01: //---------------------------------------------------------------------------//
02: // $Id: PLStreamc.java,v 1.1 2004/12/27 04:41:50 solent Exp $
03: //
04: // Copyright (C) 2004 Alan W. Irwin
05: //
06: // This file is part of PLplot.
07: //
08: // PLplot is free software; you can redistribute it and/or modify
09: // it under the terms of the GNU General Library Public License as published
10: // by the Free Software Foundation; either version 2 of the License, or
11: // (at your option) any later version.
12: //
13: // PLplot is distributed in the hope that it will be useful,
14: // but WITHOUT ANY WARRANTY; without even the implied warranty of
15: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16: // GNU Library General Public License for more details.
17: //
18: // You should have received a copy of the GNU Library General Public License
19: // along with PLplot; if not, write to the Free Software
20: // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21: //
22: // This file implements the core Java side of the Java->PLplot interface, by
23: // providing a Java class PLStreamc, which is intended to mirror the C
24: // PLStream of PLplot. However, we go further here in Java than we were able
25: // to do in C, by actually making the PLplot API entry points methods of this
26: // stream class. Thus, to plot to a stream in Java, you just instantiate the
27: // stream, and invoke PLplot API services upon it. This is basically what we
28: // have tried to do in the bindings to other object oriented environments,
29: // such as C++ and the Tcl/Tk and Python/Tk widget contexts. A stream
30: // represents sort of a "drawable" abstraction, and the PLplot API gets the
31: // drawing done on the identified stream. In C you have to swtich the stream
32: // explicitly with the plsstrm function, but in Java you just invoke the API
33: // function on the approrpiate stream object.
34: //---------------------------------------------------------------------------//
35:
36: package test.plplot.core;
37:
38: public class PLStreamc {
39:
40: // Methods needed for the implementation of PLStreamc, but not suitable for
41: // the public interface.
42: // native int mkstrm();
43:
44: // Static code block to get the PLplot java wrapper dynamic library loaded in.
45: static {
46: try {
47: System.loadLibrary(config.libname);
48: } catch (UnsatisfiedLinkError e) {
49: System.err
50: .println("Native code library failed to load. See the chapter on Dynamic Linking Problems in the SWIG Java documentation for help.\n"
51: + e);
52: System.exit(1);
53: }
54: }
55:
56: // Class data.
57: int stream_id;
58:
59: // Now comes stuff we need done in Java.
60: public PLStreamc() {
61: // stream_id = mkstrm();
62: // stream_id = plmkstrm();
63: }
64:
65: // public int get_stream_id() { return stream_id; }
66: }
67:
68: //---------------------------------------------------------------------------//
69: // End of PLStreamc.java
70: //---------------------------------------------------------------------------//
|