| 1 | -- Created on: 1990-12-20 |
| 2 | -- Created by: Remi Lequette |
| 3 | -- Copyright (c) 1990-1999 Matra Datavision |
| 4 | -- Copyright (c) 1999-2012 OPEN CASCADE SAS |
| 5 | -- |
| 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. |
| 10 | -- |
| 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. |
| 13 | -- |
| 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. |
| 20 | |
| 21 | |
| 22 | |
| 23 | package TopExp |
| 24 | |
| 25 | ---Purpose: This package provides basic tools to explore the |
| 26 | -- topological data structures. |
| 27 | -- |
| 28 | -- * Explorer : A tool to find all sub-shapes of a given |
| 29 | -- type. e.g. all faces of a solid. |
| 30 | -- |
| 31 | -- * Package methods to map sub-shapes of a shape. |
| 32 | -- |
| 33 | -- Level : Public |
| 34 | -- All methods of all classes will be public. |
| 35 | |
| 36 | |
| 37 | uses |
| 38 | |
| 39 | TCollection, |
| 40 | TopLoc, |
| 41 | TopAbs, |
| 42 | TopoDS, |
| 43 | TopTools |
| 44 | |
| 45 | is |
| 46 | |
| 47 | private class StackOfIterator instantiates |
| 48 | Stack from TCollection (Iterator from TopoDS); |
| 49 | |
| 50 | pointer Stack to Iterator from TopoDS; |
| 51 | |
| 52 | class Explorer; |
| 53 | ---Purpose: Tool to explore a topological data structure. |
| 54 | |
| 55 | -- |
| 56 | -- Package methods |
| 57 | -- |
| 58 | |
| 59 | |
| 60 | MapShapes(S : Shape from TopoDS; |
| 61 | T : ShapeEnum from TopAbs; |
| 62 | M : in out IndexedMapOfShape from TopTools); |
| 63 | ---Purpose: Stores in the map <M> all the sub-shapes of <S> |
| 64 | -- of type <T>. |
| 65 | -- |
| 66 | -- Warning: The map is not cleared at first. |
| 67 | |
| 68 | MapShapes(S : Shape from TopoDS; |
| 69 | M : in out IndexedMapOfShape from TopTools); |
| 70 | ---Purpose: Stores in the map <M> all the sub-shapes of <S>. |
| 71 | |
| 72 | MapShapesAndAncestors |
| 73 | (S : Shape from TopoDS; |
| 74 | TS : ShapeEnum from TopAbs; |
| 75 | TA : ShapeEnum from TopAbs; |
| 76 | M : in out IndexedDataMapOfShapeListOfShape from TopTools); |
| 77 | ---Purpose: Stores in the map <M> all the subshape of <S> of |
| 78 | -- type <TS> for each one append to the list all |
| 79 | -- the ancestors of type <TA>. For example map all |
| 80 | -- the edges and bind the list of faces. |
| 81 | -- Warning: The map is not cleared at first. |
| 82 | |
| 83 | FirstVertex(E : Edge from TopoDS; |
| 84 | CumOri : Boolean from Standard = Standard_False) |
| 85 | returns Vertex from TopoDS; |
| 86 | ---Purpose: Returns the Vertex of orientation FORWARD in E. If |
| 87 | -- there is none returns a Null Shape. |
| 88 | -- CumOri = True : taking account the edge orientation |
| 89 | |
| 90 | LastVertex(E : Edge from TopoDS; |
| 91 | CumOri : Boolean from Standard = Standard_False) |
| 92 | returns Vertex from TopoDS; |
| 93 | ---Purpose: Returns the Vertex of orientation REVERSED in E. If |
| 94 | -- there is none returns a Null Shape. |
| 95 | -- CumOri = True : taking account the edge orientation |
| 96 | |
| 97 | Vertices(E : Edge from TopoDS; Vfirst, Vlast : out Vertex from TopoDS; |
| 98 | CumOri : Boolean from Standard = Standard_False); |
| 99 | ---Purpose: Returns in Vfirst, Vlast the FORWARD and REVERSED |
| 100 | -- vertices of the edge <E>. May be null shapes. |
| 101 | -- CumOri = True : taking account the edge orientation |
| 102 | |
| 103 | Vertices(W : Wire from TopoDS; Vfirst, Vlast : out Vertex from TopoDS); |
| 104 | ---Purpose: Returns in Vfirst, Vlast the first and last |
| 105 | -- vertices of the open wire <W>. May be null shapes. |
| 106 | -- if <W> is closed Vfirst and Vlast are a same |
| 107 | -- vertex on <W>. |
| 108 | -- if <W> is no manifold. VFirst and VLast are null |
| 109 | -- shapes. |
| 110 | |
| 111 | CommonVertex( E1, E2 : Edge from TopoDS; |
| 112 | V : out Vertex from TopoDS) |
| 113 | returns Boolean; |
| 114 | ---Purpose: Finds the vertex <V> common to the two edges |
| 115 | -- <E1,E2>, returns True if this vertex exists. |
| 116 | -- |
| 117 | -- Warning: <V> has sense only if the value <True> is returned |
| 118 | |
| 119 | end TopExp; |
| 120 | |
| 121 | |
| 122 | |