org_scilab_modules_renderer_arcDrawing::ArcLineDrawerGL Class Reference

#include </home/scilab/compilation_chain/sci_checkOut/scilab/modules/renderer/src/jni/ArcLineDrawerGL.hxx>


Public Member Functions

 ArcLineDrawerGL (JavaVM *jvm_)
 ArcLineDrawerGL (JavaVM *jvm_, jobject JObj)
 ~ArcLineDrawerGL ()
void synchronize ()
void endSynchronize ()
void display ()
void initializeDrawing (int figureIndex)
void endDrawing ()
void show (int figureIndex)
void destroy (int parentFigureIndex)
void setFigureIndex (int figureIndex)
void setLineParameters (int lineColor, float thickness, int lineStyle)
void drawArc (double centerX, double centerY, double centerZ, double semiMinorAxisX, double semiMinorAxisY, double semiMinorAxisZ, double semiMajorAxisX, double semiMajorAxisY, double semiMajorAxisZ, double startAngle, double endAngle)
void redrawArc ()
void setUseNurbs (bool useNurbs)

Static Public Member Functions

static const std::string className ()

Private Member Functions

JNIEnv * getCurrentEnv ()

Private Attributes

JavaVM * jvm
jobject instance
jclass instanceClass
jmethodID voiddisplayID
jmethodID voidinitializeDrawingjintID
jmethodID voidendDrawingID
jmethodID voidshowjintID
jmethodID voiddestroyjintID
jmethodID voidsetFigureIndexjintID
jmethodID voidsetLineParametersjintjfloatjintID
jmethodID voiddrawArcjdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoubleID
jmethodID voidredrawArcID
jmethodID voidsetUseNurbsjbooleanID


Detailed Description

Definition at line 51 of file ArcLineDrawerGL.hxx.


Constructor & Destructor Documentation

org_scilab_modules_renderer_arcDrawing::ArcLineDrawerGL::ArcLineDrawerGL ( JavaVM *  jvm_  ) 

Create a wrapping of the object from a JNIEnv. It will call the default constructor

Parameters:
JEnv_ the Java Env

Definition at line 59 of file ArcLineDrawerGL.cpp.

References className(), getCurrentEnv(), instance, instanceClass, jvm, NULL, voiddestroyjintID, voiddisplayID, voiddrawArcjdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoubleID, voidendDrawingID, voidinitializeDrawingjintID, voidredrawArcID, voidsetFigureIndexjintID, voidsetLineParametersjintjfloatjintID, voidsetUseNurbsjbooleanID, and voidshowjintID.

00059                                               {
00060 jmethodID constructObject = NULL ;
00061 jobject localInstance ;
00062 jclass localClass ;
00063 const std::string construct="<init>";
00064 const std::string param="()V";
00065 jvm=jvm_;
00066 
00067 JNIEnv * curEnv = getCurrentEnv();
00068 
00069 localClass = curEnv->FindClass( this->className().c_str() ) ;
00070 if (localClass == NULL) {
00071   throw GiwsException::JniClassNotFoundException(curEnv, this->className());
00072 }
00073 
00074 this->instanceClass = (jclass) curEnv->NewGlobalRef(localClass) ;
00075 
00076 /* localClass is not needed anymore */
00077 curEnv->DeleteLocalRef(localClass);
00078 
00079 if (this->instanceClass == NULL) {
00080 throw GiwsException::JniObjectCreationException(curEnv, this->className());
00081 }
00082 
00083 
00084 constructObject = curEnv->GetMethodID( this->instanceClass, construct.c_str() , param.c_str() ) ;
00085 if(constructObject == NULL){
00086 throw GiwsException::JniObjectCreationException(curEnv, this->className());
00087 }
00088 
00089 localInstance = curEnv->NewObject( this->instanceClass, constructObject ) ;
00090 if(localInstance == NULL){
00091 throw GiwsException::JniObjectCreationException(curEnv, this->className());
00092 }
00093  
00094 this->instance = curEnv->NewGlobalRef(localInstance) ;
00095 if(this->instance == NULL){
00096 throw GiwsException::JniObjectCreationException(curEnv, this->className());
00097 }
00098 /* localInstance not needed anymore */
00099 curEnv->DeleteLocalRef(localInstance);
00100 
00101                 /* Methods ID set to NULL */
00102 voiddisplayID=NULL; 
00103 voidinitializeDrawingjintID=NULL; 
00104 voidendDrawingID=NULL; 
00105 voidshowjintID=NULL; 
00106 voiddestroyjintID=NULL; 
00107 voidsetFigureIndexjintID=NULL; 
00108 voidsetLineParametersjintjfloatjintID=NULL; 
00109 voiddrawArcjdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoubleID=NULL; 
00110 voidredrawArcID=NULL; 
00111 voidsetUseNurbsjbooleanID=NULL; 
00112 
00113 
00114 }

Here is the call graph for this function:

org_scilab_modules_renderer_arcDrawing::ArcLineDrawerGL::ArcLineDrawerGL ( JavaVM *  jvm_,
jobject  JObj 
)

Create a wrapping of an already existing object from a JNIEnv. The object must have already been instantiated

Parameters:
JEnv_ the Java Env
JObj the object

Definition at line 116 of file ArcLineDrawerGL.cpp.

References className(), getCurrentEnv(), instance, instanceClass, jvm, NULL, voiddestroyjintID, voiddisplayID, voiddrawArcjdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoubleID, voidendDrawingID, voidinitializeDrawingjintID, voidredrawArcID, voidsetFigureIndexjintID, voidsetLineParametersjintjfloatjintID, voidsetUseNurbsjbooleanID, and voidshowjintID.

00116                                                             {
00117         jvm=jvm_;
00118 
00119         JNIEnv * curEnv = getCurrentEnv();
00120 
00121 jclass localClass = curEnv->GetObjectClass(JObj);
00122         this->instanceClass = (jclass) curEnv->NewGlobalRef(localClass);
00123         curEnv->DeleteLocalRef(localClass);
00124 
00125         if (this->instanceClass == NULL) {
00126 throw GiwsException::JniObjectCreationException(curEnv, this->className());
00127         }
00128 
00129         this->instance = curEnv->NewGlobalRef(JObj) ;
00130         if(this->instance == NULL){
00131 throw GiwsException::JniObjectCreationException(curEnv, this->className());
00132         }
00133         /* Methods ID set to NULL */
00134         voiddisplayID=NULL; 
00135 voidinitializeDrawingjintID=NULL; 
00136 voidendDrawingID=NULL; 
00137 voidshowjintID=NULL; 
00138 voiddestroyjintID=NULL; 
00139 voidsetFigureIndexjintID=NULL; 
00140 voidsetLineParametersjintjfloatjintID=NULL; 
00141 voiddrawArcjdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoubleID=NULL; 
00142 voidredrawArcID=NULL; 
00143 voidsetUseNurbsjbooleanID=NULL; 
00144 
00145 
00146 }

Here is the call graph for this function:

org_scilab_modules_renderer_arcDrawing::ArcLineDrawerGL::~ArcLineDrawerGL (  ) 

Definition at line 50 of file ArcLineDrawerGL.cpp.

References instance, instanceClass, jvm, and NULL.

00050                                   {
00051 JNIEnv * curEnv = NULL;
00052 this->jvm->AttachCurrentThread((void **) &curEnv, NULL);
00053 
00054 curEnv->DeleteGlobalRef(this->instance);
00055 curEnv->DeleteGlobalRef(this->instanceClass);
00056 }


Member Function Documentation

JNIEnv * org_scilab_modules_renderer_arcDrawing::ArcLineDrawerGL::getCurrentEnv (  )  [private]

Get the environment matching to the current thread.

Definition at line 43 of file ArcLineDrawerGL.cpp.

References jvm, and NULL.

Referenced by ArcLineDrawerGL(), destroy(), display(), drawArc(), endDrawing(), endSynchronize(), initializeDrawing(), redrawArc(), setFigureIndex(), setLineParameters(), setUseNurbs(), show(), and synchronize().

00043                                         {
00044 JNIEnv * curEnv = NULL;
00045 this->jvm->AttachCurrentThread((void **) &curEnv, NULL);
00046 return curEnv;
00047 }

Here is the caller graph for this function:

void org_scilab_modules_renderer_arcDrawing::ArcLineDrawerGL::synchronize (  ) 

Enter monitor associated with the object. Equivalent of creating a "synchronized(obj)" scope in Java.

Definition at line 151 of file ArcLineDrawerGL.cpp.

References getCurrentEnv(), and instance.

00151                                   {
00152 if (getCurrentEnv()->MonitorEnter(instance) != JNI_OK) {
00153 std::cerr << "Fail to enter monitor." << std::endl;
00154 exit(EXIT_FAILURE);
00155 }
00156 }

Here is the call graph for this function:

void org_scilab_modules_renderer_arcDrawing::ArcLineDrawerGL::endSynchronize (  ) 

Exit monitor associated with the object. Equivalent of ending a "synchronized(obj)" scope.

Definition at line 159 of file ArcLineDrawerGL.cpp.

References getCurrentEnv(), and instance.

00159                                      {
00160 if ( getCurrentEnv()->MonitorExit(instance) != JNI_OK) {
00161 std::cerr << "Fail to exit monitor." << std::endl;
00162 exit(EXIT_FAILURE);
00163 }
00164 }

Here is the call graph for this function:

void org_scilab_modules_renderer_arcDrawing::ArcLineDrawerGL::display ( void   ) 

Definition at line 168 of file ArcLineDrawerGL.cpp.

References getCurrentEnv(), instance, instanceClass, NULL, and voiddisplayID.

Referenced by sciGraphics::ArcLineDrawerJavaMapper::display().

00168                               {
00169 
00170 JNIEnv * curEnv = getCurrentEnv();
00171 
00172 if (voiddisplayID==NULL) { /* Use the cache Luke */ voiddisplayID = curEnv->GetMethodID(this->instanceClass, "display", "()V" ) ;
00173 if (voiddisplayID == NULL) {
00174 throw GiwsException::JniMethodNotFoundException(curEnv, "display");
00175 }
00176 }
00177                          curEnv->CallVoidMethod( this->instance, voiddisplayID );
00178                         if (curEnv->ExceptionCheck()) {
00179 throw GiwsException::JniCallMethodException(curEnv);
00180 }
00181 }

Here is the call graph for this function:

Here is the caller graph for this function:

void org_scilab_modules_renderer_arcDrawing::ArcLineDrawerGL::initializeDrawing ( int  figureIndex  ) 

Definition at line 183 of file ArcLineDrawerGL.cpp.

References getCurrentEnv(), instance, instanceClass, NULL, and voidinitializeDrawingjintID.

Referenced by sciGraphics::ArcLineDrawerJavaMapper::initializeDrawing().

00183                                                        {
00184 
00185 JNIEnv * curEnv = getCurrentEnv();
00186 
00187 if (voidinitializeDrawingjintID==NULL) { /* Use the cache Luke */ voidinitializeDrawingjintID = curEnv->GetMethodID(this->instanceClass, "initializeDrawing", "(I)V" ) ;
00188 if (voidinitializeDrawingjintID == NULL) {
00189 throw GiwsException::JniMethodNotFoundException(curEnv, "initializeDrawing");
00190 }
00191 }
00192                          curEnv->CallVoidMethod( this->instance, voidinitializeDrawingjintID ,figureIndex);
00193                         if (curEnv->ExceptionCheck()) {
00194 throw GiwsException::JniCallMethodException(curEnv);
00195 }
00196 }

Here is the call graph for this function:

Here is the caller graph for this function:

void org_scilab_modules_renderer_arcDrawing::ArcLineDrawerGL::endDrawing ( void   ) 

Definition at line 198 of file ArcLineDrawerGL.cpp.

References getCurrentEnv(), instance, instanceClass, NULL, and voidendDrawingID.

Referenced by sciGraphics::ArcLineDrawerJavaMapper::endDrawing().

00198                                  {
00199 
00200 JNIEnv * curEnv = getCurrentEnv();
00201 
00202 if (voidendDrawingID==NULL) { /* Use the cache Luke */ voidendDrawingID = curEnv->GetMethodID(this->instanceClass, "endDrawing", "()V" ) ;
00203 if (voidendDrawingID == NULL) {
00204 throw GiwsException::JniMethodNotFoundException(curEnv, "endDrawing");
00205 }
00206 }
00207                          curEnv->CallVoidMethod( this->instance, voidendDrawingID );
00208                         if (curEnv->ExceptionCheck()) {
00209 throw GiwsException::JniCallMethodException(curEnv);
00210 }
00211 }

Here is the call graph for this function:

Here is the caller graph for this function:

void org_scilab_modules_renderer_arcDrawing::ArcLineDrawerGL::show ( int  figureIndex  ) 

Definition at line 213 of file ArcLineDrawerGL.cpp.

References getCurrentEnv(), instance, instanceClass, NULL, and voidshowjintID.

Referenced by sciGraphics::ArcLineDrawerJavaMapper::show().

00213                                           {
00214 
00215 JNIEnv * curEnv = getCurrentEnv();
00216 
00217 if (voidshowjintID==NULL) { /* Use the cache Luke */ voidshowjintID = curEnv->GetMethodID(this->instanceClass, "show", "(I)V" ) ;
00218 if (voidshowjintID == NULL) {
00219 throw GiwsException::JniMethodNotFoundException(curEnv, "show");
00220 }
00221 }
00222                          curEnv->CallVoidMethod( this->instance, voidshowjintID ,figureIndex);
00223                         if (curEnv->ExceptionCheck()) {
00224 throw GiwsException::JniCallMethodException(curEnv);
00225 }
00226 }

Here is the call graph for this function:

Here is the caller graph for this function:

void org_scilab_modules_renderer_arcDrawing::ArcLineDrawerGL::destroy ( int  parentFigureIndex  ) 

Definition at line 228 of file ArcLineDrawerGL.cpp.

References getCurrentEnv(), instance, instanceClass, NULL, and voiddestroyjintID.

Referenced by sciGraphics::ArcLineDrawerJavaMapper::destroy().

00228                                                    {
00229 
00230 JNIEnv * curEnv = getCurrentEnv();
00231 
00232 if (voiddestroyjintID==NULL) { /* Use the cache Luke */ voiddestroyjintID = curEnv->GetMethodID(this->instanceClass, "destroy", "(I)V" ) ;
00233 if (voiddestroyjintID == NULL) {
00234 throw GiwsException::JniMethodNotFoundException(curEnv, "destroy");
00235 }
00236 }
00237                          curEnv->CallVoidMethod( this->instance, voiddestroyjintID ,parentFigureIndex);
00238                         if (curEnv->ExceptionCheck()) {
00239 throw GiwsException::JniCallMethodException(curEnv);
00240 }
00241 }

Here is the call graph for this function:

Here is the caller graph for this function:

void org_scilab_modules_renderer_arcDrawing::ArcLineDrawerGL::setFigureIndex ( int  figureIndex  ) 

Definition at line 243 of file ArcLineDrawerGL.cpp.

References getCurrentEnv(), instance, instanceClass, NULL, and voidsetFigureIndexjintID.

Referenced by sciGraphics::ArcLineDrawerJavaMapper::setFigureIndex().

00243                                                     {
00244 
00245 JNIEnv * curEnv = getCurrentEnv();
00246 
00247 if (voidsetFigureIndexjintID==NULL) { /* Use the cache Luke */ voidsetFigureIndexjintID = curEnv->GetMethodID(this->instanceClass, "setFigureIndex", "(I)V" ) ;
00248 if (voidsetFigureIndexjintID == NULL) {
00249 throw GiwsException::JniMethodNotFoundException(curEnv, "setFigureIndex");
00250 }
00251 }
00252                          curEnv->CallVoidMethod( this->instance, voidsetFigureIndexjintID ,figureIndex);
00253                         if (curEnv->ExceptionCheck()) {
00254 throw GiwsException::JniCallMethodException(curEnv);
00255 }
00256 }

Here is the call graph for this function:

Here is the caller graph for this function:

void org_scilab_modules_renderer_arcDrawing::ArcLineDrawerGL::setLineParameters ( int  lineColor,
float  thickness,
int  lineStyle 
)

Definition at line 258 of file ArcLineDrawerGL.cpp.

References getCurrentEnv(), instance, instanceClass, NULL, and voidsetLineParametersjintjfloatjintID.

Referenced by sciGraphics::ArcLineDrawerJavaMapper::setLineParameters().

00258                                                                                      {
00259 
00260 JNIEnv * curEnv = getCurrentEnv();
00261 
00262 if (voidsetLineParametersjintjfloatjintID==NULL) { /* Use the cache Luke */ voidsetLineParametersjintjfloatjintID = curEnv->GetMethodID(this->instanceClass, "setLineParameters", "(IFI)V" ) ;
00263 if (voidsetLineParametersjintjfloatjintID == NULL) {
00264 throw GiwsException::JniMethodNotFoundException(curEnv, "setLineParameters");
00265 }
00266 }
00267                          curEnv->CallVoidMethod( this->instance, voidsetLineParametersjintjfloatjintID ,lineColor, thickness, lineStyle);
00268                         if (curEnv->ExceptionCheck()) {
00269 throw GiwsException::JniCallMethodException(curEnv);
00270 }
00271 }

Here is the call graph for this function:

Here is the caller graph for this function:

void org_scilab_modules_renderer_arcDrawing::ArcLineDrawerGL::drawArc ( double  centerX,
double  centerY,
double  centerZ,
double  semiMinorAxisX,
double  semiMinorAxisY,
double  semiMinorAxisZ,
double  semiMajorAxisX,
double  semiMajorAxisY,
double  semiMajorAxisZ,
double  startAngle,
double  endAngle 
)

Definition at line 273 of file ArcLineDrawerGL.cpp.

References getCurrentEnv(), instance, instanceClass, NULL, and voiddrawArcjdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoubleID.

Referenced by sciGraphics::ArcLineDrawerJavaMapper::drawArc().

00273                                                                                                                                                                                                                                                           {
00274 
00275 JNIEnv * curEnv = getCurrentEnv();
00276 
00277 if (voiddrawArcjdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoubleID==NULL) { /* Use the cache Luke */ voiddrawArcjdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoubleID = curEnv->GetMethodID(this->instanceClass, "drawArc", "(DDDDDDDDDDD)V" ) ;
00278 if (voiddrawArcjdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoubleID == NULL) {
00279 throw GiwsException::JniMethodNotFoundException(curEnv, "drawArc");
00280 }
00281 }
00282                          curEnv->CallVoidMethod( this->instance, voiddrawArcjdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoublejdoubleID ,centerX, centerY, centerZ, semiMinorAxisX, semiMinorAxisY, semiMinorAxisZ, semiMajorAxisX, semiMajorAxisY, semiMajorAxisZ, startAngle, endAngle);
00283                         if (curEnv->ExceptionCheck()) {
00284 throw GiwsException::JniCallMethodException(curEnv);
00285 }
00286 }

Here is the call graph for this function:

Here is the caller graph for this function:

void org_scilab_modules_renderer_arcDrawing::ArcLineDrawerGL::redrawArc ( void   ) 

Definition at line 288 of file ArcLineDrawerGL.cpp.

References getCurrentEnv(), instance, instanceClass, NULL, and voidredrawArcID.

Referenced by sciGraphics::ArcLineDrawerJavaMapper::redrawArc().

00288                                 {
00289 
00290 JNIEnv * curEnv = getCurrentEnv();
00291 
00292 if (voidredrawArcID==NULL) { /* Use the cache Luke */ voidredrawArcID = curEnv->GetMethodID(this->instanceClass, "redrawArc", "()V" ) ;
00293 if (voidredrawArcID == NULL) {
00294 throw GiwsException::JniMethodNotFoundException(curEnv, "redrawArc");
00295 }
00296 }
00297                          curEnv->CallVoidMethod( this->instance, voidredrawArcID );
00298                         if (curEnv->ExceptionCheck()) {
00299 throw GiwsException::JniCallMethodException(curEnv);
00300 }
00301 }

Here is the call graph for this function:

Here is the caller graph for this function:

void org_scilab_modules_renderer_arcDrawing::ArcLineDrawerGL::setUseNurbs ( bool  useNurbs  ) 

Definition at line 303 of file ArcLineDrawerGL.cpp.

References bool, getCurrentEnv(), instance, instanceClass, NULL, and voidsetUseNurbsjbooleanID.

Referenced by sciGraphics::ArcLineDrawerJavaMapper::setUseNurbs().

00303                                                {
00304 
00305 JNIEnv * curEnv = getCurrentEnv();
00306 
00307 if (voidsetUseNurbsjbooleanID==NULL) { /* Use the cache Luke */ voidsetUseNurbsjbooleanID = curEnv->GetMethodID(this->instanceClass, "setUseNurbs", "(Z)V" ) ;
00308 if (voidsetUseNurbsjbooleanID == NULL) {
00309 throw GiwsException::JniMethodNotFoundException(curEnv, "setUseNurbs");
00310 }
00311 }
00312 jboolean useNurbs_ = ((bool) useNurbs ? JNI_TRUE : JNI_FALSE);
00313 
00314                          curEnv->CallVoidMethod( this->instance, voidsetUseNurbsjbooleanID ,useNurbs_);
00315                         if (curEnv->ExceptionCheck()) {
00316 throw GiwsException::JniCallMethodException(curEnv);
00317 }
00318 }

Here is the call graph for this function:

Here is the caller graph for this function:

static const std::string org_scilab_modules_renderer_arcDrawing::ArcLineDrawerGL::className (  )  [inline, static]

Get class name to use for static methods

Returns:
class name to use for static methods

Definition at line 134 of file ArcLineDrawerGL.hxx.

Referenced by ArcLineDrawerGL().

00135                 {
00136                 return "org/scilab/modules/renderer/arcDrawing/ArcLineDrawerGL";
00137                 }

Here is the caller graph for this function:


Field Documentation

Definition at line 53 of file ArcLineDrawerGL.hxx.

Referenced by ArcLineDrawerGL(), getCurrentEnv(), and ~ArcLineDrawerGL().

Definition at line 57 of file ArcLineDrawerGL.hxx.

Referenced by ArcLineDrawerGL(), and display().

Definition at line 58 of file ArcLineDrawerGL.hxx.

Referenced by ArcLineDrawerGL(), and initializeDrawing().

Definition at line 59 of file ArcLineDrawerGL.hxx.

Referenced by ArcLineDrawerGL(), and endDrawing().

Definition at line 60 of file ArcLineDrawerGL.hxx.

Referenced by ArcLineDrawerGL(), and show().

Definition at line 61 of file ArcLineDrawerGL.hxx.

Referenced by ArcLineDrawerGL(), and destroy().

Definition at line 62 of file ArcLineDrawerGL.hxx.

Referenced by ArcLineDrawerGL(), and setFigureIndex().