0026106: BRepMesh - revision of data model
[occt.git] / src / BRepMesh / BRepMesh_Edge.hxx
CommitLineData
fc9b36d6 1// Copyright (c) 2013 OPEN CASCADE SAS
2//
3// This file is part of Open CASCADE Technology software library.
4//
5// This library is free software; you can redistribute it and/or modify it under
6// the terms of the GNU Lesser General Public License version 2.1 as published
7// by the Free Software Foundation, with special exception defined in the file
8// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
9// distribution for complete text of the license and disclaimer of any warranty.
10//
11// Alternatively, this file may be used under the terms of Open CASCADE
12// commercial license or contractual agreement.
13
14#ifndef _BRepMesh_Edge_HeaderFile
15#define _BRepMesh_Edge_HeaderFile
16
17#include <Standard.hxx>
18#include <Standard_DefineAlloc.hxx>
19#include <Standard_Macro.hxx>
20#include <BRepMesh_DegreeOfFreedom.hxx>
848fa7e3 21#include <BRepMesh_OrientedEdge.hxx>
ceb418e1 22
23//! Light weighted structure representing link of the mesh.
24class BRepMesh_Edge : public BRepMesh_OrientedEdge
25{
26public:
27
28 //! Default constructor.
be5c3602 29 BRepMesh_Edge()
ceb418e1 30 : BRepMesh_OrientedEdge(),
31 myMovability(BRepMesh_Deleted)
32 {
33 }
34
35 //! Constructs a link between two vertices.
be5c3602 36 BRepMesh_Edge(
ceb418e1 37 const Standard_Integer theFirstNode,
38 const Standard_Integer theLastNode,
39 const BRepMesh_DegreeOfFreedom theMovability)
40 : BRepMesh_OrientedEdge(theFirstNode, theLastNode),
41 myMovability(theMovability)
42 {
43 }
44
fc9b36d6 45 //! Returns movability flag of the Link.
46 inline BRepMesh_DegreeOfFreedom Movability() const
47 {
48 return myMovability;
49 }
ceb418e1 50
fc9b36d6 51 //! Sets movability flag of the Link.
848fa7e3 52 //! @param theMovability flag to be set.
fc9b36d6 53 inline void SetMovability(const BRepMesh_DegreeOfFreedom theMovability)
54 {
55 myMovability = theMovability;
56 }
ceb418e1 57
fc9b36d6 58 //! Checks if the given edge and this one have the same orientation.
848fa7e3 59 //! @param theOther edge to be checked against this one.
fc9b36d6 60 //! \retrun TRUE if edges have the same orientation, FALSE if not.
61 inline Standard_Boolean IsSameOrientation(const BRepMesh_Edge& theOther) const
62 {
ceb418e1 63 return BRepMesh_OrientedEdge::IsEqual(theOther);
fc9b36d6 64 }
ceb418e1 65
fc9b36d6 66 //! Checks for equality with another edge.
848fa7e3 67 //! @param theOther edge to be checked against this one.
68 //! @return TRUE if equal, FALSE if not.
fc9b36d6 69 inline Standard_Boolean IsEqual(const BRepMesh_Edge& theOther) const
70 {
ceb418e1 71 if (myMovability == BRepMesh_Deleted || theOther.myMovability == BRepMesh_Deleted)
fc9b36d6 72 return Standard_False;
fc9b36d6 73
ceb418e1 74 return IsSameOrientation(theOther) ||
75 (FirstNode() == theOther.LastNode() && LastNode() == theOther.FirstNode());
fc9b36d6 76 }
77
78 //! Alias for IsEqual.
7bd071ed 79 inline Standard_Boolean operator ==(const BRepMesh_Edge& Other) const
fc9b36d6 80 {
81 return IsEqual(Other);
82 }
83
84private:
85
fc9b36d6 86 BRepMesh_DegreeOfFreedom myMovability;
87};
88
89inline Standard_Integer HashCode(const BRepMesh_Edge& theEdge,
90 const Standard_Integer theUpper)
91{
92 return theEdge.HashCode(theUpper);
93}
94
95#endif