1 // Created on: 1993-01-27
2 // Created by: Philippe DAUTRY
3 // Copyright (c) 1993-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _BRepSweep_NumLinearRegularSweep_HeaderFile
18 #define _BRepSweep_NumLinearRegularSweep_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_DefineAlloc.hxx>
22 #include <Standard_Handle.hxx>
24 #include <BRepSweep_Builder.hxx>
25 #include <TopoDS_Shape.hxx>
26 #include <Sweep_NumShape.hxx>
27 #include <BRepSweep_Tool.hxx>
28 #include <Sweep_NumShapeTool.hxx>
29 #include <TopTools_Array2OfShape.hxx>
30 #include <TColStd_Array2OfBoolean.hxx>
31 #include <TopAbs_Orientation.hxx>
32 #include <Standard_Boolean.hxx>
33 class Standard_NoMoreObject;
34 class Standard_NoSuchObject;
35 class Standard_RangeError;
36 class Standard_DomainError;
37 class BRepSweep_Builder;
42 //! This a generic class is used to build Sweept
43 //! primitives with a generating "shape" and a
46 //! The indexation and type analysis services required
47 //! for the generatrix are given by <Tool from BRepSweep>.
49 //! The indexation and type analysis services required
50 //! for the directrix are given by <NumShapeTool from Sweep>.
52 //! The iteration services required for the generatrix
53 //! are given by <Iterator from BRepSweep>.
55 //! The iteration services required for the directrix
56 //! are given by <NumShapeIterator from Sweep>.
58 //! The topology is like a grid of shapes. Each shape
59 //! of the grid must be addressable without confusion
60 //! by one or two objects from the generating or
61 //! directing shapes. Here are exemples of correct
62 //! associations to address:
64 //! - a vertex : GenVertex - DirVertex
65 //! - an edge : GenVertex - DirEdge
66 //! - : GenEdge - DirVertex
67 //! - a face : GenEdge - DirEdge
68 //! GenFace - DirVertex
71 //! "GenObject" is used to identify an object from the
72 //! Generating Shape, and "DirObject" from the
73 //! Directing Shape. So may they be from different
76 //! The method Has... is given because in some special
77 //! cases, a vertex, an edge or a face may be
78 //! geometricaly nonexistant or not usefull.
79 class BRepSweep_NumLinearRegularSweep
86 //! Builds the vertex addressed by [aGenV,aDirV], with its
87 //! geometric part, but without subcomponents.
88 Standard_EXPORT virtual TopoDS_Shape MakeEmptyVertex (const TopoDS_Shape& aGenV, const Sweep_NumShape& aDirV) = 0;
89 Standard_EXPORT virtual ~BRepSweep_NumLinearRegularSweep();
91 //! Builds the edge addressed by [aGenV,aDirE], with its
92 //! geometric part, but without subcomponents.
93 Standard_EXPORT virtual TopoDS_Shape MakeEmptyDirectingEdge (const TopoDS_Shape& aGenV, const Sweep_NumShape& aDirE) = 0;
95 //! Builds the edge addressed by [aGenE,aDirV], with its
96 //! geometric part, but without subcomponents.
97 Standard_EXPORT virtual TopoDS_Shape MakeEmptyGeneratingEdge (const TopoDS_Shape& aGenE, const Sweep_NumShape& aDirV) = 0;
99 //! Sets the parameters of the new vertex on the new
100 //! face. The new face and new vertex where generated
101 //! from aGenF, aGenV and aDirV .
102 Standard_EXPORT virtual void SetParameters (const TopoDS_Shape& aNewFace, TopoDS_Shape& aNewVertex, const TopoDS_Shape& aGenF, const TopoDS_Shape& aGenV, const Sweep_NumShape& aDirV) = 0;
104 //! Sets the parameter of the new vertex on the new
105 //! edge. The new edge and new vertex where generated
106 //! from aGenV aDirE, and aDirV.
107 Standard_EXPORT virtual void SetDirectingParameter (const TopoDS_Shape& aNewEdge, TopoDS_Shape& aNewVertex, const TopoDS_Shape& aGenV, const Sweep_NumShape& aDirE, const Sweep_NumShape& aDirV) = 0;
109 //! Sets the parameter of the new vertex on the new
110 //! edge. The new edge and new vertex where generated
111 //! from aGenE, aGenV and aDirV .
112 Standard_EXPORT virtual void SetGeneratingParameter (const TopoDS_Shape& aNewEdge, TopoDS_Shape& aNewVertex, const TopoDS_Shape& aGenE, const TopoDS_Shape& aGenV, const Sweep_NumShape& aDirV) = 0;
114 //! Builds the face addressed by [aGenS,aDirS], with
115 //! its geometric part, but without subcomponents. The
116 //! couple aGenS, aDirS can be a "generating face and
117 //! a directing vertex" or "a generating edge and a
119 Standard_EXPORT virtual TopoDS_Shape MakeEmptyFace (const TopoDS_Shape& aGenS, const Sweep_NumShape& aDirS) = 0;
121 //! Sets the PCurve for a new edge on a new face. The
122 //! new edge and the new face were generated using
123 //! aGenF, aGenE and aDirV.
124 Standard_EXPORT virtual void SetPCurve (const TopoDS_Shape& aNewFace, TopoDS_Shape& aNewEdge, const TopoDS_Shape& aGenF, const TopoDS_Shape& aGenE, const Sweep_NumShape& aDirV, const TopAbs_Orientation orien) = 0;
126 //! Sets the PCurve for a new edge on a new face. The
127 //! new edge and the new face were generated using
128 //! aGenE, aDirE and aDirV.
129 Standard_EXPORT virtual void SetGeneratingPCurve (const TopoDS_Shape& aNewFace, TopoDS_Shape& aNewEdge, const TopoDS_Shape& aGenE, const Sweep_NumShape& aDirE, const Sweep_NumShape& aDirV, const TopAbs_Orientation orien) = 0;
131 //! Sets the PCurve for a new edge on a new face. The
132 //! new edge and the new face were generated using
133 //! aGenE, aDirE and aGenV.
134 Standard_EXPORT virtual void SetDirectingPCurve (const TopoDS_Shape& aNewFace, TopoDS_Shape& aNewEdge, const TopoDS_Shape& aGenE, const TopoDS_Shape& aGenV, const Sweep_NumShape& aDirE, const TopAbs_Orientation orien) = 0;
136 //! Returns the Orientation of the shell in the solid
137 //! generated by the face aGenS with the edge aDirS.
138 //! It is REVERSED if the surface is swept in the
139 //! direction of the normal.
140 Standard_EXPORT virtual TopAbs_Orientation DirectSolid (const TopoDS_Shape& aGenS, const Sweep_NumShape& aDirS) = 0;
142 //! Returns true if aNewSubShape (addressed by
143 //! aSubGenS and aDirS) must be added in aNewShape
144 //! (addressed by aGenS and aDirS).
145 Standard_EXPORT virtual Standard_Boolean GGDShapeIsToAdd (const TopoDS_Shape& aNewShape, const TopoDS_Shape& aNewSubShape, const TopoDS_Shape& aGenS, const TopoDS_Shape& aSubGenS, const Sweep_NumShape& aDirS) const = 0;
147 //! Returns true if aNewSubShape (addressed by
148 //! aGenS and aSubDirS) must be added in aNewShape
149 //! (addressed by aGenS and aDirS).
150 Standard_EXPORT virtual Standard_Boolean GDDShapeIsToAdd (const TopoDS_Shape& aNewShape, const TopoDS_Shape& aNewSubShape, const TopoDS_Shape& aGenS, const Sweep_NumShape& aDirS, const Sweep_NumShape& aSubDirS) const = 0;
152 //! In some particular cases the topology of a
153 //! generated face must be composed of independant
154 //! closed wires, in this case this function returns
156 Standard_EXPORT virtual Standard_Boolean SeparatedWires (const TopoDS_Shape& aNewShape, const TopoDS_Shape& aNewSubShape, const TopoDS_Shape& aGenS, const TopoDS_Shape& aSubGenS, const Sweep_NumShape& aDirS) const = 0;
158 //! In some particular cases the topology of a
159 //! generated Shell must be composed of independant
160 //! closed Shells, in this case this function returns
161 //! a Compound of independant Shells.
162 Standard_EXPORT virtual TopoDS_Shape SplitShell (const TopoDS_Shape& aNewShape) const;
164 //! Called to propagate the continuity of every vertex
165 //! between two edges of the generating wire aGenS on
166 //! the generated edge and faces.
167 Standard_EXPORT virtual void SetContinuity (const TopoDS_Shape& aGenS, const Sweep_NumShape& aDirS) = 0;
169 //! Returns true if aDirS and aGenS addresses a
170 //! resulting Shape. In some specific cases the shape
171 //! can be geometrically inexsistant, then this
172 //! function returns false.
173 Standard_EXPORT virtual Standard_Boolean HasShape (const TopoDS_Shape& aGenS, const Sweep_NumShape& aDirS) const = 0;
175 //! Returns true if aGenS cannot be transformed.
176 Standard_EXPORT virtual Standard_Boolean IsInvariant(const TopoDS_Shape& aGenS) const = 0;
178 //! Returns the resulting Shape indexed by aDirS and
180 Standard_EXPORT TopoDS_Shape Shape (const TopoDS_Shape& aGenS, const Sweep_NumShape& aDirS);
182 //! Returns the resulting Shape indexed by myDirWire
184 Standard_EXPORT TopoDS_Shape Shape (const TopoDS_Shape& aGenS);
186 //! Returns true if the initial shape aGenS
187 //! is used in result shape
188 Standard_EXPORT Standard_Boolean IsUsed(const TopoDS_Shape& aGenS) const;
190 //! Returns true if the shape, generated from theS
191 //! is used in result shape
192 Standard_EXPORT Standard_Boolean GenIsUsed(const TopoDS_Shape& theS) const;
194 //! Returns the resulting Shape indexed by myDirWire
196 Standard_EXPORT TopoDS_Shape Shape();
198 //! Returns the resulting Shape indexed by the first
199 //! Vertex of myDirWire and myGenShape.
200 Standard_EXPORT TopoDS_Shape FirstShape();
202 //! Returns the resulting Shape indexed by the last
203 //! Vertex of myDirWire and myGenShape.
204 Standard_EXPORT TopoDS_Shape LastShape();
206 //! Returns the resulting Shape indexed by the first
207 //! Vertex of myDirWire and aGenS.
208 Standard_EXPORT TopoDS_Shape FirstShape (const TopoDS_Shape& aGenS);
210 //! Returns the resulting Shape indexed by the last
211 //! Vertex of myDirWire and aGenS.
212 Standard_EXPORT TopoDS_Shape LastShape (const TopoDS_Shape& aGenS);
214 Standard_EXPORT Standard_Boolean Closed() const;
222 //! Creates a NumLinearRegularSweep. <aBuilder> gives
223 //! basic topological services.
224 Standard_EXPORT BRepSweep_NumLinearRegularSweep(const BRepSweep_Builder& aBuilder, const TopoDS_Shape& aGenShape, const Sweep_NumShape& aDirWire);
227 BRepSweep_Builder myBuilder;
228 TopoDS_Shape myGenShape;
229 Sweep_NumShape myDirWire;
230 BRepSweep_Tool myGenShapeTool;
231 Sweep_NumShapeTool myDirShapeTool;
232 TopTools_Array2OfShape myShapes;
233 TColStd_Array2OfBoolean myBuiltShapes;
234 TColStd_Array2OfBoolean myUsedShapes;
251 #endif // _BRepSweep_NumLinearRegularSweep_HeaderFile