Integration of OCCT 6.5.0 from SVN
[occt.git] / samples / java / drv / CASCADESamplesJni / CASCADESamplesJni_Aspect_GenericColorMap_java.cxx
CommitLineData
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
26extern "C" {
27
28
29JNIEXPORT void JNICALL Java_CASCADESamplesJni_Aspect_1GenericColorMap_Aspect_1GenericColorMap_1Create_10 (JNIEnv *env, jobject theobj)
30{
31
32jcas_Locking alock(env);
33{
34try {
35Handle(Aspect_GenericColorMap)* theret = new Handle(Aspect_GenericColorMap);
36*theret = new Aspect_GenericColorMap();
37jcas_SetHandle(env,theobj,theret);
38
39}
40catch (Standard_Failure) {
41 Standard_SStream Err;
42 Err << Standard_Failure::Caught();
43 Err << (char) 0;
44 jcas_ThrowException(env,GetSString(Err));
45}
46}
47alock.Release();
48
49}
50
51
52
53JNIEXPORT void JNICALL Java_CASCADESamplesJni_Aspect_1GenericColorMap_Aspect_1GenericColorMap_1AddEntry_11 (JNIEnv *env, jobject theobj, jobject AnEntry)
54{
55
56jcas_Locking alock(env);
57{
58try {
59Aspect_ColorMapEntry* the_AnEntry = (Aspect_ColorMapEntry*) jcas_GetHandle(env,AnEntry);
60Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj));
61the_this->AddEntry(*the_AnEntry);
62
63}
64catch (Standard_Failure) {
65 Standard_SStream Err;
66 Err << Standard_Failure::Caught();
67 Err << (char) 0;
68 jcas_ThrowException(env,GetSString(Err));
69}
70}
71alock.Release();
72
73}
74
75
76
77JNIEXPORT jint JNICALL Java_CASCADESamplesJni_Aspect_1GenericColorMap_Aspect_1GenericColorMap_1AddEntry_12 (JNIEnv *env, jobject theobj, jobject aColor)
78{
79jint thejret;
80
81jcas_Locking alock(env);
82{
83try {
84Quantity_Color* the_aColor = (Quantity_Color*) jcas_GetHandle(env,aColor);
85Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj));
86 thejret = the_this->AddEntry(*the_aColor);
87
88}
89catch (Standard_Failure) {
90 Standard_SStream Err;
91 Err << Standard_Failure::Caught();
92 Err << (char) 0;
93 jcas_ThrowException(env,GetSString(Err));
94}
95}
96alock.Release();
97return thejret;
98}
99
100
101
102JNIEXPORT void JNICALL Java_CASCADESamplesJni_Aspect_1GenericColorMap_RemoveEntry (JNIEnv *env, jobject theobj, jint AColorMapEntryIndex)
103{
104
105jcas_Locking alock(env);
106{
107try {
108Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj));
109the_this->RemoveEntry((Standard_Integer) AColorMapEntryIndex);
110
111}
112catch (Standard_Failure) {
113 Standard_SStream Err;
114 Err << Standard_Failure::Caught();
115 Err << (char) 0;
116 jcas_ThrowException(env,GetSString(Err));
117}
118}
119alock.Release();
120
121}
122
123
124
125JNIEXPORT jint JNICALL Java_CASCADESamplesJni_Aspect_1GenericColorMap_FindColorMapIndex (JNIEnv *env, jobject theobj, jint AColorMapEntryIndex)
126{
127jint thejret;
128
129jcas_Locking alock(env);
130{
131try {
132Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj));
133 thejret = the_this->FindColorMapIndex((Standard_Integer) AColorMapEntryIndex);
134
135}
136catch (Standard_Failure) {
137 Standard_SStream Err;
138 Err << Standard_Failure::Caught();
139 Err << (char) 0;
140 jcas_ThrowException(env,GetSString(Err));
141}
142}
143alock.Release();
144return thejret;
145}
146
147
148
149JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_Aspect_1GenericColorMap_FindEntry (JNIEnv *env, jobject theobj, jint AColorMapEntryIndex)
150{
151jobject thejret;
152
153jcas_Locking alock(env);
154{
155try {
156Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj));
157const Aspect_ColorMapEntry& theret = the_this->FindEntry((Standard_Integer) AColorMapEntryIndex);
158thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_ColorMapEntry",&theret,0);
159
160}
161catch (Standard_Failure) {
162 Standard_SStream Err;
163 Err << Standard_Failure::Caught();
164 Err << (char) 0;
165 jcas_ThrowException(env,GetSString(Err));
166}
167}
168alock.Release();
169return thejret;
170}
171
172
173
174JNIEXPORT jint JNICALL Java_CASCADESamplesJni_Aspect_1GenericColorMap_NearestColorMapIndex (JNIEnv *env, jobject theobj, jobject aColor)
175{
176jint thejret;
177
178jcas_Locking alock(env);
179{
180try {
181Quantity_Color* the_aColor = (Quantity_Color*) jcas_GetHandle(env,aColor);
182Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj));
183 thejret = the_this->NearestColorMapIndex(*the_aColor);
184
185}
186catch (Standard_Failure) {
187 Standard_SStream Err;
188 Err << Standard_Failure::Caught();
189 Err << (char) 0;
190 jcas_ThrowException(env,GetSString(Err));
191}
192}
193alock.Release();
194return thejret;
195}
196
197
198
199JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_Aspect_1GenericColorMap_NearestEntry (JNIEnv *env, jobject theobj, jobject aColor)
200{
201jobject thejret;
202
203jcas_Locking alock(env);
204{
205try {
206Quantity_Color* the_aColor = (Quantity_Color*) jcas_GetHandle(env,aColor);
207Handle(Aspect_GenericColorMap) the_this = *((Handle(Aspect_GenericColorMap)*) jcas_GetHandle(env,theobj));
208const Aspect_ColorMapEntry& theret = the_this->NearestEntry(*the_aColor);
209thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_ColorMapEntry",&theret,0);
210
211}
212catch (Standard_Failure) {
213 Standard_SStream Err;
214 Err << Standard_Failure::Caught();
215 Err << (char) 0;
216 jcas_ThrowException(env,GetSString(Err));
217}
218}
219alock.Release();
220return thejret;
221}
222
223
224}