Salome HOME
PAL8378: fix a bug in Partition algorithm
[modules/geom.git] / src / PARTITION / Partition_Spliter.cdl
1 --  GEOM PARTITION : partition algorithm
2 --
3 --  Copyright (C) 2003  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. 
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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 --
22 --
23 --
24 --  File   : Partition_Spliter.cdl
25 --  Author : Benedicte MARTIN
26 --  Module : GEOM
27
28 class Spliter from Partition
29
30         ---Purpose: Split solids, shells and  faces  into parts of the
31         --          same  topology  if  reconstruction  level  is  not
32         --          limited.
33
34 uses
35     Inter3d             from Partition,
36     Loop2d              from Partition,
37     Builder             from BRep,
38     ShapeEnum           from TopAbs,
39     Compound            from TopoDS,
40     Face                from TopoDS,
41     Edge                from TopoDS,
42     Shape               from TopoDS,
43     MapOfOrientedShape  from TopTools,
44     IndexedMapOfShape   from TopTools,
45     DataMapOfShapeShape from TopTools,
46     ListOfShape         from TopTools,
47     MapOfShape          from TopTools,
48     AsDes               from BRepAlgo,
49     Image               from BRepAlgo
50
51 is
52     Create  returns Spliter from Partition;
53         ---Purpose: constructor
54
55     AddShape ( me : in out; S : Shape from TopoDS);
56         ---Purpose: add object Shape to be splitted.
57         --          If S  is  a  COMPOUND  or  COMPSOLID,  it  will be
58         --          exploded  in  order  to  get  more  simple  object
59         --          shapes. 
60         --          Object shapes that  are  vertices,  edges or wires
61         --          won't be splitted and won't be in a result.
62
63     AddTool  ( me : in out; S : Shape from TopoDS);
64         ---Purpose: add cutting tool
65
66     Compute (me : in out; Limit : ShapeEnum from TopAbs
67                           = TopAbs_SHAPE);
68         ---Purpose: produce a result which  is  a compound of parts of
69         --          object shapes.  A  part  can  be  either a vertex,
70         --          edge, wire, face, shell or solid.
71         --          By default, a part is  of  the same topology as an
72         --          object  shape,   else   <Limit>   restricts  parts
73         --          reconstruction.
74         --          If <Limit> == TopAbs_VERTEX, only new vertices are
75         --          returned in the result
76
77     KeepShapesInside (me : in out; S : Shape from TopoDS);
78         ---Purpose: remove shapes that are outside of S from result.
79         --          S should be an object shape.
80         ---Warning: call it after Compute()
81
82     RemoveShapesInside (me : in out; S : Shape from TopoDS);
83         ---Purpose: remove shapes that are inside S from result.
84         --          S should be an object shape.
85         ---Warning: call it after Compute()
86
87     Shape ( me ) returns Shape from TopoDS;
88         ---Purpose: return resulting compound
89
90     Clear ( me : in out);
91         ---Purpose: clear fields
92
93
94         ---Category: private methods
95
96
97     MakeSolids (me: in out; Solid : Shape from TopoDS;
98                             Shells: in out ListOfShape from TopTools) 
99         is private;
100         ---Purpose: make solids out of Shells
101
102     MakeShells (me: in out; S : Shape from TopoDS;
103                             NS: in out ListOfShape from TopTools) is private;
104         ---Purpose: split S into shells
105
106     MakeFaces (me: in out; S : Shape from TopoDS)
107         returns Shape from TopoDS is private;
108         ---Purpose: split faces of S, return compound of new faces
109
110     MakeEdges (me; 
111                E : Edge from TopoDS;
112                VOnE : ListOfShape from TopTools;
113                NE : in out ListOfShape from TopTools) 
114         is private;
115         ---Purpose: cut E by vertices  VOnE,  return list of new edges
116         --          NE
117     
118     FindFacesInside (me: in out; S : Shape from TopoDS;
119                                  CheckClosed : Boolean = Standard_False;
120                                  All         : Boolean = Standard_False)
121         returns Shape from TopoDS is private;
122         ---Purpose: return compound of faces  of other shapes that are
123         --          inside <S>. <S>  must  have image in myImageShape.
124         --          <CheckClosed> makes avoid faces that do not form a
125         --          closed shell
126         --          <All> makes return already added faces
127
128     CheckTool ( me: in out; S : Shape from TopoDS)
129         returns Boolean from Standard is private;
130         ---Purpose: Return True if <S>  is  a tool shape. Prepare tool
131         --          faces of <S> for the search of internal faces.
132
133     MergeEqualEdges (me: in out; LE : ListOfShape from TopTools) is private;
134         ---Purpose: among LE, find  equal  edges,  choose ones to keep
135         --          and make them have  pcurves  on all faces they are
136         --          shared by
137         --          <LE> contains edge splits
138
139     IsInside (myclass; S1,S2 : Shape from TopoDS)
140         returns Boolean from Standard is private;
141         ---Purpose: Return True if the first vertex of S1 inside S2.
142         --          If S1.IsNull(), check infinite point against S2.
143
144     GetOriginalShape(me; aShape : Shape from TopoDS)
145         returns Shape from TopoDS is private;
146         ---Purpose: Return the  shape  aShape  originates from. aShape
147         --          should be a face or more complex result shape
148
149     FindToolsToReconstruct(me: in out) is private;
150         ---Purpose: find and store  as  objects  tools which interfere
151         --          with  solids   or   are   inside   solids  without
152         --          an interference
153
154 fields
155
156     myDoneStep     : ShapeEnum           from TopAbs;   -- rebuilt level
157     myShape        : Compound            from TopoDS;   -- result
158     myBuilder      : Builder             from BRep;
159                                            
160     myListShapes   : ListOfShape         from TopTools; -- object shapes
161     myMapFaces     : MapOfShape          from TopTools; -- object faces
162     myMapTools     : MapOfShape          from TopTools; -- tool faces
163     myEqualEdges   : MapOfShape          from TopTools; -- equal splits
164     myNewSection   : MapOfShape          from TopTools; -- new secton edges
165     myClosedShapes : MapOfShape          from TopTools;
166     mySharedFaces  : MapOfShape          from TopTools; -- faces shared by several shapes
167     myWrappingSolid: MapOfShape          from TopTools; -- solids having other shapes inside
168     myFaceShapeMap : DataMapOfShapeShape from TopTools; -- to find a shape by face
169                                            
170     myInternalFaces: DataMapOfShapeShape from TopTools; -- shape and its internal faces
171     myIntNotClFaces: DataMapOfShapeShape from TopTools; -- internal but not closed 
172
173                                            
174     myAsDes        : AsDes               from BRepAlgo;
175     myImagesFaces  : Image               from BRepAlgo;   
176     myImagesEdges  : Image               from BRepAlgo;    
177     myImageShape   : Image               from BRepAlgo;
178     
179         -- contains info of same domain shapes and section edges
180     myInter3d      : Inter3d             from Partition;
181     
182         -- avoid rebuilding twice commont part of solids
183     myAddedFacesMap: MapOfOrientedShape  from TopTools;
184     
185 end Spliter;