Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-09-14 09:14:58

0001 // Created on: 2016-04-07
0002 // Copyright (c) 2016 OPEN CASCADE SAS
0003 // Created by: Oleg AGASHIN
0004 //
0005 // This file is part of Open CASCADE Technology software library.
0006 //
0007 // This library is free software; you can redistribute it and/or modify it under
0008 // the terms of the GNU Lesser General Public License version 2.1 as published
0009 // by the Free Software Foundation, with special exception defined in the file
0010 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
0011 // distribution for complete text of the license and disclaimer of any warranty.
0012 //
0013 // Alternatively, this file may be used under the terms of Open CASCADE
0014 // commercial license or contractual agreement.
0015 
0016 #ifndef _IMeshData_Edge_HeaderFile
0017 #define _IMeshData_Edge_HeaderFile
0018 
0019 #include <TopoDS_Edge.hxx>
0020 #include <IMeshData_Curve.hxx>
0021 #include <IMeshData_PCurve.hxx>
0022 #include <IMeshData_Types.hxx>
0023 #include <BRep_Tool.hxx>
0024 
0025 //! Interface class representing discrete model of an edge.
0026 class IMeshData_Edge : public IMeshData_TessellatedShape, public IMeshData_StatusOwner
0027 {
0028 public:
0029   //! Destructor.
0030   ~IMeshData_Edge() override = default;
0031 
0032   //! Returns TopoDS_Edge attached to model.
0033   const TopoDS_Edge& GetEdge() const { return TopoDS::Edge(GetShape()); }
0034 
0035   //! Returns number of pcurves assigned to current edge.
0036   Standard_EXPORT virtual int PCurvesNb() const = 0;
0037 
0038   //! Adds discrete pcurve for the specified discrete face.
0039   Standard_EXPORT virtual const IMeshData::IPCurveHandle& AddPCurve(
0040     const IMeshData::IFacePtr& theDFace,
0041     const TopAbs_Orientation   theOrientation) = 0;
0042 
0043   //! Returns pcurve for the specified discrete face.
0044   Standard_EXPORT virtual const IMeshData::IPCurveHandle& GetPCurve(
0045     const IMeshData::IFacePtr& theDFace,
0046     const TopAbs_Orientation   theOrientation) const = 0;
0047 
0048   //! Returns pcurve with the given index.
0049   Standard_EXPORT virtual const IMeshData::IPCurveHandle& GetPCurve(const int theIndex) const = 0;
0050 
0051   //! Returns an array of pcurves indices for the specified discrete face.
0052   Standard_EXPORT virtual const IMeshData::ListOfInteger& GetPCurves(
0053     const IMeshData::IFacePtr& theDFace) const = 0;
0054 
0055   //! Clears curve and all pcurves assigned to the edge from discretization.
0056   void Clear(const bool isKeepEndPoints)
0057   {
0058     myCurve->Clear(isKeepEndPoints);
0059     for (int aPCurveIt = 0; aPCurveIt < PCurvesNb(); ++aPCurveIt)
0060     {
0061       GetPCurve(aPCurveIt)->Clear(isKeepEndPoints);
0062     }
0063   }
0064 
0065   //! Returns true in case if the edge is free one, i.e. it does not have pcurves.
0066   bool IsFree() const { return (PCurvesNb() == 0); }
0067 
0068   //! Sets 3d curve associated with current edge.
0069   void SetCurve(const IMeshData::ICurveHandle& theCurve) { myCurve = theCurve; }
0070 
0071   //! Returns 3d curve associated with current edge.
0072   const IMeshData::ICurveHandle& GetCurve() const { return myCurve; }
0073 
0074   //! Gets value of angular deflection for the discrete model.
0075   double GetAngularDeflection() const { return myAngDeflection; }
0076 
0077   //! Sets value of angular deflection for the discrete model.
0078   void SetAngularDeflection(const double theValue) { myAngDeflection = theValue; }
0079 
0080   //! Returns same param flag.
0081   //! By default equals to flag stored in topological shape.
0082   bool GetSameParam() const { return mySameParam; }
0083 
0084   //! Updates same param flag.
0085   void SetSameParam(const bool theValue) { mySameParam = theValue; }
0086 
0087   //! Returns same range flag.
0088   //! By default equals to flag stored in topological shape.
0089   bool GetSameRange() const { return mySameRange; }
0090 
0091   //! Updates same range flag.
0092   void SetSameRange(const bool theValue) { mySameRange = theValue; }
0093 
0094   //! Returns degenerative flag.
0095   //! By default equals to flag stored in topological shape.
0096   bool GetDegenerated() const { return myDegenerated; }
0097 
0098   //! Updates degenerative flag.
0099   void SetDegenerated(const bool theValue) { myDegenerated = theValue; }
0100 
0101   DEFINE_STANDARD_RTTIEXT(IMeshData_Edge, IMeshData_TessellatedShape)
0102 
0103 protected:
0104   //! Constructor.
0105   //! Initializes empty model.
0106   IMeshData_Edge(const TopoDS_Edge& theEdge)
0107       : IMeshData_TessellatedShape(theEdge),
0108         mySameParam(BRep_Tool::SameParameter(theEdge)),
0109         mySameRange(BRep_Tool::SameRange(theEdge)),
0110         myDegenerated(BRep_Tool::Degenerated(theEdge)),
0111         myAngDeflection(RealLast())
0112   {
0113   }
0114 
0115 private:
0116   bool                    mySameParam;
0117   bool                    mySameRange;
0118   bool                    myDegenerated;
0119   double                  myAngDeflection;
0120   IMeshData::ICurveHandle myCurve;
0121 };
0122 
0123 #endif