]> gerrit.simantics Code Review - simantics/3d.git/blob - org.jcae.opencascade/src-java/org/jcae/opencascade/jni/TopoDS_Shape.java
Updated OpenCASCADE to 7.3.0
[simantics/3d.git] / org.jcae.opencascade / src-java / org / jcae / opencascade / jni / TopoDS_Shape.java
1 /* ----------------------------------------------------------------------------
2  * This file was automatically generated by SWIG (http://www.swig.org).
3  * Version 3.0.12
4  *
5  * Do not make changes to this file unless you know what you are doing--modify
6  * the SWIG interface file instead.
7  * ----------------------------------------------------------------------------- */
8
9 package org.jcae.opencascade.jni;
10
11 public class TopoDS_Shape {
12   private transient long swigCPtr;
13   protected transient boolean swigCMemOwn;
14
15   protected TopoDS_Shape(long cPtr, boolean cMemoryOwn) {
16     swigCMemOwn = cMemoryOwn;
17     swigCPtr = cPtr;
18   }
19
20   protected static long getCPtr(TopoDS_Shape obj) {
21     return (obj == null) ? 0 : obj.swigCPtr;
22   }
23
24   protected void finalize() {
25     delete();
26   }
27
28   public synchronized void delete() {
29     if (swigCPtr != 0) {
30       if (swigCMemOwn) {
31         swigCMemOwn = false;
32         OccJavaJNI.delete_TopoDS_Shape(swigCPtr);
33       }
34       swigCPtr = 0;
35     }
36   }
37
38         private long myTShape;
39         protected static TopoDS_Shape downcast(TopoDS_Shape in)
40         {
41                 TopoDS_Shape toReturn = create(getCPtr(in));
42                 in.swigCMemOwn=false;
43                 return toReturn;
44         }
45
46         protected static TopoDS_Shape create(long in)
47         {
48                 if(in==0)
49                         return null;
50                 //second argument is not use in swig
51                 TopAbs_ShapeEnum type = TopAbs_ShapeEnum.swigToEnum(OccJavaJNI.TopoDS_Shape_shapeType(in, null));
52                 return create(in, type);
53         }
54
55         protected static TopoDS_Shape create(long in, TopAbs_ShapeEnum type)
56         {
57                 TopoDS_Shape toReturn=null;
58                 if(in==0)
59                         return null;
60                 switch(type)
61                 {
62                         case COMPOUND:
63                                 toReturn=new TopoDS_Compound(in, true);
64                                 break;
65                         case COMPSOLID:
66                                 toReturn=new TopoDS_CompSolid(in, true);
67                                 break;
68                         case SOLID:
69                                 toReturn=new TopoDS_Solid(in, true);
70                                 break;
71                         case SHELL:
72                                 toReturn=new TopoDS_Shell(in, true);
73                                 break;
74                         case FACE:
75                                 toReturn=new TopoDS_Face(in, true);
76                                 break;
77                         case WIRE:
78                                 toReturn=new TopoDS_Wire(in, true);
79                                 break;
80                         case EDGE:
81                                 toReturn=new TopoDS_Edge(in, true);
82                                 break;
83                         case VERTEX:
84                                 toReturn=new TopoDS_Vertex(in, true);
85                                 break;
86                 }
87                 toReturn.myTShape=toReturn.getTShape();
88                 return toReturn;
89     }
90     public boolean isSame(TopoDS_Shape s)
91     {
92         /*if(myTShape==0)
93                         myTShape=getTShape();
94                 
95                 if(s.myTShape==0)
96                         s.myTShape=s.getTShape();
97                 
98                 if(myTShape==s.myTShape)
99         {
100             return nativeIsSame(s);
101         }
102         else return false;*/
103                 return nativeIsSame(s);
104     }
105         
106     /**
107      * Alias on the isSame method for an easy use of this class in java
108      * collections
109      */
110     public boolean equals(Object o)
111     {
112         if (o instanceof TopoDS_Shape)
113         {
114             return isSame((TopoDS_Shape)o);
115         }
116         else return false;
117     }
118
119         public int hashCode()
120         {
121                 return hashCode(Integer.MAX_VALUE);
122         }
123
124         protected static TopoDS_Shape[] cArrayWrap(long[] ptrs)
125         {
126                 TopoDS_Shape[] toReturn = new TopoDS_Shape[ptrs.length/2];
127                 long ptr;
128                 int type;
129                 for (int i=0, j=0; i<toReturn.length; i++)
130                 {  
131                         ptr = ptrs[j++];
132                         type = (int)ptrs[j++];
133                         toReturn[i] = create(ptr, TopAbs_ShapeEnum.swigToEnum(type));
134                 }
135                 return toReturn;
136         }
137
138         protected static long[] cArrayUnwrap(TopoDS_Shape[] arrayWrapper)
139         {
140                 long[] cArray = new long[arrayWrapper.length];
141                 for (int i=0; i<arrayWrapper.length; i++)
142                 cArray[i] = TopoDS_Shape.getCPtr(arrayWrapper[i]);
143                 return cArray;
144         }
145
146   public TopAbs_ShapeEnum shapeType() {
147     return TopAbs_ShapeEnum.swigToEnum(OccJavaJNI.TopoDS_Shape_shapeType(swigCPtr, this));
148   }
149
150   public boolean nativeIsSame(TopoDS_Shape other) {
151         return OccJavaJNI.TopoDS_Shape_nativeIsSame(swigCPtr, this, TopoDS_Shape.getCPtr(other), other);
152 }
153
154   public TopAbs_Orientation orientation() {
155     return TopAbs_Orientation.swigToEnum(OccJavaJNI.TopoDS_Shape_orientation(swigCPtr, this));
156   }
157
158   public void reverse() {
159     OccJavaJNI.TopoDS_Shape_reverse(swigCPtr, this);
160   }
161
162   public TopoDS_Shape reversed() {
163     long cPtr = OccJavaJNI.TopoDS_Shape_reversed(swigCPtr, this);
164     return (TopoDS_Shape)TopoDS_Shape.create(cPtr);
165 }
166
167   public int hashCode(int Upper) {
168     return OccJavaJNI.TopoDS_Shape_hashCode(swigCPtr, this, Upper);
169   }
170
171   public boolean free() {
172         return OccJavaJNI.TopoDS_Shape_free__SWIG_0(swigCPtr, this);
173 }
174
175   public void free(boolean F) {
176     OccJavaJNI.TopoDS_Shape_free__SWIG_1(swigCPtr, this, F);
177   }
178
179   public long getTShape() {
180     return OccJavaJNI.TopoDS_Shape_getTShape(swigCPtr, this);
181   }
182
183   public TopoDS_Shape() {
184     this(OccJavaJNI.new_TopoDS_Shape(), true);
185   }
186
187 }