Adjusting testing cases for current state of OCCT
[occt.git] / samples / java / drv / CASCADESamplesJni / CASCADESamplesJni_V2d_Viewer_java.cxx
CommitLineData
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
48extern "C" {
49
50
51JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_V2d_1Viewer_1Create_11 (JNIEnv *env, jobject theobj, jobject aGraphicDevice, jstring aName, jobject aDomain)
52{
53
54jcas_Locking alock(env);
55{
56try {
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
62Standard_ExtString the_aName = jcas_ConvertToExtString(env,aName);
63Standard_CString the_aDomain = jcas_ConvertToCString(env,aDomain);
64Handle(V2d_Viewer)* theret = new Handle(V2d_Viewer);
65*theret = new V2d_Viewer(the_aGraphicDevice,the_aName,the_aDomain);
66jcas_SetHandle(env,theobj,theret);
67
68}
69catch (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}
76alock.Release();
77
78}
79
80
81
82JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_V2d_1Viewer_1Create_12 (JNIEnv *env, jobject theobj, jobject aGraphicDevice, jobject aView, jstring aName, jobject aDomain)
83{
84
85jcas_Locking alock(env);
86{
87try {
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
98Standard_ExtString the_aName = jcas_ConvertToExtString(env,aName);
99Standard_CString the_aDomain = jcas_ConvertToCString(env,aDomain);
100Handle(V2d_Viewer)* theret = new Handle(V2d_Viewer);
101*theret = new V2d_Viewer(the_aGraphicDevice,the_aView,the_aName,the_aDomain);
102jcas_SetHandle(env,theobj,theret);
103
104}
105catch (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}
112alock.Release();
113
114}
115
116
117
118JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_AddView (JNIEnv *env, jobject theobj, jobject aView)
119{
120
121jcas_Locking alock(env);
122{
123try {
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
129Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
130the_this->AddView(the_aView);
131
132}
133catch (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}
140alock.Release();
141
142}
143
144
145
146JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_RemoveView (JNIEnv *env, jobject theobj, jobject aView)
147{
148
149jcas_Locking alock(env);
150{
151try {
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
157Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
158the_this->RemoveView(the_aView);
159
160}
161catch (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}
168alock.Release();
169
170}
171
172
173
174JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_Update (JNIEnv *env, jobject theobj)
175{
176
177jcas_Locking alock(env);
178{
179try {
180Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
181the_this->Update();
182
183}
184catch (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}
191alock.Release();
192
193}
194
195
196
197JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_UpdateNew (JNIEnv *env, jobject theobj)
198{
199
200jcas_Locking alock(env);
201{
202try {
203Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
204the_this->UpdateNew();
205
206}
207catch (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}
214alock.Release();
215
216}
217
218
219
220JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_SetColorMap (JNIEnv *env, jobject theobj, jobject aColorMap)
221{
222
223jcas_Locking alock(env);
224{
225try {
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
231Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
232the_this->SetColorMap(the_aColorMap);
233
234}
235catch (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}
242alock.Release();
243
244}
245
246
247
248JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_SetTypeMap (JNIEnv *env, jobject theobj, jobject aTypeMap)
249{
250
251jcas_Locking alock(env);
252{
253try {
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
259Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
260the_this->SetTypeMap(the_aTypeMap);
261
262}
263catch (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}
270alock.Release();
271
272}
273
274
275
276JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_SetWidthMap (JNIEnv *env, jobject theobj, jobject aWidthMap)
277{
278
279jcas_Locking alock(env);
280{
281try {
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
287Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
288the_this->SetWidthMap(the_aWidthMap);
289
290}
291catch (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}
298alock.Release();
299
300}
301
302
303
304JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_SetFontMap (JNIEnv *env, jobject theobj, jobject aFontMap, jboolean useMFT)
305{
306
307jcas_Locking alock(env);
308{
309try {
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
315Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
316the_this->SetFontMap(the_aFontMap,(Standard_Boolean) useMFT);
317
318}
319catch (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}
326alock.Release();
327
328}
329
330
331
332JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_SetMarkMap (JNIEnv *env, jobject theobj, jobject aMarkMap)
333{
334
335jcas_Locking alock(env);
336{
337try {
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
343Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
344the_this->SetMarkMap(the_aMarkMap);
345
346}
347catch (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}
354alock.Release();
355
356}
357
358
359
360JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_V2d_1Viewer_ColorMap (JNIEnv *env, jobject theobj)
361{
362jobject thejret;
363
364jcas_Locking alock(env);
365{
366try {
367Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
368Handle(Aspect_ColorMap)* theret = new Handle(Aspect_ColorMap);
369*theret = the_this->ColorMap();
370thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_ColorMap",theret);
371
372}
373catch (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}
380alock.Release();
381return thejret;
382}
383
384
385
386JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_V2d_1Viewer_TypeMap (JNIEnv *env, jobject theobj)
387{
388jobject thejret;
389
390jcas_Locking alock(env);
391{
392try {
393Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
394Handle(Aspect_TypeMap)* theret = new Handle(Aspect_TypeMap);
395*theret = the_this->TypeMap();
396thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_TypeMap",theret);
397
398}
399catch (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}
406alock.Release();
407return thejret;
408}
409
410
411
412JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_V2d_1Viewer_WidthMap (JNIEnv *env, jobject theobj)
413{
414jobject thejret;
415
416jcas_Locking alock(env);
417{
418try {
419Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
420Handle(Aspect_WidthMap)* theret = new Handle(Aspect_WidthMap);
421*theret = the_this->WidthMap();
422thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_WidthMap",theret);
423
424}
425catch (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}
432alock.Release();
433return thejret;
434}
435
436
437
438JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_V2d_1Viewer_FontMap (JNIEnv *env, jobject theobj)
439{
440jobject thejret;
441
442jcas_Locking alock(env);
443{
444try {
445Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
446Handle(Aspect_FontMap)* theret = new Handle(Aspect_FontMap);
447*theret = the_this->FontMap();
448thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_FontMap",theret);
449
450}
451catch (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}
458alock.Release();
459return thejret;
460}
461
462
463
464JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_V2d_1Viewer_MarkMap (JNIEnv *env, jobject theobj)
465{
466jobject thejret;
467
468jcas_Locking alock(env);
469{
470try {
471Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
472Handle(Aspect_MarkMap)* theret = new Handle(Aspect_MarkMap);
473*theret = the_this->MarkMap();
474thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_MarkMap",theret);
475
476}
477catch (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}
484alock.Release();
485return thejret;
486}
487
488
489
490JNIEXPORT jboolean JNICALL Java_CASCADESamplesJni_V2d_1Viewer_UseMFT (JNIEnv *env, jobject theobj)
491{
492jboolean thejret;
493
494jcas_Locking alock(env);
495{
496try {
497Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
498 thejret = the_this->UseMFT();
499
500}
501catch (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}
508alock.Release();
509return thejret;
510}
511
512
513
514JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_V2d_1Viewer_View (JNIEnv *env, jobject theobj)
515{
516jobject thejret;
517
518jcas_Locking alock(env);
519{
520try {
521Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
522Handle(Graphic2d_View)* theret = new Handle(Graphic2d_View);
523*theret = the_this->View();
524thejret = jcas_CreateObject(env,"CASCADESamplesJni/Graphic2d_View",theret);
525
526}
527catch (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}
534alock.Release();
535return thejret;
536}
537
538
539
540JNIEXPORT jint JNICALL Java_CASCADESamplesJni_V2d_1Viewer_InitializeColor (JNIEnv *env, jobject theobj, jshort aColor)
541{
542jint thejret;
543
544jcas_Locking alock(env);
545{
546try {
547Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
548 thejret = the_this->InitializeColor((Quantity_NameOfColor) aColor);
549
550}
551catch (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}
558alock.Release();
559return thejret;
560}
561
562
563
564JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_InitActiveViews (JNIEnv *env, jobject theobj)
565{
566
567jcas_Locking alock(env);
568{
569try {
570Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
571the_this->InitActiveViews();
572
573}
574catch (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}
581alock.Release();
582
583}
584
585
586
587JNIEXPORT jboolean JNICALL Java_CASCADESamplesJni_V2d_1Viewer_MoreActiveViews (JNIEnv *env, jobject theobj)
588{
589jboolean thejret;
590
591jcas_Locking alock(env);
592{
593try {
594Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
595 thejret = the_this->MoreActiveViews();
596
597}
598catch (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}
605alock.Release();
606return thejret;
607}
608
609
610
611JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_NextActiveViews (JNIEnv *env, jobject theobj)
612{
613
614jcas_Locking alock(env);
615{
616try {
617Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
618the_this->NextActiveViews();
619
620}
621catch (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}
628alock.Release();
629
630}
631
632
633
634JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_V2d_1Viewer_ActiveView (JNIEnv *env, jobject theobj)
635{
636jobject thejret;
637
638jcas_Locking alock(env);
639{
640try {
641Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
642Handle(V2d_View)* theret = new Handle(V2d_View);
643*theret = the_this->ActiveView();
644thejret = jcas_CreateObject(env,"CASCADESamplesJni/V2d_View",theret);
645
646}
647catch (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}
654alock.Release();
655return thejret;
656}
657
658
659
660JNIEXPORT jboolean JNICALL Java_CASCADESamplesJni_V2d_1Viewer_IsEmpty (JNIEnv *env, jobject theobj)
661{
662jboolean thejret;
663
664jcas_Locking alock(env);
665{
666try {
667Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
668 thejret = the_this->IsEmpty();
669
670}
671catch (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}
678alock.Release();
679return thejret;
680}
681
682
683
684JNIEXPORT jshort JNICALL Java_CASCADESamplesJni_V2d_1Viewer_GridType (JNIEnv *env, jobject theobj)
685{
686jshort thejret;
687
688jcas_Locking alock(env);
689{
690try {
691Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
692 thejret = the_this->GridType();
693
694}
695catch (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}
702alock.Release();
703return thejret;
704}
705
706
707
708JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_Hit (JNIEnv *env, jobject theobj, jdouble X, jdouble Y, jobject gx, jobject gy)
709{
710
711jcas_Locking alock(env);
712{
713try {
714Standard_Real the_gx = jcas_GetReal(env,gx);
715Standard_Real the_gy = jcas_GetReal(env,gy);
716Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
717the_this->Hit((Quantity_Length) X,(Quantity_Length) Y,the_gx,the_gy);
718jcas_SetReal(env,gx,the_gx);
719jcas_SetReal(env,gy,the_gy);
720
721}
722catch (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}
729alock.Release();
730
731}
732
733
734
735JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_ActivateGrid (JNIEnv *env, jobject theobj, jshort aGridType, jshort aGridDrawMode)
736{
737
738jcas_Locking alock(env);
739{
740try {
741Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
742the_this->ActivateGrid((Aspect_GridType) aGridType,(Aspect_GridDrawMode) aGridDrawMode);
743
744}
745catch (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}
752alock.Release();
753
754}
755
756
757
758JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_DeactivateGrid (JNIEnv *env, jobject theobj)
759{
760
761jcas_Locking alock(env);
762{
763try {
764Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
765the_this->DeactivateGrid();
766
767}
768catch (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}
775alock.Release();
776
777}
778
779
780
781JNIEXPORT jboolean JNICALL Java_CASCADESamplesJni_V2d_1Viewer_IsActive (JNIEnv *env, jobject theobj)
782{
783jboolean thejret;
784
785jcas_Locking alock(env);
786{
787try {
788Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
789 thejret = the_this->IsActive();
790
791}
792catch (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}
799alock.Release();
800return thejret;
801}
802
803
804
805JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_RectangularGridValues (JNIEnv *env, jobject theobj, jobject XOrigin, jobject YOrigin, jobject XStep, jobject YStep, jobject RotationAngle)
806{
807
808jcas_Locking alock(env);
809{
810try {
811Standard_Real the_XOrigin = jcas_GetReal(env,XOrigin);
812Standard_Real the_YOrigin = jcas_GetReal(env,YOrigin);
813Standard_Real the_XStep = jcas_GetReal(env,XStep);
814Standard_Real the_YStep = jcas_GetReal(env,YStep);
815Standard_Real the_RotationAngle = jcas_GetReal(env,RotationAngle);
816Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
817the_this->RectangularGridValues(the_XOrigin,the_YOrigin,the_XStep,the_YStep,the_RotationAngle);
818jcas_SetReal(env,XOrigin,the_XOrigin);
819jcas_SetReal(env,YOrigin,the_YOrigin);
820jcas_SetReal(env,XStep,the_XStep);
821jcas_SetReal(env,YStep,the_YStep);
822jcas_SetReal(env,RotationAngle,the_RotationAngle);
823
824}
825catch (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}
832alock.Release();
833
834}
835
836
837
838JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_SetRectangularGridValues (JNIEnv *env, jobject theobj, jdouble XOrigin, jdouble YOrigin, jdouble XStep, jdouble YStep, jdouble RotationAngle)
839{
840
841jcas_Locking alock(env);
842{
843try {
844Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
845the_this->SetRectangularGridValues((Quantity_Length) XOrigin,(Quantity_Length) YOrigin,(Quantity_Length) XStep,(Quantity_Length) YStep,(Quantity_PlaneAngle) RotationAngle);
846
847}
848catch (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}
855alock.Release();
856
857}
858
859
860
861JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_CircularGridValues (JNIEnv *env, jobject theobj, jobject XOrigin, jobject YOrigin, jobject RadiusStep, jobject DivisionNumber, jobject RotationAngle)
862{
863
864jcas_Locking alock(env);
865{
866try {
867Standard_Real the_XOrigin = jcas_GetReal(env,XOrigin);
868Standard_Real the_YOrigin = jcas_GetReal(env,YOrigin);
869Standard_Real the_RadiusStep = jcas_GetReal(env,RadiusStep);
870Standard_Integer the_DivisionNumber = jcas_GetInteger(env,DivisionNumber);
871Standard_Real the_RotationAngle = jcas_GetReal(env,RotationAngle);
872Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
873the_this->CircularGridValues(the_XOrigin,the_YOrigin,the_RadiusStep,the_DivisionNumber,the_RotationAngle);
874jcas_SetReal(env,XOrigin,the_XOrigin);
875jcas_SetReal(env,YOrigin,the_YOrigin);
876jcas_SetReal(env,RadiusStep,the_RadiusStep);
877jcas_SetInteger(env,DivisionNumber,the_DivisionNumber);
878jcas_SetReal(env,RotationAngle,the_RotationAngle);
879
880}
881catch (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}
888alock.Release();
889
890}
891
892
893
894JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_SetCircularGridValues (JNIEnv *env, jobject theobj, jdouble XOrigin, jdouble YOrigin, jdouble RadiusStep, jint DivisionNumber, jdouble RotationAngle)
895{
896
897jcas_Locking alock(env);
898{
899try {
900Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
901the_this->SetCircularGridValues((Quantity_Length) XOrigin,(Quantity_Length) YOrigin,(Quantity_Length) RadiusStep,(Standard_Integer) DivisionNumber,(Quantity_PlaneAngle) RotationAngle);
902
903}
904catch (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}
911alock.Release();
912
913}
914
915
916
917JNIEXPORT void JNICALL Java_CASCADESamplesJni_V2d_1Viewer_SetGridColor (JNIEnv *env, jobject theobj, jobject color1, jobject color2)
918{
919
920jcas_Locking alock(env);
921{
922try {
923Quantity_Color* the_color1 = (Quantity_Color*) jcas_GetHandle(env,color1);
924if ( 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
934Quantity_Color* the_color2 = (Quantity_Color*) jcas_GetHandle(env,color2);
935if ( 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
945Handle(V2d_Viewer) the_this = *((Handle(V2d_Viewer)*) jcas_GetHandle(env,theobj));
946the_this->SetGridColor(*the_color1,*the_color2);
947
948}
949catch (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}
956alock.Release();
957
958}
959
960
961}