1 // Created on: 2016-04-07
2 // Copyright (c) 2016 OPEN CASCADE SAS
3 // Created by: Oleg AGASHIN
5 // This file is part of Open CASCADE Technology software library.
7 // This library is free software; you can redistribute it and/or modify it under
8 // the terms of the GNU Lesser General Public License version 2.1 as published
9 // by the Free Software Foundation, with special exception defined in the file
10 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
11 // distribution for complete text of the license and disclaimer of any warranty.
13 // Alternatively, this file may be used under the terms of Open CASCADE
14 // commercial license or contractual agreement.
16 #ifndef _IMeshData_Edge_HeaderFile
17 #define _IMeshData_Edge_HeaderFile
19 #include <TopoDS_Edge.hxx>
20 #include <IMeshData_Curve.hxx>
21 #include <IMeshData_PCurve.hxx>
22 #include <IMeshData_Types.hxx>
23 #include <BRep_Tool.hxx>
26 //! Interface class representing discrete model of an edge.
27 class IMeshData_Edge : public IMeshData_TessellatedShape, public IMeshData_StatusOwner
32 virtual ~IMeshData_Edge()
36 //! Returns TopoDS_Edge attached to model.
37 const TopoDS_Edge& GetEdge () const
39 return TopoDS::Edge (GetShape ());
42 //! Returns number of pcurves assigned to current edge.
43 Standard_EXPORT virtual Standard_Integer PCurvesNb () const = 0;
45 //! Adds discrete pcurve for the specified discrete face.
46 Standard_EXPORT virtual const IMeshData::IPCurveHandle& AddPCurve (
47 const IMeshData::IFacePtr& theDFace,
48 const TopAbs_Orientation theOrientation) = 0;
50 //! Returns pcurve for the specified discrete face.
51 Standard_EXPORT virtual const IMeshData::IPCurveHandle& GetPCurve (
52 const IMeshData::IFacePtr& theDFace,
53 const TopAbs_Orientation theOrientation) const = 0;
55 //! Returns pcurve with the given index.
56 Standard_EXPORT virtual const IMeshData::IPCurveHandle& GetPCurve (
57 const Standard_Integer theIndex) const = 0;
59 //! Clears curve and all pcurves assigned to the edge from discretization.
60 void Clear(const Standard_Boolean isKeepEndPoints)
62 myCurve->Clear(isKeepEndPoints);
63 for (Standard_Integer aPCurveIt = 0; aPCurveIt < PCurvesNb(); ++aPCurveIt)
65 GetPCurve(aPCurveIt)->Clear(isKeepEndPoints);
69 //! Returns true in case if the edge is free one, i.e. it does not have pcurves.
70 Standard_Boolean IsFree () const
72 return (PCurvesNb () == 0);
75 //! Sets 3d curve associated with current edge.
76 void SetCurve (const IMeshData::ICurveHandle& theCurve)
81 //! Returns 3d curve associated with current edge.
82 const IMeshData::ICurveHandle& GetCurve () const
87 //! Gets value of angular deflection for the discrete model.
88 Standard_Real GetAngularDeflection () const
90 return myAngDeflection;
93 //! Sets value of angular deflection for the discrete model.
94 void SetAngularDeflection (const Standard_Real theValue)
96 myAngDeflection = theValue;
99 //! Returns same param flag.
100 //! By default equals to flag stored in topological shape.
101 Standard_Boolean GetSameParam () const
106 //! Updates same param flag.
107 void SetSameParam (const Standard_Boolean theValue)
109 mySameParam = theValue;
112 //! Returns same range flag.
113 //! By default equals to flag stored in topological shape.
114 Standard_Boolean GetSameRange () const
119 //! Updates same range flag.
120 void SetSameRange (const Standard_Boolean theValue)
122 mySameRange = theValue;
125 //! Returns degenerative flag.
126 //! By default equals to flag stored in topological shape.
127 Standard_Boolean GetDegenerated () const
129 return myDegenerated;
132 //! Updates degenerative flag.
133 void SetDegenerated (const Standard_Boolean theValue)
135 myDegenerated = theValue;
138 DEFINE_STANDARD_RTTIEXT(IMeshData_Edge, IMeshData_TessellatedShape)
143 //! Initializes empty model.
144 IMeshData_Edge (const TopoDS_Edge& theEdge)
145 : IMeshData_TessellatedShape(theEdge),
146 mySameParam (BRep_Tool::SameParameter(theEdge)),
147 mySameRange (BRep_Tool::SameRange (theEdge)),
148 myDegenerated(BRep_Tool::Degenerated (theEdge)),
149 myAngDeflection(RealLast())
155 Standard_Boolean mySameParam;
156 Standard_Boolean mySameRange;
157 Standard_Boolean myDegenerated;
158 Standard_Real myAngDeflection;
159 IMeshData::ICurveHandle myCurve;