Adjusting testing cases for current state of OCCT
[occt.git] / samples / java / drv / SampleHLRJni / SampleHLRJni_Aspect_ColorCubeColorMap_java.cxx
CommitLineData
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 <SampleHLRJni_Aspect_ColorCubeColorMap.h>
22#include <Aspect_ColorCubeColorMap.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 <Standard_Integer.hxx>
30#include <Aspect_ColorMapEntry.hxx>
31#include <Quantity_Color.hxx>
32
33
34extern "C" {
35
36
37JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1ColorCubeColorMap_Aspect_1ColorCubeColorMap_1Create_10 (JNIEnv *env, jobject theobj, jint base_pixel, jint redmax, jint redmult, jint greenmax, jint greenmult, jint bluemax, jint bluemult)
38{
39
40jcas_Locking alock(env);
41{
42try {
43Handle(Aspect_ColorCubeColorMap)* theret = new Handle(Aspect_ColorCubeColorMap);
44*theret = new Aspect_ColorCubeColorMap((Standard_Integer) base_pixel,(Standard_Integer) redmax,(Standard_Integer) redmult,(Standard_Integer) greenmax,(Standard_Integer) greenmult,(Standard_Integer) bluemax,(Standard_Integer) bluemult);
45jcas_SetHandle(env,theobj,theret);
46
47}
48catch (Standard_Failure) {
49 Standard_SStream Err;
50 Err << Standard_Failure::Caught();
51 Err << (char) 0;
52 jcas_ThrowException(env,Err.str().c_str());
53}
54}
55alock.Release();
56
57}
58
59
60
61JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1ColorCubeColorMap_ColorCubeDefinition (JNIEnv *env, jobject theobj, jobject base_pixel, jobject redmax, jobject redmult, jobject greenmax, jobject greenmult, jobject bluemax, jobject bluemult)
62{
63
64jcas_Locking alock(env);
65{
66try {
67Standard_Integer the_base_pixel = jcas_GetInteger(env,base_pixel);
68Standard_Integer the_redmax = jcas_GetInteger(env,redmax);
69Standard_Integer the_redmult = jcas_GetInteger(env,redmult);
70Standard_Integer the_greenmax = jcas_GetInteger(env,greenmax);
71Standard_Integer the_greenmult = jcas_GetInteger(env,greenmult);
72Standard_Integer the_bluemax = jcas_GetInteger(env,bluemax);
73Standard_Integer the_bluemult = jcas_GetInteger(env,bluemult);
74Handle(Aspect_ColorCubeColorMap) the_this = *((Handle(Aspect_ColorCubeColorMap)*) jcas_GetHandle(env,theobj));
75the_this->ColorCubeDefinition(the_base_pixel,the_redmax,the_redmult,the_greenmax,the_greenmult,the_bluemax,the_bluemult);
76jcas_SetInteger(env,base_pixel,the_base_pixel);
77jcas_SetInteger(env,redmax,the_redmax);
78jcas_SetInteger(env,redmult,the_redmult);
79jcas_SetInteger(env,greenmax,the_greenmax);
80jcas_SetInteger(env,greenmult,the_greenmult);
81jcas_SetInteger(env,bluemax,the_bluemax);
82jcas_SetInteger(env,bluemult,the_bluemult);
83
84}
85catch (Standard_Failure) {
86 Standard_SStream Err;
87 Err << Standard_Failure::Caught();
88 Err << (char) 0;
89 jcas_ThrowException(env,Err.str().c_str());
90}
91}
92alock.Release();
93
94}
95
96
97
98JNIEXPORT jint JNICALL Java_SampleHLRJni_Aspect_1ColorCubeColorMap_FindColorMapIndex (JNIEnv *env, jobject theobj, jint AColorMapEntryIndex)
99{
100jint thejret;
101
102jcas_Locking alock(env);
103{
104try {
105Handle(Aspect_ColorCubeColorMap) the_this = *((Handle(Aspect_ColorCubeColorMap)*) jcas_GetHandle(env,theobj));
106 thejret = the_this->FindColorMapIndex((Standard_Integer) AColorMapEntryIndex);
107
108}
109catch (Standard_Failure) {
110 Standard_SStream Err;
111 Err << Standard_Failure::Caught();
112 Err << (char) 0;
113 jcas_ThrowException(env,Err.str().c_str());
114}
115}
116alock.Release();
117return thejret;
118}
119
120
121
122JNIEXPORT jobject JNICALL Java_SampleHLRJni_Aspect_1ColorCubeColorMap_FindEntry (JNIEnv *env, jobject theobj, jint AColorMapEntryIndex)
123{
124jobject thejret;
125
126jcas_Locking alock(env);
127{
128try {
129Handle(Aspect_ColorCubeColorMap) the_this = *((Handle(Aspect_ColorCubeColorMap)*) jcas_GetHandle(env,theobj));
130const Aspect_ColorMapEntry& theret = the_this->FindEntry((Standard_Integer) AColorMapEntryIndex);
131thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_ColorMapEntry",&theret,0);
132
133}
134catch (Standard_Failure) {
135 Standard_SStream Err;
136 Err << Standard_Failure::Caught();
137 Err << (char) 0;
138 jcas_ThrowException(env,Err.str().c_str());
139}
140}
141alock.Release();
142return thejret;
143}
144
145
146
147JNIEXPORT jint JNICALL Java_SampleHLRJni_Aspect_1ColorCubeColorMap_NearestColorMapIndex (JNIEnv *env, jobject theobj, jobject aColor)
148{
149jint thejret;
150
151jcas_Locking alock(env);
152{
153try {
154Quantity_Color* the_aColor = (Quantity_Color*) jcas_GetHandle(env,aColor);
155if ( the_aColor == NULL ) {
156
157 // The following assumes availability of the default constructor (what may not
158 // always be the case). Therefore explicit exception is thrown if the null
159 // object has been passed.
160 // the_aColor = new Quantity_Color ();
161 // jcas_SetHandle ( env, aColor, the_aColor );
162 jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
163
164} // end if
165Handle(Aspect_ColorCubeColorMap) the_this = *((Handle(Aspect_ColorCubeColorMap)*) jcas_GetHandle(env,theobj));
166 thejret = the_this->NearestColorMapIndex(*the_aColor);
167
168}
169catch (Standard_Failure) {
170 Standard_SStream Err;
171 Err << Standard_Failure::Caught();
172 Err << (char) 0;
173 jcas_ThrowException(env,Err.str().c_str());
174}
175}
176alock.Release();
177return thejret;
178}
179
180
181
182JNIEXPORT jobject JNICALL Java_SampleHLRJni_Aspect_1ColorCubeColorMap_NearestEntry (JNIEnv *env, jobject theobj, jobject aColor)
183{
184jobject thejret;
185
186jcas_Locking alock(env);
187{
188try {
189Quantity_Color* the_aColor = (Quantity_Color*) jcas_GetHandle(env,aColor);
190if ( the_aColor == NULL ) {
191
192 // The following assumes availability of the default constructor (what may not
193 // always be the case). Therefore explicit exception is thrown if the null
194 // object has been passed.
195 // the_aColor = new Quantity_Color ();
196 // jcas_SetHandle ( env, aColor, the_aColor );
197 jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
198
199} // end if
200Handle(Aspect_ColorCubeColorMap) the_this = *((Handle(Aspect_ColorCubeColorMap)*) jcas_GetHandle(env,theobj));
201const Aspect_ColorMapEntry& theret = the_this->NearestEntry(*the_aColor);
202thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_ColorMapEntry",&theret,0);
203
204}
205catch (Standard_Failure) {
206 Standard_SStream Err;
207 Err << Standard_Failure::Caught();
208 Err << (char) 0;
209 jcas_ThrowException(env,Err.str().c_str());
210}
211}
212alock.Release();
213return thejret;
214}
215
216
217
218JNIEXPORT jint JNICALL Java_SampleHLRJni_Aspect_1ColorCubeColorMap_AddEntry (JNIEnv *env, jobject theobj, jobject aColor)
219{
220jint thejret;
221
222jcas_Locking alock(env);
223{
224try {
225Quantity_Color* the_aColor = (Quantity_Color*) jcas_GetHandle(env,aColor);
226if ( the_aColor == NULL ) {
227
228 // The following assumes availability of the default constructor (what may not
229 // always be the case). Therefore explicit exception is thrown if the null
230 // object has been passed.
231 // the_aColor = new Quantity_Color ();
232 // jcas_SetHandle ( env, aColor, the_aColor );
233 jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value");
234
235} // end if
236Handle(Aspect_ColorCubeColorMap) the_this = *((Handle(Aspect_ColorCubeColorMap)*) jcas_GetHandle(env,theobj));
237 thejret = the_this->AddEntry(*the_aColor);
238
239}
240catch (Standard_Failure) {
241 Standard_SStream Err;
242 Err << Standard_Failure::Caught();
243 Err << (char) 0;
244 jcas_ThrowException(env,Err.str().c_str());
245}
246}
247alock.Release();
248return thejret;
249}
250
251
252}