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_GenericColorMap.h>
22 #include <Aspect_GenericColorMap.hxx>
25 #include <Standard_ErrorHandler.hxx>
26 #include <Standard_Failure.hxx>
27 #include <Standard_SStream.hxx>
29 #include <Aspect_ColorMapEntry.hxx>
30 #include <Standard_Integer.hxx>
31 #include <Quantity_Color.hxx>
37 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1GenericColorMap_Aspect_1GenericColorMap_1Create_10 (JNIEnv *env, jobject theobj)
40 jcas_Locking alock(env);
43 Handle(Aspect_GenericColorMap)* theret = new Handle(Aspect_GenericColorMap);
44 *theret = new Aspect_GenericColorMap();
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_1GenericColorMap_Aspect_1GenericColorMap_1AddEntry_11 (JNIEnv *env, jobject theobj, jobject AnEntry)
64 jcas_Locking alock(env);
67 Aspect_ColorMapEntry* the_AnEntry = (Aspect_ColorMapEntry*) jcas_GetHandle(env,AnEntry);
68 if ( the_AnEntry == NULL ) {
70 // The following assumes availability of the default constructor (what may not
71 // always be the case). Therefore explicit exception is thrown if the null
72 // object has been passed.
73 // the_AnEntry = new Aspect_ColorMapEntry ();
74 // jcas_SetHandle ( env, AnEntry, the_AnEntry );
75 jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
78 Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj));
79 the_this->AddEntry(*the_AnEntry);
82 catch (Standard_Failure) {
84 Err << Standard_Failure::Caught();
86 jcas_ThrowException(env,Err.str().c_str());
95 JNIEXPORT jint JNICALL Java_SampleHLRJni_Aspect_1GenericColorMap_Aspect_1GenericColorMap_1AddEntry_12 (JNIEnv *env, jobject theobj, jobject aColor)
99 jcas_Locking alock(env);
102 Quantity_Color* the_aColor = (Quantity_Color*) jcas_GetHandle(env,aColor);
103 if ( the_aColor == NULL ) {
105 // The following assumes availability of the default constructor (what may not
106 // always be the case). Therefore explicit exception is thrown if the null
107 // object has been passed.
108 // the_aColor = new Quantity_Color ();
109 // jcas_SetHandle ( env, aColor, the_aColor );
110 jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
113 Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj));
114 thejret = the_this->AddEntry(*the_aColor);
117 catch (Standard_Failure) {
118 Standard_SStream Err;
119 Err << Standard_Failure::Caught();
121 jcas_ThrowException(env,Err.str().c_str());
130 JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1GenericColorMap_RemoveEntry (JNIEnv *env, jobject theobj, jint AColorMapEntryIndex)
133 jcas_Locking alock(env);
136 Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj));
137 the_this->RemoveEntry((Standard_Integer) AColorMapEntryIndex);
140 catch (Standard_Failure) {
141 Standard_SStream Err;
142 Err << Standard_Failure::Caught();
144 jcas_ThrowException(env,Err.str().c_str());
153 JNIEXPORT jint JNICALL Java_SampleHLRJni_Aspect_1GenericColorMap_FindColorMapIndex (JNIEnv *env, jobject theobj, jint AColorMapEntryIndex)
157 jcas_Locking alock(env);
160 Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj));
161 thejret = the_this->FindColorMapIndex((Standard_Integer) AColorMapEntryIndex);
164 catch (Standard_Failure) {
165 Standard_SStream Err;
166 Err << Standard_Failure::Caught();
168 jcas_ThrowException(env,Err.str().c_str());
177 JNIEXPORT jobject JNICALL Java_SampleHLRJni_Aspect_1GenericColorMap_FindEntry (JNIEnv *env, jobject theobj, jint AColorMapEntryIndex)
181 jcas_Locking alock(env);
184 Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj));
185 const Aspect_ColorMapEntry& theret = the_this->FindEntry((Standard_Integer) AColorMapEntryIndex);
186 thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_ColorMapEntry",&theret,0);
189 catch (Standard_Failure) {
190 Standard_SStream Err;
191 Err << Standard_Failure::Caught();
193 jcas_ThrowException(env,Err.str().c_str());
202 JNIEXPORT jint JNICALL Java_SampleHLRJni_Aspect_1GenericColorMap_NearestColorMapIndex (JNIEnv *env, jobject theobj, jobject aColor)
206 jcas_Locking alock(env);
209 Quantity_Color* the_aColor = (Quantity_Color*) jcas_GetHandle(env,aColor);
210 if ( the_aColor == NULL ) {
212 // The following assumes availability of the default constructor (what may not
213 // always be the case). Therefore explicit exception is thrown if the null
214 // object has been passed.
215 // the_aColor = new Quantity_Color ();
216 // jcas_SetHandle ( env, aColor, the_aColor );
217 jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
220 Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj));
221 thejret = the_this->NearestColorMapIndex(*the_aColor);
224 catch (Standard_Failure) {
225 Standard_SStream Err;
226 Err << Standard_Failure::Caught();
228 jcas_ThrowException(env,Err.str().c_str());
237 JNIEXPORT jobject JNICALL Java_SampleHLRJni_Aspect_1GenericColorMap_NearestEntry (JNIEnv *env, jobject theobj, jobject aColor)
241 jcas_Locking alock(env);
244 Quantity_Color* the_aColor = (Quantity_Color*) jcas_GetHandle(env,aColor);
245 if ( the_aColor == NULL ) {
247 // The following assumes availability of the default constructor (what may not
248 // always be the case). Therefore explicit exception is thrown if the null
249 // object has been passed.
250 // the_aColor = new Quantity_Color ();
251 // jcas_SetHandle ( env, aColor, the_aColor );
252 jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
255 Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj));
256 const Aspect_ColorMapEntry& theret = the_this->NearestEntry(*the_aColor);
257 thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_ColorMapEntry",&theret,0);
260 catch (Standard_Failure) {
261 Standard_SStream Err;
262 Err << Standard_Failure::Caught();
264 jcas_ThrowException(env,Err.str().c_str());