7fd59977 |
1 | // Copyright (C) 1991,1995 by |
2 | // |
3 | // MATRA DATAVISION, FRANCE |
4 | // |
5 | // This software is furnished in accordance with the terms and conditions |
6 | // of the contract and with the inclusion of the above copyright notice. |
7 | // This software or any other copy thereof may not be provided or otherwise |
8 | // be made available to any other person. No title to an ownership of the |
9 | // software is hereby transferred. |
10 | // |
11 | // At the termination of the contract, the software and all copies of this |
12 | // software must be deleted. |
13 | |
14 | #include <CASCADESamplesJni_Aspect_GenericColorMap.h> |
15 | #include <Aspect_GenericColorMap.hxx> |
16 | #include <jcas.hxx> |
17 | #include <stdlib.h> |
18 | #include <Standard_ErrorHandler.hxx> |
19 | #include <Standard_SStream.hxx> |
20 | |
21 | #include <Aspect_ColorMapEntry.hxx> |
22 | #include <Standard_Integer.hxx> |
23 | #include <Quantity_Color.hxx> |
24 | |
25 | |
26 | extern "C" { |
27 | |
28 | |
29 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_Aspect_1GenericColorMap_Aspect_1GenericColorMap_1Create_10 (JNIEnv *env, jobject theobj) |
30 | { |
31 | |
32 | jcas_Locking alock(env); |
33 | { |
34 | try { |
35 | Handle(Aspect_GenericColorMap)* theret = new Handle(Aspect_GenericColorMap); |
36 | *theret = new Aspect_GenericColorMap(); |
37 | jcas_SetHandle(env,theobj,theret); |
38 | |
39 | } |
40 | catch (Standard_Failure) { |
41 | Standard_SStream Err; |
42 | Err << Standard_Failure::Caught(); |
43 | Err << (char) 0; |
44 | jcas_ThrowException(env,GetSString(Err)); |
45 | } |
46 | } |
47 | alock.Release(); |
48 | |
49 | } |
50 | |
51 | |
52 | |
53 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_Aspect_1GenericColorMap_Aspect_1GenericColorMap_1AddEntry_11 (JNIEnv *env, jobject theobj, jobject AnEntry) |
54 | { |
55 | |
56 | jcas_Locking alock(env); |
57 | { |
58 | try { |
59 | Aspect_ColorMapEntry* the_AnEntry = (Aspect_ColorMapEntry*) jcas_GetHandle(env,AnEntry); |
60 | Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj)); |
61 | the_this->AddEntry(*the_AnEntry); |
62 | |
63 | } |
64 | catch (Standard_Failure) { |
65 | Standard_SStream Err; |
66 | Err << Standard_Failure::Caught(); |
67 | Err << (char) 0; |
68 | jcas_ThrowException(env,GetSString(Err)); |
69 | } |
70 | } |
71 | alock.Release(); |
72 | |
73 | } |
74 | |
75 | |
76 | |
77 | JNIEXPORT jint JNICALL Java_CASCADESamplesJni_Aspect_1GenericColorMap_Aspect_1GenericColorMap_1AddEntry_12 (JNIEnv *env, jobject theobj, jobject aColor) |
78 | { |
79 | jint thejret; |
80 | |
81 | jcas_Locking alock(env); |
82 | { |
83 | try { |
84 | Quantity_Color* the_aColor = (Quantity_Color*) jcas_GetHandle(env,aColor); |
85 | Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj)); |
86 | thejret = the_this->AddEntry(*the_aColor); |
87 | |
88 | } |
89 | catch (Standard_Failure) { |
90 | Standard_SStream Err; |
91 | Err << Standard_Failure::Caught(); |
92 | Err << (char) 0; |
93 | jcas_ThrowException(env,GetSString(Err)); |
94 | } |
95 | } |
96 | alock.Release(); |
97 | return thejret; |
98 | } |
99 | |
100 | |
101 | |
102 | JNIEXPORT void JNICALL Java_CASCADESamplesJni_Aspect_1GenericColorMap_RemoveEntry (JNIEnv *env, jobject theobj, jint AColorMapEntryIndex) |
103 | { |
104 | |
105 | jcas_Locking alock(env); |
106 | { |
107 | try { |
108 | Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj)); |
109 | the_this->RemoveEntry((Standard_Integer) AColorMapEntryIndex); |
110 | |
111 | } |
112 | catch (Standard_Failure) { |
113 | Standard_SStream Err; |
114 | Err << Standard_Failure::Caught(); |
115 | Err << (char) 0; |
116 | jcas_ThrowException(env,GetSString(Err)); |
117 | } |
118 | } |
119 | alock.Release(); |
120 | |
121 | } |
122 | |
123 | |
124 | |
125 | JNIEXPORT jint JNICALL Java_CASCADESamplesJni_Aspect_1GenericColorMap_FindColorMapIndex (JNIEnv *env, jobject theobj, jint AColorMapEntryIndex) |
126 | { |
127 | jint thejret; |
128 | |
129 | jcas_Locking alock(env); |
130 | { |
131 | try { |
132 | Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj)); |
133 | thejret = the_this->FindColorMapIndex((Standard_Integer) AColorMapEntryIndex); |
134 | |
135 | } |
136 | catch (Standard_Failure) { |
137 | Standard_SStream Err; |
138 | Err << Standard_Failure::Caught(); |
139 | Err << (char) 0; |
140 | jcas_ThrowException(env,GetSString(Err)); |
141 | } |
142 | } |
143 | alock.Release(); |
144 | return thejret; |
145 | } |
146 | |
147 | |
148 | |
149 | JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_Aspect_1GenericColorMap_FindEntry (JNIEnv *env, jobject theobj, jint AColorMapEntryIndex) |
150 | { |
151 | jobject thejret; |
152 | |
153 | jcas_Locking alock(env); |
154 | { |
155 | try { |
156 | Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj)); |
157 | const Aspect_ColorMapEntry& theret = the_this->FindEntry((Standard_Integer) AColorMapEntryIndex); |
158 | thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_ColorMapEntry",&theret,0); |
159 | |
160 | } |
161 | catch (Standard_Failure) { |
162 | Standard_SStream Err; |
163 | Err << Standard_Failure::Caught(); |
164 | Err << (char) 0; |
165 | jcas_ThrowException(env,GetSString(Err)); |
166 | } |
167 | } |
168 | alock.Release(); |
169 | return thejret; |
170 | } |
171 | |
172 | |
173 | |
174 | JNIEXPORT jint JNICALL Java_CASCADESamplesJni_Aspect_1GenericColorMap_NearestColorMapIndex (JNIEnv *env, jobject theobj, jobject aColor) |
175 | { |
176 | jint thejret; |
177 | |
178 | jcas_Locking alock(env); |
179 | { |
180 | try { |
181 | Quantity_Color* the_aColor = (Quantity_Color*) jcas_GetHandle(env,aColor); |
182 | Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj)); |
183 | thejret = the_this->NearestColorMapIndex(*the_aColor); |
184 | |
185 | } |
186 | catch (Standard_Failure) { |
187 | Standard_SStream Err; |
188 | Err << Standard_Failure::Caught(); |
189 | Err << (char) 0; |
190 | jcas_ThrowException(env,GetSString(Err)); |
191 | } |
192 | } |
193 | alock.Release(); |
194 | return thejret; |
195 | } |
196 | |
197 | |
198 | |
199 | JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_Aspect_1GenericColorMap_NearestEntry (JNIEnv *env, jobject theobj, jobject aColor) |
200 | { |
201 | jobject thejret; |
202 | |
203 | jcas_Locking alock(env); |
204 | { |
205 | try { |
206 | Quantity_Color* the_aColor = (Quantity_Color*) jcas_GetHandle(env,aColor); |
207 | Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj)); |
208 | const Aspect_ColorMapEntry& theret = the_this->NearestEntry(*the_aColor); |
209 | thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_ColorMapEntry",&theret,0); |
210 | |
211 | } |
212 | catch (Standard_Failure) { |
213 | Standard_SStream Err; |
214 | Err << Standard_Failure::Caught(); |
215 | Err << (char) 0; |
216 | jcas_ThrowException(env,GetSString(Err)); |
217 | } |
218 | } |
219 | alock.Release(); |
220 | return thejret; |
221 | } |
222 | |
223 | |
224 | } |