Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-24 09:15:24

0001 // Created on: 1993-01-27
0002 // Created by: Philippe DAUTRY
0003 // Copyright (c) 1993-1999 Matra Datavision
0004 // Copyright (c) 1999-2014 OPEN CASCADE SAS
0005 //
0006 // This file is part of Open CASCADE Technology software library.
0007 //
0008 // This library is free software; you can redistribute it and/or modify it under
0009 // the terms of the GNU Lesser General Public License version 2.1 as published
0010 // by the Free Software Foundation, with special exception defined in the file
0011 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0012 // distribution for complete text of the license and disclaimer of any warranty.
0013 //
0014 // Alternatively, this file may be used under the terms of Open CASCADE
0015 // commercial license or contractual agreement.
0016 
0017 #ifndef _BRepSweep_NumLinearRegularSweep_HeaderFile
0018 #define _BRepSweep_NumLinearRegularSweep_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 
0023 #include <BRepSweep_Builder.hxx>
0024 #include <TopoDS_Shape.hxx>
0025 #include <BRepSweep_Tool.hxx>
0026 #include <Sweep_NumShapeTool.hxx>
0027 #include <NCollection_Array2.hxx>
0028 #include <TopAbs_Orientation.hxx>
0029 
0030 //! This a generic class is used to build Sweept
0031 //! primitives with a generating "shape" and a
0032 //! directing "line".
0033 //!
0034 //! The indexation and type analysis services required
0035 //! for the generatrix are given by <Tool from BRepSweep>.
0036 //!
0037 //! The indexation and type analysis services required
0038 //! for the directrix are given by <NumShapeTool from Sweep>.
0039 //!
0040 //! The iteration services required for the generatrix
0041 //! are given by <Iterator from BRepSweep>.
0042 //!
0043 //! The iteration services required for the directrix
0044 //! are given by <NumShapeIterator from Sweep>.
0045 //!
0046 //! The topology is like a grid of shapes. Each shape
0047 //! of the grid must be addressable without confusion
0048 //! by one or two objects from the generating or
0049 //! directing shapes. Here are examples of correct
0050 //! associations to address:
0051 //!
0052 //! - a vertex : GenVertex - DirVertex
0053 //! - an edge  : GenVertex - DirEdge
0054 //! -          : GenEdge   - DirVertex
0055 //! - a face   : GenEdge   - DirEdge
0056 //! GenFace   - DirVertex
0057 //! ...
0058 //!
0059 //! "GenObject" is used to identify an object from the
0060 //! Generating Shape, and "DirObject" from the
0061 //! Directing Shape. So may they be from different
0062 //! types.
0063 //!
0064 //! The method Has... is given because in some special
0065 //! cases, a vertex, an edge or a face may be
0066 //! geometricaly nonexistent or not useful.
0067 class BRepSweep_NumLinearRegularSweep
0068 {
0069 public:
0070   DEFINE_STANDARD_ALLOC
0071 
0072   //! Builds the vertex addressed by [aGenV,aDirV], with its
0073   //! geometric part, but without subcomponents.
0074   Standard_EXPORT virtual TopoDS_Shape MakeEmptyVertex(const TopoDS_Shape&   aGenV,
0075                                                        const Sweep_NumShape& aDirV) = 0;
0076   Standard_EXPORT virtual ~BRepSweep_NumLinearRegularSweep();
0077 
0078   //! Builds the edge addressed by [aGenV,aDirE], with its
0079   //! geometric part, but without subcomponents.
0080   Standard_EXPORT virtual TopoDS_Shape MakeEmptyDirectingEdge(const TopoDS_Shape&   aGenV,
0081                                                               const Sweep_NumShape& aDirE) = 0;
0082 
0083   //! Builds the edge addressed by [aGenE,aDirV], with its
0084   //! geometric part, but without subcomponents.
0085   Standard_EXPORT virtual TopoDS_Shape MakeEmptyGeneratingEdge(const TopoDS_Shape&   aGenE,
0086                                                                const Sweep_NumShape& aDirV) = 0;
0087 
0088   //! Sets the parameters of the new vertex on the new
0089   //! face. The new face and new vertex where generated
0090   //! from aGenF, aGenV and aDirV .
0091   Standard_EXPORT virtual void SetParameters(const TopoDS_Shape&   aNewFace,
0092                                              TopoDS_Shape&         aNewVertex,
0093                                              const TopoDS_Shape&   aGenF,
0094                                              const TopoDS_Shape&   aGenV,
0095                                              const Sweep_NumShape& aDirV) = 0;
0096 
0097   //! Sets the parameter of the new vertex on the new
0098   //! edge. The new edge and new vertex where generated
0099   //! from aGenV aDirE, and aDirV.
0100   Standard_EXPORT virtual void SetDirectingParameter(const TopoDS_Shape&   aNewEdge,
0101                                                      TopoDS_Shape&         aNewVertex,
0102                                                      const TopoDS_Shape&   aGenV,
0103                                                      const Sweep_NumShape& aDirE,
0104                                                      const Sweep_NumShape& aDirV) = 0;
0105 
0106   //! Sets the parameter of the new vertex on the new
0107   //! edge. The new edge and new vertex where generated
0108   //! from aGenE, aGenV and aDirV .
0109   Standard_EXPORT virtual void SetGeneratingParameter(const TopoDS_Shape&   aNewEdge,
0110                                                       TopoDS_Shape&         aNewVertex,
0111                                                       const TopoDS_Shape&   aGenE,
0112                                                       const TopoDS_Shape&   aGenV,
0113                                                       const Sweep_NumShape& aDirV) = 0;
0114 
0115   //! Builds the face addressed by [aGenS,aDirS], with
0116   //! its geometric part, but without subcomponents. The
0117   //! couple aGenS, aDirS can be a "generating face and
0118   //! a directing vertex" or "a generating edge and a
0119   //! directing edge".
0120   Standard_EXPORT virtual TopoDS_Shape MakeEmptyFace(const TopoDS_Shape&   aGenS,
0121                                                      const Sweep_NumShape& aDirS) = 0;
0122 
0123   //! Sets the PCurve for a new edge on a new face. The
0124   //! new edge and the new face were generated using
0125   //! aGenF, aGenE and aDirV.
0126   Standard_EXPORT virtual void SetPCurve(const TopoDS_Shape&      aNewFace,
0127                                          TopoDS_Shape&            aNewEdge,
0128                                          const TopoDS_Shape&      aGenF,
0129                                          const TopoDS_Shape&      aGenE,
0130                                          const Sweep_NumShape&    aDirV,
0131                                          const TopAbs_Orientation orien) = 0;
0132 
0133   //! Sets the PCurve for a new edge on a new face. The
0134   //! new edge and the new face were generated using
0135   //! aGenE, aDirE and aDirV.
0136   Standard_EXPORT virtual void SetGeneratingPCurve(const TopoDS_Shape&      aNewFace,
0137                                                    TopoDS_Shape&            aNewEdge,
0138                                                    const TopoDS_Shape&      aGenE,
0139                                                    const Sweep_NumShape&    aDirE,
0140                                                    const Sweep_NumShape&    aDirV,
0141                                                    const TopAbs_Orientation orien) = 0;
0142 
0143   //! Sets the PCurve for a new edge on a new face. The
0144   //! new edge and the new face were generated using
0145   //! aGenE, aDirE and aGenV.
0146   Standard_EXPORT virtual void SetDirectingPCurve(const TopoDS_Shape&      aNewFace,
0147                                                   TopoDS_Shape&            aNewEdge,
0148                                                   const TopoDS_Shape&      aGenE,
0149                                                   const TopoDS_Shape&      aGenV,
0150                                                   const Sweep_NumShape&    aDirE,
0151                                                   const TopAbs_Orientation orien) = 0;
0152 
0153   //! Returns the Orientation of the shell in the solid
0154   //! generated by the face aGenS with the edge aDirS.
0155   //! It is REVERSED if the surface is swept in the
0156   //! direction of the normal.
0157   Standard_EXPORT virtual TopAbs_Orientation DirectSolid(const TopoDS_Shape&   aGenS,
0158                                                          const Sweep_NumShape& aDirS) = 0;
0159 
0160   //! Returns true if aNewSubShape (addressed by
0161   //! aSubGenS and aDirS) must be added in aNewShape
0162   //! (addressed by aGenS and aDirS).
0163   Standard_EXPORT virtual bool GGDShapeIsToAdd(const TopoDS_Shape&   aNewShape,
0164                                                const TopoDS_Shape&   aNewSubShape,
0165                                                const TopoDS_Shape&   aGenS,
0166                                                const TopoDS_Shape&   aSubGenS,
0167                                                const Sweep_NumShape& aDirS) const = 0;
0168 
0169   //! Returns true if aNewSubShape (addressed by
0170   //! aGenS and aSubDirS) must be added in aNewShape
0171   //! (addressed by aGenS and aDirS).
0172   Standard_EXPORT virtual bool GDDShapeIsToAdd(const TopoDS_Shape&   aNewShape,
0173                                                const TopoDS_Shape&   aNewSubShape,
0174                                                const TopoDS_Shape&   aGenS,
0175                                                const Sweep_NumShape& aDirS,
0176                                                const Sweep_NumShape& aSubDirS) const = 0;
0177 
0178   //! In some particular cases the topology of a
0179   //! generated face must be composed of independent
0180   //! closed wires, in this case this function returns
0181   //! true.
0182   Standard_EXPORT virtual bool SeparatedWires(const TopoDS_Shape&   aNewShape,
0183                                               const TopoDS_Shape&   aNewSubShape,
0184                                               const TopoDS_Shape&   aGenS,
0185                                               const TopoDS_Shape&   aSubGenS,
0186                                               const Sweep_NumShape& aDirS) const = 0;
0187 
0188   //! In some particular cases the topology of a
0189   //! generated Shell must be composed of independent
0190   //! closed Shells, in this case this function returns
0191   //! a Compound of independent Shells.
0192   Standard_EXPORT virtual TopoDS_Shape SplitShell(const TopoDS_Shape& aNewShape) const;
0193 
0194   //! Called to propagate the continuity of every vertex
0195   //! between two edges of the generating wire aGenS on
0196   //! the generated edge and faces.
0197   Standard_EXPORT virtual void SetContinuity(const TopoDS_Shape&   aGenS,
0198                                              const Sweep_NumShape& aDirS) = 0;
0199 
0200   //! Returns true if aDirS and aGenS addresses a
0201   //! resulting Shape. In some specific cases the shape
0202   //! can be geometrically inexsistant, then this
0203   //! function returns false.
0204   Standard_EXPORT virtual bool HasShape(const TopoDS_Shape&   aGenS,
0205                                         const Sweep_NumShape& aDirS) const = 0;
0206 
0207   //! Returns true if aGenS cannot be transformed.
0208   Standard_EXPORT virtual bool IsInvariant(const TopoDS_Shape& aGenS) const = 0;
0209 
0210   //! Returns the resulting Shape indexed by aDirS and
0211   //! aGenS.
0212   Standard_EXPORT TopoDS_Shape Shape(const TopoDS_Shape& aGenS, const Sweep_NumShape& aDirS);
0213 
0214   //! Returns the resulting Shape indexed by myDirWire
0215   //! and aGenS.
0216   Standard_EXPORT TopoDS_Shape Shape(const TopoDS_Shape& aGenS);
0217 
0218   //! Returns true if the initial shape aGenS
0219   //! is used in result shape
0220   Standard_EXPORT bool IsUsed(const TopoDS_Shape& aGenS) const;
0221 
0222   //! Returns true if the shape, generated from theS
0223   //! is used in result shape
0224   Standard_EXPORT bool GenIsUsed(const TopoDS_Shape& theS) const;
0225 
0226   //! Returns the resulting Shape indexed by myDirWire
0227   //! and myGenShape.
0228   Standard_EXPORT TopoDS_Shape Shape();
0229 
0230   //! Returns the resulting Shape indexed by the first
0231   //! Vertex of myDirWire and myGenShape.
0232   Standard_EXPORT TopoDS_Shape FirstShape();
0233 
0234   //! Returns the resulting Shape indexed by the last
0235   //! Vertex of myDirWire and myGenShape.
0236   Standard_EXPORT TopoDS_Shape LastShape();
0237 
0238   //! Returns the resulting Shape indexed by the first
0239   //! Vertex of myDirWire and aGenS.
0240   Standard_EXPORT TopoDS_Shape FirstShape(const TopoDS_Shape& aGenS);
0241 
0242   //! Returns the resulting Shape indexed by the last
0243   //! Vertex of myDirWire and aGenS.
0244   Standard_EXPORT TopoDS_Shape LastShape(const TopoDS_Shape& aGenS);
0245 
0246   Standard_EXPORT bool Closed() const;
0247 
0248 protected:
0249   //! Creates a NumLinearRegularSweep. <aBuilder> gives
0250   //! basic topological services.
0251   Standard_EXPORT BRepSweep_NumLinearRegularSweep(const BRepSweep_Builder& aBuilder,
0252                                                   const TopoDS_Shape&      aGenShape,
0253                                                   const Sweep_NumShape&    aDirWire);
0254 
0255   BRepSweep_Builder                myBuilder;
0256   TopoDS_Shape                     myGenShape;
0257   Sweep_NumShape                   myDirWire;
0258   BRepSweep_Tool                   myGenShapeTool;
0259   Sweep_NumShapeTool               myDirShapeTool;
0260   NCollection_Array2<TopoDS_Shape> myShapes;
0261   NCollection_Array2<bool>         myBuiltShapes;
0262   NCollection_Array2<bool>         myUsedShapes;
0263 };
0264 
0265 #endif // _BRepSweep_NumLinearRegularSweep_HeaderFile