Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:03:16

0001 // Created on: 1995-07-17
0002 // Created by: Jing-Cheng MEI
0003 // Copyright (c) 1995-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 _BRepOffsetAPI_ThruSections_HeaderFile
0018 #define _BRepOffsetAPI_ThruSections_HeaderFile
0019 
0020 #include <Standard.hxx>
0021 #include <Standard_DefineAlloc.hxx>
0022 #include <Standard_Handle.hxx>
0023 
0024 #include <BRepFill_ThruSectionErrorStatus.hxx>
0025 #include <TopTools_SequenceOfShape.hxx>
0026 #include <TopoDS_Face.hxx>
0027 #include <TopTools_DataMapOfShapeShape.hxx>
0028 #include <TopTools_DataMapOfShapeListOfInteger.hxx>
0029 #include <TopTools_DataMapOfShapeInteger.hxx>
0030 #include <GeomAbs_Shape.hxx>
0031 #include <Approx_ParametrizationType.hxx>
0032 #include <Standard_Integer.hxx>
0033 #include <BRepBuilderAPI_MakeShape.hxx>
0034 #include <TopTools_Array1OfShape.hxx>
0035 #include <NCollection_Handle.hxx>
0036 
0037 class TopoDS_Wire;
0038 class TopoDS_Vertex;
0039 class TopoDS_Shape;
0040 class Geom_BSplineSurface;
0041 class BRepFill_Generator;
0042 
0043 //! Describes functions to build a loft. This is a shell or a
0044 //! solid passing through a set of sections in a given
0045 //! sequence. Usually sections are wires, but the first and
0046 //! the last sections may be vertices (punctual sections).
0047 class BRepOffsetAPI_ThruSections  : public BRepBuilderAPI_MakeShape
0048 {
0049 public:
0050 
0051   DEFINE_STANDARD_ALLOC
0052 
0053   
0054   //! Initializes an algorithm for building a shell or a solid
0055   //! passing through a set of sections, where:
0056   //! -          isSolid is set to true if the construction algorithm is
0057   //! required to build a solid or to false if it is required to build
0058   //! a shell (the default value),
0059   //! -          ruled is set to true if the faces generated between
0060   //! the edges of two consecutive wires are ruled surfaces or to
0061   //! false (the default value) if they are smoothed out by approximation,
0062   //! -          pres3d defines the precision criterion used by the
0063   //! approximation algorithm; the default value is 1.0e-6.
0064   //! Use AddWire and AddVertex to define the
0065   //! successive sections of the shell or solid to be built.
0066   Standard_EXPORT BRepOffsetAPI_ThruSections(const Standard_Boolean isSolid = Standard_False, const Standard_Boolean ruled = Standard_False, const Standard_Real pres3d = 1.0e-06);
0067   
0068   //! Initializes this algorithm for building a shell or a solid
0069   //! passing through a set of sections, where:
0070   //! - isSolid is set to true if this construction algorithm is
0071   //! required to build a solid or to false if it is required to
0072   //! build a shell. false is the default value;
0073   //! - ruled is set to true if the faces generated between the
0074   //! edges of two consecutive wires are ruled surfaces or
0075   //! to false (the default value) if they are smoothed out by approximation,
0076   //! - pres3d defines the precision criterion used by the
0077   //! approximation algorithm; the default value is 1.0e-6.
0078   //! Use AddWire and AddVertex to define the successive
0079   //! sections of the shell or solid to be built.
0080   Standard_EXPORT void Init (const Standard_Boolean isSolid = Standard_False, const Standard_Boolean ruled = Standard_False, const Standard_Real pres3d = 1.0e-06);
0081   
0082   //! Adds the wire wire to the set of
0083   //! sections through which the shell or solid is built.
0084   //! Use the Build function to construct the shape.
0085   Standard_EXPORT void AddWire (const TopoDS_Wire& wire);
0086   
0087   //! Adds the vertex Vertex (punctual section) to the set of sections
0088   //! through which the shell or solid is built. A vertex may be added to the
0089   //! set of sections only as first or last section. At least one wire
0090   //! must be added to the set of sections by the method AddWire.
0091   //! Use the Build function to construct the shape.
0092   Standard_EXPORT void AddVertex (const TopoDS_Vertex& aVertex);
0093   
0094   //! Sets/unsets the option to
0095   //! compute origin and orientation on wires to avoid twisted results
0096   //! and update wires to have same number of edges.
0097   Standard_EXPORT void CheckCompatibility (const Standard_Boolean check = Standard_True);
0098   
0099   //! Define the approximation algorithm
0100   Standard_EXPORT void SetSmoothing (const Standard_Boolean UseSmoothing);
0101   
0102   //! Define the type of parametrization   used in the approximation
0103   Standard_EXPORT void SetParType (const Approx_ParametrizationType ParType);
0104   
0105   //! Define the Continuity used in the approximation
0106   Standard_EXPORT void SetContinuity (const GeomAbs_Shape C);
0107   
0108   //! define the Weights  associed to the criterium used in
0109   //! the  optimization.
0110   //!
0111   //! if Wi <= 0
0112   Standard_EXPORT void SetCriteriumWeight (const Standard_Real W1, const Standard_Real W2, const Standard_Real W3);
0113   
0114   //! Define the maximal U degree of result surface
0115   Standard_EXPORT void SetMaxDegree (const Standard_Integer MaxDeg);
0116   
0117   //! returns the type of parametrization used in the approximation
0118   Standard_EXPORT Approx_ParametrizationType ParType() const;
0119   
0120   //! returns the Continuity used in the approximation
0121   Standard_EXPORT GeomAbs_Shape Continuity() const;
0122   
0123   //! returns the maximal U degree of result surface
0124   Standard_EXPORT Standard_Integer MaxDegree() const;
0125   
0126   //! Define the approximation algorithm
0127   Standard_EXPORT Standard_Boolean UseSmoothing() const;
0128   
0129   //! returns the Weights associed  to the criterium used in
0130   //! the  optimization.
0131   Standard_EXPORT void CriteriumWeight (Standard_Real& W1, Standard_Real& W2, Standard_Real& W3) const;
0132   
0133   Standard_EXPORT virtual void Build(const Message_ProgressRange& theRange = Message_ProgressRange()) Standard_OVERRIDE;
0134   
0135   //! Returns the TopoDS Shape of the bottom of the loft if solid
0136   Standard_EXPORT const TopoDS_Shape& FirstShape() const;
0137   
0138   //! Returns the TopoDS Shape of the top of the loft if solid
0139   Standard_EXPORT const TopoDS_Shape& LastShape() const;
0140   
0141   //! if Ruled
0142   //! Returns the Face generated by each edge
0143   //! except the last wire
0144   //! if smoothed
0145   //! Returns the Face generated by each edge of the first wire
0146   Standard_EXPORT TopoDS_Shape GeneratedFace (const TopoDS_Shape& Edge) const;
0147 
0148   //! Sets the mutable input state.
0149   //! If true then the input profile can be modified inside
0150   //! the thrusection operation. Default value is true.
0151   Standard_EXPORT void SetMutableInput(const Standard_Boolean theIsMutableInput);
0152   
0153   //! Returns a list of new shapes generated from the shape
0154   //! S by the shell-generating algorithm.
0155   //! This function is redefined from BRepBuilderAPI_MakeShape::Generated.
0156   //! S can be an edge or a vertex of a given Profile (see methods AddWire and AddVertex).
0157   Standard_EXPORT virtual const TopTools_ListOfShape& Generated (const TopoDS_Shape& S) Standard_OVERRIDE;
0158 
0159   //! Returns the list of original wires
0160   const TopTools_ListOfShape& Wires() const
0161   {
0162     return myInputWires;
0163   }
0164   //! Returns the current mutable input state
0165   Standard_EXPORT Standard_Boolean IsMutableInput() const;
0166   
0167   //! Returns the status of thrusection operation
0168   BRepFill_ThruSectionErrorStatus GetStatus() const
0169   {
0170     return myStatus;
0171   }
0172 
0173 protected:
0174 
0175 
0176 
0177 
0178 
0179 private:
0180 
0181   
0182   Standard_EXPORT void CreateRuled();
0183   
0184   Standard_EXPORT void CreateSmoothed();
0185   
0186   Standard_EXPORT Handle(Geom_BSplineSurface) TotalSurf (const TopTools_Array1OfShape& shapes,
0187                                                          const Standard_Integer NbSect,
0188                                                          const Standard_Integer NbEdges,
0189                                                          const Standard_Boolean w1Point,
0190                                                          const Standard_Boolean w2Point,
0191                                                          const Standard_Boolean vClosed) const;
0192 
0193 
0194   TopTools_ListOfShape myInputWires; //!< List of input wires
0195   TopTools_SequenceOfShape myWires;  //!< Working wires
0196   TopTools_DataMapOfShapeListOfInteger myEdgeNewIndices;
0197   TopTools_DataMapOfShapeInteger myVertexIndex;
0198   Standard_Integer myNbEdgesInSection;
0199   Standard_Boolean myIsSolid;
0200   Standard_Boolean myIsRuled;
0201   Standard_Boolean myWCheck;
0202   Standard_Real myPres3d;
0203   TopoDS_Face myFirst;
0204   TopoDS_Face myLast;
0205   Standard_Boolean myDegen1;
0206   Standard_Boolean myDegen2;
0207   TopTools_DataMapOfShapeShape myEdgeFace;
0208   GeomAbs_Shape myContinuity;
0209   Approx_ParametrizationType myParamType;
0210   Standard_Integer myDegMax;
0211   Standard_Real myCritWeights[3];
0212   Standard_Boolean myUseSmoothing;
0213   Standard_Boolean myMutableInput;
0214   NCollection_Handle<BRepFill_Generator> myBFGenerator;
0215   BRepFill_ThruSectionErrorStatus myStatus;
0216 
0217 };
0218 
0219 
0220 
0221 
0222 
0223 
0224 
0225 #endif // _BRepOffsetAPI_ThruSections_HeaderFile