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_MarkMap.h> |
22 | #include <Aspect_MarkMap.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 <Aspect_MarkMapEntry.hxx> |
30 | #include <Standard_Integer.hxx> |
31 | #include <Aspect_MarkerStyle.hxx> |
32 | |
33 | |
34 | extern "C" { |
35 | |
36 | |
37 | JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1MarkMap_Aspect_1MarkMap_1Create_10 (JNIEnv *env, jobject theobj) |
38 | { |
39 | |
40 | jcas_Locking alock(env); |
41 | { |
42 | try { |
43 | Handle(Aspect_MarkMap)* theret = new Handle(Aspect_MarkMap); |
44 | *theret = new Aspect_MarkMap(); |
45 | jcas_SetHandle(env,theobj,theret); |
46 | |
47 | } |
48 | catch (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 | } |
55 | alock.Release(); |
56 | |
57 | } |
58 | |
59 | |
60 | |
61 | JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1MarkMap_Aspect_1MarkMap_1AddEntry_11 (JNIEnv *env, jobject theobj, jobject AnEntry) |
62 | { |
63 | |
64 | jcas_Locking alock(env); |
65 | { |
66 | try { |
67 | Aspect_MarkMapEntry* the_AnEntry = (Aspect_MarkMapEntry*) jcas_GetHandle(env,AnEntry); |
68 | if ( the_AnEntry == NULL ) { |
69 | |
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_MarkMapEntry (); |
74 | // jcas_SetHandle ( env, AnEntry, the_AnEntry ); |
75 | jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value"); |
76 | |
77 | } // end if |
78 | Handle(Aspect_MarkMap) the_this = *((Handle(Aspect_MarkMap)*) jcas_GetHandle(env,theobj)); |
79 | the_this->AddEntry(*the_AnEntry); |
80 | |
81 | } |
82 | catch (Standard_Failure) { |
83 | Standard_SStream Err; |
84 | Err << Standard_Failure::Caught(); |
85 | Err << (char) 0; |
86 | jcas_ThrowException(env,Err.str().c_str()); |
87 | } |
88 | } |
89 | alock.Release(); |
90 | |
91 | } |
92 | |
93 | |
94 | |
95 | JNIEXPORT jint JNICALL Java_SampleHLRJni_Aspect_1MarkMap_Aspect_1MarkMap_1AddEntry_12 (JNIEnv *env, jobject theobj, jobject aStyle) |
96 | { |
97 | jint thejret; |
98 | |
99 | jcas_Locking alock(env); |
100 | { |
101 | try { |
102 | Aspect_MarkerStyle* the_aStyle = (Aspect_MarkerStyle*) jcas_GetHandle(env,aStyle); |
103 | if ( the_aStyle == NULL ) { |
104 | |
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_aStyle = new Aspect_MarkerStyle (); |
109 | // jcas_SetHandle ( env, aStyle, the_aStyle ); |
110 | jcas_ThrowException (env, "NULL object has been passed while expecting an object manipulated by value"); |
111 | |
112 | } // end if |
113 | Handle(Aspect_MarkMap) the_this = *((Handle(Aspect_MarkMap)*) jcas_GetHandle(env,theobj)); |
114 | thejret = the_this->AddEntry(*the_aStyle); |
115 | |
116 | } |
117 | catch (Standard_Failure) { |
118 | Standard_SStream Err; |
119 | Err << Standard_Failure::Caught(); |
120 | Err << (char) 0; |
121 | jcas_ThrowException(env,Err.str().c_str()); |
122 | } |
123 | } |
124 | alock.Release(); |
125 | return thejret; |
126 | } |
127 | |
128 | |
129 | |
130 | JNIEXPORT jint JNICALL Java_SampleHLRJni_Aspect_1MarkMap_Size (JNIEnv *env, jobject theobj) |
131 | { |
132 | jint thejret; |
133 | |
134 | jcas_Locking alock(env); |
135 | { |
136 | try { |
137 | Handle(Aspect_MarkMap) the_this = *((Handle(Aspect_MarkMap)*) jcas_GetHandle(env,theobj)); |
138 | thejret = the_this->Size(); |
139 | |
140 | } |
141 | catch (Standard_Failure) { |
142 | Standard_SStream Err; |
143 | Err << Standard_Failure::Caught(); |
144 | Err << (char) 0; |
145 | jcas_ThrowException(env,Err.str().c_str()); |
146 | } |
147 | } |
148 | alock.Release(); |
149 | return thejret; |
150 | } |
151 | |
152 | |
153 | |
154 | JNIEXPORT jint JNICALL Java_SampleHLRJni_Aspect_1MarkMap_Index (JNIEnv *env, jobject theobj, jint aMarkmapIndex) |
155 | { |
156 | jint thejret; |
157 | |
158 | jcas_Locking alock(env); |
159 | { |
160 | try { |
161 | Handle(Aspect_MarkMap) the_this = *((Handle(Aspect_MarkMap)*) jcas_GetHandle(env,theobj)); |
162 | thejret = the_this->Index((Standard_Integer) aMarkmapIndex); |
163 | |
164 | } |
165 | catch (Standard_Failure) { |
166 | Standard_SStream Err; |
167 | Err << Standard_Failure::Caught(); |
168 | Err << (char) 0; |
169 | jcas_ThrowException(env,Err.str().c_str()); |
170 | } |
171 | } |
172 | alock.Release(); |
173 | return thejret; |
174 | } |
175 | |
176 | |
177 | |
178 | JNIEXPORT void JNICALL Java_SampleHLRJni_Aspect_1MarkMap_Dump (JNIEnv *env, jobject theobj) |
179 | { |
180 | |
181 | jcas_Locking alock(env); |
182 | { |
183 | try { |
184 | Handle(Aspect_MarkMap) the_this = *((Handle(Aspect_MarkMap)*) jcas_GetHandle(env,theobj)); |
185 | the_this->Dump(); |
186 | |
187 | } |
188 | catch (Standard_Failure) { |
189 | Standard_SStream Err; |
190 | Err << Standard_Failure::Caught(); |
191 | Err << (char) 0; |
192 | jcas_ThrowException(env,Err.str().c_str()); |
193 | } |
194 | } |
195 | alock.Release(); |
196 | |
197 | } |
198 | |
199 | |
200 | |
201 | JNIEXPORT jobject JNICALL Java_SampleHLRJni_Aspect_1MarkMap_Entry (JNIEnv *env, jobject theobj, jint AnIndex) |
202 | { |
203 | jobject thejret; |
204 | |
205 | jcas_Locking alock(env); |
206 | { |
207 | try { |
208 | Handle(Aspect_MarkMap) the_this = *((Handle(Aspect_MarkMap)*) jcas_GetHandle(env,theobj)); |
209 | Aspect_MarkMapEntry* theret = new Aspect_MarkMapEntry(the_this->Entry((Standard_Integer) AnIndex)); |
210 | thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_MarkMapEntry",theret); |
211 | |
212 | } |
213 | catch (Standard_Failure) { |
214 | Standard_SStream Err; |
215 | Err << Standard_Failure::Caught(); |
216 | Err << (char) 0; |
217 | jcas_ThrowException(env,Err.str().c_str()); |
218 | } |
219 | } |
220 | alock.Release(); |
221 | return thejret; |
222 | } |
223 | |
224 | |
225 | } |