| 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 |
| 5 | // |
| 6 | // This file is part of Open CASCADE Technology software library. |
| 7 | // |
| 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. |
| 13 | // |
| 14 | // Alternatively, this file may be used under the terms of Open CASCADE |
| 15 | // commercial license or contractual agreement. |
| 16 | |
| 17 | #ifndef _BRepSweep_NumLinearRegularSweep_HeaderFile |
| 18 | #define _BRepSweep_NumLinearRegularSweep_HeaderFile |
| 19 | |
| 20 | #include <Standard.hxx> |
| 21 | #include <Standard_DefineAlloc.hxx> |
| 22 | #include <Standard_Handle.hxx> |
| 23 | |
| 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; |
| 38 | class TopoDS_Shape; |
| 39 | class Sweep_NumShape; |
| 40 | |
| 41 | |
| 42 | //! This a generic class is used to build Sweept |
| 43 | //! primitives with a generating "shape" and a |
| 44 | //! directing "line". |
| 45 | //! |
| 46 | //! The indexation and type analysis services required |
| 47 | //! for the generatrix are given by <Tool from BRepSweep>. |
| 48 | //! |
| 49 | //! The indexation and type analysis services required |
| 50 | //! for the directrix are given by <NumShapeTool from Sweep>. |
| 51 | //! |
| 52 | //! The iteration services required for the generatrix |
| 53 | //! are given by <Iterator from BRepSweep>. |
| 54 | //! |
| 55 | //! The iteration services required for the directrix |
| 56 | //! are given by <NumShapeIterator from Sweep>. |
| 57 | //! |
| 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: |
| 63 | //! |
| 64 | //! - a vertex : GenVertex - DirVertex |
| 65 | //! - an edge : GenVertex - DirEdge |
| 66 | //! - : GenEdge - DirVertex |
| 67 | //! - a face : GenEdge - DirEdge |
| 68 | //! GenFace - DirVertex |
| 69 | //! ... |
| 70 | //! |
| 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 |
| 74 | //! types. |
| 75 | //! |
| 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 |
| 80 | { |
| 81 | public: |
| 82 | |
| 83 | DEFINE_STANDARD_ALLOC |
| 84 | |
| 85 | |
| 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(); |
| 90 | |
| 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; |
| 94 | |
| 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; |
| 98 | |
| 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; |
| 103 | |
| 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; |
| 108 | |
| 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; |
| 113 | |
| 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 |
| 118 | //! directing edge". |
| 119 | Standard_EXPORT virtual TopoDS_Shape MakeEmptyFace (const TopoDS_Shape& aGenS, const Sweep_NumShape& aDirS) = 0; |
| 120 | |
| 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; |
| 125 | |
| 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; |
| 130 | |
| 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; |
| 135 | |
| 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; |
| 141 | |
| 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; |
| 146 | |
| 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; |
| 151 | |
| 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 |
| 155 | //! true. |
| 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; |
| 157 | |
| 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; |
| 163 | |
| 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; |
| 168 | |
| 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; |
| 174 | |
| 175 | //! Returns the resulting Shape indexed by aDirS and |
| 176 | //! aGenS. |
| 177 | Standard_EXPORT TopoDS_Shape Shape (const TopoDS_Shape& aGenS, const Sweep_NumShape& aDirS); |
| 178 | |
| 179 | //! Returns the resulting Shape indexed by myDirWire |
| 180 | //! and aGenS. |
| 181 | Standard_EXPORT TopoDS_Shape Shape (const TopoDS_Shape& aGenS); |
| 182 | |
| 183 | //! Returns the resulting Shape indexed by myDirWire |
| 184 | //! and myGenShape. |
| 185 | Standard_EXPORT TopoDS_Shape Shape(); |
| 186 | |
| 187 | //! Returns the resulting Shape indexed by the first |
| 188 | //! Vertex of myDirWire and myGenShape. |
| 189 | Standard_EXPORT TopoDS_Shape FirstShape(); |
| 190 | |
| 191 | //! Returns the resulting Shape indexed by the last |
| 192 | //! Vertex of myDirWire and myGenShape. |
| 193 | Standard_EXPORT TopoDS_Shape LastShape(); |
| 194 | |
| 195 | //! Returns the resulting Shape indexed by the first |
| 196 | //! Vertex of myDirWire and aGenS. |
| 197 | Standard_EXPORT TopoDS_Shape FirstShape (const TopoDS_Shape& aGenS); |
| 198 | |
| 199 | //! Returns the resulting Shape indexed by the last |
| 200 | //! Vertex of myDirWire and aGenS. |
| 201 | Standard_EXPORT TopoDS_Shape LastShape (const TopoDS_Shape& aGenS); |
| 202 | |
| 203 | Standard_EXPORT Standard_Boolean Closed() const; |
| 204 | |
| 205 | |
| 206 | |
| 207 | |
| 208 | protected: |
| 209 | |
| 210 | |
| 211 | //! Creates a NumLinearRegularSweep. <aBuilder> gives |
| 212 | //! basic topological services. |
| 213 | Standard_EXPORT BRepSweep_NumLinearRegularSweep(const BRepSweep_Builder& aBuilder, const TopoDS_Shape& aGenShape, const Sweep_NumShape& aDirWire); |
| 214 | |
| 215 | |
| 216 | BRepSweep_Builder myBuilder; |
| 217 | TopoDS_Shape myGenShape; |
| 218 | Sweep_NumShape myDirWire; |
| 219 | BRepSweep_Tool myGenShapeTool; |
| 220 | Sweep_NumShapeTool myDirShapeTool; |
| 221 | TopTools_Array2OfShape myShapes; |
| 222 | TColStd_Array2OfBoolean myBuiltShapes; |
| 223 | |
| 224 | |
| 225 | private: |
| 226 | |
| 227 | |
| 228 | |
| 229 | |
| 230 | |
| 231 | }; |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | |
| 238 | |
| 239 | #endif // _BRepSweep_NumLinearRegularSweep_HeaderFile |