Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:04:05

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 
0026 //! Interface class representing discrete model of an edge.
0027 class IMeshData_Edge : public IMeshData_TessellatedShape, public IMeshData_StatusOwner
0028 {
0029 public:
0030 
0031   //! Destructor.
0032   virtual ~IMeshData_Edge()
0033   {
0034   }
0035 
0036   //! Returns TopoDS_Edge attached to model.
0037   const TopoDS_Edge& GetEdge () const
0038   {
0039     return TopoDS::Edge (GetShape ());
0040   }
0041 
0042   //! Returns number of pcurves assigned to current edge.
0043   Standard_EXPORT virtual Standard_Integer PCurvesNb () const = 0;
0044 
0045   //! Adds discrete pcurve for the specified discrete face.
0046   Standard_EXPORT virtual const IMeshData::IPCurveHandle& AddPCurve (
0047     const IMeshData::IFacePtr& theDFace,
0048     const TopAbs_Orientation   theOrientation) = 0;
0049 
0050   //! Returns pcurve for the specified discrete face.
0051   Standard_EXPORT virtual const IMeshData::IPCurveHandle& GetPCurve (
0052     const IMeshData::IFacePtr& theDFace,
0053     const TopAbs_Orientation   theOrientation) const = 0;
0054 
0055   //! Returns pcurve with the given index.
0056   Standard_EXPORT virtual const IMeshData::IPCurveHandle& GetPCurve (
0057     const Standard_Integer theIndex) const = 0;
0058 
0059   //! Clears curve and all pcurves assigned to the edge from discretization.
0060   void Clear(const Standard_Boolean isKeepEndPoints)
0061   {
0062     myCurve->Clear(isKeepEndPoints);
0063     for (Standard_Integer aPCurveIt = 0; aPCurveIt < PCurvesNb(); ++aPCurveIt)
0064     {
0065       GetPCurve(aPCurveIt)->Clear(isKeepEndPoints);
0066     }
0067   }
0068 
0069   //! Returns true in case if the edge is free one, i.e. it does not have pcurves.
0070   Standard_Boolean IsFree () const
0071   {
0072     return (PCurvesNb () == 0);
0073   }
0074 
0075   //! Sets 3d curve associated with current edge.
0076   void SetCurve (const IMeshData::ICurveHandle& theCurve)
0077   {
0078     myCurve = theCurve;
0079   }
0080 
0081   //! Returns 3d curve associated with current edge.
0082   const IMeshData::ICurveHandle& GetCurve () const
0083   {
0084     return myCurve;
0085   }
0086 
0087   //! Gets value of angular deflection for the discrete model.
0088   Standard_Real GetAngularDeflection () const
0089   {
0090     return myAngDeflection;
0091   }
0092 
0093   //! Sets value of angular deflection for the discrete model.
0094   void SetAngularDeflection (const Standard_Real theValue)
0095   {
0096     myAngDeflection = theValue;
0097   }
0098 
0099   //! Returns same param flag.
0100   //! By default equals to flag stored in topological shape.
0101   Standard_Boolean GetSameParam () const
0102   {
0103     return mySameParam;
0104   }
0105 
0106   //! Updates same param flag.
0107   void SetSameParam (const Standard_Boolean theValue)
0108   {
0109     mySameParam = theValue;
0110   }
0111 
0112   //! Returns same range flag.
0113   //! By default equals to flag stored in topological shape.
0114   Standard_Boolean GetSameRange () const
0115   {
0116     return mySameRange;
0117   }
0118 
0119   //! Updates same range flag.
0120   void SetSameRange (const Standard_Boolean theValue)
0121   {
0122     mySameRange = theValue;
0123   }
0124 
0125   //! Returns degenerative flag.
0126   //! By default equals to flag stored in topological shape.
0127   Standard_Boolean GetDegenerated () const
0128   {
0129     return myDegenerated;
0130   }
0131 
0132   //! Updates degenerative flag.
0133   void SetDegenerated (const Standard_Boolean theValue)
0134   {
0135     myDegenerated = theValue;
0136   }
0137 
0138   DEFINE_STANDARD_RTTIEXT(IMeshData_Edge, IMeshData_TessellatedShape)
0139 
0140 protected:
0141 
0142   //! Constructor.
0143   //! Initializes empty model.
0144   IMeshData_Edge (const TopoDS_Edge& theEdge)
0145     : IMeshData_TessellatedShape(theEdge),
0146       mySameParam  (BRep_Tool::SameParameter(theEdge)),
0147       mySameRange  (BRep_Tool::SameRange    (theEdge)),
0148       myDegenerated(BRep_Tool::Degenerated  (theEdge)),
0149       myAngDeflection(RealLast())
0150   {
0151   }
0152 
0153 private:
0154 
0155   Standard_Boolean        mySameParam;
0156   Standard_Boolean        mySameRange;
0157   Standard_Boolean        myDegenerated;
0158   Standard_Real           myAngDeflection;
0159   IMeshData::ICurveHandle myCurve;
0160 };
0161 
0162 #endif