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 <CASCADESamplesJni_Viewer_Viewer.h>
22 #include <Viewer_Viewer.hxx>
25 #include <Standard_ErrorHandler.hxx>
26 #include <Standard_Failure.hxx>
27 #include <Standard_SStream.hxx>
29 #include <Aspect_GraphicDevice.hxx>
30 #include <Standard_ExtString.hxx>
31 #include <Standard_CString.hxx>
37 JNIEXPORT void JNICALL Java_CASCADESamplesJni_Viewer_1Viewer_Update (JNIEnv *env, jobject theobj)
40 jcas_Locking alock(env);
43 Handle(Viewer_Viewer) the_this = *((Handle(Viewer_Viewer)*) jcas_GetHandle(env,theobj));
47 catch (Standard_Failure) {
49 Err << Standard_Failure::Caught();
51 jcas_ThrowException(env,Err.str().c_str());
60 JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_Viewer_1Viewer_Device (JNIEnv *env, jobject theobj)
64 jcas_Locking alock(env);
67 Handle(Viewer_Viewer) the_this = *((Handle(Viewer_Viewer)*) jcas_GetHandle(env,theobj));
68 Handle(Aspect_GraphicDevice)* theret = new Handle(Aspect_GraphicDevice);
69 *theret = the_this->Device();
70 thejret = jcas_CreateObject(env,"CASCADESamplesJni/Aspect_GraphicDevice",theret);
73 catch (Standard_Failure) {
75 Err << Standard_Failure::Caught();
77 jcas_ThrowException(env,Err.str().c_str());
86 JNIEXPORT jstring JNICALL Java_CASCADESamplesJni_Viewer_1Viewer_NextName (JNIEnv *env, jobject theobj)
90 jcas_Locking alock(env);
93 Handle(Viewer_Viewer) the_this = *((Handle(Viewer_Viewer)*) jcas_GetHandle(env,theobj));
94 Standard_ExtString sret = the_this->NextName();
95 thejret = jcas_ConvertTojstring(env,sret);
98 catch (Standard_Failure) {
100 Err << Standard_Failure::Caught();
102 jcas_ThrowException(env,Err.str().c_str());
111 JNIEXPORT jobject JNICALL Java_CASCADESamplesJni_Viewer_1Viewer_Domain (JNIEnv *env, jobject theobj)
115 jcas_Locking alock(env);
118 Handle(Viewer_Viewer) the_this = *((Handle(Viewer_Viewer)*) jcas_GetHandle(env,theobj));
119 Standard_CString sret = the_this->Domain();
120 jclass CLSret = env->FindClass("jcas/Standard_CString");
121 thejret = env->AllocObject(CLSret);
122 jcas_SetCStringValue(env,thejret,sret);
125 catch (Standard_Failure) {
126 Standard_SStream Err;
127 Err << Standard_Failure::Caught();
129 jcas_ThrowException(env,Err.str().c_str());