Adjusting testing cases for current state of OCCT
[occt.git] / samples / java / drv / SampleHLRJni / SampleHLRJni_Aspect_Driver_java.cxx
1 //
2 //                     Copyright (C) 1991 - 2000 by  
3 //                      Matra Datavision SA.  All rights reserved.
4 //  
5 //                     Copyright (C) 2001 - 2004 by
6 //                     Open CASCADE SA.  All rights reserved.
7 // 
8 // This file is part of the Open CASCADE Technology software.
9 //
10 // This software may be distributed and/or modified under the terms and
11 // conditions of the Open CASCADE Public License as defined by Open CASCADE SA
12 // and appearing in the file LICENSE included in the packaging of this file.
13 //  
14 // This software is distributed on an "AS IS" basis, without warranty of any
15 // kind, and Open CASCADE SA hereby disclaims all such warranties,
16 // including without limitation, any warranties of merchantability, fitness
17 // for a particular purpose or non-infringement. Please see the License for
18 // the specific terms and conditions governing rights and limitations under the
19 // License.
20
21 #include <SampleHLRJni_Aspect_Driver.h>
22 #include <Aspect_Driver.hxx>
23 #include <jcas.hxx>
24 #include <stdlib.h>
25 #include <Standard_ErrorHandler.hxx>
26 #include <Standard_Failure.hxx>
27 #include <Standard_SStream.hxx>
28
29 #include <Standard_Boolean.hxx>
30 #include <Aspect_ColorMap.hxx>
31 #include <Aspect_TypeMap.hxx>
32 #include <Aspect_WidthMap.hxx>
33 #include <Aspect_FontMap.hxx>
34 #include <Aspect_MarkMap.hxx>
35 #include <Standard_Integer.hxx>
36 #include <Standard_Real.hxx>
37 #include <Standard_Transient.hxx>
38 #include <Standard_CString.hxx>
39 #include <Standard_ShortReal.hxx>
40 #include <TShort_Array1OfShortReal.hxx>
41 #include <TCollection_ExtendedString.hxx>
42 #include <Aspect_TypeOfText.hxx>
43
44
45 extern "C" {
46
47
48 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_EndDraw (JNIEnv *env, jobject theobj, jboolean Synchronize)
49 {
50
51 jcas_Locking alock(env);
52 {
53 try {
54 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
55 the_this->EndDraw((Standard_Boolean) Synchronize);
56
57 }
58 catch (Standard_Failure) {
59   Standard_SStream Err;
60   Err <<   Standard_Failure::Caught(); 
61   Err << (char) 0;
62   jcas_ThrowException(env,Err.str().c_str());
63 }
64 }
65 alock.Release();
66
67 }
68
69
70
71 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_SetColorMap (JNIEnv *env, jobject theobj, jobject aColorMap)
72 {
73
74 jcas_Locking alock(env);
75 {
76 try {
77  Handle( Aspect_ColorMap ) the_aColorMap;
78  void*                ptr_aColorMap = jcas_GetHandle(env,aColorMap);
79  
80  if ( ptr_aColorMap != NULL ) the_aColorMap = *(   (  Handle( Aspect_ColorMap )*  )ptr_aColorMap   );
81
82 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
83 the_this->SetColorMap(the_aColorMap);
84
85 }
86 catch (Standard_Failure) {
87   Standard_SStream Err;
88   Err <<   Standard_Failure::Caught(); 
89   Err << (char) 0;
90   jcas_ThrowException(env,Err.str().c_str());
91 }
92 }
93 alock.Release();
94
95 }
96
97
98
99 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_SetTypeMap (JNIEnv *env, jobject theobj, jobject aTypeMap)
100 {
101
102 jcas_Locking alock(env);
103 {
104 try {
105  Handle( Aspect_TypeMap ) the_aTypeMap;
106  void*                ptr_aTypeMap = jcas_GetHandle(env,aTypeMap);
107  
108  if ( ptr_aTypeMap != NULL ) the_aTypeMap = *(   (  Handle( Aspect_TypeMap )*  )ptr_aTypeMap   );
109
110 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
111 the_this->SetTypeMap(the_aTypeMap);
112
113 }
114 catch (Standard_Failure) {
115   Standard_SStream Err;
116   Err <<   Standard_Failure::Caught(); 
117   Err << (char) 0;
118   jcas_ThrowException(env,Err.str().c_str());
119 }
120 }
121 alock.Release();
122
123 }
124
125
126
127 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_SetWidthMap (JNIEnv *env, jobject theobj, jobject aWidthMap)
128 {
129
130 jcas_Locking alock(env);
131 {
132 try {
133  Handle( Aspect_WidthMap ) the_aWidthMap;
134  void*                ptr_aWidthMap = jcas_GetHandle(env,aWidthMap);
135  
136  if ( ptr_aWidthMap != NULL ) the_aWidthMap = *(   (  Handle( Aspect_WidthMap )*  )ptr_aWidthMap   );
137
138 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
139 the_this->SetWidthMap(the_aWidthMap);
140
141 }
142 catch (Standard_Failure) {
143   Standard_SStream Err;
144   Err <<   Standard_Failure::Caught(); 
145   Err << (char) 0;
146   jcas_ThrowException(env,Err.str().c_str());
147 }
148 }
149 alock.Release();
150
151 }
152
153
154
155 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_SetFontMap (JNIEnv *env, jobject theobj, jobject aFontMap, jboolean useMFT)
156 {
157
158 jcas_Locking alock(env);
159 {
160 try {
161  Handle( Aspect_FontMap ) the_aFontMap;
162  void*                ptr_aFontMap = jcas_GetHandle(env,aFontMap);
163  
164  if ( ptr_aFontMap != NULL ) the_aFontMap = *(   (  Handle( Aspect_FontMap )*  )ptr_aFontMap   );
165
166 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
167 the_this->SetFontMap(the_aFontMap,(Standard_Boolean) useMFT);
168
169 }
170 catch (Standard_Failure) {
171   Standard_SStream Err;
172   Err <<   Standard_Failure::Caught(); 
173   Err << (char) 0;
174   jcas_ThrowException(env,Err.str().c_str());
175 }
176 }
177 alock.Release();
178
179 }
180
181
182
183 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_SetMarkMap (JNIEnv *env, jobject theobj, jobject aMarkMap)
184 {
185
186 jcas_Locking alock(env);
187 {
188 try {
189  Handle( Aspect_MarkMap ) the_aMarkMap;
190  void*                ptr_aMarkMap = jcas_GetHandle(env,aMarkMap);
191  
192  if ( ptr_aMarkMap != NULL ) the_aMarkMap = *(   (  Handle( Aspect_MarkMap )*  )ptr_aMarkMap   );
193
194 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
195 the_this->SetMarkMap(the_aMarkMap);
196
197 }
198 catch (Standard_Failure) {
199   Standard_SStream Err;
200   Err <<   Standard_Failure::Caught(); 
201   Err << (char) 0;
202   jcas_ThrowException(env,Err.str().c_str());
203 }
204 }
205 alock.Release();
206
207 }
208
209
210
211 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_SetLineAttrib (JNIEnv *env, jobject theobj, jint ColorIndex, jint TypeIndex, jint WidthIndex)
212 {
213
214 jcas_Locking alock(env);
215 {
216 try {
217 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
218 the_this->SetLineAttrib((Standard_Integer) ColorIndex,(Standard_Integer) TypeIndex,(Standard_Integer) WidthIndex);
219
220 }
221 catch (Standard_Failure) {
222   Standard_SStream Err;
223   Err <<   Standard_Failure::Caught(); 
224   Err << (char) 0;
225   jcas_ThrowException(env,Err.str().c_str());
226 }
227 }
228 alock.Release();
229
230 }
231
232
233
234 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_Aspect_1Driver_1SetTextAttrib_11 (JNIEnv *env, jobject theobj, jint ColorIndex, jint FontIndex)
235 {
236
237 jcas_Locking alock(env);
238 {
239 try {
240 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
241 the_this->SetTextAttrib((Standard_Integer) ColorIndex,(Standard_Integer) FontIndex);
242
243 }
244 catch (Standard_Failure) {
245   Standard_SStream Err;
246   Err <<   Standard_Failure::Caught(); 
247   Err << (char) 0;
248   jcas_ThrowException(env,Err.str().c_str());
249 }
250 }
251 alock.Release();
252
253 }
254
255
256
257 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_Aspect_1Driver_1SetTextAttrib_12 (JNIEnv *env, jobject theobj, jint ColorIndex, jint FontIndex, jdouble aSlant, jdouble aHScale, jdouble aWScale, jboolean isUnderlined)
258 {
259
260 jcas_Locking alock(env);
261 {
262 try {
263 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
264 the_this->SetTextAttrib((Standard_Integer) ColorIndex,(Standard_Integer) FontIndex,(Quantity_PlaneAngle) aSlant,(Quantity_Factor) aHScale,(Quantity_Factor) aWScale,(Standard_Boolean) isUnderlined);
265
266 }
267 catch (Standard_Failure) {
268   Standard_SStream Err;
269   Err <<   Standard_Failure::Caught(); 
270   Err << (char) 0;
271   jcas_ThrowException(env,Err.str().c_str());
272 }
273 }
274 alock.Release();
275
276 }
277
278
279
280 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_SetPolyAttrib (JNIEnv *env, jobject theobj, jint ColorIndex, jint TileIndex, jboolean DrawEdge)
281 {
282
283 jcas_Locking alock(env);
284 {
285 try {
286 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
287 the_this->SetPolyAttrib((Standard_Integer) ColorIndex,(Standard_Integer) TileIndex,(Standard_Boolean) DrawEdge);
288
289 }
290 catch (Standard_Failure) {
291   Standard_SStream Err;
292   Err <<   Standard_Failure::Caught(); 
293   Err << (char) 0;
294   jcas_ThrowException(env,Err.str().c_str());
295 }
296 }
297 alock.Release();
298
299 }
300
301
302
303 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_SetMarkerAttrib (JNIEnv *env, jobject theobj, jint ColorIndex, jint WidthIndex, jboolean FillMarker)
304 {
305
306 jcas_Locking alock(env);
307 {
308 try {
309 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
310 the_this->SetMarkerAttrib((Standard_Integer) ColorIndex,(Standard_Integer) WidthIndex,(Standard_Boolean) FillMarker);
311
312 }
313 catch (Standard_Failure) {
314   Standard_SStream Err;
315   Err <<   Standard_Failure::Caught(); 
316   Err << (char) 0;
317   jcas_ThrowException(env,Err.str().c_str());
318 }
319 }
320 alock.Release();
321
322 }
323
324
325
326 JNIEXPORT jboolean JNICALL Java_SampleHLRJni_Aspect_1Driver_IsKnownImage (JNIEnv *env, jobject theobj, jobject anImage)
327 {
328 jboolean thejret;
329
330 jcas_Locking alock(env);
331 {
332 try {
333  Handle( Standard_Transient ) the_anImage;
334  void*                ptr_anImage = jcas_GetHandle(env,anImage);
335  
336  if ( ptr_anImage != NULL ) the_anImage = *(   (  Handle( Standard_Transient )*  )ptr_anImage   );
337
338 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
339  thejret = the_this->IsKnownImage(the_anImage);
340
341 }
342 catch (Standard_Failure) {
343   Standard_SStream Err;
344   Err <<   Standard_Failure::Caught(); 
345   Err << (char) 0;
346   jcas_ThrowException(env,Err.str().c_str());
347 }
348 }
349 alock.Release();
350 return thejret;
351 }
352
353
354
355 JNIEXPORT jboolean JNICALL Java_SampleHLRJni_Aspect_1Driver_SizeOfImageFile (JNIEnv *env, jobject theobj, jobject anImageFile, jobject aWidth, jobject aHeight)
356 {
357 jboolean thejret;
358
359 jcas_Locking alock(env);
360 {
361 try {
362 Standard_CString the_anImageFile = jcas_ConvertToCString(env,anImageFile);
363 Standard_Integer the_aWidth = jcas_GetInteger(env,aWidth);
364 Standard_Integer the_aHeight = jcas_GetInteger(env,aHeight);
365 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
366  thejret = the_this->SizeOfImageFile(the_anImageFile,the_aWidth,the_aHeight);
367 jcas_SetInteger(env,aWidth,the_aWidth);
368 jcas_SetInteger(env,aHeight,the_aHeight);
369
370 }
371 catch (Standard_Failure) {
372   Standard_SStream Err;
373   Err <<   Standard_Failure::Caught(); 
374   Err << (char) 0;
375   jcas_ThrowException(env,Err.str().c_str());
376 }
377 }
378 alock.Release();
379 return thejret;
380 }
381
382
383
384 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_ClearImage (JNIEnv *env, jobject theobj, jobject anImageId)
385 {
386
387 jcas_Locking alock(env);
388 {
389 try {
390  Handle( Standard_Transient ) the_anImageId;
391  void*                ptr_anImageId = jcas_GetHandle(env,anImageId);
392  
393  if ( ptr_anImageId != NULL ) the_anImageId = *(   (  Handle( Standard_Transient )*  )ptr_anImageId   );
394
395 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
396 the_this->ClearImage(the_anImageId);
397
398 }
399 catch (Standard_Failure) {
400   Standard_SStream Err;
401   Err <<   Standard_Failure::Caught(); 
402   Err << (char) 0;
403   jcas_ThrowException(env,Err.str().c_str());
404 }
405 }
406 alock.Release();
407
408 }
409
410
411
412 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_ClearImageFile (JNIEnv *env, jobject theobj, jobject anImageFile)
413 {
414
415 jcas_Locking alock(env);
416 {
417 try {
418 Standard_CString the_anImageFile = jcas_ConvertToCString(env,anImageFile);
419 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
420 the_this->ClearImageFile(the_anImageFile);
421
422 }
423 catch (Standard_Failure) {
424   Standard_SStream Err;
425   Err <<   Standard_Failure::Caught(); 
426   Err << (char) 0;
427   jcas_ThrowException(env,Err.str().c_str());
428 }
429 }
430 alock.Release();
431
432 }
433
434
435
436 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_DrawImage (JNIEnv *env, jobject theobj, jobject anImageId, jfloat aX, jfloat aY)
437 {
438
439 jcas_Locking alock(env);
440 {
441 try {
442  Handle( Standard_Transient ) the_anImageId;
443  void*                ptr_anImageId = jcas_GetHandle(env,anImageId);
444  
445  if ( ptr_anImageId != NULL ) the_anImageId = *(   (  Handle( Standard_Transient )*  )ptr_anImageId   );
446
447 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
448 the_this->DrawImage(the_anImageId,(Standard_ShortReal) aX,(Standard_ShortReal) aY);
449
450 }
451 catch (Standard_Failure) {
452   Standard_SStream Err;
453   Err <<   Standard_Failure::Caught(); 
454   Err << (char) 0;
455   jcas_ThrowException(env,Err.str().c_str());
456 }
457 }
458 alock.Release();
459
460 }
461
462
463
464 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_DrawImageFile (JNIEnv *env, jobject theobj, jobject anImageFile, jfloat aX, jfloat aY, jdouble aScale)
465 {
466
467 jcas_Locking alock(env);
468 {
469 try {
470 Standard_CString the_anImageFile = jcas_ConvertToCString(env,anImageFile);
471 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
472 the_this->DrawImageFile(the_anImageFile,(Standard_ShortReal) aX,(Standard_ShortReal) aY,(Quantity_Factor) aScale);
473
474 }
475 catch (Standard_Failure) {
476   Standard_SStream Err;
477   Err <<   Standard_Failure::Caught(); 
478   Err << (char) 0;
479   jcas_ThrowException(env,Err.str().c_str());
480 }
481 }
482 alock.Release();
483
484 }
485
486
487
488 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_DrawPolyline (JNIEnv *env, jobject theobj, jobject aListX, jobject aListY)
489 {
490
491 jcas_Locking alock(env);
492 {
493 try {
494 TShort_Array1OfShortReal* the_aListX = (TShort_Array1OfShortReal*) jcas_GetHandle(env,aListX);
495 if ( the_aListX == NULL ) {
496
497  // The following assumes availability of the default constructor (what may not
498  // always be the case). Therefore explicit exception is thrown if the null
499  // object has been passed.
500  // the_aListX = new TShort_Array1OfShortReal ();
501  // jcas_SetHandle ( env, aListX, the_aListX );
502  jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
503
504 }  // end if
505 TShort_Array1OfShortReal* the_aListY = (TShort_Array1OfShortReal*) jcas_GetHandle(env,aListY);
506 if ( the_aListY == NULL ) {
507
508  // The following assumes availability of the default constructor (what may not
509  // always be the case). Therefore explicit exception is thrown if the null
510  // object has been passed.
511  // the_aListY = new TShort_Array1OfShortReal ();
512  // jcas_SetHandle ( env, aListY, the_aListY );
513  jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
514
515 }  // end if
516 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
517 the_this->DrawPolyline(*the_aListX,*the_aListY);
518
519 }
520 catch (Standard_Failure) {
521   Standard_SStream Err;
522   Err <<   Standard_Failure::Caught(); 
523   Err << (char) 0;
524   jcas_ThrowException(env,Err.str().c_str());
525 }
526 }
527 alock.Release();
528
529 }
530
531
532
533 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_DrawPolygon (JNIEnv *env, jobject theobj, jobject aListX, jobject aListY)
534 {
535
536 jcas_Locking alock(env);
537 {
538 try {
539 TShort_Array1OfShortReal* the_aListX = (TShort_Array1OfShortReal*) jcas_GetHandle(env,aListX);
540 if ( the_aListX == NULL ) {
541
542  // The following assumes availability of the default constructor (what may not
543  // always be the case). Therefore explicit exception is thrown if the null
544  // object has been passed.
545  // the_aListX = new TShort_Array1OfShortReal ();
546  // jcas_SetHandle ( env, aListX, the_aListX );
547  jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
548
549 }  // end if
550 TShort_Array1OfShortReal* the_aListY = (TShort_Array1OfShortReal*) jcas_GetHandle(env,aListY);
551 if ( the_aListY == NULL ) {
552
553  // The following assumes availability of the default constructor (what may not
554  // always be the case). Therefore explicit exception is thrown if the null
555  // object has been passed.
556  // the_aListY = new TShort_Array1OfShortReal ();
557  // jcas_SetHandle ( env, aListY, the_aListY );
558  jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
559
560 }  // end if
561 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
562 the_this->DrawPolygon(*the_aListX,*the_aListY);
563
564 }
565 catch (Standard_Failure) {
566   Standard_SStream Err;
567   Err <<   Standard_Failure::Caught(); 
568   Err << (char) 0;
569   jcas_ThrowException(env,Err.str().c_str());
570 }
571 }
572 alock.Release();
573
574 }
575
576
577
578 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_DrawSegment (JNIEnv *env, jobject theobj, jfloat X1, jfloat Y1, jfloat X2, jfloat Y2)
579 {
580
581 jcas_Locking alock(env);
582 {
583 try {
584 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
585 the_this->DrawSegment((Standard_ShortReal) X1,(Standard_ShortReal) Y1,(Standard_ShortReal) X2,(Standard_ShortReal) Y2);
586
587 }
588 catch (Standard_Failure) {
589   Standard_SStream Err;
590   Err <<   Standard_Failure::Caught(); 
591   Err << (char) 0;
592   jcas_ThrowException(env,Err.str().c_str());
593 }
594 }
595 alock.Release();
596
597 }
598
599
600
601 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_DrawText (JNIEnv *env, jobject theobj, jobject aText, jfloat Xpos, jfloat Ypos, jfloat anAngle, jshort aType)
602 {
603
604 jcas_Locking alock(env);
605 {
606 try {
607 TCollection_ExtendedString* the_aText = (TCollection_ExtendedString*) jcas_GetHandle(env,aText);
608 if ( the_aText == NULL ) {
609
610  // The following assumes availability of the default constructor (what may not
611  // always be the case). Therefore explicit exception is thrown if the null
612  // object has been passed.
613  // the_aText = new TCollection_ExtendedString ();
614  // jcas_SetHandle ( env, aText, the_aText );
615  jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
616
617 }  // end if
618 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
619 the_this->DrawText(*the_aText,(Standard_ShortReal) Xpos,(Standard_ShortReal) Ypos,(Standard_ShortReal) anAngle,(Aspect_TypeOfText) aType);
620
621 }
622 catch (Standard_Failure) {
623   Standard_SStream Err;
624   Err <<   Standard_Failure::Caught(); 
625   Err << (char) 0;
626   jcas_ThrowException(env,Err.str().c_str());
627 }
628 }
629 alock.Release();
630
631 }
632
633
634
635 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_DrawPolyText (JNIEnv *env, jobject theobj, jobject aText, jfloat Xpos, jfloat Ypos, jdouble aMarge, jfloat anAngle, jshort aType)
636 {
637
638 jcas_Locking alock(env);
639 {
640 try {
641 TCollection_ExtendedString* the_aText = (TCollection_ExtendedString*) jcas_GetHandle(env,aText);
642 if ( the_aText == NULL ) {
643
644  // The following assumes availability of the default constructor (what may not
645  // always be the case). Therefore explicit exception is thrown if the null
646  // object has been passed.
647  // the_aText = new TCollection_ExtendedString ();
648  // jcas_SetHandle ( env, aText, the_aText );
649  jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
650
651 }  // end if
652 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
653 the_this->DrawPolyText(*the_aText,(Standard_ShortReal) Xpos,(Standard_ShortReal) Ypos,(Quantity_Ratio) aMarge,(Standard_ShortReal) anAngle,(Aspect_TypeOfText) aType);
654
655 }
656 catch (Standard_Failure) {
657   Standard_SStream Err;
658   Err <<   Standard_Failure::Caught(); 
659   Err << (char) 0;
660   jcas_ThrowException(env,Err.str().c_str());
661 }
662 }
663 alock.Release();
664
665 }
666
667
668
669 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_DrawPoint (JNIEnv *env, jobject theobj, jfloat X, jfloat Y)
670 {
671
672 jcas_Locking alock(env);
673 {
674 try {
675 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
676 the_this->DrawPoint((Standard_ShortReal) X,(Standard_ShortReal) Y);
677
678 }
679 catch (Standard_Failure) {
680   Standard_SStream Err;
681   Err <<   Standard_Failure::Caught(); 
682   Err << (char) 0;
683   jcas_ThrowException(env,Err.str().c_str());
684 }
685 }
686 alock.Release();
687
688 }
689
690
691
692 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_DrawMarker (JNIEnv *env, jobject theobj, jint aMarker, jfloat Xpos, jfloat Ypos, jfloat Width, jfloat Height, jfloat Angle)
693 {
694
695 jcas_Locking alock(env);
696 {
697 try {
698 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
699 the_this->DrawMarker((Standard_Integer) aMarker,(Standard_ShortReal) Xpos,(Standard_ShortReal) Ypos,(Standard_ShortReal) Width,(Standard_ShortReal) Height,(Standard_ShortReal) Angle);
700
701 }
702 catch (Standard_Failure) {
703   Standard_SStream Err;
704   Err <<   Standard_Failure::Caught(); 
705   Err << (char) 0;
706   jcas_ThrowException(env,Err.str().c_str());
707 }
708 }
709 alock.Release();
710
711 }
712
713
714
715 JNIEXPORT jboolean JNICALL Java_SampleHLRJni_Aspect_1Driver_DrawArc (JNIEnv *env, jobject theobj, jfloat X, jfloat Y, jfloat anXradius, jfloat anYradius, jfloat aStartAngle, jfloat anOpenAngle)
716 {
717 jboolean thejret;
718
719 jcas_Locking alock(env);
720 {
721 try {
722 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
723  thejret = the_this->DrawArc((Standard_ShortReal) X,(Standard_ShortReal) Y,(Standard_ShortReal) anXradius,(Standard_ShortReal) anYradius,(Standard_ShortReal) aStartAngle,(Standard_ShortReal) anOpenAngle);
724
725 }
726 catch (Standard_Failure) {
727   Standard_SStream Err;
728   Err <<   Standard_Failure::Caught(); 
729   Err << (char) 0;
730   jcas_ThrowException(env,Err.str().c_str());
731 }
732 }
733 alock.Release();
734 return thejret;
735 }
736
737
738
739 JNIEXPORT jboolean JNICALL Java_SampleHLRJni_Aspect_1Driver_DrawPolyArc (JNIEnv *env, jobject theobj, jfloat X, jfloat Y, jfloat anXradius, jfloat anYradius, jfloat aStartAngle, jfloat anOpenAngle)
740 {
741 jboolean thejret;
742
743 jcas_Locking alock(env);
744 {
745 try {
746 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
747  thejret = the_this->DrawPolyArc((Standard_ShortReal) X,(Standard_ShortReal) Y,(Standard_ShortReal) anXradius,(Standard_ShortReal) anYradius,(Standard_ShortReal) aStartAngle,(Standard_ShortReal) anOpenAngle);
748
749 }
750 catch (Standard_Failure) {
751   Standard_SStream Err;
752   Err <<   Standard_Failure::Caught(); 
753   Err << (char) 0;
754   jcas_ThrowException(env,Err.str().c_str());
755 }
756 }
757 alock.Release();
758 return thejret;
759 }
760
761
762
763 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_BeginPolyline (JNIEnv *env, jobject theobj, jint aNumber)
764 {
765
766 jcas_Locking alock(env);
767 {
768 try {
769 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
770 the_this->BeginPolyline((Standard_Integer) aNumber);
771
772 }
773 catch (Standard_Failure) {
774   Standard_SStream Err;
775   Err <<   Standard_Failure::Caught(); 
776   Err << (char) 0;
777   jcas_ThrowException(env,Err.str().c_str());
778 }
779 }
780 alock.Release();
781
782 }
783
784
785
786 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_BeginPolygon (JNIEnv *env, jobject theobj, jint aNumber)
787 {
788
789 jcas_Locking alock(env);
790 {
791 try {
792 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
793 the_this->BeginPolygon((Standard_Integer) aNumber);
794
795 }
796 catch (Standard_Failure) {
797   Standard_SStream Err;
798   Err <<   Standard_Failure::Caught(); 
799   Err << (char) 0;
800   jcas_ThrowException(env,Err.str().c_str());
801 }
802 }
803 alock.Release();
804
805 }
806
807
808
809 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_BeginSegments (JNIEnv *env, jobject theobj)
810 {
811
812 jcas_Locking alock(env);
813 {
814 try {
815 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
816 the_this->BeginSegments();
817
818 }
819 catch (Standard_Failure) {
820   Standard_SStream Err;
821   Err <<   Standard_Failure::Caught(); 
822   Err << (char) 0;
823   jcas_ThrowException(env,Err.str().c_str());
824 }
825 }
826 alock.Release();
827
828 }
829
830
831
832 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_BeginArcs (JNIEnv *env, jobject theobj)
833 {
834
835 jcas_Locking alock(env);
836 {
837 try {
838 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
839 the_this->BeginArcs();
840
841 }
842 catch (Standard_Failure) {
843   Standard_SStream Err;
844   Err <<   Standard_Failure::Caught(); 
845   Err << (char) 0;
846   jcas_ThrowException(env,Err.str().c_str());
847 }
848 }
849 alock.Release();
850
851 }
852
853
854
855 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_BeginPolyArcs (JNIEnv *env, jobject theobj)
856 {
857
858 jcas_Locking alock(env);
859 {
860 try {
861 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
862 the_this->BeginPolyArcs();
863
864 }
865 catch (Standard_Failure) {
866   Standard_SStream Err;
867   Err <<   Standard_Failure::Caught(); 
868   Err << (char) 0;
869   jcas_ThrowException(env,Err.str().c_str());
870 }
871 }
872 alock.Release();
873
874 }
875
876
877
878 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_BeginMarkers (JNIEnv *env, jobject theobj)
879 {
880
881 jcas_Locking alock(env);
882 {
883 try {
884 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
885 the_this->BeginMarkers();
886
887 }
888 catch (Standard_Failure) {
889   Standard_SStream Err;
890   Err <<   Standard_Failure::Caught(); 
891   Err << (char) 0;
892   jcas_ThrowException(env,Err.str().c_str());
893 }
894 }
895 alock.Release();
896
897 }
898
899
900
901 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_BeginPoints (JNIEnv *env, jobject theobj)
902 {
903
904 jcas_Locking alock(env);
905 {
906 try {
907 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
908 the_this->BeginPoints();
909
910 }
911 catch (Standard_Failure) {
912   Standard_SStream Err;
913   Err <<   Standard_Failure::Caught(); 
914   Err << (char) 0;
915   jcas_ThrowException(env,Err.str().c_str());
916 }
917 }
918 alock.Release();
919
920 }
921
922
923
924 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_ClosePrimitive (JNIEnv *env, jobject theobj)
925 {
926
927 jcas_Locking alock(env);
928 {
929 try {
930 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
931 the_this->ClosePrimitive();
932
933 }
934 catch (Standard_Failure) {
935   Standard_SStream Err;
936   Err <<   Standard_Failure::Caught(); 
937   Err << (char) 0;
938   jcas_ThrowException(env,Err.str().c_str());
939 }
940 }
941 alock.Release();
942
943 }
944
945
946
947 JNIEXPORT jobject JNICALL Java_SampleHLRJni_Aspect_1Driver_ColorMap (JNIEnv *env, jobject theobj)
948 {
949 jobject thejret;
950
951 jcas_Locking alock(env);
952 {
953 try {
954 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
955 Handle(Aspect_ColorMap)* theret = new Handle(Aspect_ColorMap);
956 *theret = the_this->ColorMap();
957 thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_ColorMap",theret);
958
959 }
960 catch (Standard_Failure) {
961   Standard_SStream Err;
962   Err <<   Standard_Failure::Caught(); 
963   Err << (char) 0;
964   jcas_ThrowException(env,Err.str().c_str());
965 }
966 }
967 alock.Release();
968 return thejret;
969 }
970
971
972
973 JNIEXPORT jobject JNICALL Java_SampleHLRJni_Aspect_1Driver_TypeMap (JNIEnv *env, jobject theobj)
974 {
975 jobject thejret;
976
977 jcas_Locking alock(env);
978 {
979 try {
980 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
981 Handle(Aspect_TypeMap)* theret = new Handle(Aspect_TypeMap);
982 *theret = the_this->TypeMap();
983 thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_TypeMap",theret);
984
985 }
986 catch (Standard_Failure) {
987   Standard_SStream Err;
988   Err <<   Standard_Failure::Caught(); 
989   Err << (char) 0;
990   jcas_ThrowException(env,Err.str().c_str());
991 }
992 }
993 alock.Release();
994 return thejret;
995 }
996
997
998
999 JNIEXPORT jobject JNICALL Java_SampleHLRJni_Aspect_1Driver_WidthMap (JNIEnv *env, jobject theobj)
1000 {
1001 jobject thejret;
1002
1003 jcas_Locking alock(env);
1004 {
1005 try {
1006 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
1007 Handle(Aspect_WidthMap)* theret = new Handle(Aspect_WidthMap);
1008 *theret = the_this->WidthMap();
1009 thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_WidthMap",theret);
1010
1011 }
1012 catch (Standard_Failure) {
1013   Standard_SStream Err;
1014   Err <<   Standard_Failure::Caught(); 
1015   Err << (char) 0;
1016   jcas_ThrowException(env,Err.str().c_str());
1017 }
1018 }
1019 alock.Release();
1020 return thejret;
1021 }
1022
1023
1024
1025 JNIEXPORT jobject JNICALL Java_SampleHLRJni_Aspect_1Driver_FontMap (JNIEnv *env, jobject theobj)
1026 {
1027 jobject thejret;
1028
1029 jcas_Locking alock(env);
1030 {
1031 try {
1032 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
1033 Handle(Aspect_FontMap)* theret = new Handle(Aspect_FontMap);
1034 *theret = the_this->FontMap();
1035 thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_FontMap",theret);
1036
1037 }
1038 catch (Standard_Failure) {
1039   Standard_SStream Err;
1040   Err <<   Standard_Failure::Caught(); 
1041   Err << (char) 0;
1042   jcas_ThrowException(env,Err.str().c_str());
1043 }
1044 }
1045 alock.Release();
1046 return thejret;
1047 }
1048
1049
1050
1051 JNIEXPORT jobject JNICALL Java_SampleHLRJni_Aspect_1Driver_MarkMap (JNIEnv *env, jobject theobj)
1052 {
1053 jobject thejret;
1054
1055 jcas_Locking alock(env);
1056 {
1057 try {
1058 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
1059 Handle(Aspect_MarkMap)* theret = new Handle(Aspect_MarkMap);
1060 *theret = the_this->MarkMap();
1061 thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_MarkMap",theret);
1062
1063 }
1064 catch (Standard_Failure) {
1065   Standard_SStream Err;
1066   Err <<   Standard_Failure::Caught(); 
1067   Err << (char) 0;
1068   jcas_ThrowException(env,Err.str().c_str());
1069 }
1070 }
1071 alock.Release();
1072 return thejret;
1073 }
1074
1075
1076
1077 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_WorkSpace (JNIEnv *env, jobject theobj, jobject Width, jobject Heigth)
1078 {
1079
1080 jcas_Locking alock(env);
1081 {
1082 try {
1083 Standard_Real the_Width = jcas_GetReal(env,Width);
1084 Standard_Real the_Heigth = jcas_GetReal(env,Heigth);
1085 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
1086 the_this->WorkSpace(the_Width,the_Heigth);
1087 jcas_SetReal(env,Width,the_Width);
1088 jcas_SetReal(env,Heigth,the_Heigth);
1089
1090 }
1091 catch (Standard_Failure) {
1092   Standard_SStream Err;
1093   Err <<   Standard_Failure::Caught(); 
1094   Err << (char) 0;
1095   jcas_ThrowException(env,Err.str().c_str());
1096 }
1097 }
1098 alock.Release();
1099
1100 }
1101
1102
1103
1104 JNIEXPORT jdouble JNICALL Java_SampleHLRJni_Aspect_1Driver_Aspect_1Driver_1Convert_11 (JNIEnv *env, jobject theobj, jint PV)
1105 {
1106 jdouble thejret;
1107
1108 jcas_Locking alock(env);
1109 {
1110 try {
1111 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
1112  thejret = the_this->Convert((Standard_Integer) PV);
1113
1114 }
1115 catch (Standard_Failure) {
1116   Standard_SStream Err;
1117   Err <<   Standard_Failure::Caught(); 
1118   Err << (char) 0;
1119   jcas_ThrowException(env,Err.str().c_str());
1120 }
1121 }
1122 alock.Release();
1123 return thejret;
1124 }
1125
1126
1127
1128 JNIEXPORT jint JNICALL Java_SampleHLRJni_Aspect_1Driver_Aspect_1Driver_1Convert_12 (JNIEnv *env, jobject theobj, jdouble DV)
1129 {
1130 jint thejret;
1131
1132 jcas_Locking alock(env);
1133 {
1134 try {
1135 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
1136  thejret = the_this->Convert((Quantity_Length) DV);
1137
1138 }
1139 catch (Standard_Failure) {
1140   Standard_SStream Err;
1141   Err <<   Standard_Failure::Caught(); 
1142   Err << (char) 0;
1143   jcas_ThrowException(env,Err.str().c_str());
1144 }
1145 }
1146 alock.Release();
1147 return thejret;
1148 }
1149
1150
1151
1152 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_Aspect_1Driver_1Convert_13 (JNIEnv *env, jobject theobj, jint PX, jint PY, jobject DX, jobject DY)
1153 {
1154
1155 jcas_Locking alock(env);
1156 {
1157 try {
1158 Standard_Real the_DX = jcas_GetReal(env,DX);
1159 Standard_Real the_DY = jcas_GetReal(env,DY);
1160 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
1161 the_this->Convert((Standard_Integer) PX,(Standard_Integer) PY,the_DX,the_DY);
1162 jcas_SetReal(env,DX,the_DX);
1163 jcas_SetReal(env,DY,the_DY);
1164
1165 }
1166 catch (Standard_Failure) {
1167   Standard_SStream Err;
1168   Err <<   Standard_Failure::Caught(); 
1169   Err << (char) 0;
1170   jcas_ThrowException(env,Err.str().c_str());
1171 }
1172 }
1173 alock.Release();
1174
1175 }
1176
1177
1178
1179 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1Driver_Aspect_1Driver_1Convert_14 (JNIEnv *env, jobject theobj, jdouble DX, jdouble DY, jobject PX, jobject PY)
1180 {
1181
1182 jcas_Locking alock(env);
1183 {
1184 try {
1185 Standard_Integer the_PX = jcas_GetInteger(env,PX);
1186 Standard_Integer the_PY = jcas_GetInteger(env,PY);
1187 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
1188 the_this->Convert((Quantity_Length) DX,(Quantity_Length) DY,the_PX,the_PY);
1189 jcas_SetInteger(env,PX,the_PX);
1190 jcas_SetInteger(env,PY,the_PY);
1191
1192 }
1193 catch (Standard_Failure) {
1194   Standard_SStream Err;
1195   Err <<   Standard_Failure::Caught(); 
1196   Err << (char) 0;
1197   jcas_ThrowException(env,Err.str().c_str());
1198 }
1199 }
1200 alock.Release();
1201
1202 }
1203
1204
1205
1206 JNIEXPORT jboolean JNICALL Java_SampleHLRJni_Aspect_1Driver_UseMFT (JNIEnv *env, jobject theobj)
1207 {
1208 jboolean thejret;
1209
1210 jcas_Locking alock(env);
1211 {
1212 try {
1213 Handle(Aspect_Driver) the_this = *((Handle(Aspect_Driver)*) jcas_GetHandle(env,theobj));
1214  thejret = the_this->UseMFT();
1215
1216 }
1217 catch (Standard_Failure) {
1218   Standard_SStream Err;
1219   Err <<   Standard_Failure::Caught(); 
1220   Err << (char) 0;
1221   jcas_ThrowException(env,Err.str().c_str());
1222 }
1223 }
1224 alock.Release();
1225 return thejret;
1226 }
1227
1228
1229 }