]> SALOME platform Git repositories - modules/shaper_study.git/blob - src/PY/SHAPERSTUDY_Object.py
Salome HOME
43c5ca3687711f7d5e7bf6606922949295061465
[modules/shaper_study.git] / src / PY / SHAPERSTUDY_Object.py
1 # Copyright (C) 2007-2019  CEA/DEN, EDF R&D, OPEN CASCADE
2 #
3 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 #
6 # This library is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU Lesser General Public
8 # License as published by the Free Software Foundation; either
9 # version 2.1 of the License, or (at your option) any later version.
10 #
11 # This library is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 # Lesser General Public License for more details.
15 #
16 # You should have received a copy of the GNU Lesser General Public
17 # License along with this library; if not, write to the Free Software
18 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 #
20 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 #
22
23 import SHAPERSTUDY_ORB__POA
24 import GEOM
25 from SHAPERSTUDY_utils import getEngine
26
27 import StudyData_Swig
28
29 class SHAPERSTUDY_Object(SHAPERSTUDY_ORB__POA.SHAPER_Object):
30     """
31     Construct an instance of SHAPERSTUDY Object.
32     """
33     def __init__ ( self, *args):
34         pass
35
36     def GetShapeType( self ):
37         """
38         Get a GEOM.shape_type of the object value.
39         """
40         if self.data is None:
41             return GEOM.SHAPE
42         return self.data.type();
43
44     def IsMainShape( self ):
45         """
46         Returns True if this object is not a sub-shape of another object.
47         """
48         return True
49
50     def GetSubShapeIndices( self ):
51         """
52         Get a list of ID's of sub-shapes in the main shape.
53         """
54         return []
55
56     def GetMainShape( self ):
57         """
58         Get a main shape object to which this object is a sub-shape.
59         """
60         return getShape()
61
62     def getShape( self ):
63         """
64         Get the TopoDS_Shape, for colocated case only.
65         Called by GEOM_Client to get TopoDS_Shape pointer
66         """
67         if self.data is None:
68             return 0
69         return self.data.shape()
70
71     def GetShapeStream( self ):
72         """
73         Get geometric shape of the object as a byte stream in BRep format
74         """
75         if self.data is None:
76             return
77         return self.data.shapeStream()
78
79     def SetShapeByStream(self, theStream):
80         """
81         Sets geometric shape content of the object as a byte stream in BRep format
82         """
83         self.data = StudyData_Swig.StudyData_Object(theStream)
84
85     """
86     Methods from BaseObject
87     """
88     def GetName( self ):
89         """
90         Get name of the object associated with this object.
91         """
92         return ""
93
94     def SetEntry( self, theInternalEntry ):
95         """
96         Sets internal (unique) entry of the object in the component's data tree.
97         """
98         self.entry = theInternalEntry
99
100     def GetEntry( self ):
101         """
102         Get internal (unique) entry of the object in the component's data tree.
103         """
104         return self.entry
105
106     def GetType( self ):
107         """
108         Get internal type of operation created this object.
109         In SMESH is used to find out if an object is GROUP (type == 37)
110         """
111         # 1 corresponds to the Import feature (GEOMImpl_Types.hxx )
112         return 1
113
114     # TODO: version number of the shape
115     def GetTick( self ):
116         """
117         Get value of a modification counter of the object
118         """
119         return 1
120
121     def GetStudyEntry( self ):
122         """
123         Get a Study entry where this object was published.
124         """
125         return '0:0:0:1'
126
127     def IsShape( self ):
128         """
129         Return true if geom object representes a shape.
130         For example, method return false for GEOM_MARKER
131         """
132         return True
133
134     def IsSame( self, other ):
135         """
136         Return true if passed object is identical to this object
137         """
138         return False
139
140     def GetGen( self ):
141         """
142         Return the engine creating this object
143         """
144         return getEngine()
145
146     pass