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_AIS_Shape.h> |
22 | #include <AIS_Shape.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 <TopoDS_Shape.hxx> |
30 | #include <Standard_Integer.hxx> |
31 | #include <AIS_KindOfInteractive.hxx> |
32 | #include <Standard_Boolean.hxx> |
33 | #include <Standard_Real.hxx> |
34 | #include <Quantity_NameOfColor.hxx> |
35 | #include <Quantity_Color.hxx> |
36 | #include <Graphic3d_NameOfMaterial.hxx> |
37 | #include <Graphic3d_MaterialAspect.hxx> |
38 | #include <Bnd_Box.hxx> |
39 | #include <TopAbs_ShapeEnum.hxx> |
40 | #include <Prs3d_Drawer.hxx> |
41 | |
42 | |
43 | extern "C" { |
44 | |
45 | |
46 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_AIS_1Shape_AIS_1Shape_1Create_10 (JNIEnv *env, jobject theobj, jobject shap) |
47 | { |
48 | |
49 | jcas_Locking alock(env); |
50 | { |
51 | try { |
52 | TopoDS_Shape* the_shap = (TopoDS_Shape*) jcas_GetHandle(env,shap); |
53 | if ( the_shap == NULL ) { |
54 | |
55 | // The following assumes availability of the default constructor (what may not |
56 | // always be the case). Therefore explicit exception is thrown if the null |
57 | // object has been passed. |
58 | // the_shap = new TopoDS_Shape (); |
59 | // jcas_SetHandle ( env, shap, the_shap ); |
60 | jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value"); |
61 | |
62 | } // end if |
63 | Handle(AIS_Shape)* theret = new Handle(AIS_Shape); |
64 | *theret = new AIS_Shape(*the_shap); |
65 | jcas_SetHandle(env,theobj,theret); |
66 | |
67 | } |
68 | catch (Standard_Failure) { |
69 | Standard_SStream Err; |
70 | Err << Standard_Failure::Caught(); |
71 | Err << (char) 0; |
72 | jcas_ThrowException(env,Err.str().c_str()); |
73 | } |
74 | } |
75 | alock.Release(); |
76 | |
77 | } |
78 | |
79 | |
80 | |
81 | JNIEXPORT jint JNICALL Java_CASCADESamplesJni_AIS_1Shape_Signature (JNIEnv *env, jobject theobj) |
82 | { |
83 | jint thejret; |
84 | |
85 | jcas_Locking alock(env); |
86 | { |
87 | try { |
88 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
89 | thejret = the_this->Signature(); |
90 | |
91 | } |
92 | catch (Standard_Failure) { |
93 | Standard_SStream Err; |
94 | Err << Standard_Failure::Caught(); |
95 | Err << (char) 0; |
96 | jcas_ThrowException(env,Err.str().c_str()); |
97 | } |
98 | } |
99 | alock.Release(); |
100 | return thejret; |
101 | } |
102 | |
103 | |
104 | |
105 | JNIEXPORT jshort JNICALL Java_CASCADESamplesJni_AIS_1Shape_Type (JNIEnv *env, jobject theobj) |
106 | { |
107 | jshort thejret; |
108 | |
109 | jcas_Locking alock(env); |
110 | { |
111 | try { |
112 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
113 | thejret = the_this->Type(); |
114 | |
115 | } |
116 | catch (Standard_Failure) { |
117 | Standard_SStream Err; |
118 | Err << Standard_Failure::Caught(); |
119 | Err << (char) 0; |
120 | jcas_ThrowException(env,Err.str().c_str()); |
121 | } |
122 | } |
123 | alock.Release(); |
124 | return thejret; |
125 | } |
126 | |
127 | |
128 | |
129 | JNIEXPORT jboolean JNICALL Java_CASCADESamplesJni_AIS_1Shape_AcceptShapeDecomposition (JNIEnv *env, jobject theobj) |
130 | { |
131 | jboolean thejret; |
132 | |
133 | jcas_Locking alock(env); |
134 | { |
135 | try { |
136 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
137 | thejret = the_this->AcceptShapeDecomposition(); |
138 | |
139 | } |
140 | catch (Standard_Failure) { |
141 | Standard_SStream Err; |
142 | Err << Standard_Failure::Caught(); |
143 | Err << (char) 0; |
144 | jcas_ThrowException(env,Err.str().c_str()); |
145 | } |
146 | } |
147 | alock.Release(); |
148 | return thejret; |
149 | } |
150 | |
151 | |
152 | |
153 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_AIS_1Shape_Set (JNIEnv *env, jobject theobj, jobject ashap) |
154 | { |
155 | |
156 | jcas_Locking alock(env); |
157 | { |
158 | try { |
159 | TopoDS_Shape* the_ashap = (TopoDS_Shape*) jcas_GetHandle(env,ashap); |
160 | if ( the_ashap == NULL ) { |
161 | |
162 | // The following assumes availability of the default constructor (what may not |
163 | // always be the case). Therefore explicit exception is thrown if the null |
164 | // object has been passed. |
165 | // the_ashap = new TopoDS_Shape (); |
166 | // jcas_SetHandle ( env, ashap, the_ashap ); |
167 | jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value"); |
168 | |
169 | } // end if |
170 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
171 | the_this->Set(*the_ashap); |
172 | |
173 | } |
174 | catch (Standard_Failure) { |
175 | Standard_SStream Err; |
176 | Err << Standard_Failure::Caught(); |
177 | Err << (char) 0; |
178 | jcas_ThrowException(env,Err.str().c_str()); |
179 | } |
180 | } |
181 | alock.Release(); |
182 | |
183 | } |
184 | |
185 | |
186 | |
187 | JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_AIS_1Shape_Shape (JNIEnv *env, jobject theobj) |
188 | { |
189 | jobject thejret; |
190 | |
191 | jcas_Locking alock(env); |
192 | { |
193 | try { |
194 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
195 | const TopoDS_Shape& theret = the_this->Shape(); |
196 | thejret = jcas_CreateObject(env,"CASCADESamplesJni/TopoDS_Shape",&theret,0); |
197 | |
198 | } |
199 | catch (Standard_Failure) { |
200 | Standard_SStream Err; |
201 | Err << Standard_Failure::Caught(); |
202 | Err << (char) 0; |
203 | jcas_ThrowException(env,Err.str().c_str()); |
204 | } |
205 | } |
206 | alock.Release(); |
207 | return thejret; |
208 | } |
209 | |
210 | |
211 | |
212 | JNIEXPORT jboolean JNICALL Java_CASCADESamplesJni_AIS_1Shape_AIS_1Shape_1SetOwnDeviationCoefficient_11 (JNIEnv *env, jobject theobj) |
213 | { |
214 | jboolean thejret; |
215 | |
216 | jcas_Locking alock(env); |
217 | { |
218 | try { |
219 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
220 | thejret = the_this->SetOwnDeviationCoefficient(); |
221 | |
222 | } |
223 | catch (Standard_Failure) { |
224 | Standard_SStream Err; |
225 | Err << Standard_Failure::Caught(); |
226 | Err << (char) 0; |
227 | jcas_ThrowException(env,Err.str().c_str()); |
228 | } |
229 | } |
230 | alock.Release(); |
231 | return thejret; |
232 | } |
233 | |
234 | |
235 | |
236 | JNIEXPORT jboolean JNICALL Java_CASCADESamplesJni_AIS_1Shape_AIS_1Shape_1SetOwnHLRDeviationCoefficient_11 (JNIEnv *env, jobject theobj) |
237 | { |
238 | jboolean thejret; |
239 | |
240 | jcas_Locking alock(env); |
241 | { |
242 | try { |
243 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
244 | thejret = the_this->SetOwnHLRDeviationCoefficient(); |
245 | |
246 | } |
247 | catch (Standard_Failure) { |
248 | Standard_SStream Err; |
249 | Err << Standard_Failure::Caught(); |
250 | Err << (char) 0; |
251 | jcas_ThrowException(env,Err.str().c_str()); |
252 | } |
253 | } |
254 | alock.Release(); |
255 | return thejret; |
256 | } |
257 | |
258 | |
259 | |
260 | JNIEXPORT jboolean JNICALL Java_CASCADESamplesJni_AIS_1Shape_AIS_1Shape_1SetOwnDeviationAngle_11 (JNIEnv *env, jobject theobj) |
261 | { |
262 | jboolean thejret; |
263 | |
264 | jcas_Locking alock(env); |
265 | { |
266 | try { |
267 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
268 | thejret = the_this->SetOwnDeviationAngle(); |
269 | |
270 | } |
271 | catch (Standard_Failure) { |
272 | Standard_SStream Err; |
273 | Err << Standard_Failure::Caught(); |
274 | Err << (char) 0; |
275 | jcas_ThrowException(env,Err.str().c_str()); |
276 | } |
277 | } |
278 | alock.Release(); |
279 | return thejret; |
280 | } |
281 | |
282 | |
283 | |
284 | JNIEXPORT jboolean JNICALL Java_CASCADESamplesJni_AIS_1Shape_AIS_1Shape_1SetOwnHLRDeviationAngle_11 (JNIEnv *env, jobject theobj) |
285 | { |
286 | jboolean thejret; |
287 | |
288 | jcas_Locking alock(env); |
289 | { |
290 | try { |
291 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
292 | thejret = the_this->SetOwnHLRDeviationAngle(); |
293 | |
294 | } |
295 | catch (Standard_Failure) { |
296 | Standard_SStream Err; |
297 | Err << Standard_Failure::Caught(); |
298 | Err << (char) 0; |
299 | jcas_ThrowException(env,Err.str().c_str()); |
300 | } |
301 | } |
302 | alock.Release(); |
303 | return thejret; |
304 | } |
305 | |
306 | |
307 | |
308 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_AIS_1Shape_AIS_1Shape_1SetOwnDeviationCoefficient_12 (JNIEnv *env, jobject theobj, jdouble aCoefficient) |
309 | { |
310 | |
311 | jcas_Locking alock(env); |
312 | { |
313 | try { |
314 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
315 | the_this->SetOwnDeviationCoefficient((Standard_Real) aCoefficient); |
316 | |
317 | } |
318 | catch (Standard_Failure) { |
319 | Standard_SStream Err; |
320 | Err << Standard_Failure::Caught(); |
321 | Err << (char) 0; |
322 | jcas_ThrowException(env,Err.str().c_str()); |
323 | } |
324 | } |
325 | alock.Release(); |
326 | |
327 | } |
328 | |
329 | |
330 | |
331 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_AIS_1Shape_AIS_1Shape_1SetOwnHLRDeviationCoefficient_12 (JNIEnv *env, jobject theobj, jdouble aCoefficient) |
332 | { |
333 | |
334 | jcas_Locking alock(env); |
335 | { |
336 | try { |
337 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
338 | the_this->SetOwnHLRDeviationCoefficient((Standard_Real) aCoefficient); |
339 | |
340 | } |
341 | catch (Standard_Failure) { |
342 | Standard_SStream Err; |
343 | Err << Standard_Failure::Caught(); |
344 | Err << (char) 0; |
345 | jcas_ThrowException(env,Err.str().c_str()); |
346 | } |
347 | } |
348 | alock.Release(); |
349 | |
350 | } |
351 | |
352 | |
353 | |
354 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_AIS_1Shape_SetAngleAndDeviation (JNIEnv *env, jobject theobj, jdouble anAngle) |
355 | { |
356 | |
357 | jcas_Locking alock(env); |
358 | { |
359 | try { |
360 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
361 | the_this->SetAngleAndDeviation((Standard_Real) anAngle); |
362 | |
363 | } |
364 | catch (Standard_Failure) { |
365 | Standard_SStream Err; |
366 | Err << Standard_Failure::Caught(); |
367 | Err << (char) 0; |
368 | jcas_ThrowException(env,Err.str().c_str()); |
369 | } |
370 | } |
371 | alock.Release(); |
372 | |
373 | } |
374 | |
375 | |
376 | |
377 | JNIEXPORT jdouble JNICALL Java_CASCADESamplesJni_AIS_1Shape_UserAngle (JNIEnv *env, jobject theobj) |
378 | { |
379 | jdouble thejret; |
380 | |
381 | jcas_Locking alock(env); |
382 | { |
383 | try { |
384 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
385 | thejret = the_this->UserAngle(); |
386 | |
387 | } |
388 | catch (Standard_Failure) { |
389 | Standard_SStream Err; |
390 | Err << Standard_Failure::Caught(); |
391 | Err << (char) 0; |
392 | jcas_ThrowException(env,Err.str().c_str()); |
393 | } |
394 | } |
395 | alock.Release(); |
396 | return thejret; |
397 | } |
398 | |
399 | |
400 | |
401 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_AIS_1Shape_AIS_1Shape_1SetOwnDeviationAngle_12 (JNIEnv *env, jobject theobj, jdouble anAngle) |
402 | { |
403 | |
404 | jcas_Locking alock(env); |
405 | { |
406 | try { |
407 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
408 | the_this->SetOwnDeviationAngle((Standard_Real) anAngle); |
409 | |
410 | } |
411 | catch (Standard_Failure) { |
412 | Standard_SStream Err; |
413 | Err << Standard_Failure::Caught(); |
414 | Err << (char) 0; |
415 | jcas_ThrowException(env,Err.str().c_str()); |
416 | } |
417 | } |
418 | alock.Release(); |
419 | |
420 | } |
421 | |
422 | |
423 | |
424 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_AIS_1Shape_SetHLRAngleAndDeviation (JNIEnv *env, jobject theobj, jdouble anAngle) |
425 | { |
426 | |
427 | jcas_Locking alock(env); |
428 | { |
429 | try { |
430 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
431 | the_this->SetHLRAngleAndDeviation((Standard_Real) anAngle); |
432 | |
433 | } |
434 | catch (Standard_Failure) { |
435 | Standard_SStream Err; |
436 | Err << Standard_Failure::Caught(); |
437 | Err << (char) 0; |
438 | jcas_ThrowException(env,Err.str().c_str()); |
439 | } |
440 | } |
441 | alock.Release(); |
442 | |
443 | } |
444 | |
445 | |
446 | |
447 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_AIS_1Shape_AIS_1Shape_1SetOwnHLRDeviationAngle_12 (JNIEnv *env, jobject theobj, jdouble anAngle) |
448 | { |
449 | |
450 | jcas_Locking alock(env); |
451 | { |
452 | try { |
453 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
454 | the_this->SetOwnHLRDeviationAngle((Standard_Real) anAngle); |
455 | |
456 | } |
457 | catch (Standard_Failure) { |
458 | Standard_SStream Err; |
459 | Err << Standard_Failure::Caught(); |
460 | Err << (char) 0; |
461 | jcas_ThrowException(env,Err.str().c_str()); |
462 | } |
463 | } |
464 | alock.Release(); |
465 | |
466 | } |
467 | |
468 | |
469 | |
470 | JNIEXPORT jboolean JNICALL Java_CASCADESamplesJni_AIS_1Shape_OwnDeviationCoefficient (JNIEnv *env, jobject theobj, jobject aCoefficient, jobject aPreviousCoefficient) |
471 | { |
472 | jboolean thejret; |
473 | |
474 | jcas_Locking alock(env); |
475 | { |
476 | try { |
477 | Standard_Real the_aCoefficient = jcas_GetReal(env,aCoefficient); |
478 | Standard_Real the_aPreviousCoefficient = jcas_GetReal(env,aPreviousCoefficient); |
479 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
480 | thejret = the_this->OwnDeviationCoefficient(the_aCoefficient,the_aPreviousCoefficient); |
481 | jcas_SetReal(env,aCoefficient,the_aCoefficient); |
482 | jcas_SetReal(env,aPreviousCoefficient,the_aPreviousCoefficient); |
483 | |
484 | } |
485 | catch (Standard_Failure) { |
486 | Standard_SStream Err; |
487 | Err << Standard_Failure::Caught(); |
488 | Err << (char) 0; |
489 | jcas_ThrowException(env,Err.str().c_str()); |
490 | } |
491 | } |
492 | alock.Release(); |
493 | return thejret; |
494 | } |
495 | |
496 | |
497 | |
498 | JNIEXPORT jboolean JNICALL Java_CASCADESamplesJni_AIS_1Shape_OwnHLRDeviationCoefficient (JNIEnv *env, jobject theobj, jobject aCoefficient, jobject aPreviousCoefficient) |
499 | { |
500 | jboolean thejret; |
501 | |
502 | jcas_Locking alock(env); |
503 | { |
504 | try { |
505 | Standard_Real the_aCoefficient = jcas_GetReal(env,aCoefficient); |
506 | Standard_Real the_aPreviousCoefficient = jcas_GetReal(env,aPreviousCoefficient); |
507 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
508 | thejret = the_this->OwnHLRDeviationCoefficient(the_aCoefficient,the_aPreviousCoefficient); |
509 | jcas_SetReal(env,aCoefficient,the_aCoefficient); |
510 | jcas_SetReal(env,aPreviousCoefficient,the_aPreviousCoefficient); |
511 | |
512 | } |
513 | catch (Standard_Failure) { |
514 | Standard_SStream Err; |
515 | Err << Standard_Failure::Caught(); |
516 | Err << (char) 0; |
517 | jcas_ThrowException(env,Err.str().c_str()); |
518 | } |
519 | } |
520 | alock.Release(); |
521 | return thejret; |
522 | } |
523 | |
524 | |
525 | |
526 | JNIEXPORT jboolean JNICALL Java_CASCADESamplesJni_AIS_1Shape_OwnDeviationAngle (JNIEnv *env, jobject theobj, jobject anAngle, jobject aPreviousAngle) |
527 | { |
528 | jboolean thejret; |
529 | |
530 | jcas_Locking alock(env); |
531 | { |
532 | try { |
533 | Standard_Real the_anAngle = jcas_GetReal(env,anAngle); |
534 | Standard_Real the_aPreviousAngle = jcas_GetReal(env,aPreviousAngle); |
535 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
536 | thejret = the_this->OwnDeviationAngle(the_anAngle,the_aPreviousAngle); |
537 | jcas_SetReal(env,anAngle,the_anAngle); |
538 | jcas_SetReal(env,aPreviousAngle,the_aPreviousAngle); |
539 | |
540 | } |
541 | catch (Standard_Failure) { |
542 | Standard_SStream Err; |
543 | Err << Standard_Failure::Caught(); |
544 | Err << (char) 0; |
545 | jcas_ThrowException(env,Err.str().c_str()); |
546 | } |
547 | } |
548 | alock.Release(); |
549 | return thejret; |
550 | } |
551 | |
552 | |
553 | |
554 | JNIEXPORT jboolean JNICALL Java_CASCADESamplesJni_AIS_1Shape_OwnHLRDeviationAngle (JNIEnv *env, jobject theobj, jobject anAngle, jobject aPreviousAngle) |
555 | { |
556 | jboolean thejret; |
557 | |
558 | jcas_Locking alock(env); |
559 | { |
560 | try { |
561 | Standard_Real the_anAngle = jcas_GetReal(env,anAngle); |
562 | Standard_Real the_aPreviousAngle = jcas_GetReal(env,aPreviousAngle); |
563 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
564 | thejret = the_this->OwnHLRDeviationAngle(the_anAngle,the_aPreviousAngle); |
565 | jcas_SetReal(env,anAngle,the_anAngle); |
566 | jcas_SetReal(env,aPreviousAngle,the_aPreviousAngle); |
567 | |
568 | } |
569 | catch (Standard_Failure) { |
570 | Standard_SStream Err; |
571 | Err << Standard_Failure::Caught(); |
572 | Err << (char) 0; |
573 | jcas_ThrowException(env,Err.str().c_str()); |
574 | } |
575 | } |
576 | alock.Release(); |
577 | return thejret; |
578 | } |
579 | |
580 | |
581 | |
582 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_AIS_1Shape_AIS_1Shape_1SetColor_11 (JNIEnv *env, jobject theobj, jshort aColor) |
583 | { |
584 | |
585 | jcas_Locking alock(env); |
586 | { |
587 | try { |
588 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
589 | the_this->SetColor((Quantity_NameOfColor) aColor); |
590 | |
591 | } |
592 | catch (Standard_Failure) { |
593 | Standard_SStream Err; |
594 | Err << Standard_Failure::Caught(); |
595 | Err << (char) 0; |
596 | jcas_ThrowException(env,Err.str().c_str()); |
597 | } |
598 | } |
599 | alock.Release(); |
600 | |
601 | } |
602 | |
603 | |
604 | |
605 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_AIS_1Shape_AIS_1Shape_1SetColor_12 (JNIEnv *env, jobject theobj, jobject aColor) |
606 | { |
607 | |
608 | jcas_Locking alock(env); |
609 | { |
610 | try { |
611 | Quantity_Color* the_aColor = (Quantity_Color*) jcas_GetHandle(env,aColor); |
612 | if ( the_aColor == NULL ) { |
613 | |
614 | // The following assumes availability of the default constructor (what may not |
615 | // always be the case). Therefore explicit exception is thrown if the null |
616 | // object has been passed. |
617 | // the_aColor = new Quantity_Color (); |
618 | // jcas_SetHandle ( env, aColor, the_aColor ); |
619 | jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value"); |
620 | |
621 | } // end if |
622 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
623 | the_this->SetColor(*the_aColor); |
624 | |
625 | } |
626 | catch (Standard_Failure) { |
627 | Standard_SStream Err; |
628 | Err << Standard_Failure::Caught(); |
629 | Err << (char) 0; |
630 | jcas_ThrowException(env,Err.str().c_str()); |
631 | } |
632 | } |
633 | alock.Release(); |
634 | |
635 | } |
636 | |
637 | |
638 | |
639 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_AIS_1Shape_UnsetColor (JNIEnv *env, jobject theobj) |
640 | { |
641 | |
642 | jcas_Locking alock(env); |
643 | { |
644 | try { |
645 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
646 | the_this->UnsetColor(); |
647 | |
648 | } |
649 | catch (Standard_Failure) { |
650 | Standard_SStream Err; |
651 | Err << Standard_Failure::Caught(); |
652 | Err << (char) 0; |
653 | jcas_ThrowException(env,Err.str().c_str()); |
654 | } |
655 | } |
656 | alock.Release(); |
657 | |
658 | } |
659 | |
660 | |
661 | |
662 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_AIS_1Shape_SetWidth (JNIEnv *env, jobject theobj, jdouble aValue) |
663 | { |
664 | |
665 | jcas_Locking alock(env); |
666 | { |
667 | try { |
668 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
669 | the_this->SetWidth((Standard_Real) aValue); |
670 | |
671 | } |
672 | catch (Standard_Failure) { |
673 | Standard_SStream Err; |
674 | Err << Standard_Failure::Caught(); |
675 | Err << (char) 0; |
676 | jcas_ThrowException(env,Err.str().c_str()); |
677 | } |
678 | } |
679 | alock.Release(); |
680 | |
681 | } |
682 | |
683 | |
684 | |
685 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_AIS_1Shape_UnsetWidth (JNIEnv *env, jobject theobj) |
686 | { |
687 | |
688 | jcas_Locking alock(env); |
689 | { |
690 | try { |
691 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
692 | the_this->UnsetWidth(); |
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 | |
704 | } |
705 | |
706 | |
707 | |
708 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_AIS_1Shape_AIS_1Shape_1SetMaterial_11 (JNIEnv *env, jobject theobj, jshort aName) |
709 | { |
710 | |
711 | jcas_Locking alock(env); |
712 | { |
713 | try { |
714 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
715 | the_this->SetMaterial((Graphic3d_NameOfMaterial) aName); |
716 | |
717 | } |
718 | catch (Standard_Failure) { |
719 | Standard_SStream Err; |
720 | Err << Standard_Failure::Caught(); |
721 | Err << (char) 0; |
722 | jcas_ThrowException(env,Err.str().c_str()); |
723 | } |
724 | } |
725 | alock.Release(); |
726 | |
727 | } |
728 | |
729 | |
730 | |
731 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_AIS_1Shape_AIS_1Shape_1SetMaterial_12 (JNIEnv *env, jobject theobj, jobject aName) |
732 | { |
733 | |
734 | jcas_Locking alock(env); |
735 | { |
736 | try { |
737 | Graphic3d_MaterialAspect* the_aName = (Graphic3d_MaterialAspect*) jcas_GetHandle(env,aName); |
738 | if ( the_aName == NULL ) { |
739 | |
740 | // The following assumes availability of the default constructor (what may not |
741 | // always be the case). Therefore explicit exception is thrown if the null |
742 | // object has been passed. |
743 | // the_aName = new Graphic3d_MaterialAspect (); |
744 | // jcas_SetHandle ( env, aName, the_aName ); |
745 | jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value"); |
746 | |
747 | } // end if |
748 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
749 | the_this->SetMaterial(*the_aName); |
750 | |
751 | } |
752 | catch (Standard_Failure) { |
753 | Standard_SStream Err; |
754 | Err << Standard_Failure::Caught(); |
755 | Err << (char) 0; |
756 | jcas_ThrowException(env,Err.str().c_str()); |
757 | } |
758 | } |
759 | alock.Release(); |
760 | |
761 | } |
762 | |
763 | |
764 | |
765 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_AIS_1Shape_UnsetMaterial (JNIEnv *env, jobject theobj) |
766 | { |
767 | |
768 | jcas_Locking alock(env); |
769 | { |
770 | try { |
771 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
772 | the_this->UnsetMaterial(); |
773 | |
774 | } |
775 | catch (Standard_Failure) { |
776 | Standard_SStream Err; |
777 | Err << Standard_Failure::Caught(); |
778 | Err << (char) 0; |
779 | jcas_ThrowException(env,Err.str().c_str()); |
780 | } |
781 | } |
782 | alock.Release(); |
783 | |
784 | } |
785 | |
786 | |
787 | |
788 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_AIS_1Shape_SetTransparency (JNIEnv *env, jobject theobj, jdouble aValue) |
789 | { |
790 | |
791 | jcas_Locking alock(env); |
792 | { |
793 | try { |
794 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
795 | the_this->SetTransparency((Standard_Real) aValue); |
796 | |
797 | } |
798 | catch (Standard_Failure) { |
799 | Standard_SStream Err; |
800 | Err << Standard_Failure::Caught(); |
801 | Err << (char) 0; |
802 | jcas_ThrowException(env,Err.str().c_str()); |
803 | } |
804 | } |
805 | alock.Release(); |
806 | |
807 | } |
808 | |
809 | |
810 | |
811 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_AIS_1Shape_UnsetTransparency (JNIEnv *env, jobject theobj) |
812 | { |
813 | |
814 | jcas_Locking alock(env); |
815 | { |
816 | try { |
817 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
818 | the_this->UnsetTransparency(); |
819 | |
820 | } |
821 | catch (Standard_Failure) { |
822 | Standard_SStream Err; |
823 | Err << Standard_Failure::Caught(); |
824 | Err << (char) 0; |
825 | jcas_ThrowException(env,Err.str().c_str()); |
826 | } |
827 | } |
828 | alock.Release(); |
829 | |
830 | } |
831 | |
832 | |
833 | |
834 | JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_AIS_1Shape_BoundingBox (JNIEnv *env, jobject theobj) |
835 | { |
836 | jobject thejret; |
837 | |
838 | jcas_Locking alock(env); |
839 | { |
840 | try { |
841 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
842 | const Bnd_Box& theret = the_this->BoundingBox(); |
843 | thejret = jcas_CreateObject(env,"CASCADESamplesJni/Bnd_Box",&theret,0); |
844 | |
845 | } |
846 | catch (Standard_Failure) { |
847 | Standard_SStream Err; |
848 | Err << Standard_Failure::Caught(); |
849 | Err << (char) 0; |
850 | jcas_ThrowException(env,Err.str().c_str()); |
851 | } |
852 | } |
853 | alock.Release(); |
854 | return thejret; |
855 | } |
856 | |
857 | |
858 | |
859 | JNIEXPORT jshort JNICALL Java_CASCADESamplesJni_AIS_1Shape_AIS_1Shape_1Color_11 (JNIEnv *env, jobject theobj) |
860 | { |
861 | jshort thejret; |
862 | |
863 | jcas_Locking alock(env); |
864 | { |
865 | try { |
866 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
867 | thejret = the_this->Color(); |
868 | |
869 | } |
870 | catch (Standard_Failure) { |
871 | Standard_SStream Err; |
872 | Err << Standard_Failure::Caught(); |
873 | Err << (char) 0; |
874 | jcas_ThrowException(env,Err.str().c_str()); |
875 | } |
876 | } |
877 | alock.Release(); |
878 | return thejret; |
879 | } |
880 | |
881 | |
882 | |
883 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_AIS_1Shape_AIS_1Shape_1Color_12 (JNIEnv *env, jobject theobj, jobject aColor) |
884 | { |
885 | |
886 | jcas_Locking alock(env); |
887 | { |
888 | try { |
889 | Quantity_Color* the_aColor = (Quantity_Color*) jcas_GetHandle(env,aColor); |
890 | if ( the_aColor == NULL ) { |
891 | |
892 | // The following assumes availability of the default constructor (what may not |
893 | // always be the case). Therefore explicit exception is thrown if the null |
894 | // object has been passed. |
895 | // the_aColor = new Quantity_Color (); |
896 | // jcas_SetHandle ( env, aColor, the_aColor ); |
897 | jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value"); |
898 | |
899 | } // end if |
900 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
901 | the_this->Color(*the_aColor); |
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 jshort JNICALL Java_CASCADESamplesJni_AIS_1Shape_Material (JNIEnv *env, jobject theobj) |
918 | { |
919 | jshort thejret; |
920 | |
921 | jcas_Locking alock(env); |
922 | { |
923 | try { |
924 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
925 | thejret = the_this->Material(); |
926 | |
927 | } |
928 | catch (Standard_Failure) { |
929 | Standard_SStream Err; |
930 | Err << Standard_Failure::Caught(); |
931 | Err << (char) 0; |
932 | jcas_ThrowException(env,Err.str().c_str()); |
933 | } |
934 | } |
935 | alock.Release(); |
936 | return thejret; |
937 | } |
938 | |
939 | |
940 | |
941 | JNIEXPORT jdouble JNICALL Java_CASCADESamplesJni_AIS_1Shape_Transparency (JNIEnv *env, jobject theobj) |
942 | { |
943 | jdouble thejret; |
944 | |
945 | jcas_Locking alock(env); |
946 | { |
947 | try { |
948 | Handle(AIS_Shape) the_this = *((Handle(AIS_Shape)*) jcas_GetHandle(env,theobj)); |
949 | thejret = the_this->Transparency(); |
950 | |
951 | } |
952 | catch (Standard_Failure) { |
953 | Standard_SStream Err; |
954 | Err << Standard_Failure::Caught(); |
955 | Err << (char) 0; |
956 | jcas_ThrowException(env,Err.str().c_str()); |
957 | } |
958 | } |
959 | alock.Release(); |
960 | return thejret; |
961 | } |
962 | |
963 | |
964 | |
965 | JNIEXPORT jshort JNICALL Java_CASCADESamplesJni_AIS_1Shape_SelectionType (JNIEnv *env, jclass, jint aDecompositionMode) |
966 | { |
967 | jshort thejret; |
968 | |
969 | jcas_Locking alock(env); |
970 | { |
971 | try { |
972 | thejret = AIS_Shape::SelectionType((Standard_Integer) aDecompositionMode); |
973 | |
974 | } |
975 | catch (Standard_Failure) { |
976 | Standard_SStream Err; |
977 | Err << Standard_Failure::Caught(); |
978 | Err << (char) 0; |
979 | jcas_ThrowException(env,Err.str().c_str()); |
980 | } |
981 | } |
982 | alock.Release(); |
983 | return thejret; |
984 | } |
985 | |
986 | |
987 | |
988 | JNIEXPORT jint JNICALL Java_CASCADESamplesJni_AIS_1Shape_SelectionMode (JNIEnv *env, jclass, jshort aShapeType) |
989 | { |
990 | jint thejret; |
991 | |
992 | jcas_Locking alock(env); |
993 | { |
994 | try { |
995 | thejret = AIS_Shape::SelectionMode((TopAbs_ShapeEnum) aShapeType); |
996 | |
997 | } |
998 | catch (Standard_Failure) { |
999 | Standard_SStream Err; |
1000 | Err << Standard_Failure::Caught(); |
1001 | Err << (char) 0; |
1002 | jcas_ThrowException(env,Err.str().c_str()); |
1003 | } |
1004 | } |
1005 | alock.Release(); |
1006 | return thejret; |
1007 | } |
1008 | |
1009 | |
1010 | |
1011 | JNIEXPORT jdouble JNICALL Java_CASCADESamplesJni_AIS_1Shape_GetDeflection (JNIEnv *env, jclass, jobject aShape, jobject aDrawer) |
1012 | { |
1013 | jdouble thejret; |
1014 | |
1015 | jcas_Locking alock(env); |
1016 | { |
1017 | try { |
1018 | TopoDS_Shape* the_aShape = (TopoDS_Shape*) jcas_GetHandle(env,aShape); |
1019 | if ( the_aShape == NULL ) { |
1020 | |
1021 | // The following assumes availability of the default constructor (what may not |
1022 | // always be the case). Therefore explicit exception is thrown if the null |
1023 | // object has been passed. |
1024 | // the_aShape = new TopoDS_Shape (); |
1025 | // jcas_SetHandle ( env, aShape, the_aShape ); |
1026 | jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value"); |
1027 | |
1028 | } // end if |
1029 | Handle( Prs3d_Drawer ) the_aDrawer; |
1030 | void* ptr_aDrawer = jcas_GetHandle(env,aDrawer); |
1031 | |
1032 | if ( ptr_aDrawer != NULL ) the_aDrawer = *( ( Handle( Prs3d_Drawer )* )ptr_aDrawer ); |
1033 | |
1034 | thejret = AIS_Shape::GetDeflection(*the_aShape,the_aDrawer); |
1035 | |
1036 | } |
1037 | catch (Standard_Failure) { |
1038 | Standard_SStream Err; |
1039 | Err << Standard_Failure::Caught(); |
1040 | Err << (char) 0; |
1041 | jcas_ThrowException(env,Err.str().c_str()); |
1042 | } |
1043 | } |
1044 | alock.Release(); |
1045 | return thejret; |
1046 | } |
1047 | |
1048 | |
1049 | } |