7fd59977 |
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 <CASCADESamplesJni_V2d_Viewer.h> |
22 | #include <V2d_Viewer.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 <Aspect_GraphicDevice.hxx> |
30 | #include <Standard_ExtString.hxx> |
31 | #include <Standard_CString.hxx> |
32 | #include <Graphic2d_View.hxx> |
33 | #include <V2d_View.hxx> |
34 | #include <Aspect_ColorMap.hxx> |
35 | #include <Aspect_TypeMap.hxx> |
36 | #include <Aspect_WidthMap.hxx> |
37 | #include <Aspect_FontMap.hxx> |
38 | #include <Standard_Boolean.hxx> |
39 | #include <Aspect_MarkMap.hxx> |
40 | #include <Standard_Integer.hxx> |
41 | #include <Quantity_NameOfColor.hxx> |
42 | #include <Aspect_GridType.hxx> |
43 | #include <Standard_Real.hxx> |
44 | #include <Aspect_GridDrawMode.hxx> |
45 | #include <Quantity_Color.hxx> |
46 | |
47 | |
48 | extern "C" { |
49 | |
50 | |
51 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_V2d_1Viewer_1Create_11 (JNIEnv *env, jobject theobj, jobject aGraphicDevice, jstring aName, jobject aDomain) |
52 | { |
53 | |
54 | jcas_Locking alock(env); |
55 | { |
56 | try { |
57 | Handle( Aspect_GraphicDevice ) the_aGraphicDevice; |
58 | void* ptr_aGraphicDevice = jcas_GetHandle(env,aGraphicDevice); |
59 | |
60 | if ( ptr_aGraphicDevice != NULL ) the_aGraphicDevice = *( ( Handle( Aspect_GraphicDevice )* )ptr_aGraphicDevice ); |
61 | |
62 | Standard_ExtString the_aName = jcas_ConvertToExtString(env,aName); |
63 | Standard_CString the_aDomain = jcas_ConvertToCString(env,aDomain); |
64 | Handle(V2d_Viewer)* theret = new Handle(V2d_Viewer); |
65 | *theret = new V2d_Viewer(the_aGraphicDevice,the_aName,the_aDomain); |
66 | jcas_SetHandle(env,theobj,theret); |
67 | |
68 | } |
69 | catch (Standard_Failure) { |
70 | Standard_SStream Err; |
71 | Err << Standard_Failure::Caught(); |
72 | Err << (char) 0; |
73 | jcas_ThrowException(env,Err.str().c_str()); |
74 | } |
75 | } |
76 | alock.Release(); |
77 | |
78 | } |
79 | |
80 | |
81 | |
82 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_V2d_1Viewer_1Create_12 (JNIEnv *env, jobject theobj, jobject aGraphicDevice, jobject aView, jstring aName, jobject aDomain) |
83 | { |
84 | |
85 | jcas_Locking alock(env); |
86 | { |
87 | try { |
88 | Handle( Aspect_GraphicDevice ) the_aGraphicDevice; |
89 | void* ptr_aGraphicDevice = jcas_GetHandle(env,aGraphicDevice); |
90 | |
91 | if ( ptr_aGraphicDevice != NULL ) the_aGraphicDevice = *( ( Handle( Aspect_GraphicDevice )* )ptr_aGraphicDevice ); |
92 | |
93 | Handle( Graphic2d_View ) the_aView; |
94 | void* ptr_aView = jcas_GetHandle(env,aView); |
95 | |
96 | if ( ptr_aView != NULL ) the_aView = *( ( Handle( Graphic2d_View )* )ptr_aView ); |
97 | |
98 | Standard_ExtString the_aName = jcas_ConvertToExtString(env,aName); |
99 | Standard_CString the_aDomain = jcas_ConvertToCString(env,aDomain); |
100 | Handle(V2d_Viewer)* theret = new Handle(V2d_Viewer); |
101 | *theret = new V2d_Viewer(the_aGraphicDevice,the_aView,the_aName,the_aDomain); |
102 | jcas_SetHandle(env,theobj,theret); |
103 | |
104 | } |
105 | catch (Standard_Failure) { |
106 | Standard_SStream Err; |
107 | Err << Standard_Failure::Caught(); |
108 | Err << (char) 0; |
109 | jcas_ThrowException(env,Err.str().c_str()); |
110 | } |
111 | } |
112 | alock.Release(); |
113 | |
114 | } |
115 | |
116 | |
117 | |
118 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_AddView (JNIEnv *env, jobject theobj, jobject aView) |
119 | { |
120 | |
121 | jcas_Locking alock(env); |
122 | { |
123 | try { |
124 | Handle( V2d_View ) the_aView; |
125 | void* ptr_aView = jcas_GetHandle(env,aView); |
126 | |
127 | if ( ptr_aView != NULL ) the_aView = *( ( Handle( V2d_View )* )ptr_aView ); |
128 | |
129 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
130 | the_this->AddView(the_aView); |
131 | |
132 | } |
133 | catch (Standard_Failure) { |
134 | Standard_SStream Err; |
135 | Err << Standard_Failure::Caught(); |
136 | Err << (char) 0; |
137 | jcas_ThrowException(env,Err.str().c_str()); |
138 | } |
139 | } |
140 | alock.Release(); |
141 | |
142 | } |
143 | |
144 | |
145 | |
146 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_RemoveView (JNIEnv *env, jobject theobj, jobject aView) |
147 | { |
148 | |
149 | jcas_Locking alock(env); |
150 | { |
151 | try { |
152 | Handle( V2d_View ) the_aView; |
153 | void* ptr_aView = jcas_GetHandle(env,aView); |
154 | |
155 | if ( ptr_aView != NULL ) the_aView = *( ( Handle( V2d_View )* )ptr_aView ); |
156 | |
157 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
158 | the_this->RemoveView(the_aView); |
159 | |
160 | } |
161 | catch (Standard_Failure) { |
162 | Standard_SStream Err; |
163 | Err << Standard_Failure::Caught(); |
164 | Err << (char) 0; |
165 | jcas_ThrowException(env,Err.str().c_str()); |
166 | } |
167 | } |
168 | alock.Release(); |
169 | |
170 | } |
171 | |
172 | |
173 | |
174 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_Update (JNIEnv *env, jobject theobj) |
175 | { |
176 | |
177 | jcas_Locking alock(env); |
178 | { |
179 | try { |
180 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
181 | the_this->Update(); |
182 | |
183 | } |
184 | catch (Standard_Failure) { |
185 | Standard_SStream Err; |
186 | Err << Standard_Failure::Caught(); |
187 | Err << (char) 0; |
188 | jcas_ThrowException(env,Err.str().c_str()); |
189 | } |
190 | } |
191 | alock.Release(); |
192 | |
193 | } |
194 | |
195 | |
196 | |
197 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_UpdateNew (JNIEnv *env, jobject theobj) |
198 | { |
199 | |
200 | jcas_Locking alock(env); |
201 | { |
202 | try { |
203 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
204 | the_this->UpdateNew(); |
205 | |
206 | } |
207 | catch (Standard_Failure) { |
208 | Standard_SStream Err; |
209 | Err << Standard_Failure::Caught(); |
210 | Err << (char) 0; |
211 | jcas_ThrowException(env,Err.str().c_str()); |
212 | } |
213 | } |
214 | alock.Release(); |
215 | |
216 | } |
217 | |
218 | |
219 | |
220 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_SetColorMap (JNIEnv *env, jobject theobj, jobject aColorMap) |
221 | { |
222 | |
223 | jcas_Locking alock(env); |
224 | { |
225 | try { |
226 | Handle( Aspect_ColorMap ) the_aColorMap; |
227 | void* ptr_aColorMap = jcas_GetHandle(env,aColorMap); |
228 | |
229 | if ( ptr_aColorMap != NULL ) the_aColorMap = *( ( Handle( Aspect_ColorMap )* )ptr_aColorMap ); |
230 | |
231 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
232 | the_this->SetColorMap(the_aColorMap); |
233 | |
234 | } |
235 | catch (Standard_Failure) { |
236 | Standard_SStream Err; |
237 | Err << Standard_Failure::Caught(); |
238 | Err << (char) 0; |
239 | jcas_ThrowException(env,Err.str().c_str()); |
240 | } |
241 | } |
242 | alock.Release(); |
243 | |
244 | } |
245 | |
246 | |
247 | |
248 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_SetTypeMap (JNIEnv *env, jobject theobj, jobject aTypeMap) |
249 | { |
250 | |
251 | jcas_Locking alock(env); |
252 | { |
253 | try { |
254 | Handle( Aspect_TypeMap ) the_aTypeMap; |
255 | void* ptr_aTypeMap = jcas_GetHandle(env,aTypeMap); |
256 | |
257 | if ( ptr_aTypeMap != NULL ) the_aTypeMap = *( ( Handle( Aspect_TypeMap )* )ptr_aTypeMap ); |
258 | |
259 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
260 | the_this->SetTypeMap(the_aTypeMap); |
261 | |
262 | } |
263 | catch (Standard_Failure) { |
264 | Standard_SStream Err; |
265 | Err << Standard_Failure::Caught(); |
266 | Err << (char) 0; |
267 | jcas_ThrowException(env,Err.str().c_str()); |
268 | } |
269 | } |
270 | alock.Release(); |
271 | |
272 | } |
273 | |
274 | |
275 | |
276 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_SetWidthMap (JNIEnv *env, jobject theobj, jobject aWidthMap) |
277 | { |
278 | |
279 | jcas_Locking alock(env); |
280 | { |
281 | try { |
282 | Handle( Aspect_WidthMap ) the_aWidthMap; |
283 | void* ptr_aWidthMap = jcas_GetHandle(env,aWidthMap); |
284 | |
285 | if ( ptr_aWidthMap != NULL ) the_aWidthMap = *( ( Handle( Aspect_WidthMap )* )ptr_aWidthMap ); |
286 | |
287 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
288 | the_this->SetWidthMap(the_aWidthMap); |
289 | |
290 | } |
291 | catch (Standard_Failure) { |
292 | Standard_SStream Err; |
293 | Err << Standard_Failure::Caught(); |
294 | Err << (char) 0; |
295 | jcas_ThrowException(env,Err.str().c_str()); |
296 | } |
297 | } |
298 | alock.Release(); |
299 | |
300 | } |
301 | |
302 | |
303 | |
304 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_SetFontMap (JNIEnv *env, jobject theobj, jobject aFontMap, jboolean useMFT) |
305 | { |
306 | |
307 | jcas_Locking alock(env); |
308 | { |
309 | try { |
310 | Handle( Aspect_FontMap ) the_aFontMap; |
311 | void* ptr_aFontMap = jcas_GetHandle(env,aFontMap); |
312 | |
313 | if ( ptr_aFontMap != NULL ) the_aFontMap = *( ( Handle( Aspect_FontMap )* )ptr_aFontMap ); |
314 | |
315 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
316 | the_this->SetFontMap(the_aFontMap,(Standard_Boolean) useMFT); |
317 | |
318 | } |
319 | catch (Standard_Failure) { |
320 | Standard_SStream Err; |
321 | Err << Standard_Failure::Caught(); |
322 | Err << (char) 0; |
323 | jcas_ThrowException(env,Err.str().c_str()); |
324 | } |
325 | } |
326 | alock.Release(); |
327 | |
328 | } |
329 | |
330 | |
331 | |
332 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_SetMarkMap (JNIEnv *env, jobject theobj, jobject aMarkMap) |
333 | { |
334 | |
335 | jcas_Locking alock(env); |
336 | { |
337 | try { |
338 | Handle( Aspect_MarkMap ) the_aMarkMap; |
339 | void* ptr_aMarkMap = jcas_GetHandle(env,aMarkMap); |
340 | |
341 | if ( ptr_aMarkMap != NULL ) the_aMarkMap = *( ( Handle( Aspect_MarkMap )* )ptr_aMarkMap ); |
342 | |
343 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
344 | the_this->SetMarkMap(the_aMarkMap); |
345 | |
346 | } |
347 | catch (Standard_Failure) { |
348 | Standard_SStream Err; |
349 | Err << Standard_Failure::Caught(); |
350 | Err << (char) 0; |
351 | jcas_ThrowException(env,Err.str().c_str()); |
352 | } |
353 | } |
354 | alock.Release(); |
355 | |
356 | } |
357 | |
358 | |
359 | |
360 | JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_V2d_1Viewer_ColorMap (JNIEnv *env, jobject theobj) |
361 | { |
362 | jobject thejret; |
363 | |
364 | jcas_Locking alock(env); |
365 | { |
366 | try { |
367 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
368 | Handle(Aspect_ColorMap)* theret = new Handle(Aspect_ColorMap); |
369 | *theret = the_this->ColorMap(); |
370 | thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_ColorMap",theret); |
371 | |
372 | } |
373 | catch (Standard_Failure) { |
374 | Standard_SStream Err; |
375 | Err << Standard_Failure::Caught(); |
376 | Err << (char) 0; |
377 | jcas_ThrowException(env,Err.str().c_str()); |
378 | } |
379 | } |
380 | alock.Release(); |
381 | return thejret; |
382 | } |
383 | |
384 | |
385 | |
386 | JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_V2d_1Viewer_TypeMap (JNIEnv *env, jobject theobj) |
387 | { |
388 | jobject thejret; |
389 | |
390 | jcas_Locking alock(env); |
391 | { |
392 | try { |
393 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
394 | Handle(Aspect_TypeMap)* theret = new Handle(Aspect_TypeMap); |
395 | *theret = the_this->TypeMap(); |
396 | thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_TypeMap",theret); |
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 | return thejret; |
408 | } |
409 | |
410 | |
411 | |
412 | JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_V2d_1Viewer_WidthMap (JNIEnv *env, jobject theobj) |
413 | { |
414 | jobject thejret; |
415 | |
416 | jcas_Locking alock(env); |
417 | { |
418 | try { |
419 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
420 | Handle(Aspect_WidthMap)* theret = new Handle(Aspect_WidthMap); |
421 | *theret = the_this->WidthMap(); |
422 | thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_WidthMap",theret); |
423 | |
424 | } |
425 | catch (Standard_Failure) { |
426 | Standard_SStream Err; |
427 | Err << Standard_Failure::Caught(); |
428 | Err << (char) 0; |
429 | jcas_ThrowException(env,Err.str().c_str()); |
430 | } |
431 | } |
432 | alock.Release(); |
433 | return thejret; |
434 | } |
435 | |
436 | |
437 | |
438 | JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_V2d_1Viewer_FontMap (JNIEnv *env, jobject theobj) |
439 | { |
440 | jobject thejret; |
441 | |
442 | jcas_Locking alock(env); |
443 | { |
444 | try { |
445 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
446 | Handle(Aspect_FontMap)* theret = new Handle(Aspect_FontMap); |
447 | *theret = the_this->FontMap(); |
448 | thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_FontMap",theret); |
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 | return thejret; |
460 | } |
461 | |
462 | |
463 | |
464 | JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_V2d_1Viewer_MarkMap (JNIEnv *env, jobject theobj) |
465 | { |
466 | jobject thejret; |
467 | |
468 | jcas_Locking alock(env); |
469 | { |
470 | try { |
471 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
472 | Handle(Aspect_MarkMap)* theret = new Handle(Aspect_MarkMap); |
473 | *theret = the_this->MarkMap(); |
474 | thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_MarkMap",theret); |
475 | |
476 | } |
477 | catch (Standard_Failure) { |
478 | Standard_SStream Err; |
479 | Err << Standard_Failure::Caught(); |
480 | Err << (char) 0; |
481 | jcas_ThrowException(env,Err.str().c_str()); |
482 | } |
483 | } |
484 | alock.Release(); |
485 | return thejret; |
486 | } |
487 | |
488 | |
489 | |
490 | JNIEXPORT jboolean JNICALL Java_CASCADESamplesJni_V2d_1Viewer_UseMFT (JNIEnv *env, jobject theobj) |
491 | { |
492 | jboolean thejret; |
493 | |
494 | jcas_Locking alock(env); |
495 | { |
496 | try { |
497 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
498 | thejret = the_this->UseMFT(); |
499 | |
500 | } |
501 | catch (Standard_Failure) { |
502 | Standard_SStream Err; |
503 | Err << Standard_Failure::Caught(); |
504 | Err << (char) 0; |
505 | jcas_ThrowException(env,Err.str().c_str()); |
506 | } |
507 | } |
508 | alock.Release(); |
509 | return thejret; |
510 | } |
511 | |
512 | |
513 | |
514 | JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_V2d_1Viewer_View (JNIEnv *env, jobject theobj) |
515 | { |
516 | jobject thejret; |
517 | |
518 | jcas_Locking alock(env); |
519 | { |
520 | try { |
521 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
522 | Handle(Graphic2d_View)* theret = new Handle(Graphic2d_View); |
523 | *theret = the_this->View(); |
524 | thejret = jcas_CreateObject(env,"CASCADESamplesJni/Graphic2d_View",theret); |
525 | |
526 | } |
527 | catch (Standard_Failure) { |
528 | Standard_SStream Err; |
529 | Err << Standard_Failure::Caught(); |
530 | Err << (char) 0; |
531 | jcas_ThrowException(env,Err.str().c_str()); |
532 | } |
533 | } |
534 | alock.Release(); |
535 | return thejret; |
536 | } |
537 | |
538 | |
539 | |
540 | JNIEXPORT jint JNICALL Java_CASCADESamplesJni_V2d_1Viewer_InitializeColor (JNIEnv *env, jobject theobj, jshort aColor) |
541 | { |
542 | jint thejret; |
543 | |
544 | jcas_Locking alock(env); |
545 | { |
546 | try { |
547 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
548 | thejret = the_this->InitializeColor((Quantity_NameOfColor) aColor); |
549 | |
550 | } |
551 | catch (Standard_Failure) { |
552 | Standard_SStream Err; |
553 | Err << Standard_Failure::Caught(); |
554 | Err << (char) 0; |
555 | jcas_ThrowException(env,Err.str().c_str()); |
556 | } |
557 | } |
558 | alock.Release(); |
559 | return thejret; |
560 | } |
561 | |
562 | |
563 | |
564 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_InitActiveViews (JNIEnv *env, jobject theobj) |
565 | { |
566 | |
567 | jcas_Locking alock(env); |
568 | { |
569 | try { |
570 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
571 | the_this->InitActiveViews(); |
572 | |
573 | } |
574 | catch (Standard_Failure) { |
575 | Standard_SStream Err; |
576 | Err << Standard_Failure::Caught(); |
577 | Err << (char) 0; |
578 | jcas_ThrowException(env,Err.str().c_str()); |
579 | } |
580 | } |
581 | alock.Release(); |
582 | |
583 | } |
584 | |
585 | |
586 | |
587 | JNIEXPORT jboolean JNICALL Java_CASCADESamplesJni_V2d_1Viewer_MoreActiveViews (JNIEnv *env, jobject theobj) |
588 | { |
589 | jboolean thejret; |
590 | |
591 | jcas_Locking alock(env); |
592 | { |
593 | try { |
594 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
595 | thejret = the_this->MoreActiveViews(); |
596 | |
597 | } |
598 | catch (Standard_Failure) { |
599 | Standard_SStream Err; |
600 | Err << Standard_Failure::Caught(); |
601 | Err << (char) 0; |
602 | jcas_ThrowException(env,Err.str().c_str()); |
603 | } |
604 | } |
605 | alock.Release(); |
606 | return thejret; |
607 | } |
608 | |
609 | |
610 | |
611 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_NextActiveViews (JNIEnv *env, jobject theobj) |
612 | { |
613 | |
614 | jcas_Locking alock(env); |
615 | { |
616 | try { |
617 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
618 | the_this->NextActiveViews(); |
619 | |
620 | } |
621 | catch (Standard_Failure) { |
622 | Standard_SStream Err; |
623 | Err << Standard_Failure::Caught(); |
624 | Err << (char) 0; |
625 | jcas_ThrowException(env,Err.str().c_str()); |
626 | } |
627 | } |
628 | alock.Release(); |
629 | |
630 | } |
631 | |
632 | |
633 | |
634 | JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_V2d_1Viewer_ActiveView (JNIEnv *env, jobject theobj) |
635 | { |
636 | jobject thejret; |
637 | |
638 | jcas_Locking alock(env); |
639 | { |
640 | try { |
641 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
642 | Handle(V2d_View)* theret = new Handle(V2d_View); |
643 | *theret = the_this->ActiveView(); |
644 | thejret = jcas_CreateObject(env,"CASCADESamplesJni/V2d_View",theret); |
645 | |
646 | } |
647 | catch (Standard_Failure) { |
648 | Standard_SStream Err; |
649 | Err << Standard_Failure::Caught(); |
650 | Err << (char) 0; |
651 | jcas_ThrowException(env,Err.str().c_str()); |
652 | } |
653 | } |
654 | alock.Release(); |
655 | return thejret; |
656 | } |
657 | |
658 | |
659 | |
660 | JNIEXPORT jboolean JNICALL Java_CASCADESamplesJni_V2d_1Viewer_IsEmpty (JNIEnv *env, jobject theobj) |
661 | { |
662 | jboolean thejret; |
663 | |
664 | jcas_Locking alock(env); |
665 | { |
666 | try { |
667 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
668 | thejret = the_this->IsEmpty(); |
669 | |
670 | } |
671 | catch (Standard_Failure) { |
672 | Standard_SStream Err; |
673 | Err << Standard_Failure::Caught(); |
674 | Err << (char) 0; |
675 | jcas_ThrowException(env,Err.str().c_str()); |
676 | } |
677 | } |
678 | alock.Release(); |
679 | return thejret; |
680 | } |
681 | |
682 | |
683 | |
684 | JNIEXPORT jshort JNICALL Java_CASCADESamplesJni_V2d_1Viewer_GridType (JNIEnv *env, jobject theobj) |
685 | { |
686 | jshort thejret; |
687 | |
688 | jcas_Locking alock(env); |
689 | { |
690 | try { |
691 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
692 | thejret = the_this->GridType(); |
693 | |
694 | } |
695 | catch (Standard_Failure) { |
696 | Standard_SStream Err; |
697 | Err << Standard_Failure::Caught(); |
698 | Err << (char) 0; |
699 | jcas_ThrowException(env,Err.str().c_str()); |
700 | } |
701 | } |
702 | alock.Release(); |
703 | return thejret; |
704 | } |
705 | |
706 | |
707 | |
708 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_Hit (JNIEnv *env, jobject theobj, jdouble X, jdouble Y, jobject gx, jobject gy) |
709 | { |
710 | |
711 | jcas_Locking alock(env); |
712 | { |
713 | try { |
714 | Standard_Real the_gx = jcas_GetReal(env,gx); |
715 | Standard_Real the_gy = jcas_GetReal(env,gy); |
716 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
717 | the_this->Hit((Quantity_Length) X,(Quantity_Length) Y,the_gx,the_gy); |
718 | jcas_SetReal(env,gx,the_gx); |
719 | jcas_SetReal(env,gy,the_gy); |
720 | |
721 | } |
722 | catch (Standard_Failure) { |
723 | Standard_SStream Err; |
724 | Err << Standard_Failure::Caught(); |
725 | Err << (char) 0; |
726 | jcas_ThrowException(env,Err.str().c_str()); |
727 | } |
728 | } |
729 | alock.Release(); |
730 | |
731 | } |
732 | |
733 | |
734 | |
735 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_ActivateGrid (JNIEnv *env, jobject theobj, jshort aGridType, jshort aGridDrawMode) |
736 | { |
737 | |
738 | jcas_Locking alock(env); |
739 | { |
740 | try { |
741 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
742 | the_this->ActivateGrid((Aspect_GridType) aGridType,(Aspect_GridDrawMode) aGridDrawMode); |
743 | |
744 | } |
745 | catch (Standard_Failure) { |
746 | Standard_SStream Err; |
747 | Err << Standard_Failure::Caught(); |
748 | Err << (char) 0; |
749 | jcas_ThrowException(env,Err.str().c_str()); |
750 | } |
751 | } |
752 | alock.Release(); |
753 | |
754 | } |
755 | |
756 | |
757 | |
758 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_DeactivateGrid (JNIEnv *env, jobject theobj) |
759 | { |
760 | |
761 | jcas_Locking alock(env); |
762 | { |
763 | try { |
764 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
765 | the_this->DeactivateGrid(); |
766 | |
767 | } |
768 | catch (Standard_Failure) { |
769 | Standard_SStream Err; |
770 | Err << Standard_Failure::Caught(); |
771 | Err << (char) 0; |
772 | jcas_ThrowException(env,Err.str().c_str()); |
773 | } |
774 | } |
775 | alock.Release(); |
776 | |
777 | } |
778 | |
779 | |
780 | |
781 | JNIEXPORT jboolean JNICALL Java_CASCADESamplesJni_V2d_1Viewer_IsActive (JNIEnv *env, jobject theobj) |
782 | { |
783 | jboolean thejret; |
784 | |
785 | jcas_Locking alock(env); |
786 | { |
787 | try { |
788 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
789 | thejret = the_this->IsActive(); |
790 | |
791 | } |
792 | catch (Standard_Failure) { |
793 | Standard_SStream Err; |
794 | Err << Standard_Failure::Caught(); |
795 | Err << (char) 0; |
796 | jcas_ThrowException(env,Err.str().c_str()); |
797 | } |
798 | } |
799 | alock.Release(); |
800 | return thejret; |
801 | } |
802 | |
803 | |
804 | |
805 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_RectangularGridValues (JNIEnv *env, jobject theobj, jobject XOrigin, jobject YOrigin, jobject XStep, jobject YStep, jobject RotationAngle) |
806 | { |
807 | |
808 | jcas_Locking alock(env); |
809 | { |
810 | try { |
811 | Standard_Real the_XOrigin = jcas_GetReal(env,XOrigin); |
812 | Standard_Real the_YOrigin = jcas_GetReal(env,YOrigin); |
813 | Standard_Real the_XStep = jcas_GetReal(env,XStep); |
814 | Standard_Real the_YStep = jcas_GetReal(env,YStep); |
815 | Standard_Real the_RotationAngle = jcas_GetReal(env,RotationAngle); |
816 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
817 | the_this->RectangularGridValues(the_XOrigin,the_YOrigin,the_XStep,the_YStep,the_RotationAngle); |
818 | jcas_SetReal(env,XOrigin,the_XOrigin); |
819 | jcas_SetReal(env,YOrigin,the_YOrigin); |
820 | jcas_SetReal(env,XStep,the_XStep); |
821 | jcas_SetReal(env,YStep,the_YStep); |
822 | jcas_SetReal(env,RotationAngle,the_RotationAngle); |
823 | |
824 | } |
825 | catch (Standard_Failure) { |
826 | Standard_SStream Err; |
827 | Err << Standard_Failure::Caught(); |
828 | Err << (char) 0; |
829 | jcas_ThrowException(env,Err.str().c_str()); |
830 | } |
831 | } |
832 | alock.Release(); |
833 | |
834 | } |
835 | |
836 | |
837 | |
838 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_SetRectangularGridValues (JNIEnv *env, jobject theobj, jdouble XOrigin, jdouble YOrigin, jdouble XStep, jdouble YStep, jdouble RotationAngle) |
839 | { |
840 | |
841 | jcas_Locking alock(env); |
842 | { |
843 | try { |
844 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
845 | the_this->SetRectangularGridValues((Quantity_Length) XOrigin,(Quantity_Length) YOrigin,(Quantity_Length) XStep,(Quantity_Length) YStep,(Quantity_PlaneAngle) RotationAngle); |
846 | |
847 | } |
848 | catch (Standard_Failure) { |
849 | Standard_SStream Err; |
850 | Err << Standard_Failure::Caught(); |
851 | Err << (char) 0; |
852 | jcas_ThrowException(env,Err.str().c_str()); |
853 | } |
854 | } |
855 | alock.Release(); |
856 | |
857 | } |
858 | |
859 | |
860 | |
861 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_CircularGridValues (JNIEnv *env, jobject theobj, jobject XOrigin, jobject YOrigin, jobject RadiusStep, jobject DivisionNumber, jobject RotationAngle) |
862 | { |
863 | |
864 | jcas_Locking alock(env); |
865 | { |
866 | try { |
867 | Standard_Real the_XOrigin = jcas_GetReal(env,XOrigin); |
868 | Standard_Real the_YOrigin = jcas_GetReal(env,YOrigin); |
869 | Standard_Real the_RadiusStep = jcas_GetReal(env,RadiusStep); |
870 | Standard_Integer the_DivisionNumber = jcas_GetInteger(env,DivisionNumber); |
871 | Standard_Real the_RotationAngle = jcas_GetReal(env,RotationAngle); |
872 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
873 | the_this->CircularGridValues(the_XOrigin,the_YOrigin,the_RadiusStep,the_DivisionNumber,the_RotationAngle); |
874 | jcas_SetReal(env,XOrigin,the_XOrigin); |
875 | jcas_SetReal(env,YOrigin,the_YOrigin); |
876 | jcas_SetReal(env,RadiusStep,the_RadiusStep); |
877 | jcas_SetInteger(env,DivisionNumber,the_DivisionNumber); |
878 | jcas_SetReal(env,RotationAngle,the_RotationAngle); |
879 | |
880 | } |
881 | catch (Standard_Failure) { |
882 | Standard_SStream Err; |
883 | Err << Standard_Failure::Caught(); |
884 | Err << (char) 0; |
885 | jcas_ThrowException(env,Err.str().c_str()); |
886 | } |
887 | } |
888 | alock.Release(); |
889 | |
890 | } |
891 | |
892 | |
893 | |
894 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_SetCircularGridValues (JNIEnv *env, jobject theobj, jdouble XOrigin, jdouble YOrigin, jdouble RadiusStep, jint DivisionNumber, jdouble RotationAngle) |
895 | { |
896 | |
897 | jcas_Locking alock(env); |
898 | { |
899 | try { |
900 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
901 | the_this->SetCircularGridValues((Quantity_Length) XOrigin,(Quantity_Length) YOrigin,(Quantity_Length) RadiusStep,(Standard_Integer) DivisionNumber,(Quantity_PlaneAngle) RotationAngle); |
902 | |
903 | } |
904 | catch (Standard_Failure) { |
905 | Standard_SStream Err; |
906 | Err << Standard_Failure::Caught(); |
907 | Err << (char) 0; |
908 | jcas_ThrowException(env,Err.str().c_str()); |
909 | } |
910 | } |
911 | alock.Release(); |
912 | |
913 | } |
914 | |
915 | |
916 | |
917 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_SetGridColor (JNIEnv *env, jobject theobj, jobject color1, jobject color2) |
918 | { |
919 | |
920 | jcas_Locking alock(env); |
921 | { |
922 | try { |
923 | Quantity_Color* the_color1 = (Quantity_Color*) jcas_GetHandle(env,color1); |
924 | if ( the_color1 == NULL ) { |
925 | |
926 | // The following assumes availability of the default constructor (what may not |
927 | // always be the case). Therefore explicit exception is thrown if the null |
928 | // object has been passed. |
929 | // the_color1 = new Quantity_Color (); |
930 | // jcas_SetHandle ( env, color1, the_color1 ); |
931 | jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value"); |
932 | |
933 | } // end if |
934 | Quantity_Color* the_color2 = (Quantity_Color*) jcas_GetHandle(env,color2); |
935 | if ( the_color2 == NULL ) { |
936 | |
937 | // The following assumes availability of the default constructor (what may not |
938 | // always be the case). Therefore explicit exception is thrown if the null |
939 | // object has been passed. |
940 | // the_color2 = new Quantity_Color (); |
941 | // jcas_SetHandle ( env, color2, the_color2 ); |
942 | jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value"); |
943 | |
944 | } // end if |
945 | Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj)); |
946 | the_this->SetGridColor(*the_color1,*the_color2); |
947 | |
948 | } |
949 | catch (Standard_Failure) { |
950 | Standard_SStream Err; |
951 | Err << Standard_Failure::Caught(); |
952 | Err << (char) 0; |
953 | jcas_ThrowException(env,Err.str().c_str()); |
954 | } |
955 | } |
956 | alock.Release(); |
957 | |
958 | } |
959 | |
960 | |
961 | } |