1 /* Generated by GIWS (version 2.0.2) with command:
2 giws --disable-return-size-array --output-dir src\jni --throws-exception-on-error --description-file src\jni\builder.giws.xml
3 */
4 /*
5
6 This is generated code.
7
8 This software is a computer program whose purpose is to hide the complexity
9 of accessing Java objects/methods from C++ code.
10
11 Copyright (C) 2012 - 2016 - Scilab Enterprises
12
13 This file is hereby licensed under the terms of the GNU GPL v2.0,
14 pursuant to article 5.3.4 of the CeCILL v.2.1.
15 This file was originally licensed under the terms of the CeCILL v2.1,
16 and continues to be available under such terms.
17 For more information, see the COPYING file which you should have received
18 along with this program.
19 */
20
21
22 #ifndef __ORG_SCILAB_MODULES_GRAPHIC_OBJECTS_BUILDER_BUILDER__
23 #define __ORG_SCILAB_MODULES_GRAPHIC_OBJECTS_BUILDER_BUILDER__
24 #include <iostream>
25 #include <string>
26 #include <string.h>
27 #include <stdlib.h>
28 #include <jni.h>
29
30 #include "GiwsException.hxx"
31
32 #if defined(_MSC_VER) /* Defined anyway with Visual */
33 #include <Windows.h>
34 #else
35 typedef signed char byte;
36 #endif
37
38
39 #ifndef GIWSEXPORT
40 # if defined(_MSC_VER) || defined(__WIN32__) || defined(__CYGWIN__)
41 # if defined(STATIC_LINKED)
42 # define GIWSEXPORT
43 # else
44 # define GIWSEXPORT __declspec(dllexport)
45 # endif
46 # else
47 # if __GNUC__ >= 4
48 # define GIWSEXPORT __attribute__ ((visibility ("default")))
49 # else
50 # define GIWSEXPORT
51 # endif
52 # endif
53 #endif
54
55 namespace org_scilab_modules_graphic_objects_builder {
56 class GIWSEXPORT Builder {
57
58 private:
59 JavaVM * jvm;
60
61 protected:
62 jmethodID jintcreateRectjintintjdoubledoublejdoubledoublejdoubledoublejdoubledoublejintintjintintjintintjintintID; // cache method id
63 jmethodID jintcloneGraphicContextjintintjintintID; // cache method id
64 jmethodID jintcloneFontContextjintintjintintID; // cache method id
65 jmethodID jintcreateHiddenLabeljintintID; // cache method id
66 jmethodID jbooleanisAxesRedrawingjintintID; // cache method id
67 jmethodID jintcreateLabeljintintjintintID; // cache method id
68 jmethodID jintcreateNewFigureWithAxesID; // cache method id
69 jmethodID jintcreateFigurejbooleanbooleanjintintjintintjbooleanbooleanjbooleanbooleanID; // cache method id
70 jmethodID voidcloneMenusjintintjintintID; // cache method id
71 jmethodID jintcloneAxesModeljintintID; // cache method id
72 jmethodID jintcreateSubWinjintintID; // cache method id
73 jmethodID jintcreateTextjintintjobjectArray_java_lang_Stringjava_lang_StringjintintjintintjdoubledoublejdoubledoublejbooleanbooleanjdoubleArray_doubledoublejintintjintintjbooleanbooleanjintintjbooleanbooleanjbooleanbooleanjbooleanbooleanjbooleanbooleanjintintID; // cache method id
74 jclass stringArrayClass;
75 jmethodID jintcreateArcjintintjdoubledoublejdoubledoublejdoubledoublejdoubledoublejdoubledoublejdoubledoublejintintjbooleanbooleanjintintjbooleanbooleanjbooleanbooleanjbooleanbooleanID; // cache method id
76 jmethodID jintcreateAxisjintintjintintjintintjdoubleArray_doubledoublejdoubleArray_doubledoublejintintjstringjava_lang_StringjintintjintintjintintjbooleanbooleanID; // cache method id
77 jmethodID jintcreateCompoundjintintjintArray_intintID; // cache method id
78 jmethodID jintcreateCompoundSeqjintintjintintID; // cache method id
79 jmethodID jintcreateFecjintintjdoubleArray_doubledoublejintArray_intintjintArray_intintjbooleanbooleanID; // cache method id
80 jmethodID jintcreateGrayplotjintintjintintjdoubleArray_doubledoublejintintjintintID; // cache method id
81 jmethodID jintcreatePolylinejintintjbooleanbooleanjintintjintintjbooleanbooleanjintArray_intintjintintjbooleanbooleanjintintjbooleanbooleanjintintjbooleanbooleanjbooleanbooleanjbooleanbooleanjbooleanbooleanjbooleanbooleanID; // cache method id
82 jmethodID jintcreateLegendjintintjobjectArray_java_lang_Stringjava_lang_StringjintArray_intintID; // cache method id
83 jmethodID jintcreateSegsjintintjdoubleArray_doubledoublejdoubleArray_doubledoublejdoubleArray_doubledoublejbooleanbooleanjintArray_intintjdoubledoubleID; // cache method id
84 jmethodID jintcreateChampjintintjdoubleArray_doubledoublejdoubleArray_doubledoublejdoubleArray_doubledoublejdoubleArray_doubledoublejdoubledoublejbooleanbooleanID; // cache method id
85 jmethodID jintcreateSurfacejintintjintintjintintjintintID; // cache method id
86 jmethodID voidinitSubWinTo3djintintjstringjava_lang_StringjbooleanbooleanjintArray_intintjdoubledoublejdoubledoublejdoubleArray_doubledoublejdoubleArray_doubledoublejdoubleArray_doubledoublejdoubleArray_doubledoubleID; // cache method id
87 jmethodID jintcreateLightjintintjintintjbooleanbooleanjdoubleArray_doubledoublejdoubleArray_doubledoublejdoubleArray_doubledoublejdoubleArray_doubledoublejdoubleArray_doubledoubleID; // cache method id
88
89
90
91 jobject instance;
92 jclass instanceClass; // cache class
93
94
95 // Caching (if any)
96
97
98 /**
99 * Get the environment matching to the current thread.
100 */
101 virtual JNIEnv * getCurrentEnv();
102
103 public:
104 // Constructor
105 /**
106 * Create a wrapping of the object from a JNIEnv.
107 * It will call the default constructor
108 * @param JEnv_ the Java Env
109 */
110 Builder(JavaVM * jvm_);
111
112 /**
113 * Create a wrapping of an already existing object from a JNIEnv.
114 * The object must have already been instantiated
115 * @param JEnv_ the Java Env
116 * @param JObj the object
117 */
118 Builder(JavaVM * jvm_, jobject JObj);
119
120
121 /**
122 * This is a fake constructor to avoid the constructor
123 * chaining when dealing with extended giws classes
124 */
125 #ifdef FAKEGIWSDATATYPE
Builder(fakeGiwsDataType::fakeGiwsDataType)126 Builder(fakeGiwsDataType::fakeGiwsDataType /* unused */) {}
127 #endif
128
129 // Destructor
130 ~Builder();
131
132 // Generic method
133 // Synchronization methods
134 /**
135 * Enter monitor associated with the object.
136 * Equivalent of creating a "synchronized(obj)" scope in Java.
137 */
138 void synchronize();
139
140 /**
141 * Exit monitor associated with the object.
142 * Equivalent of ending a "synchronized(obj)" scope.
143 */
144 void endSynchronize();
145
146 // Methods
147 static int createRect(JavaVM * jvm_, int pparentsubwinUID, double x, double y, double height, double width, int foreground, int background, int isfilled, int isline);
148
149 static int cloneGraphicContext(JavaVM * jvm_, int sourceIdentifier, int destIdentifier);
150
151 static int cloneFontContext(JavaVM * jvm_, int sourceIdentifier, int destIdentifier);
152
153 static int createHiddenLabel(JavaVM * jvm_, int parent);
154
155 static bool isAxesRedrawing(JavaVM * jvm_, int subWin);
156
157 static int createLabel(JavaVM * jvm_, int parent, int type);
158
159 static int createNewFigureWithAxes(JavaVM * jvm_);
160
161 static int createFigure(JavaVM * jvm_, bool dockable, int menubarType, int toolbarType, bool defaultAxes, bool visible);
162
163 static void cloneMenus(JavaVM * jvm_, int model, int newParent);
164
165 static int cloneAxesModel(JavaVM * jvm_, int parent);
166
167 static int createSubWin(JavaVM * jvm_, int parent);
168
169 static int createText(JavaVM * jvm_, int parent, char const* const* text, int textSize, int rows, int cols, double x, double y, bool autoSize, double const* userSize, int userSizeSize, int centerPos, int foreground, bool isForeground, int background, bool isBackground, bool boxed, bool line, bool filled, int align);
170
171 static int createArc(JavaVM * jvm_, int parent, double x, double y, double h, double w, double start, double end, int foreground, bool isForeground, int background, bool isBackground, bool filled, bool line);
172
173 static int createAxis(JavaVM * jvm_, int parent, int dir, int tics, double const* vx, int vxSize, double const* vy, int vySize, int subint, char const* format, int fontSize, int textColor, int ticsColor, bool seg);
174
175 static int createCompound(JavaVM * jvm_, int parent, int const* children, int childrenSize);
176
177 static int createCompoundSeq(JavaVM * jvm_, int parent, int childrenCount);
178
179 static int createFec(JavaVM * jvm_, int parent, double const* zminmax, int zminmaxSize, int const* colminmax, int colminmaxSize, int const* colout, int coloutSize, bool with_mesh);
180
181 static int createGrayplot(JavaVM * jvm_, int parent, int type, double const* pvecx, int pvecxSize, int n1, int n2);
182
183 static int createPolyline(JavaVM * jvm_, int parent, bool closed, int plot, int foreground, bool isForeground, int const* background, int backgroundSize, int mark_style, bool isMarkStyle, int mark_foreground, bool isMarkForeground, int mark_background, bool isMarkBackground, bool isline, bool isfilled, bool ismark, bool isinterp);
184
185 static int createLegend(JavaVM * jvm_, int parent, char const* const* text, int textSize, int const* handles, int handlesSize);
186
187 static int createSegs(JavaVM * jvm_, int parent, double const* vx, int vxSize, double const* vy, int vySize, double const* vz, int vzSize, bool isVZ, int const* style, int styleSize, double arsize);
188
189 static int createChamp(JavaVM * jvm_, int parent, double const* vx, int vxSize, double const* vy, int vySize, double const* vfx, int vfxSize, double const* vfy, int vfySize, double arsize, bool typeofchamp);
190
191 static int createSurface(JavaVM * jvm_, int parent, int typeof3d, int colorFlag, int colorMode);
192
193 static void initSubWinTo3d(JavaVM * jvm_, int parent, char const* legend, bool isLegend, int const* flag, int flagSize, double alpha, double theta, double const* ebox, int eboxSize, double const* x, int xSize, double const* y, int ySize, double const* z, int zSize);
194
195 static int createLight(JavaVM * jvm_, int parent, int type, bool visible, double const* pos, int posSize, double const* dir, int dirSize, double const* ambient, int ambientSize, double const* diffuse, int diffuseSize, double const* specular, int specularSize);
196
197
198 /**
199 * Get class name to use for static methods
200 * @return class name to use for static methods
201 */
202
className()203 static const std::string className()
204 {
205 return "org/scilab/modules/graphic_objects/builder/Builder";
206 }
207
208
209 /**
210 * Get class to use for static methods
211 * @return class to use for static methods
212 */
213
initClass(JNIEnv * curEnv)214 static jclass initClass(JNIEnv * curEnv)
215 {
216 static jclass cls = 0;
217
218 if (cls == 0)
219 {
220 jclass _cls = curEnv->FindClass(className().c_str());
221 if (_cls)
222 {
223 cls = static_cast<jclass>(curEnv->NewGlobalRef(_cls));
224 }
225 }
226
227 return cls;
228 }
229
230 };
231
232
233 }
234 #endif
235