1 -- Created on: 1998-06-03
2 -- Created by: data exchange team
3 -- Copyright (c) 1998-1999 Matra Datavision
4 -- Copyright (c) 1999-2012 OPEN CASCADE SAS
6 -- The content of this file is subject to the Open CASCADE Technology Public
7 -- License Version 6.5 (the "License"). You may not use the content of this file
8 -- except in compliance with the License. Please obtain a copy of the License
9 -- at http://www.opencascade.org and read it completely before using this file.
11 -- The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
12 -- main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
14 -- The Original Code and all software distributed under the License is
15 -- distributed on an "AS IS" basis, without warranty of any kind, and the
16 -- Initial Developer hereby disclaims all such warranties, including without
17 -- limitation, any warranties of merchantability, fitness for a particular
18 -- purpose or non-infringement. Please see the License for the specific terms
19 -- and conditions governing the rights and limitations under the License.
23 class Explorer from ShapeExtend
25 ---Purpose: This class is intended to
26 -- explore shapes and convert different representations
27 -- (list, sequence, compound) of complex shapes. It provides tools for:
28 -- - obtaining type of the shapes in context of TopoDS_Compound,
29 -- - exploring shapes in context of TopoDS_Compound,
30 -- - converting different representations of shapes (list, sequence, compound).
33 ShapeEnum from TopAbs,
34 HSequenceOfShape from TopTools,
35 ListOfShape from TopTools
38 TypeMismatch from Standard
42 Create returns Explorer from ShapeExtend;
43 ---Purpose: Creates an object Explorer
45 CompoundFromSeq (me; seqval: HSequenceOfShape)
46 returns Shape from TopoDS;
47 ---Purpose: Converts a sequence of Shapes to a Compound
49 SeqFromCompound (me; comp: Shape from TopoDS; expcomp: Boolean)
50 returns HSequenceOfShape;
51 ---Purpose: Converts a Compound to a list of Shapes
52 -- if <comp> is not a compound, the list contains only <comp>
53 -- if <comp> is Null, the list is empty
54 -- if <comp> is a Compound, its sub-shapes are put into the list
55 -- then if <expcomp> is True, if a sub-shape is a Compound, it
56 -- is not put to the list but its sub-shapes are (recursive)
58 ListFromSeq (me; seqval: HSequenceOfShape;
59 lisval: in out ListOfShape from TopTools;
60 clear: Boolean = Standard_True);
61 ---Purpose: Converts a Sequence of Shapes to a List of Shapes
62 -- <clear> if True (D), commands the list to start from scratch
63 -- else, the list is cumulated
65 SeqFromList (me; lisval: ListOfShape)
66 returns HSequenceOfShape from TopTools;
67 ---Purpose: Converts a List of Shapes to a Sequence of Shapes
70 ShapeType (me; shape: Shape from TopoDS; compound: Boolean)
72 ---Purpose: Returns the type of a Shape: true type if <compound> is False
73 -- If <compound> is True and <shape> is a Compound, iterates on
74 -- its items. If all are of the same type, returns this type.
75 -- Else, returns COMPOUND. If it is empty, returns SHAPE
76 -- For a Null Shape, returns SHAPE
78 SortedCompound (me; shape: Shape from TopoDS; type: ShapeEnum;
79 explore: Boolean; compound: Boolean)
80 returns Shape from TopoDS;
81 ---Purpose: Builds a COMPOUND from the given shape.
82 -- It explores the shape level by level, according to the
83 -- <explore> argument. If <explore> is False, only COMPOUND
84 -- items are explored, else all items are.
85 -- The following shapes are added to resulting compound:
86 -- - shapes which comply to <type>
87 -- - if <type> is WIRE, considers also free edges (and makes wires)
88 -- - if <type> is SHELL, considers also free faces (and makes shells)
89 -- If <compound> is True, gathers items in compounds which
90 -- correspond to starting COMPOUND,SOLID or SHELL containers, or
91 -- items directly contained in a Compound
93 DispatchList (me; list: HSequenceOfShape;
94 vertices, edges, wires, faces, shells, solids, compsols, compounds:
95 in out HSequenceOfShape);
96 ---Purpose: Dispatches starting list of shapes according to their type,
97 -- to the appropriate resulting lists
98 -- For each of these lists, if it is null, it is firstly created
99 -- else, new items are appended to the already existing ones