2 // Copyright (C) 1991 - 2000 by
3 // Matra Datavision SA. All rights reserved.
5 // Copyright (C) 2001 - 2004 by
6 // Open CASCADE SA. All rights reserved.
8 // This file is part of the Open CASCADE Technology software.
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.
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
21 #include <SampleHLRJni_Aspect_LineStyle.h>
22 #include <Aspect_LineStyle.hxx>
25 #include <Standard_ErrorHandler.hxx>
26 #include <Standard_Failure.hxx>
27 #include <Standard_SStream.hxx>
29 #include <Aspect_TypeOfLine.hxx>
30 #include <TColQuantity_Array1OfLength.hxx>
31 #include <Standard_Integer.hxx>
32 #include <Standard_Boolean.hxx>
38 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1LineStyle_Aspect_1LineStyle_1Create_11 (JNIEnv *env, jobject theobj)
41 jcas_Locking alock(env);
44 Aspect_LineStyle* theret = new Aspect_LineStyle();
45 jcas_SetHandle(env,theobj,theret);
48 catch (Standard_Failure) {
50 Err << Standard_Failure::Caught();
52 jcas_ThrowException(env,Err.str().c_str());
61 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1LineStyle_Aspect_1LineStyle_1Create_12 (JNIEnv *env, jobject theobj, jshort Type)
64 jcas_Locking alock(env);
67 Aspect_LineStyle* theret = new Aspect_LineStyle((Aspect_TypeOfLine) Type);
68 jcas_SetHandle(env,theobj,theret);
71 catch (Standard_Failure) {
73 Err << Standard_Failure::Caught();
75 jcas_ThrowException(env,Err.str().c_str());
84 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1LineStyle_Aspect_1LineStyle_1Create_13 (JNIEnv *env, jobject theobj, jobject Style)
87 jcas_Locking alock(env);
90 TColQuantity_Array1OfLength* the_Style = (TColQuantity_Array1OfLength*) jcas_GetHandle(env,Style);
91 if ( the_Style == NULL ) {
93 // The following assumes availability of the default constructor (what may not
94 // always be the case). Therefore explicit exception is thrown if the null
95 // object has been passed.
96 // the_Style = new TColQuantity_Array1OfLength ();
97 // jcas_SetHandle ( env, Style, the_Style );
98 jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
101 Aspect_LineStyle* theret = new Aspect_LineStyle(*the_Style);
102 jcas_SetHandle(env,theobj,theret);
105 catch (Standard_Failure) {
106 Standard_SStream Err;
107 Err << Standard_Failure::Caught();
109 jcas_ThrowException(env,Err.str().c_str());
118 JNIEXPORT jobject JNICALL Java_SampleHLRJni_Aspect_1LineStyle_Assign (JNIEnv *env, jobject theobj, jobject Other)
122 jcas_Locking alock(env);
125 Aspect_LineStyle* the_Other = (Aspect_LineStyle*) jcas_GetHandle(env,Other);
126 if ( the_Other == NULL ) {
128 // The following assumes availability of the default constructor (what may not
129 // always be the case). Therefore explicit exception is thrown if the null
130 // object has been passed.
131 // the_Other = new Aspect_LineStyle ();
132 // jcas_SetHandle ( env, Other, the_Other );
133 jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
136 Aspect_LineStyle* the_this = (Aspect_LineStyle*) jcas_GetHandle(env,theobj);
137 const Aspect_LineStyle& theret = the_this->Assign(*the_Other);
138 thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_LineStyle",&theret,0);
141 catch (Standard_Failure) {
142 Standard_SStream Err;
143 Err << Standard_Failure::Caught();
145 jcas_ThrowException(env,Err.str().c_str());
154 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1LineStyle_Aspect_1LineStyle_1SetValues_11 (JNIEnv *env, jobject theobj, jshort Type)
157 jcas_Locking alock(env);
160 Aspect_LineStyle* the_this = (Aspect_LineStyle*) jcas_GetHandle(env,theobj);
161 the_this->SetValues((Aspect_TypeOfLine) Type);
164 catch (Standard_Failure) {
165 Standard_SStream Err;
166 Err << Standard_Failure::Caught();
168 jcas_ThrowException(env,Err.str().c_str());
177 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1LineStyle_Aspect_1LineStyle_1SetValues_12 (JNIEnv *env, jobject theobj, jobject Style)
180 jcas_Locking alock(env);
183 TColQuantity_Array1OfLength* the_Style = (TColQuantity_Array1OfLength*) jcas_GetHandle(env,Style);
184 if ( the_Style == NULL ) {
186 // The following assumes availability of the default constructor (what may not
187 // always be the case). Therefore explicit exception is thrown if the null
188 // object has been passed.
189 // the_Style = new TColQuantity_Array1OfLength ();
190 // jcas_SetHandle ( env, Style, the_Style );
191 jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
194 Aspect_LineStyle* the_this = (Aspect_LineStyle*) jcas_GetHandle(env,theobj);
195 the_this->SetValues(*the_Style);
198 catch (Standard_Failure) {
199 Standard_SStream Err;
200 Err << Standard_Failure::Caught();
202 jcas_ThrowException(env,Err.str().c_str());
211 JNIEXPORT jshort JNICALL Java_SampleHLRJni_Aspect_1LineStyle_Style (JNIEnv *env, jobject theobj)
215 jcas_Locking alock(env);
218 Aspect_LineStyle* the_this = (Aspect_LineStyle*) jcas_GetHandle(env,theobj);
219 thejret = the_this->Style();
222 catch (Standard_Failure) {
223 Standard_SStream Err;
224 Err << Standard_Failure::Caught();
226 jcas_ThrowException(env,Err.str().c_str());
235 JNIEXPORT jint JNICALL Java_SampleHLRJni_Aspect_1LineStyle_Length (JNIEnv *env, jobject theobj)
239 jcas_Locking alock(env);
242 Aspect_LineStyle* the_this = (Aspect_LineStyle*) jcas_GetHandle(env,theobj);
243 thejret = the_this->Length();
246 catch (Standard_Failure) {
247 Standard_SStream Err;
248 Err << Standard_Failure::Caught();
250 jcas_ThrowException(env,Err.str().c_str());
259 JNIEXPORT jobject JNICALL Java_SampleHLRJni_Aspect_1LineStyle_Values (JNIEnv *env, jobject theobj)
263 jcas_Locking alock(env);
266 Aspect_LineStyle* the_this = (Aspect_LineStyle*) jcas_GetHandle(env,theobj);
267 const TColQuantity_Array1OfLength& theret = the_this->Values();
268 thejret = jcas_CreateObject(env,"CASCADESamplesJni/TColQuantity_Array1OfLength",&theret,0);
271 catch (Standard_Failure) {
272 Standard_SStream Err;
273 Err << Standard_Failure::Caught();
275 jcas_ThrowException(env,Err.str().c_str());
284 JNIEXPORT jboolean JNICALL Java_SampleHLRJni_Aspect_1LineStyle_IsEqual (JNIEnv *env, jobject theobj, jobject Other)
288 jcas_Locking alock(env);
291 Aspect_LineStyle* the_Other = (Aspect_LineStyle*) jcas_GetHandle(env,Other);
292 if ( the_Other == NULL ) {
294 // The following assumes availability of the default constructor (what may not
295 // always be the case). Therefore explicit exception is thrown if the null
296 // object has been passed.
297 // the_Other = new Aspect_LineStyle ();
298 // jcas_SetHandle ( env, Other, the_Other );
299 jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
302 Aspect_LineStyle* the_this = (Aspect_LineStyle*) jcas_GetHandle(env,theobj);
303 thejret = the_this->IsEqual(*the_Other);
306 catch (Standard_Failure) {
307 Standard_SStream Err;
308 Err << Standard_Failure::Caught();
310 jcas_ThrowException(env,Err.str().c_str());
319 JNIEXPORT jboolean JNICALL Java_SampleHLRJni_Aspect_1LineStyle_IsNotEqual (JNIEnv *env, jobject theobj, jobject Other)
323 jcas_Locking alock(env);
326 Aspect_LineStyle* the_Other = (Aspect_LineStyle*) jcas_GetHandle(env,Other);
327 if ( the_Other == NULL ) {
329 // The following assumes availability of the default constructor (what may not
330 // always be the case). Therefore explicit exception is thrown if the null
331 // object has been passed.
332 // the_Other = new Aspect_LineStyle ();
333 // jcas_SetHandle ( env, Other, the_Other );
334 jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
337 Aspect_LineStyle* the_this = (Aspect_LineStyle*) jcas_GetHandle(env,theobj);
338 thejret = the_this->IsNotEqual(*the_Other);
341 catch (Standard_Failure) {
342 Standard_SStream Err;
343 Err << Standard_Failure::Caught();
345 jcas_ThrowException(env,Err.str().c_str());
354 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1LineStyle_FinalizeValue(JNIEnv *, jclass, jlong theid)
357 Aspect_LineStyle* theobj = (Aspect_LineStyle*) theid;