Integration of OCCT 6.5.0 from SVN
[occt.git] / samples / java / drv / SampleAISBasicJni / SampleAISBasicJni_UnitsAPI_java.cxx
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
22 #include <SampleAISBasicJni_UnitsAPI.h>
23 #include <UnitsAPI.hxx>
24 #include <jcas.hxx>
25 #include <stdlib.h>
26 #include <Standard_ErrorHandler.hxx>
27 #include <Standard_Failure.hxx>
28 #include <Standard_SStream.hxx>
29
30 #include <UnitsAPI_SystemUnits.hxx>
31
32
33 extern "C" {
34
35
36 JNIEXPORT void JNICALL Java_SampleAISBasicJni_UnitsAPI_SetLocalSystem (JNIEnv *env, jclass, jshort aSystemUnit)
37 {
38
39 jcas_Locking alock(env);
40 {
41 try {
42 UnitsAPI::SetLocalSystem((UnitsAPI_SystemUnits) aSystemUnit);
43
44 }
45 catch (Standard_Failure) {
46   Standard_SStream Err;
47   Err <<   Standard_Failure::Caught(); 
48   Err << (char) 0;
49   jcas_ThrowException(env,Err.str().c_str());
50 }
51 }
52 alock.Release();
53
54 }
55
56
57 }