1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

Coding - Apply .clang-format formatting #286

Update empty method guards to new style with regex (see PR).
Used clang-format 18.1.8.
New actions to validate code formatting is added.
Update .clang-format with disabling of include sorting.
  It is temporary changes, then include will be sorted.
Apply formatting for /src and /tools folder.
The files with .hxx,.cxx,.lxx,.h,.pxx,.hpp,*.cpp extensions.
This commit is contained in:
dpasukhi
2025-01-25 20:15:22 +00:00
parent dbba6f1289
commit a5a7b3185b
14005 changed files with 1273539 additions and 1195567 deletions

View File

@@ -14,257 +14,217 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MAT_Arc.hxx>
#include <MAT_Node.hxx>
#include <Standard_DomainError.hxx>
#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(MAT_Arc,Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(MAT_Arc, Standard_Transient)
//========================================================================
// function:
// purpose :
//========================================================================
MAT_Arc::MAT_Arc (const Standard_Integer ArcIndex,
const Standard_Integer GeomIndex,
const Handle(MAT_BasicElt)& FirstElement,
const Handle(MAT_BasicElt)& SecondElement)
: arcIndex(ArcIndex),
geomIndex(GeomIndex),
firstArcLeft (0),
firstArcRight (0),
secondArcRight (0),
secondArcLeft (0)
//=================================================================================================
MAT_Arc::MAT_Arc(const Standard_Integer ArcIndex,
const Standard_Integer GeomIndex,
const Handle(MAT_BasicElt)& FirstElement,
const Handle(MAT_BasicElt)& SecondElement)
: arcIndex(ArcIndex),
geomIndex(GeomIndex),
firstArcLeft(0),
firstArcRight(0),
secondArcRight(0),
secondArcLeft(0)
{
firstElement = FirstElement;
secondElement = SecondElement;
}
//========================================================================
// function: Index
// purpose :
//========================================================================
Standard_Integer MAT_Arc::Index() const
//=================================================================================================
Standard_Integer MAT_Arc::Index() const
{
return arcIndex;
}
//========================================================================
// function: GeomIndex
// purpose :
//========================================================================
Standard_Integer MAT_Arc::GeomIndex() const
//=================================================================================================
Standard_Integer MAT_Arc::GeomIndex() const
{
return geomIndex;
}
//========================================================================
// function: FirstElement
// purpose :
//========================================================================
Handle(MAT_BasicElt) MAT_Arc::FirstElement() const
//=================================================================================================
Handle(MAT_BasicElt) MAT_Arc::FirstElement() const
{
return firstElement;
}
//========================================================================
// function: SecondElement
// purpose :
//========================================================================
Handle(MAT_BasicElt) MAT_Arc::SecondElement() const
//=================================================================================================
Handle(MAT_BasicElt) MAT_Arc::SecondElement() const
{
return secondElement;
}
//========================================================================
// function: FirstNode
// purpose :
//========================================================================
Handle(MAT_Node) MAT_Arc::FirstNode() const
//=================================================================================================
Handle(MAT_Node) MAT_Arc::FirstNode() const
{
return firstNode;
return firstNode;
}
//========================================================================
// function: SecondNode
// purpose :
//========================================================================
Handle(MAT_Node) MAT_Arc::SecondNode() const
//=================================================================================================
Handle(MAT_Node) MAT_Arc::SecondNode() const
{
return secondNode;
}
//========================================================================
// function: TheOtherNode
// purpose :
//========================================================================
Handle(MAT_Node) MAT_Arc::TheOtherNode(const Handle(MAT_Node)& aNode)const
//=================================================================================================
Handle(MAT_Node) MAT_Arc::TheOtherNode(const Handle(MAT_Node)& aNode) const
{
if (FirstNode() == aNode)
return SecondNode();
else if (SecondNode() == aNode)
return FirstNode();
else {
else
{
throw Standard_DomainError("MAT_Arc::TheOtherNode");
}
}
//========================================================================
// function: HasNeighbour
// purpose :
//========================================================================
Standard_Boolean MAT_Arc::HasNeighbour(const Handle(MAT_Node)& aNode,
const MAT_Side aSide ) const
//=================================================================================================
Standard_Boolean MAT_Arc::HasNeighbour(const Handle(MAT_Node)& aNode, const MAT_Side aSide) const
{
if (aSide == MAT_Left) {
// if (aNode == FirstNode()) return (!firstArcLeft == NULL);
if (aNode == FirstNode()) return (firstArcLeft != 0);
// if (aNode == SecondNode()) return (!secondArcLeft == NULL);
if (aNode == SecondNode()) return (secondArcLeft != 0);
if (aSide == MAT_Left)
{
// if (aNode == FirstNode()) return (!firstArcLeft == NULL);
if (aNode == FirstNode())
return (firstArcLeft != 0);
// if (aNode == SecondNode()) return (!secondArcLeft == NULL);
if (aNode == SecondNode())
return (secondArcLeft != 0);
}
else {
// if (aNode == FirstNode()) return (!firstArcRight == NULL);
if (aNode == FirstNode()) return (firstArcRight != 0);
// if (aNode == SecondNode()) return (!secondArcRight == NULL);
if (aNode == SecondNode()) return (secondArcRight != 0);
else
{
// if (aNode == FirstNode()) return (!firstArcRight == NULL);
if (aNode == FirstNode())
return (firstArcRight != 0);
// if (aNode == SecondNode()) return (!secondArcRight == NULL);
if (aNode == SecondNode())
return (secondArcRight != 0);
}
throw Standard_DomainError("MAT_Arc::HasNeighbour");
}
//========================================================================
// function: Neighbour
// purpose :
//========================================================================
Handle(MAT_Arc) MAT_Arc::Neighbour(const Handle(MAT_Node)& aNode,
const MAT_Side aSide )
const
//=================================================================================================
Handle(MAT_Arc) MAT_Arc::Neighbour(const Handle(MAT_Node)& aNode, const MAT_Side aSide) const
{
if (aSide == MAT_Left) {
if (aNode == FirstNode()) return (MAT_Arc*)firstArcLeft;
if (aNode == SecondNode()) return (MAT_Arc*)secondArcLeft;
if (aSide == MAT_Left)
{
if (aNode == FirstNode())
return (MAT_Arc*)firstArcLeft;
if (aNode == SecondNode())
return (MAT_Arc*)secondArcLeft;
}
else {
if (aNode == FirstNode()) return (MAT_Arc*)firstArcRight;
if (aNode == SecondNode()) return (MAT_Arc*)secondArcRight;
else
{
if (aNode == FirstNode())
return (MAT_Arc*)firstArcRight;
if (aNode == SecondNode())
return (MAT_Arc*)secondArcRight;
}
throw Standard_DomainError("MAT_Arc::Neighbour");
}
//========================================================================
// function: SetIndex
// purpose :
//========================================================================
void MAT_Arc::SetIndex(const Standard_Integer anInteger)
//=================================================================================================
void MAT_Arc::SetIndex(const Standard_Integer anInteger)
{
arcIndex = anInteger;
}
//========================================================================
// function: SetGeomIndex
// purpose :
//========================================================================
void MAT_Arc::SetGeomIndex(const Standard_Integer anInteger)
//=================================================================================================
void MAT_Arc::SetGeomIndex(const Standard_Integer anInteger)
{
geomIndex = anInteger;
}
//========================================================================
// function: SetFirstElement
// purpose :
//========================================================================
void MAT_Arc::SetFirstElement(const Handle(MAT_BasicElt)& aBasicElt)
//=================================================================================================
void MAT_Arc::SetFirstElement(const Handle(MAT_BasicElt)& aBasicElt)
{
firstElement = aBasicElt;
}
//========================================================================
// function: SetSecondElement
// purpose :
//========================================================================
void MAT_Arc::SetSecondElement(const Handle(MAT_BasicElt)& aBasicElt)
//=================================================================================================
void MAT_Arc::SetSecondElement(const Handle(MAT_BasicElt)& aBasicElt)
{
secondElement = aBasicElt;
}
//========================================================================
// function: SetFirstNode
// purpose :
//========================================================================
void MAT_Arc::SetFirstNode(const Handle(MAT_Node)& aNode)
//=================================================================================================
void MAT_Arc::SetFirstNode(const Handle(MAT_Node)& aNode)
{
firstNode = aNode;
}
//========================================================================
// function: SetSecondNode
// purpose :
//========================================================================
void MAT_Arc::SetSecondNode(const Handle(MAT_Node)& aNode)
//=================================================================================================
void MAT_Arc::SetSecondNode(const Handle(MAT_Node)& aNode)
{
secondNode = aNode;
}
//========================================================================
// function: SetFirstArc
// purpose :
//========================================================================
void MAT_Arc::SetFirstArc(const MAT_Side aSide ,
const Handle(MAT_Arc)& anArc)
//=================================================================================================
void MAT_Arc::SetFirstArc(const MAT_Side aSide, const Handle(MAT_Arc)& anArc)
{
if (aSide == MAT_Left)
firstArcLeft = anArc.get();
if (aSide == MAT_Left)
firstArcLeft = anArc.get();
else
firstArcRight = anArc.get();
}
//========================================================================
// function: SetSecondArc
// purpose :
//========================================================================
void MAT_Arc::SetSecondArc(const MAT_Side aSide ,
const Handle(MAT_Arc)& anArc)
{
if (aSide == MAT_Left)
//=================================================================================================
void MAT_Arc::SetSecondArc(const MAT_Side aSide, const Handle(MAT_Arc)& anArc)
{
if (aSide == MAT_Left)
secondArcLeft = anArc.get();
else
secondArcRight = anArc.get();
}
//========================================================================
// function: SetNeighbour
// purpose :
//========================================================================
void MAT_Arc::SetNeighbour(const MAT_Side aSide,
const Handle(MAT_Node)& aNode,
const Handle(MAT_Arc)& anArc)
//=================================================================================================
void MAT_Arc::SetNeighbour(const MAT_Side aSide,
const Handle(MAT_Node)& aNode,
const Handle(MAT_Arc)& anArc)
{
if (aSide == MAT_Left) {
if (aNode == FirstNode())
firstArcLeft = anArc.get();
if (aSide == MAT_Left)
{
if (aNode == FirstNode())
firstArcLeft = anArc.get();
else if (aNode == SecondNode())
secondArcLeft = anArc.get();
else
throw Standard_DomainError("MAT_Arc::SetNeighbour");
throw Standard_DomainError("MAT_Arc::SetNeighbour");
}
else {
if (aNode == FirstNode())
firstArcRight = anArc.get();
else
{
if (aNode == FirstNode())
firstArcRight = anArc.get();
else if (aNode == SecondNode())
secondArcRight = anArc.get();
else
throw Standard_DomainError("MAT_Arc::SetNeighbour");
}
}

View File

@@ -26,7 +26,6 @@
class MAT_BasicElt;
class MAT_Node;
class MAT_Arc;
DEFINE_STANDARD_HANDLE(MAT_Arc, Standard_Transient)
@@ -35,94 +34,82 @@ class MAT_Arc : public Standard_Transient
{
public:
Standard_EXPORT MAT_Arc(const Standard_Integer ArcIndex,
const Standard_Integer GeomIndex,
const Handle(MAT_BasicElt)& FirstElement,
const Handle(MAT_BasicElt)& SecondElement);
Standard_EXPORT MAT_Arc(const Standard_Integer ArcIndex, const Standard_Integer GeomIndex, const Handle(MAT_BasicElt)& FirstElement, const Handle(MAT_BasicElt)& SecondElement);
//! Returns the index of <me> in Graph.theArcs.
Standard_EXPORT Standard_Integer Index() const;
//! Returns the index associated of the geometric
//! representation of <me>.
Standard_EXPORT Standard_Integer GeomIndex() const;
//! Returns one of the BasicElt equidistant from <me>.
Standard_EXPORT Handle(MAT_BasicElt) FirstElement() const;
//! Returns the other BasicElt equidistant from <me>.
Standard_EXPORT Handle(MAT_BasicElt) SecondElement() const;
//! Returns one Node extremity of <me>.
Standard_EXPORT Handle(MAT_Node) FirstNode() const;
//! Returns the other Node extremity of <me>.
Standard_EXPORT Handle(MAT_Node) SecondNode() const;
//! an Arc has two Node, if <aNode> egal one
//! Returns the other.
//!
//! if <aNode> is not oh <me>
Standard_EXPORT Handle(MAT_Node) TheOtherNode (const Handle(MAT_Node)& aNode) const;
Standard_EXPORT Handle(MAT_Node) TheOtherNode(const Handle(MAT_Node)& aNode) const;
//! Returnst True is there is an arc linked to
//! the Node <aNode> located on the side <aSide> of <me>;
//! if <aNode> is not on <me>
Standard_EXPORT Standard_Boolean HasNeighbour (const Handle(MAT_Node)& aNode, const MAT_Side aSide) const;
Standard_EXPORT Standard_Boolean HasNeighbour(const Handle(MAT_Node)& aNode,
const MAT_Side aSide) const;
//! Returns the first arc linked to the Node <aNode>
//! located on the side <aSide> of <me>;
//! if HasNeighbour() returns FALSE.
Standard_EXPORT Handle(MAT_Arc) Neighbour (const Handle(MAT_Node)& aNode, const MAT_Side aSide) const;
Standard_EXPORT void SetIndex (const Standard_Integer anInteger);
Standard_EXPORT void SetGeomIndex (const Standard_Integer anInteger);
Standard_EXPORT void SetFirstElement (const Handle(MAT_BasicElt)& aBasicElt);
Standard_EXPORT void SetSecondElement (const Handle(MAT_BasicElt)& aBasicElt);
Standard_EXPORT void SetFirstNode (const Handle(MAT_Node)& aNode);
Standard_EXPORT void SetSecondNode (const Handle(MAT_Node)& aNode);
Standard_EXPORT void SetFirstArc (const MAT_Side aSide, const Handle(MAT_Arc)& anArc);
Standard_EXPORT void SetSecondArc (const MAT_Side aSide, const Handle(MAT_Arc)& anArc);
Standard_EXPORT void SetNeighbour (const MAT_Side aSide, const Handle(MAT_Node)& aNode, const Handle(MAT_Arc)& anArc);
Standard_EXPORT Handle(MAT_Arc) Neighbour(const Handle(MAT_Node)& aNode,
const MAT_Side aSide) const;
Standard_EXPORT void SetIndex(const Standard_Integer anInteger);
Standard_EXPORT void SetGeomIndex(const Standard_Integer anInteger);
Standard_EXPORT void SetFirstElement(const Handle(MAT_BasicElt)& aBasicElt);
DEFINE_STANDARD_RTTIEXT(MAT_Arc,Standard_Transient)
Standard_EXPORT void SetSecondElement(const Handle(MAT_BasicElt)& aBasicElt);
Standard_EXPORT void SetFirstNode(const Handle(MAT_Node)& aNode);
Standard_EXPORT void SetSecondNode(const Handle(MAT_Node)& aNode);
Standard_EXPORT void SetFirstArc(const MAT_Side aSide, const Handle(MAT_Arc)& anArc);
Standard_EXPORT void SetSecondArc(const MAT_Side aSide, const Handle(MAT_Arc)& anArc);
Standard_EXPORT void SetNeighbour(const MAT_Side aSide,
const Handle(MAT_Node)& aNode,
const Handle(MAT_Arc)& anArc);
DEFINE_STANDARD_RTTIEXT(MAT_Arc, Standard_Transient)
protected:
private:
Standard_Integer arcIndex;
Standard_Integer geomIndex;
Standard_Integer arcIndex;
Standard_Integer geomIndex;
Handle(MAT_BasicElt) firstElement;
Handle(MAT_BasicElt) secondElement;
Handle(MAT_Node) firstNode;
Handle(MAT_Node) secondNode;
Standard_Address firstArcLeft;
Standard_Address firstArcRight;
Standard_Address secondArcRight;
Standard_Address secondArcLeft;
Handle(MAT_Node) firstNode;
Handle(MAT_Node) secondNode;
Standard_Address firstArcLeft;
Standard_Address firstArcRight;
Standard_Address secondArcRight;
Standard_Address secondArcLeft;
};
#endif // _MAT_Arc_HeaderFile

View File

@@ -14,102 +14,76 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MAT_Arc.hxx>
#include <MAT_BasicElt.hxx>
#include <MAT_Node.hxx>
#include <MAT_SequenceOfArc.hxx>
#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(MAT_BasicElt,Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(MAT_BasicElt, Standard_Transient)
//=================================================================================================
//========================================================================
// function:
// purpose :
//========================================================================
MAT_BasicElt::MAT_BasicElt(const Standard_Integer anInteger)
: startLeftArc (0),
endLeftArc (0),
: startLeftArc(0),
endLeftArc(0),
index(anInteger),
geomIndex(0)
{
}
//========================================================================
// function: StartArc
// purpose :
//========================================================================
Handle(MAT_Arc) MAT_BasicElt::StartArc() const
//=================================================================================================
Handle(MAT_Arc) MAT_BasicElt::StartArc() const
{
return (MAT_Arc*)startLeftArc;
}
//========================================================================
// function: EndArc
// purpose :
//========================================================================
Handle(MAT_Arc) MAT_BasicElt::EndArc() const
//=================================================================================================
Handle(MAT_Arc) MAT_BasicElt::EndArc() const
{
return (MAT_Arc*)endLeftArc;
}
//========================================================================
// function: Index
// purpose :
//========================================================================
Standard_Integer MAT_BasicElt::Index() const
//=================================================================================================
Standard_Integer MAT_BasicElt::Index() const
{
return index;
return index;
}
//========================================================================
// function: GeomIndex
// purpose :
//========================================================================
Standard_Integer MAT_BasicElt::GeomIndex() const
//=================================================================================================
Standard_Integer MAT_BasicElt::GeomIndex() const
{
return geomIndex;
return geomIndex;
}
//=================================================================================================
//========================================================================
// function: SetStartArc
// purpose :
//========================================================================
void MAT_BasicElt::SetStartArc(const Handle(MAT_Arc)& anArc)
void MAT_BasicElt::SetStartArc(const Handle(MAT_Arc)& anArc)
{
startLeftArc = anArc.get();
}
//=================================================================================================
//========================================================================
// function: SetEndArc
// purpose :
//========================================================================
void MAT_BasicElt::SetEndArc(const Handle(MAT_Arc)& anArc)
void MAT_BasicElt::SetEndArc(const Handle(MAT_Arc)& anArc)
{
endLeftArc = anArc.get();
}
//========================================================================
// function: SetIndex
// purpose :
//========================================================================
//=================================================================================================
void MAT_BasicElt::SetIndex(const Standard_Integer anInteger)
{
index = anInteger;
}
//========================================================================
// function: SetGeomIndex
// purpose :
//========================================================================
//=================================================================================================
void MAT_BasicElt::SetGeomIndex(const Standard_Integer anInteger)
{
geomIndex = anInteger;
}

View File

@@ -24,7 +24,6 @@
#include <Standard_Transient.hxx>
class MAT_Arc;
class MAT_BasicElt;
DEFINE_STANDARD_HANDLE(MAT_BasicElt, Standard_Transient)
@@ -34,58 +33,39 @@ class MAT_BasicElt : public Standard_Transient
{
public:
//! Constructor, <anInteger> is the <index> of <me>.
Standard_EXPORT MAT_BasicElt(const Standard_Integer anInteger);
//! Return <startArcLeft> or <startArcRight> corresponding
//! to <aSide>.
Standard_EXPORT Handle(MAT_Arc) StartArc() const;
//! Return <endArcLeft> or <endArcRight> corresponding
//! to <aSide>.
Standard_EXPORT Handle(MAT_Arc) EndArc() const;
//! Return the <index> of <me> in Graph.TheBasicElts.
Standard_EXPORT Standard_Integer Index() const;
//! Return the <GeomIndex> of <me>.
Standard_EXPORT Standard_Integer GeomIndex() const;
Standard_EXPORT void SetStartArc (const Handle(MAT_Arc)& anArc);
Standard_EXPORT void SetEndArc (const Handle(MAT_Arc)& anArc);
Standard_EXPORT void SetIndex (const Standard_Integer anInteger);
Standard_EXPORT void SetGeomIndex (const Standard_Integer anInteger);
Standard_EXPORT void SetStartArc(const Handle(MAT_Arc)& anArc);
Standard_EXPORT void SetEndArc(const Handle(MAT_Arc)& anArc);
Standard_EXPORT void SetIndex(const Standard_Integer anInteger);
DEFINE_STANDARD_RTTIEXT(MAT_BasicElt,Standard_Transient)
Standard_EXPORT void SetGeomIndex(const Standard_Integer anInteger);
DEFINE_STANDARD_RTTIEXT(MAT_BasicElt, Standard_Transient)
protected:
private:
Standard_Address startLeftArc;
Standard_Address endLeftArc;
Standard_Integer index;
Standard_Integer geomIndex;
};
#endif // _MAT_BasicElt_HeaderFile

View File

@@ -14,18 +14,17 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MAT_Bisector.hxx>
#include <MAT_Edge.hxx>
#include <MAT_ListOfBisector.hxx>
#include <Precision.hxx>
#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(MAT_Bisector,Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(MAT_Bisector, Standard_Transient)
MAT_Bisector::MAT_Bisector()
{
thebisectornumber = -1;
thebisectornumber = -1;
thefirstparameter = Precision::Infinite();
thesecondparameter = Precision::Infinite();
thelistofbisectors = new MAT_ListOfBisector();
@@ -55,27 +54,27 @@ void MAT_Bisector::BisectorNumber(const Standard_Integer anumber)
{
thebisectornumber = anumber;
}
void MAT_Bisector::IndexNumber(const Standard_Integer anumber)
{
theindexnumber = anumber;
}
void MAT_Bisector::FirstEdge(const Handle(MAT_Edge)& anedge)
{
thefirstedge = anedge;
}
void MAT_Bisector::SecondEdge(const Handle(MAT_Edge)& anedge)
{
thesecondedge = anedge;
}
void MAT_Bisector::IssuePoint(const Standard_Integer apoint)
{
theissuepoint = apoint;
}
void MAT_Bisector::EndPoint(const Standard_Integer apoint)
{
theendpoint = apoint;
@@ -85,57 +84,57 @@ void MAT_Bisector::DistIssuePoint(const Standard_Real areal)
{
distissuepoint = areal;
}
void MAT_Bisector::FirstVector(const Standard_Integer avector)
{
thefirstvector = avector;
}
void MAT_Bisector::SecondVector(const Standard_Integer avector)
{
thesecondvector = avector;
}
void MAT_Bisector::Sense(const Standard_Real asense)
{
thesense = asense;
}
void MAT_Bisector::FirstParameter(const Standard_Real aparameter)
{
thefirstparameter = aparameter;
}
void MAT_Bisector::SecondParameter(const Standard_Real aparameter)
{
thesecondparameter = aparameter;
}
Standard_Integer MAT_Bisector::BisectorNumber() const
{
return thebisectornumber;
}
Standard_Integer MAT_Bisector::IndexNumber() const
{
return theindexnumber;
}
Handle(MAT_Edge) MAT_Bisector::FirstEdge() const
{
return thefirstedge;
}
Handle(MAT_Edge) MAT_Bisector::SecondEdge() const
{
return thesecondedge;
}
Standard_Integer MAT_Bisector::IssuePoint() const
{
return theissuepoint;
}
Standard_Integer MAT_Bisector::EndPoint() const
{
return theendpoint;
@@ -144,12 +143,13 @@ Standard_Integer MAT_Bisector::EndPoint() const
Standard_Real MAT_Bisector::DistIssuePoint() const
{
return distissuepoint;
}
}
Standard_Integer MAT_Bisector::FirstVector() const
{
return thefirstvector;
}
Standard_Integer MAT_Bisector::SecondVector() const
{
return thesecondvector;
@@ -159,36 +159,39 @@ Standard_Real MAT_Bisector::Sense() const
{
return thesense;
}
Standard_Real MAT_Bisector::FirstParameter() const
{
return thefirstparameter;
}
Standard_Real MAT_Bisector::SecondParameter() const
{
return thesecondparameter;
}
void MAT_Bisector::Dump(const Standard_Integer ashift,
const Standard_Integer alevel) const
void MAT_Bisector::Dump(const Standard_Integer ashift, const Standard_Integer alevel) const
{
Standard_Integer i;
for(i=0; i<ashift; i++)std::cout<<" ";
std::cout<<" BISECTOR : "<<thebisectornumber<<std::endl;
for(i=0; i<ashift; i++)std::cout<<" ";
std::cout<<" First edge : "<<thefirstedge->EdgeNumber()<<std::endl;
for(i=0; i<ashift; i++)std::cout<<" ";
std::cout<<" Second edge : "<<thesecondedge->EdgeNumber()<<std::endl;
for(i=0; i<ashift; i++)std::cout<<" ";
if(alevel)
for (i = 0; i < ashift; i++)
std::cout << " ";
std::cout << " BISECTOR : " << thebisectornumber << std::endl;
for (i = 0; i < ashift; i++)
std::cout << " ";
std::cout << " First edge : " << thefirstedge->EdgeNumber() << std::endl;
for (i = 0; i < ashift; i++)
std::cout << " ";
std::cout << " Second edge : " << thesecondedge->EdgeNumber() << std::endl;
for (i = 0; i < ashift; i++)
std::cout << " ";
if (alevel)
{
if (!thelistofbisectors->More())
{
if(!thelistofbisectors->More())
{
std::cout<<" Bisectors List : "<<std::endl;
thelistofbisectors->Dump(ashift+1,1);
}
std::cout << " Bisectors List : " << std::endl;
thelistofbisectors->Dump(ashift + 1, 1);
}
std::cout<<std::endl;
}
std::cout << std::endl;
}

View File

@@ -26,111 +26,90 @@
class MAT_Edge;
class MAT_ListOfBisector;
class MAT_Bisector;
DEFINE_STANDARD_HANDLE(MAT_Bisector, Standard_Transient)
class MAT_Bisector : public Standard_Transient
{
public:
Standard_EXPORT MAT_Bisector();
Standard_EXPORT void AddBisector (const Handle(MAT_Bisector)& abisector) const;
Standard_EXPORT void AddBisector(const Handle(MAT_Bisector)& abisector) const;
Standard_EXPORT Handle(MAT_ListOfBisector) List() const;
Standard_EXPORT Handle(MAT_Bisector) FirstBisector() const;
Standard_EXPORT Handle(MAT_Bisector) LastBisector() const;
Standard_EXPORT void BisectorNumber (const Standard_Integer anumber);
Standard_EXPORT void IndexNumber (const Standard_Integer anumber);
Standard_EXPORT void FirstEdge (const Handle(MAT_Edge)& anedge);
Standard_EXPORT void SecondEdge (const Handle(MAT_Edge)& anedge);
Standard_EXPORT void IssuePoint (const Standard_Integer apoint);
Standard_EXPORT void EndPoint (const Standard_Integer apoint);
Standard_EXPORT void DistIssuePoint (const Standard_Real areal);
Standard_EXPORT void FirstVector (const Standard_Integer avector);
Standard_EXPORT void SecondVector (const Standard_Integer avector);
Standard_EXPORT void Sense (const Standard_Real asense);
Standard_EXPORT void FirstParameter (const Standard_Real aparameter);
Standard_EXPORT void SecondParameter (const Standard_Real aparameter);
Standard_EXPORT void BisectorNumber(const Standard_Integer anumber);
Standard_EXPORT void IndexNumber(const Standard_Integer anumber);
Standard_EXPORT void FirstEdge(const Handle(MAT_Edge)& anedge);
Standard_EXPORT void SecondEdge(const Handle(MAT_Edge)& anedge);
Standard_EXPORT void IssuePoint(const Standard_Integer apoint);
Standard_EXPORT void EndPoint(const Standard_Integer apoint);
Standard_EXPORT void DistIssuePoint(const Standard_Real areal);
Standard_EXPORT void FirstVector(const Standard_Integer avector);
Standard_EXPORT void SecondVector(const Standard_Integer avector);
Standard_EXPORT void Sense(const Standard_Real asense);
Standard_EXPORT void FirstParameter(const Standard_Real aparameter);
Standard_EXPORT void SecondParameter(const Standard_Real aparameter);
Standard_EXPORT Standard_Integer BisectorNumber() const;
Standard_EXPORT Standard_Integer IndexNumber() const;
Standard_EXPORT Handle(MAT_Edge) FirstEdge() const;
Standard_EXPORT Handle(MAT_Edge) SecondEdge() const;
Standard_EXPORT Standard_Integer IssuePoint() const;
Standard_EXPORT Standard_Integer EndPoint() const;
Standard_EXPORT Standard_Real DistIssuePoint() const;
Standard_EXPORT Standard_Integer FirstVector() const;
Standard_EXPORT Standard_Integer SecondVector() const;
Standard_EXPORT Standard_Real Sense() const;
Standard_EXPORT Standard_Real FirstParameter() const;
Standard_EXPORT Standard_Real SecondParameter() const;
Standard_EXPORT void Dump (const Standard_Integer ashift, const Standard_Integer alevel) const;
Standard_EXPORT void Dump(const Standard_Integer ashift, const Standard_Integer alevel) const;
DEFINE_STANDARD_RTTIEXT(MAT_Bisector,Standard_Transient)
DEFINE_STANDARD_RTTIEXT(MAT_Bisector, Standard_Transient)
protected:
private:
Standard_Integer thebisectornumber;
Standard_Integer theindexnumber;
Handle(MAT_Edge) thefirstedge;
Handle(MAT_Edge) thesecondedge;
Standard_Integer thebisectornumber;
Standard_Integer theindexnumber;
Handle(MAT_Edge) thefirstedge;
Handle(MAT_Edge) thesecondedge;
Handle(MAT_ListOfBisector) thelistofbisectors;
Standard_Integer theissuepoint;
Standard_Integer theendpoint;
Standard_Integer thefirstvector;
Standard_Integer thesecondvector;
Standard_Real thesense;
Standard_Real thefirstparameter;
Standard_Real thesecondparameter;
Standard_Real distissuepoint;
Standard_Integer theissuepoint;
Standard_Integer theendpoint;
Standard_Integer thefirstvector;
Standard_Integer thesecondvector;
Standard_Real thesense;
Standard_Real thefirstparameter;
Standard_Real thesecondparameter;
Standard_Real distissuepoint;
};
#endif // _MAT_Bisector_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef MAT_DataMapIteratorOfDataMapOfIntegerArc_HeaderFile
#define MAT_DataMapIteratorOfDataMapOfIntegerArc_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef MAT_DataMapIteratorOfDataMapOfIntegerBasicElt_HeaderFile
#define MAT_DataMapIteratorOfDataMapOfIntegerBasicElt_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef MAT_DataMapIteratorOfDataMapOfIntegerBisector_HeaderFile
#define MAT_DataMapIteratorOfDataMapOfIntegerBisector_HeaderFile

View File

@@ -11,7 +11,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#ifndef MAT_DataMapIteratorOfDataMapOfIntegerNode_HeaderFile
#define MAT_DataMapIteratorOfDataMapOfIntegerNode_HeaderFile

View File

@@ -21,8 +21,8 @@
#include <MAT_Arc.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<Standard_Integer,Handle(MAT_Arc)> MAT_DataMapOfIntegerArc;
typedef NCollection_DataMap<Standard_Integer,Handle(MAT_Arc)>::Iterator MAT_DataMapIteratorOfDataMapOfIntegerArc;
typedef NCollection_DataMap<Standard_Integer, Handle(MAT_Arc)> MAT_DataMapOfIntegerArc;
typedef NCollection_DataMap<Standard_Integer, Handle(MAT_Arc)>::Iterator
MAT_DataMapIteratorOfDataMapOfIntegerArc;
#endif

View File

@@ -21,8 +21,8 @@
#include <MAT_BasicElt.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<Standard_Integer,Handle(MAT_BasicElt)> MAT_DataMapOfIntegerBasicElt;
typedef NCollection_DataMap<Standard_Integer,Handle(MAT_BasicElt)>::Iterator MAT_DataMapIteratorOfDataMapOfIntegerBasicElt;
typedef NCollection_DataMap<Standard_Integer, Handle(MAT_BasicElt)> MAT_DataMapOfIntegerBasicElt;
typedef NCollection_DataMap<Standard_Integer, Handle(MAT_BasicElt)>::Iterator
MAT_DataMapIteratorOfDataMapOfIntegerBasicElt;
#endif

View File

@@ -21,8 +21,8 @@
#include <MAT_Bisector.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<Standard_Integer,Handle(MAT_Bisector)> MAT_DataMapOfIntegerBisector;
typedef NCollection_DataMap<Standard_Integer,Handle(MAT_Bisector)>::Iterator MAT_DataMapIteratorOfDataMapOfIntegerBisector;
typedef NCollection_DataMap<Standard_Integer, Handle(MAT_Bisector)> MAT_DataMapOfIntegerBisector;
typedef NCollection_DataMap<Standard_Integer, Handle(MAT_Bisector)>::Iterator
MAT_DataMapIteratorOfDataMapOfIntegerBisector;
#endif

View File

@@ -21,8 +21,8 @@
#include <MAT_Node.hxx>
#include <NCollection_DataMap.hxx>
typedef NCollection_DataMap<Standard_Integer,Handle(MAT_Node)> MAT_DataMapOfIntegerNode;
typedef NCollection_DataMap<Standard_Integer,Handle(MAT_Node)>::Iterator MAT_DataMapIteratorOfDataMapOfIntegerNode;
typedef NCollection_DataMap<Standard_Integer, Handle(MAT_Node)> MAT_DataMapOfIntegerNode;
typedef NCollection_DataMap<Standard_Integer, Handle(MAT_Node)>::Iterator
MAT_DataMapIteratorOfDataMapOfIntegerNode;
#endif

View File

@@ -14,20 +14,19 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MAT_Bisector.hxx>
#include <MAT_Edge.hxx>
#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(MAT_Edge,Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(MAT_Edge, Standard_Transient)
MAT_Edge::MAT_Edge()
: theedgenumber(0),
thedistance(0.0),
theintersectionpoint(0)
: theedgenumber(0),
thedistance(0.0),
theintersectionpoint(0)
{
}
void MAT_Edge::EdgeNumber(const Standard_Integer anumber)
{
theedgenumber = anumber;
@@ -78,8 +77,4 @@ Standard_Integer MAT_Edge::IntersectionPoint() const
return theintersectionpoint;
}
void MAT_Edge::Dump(const Standard_Integer,
const Standard_Integer) const
{
}
void MAT_Edge::Dump(const Standard_Integer, const Standard_Integer) const {}

View File

@@ -24,67 +24,46 @@
#include <Standard_Transient.hxx>
class MAT_Bisector;
class MAT_Edge;
DEFINE_STANDARD_HANDLE(MAT_Edge, Standard_Transient)
class MAT_Edge : public Standard_Transient
{
public:
Standard_EXPORT MAT_Edge();
Standard_EXPORT void EdgeNumber (const Standard_Integer anumber);
Standard_EXPORT void FirstBisector (const Handle(MAT_Bisector)& abisector);
Standard_EXPORT void SecondBisector (const Handle(MAT_Bisector)& abisector);
Standard_EXPORT void Distance (const Standard_Real adistance);
Standard_EXPORT void IntersectionPoint (const Standard_Integer apoint);
Standard_EXPORT void EdgeNumber(const Standard_Integer anumber);
Standard_EXPORT void FirstBisector(const Handle(MAT_Bisector)& abisector);
Standard_EXPORT void SecondBisector(const Handle(MAT_Bisector)& abisector);
Standard_EXPORT void Distance(const Standard_Real adistance);
Standard_EXPORT void IntersectionPoint(const Standard_Integer apoint);
Standard_EXPORT Standard_Integer EdgeNumber() const;
Standard_EXPORT Handle(MAT_Bisector) FirstBisector() const;
Standard_EXPORT Handle(MAT_Bisector) SecondBisector() const;
Standard_EXPORT Standard_Real Distance() const;
Standard_EXPORT Standard_Integer IntersectionPoint() const;
Standard_EXPORT void Dump (const Standard_Integer ashift, const Standard_Integer alevel) const;
Standard_EXPORT void Dump(const Standard_Integer ashift, const Standard_Integer alevel) const;
DEFINE_STANDARD_RTTIEXT(MAT_Edge,Standard_Transient)
DEFINE_STANDARD_RTTIEXT(MAT_Edge, Standard_Transient)
protected:
private:
Standard_Integer theedgenumber;
Standard_Integer theedgenumber;
Handle(MAT_Bisector) thefirstbisector;
Handle(MAT_Bisector) thesecondbisector;
Standard_Real thedistance;
Standard_Integer theintersectionpoint;
Standard_Real thedistance;
Standard_Integer theintersectionpoint;
};
#endif // _MAT_Edge_HeaderFile

View File

@@ -14,7 +14,6 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MAT_Arc.hxx>
#include <MAT_Bisector.hxx>
#include <MAT_DataMapIteratorOfDataMapOfIntegerBasicElt.hxx>
@@ -27,24 +26,24 @@
#include <Precision.hxx>
#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(MAT_Graph,Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(MAT_Graph, Standard_Transient)
//------------------
// functions static.
//-------------------
static Handle(MAT_Arc) MakeArc(const Handle(MAT_Bisector)& aBisector,
MAT_DataMapOfIntegerBasicElt& TheBasicElts,
MAT_DataMapOfIntegerArc& TheArcs,
Standard_Integer& IndTabArcs);
static Handle(MAT_Arc) MakeArc(const Handle(MAT_Bisector)& aBisector,
MAT_DataMapOfIntegerBasicElt& TheBasicElts,
MAT_DataMapOfIntegerArc& TheArcs,
Standard_Integer& IndTabArcs);
// =====================================================================
// Constructeur vide.
// =====================================================================
MAT_Graph::MAT_Graph()
: numberOfArcs(0),
numberOfNodes(0),
numberOfBasicElts(0),
numberOfInfiniteNodes(0)
: numberOfArcs(0),
numberOfNodes(0),
numberOfBasicElts(0),
numberOfInfiniteNodes(0)
{
}
@@ -52,45 +51,48 @@ MAT_Graph::MAT_Graph()
// function : Perform
// purpose : Creation du graphe contenant le resultat.
// =====================================================================
void MAT_Graph::Perform(const Standard_Boolean SemiInfinite,
const Handle(MAT_ListOfBisector)& TheRoots,
const Standard_Integer NbBasicElts,
const Standard_Integer NbArcs)
void MAT_Graph::Perform(const Standard_Boolean SemiInfinite,
const Handle(MAT_ListOfBisector)& TheRoots,
const Standard_Integer NbBasicElts,
const Standard_Integer NbArcs)
{
Standard_Integer NbRoots;
Handle(MAT_Arc) FirstArc;
Handle(MAT_Arc) CurrentArc;
Handle(MAT_Node) Extremite;
Standard_Integer IndTabArcs = 1;
Standard_Integer IndTabNodes;
Standard_Integer i;
Standard_Real DistExt;
Standard_Integer IndExt;
Handle(MAT_Arc) PreviousArc = CurrentArc;
Standard_Integer NbRoots;
Handle(MAT_Arc) FirstArc;
Handle(MAT_Arc) CurrentArc;
Handle(MAT_Node) Extremite;
Standard_Integer IndTabArcs = 1;
Standard_Integer IndTabNodes;
Standard_Integer i;
Standard_Real DistExt;
Standard_Integer IndExt;
Handle(MAT_Arc) PreviousArc = CurrentArc;
//------------------------
// Construction du graphe.
//------------------------
if (SemiInfinite) {
if (SemiInfinite)
{
NbRoots = TheRoots->Number();
numberOfInfiniteNodes = NbRoots;
}
else {
else
{
NbRoots = 1;
numberOfInfiniteNodes = 0;
}
}
numberOfArcs = NbArcs;
numberOfBasicElts = NbBasicElts;
numberOfNodes = NbRoots + NbArcs;
IndTabNodes = numberOfNodes;
numberOfArcs = NbArcs;
numberOfBasicElts = NbBasicElts;
numberOfNodes = NbRoots + NbArcs;
IndTabNodes = numberOfNodes;
//---------------------------
//... Creation des BasicElts.
//---------------------------
for (i = 1; i <= NbBasicElts; i++) {
theBasicElts.Bind(i,new MAT_BasicElt(i));
for (i = 1; i <= NbBasicElts; i++)
{
theBasicElts.Bind(i, new MAT_BasicElt(i));
theBasicElts(i)->SetGeomIndex(i);
}
@@ -99,68 +101,63 @@ void MAT_Graph::Perform(const Standard_Boolean SemiInfinite,
// Construction des arbres d arcs a partir des <Bisector> racines.
//--------------------------------------------------------------------
if (SemiInfinite) {
if (SemiInfinite)
{
// Plusieurs points d entree a l infini.
//--------------------------------------
TheRoots->First();
while (TheRoots->More()) {
CurrentArc = MakeArc(TheRoots->Current(),
theBasicElts,
theArcs,
IndTabArcs);
Extremite = new MAT_Node (0,CurrentArc,Precision::Infinite());
Extremite ->SetIndex (IndTabNodes);
while (TheRoots->More())
{
CurrentArc = MakeArc(TheRoots->Current(), theBasicElts, theArcs, IndTabArcs);
Extremite = new MAT_Node(0, CurrentArc, Precision::Infinite());
Extremite->SetIndex(IndTabNodes);
CurrentArc->SetSecondNode(Extremite);
theNodes.Bind(IndTabNodes,Extremite);
TheRoots->Next();
theNodes.Bind(IndTabNodes, Extremite);
TheRoots->Next();
IndTabNodes--;
}
}
else {
else
{
// -----------------------------------------------
// Un seul point d entree .
// Creation d un premier ARC et du NODE racine.
// -----------------------------------------------
NbRoots = 1;
TheRoots->First();
CurrentArc = MakeArc(TheRoots->Current(),
theBasicElts,
theArcs,
IndTabArcs);
DistExt = TheRoots->Current()->FirstEdge()->Distance();
IndExt = TheRoots->Current()->EndPoint();
CurrentArc = MakeArc(TheRoots->Current(), theBasicElts, theArcs, IndTabArcs);
DistExt = TheRoots->Current()->FirstEdge()->Distance();
IndExt = TheRoots->Current()->EndPoint();
Extremite = new MAT_Node(IndExt,CurrentArc,DistExt);
Extremite ->SetIndex (IndTabNodes);
Extremite = new MAT_Node(IndExt, CurrentArc, DistExt);
Extremite->SetIndex(IndTabNodes);
CurrentArc->SetSecondNode(Extremite);
theNodes.Bind(IndTabNodes,Extremite);
theNodes.Bind(IndTabNodes, Extremite);
IndTabNodes--;
// -----------------------------------------------------------
// ...Creation des ARCs issues de la racine.
// Codage des voisinages sur ces arcs et mise a jour de la
// sequence des arcs issue du Node racine.
// -----------------------------------------------------------
FirstArc = CurrentArc;
PreviousArc = FirstArc;
FirstArc = CurrentArc;
PreviousArc = FirstArc;
TheRoots->Next();
while (TheRoots->More()) {
CurrentArc = MakeArc(TheRoots->Current(),
theBasicElts,
theArcs,
IndTabArcs);
CurrentArc ->SetSecondNode(Extremite);
CurrentArc ->SetNeighbour (MAT_Left,Extremite ,PreviousArc);
PreviousArc->SetNeighbour (MAT_Right,Extremite,CurrentArc);
while (TheRoots->More())
{
CurrentArc = MakeArc(TheRoots->Current(), theBasicElts, theArcs, IndTabArcs);
CurrentArc->SetSecondNode(Extremite);
CurrentArc->SetNeighbour(MAT_Left, Extremite, PreviousArc);
PreviousArc->SetNeighbour(MAT_Right, Extremite, CurrentArc);
PreviousArc = CurrentArc;
TheRoots->Next();
}
FirstArc ->SetNeighbour (MAT_Left ,Extremite,CurrentArc);
CurrentArc->SetNeighbour (MAT_Right,Extremite,FirstArc);
FirstArc->SetNeighbour(MAT_Left, Extremite, CurrentArc);
CurrentArc->SetNeighbour(MAT_Right, Extremite, FirstArc);
}
// ----------------------------------------------------
@@ -170,102 +167,90 @@ void MAT_Graph::Perform(const Standard_Boolean SemiInfinite,
UpDateNodes(IndTabNodes);
}
//=============================================================================
//function : Arc
//Purpose :
//=============================================================================
Handle(MAT_Arc) MAT_Graph::Arc(const Standard_Integer Index) const
//=================================================================================================
Handle(MAT_Arc) MAT_Graph::Arc(const Standard_Integer Index) const
{
return theArcs(Index);
}
//=============================================================================
//function : BasicElt
//Purpose :
//=============================================================================
Handle(MAT_BasicElt) MAT_Graph::BasicElt(const Standard_Integer Index) const
//=================================================================================================
Handle(MAT_BasicElt) MAT_Graph::BasicElt(const Standard_Integer Index) const
{
return theBasicElts(Index);
}
//=============================================================================
//function : Node
//Purpose :
//=============================================================================
Handle(MAT_Node) MAT_Graph::Node(const Standard_Integer Index) const
//=================================================================================================
Handle(MAT_Node) MAT_Graph::Node(const Standard_Integer Index) const
{
return theNodes(Index);
}
//=============================================================================
//function : NumberOfArcs
//Purpose :
//=============================================================================
Standard_Integer MAT_Graph::NumberOfArcs() const
//=================================================================================================
Standard_Integer MAT_Graph::NumberOfArcs() const
{
return numberOfArcs;
}
//=============================================================================
//function : NumberOfNodes
//Purpose :
//=============================================================================
Standard_Integer MAT_Graph::NumberOfNodes() const
//=================================================================================================
Standard_Integer MAT_Graph::NumberOfNodes() const
{
return numberOfNodes;
}
//=============================================================================
//function : NumberOfInfiniteNodes
//Purpose :
//=============================================================================
Standard_Integer MAT_Graph::NumberOfInfiniteNodes() const
//=================================================================================================
Standard_Integer MAT_Graph::NumberOfInfiniteNodes() const
{
return numberOfInfiniteNodes;
}
//=============================================================================
//function : NumberOfBasicElts
//Purpose :
//=============================================================================
Standard_Integer MAT_Graph::NumberOfBasicElts() const
//=================================================================================================
Standard_Integer MAT_Graph::NumberOfBasicElts() const
{
return numberOfBasicElts;
}
//=============================================================================
//function : FusionOfBasicElts
//Purpose :
//=============================================================================
void MAT_Graph::FusionOfBasicElts(const Standard_Integer IndexElt1,
const Standard_Integer IndexElt2,
Standard_Boolean& MergeArc1,
Standard_Integer& IGeomArc1,
Standard_Integer& IGeomArc2,
Standard_Boolean& MergeArc2,
Standard_Integer& IGeomArc3,
Standard_Integer& IGeomArc4)
//=================================================================================================
void MAT_Graph::FusionOfBasicElts(const Standard_Integer IndexElt1,
const Standard_Integer IndexElt2,
Standard_Boolean& MergeArc1,
Standard_Integer& IGeomArc1,
Standard_Integer& IGeomArc2,
Standard_Boolean& MergeArc2,
Standard_Integer& IGeomArc3,
Standard_Integer& IGeomArc4)
{
Handle(MAT_BasicElt) Elt1 = theBasicElts(IndexElt1);
Handle(MAT_BasicElt) Elt2 = theBasicElts(IndexElt2);
if (Elt1 == Elt2) return;
if (Elt1 == Elt2)
return;
Standard_Integer i;
Handle(MAT_Zone) Zone2 = new MAT_Zone(Elt2);
Handle(MAT_Zone) Zone2 = new MAT_Zone(Elt2);
//--------------------------------------------------------------------
// Les arcs de la zone de Elt2 ne separent plus Elt2 et qq chose mais
// Elt1 et qq chose.
//--------------------------------------------------------------------
for (i = 1; i <= Zone2->NumberOfArcs(); i++) {
if (Zone2->ArcOnFrontier(i)->FirstElement() == Elt2) {
theArcs(Zone2->ArcOnFrontier(i)->Index())->SetFirstElement(Elt1);
}
else {
theArcs(Zone2->ArcOnFrontier(i)->Index())->SetSecondElement(Elt1);
}
}
for (i = 1; i <= Zone2->NumberOfArcs(); i++)
{
if (Zone2->ArcOnFrontier(i)->FirstElement() == Elt2)
{
theArcs(Zone2->ArcOnFrontier(i)->Index())->SetFirstElement(Elt1);
}
else
{
theArcs(Zone2->ArcOnFrontier(i)->Index())->SetSecondElement(Elt1);
}
}
//-------------------------------------------------------------------
// le EndArc de Elt1 et le StartArc de Elt2 peuvent separes les memes
@@ -278,15 +263,16 @@ void MAT_Graph::FusionOfBasicElts(const Standard_Integer IndexElt1,
Handle(MAT_BasicElt) E2 = EA1->SecondElement();
Handle(MAT_BasicElt) E3 = SA2->FirstElement();
Handle(MAT_BasicElt) E4 = SA2->SecondElement();
MergeArc1 = Standard_False;
MergeArc1 = Standard_False;
if ( (E1 == E3 || E1 == E4) && (E2 == E3 || E2 == E4)) {
FusionOfArcs(theArcs(EA1->Index()),theArcs(SA2->Index()));
if ((E1 == E3 || E1 == E4) && (E2 == E3 || E2 == E4))
{
FusionOfArcs(theArcs(EA1->Index()), theArcs(SA2->Index()));
MergeArc1 = Standard_True;
IGeomArc1 = EA1->GeomIndex();
IGeomArc2 = SA2->GeomIndex();
}
//-------------------------------------------------
// La fin de Elt1 devient la fin de Elt2.
//-------------------------------------------------
@@ -295,34 +281,34 @@ void MAT_Graph::FusionOfBasicElts(const Standard_Integer IndexElt1,
//-------------------------------------------------------------------
// le EndArc de Elt1 et le StartArc de Elt1 peuvent separer les memes
// elements de base.
// si les noeuds des arcs ne sont pas sur le contour
// si les noeuds des arcs ne sont pas sur le contour
// => fusion des arcs.(contour ferme compose d un seul BasicElt)
// sinon rien (contour ferme compose de deux BasicElts)
//-------------------------------------------------------------------
Handle(MAT_Arc) SA1 = Elt1->StartArc();
EA1 = Elt1->EndArc();
EA1 = Elt1->EndArc();
if ( EA1 != SA1 ) {
E1 = EA1->FirstElement ();
if (EA1 != SA1)
{
E1 = EA1->FirstElement();
E2 = EA1->SecondElement();
E3 = SA1->FirstElement ();
E3 = SA1->FirstElement();
E4 = SA1->SecondElement();
Standard_Boolean OnFig = (EA1->FirstNode() ->OnBasicElt() ||
EA1->SecondNode()->OnBasicElt() ||
SA1->FirstNode() ->OnBasicElt() ||
SA1->SecondNode()->OnBasicElt() );
Standard_Boolean OnFig = (EA1->FirstNode()->OnBasicElt() || EA1->SecondNode()->OnBasicElt()
|| SA1->FirstNode()->OnBasicElt() || SA1->SecondNode()->OnBasicElt());
MergeArc2 = Standard_False;
if ((E1 == E3 || E1 == E4) && (E2 == E3 || E2 == E4) && !OnFig) {
FusionOfArcs(theArcs(EA1->Index()),theArcs(SA1->Index()));
if ((E1 == E3 || E1 == E4) && (E2 == E3 || E2 == E4) && !OnFig)
{
FusionOfArcs(theArcs(EA1->Index()), theArcs(SA1->Index()));
MergeArc2 = Standard_True;
IGeomArc3 = EA1->GeomIndex();
IGeomArc4 = SA1->GeomIndex();
}
}
//----------------------------------------------------
// un element de base a ete elimine.
//----------------------------------------------------
@@ -335,35 +321,32 @@ void MAT_Graph::FusionOfBasicElts(const Standard_Integer IndexElt1,
// purpose : Fusion de deux arcs separant les memes elements.
// l <Arc1> ira du Second noeud de <Arc2> au second Noeud de <Arc1>.
//=============================================================================
void MAT_Graph::FusionOfArcs(const Handle(MAT_Arc)& Arc1,
const Handle(MAT_Arc)& Arc2)
void MAT_Graph::FusionOfArcs(const Handle(MAT_Arc)& Arc1, const Handle(MAT_Arc)& Arc2)
{
Handle(MAT_Node) OldNode1 = Arc1->FirstNode();
Handle(MAT_Node) OldNode2 = Arc2->FirstNode();
Arc1->SetFirstNode(Arc2->SecondNode());
//--------------------------------------------------------------------
// Mise a jour des voisinages autour du nouveau premier noeud de Arc1.
//--------------------------------------------------------------------
if (!Arc2->SecondNode()->Infinite()) {
Handle(MAT_Arc) LNeighbour = Arc2->Neighbour(Arc2->SecondNode(),MAT_Left);
Handle(MAT_Arc) RNeighbour = Arc2->Neighbour(Arc2->SecondNode(),MAT_Right);
Arc1->SetFirstArc(MAT_Left,LNeighbour);
Arc1->SetFirstArc(MAT_Right,RNeighbour);
theArcs(LNeighbour->Index())->SetNeighbour(MAT_Right,
Arc2->SecondNode(),
Arc1);
theArcs(RNeighbour->Index())->SetNeighbour(MAT_Left,
Arc2->SecondNode(),
Arc1);
if (!Arc2->SecondNode()->Infinite())
{
Handle(MAT_Arc) LNeighbour = Arc2->Neighbour(Arc2->SecondNode(), MAT_Left);
Handle(MAT_Arc) RNeighbour = Arc2->Neighbour(Arc2->SecondNode(), MAT_Right);
Arc1->SetFirstArc(MAT_Left, LNeighbour);
Arc1->SetFirstArc(MAT_Right, RNeighbour);
theArcs(LNeighbour->Index())->SetNeighbour(MAT_Right, Arc2->SecondNode(), Arc1);
theArcs(RNeighbour->Index())->SetNeighbour(MAT_Left, Arc2->SecondNode(), Arc1);
}
else {
else
{
Handle(MAT_Arc) EmptyArc;
Arc1->SetFirstArc(MAT_Left ,EmptyArc);
Arc1->SetFirstArc(MAT_Right,EmptyArc);
Arc1->SetFirstArc(MAT_Left, EmptyArc);
Arc1->SetFirstArc(MAT_Right, EmptyArc);
}
//-------------------------------------------------------------------
@@ -372,13 +355,15 @@ void MAT_Graph::FusionOfArcs(const Handle(MAT_Arc)& Arc1,
Arc1->FirstNode()->SetLinkedArc(Arc1);
//------------------------------------
// Elimination de Arc2 et des OldNode
// Elimination de Arc2 et des OldNode
//------------------------------------
if (theNodes.IsBound(OldNode1->Index())) {
if (theNodes.IsBound(OldNode1->Index()))
{
theNodes.UnBind(OldNode1->Index());
numberOfNodes--;
}
if (theNodes.IsBound(OldNode2->Index())) {
if (theNodes.IsBound(OldNode2->Index()))
{
theNodes.UnBind(OldNode2->Index());
numberOfNodes--;
}
@@ -387,18 +372,25 @@ void MAT_Graph::FusionOfArcs(const Handle(MAT_Arc)& Arc1,
// it is necessary to create copy of that handle and use only it to access
// that object, since the handle contained in the map is destroyed by UnBind()
Handle(MAT_Arc) anArc2 = Arc2;
theArcs .UnBind(Arc2->Index());
theArcs.UnBind(Arc2->Index());
numberOfArcs--;
for (Standard_Integer i = 1; i <= 2; i++){
for (Standard_Integer i = 1; i <= 2; i++)
{
Handle(MAT_BasicElt) BE;
if (i == 1)
BE = theBasicElts(anArc2->FirstElement ()->Index());
BE = theBasicElts(anArc2->FirstElement()->Index());
else
BE = theBasicElts(anArc2->SecondElement ()->Index());
BE = theBasicElts(anArc2->SecondElement()->Index());
if (BE->StartArc() == anArc2) { BE->SetStartArc(Arc1);}
if (BE->EndArc () == anArc2) { BE->SetEndArc (Arc1);}
if (BE->StartArc() == anArc2)
{
BE->SetStartArc(Arc1);
}
if (BE->EndArc() == anArc2)
{
BE->SetEndArc(Arc1);
}
}
}
@@ -406,22 +398,26 @@ void MAT_Graph::FusionOfArcs(const Handle(MAT_Arc)& Arc1,
// function : CompactArcs
// purpose : Decalage des Arcs pour boucher les trous.
//=============================================================================
void MAT_Graph::CompactArcs()
void MAT_Graph::CompactArcs()
{
Standard_Integer IFind = 0;
Standard_Integer IFind = 0;
Standard_Integer i = 1;
Standard_Boolean YaDecalage = Standard_False;
while (IFind < numberOfArcs) {
if (!theArcs.IsBound(i)) {
while (IFind < numberOfArcs)
{
if (!theArcs.IsBound(i))
{
YaDecalage = Standard_True;
}
else {
else
{
IFind++;
if (YaDecalage) {
theArcs(i)->SetIndex(IFind);
theArcs.Bind(IFind,theArcs(i));
theArcs.UnBind(i);
if (YaDecalage)
{
theArcs(i)->SetIndex(IFind);
theArcs.Bind(IFind, theArcs(i));
theArcs.UnBind(i);
}
}
i++;
@@ -432,46 +428,47 @@ void MAT_Graph::CompactArcs()
// function : CompactNodes
// purpose : Decalage des Nodes pour boucher les trous.
//=============================================================================
void MAT_Graph::CompactNodes()
void MAT_Graph::CompactNodes()
{
Standard_Integer IFind = 0;
Standard_Integer IFind = 0;
Standard_Integer i = 1;
Standard_Boolean YaDecalage = Standard_False;
while (IFind < numberOfNodes) {
if (!theNodes.IsBound(i)) {
while (IFind < numberOfNodes)
{
if (!theNodes.IsBound(i))
{
YaDecalage = Standard_True;
}
else {
else
{
IFind++;
if (YaDecalage) {
theNodes(i)->SetIndex(IFind);
theNodes.Bind(IFind,theNodes(i));
theNodes.UnBind(i);
if (YaDecalage)
{
theNodes(i)->SetIndex(IFind);
theNodes.Bind(IFind, theNodes(i));
theNodes.UnBind(i);
}
}
i++;
}
}
//=============================================================================
// function : ChangeBasicElts
// purpose :
//=============================================================================
void MAT_Graph::ChangeBasicElts(const MAT_DataMapOfIntegerBasicElt& NewMap)
//=================================================================================================
void MAT_Graph::ChangeBasicElts(const MAT_DataMapOfIntegerBasicElt& NewMap)
{
theBasicElts = NewMap;
theBasicElts = NewMap;
MAT_DataMapIteratorOfDataMapOfIntegerBasicElt Ite;
for (Ite.Initialize(theBasicElts); Ite.More(); Ite.Next()) {
for (Ite.Initialize(theBasicElts); Ite.More(); Ite.Next())
{
Ite.Value()->SetIndex(Ite.Key());
}
}
//=============================================================================
//function : ChangeBasicElt
//Purpose :
//=============================================================================
Handle(MAT_BasicElt) MAT_Graph::ChangeBasicElt(const Standard_Integer Index)
//=================================================================================================
Handle(MAT_BasicElt) MAT_Graph::ChangeBasicElt(const Standard_Integer Index)
{
return theBasicElts(Index);
}
@@ -482,101 +479,94 @@ Handle(MAT_BasicElt) MAT_Graph::ChangeBasicElt(const Standard_Integer Index)
// et stockage de chaque noeud dans la table des noeuds.
// Les noeuds racines sont traites dans PERFORM.
//=============================================================================
void MAT_Graph::UpDateNodes (Standard_Integer& IndTabNodes)
{
Standard_Integer i;
Handle(MAT_Node) Bout;
Handle(MAT_Arc) CurrentArc;
for (i = 1; i <= numberOfArcs; i++) {
void MAT_Graph::UpDateNodes(Standard_Integer& IndTabNodes)
{
Standard_Integer i;
Handle(MAT_Node) Bout;
Handle(MAT_Arc) CurrentArc;
for (i = 1; i <= numberOfArcs; i++)
{
Bout = theArcs(i)->FirstNode();
theNodes.Bind(IndTabNodes,Bout);
theNodes.Bind(IndTabNodes, Bout);
Bout->SetIndex(IndTabNodes);
IndTabNodes--;
Bout->SetLinkedArc(theArcs(i));
}
}
//=============================================================================
// function : MakeArc
// purpose : Creation des <ARCS> en parcourant l'arbre issue de <aBisector>.
//=============================================================================
static Handle(MAT_Arc) MakeArc(const Handle(MAT_Bisector)& aBisector,
MAT_DataMapOfIntegerBasicElt& TheBasicElts,
MAT_DataMapOfIntegerArc& TheArcs,
Standard_Integer& IndTabArcs)
static Handle(MAT_Arc) MakeArc(const Handle(MAT_Bisector)& aBisector,
MAT_DataMapOfIntegerBasicElt& TheBasicElts,
MAT_DataMapOfIntegerArc& TheArcs,
Standard_Integer& IndTabArcs)
{
Handle(MAT_Arc) CurrentArc;
Handle(MAT_Arc) PrevArc;
Handle(MAT_Arc) NextArc;
Handle(MAT_Node) Extremite;
Handle(MAT_ListOfBisector) BisectorList;
Standard_Real DistExt;
Handle(MAT_Arc) CurrentArc;
Handle(MAT_Arc) PrevArc;
Handle(MAT_Arc) NextArc;
Handle(MAT_Node) Extremite;
Handle(MAT_ListOfBisector) BisectorList;
Standard_Real DistExt;
#ifdef OCCT_DEBUG_Graph
std::cout<<"Construction Arc : Index"<<aBisector->IndexNumber()<<std::endl;
std::cout<<"Construction Arc : Bisector"<<aBisector->BisectorNumber()<<std::endl;
std::cout << "Construction Arc : Index" << aBisector->IndexNumber() << std::endl;
std::cout << "Construction Arc : Bisector" << aBisector->BisectorNumber() << std::endl;
#endif
CurrentArc = new MAT_Arc(IndTabArcs,
aBisector->BisectorNumber(),
TheBasicElts(aBisector->FirstEdge()->EdgeNumber()),
TheBasicElts(aBisector->SecondEdge()->EdgeNumber())
);
DistExt = aBisector->DistIssuePoint();
if (DistExt == Precision::Infinite()) {
aBisector->BisectorNumber(),
TheBasicElts(aBisector->FirstEdge()->EdgeNumber()),
TheBasicElts(aBisector->SecondEdge()->EdgeNumber()));
DistExt = aBisector->DistIssuePoint();
if (DistExt == Precision::Infinite())
{
DistExt = 1.0;
#ifdef OCCT_DEBUG_Graph
std::cout<<"PB:RECUPERATION DISTANCE SUR ISSUEPOINT."<<std::endl;
std::cout << "PB:RECUPERATION DISTANCE SUR ISSUEPOINT." << std::endl;
#endif
}
Extremite = new MAT_Node(aBisector->IssuePoint(),CurrentArc,DistExt);
Extremite = new MAT_Node(aBisector->IssuePoint(), CurrentArc, DistExt);
CurrentArc->SetFirstNode(Extremite);
BisectorList = aBisector->List();
BisectorList->First();
if (!BisectorList->More()) {
if (!BisectorList->More())
{
// -------------------
// Arc sur le contour.
// -------------------
TheBasicElts(aBisector->SecondEdge()->EdgeNumber())
->SetStartArc(CurrentArc);
TheBasicElts(aBisector->FirstEdge()->EdgeNumber())
->SetEndArc(CurrentArc);
TheBasicElts(aBisector->SecondEdge()->EdgeNumber())->SetStartArc(CurrentArc);
TheBasicElts(aBisector->FirstEdge()->EdgeNumber())->SetEndArc(CurrentArc);
}
else {
else
{
PrevArc = CurrentArc;
while (BisectorList->More()) {
NextArc = MakeArc(BisectorList->Current(),
TheBasicElts,
TheArcs,
IndTabArcs);
while (BisectorList->More())
{
NextArc = MakeArc(BisectorList->Current(), TheBasicElts, TheArcs, IndTabArcs);
NextArc->SetSecondNode(Extremite);
NextArc->SetNeighbour (MAT_Left ,Extremite,PrevArc);
PrevArc->SetNeighbour (MAT_Right,Extremite,NextArc);
PrevArc = NextArc;
NextArc->SetNeighbour(MAT_Left, Extremite, PrevArc);
PrevArc->SetNeighbour(MAT_Right, Extremite, NextArc);
PrevArc = NextArc;
BisectorList->Next();
}
CurrentArc->SetNeighbour(MAT_Left ,Extremite,NextArc);
NextArc ->SetNeighbour(MAT_Right,Extremite,CurrentArc);
CurrentArc->SetNeighbour(MAT_Left, Extremite, NextArc);
NextArc->SetNeighbour(MAT_Right, Extremite, CurrentArc);
}
#ifdef OCCT_DEBUG_Graph
std::cout<<"IndTabArcs = "<<IndTabArcs<<std::endl;
std::cout<<"ArcIndex = "<<CurrentArc->ArcIndex()<<std::endl;
#endif
std::cout << "IndTabArcs = " << IndTabArcs << std::endl;
std::cout << "ArcIndex = " << CurrentArc->ArcIndex() << std::endl;
#endif
CurrentArc->SetIndex(IndTabArcs);
TheArcs.Bind(IndTabArcs,CurrentArc);
IndTabArcs = IndTabArcs + 1;
TheArcs.Bind(IndTabArcs, CurrentArc);
IndTabArcs = IndTabArcs + 1;
return CurrentArc;
}

View File

@@ -30,7 +30,6 @@ class MAT_Arc;
class MAT_BasicElt;
class MAT_Node;
class MAT_Graph;
DEFINE_STANDARD_HANDLE(MAT_Graph, Standard_Transient)
@@ -40,11 +39,9 @@ class MAT_Graph : public Standard_Transient
{
public:
//! Empty constructor.
Standard_EXPORT MAT_Graph();
//! Construct <me> from the result of the method
//! <CreateMat> of the class <MAT> from <MAT>.
//!
@@ -52,29 +49,32 @@ public:
//! <TheRoots> : Set of the bisectors.
//! <NbBasicElts> : Number of Basic Elements.
//! <NbArcs> : Number of Arcs = Number of Bisectors.
Standard_EXPORT void Perform (const Standard_Boolean SemiInfinite, const Handle(MAT_ListOfBisector)& TheRoots, const Standard_Integer NbBasicElts, const Standard_Integer NbArcs);
Standard_EXPORT void Perform(const Standard_Boolean SemiInfinite,
const Handle(MAT_ListOfBisector)& TheRoots,
const Standard_Integer NbBasicElts,
const Standard_Integer NbArcs);
//! Return the Arc of index <Index> in <theArcs>.
Standard_EXPORT Handle(MAT_Arc) Arc (const Standard_Integer Index) const;
Standard_EXPORT Handle(MAT_Arc) Arc(const Standard_Integer Index) const;
//! Return the BasicElt of index <Index> in <theBasicElts>.
Standard_EXPORT Handle(MAT_BasicElt) BasicElt (const Standard_Integer Index) const;
Standard_EXPORT Handle(MAT_BasicElt) BasicElt(const Standard_Integer Index) const;
//! Return the Node of index <Index> in <theNodes>.
Standard_EXPORT Handle(MAT_Node) Node (const Standard_Integer Index) const;
Standard_EXPORT Handle(MAT_Node) Node(const Standard_Integer Index) const;
//! Return the number of arcs of <me>.
Standard_EXPORT Standard_Integer NumberOfArcs() const;
//! Return the number of nodes of <me>.
Standard_EXPORT Standard_Integer NumberOfNodes() const;
//! Return the number of basic elements of <me>.
Standard_EXPORT Standard_Integer NumberOfBasicElts() const;
//! Return the number of infinites nodes of <me>.
Standard_EXPORT Standard_Integer NumberOfInfiniteNodes() const;
//! Merge two BasicElts. The End of the BasicElt Elt1
//! of IndexElt1 becomes The End of the BasicElt Elt2
//! of IndexElt2. Elt2 is replaced in the arcs by
@@ -91,52 +91,42 @@ public:
//! In this case there is a fusion of this arcs, <MergeArc2>
//! is true and <GeomIndexArc3> and <GeomIndexArc4> are the
//! Geometric Index of this arcs.
Standard_EXPORT void FusionOfBasicElts (const Standard_Integer IndexElt1, const Standard_Integer IndexElt2, Standard_Boolean& MergeArc1, Standard_Integer& GeomIndexArc1, Standard_Integer& GeomIndexArc2, Standard_Boolean& MergeArc2, Standard_Integer& GeomIndexArc3, Standard_Integer& GeomIndexArc4);
Standard_EXPORT void FusionOfBasicElts(const Standard_Integer IndexElt1,
const Standard_Integer IndexElt2,
Standard_Boolean& MergeArc1,
Standard_Integer& GeomIndexArc1,
Standard_Integer& GeomIndexArc2,
Standard_Boolean& MergeArc2,
Standard_Integer& GeomIndexArc3,
Standard_Integer& GeomIndexArc4);
Standard_EXPORT void CompactArcs();
Standard_EXPORT void CompactNodes();
Standard_EXPORT void ChangeBasicElts (const MAT_DataMapOfIntegerBasicElt& NewMap);
Standard_EXPORT Handle(MAT_BasicElt) ChangeBasicElt (const Standard_Integer Index);
Standard_EXPORT void ChangeBasicElts(const MAT_DataMapOfIntegerBasicElt& NewMap);
Standard_EXPORT Handle(MAT_BasicElt) ChangeBasicElt(const Standard_Integer Index);
DEFINE_STANDARD_RTTIEXT(MAT_Graph,Standard_Transient)
DEFINE_STANDARD_RTTIEXT(MAT_Graph, Standard_Transient)
protected:
private:
//! Merge two Arcs. the second node of <Arc2> becomes
//! the first node of <Arc1>. Update of the first
//! node and the neighbours of <Arc1>.
//! <Arc2> is eliminated.
Standard_EXPORT void FusionOfArcs (const Handle(MAT_Arc)& Arc1, const Handle(MAT_Arc)& Arc2);
Standard_EXPORT void UpDateNodes (Standard_Integer& Index);
Standard_EXPORT void FusionOfArcs(const Handle(MAT_Arc)& Arc1, const Handle(MAT_Arc)& Arc2);
MAT_DataMapOfIntegerArc theArcs;
Standard_EXPORT void UpDateNodes(Standard_Integer& Index);
MAT_DataMapOfIntegerArc theArcs;
MAT_DataMapOfIntegerBasicElt theBasicElts;
MAT_DataMapOfIntegerNode theNodes;
Standard_Integer numberOfArcs;
Standard_Integer numberOfNodes;
Standard_Integer numberOfBasicElts;
Standard_Integer numberOfInfiniteNodes;
MAT_DataMapOfIntegerNode theNodes;
Standard_Integer numberOfArcs;
Standard_Integer numberOfNodes;
Standard_Integer numberOfBasicElts;
Standard_Integer numberOfInfiniteNodes;
};
#endif // _MAT_Graph_HeaderFile

View File

@@ -25,92 +25,76 @@
class MAT_TListNodeOfListOfBisector;
class MAT_Bisector;
class MAT_ListOfBisector;
DEFINE_STANDARD_HANDLE(MAT_ListOfBisector, Standard_Transient)
class MAT_ListOfBisector : public Standard_Transient
{
public:
Standard_EXPORT MAT_ListOfBisector();
Standard_EXPORT ~MAT_ListOfBisector();
Standard_EXPORT void First();
Standard_EXPORT void Last();
Standard_EXPORT void Init (const Handle(MAT_Bisector)& aniten);
Standard_EXPORT void Init(const Handle(MAT_Bisector)& aniten);
Standard_EXPORT void Next();
Standard_EXPORT void Previous();
Standard_EXPORT Standard_Boolean More() const;
Standard_EXPORT Handle(MAT_Bisector) Current() const;
Standard_EXPORT void Current (const Handle(MAT_Bisector)& anitem) const;
Standard_EXPORT void Current(const Handle(MAT_Bisector)& anitem) const;
Standard_EXPORT Handle(MAT_Bisector) FirstItem() const;
Standard_EXPORT Handle(MAT_Bisector) LastItem() const;
Standard_EXPORT Handle(MAT_Bisector) PreviousItem() const;
Standard_EXPORT Handle(MAT_Bisector) NextItem() const;
Standard_Integer Number() const;
Standard_Integer Index() const;
Standard_EXPORT Handle(MAT_Bisector) Brackets (const Standard_Integer anindex);
Handle(MAT_Bisector) operator() (const Standard_Integer anindex)
{
return Brackets(anindex);
}
Standard_Integer Number() const;
Standard_Integer Index() const;
Standard_EXPORT Handle(MAT_Bisector) Brackets(const Standard_Integer anindex);
Handle(MAT_Bisector) operator()(const Standard_Integer anindex) { return Brackets(anindex); }
Standard_EXPORT void Unlink();
Standard_EXPORT void LinkBefore (const Handle(MAT_Bisector)& anitem);
Standard_EXPORT void LinkAfter (const Handle(MAT_Bisector)& anitem);
Standard_EXPORT void FrontAdd (const Handle(MAT_Bisector)& anitem);
Standard_EXPORT void BackAdd (const Handle(MAT_Bisector)& anitem);
Standard_EXPORT void LinkBefore(const Handle(MAT_Bisector)& anitem);
Standard_EXPORT void LinkAfter(const Handle(MAT_Bisector)& anitem);
Standard_EXPORT void FrontAdd(const Handle(MAT_Bisector)& anitem);
Standard_EXPORT void BackAdd(const Handle(MAT_Bisector)& anitem);
Standard_EXPORT void Permute();
Standard_EXPORT void Loop() const;
Standard_Boolean IsEmpty() const;
Standard_EXPORT void Dump (const Standard_Integer ashift, const Standard_Integer alevel);
Standard_EXPORT void Dump(const Standard_Integer ashift, const Standard_Integer alevel);
DEFINE_STANDARD_RTTI_INLINE(MAT_ListOfBisector,Standard_Transient)
DEFINE_STANDARD_RTTI_INLINE(MAT_ListOfBisector, Standard_Transient)
protected:
private:
Handle(MAT_TListNodeOfListOfBisector) thefirstnode;
Handle(MAT_TListNodeOfListOfBisector) thelastnode;
Handle(MAT_TListNodeOfListOfBisector) thecurrentnode;
Standard_Integer thecurrentindex;
Standard_Integer thenumberofitems;
Standard_Integer thecurrentindex;
Standard_Integer thenumberofitems;
};
#define Item Handle(MAT_Bisector)
@@ -133,7 +117,4 @@ private:
#undef MAT_TList_hxx
#undef Handle_MAT_TList
#endif // _MAT_ListOfBisector_HeaderFile

View File

@@ -21,15 +21,6 @@
#include <MAT_TListNodeOfListOfBisector.hxx>
#include <MAT_Bisector.hxx>
#define Item Handle(MAT_Bisector)
#define Item_hxx <MAT_Bisector.hxx>
#define MAT_TListNode MAT_TListNodeOfListOfBisector
@@ -39,4 +30,3 @@
#define MAT_TList_hxx <MAT_ListOfBisector.hxx>
#define Handle_MAT_TList Handle(MAT_ListOfBisector)
#include "../MAT/MAT_TList.gxx"

View File

@@ -25,92 +25,76 @@
class MAT_TListNodeOfListOfEdge;
class MAT_Edge;
class MAT_ListOfEdge;
DEFINE_STANDARD_HANDLE(MAT_ListOfEdge, Standard_Transient)
class MAT_ListOfEdge : public Standard_Transient
{
public:
Standard_EXPORT MAT_ListOfEdge();
Standard_EXPORT ~MAT_ListOfEdge();
Standard_EXPORT void First();
Standard_EXPORT void Last();
Standard_EXPORT void Init (const Handle(MAT_Edge)& aniten);
Standard_EXPORT void Init(const Handle(MAT_Edge)& aniten);
Standard_EXPORT void Next();
Standard_EXPORT void Previous();
Standard_EXPORT Standard_Boolean More() const;
Standard_EXPORT Handle(MAT_Edge) Current() const;
Standard_EXPORT void Current (const Handle(MAT_Edge)& anitem) const;
Standard_EXPORT void Current(const Handle(MAT_Edge)& anitem) const;
Standard_EXPORT Handle(MAT_Edge) FirstItem() const;
Standard_EXPORT Handle(MAT_Edge) LastItem() const;
Standard_EXPORT Handle(MAT_Edge) PreviousItem() const;
Standard_EXPORT Handle(MAT_Edge) NextItem() const;
Standard_Integer Number() const;
Standard_Integer Index() const;
Standard_EXPORT Handle(MAT_Edge) Brackets (const Standard_Integer anindex);
Handle(MAT_Edge) operator() (const Standard_Integer anindex)
{
return Brackets(anindex);
}
Standard_Integer Number() const;
Standard_Integer Index() const;
Standard_EXPORT Handle(MAT_Edge) Brackets(const Standard_Integer anindex);
Handle(MAT_Edge) operator()(const Standard_Integer anindex) { return Brackets(anindex); }
Standard_EXPORT void Unlink();
Standard_EXPORT void LinkBefore (const Handle(MAT_Edge)& anitem);
Standard_EXPORT void LinkAfter (const Handle(MAT_Edge)& anitem);
Standard_EXPORT void FrontAdd (const Handle(MAT_Edge)& anitem);
Standard_EXPORT void BackAdd (const Handle(MAT_Edge)& anitem);
Standard_EXPORT void LinkBefore(const Handle(MAT_Edge)& anitem);
Standard_EXPORT void LinkAfter(const Handle(MAT_Edge)& anitem);
Standard_EXPORT void FrontAdd(const Handle(MAT_Edge)& anitem);
Standard_EXPORT void BackAdd(const Handle(MAT_Edge)& anitem);
Standard_EXPORT void Permute();
Standard_EXPORT void Loop() const;
Standard_Boolean IsEmpty() const;
Standard_EXPORT void Dump (const Standard_Integer ashift, const Standard_Integer alevel);
Standard_EXPORT void Dump(const Standard_Integer ashift, const Standard_Integer alevel);
DEFINE_STANDARD_RTTI_INLINE(MAT_ListOfEdge,Standard_Transient)
DEFINE_STANDARD_RTTI_INLINE(MAT_ListOfEdge, Standard_Transient)
protected:
private:
Handle(MAT_TListNodeOfListOfEdge) thefirstnode;
Handle(MAT_TListNodeOfListOfEdge) thelastnode;
Handle(MAT_TListNodeOfListOfEdge) thecurrentnode;
Standard_Integer thecurrentindex;
Standard_Integer thenumberofitems;
Standard_Integer thecurrentindex;
Standard_Integer thenumberofitems;
};
#define Item Handle(MAT_Edge)
@@ -133,7 +117,4 @@ private:
#undef MAT_TList_hxx
#undef Handle_MAT_TList
#endif // _MAT_ListOfEdge_HeaderFile

View File

@@ -21,15 +21,6 @@
#include <MAT_TListNodeOfListOfEdge.hxx>
#include <MAT_Edge.hxx>
#define Item Handle(MAT_Edge)
#define Item_hxx <MAT_Edge.hxx>
#define MAT_TListNode MAT_TListNodeOfListOfEdge
@@ -39,4 +30,3 @@
#define MAT_TList_hxx <MAT_ListOfEdge.hxx>
#define Handle_MAT_TList Handle(MAT_ListOfEdge)
#include "../MAT/MAT_TList.gxx"

View File

@@ -14,49 +14,40 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MAT_Node.hxx>
#include <Precision.hxx>
#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(MAT_Node,Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(MAT_Node, Standard_Transient)
//=============================================================================
//function :
//Purpose :
//=============================================================================
MAT_Node::MAT_Node(const Standard_Integer GeomIndex,
const Handle(MAT_Arc)& LinkedArc,
const Standard_Real Distance)
: nodeIndex(0),
geomIndex(GeomIndex),
distance(Distance)
//=================================================================================================
MAT_Node::MAT_Node(const Standard_Integer GeomIndex,
const Handle(MAT_Arc)& LinkedArc,
const Standard_Real Distance)
: nodeIndex(0),
geomIndex(GeomIndex),
distance(Distance)
{
aLinkedArc = LinkedArc.get();
}
//=============================================================================
//function : GeomIndex
//Purpose :
//=============================================================================
Standard_Integer MAT_Node::GeomIndex() const
//=================================================================================================
Standard_Integer MAT_Node::GeomIndex() const
{
return geomIndex;
}
//=============================================================================
//function : Index
//Purpose :
//=============================================================================
Standard_Integer MAT_Node::Index() const
//=================================================================================================
Standard_Integer MAT_Node::Index() const
{
return nodeIndex;
}
//=============================================================================
//function : LinkedArcs
//Purpose :
//=============================================================================
//=================================================================================================
void MAT_Node::LinkedArcs(MAT_SequenceOfArc& S) const
{
S.Clear();
@@ -65,19 +56,19 @@ void MAT_Node::LinkedArcs(MAT_SequenceOfArc& S) const
S.Append(LA);
if (LA->HasNeighbour(Me, MAT_Left)) {
Handle(MAT_Arc) CA = LA->Neighbour(Me, MAT_Left);
while (CA != LA) {
if (LA->HasNeighbour(Me, MAT_Left))
{
Handle(MAT_Arc) CA = LA->Neighbour(Me, MAT_Left);
while (CA != LA)
{
S.Append(CA);
CA = CA->Neighbour(Me, MAT_Left);
}
}
}
//=============================================================================
//function : NearElts
//Purpose :
//=============================================================================
//=================================================================================================
void MAT_Node::NearElts(MAT_SequenceOfBasicElt& S) const
{
S.Clear();
@@ -88,85 +79,72 @@ void MAT_Node::NearElts(MAT_SequenceOfBasicElt& S) const
S.Append(LA->FirstElement());
S.Append(LA->SecondElement());
if (LA->HasNeighbour(Me, MAT_Left)) {
if (LA->HasNeighbour(Me, MAT_Left))
{
Handle(MAT_Arc) CA = LA->Neighbour(Me, MAT_Left);
Handle(MAT_Arc) CA = LA->Neighbour(Me, MAT_Left);
Standard_Boolean Pair = Standard_False;
//---------------------------------------------------------
// Recuperation des deux elements separes pour un arc sur
// deux.
//---------------------------------------------------------
while (CA != LA) {
if (Pair) {
S.Append(CA->FirstElement());
S.Append(CA->SecondElement());
while (CA != LA)
{
if (Pair)
{
S.Append(CA->FirstElement());
S.Append(CA->SecondElement());
}
else {
Pair = Standard_True;
else
{
Pair = Standard_True;
}
CA = CA->Neighbour(Me, MAT_Left);
}
}
}
//=============================================================================
//function : Distance
//Purpose :
//=============================================================================
Standard_Real MAT_Node::Distance() const
//=================================================================================================
Standard_Real MAT_Node::Distance() const
{
return distance;
}
//=================================================================================================
//=============================================================================
//function : PendingNode
//Purpose :
//=============================================================================
Standard_Boolean MAT_Node::PendingNode() const
Standard_Boolean MAT_Node::PendingNode() const
{
Handle(MAT_Node) Me = this;
return (!((MAT_Arc*)aLinkedArc)->HasNeighbour(Me,MAT_Left));
return (!((MAT_Arc*)aLinkedArc)->HasNeighbour(Me, MAT_Left));
}
//=============================================================================
//function : NodeOnFig
//Purpose :
//=============================================================================
Standard_Boolean MAT_Node::OnBasicElt() const
//=================================================================================================
Standard_Boolean MAT_Node::OnBasicElt() const
{
return (Distance() == 0.0);
}
//=============================================================================
//function : NodeInfinite
//Purpose :
//=============================================================================
Standard_Boolean MAT_Node::Infinite() const
//=================================================================================================
Standard_Boolean MAT_Node::Infinite() const
{
return (Distance() == Precision::Infinite());
}
//=============================================================================
//function : SetLinkedArcs
//Purpose :
//=============================================================================
void MAT_Node::SetLinkedArc (const Handle(MAT_Arc)& LinkedArc)
//=================================================================================================
void MAT_Node::SetLinkedArc(const Handle(MAT_Arc)& LinkedArc)
{
aLinkedArc = LinkedArc.get();
}
//=============================================================================
//function : SetIndex
//Purpose :
//=============================================================================
void MAT_Node::SetIndex (const Standard_Integer anIndex)
//=================================================================================================
void MAT_Node::SetIndex(const Standard_Integer anIndex)
{
nodeIndex = anIndex;
}

View File

@@ -27,7 +27,6 @@
#include <MAT_SequenceOfBasicElt.hxx>
class MAT_Arc;
class MAT_Node;
DEFINE_STANDARD_HANDLE(MAT_Node, Standard_Transient)
@@ -36,66 +35,49 @@ class MAT_Node : public Standard_Transient
{
public:
Standard_EXPORT MAT_Node(const Standard_Integer GeomIndex,
const Handle(MAT_Arc)& LinkedArc,
const Standard_Real Distance);
Standard_EXPORT MAT_Node(const Standard_Integer GeomIndex, const Handle(MAT_Arc)& LinkedArc, const Standard_Real Distance);
//! Returns the index associated of the geometric
//! representation of <me>.
Standard_EXPORT Standard_Integer GeomIndex() const;
//! Returns the index associated of the node
Standard_EXPORT Standard_Integer Index() const;
//! Returns in <S> the Arcs linked to <me>.
Standard_EXPORT void LinkedArcs (MAT_SequenceOfArc& S) const;
Standard_EXPORT void LinkedArcs(MAT_SequenceOfArc& S) const;
//! Returns in <S> the BasicElts equidistant
//! to <me>.
Standard_EXPORT void NearElts (MAT_SequenceOfBasicElt& S) const;
Standard_EXPORT void NearElts(MAT_SequenceOfBasicElt& S) const;
Standard_EXPORT Standard_Real Distance() const;
//! Returns True if <me> is a pending Node.
//! (ie : the number of Arc Linked = 1)
Standard_EXPORT Standard_Boolean PendingNode() const;
//! Returns True if <me> belongs to the figure.
Standard_EXPORT Standard_Boolean OnBasicElt() const;
//! Returns True if the distance of <me> is Infinite
Standard_EXPORT Standard_Boolean Infinite() const;
//! Set the index associated of the node
Standard_EXPORT void SetIndex (const Standard_Integer anIndex);
Standard_EXPORT void SetLinkedArc (const Handle(MAT_Arc)& anArc);
Standard_EXPORT void SetIndex(const Standard_Integer anIndex);
Standard_EXPORT void SetLinkedArc(const Handle(MAT_Arc)& anArc);
DEFINE_STANDARD_RTTIEXT(MAT_Node,Standard_Transient)
DEFINE_STANDARD_RTTIEXT(MAT_Node, Standard_Transient)
protected:
private:
Standard_Integer nodeIndex;
Standard_Integer geomIndex;
Standard_Address aLinkedArc;
Standard_Real distance;
Standard_Real distance;
};
#endif // _MAT_Node_HeaderFile

View File

@@ -22,5 +22,4 @@
typedef NCollection_Sequence<Handle(MAT_Arc)> MAT_SequenceOfArc;
#endif

View File

@@ -22,5 +22,4 @@
typedef NCollection_Sequence<Handle(MAT_BasicElt)> MAT_SequenceOfBasicElt;
#endif

View File

@@ -20,8 +20,8 @@
//! Definition on the Left and the Right on the Fig.
enum MAT_Side
{
MAT_Left,
MAT_Right
MAT_Left,
MAT_Right
};
#endif // _MAT_Side_HeaderFile

View File

@@ -15,8 +15,8 @@
// commercial license or contractual agreement.
//=======================================================================
//function : Number
//purpose :
// function : Number
// purpose :
//=======================================================================
inline Standard_Integer MAT_TList::Number() const
@@ -25,8 +25,8 @@ inline Standard_Integer MAT_TList::Number() const
}
//=======================================================================
//function : Index
//purpose :
// function : Index
// purpose :
//=======================================================================
inline Standard_Integer MAT_TList::Index() const
@@ -35,8 +35,8 @@ inline Standard_Integer MAT_TList::Index() const
}
//=======================================================================
//function : IsEmpty
//purpose :
// function : IsEmpty
// purpose :
//=======================================================================
inline Standard_Boolean MAT_TList::IsEmpty() const

View File

@@ -15,15 +15,15 @@
// commercial license or contractual agreement.
//=======================================================================
//function : MAT_TListNode
//purpose :
// function : MAT_TListNode
// purpose :
//=======================================================================
inline MAT_TListNode::MAT_TListNode() {}
//=======================================================================
//function : MAT_TListNode
//purpose :
// function : MAT_TListNode
// purpose :
//=======================================================================
inline MAT_TListNode::MAT_TListNode(const Item& anitem)
@@ -32,8 +32,8 @@ inline MAT_TListNode::MAT_TListNode(const Item& anitem)
}
//=======================================================================
//function : GetItem
//purpose :
// function : GetItem
// purpose :
//=======================================================================
inline Item MAT_TListNode::GetItem() const
@@ -42,8 +42,8 @@ inline Item MAT_TListNode::GetItem() const
}
//=======================================================================
//function : Next
//purpose :
// function : Next
// purpose :
//=======================================================================
inline Handle(MAT_TListNode) MAT_TListNode::Next() const
@@ -52,8 +52,8 @@ inline Handle(MAT_TListNode) MAT_TListNode::Next() const
}
//=======================================================================
//function : Previous
//purpose :
// function : Previous
// purpose :
//=======================================================================
inline Handle(MAT_TListNode) MAT_TListNode::Previous() const
@@ -62,33 +62,31 @@ inline Handle(MAT_TListNode) MAT_TListNode::Previous() const
}
//=======================================================================
//function : SetItem
//purpose :
// function : SetItem
// purpose :
//=======================================================================
inline void MAT_TListNode::SetItem(const Item& anitem)
{
theitem=anitem;
theitem = anitem;
}
//=======================================================================
//function : Next
//purpose :
// function : Next
// purpose :
//=======================================================================
inline void MAT_TListNode::Next
(const Handle(MAT_TListNode)& atlistnode)
inline void MAT_TListNode::Next(const Handle(MAT_TListNode)& atlistnode)
{
thenext=atlistnode;
thenext = atlistnode;
}
//=======================================================================
//function : Previous
//purpose :
// function : Previous
// purpose :
//=======================================================================
inline void MAT_TListNode::Previous
(const Handle(MAT_TListNode)& atlistnode)
inline void MAT_TListNode::Previous(const Handle(MAT_TListNode)& atlistnode)
{
theprevious=atlistnode;
theprevious = atlistnode;
}

View File

@@ -24,53 +24,38 @@
class MAT_Bisector;
class MAT_ListOfBisector;
class MAT_TListNodeOfListOfBisector;
DEFINE_STANDARD_HANDLE(MAT_TListNodeOfListOfBisector, Standard_Transient)
class MAT_TListNodeOfListOfBisector : public Standard_Transient
{
public:
MAT_TListNodeOfListOfBisector();
MAT_TListNodeOfListOfBisector(const Handle(MAT_Bisector)& anitem);
Handle(MAT_Bisector) GetItem() const;
Handle(MAT_TListNodeOfListOfBisector) Next() const;
Handle(MAT_TListNodeOfListOfBisector) Previous() const;
void SetItem(const Handle(MAT_Bisector)& anitem);
void Next(const Handle(MAT_TListNodeOfListOfBisector)& atlistnode);
void Previous(const Handle(MAT_TListNodeOfListOfBisector)& atlistnode);
MAT_TListNodeOfListOfBisector();
MAT_TListNodeOfListOfBisector(const Handle(MAT_Bisector)& anitem);
Handle(MAT_Bisector) GetItem() const;
Handle(MAT_TListNodeOfListOfBisector) Next() const;
Handle(MAT_TListNodeOfListOfBisector) Previous() const;
void SetItem (const Handle(MAT_Bisector)& anitem);
void Next (const Handle(MAT_TListNodeOfListOfBisector)& atlistnode);
void Previous (const Handle(MAT_TListNodeOfListOfBisector)& atlistnode);
Standard_EXPORT void Dummy() const;
DEFINE_STANDARD_RTTI_INLINE(MAT_TListNodeOfListOfBisector,Standard_Transient)
DEFINE_STANDARD_RTTI_INLINE(MAT_TListNodeOfListOfBisector, Standard_Transient)
protected:
private:
Handle(MAT_TListNodeOfListOfBisector) thenext;
Handle(MAT_TListNodeOfListOfBisector) theprevious;
Handle(MAT_Bisector) theitem;
Handle(MAT_Bisector) theitem;
};
#define Item Handle(MAT_Bisector)
@@ -93,7 +78,4 @@ private:
#undef MAT_TList_hxx
#undef Handle_MAT_TList
#endif // _MAT_TListNodeOfListOfBisector_HeaderFile

View File

@@ -22,15 +22,6 @@
#include <MAT_Bisector.hxx>
#include <MAT_ListOfBisector.hxx>
#define Item Handle(MAT_Bisector)
#define Item_hxx <MAT_Bisector.hxx>
#define MAT_TListNode MAT_TListNodeOfListOfBisector
@@ -40,4 +31,3 @@
#define MAT_TList_hxx <MAT_ListOfBisector.hxx>
#define Handle_MAT_TList Handle(MAT_ListOfBisector)
#include "../MAT/MAT_TListNode.gxx"

View File

@@ -24,53 +24,38 @@
class MAT_Edge;
class MAT_ListOfEdge;
class MAT_TListNodeOfListOfEdge;
DEFINE_STANDARD_HANDLE(MAT_TListNodeOfListOfEdge, Standard_Transient)
class MAT_TListNodeOfListOfEdge : public Standard_Transient
{
public:
MAT_TListNodeOfListOfEdge();
MAT_TListNodeOfListOfEdge(const Handle(MAT_Edge)& anitem);
Handle(MAT_Edge) GetItem() const;
Handle(MAT_TListNodeOfListOfEdge) Next() const;
Handle(MAT_TListNodeOfListOfEdge) Previous() const;
void SetItem(const Handle(MAT_Edge)& anitem);
void Next(const Handle(MAT_TListNodeOfListOfEdge)& atlistnode);
void Previous(const Handle(MAT_TListNodeOfListOfEdge)& atlistnode);
MAT_TListNodeOfListOfEdge();
MAT_TListNodeOfListOfEdge(const Handle(MAT_Edge)& anitem);
Handle(MAT_Edge) GetItem() const;
Handle(MAT_TListNodeOfListOfEdge) Next() const;
Handle(MAT_TListNodeOfListOfEdge) Previous() const;
void SetItem (const Handle(MAT_Edge)& anitem);
void Next (const Handle(MAT_TListNodeOfListOfEdge)& atlistnode);
void Previous (const Handle(MAT_TListNodeOfListOfEdge)& atlistnode);
Standard_EXPORT void Dummy() const;
DEFINE_STANDARD_RTTI_INLINE(MAT_TListNodeOfListOfEdge,Standard_Transient)
DEFINE_STANDARD_RTTI_INLINE(MAT_TListNodeOfListOfEdge, Standard_Transient)
protected:
private:
Handle(MAT_TListNodeOfListOfEdge) thenext;
Handle(MAT_TListNodeOfListOfEdge) theprevious;
Handle(MAT_Edge) theitem;
Handle(MAT_Edge) theitem;
};
#define Item Handle(MAT_Edge)
@@ -93,7 +78,4 @@ private:
#undef MAT_TList_hxx
#undef Handle_MAT_TList
#endif // _MAT_TListNodeOfListOfEdge_HeaderFile

View File

@@ -22,15 +22,6 @@
#include <MAT_Edge.hxx>
#include <MAT_ListOfEdge.hxx>
#define Item Handle(MAT_Edge)
#define Item_hxx <MAT_Edge.hxx>
#define MAT_TListNode MAT_TListNodeOfListOfEdge
@@ -40,4 +31,3 @@
#define MAT_TList_hxx <MAT_ListOfEdge.hxx>
#define Handle_MAT_TList Handle(MAT_ListOfEdge)
#include "../MAT/MAT_TListNode.gxx"

View File

@@ -14,48 +14,42 @@
// Alternatively, this file may be used under the terms of Open CASCADE
// commercial license or contractual agreement.
#include <MAT_Arc.hxx>
#include <MAT_Node.hxx>
#include <MAT_SequenceOfArc.hxx>
#include <MAT_Zone.hxx>
#include <Standard_Type.hxx>
IMPLEMENT_STANDARD_RTTIEXT(MAT_Zone,Standard_Transient)
IMPLEMENT_STANDARD_RTTIEXT(MAT_Zone, Standard_Transient)
//========================================================================
// function:
// purpose :
//========================================================================
MAT_Zone::MAT_Zone ()
: limited(Standard_True)
//=================================================================================================
MAT_Zone::MAT_Zone()
: limited(Standard_True)
{
}
//========================================================================
// function:
// purpose :
//========================================================================
MAT_Zone::MAT_Zone(const Handle(MAT_BasicElt)& aBasicElt)
//=================================================================================================
MAT_Zone::MAT_Zone(const Handle(MAT_BasicElt)& aBasicElt)
{
Perform (aBasicElt);
Perform(aBasicElt);
}
//========================================================================
// function: Perform
// purpose :
//========================================================================
void MAT_Zone::Perform (const Handle(MAT_BasicElt)& aBasicElt)
//=================================================================================================
void MAT_Zone::Perform(const Handle(MAT_BasicElt)& aBasicElt)
{
Handle (MAT_Node) NextNode, StartNode;
Handle (MAT_Arc) CurrentArc;
Handle(MAT_Node) NextNode, StartNode;
Handle(MAT_Arc) CurrentArc;
limited = Standard_True;
frontier.Clear();
// ------------------------------------------------------------------------
// Si le premier arc correspondant a la zone est Null => Sequence vide.
// ------------------------------------------------------------------------
if (aBasicElt->EndArc().IsNull()) return;
if (aBasicElt->EndArc().IsNull())
return;
// ----------------------------
// Angle rentrant => Zone Vide.
@@ -68,11 +62,11 @@ void MAT_Zone::Perform (const Handle(MAT_BasicElt)& aBasicElt)
CurrentArc = aBasicElt->EndArc();
frontier.Append(CurrentArc);
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// Determination du premier noeud qui permet de construire la zone en tournant
// surla gauche.
// --------------------------------------------------------------------------
NextNode = NodeForTurn(CurrentArc,aBasicElt,MAT_Left);
NextNode = NodeForTurn(CurrentArc, aBasicElt, MAT_Left);
StartNode = CurrentArc->TheOtherNode(NextNode);
// -------------------------------------------------------------------------
@@ -82,105 +76,102 @@ void MAT_Zone::Perform (const Handle(MAT_BasicElt)& aBasicElt)
// (Ces deux cas correspondent a des noeuds pendants.)
// - retour sur l arc de depart si le basicElt est ferme.
// -------------------------------------------------------------------------
while (!NextNode->PendingNode() && (NextNode != StartNode)) {
CurrentArc = CurrentArc->Neighbour(NextNode,MAT_Left);
while (!NextNode->PendingNode() && (NextNode != StartNode))
{
CurrentArc = CurrentArc->Neighbour(NextNode, MAT_Left);
frontier.Append(CurrentArc);
NextNode = CurrentArc->TheOtherNode(NextNode);
NextNode = CurrentArc->TheOtherNode(NextNode);
}
// -----------------------------------------------------------------------
// Si NextNode est a l infini : exploration du graph a partir du StartArc
// Si NextNode est a l infini : exploration du graph a partir du StartArc
// sur <aBasicElt>.
// exploration sur les arcs voisins a droite.
// Sinon => Fin.
// -----------------------------------------------------------------------
if (NextNode->Infinite()) {
if (NextNode->Infinite())
{
limited = Standard_False;
CurrentArc = aBasicElt->StartArc();
CurrentArc = aBasicElt->StartArc();
frontier.Append(CurrentArc);
// --------------------------------------------------------------------------
// Determination du premier noeud qui permet de construire la zone en
//tournan surla droite.
// Determination du premier noeud qui permet de construire la zone en
// tournan surla droite.
// --------------------------------------------------------------------------
NextNode = NodeForTurn(CurrentArc,aBasicElt,MAT_Right);
NextNode = NodeForTurn(CurrentArc, aBasicElt, MAT_Right);
// -----------------------------------------------------
// Cette branche est aussi terminee par un noeud infini.
// -----------------------------------------------------
while (!NextNode->Infinite()) {
CurrentArc = CurrentArc->Neighbour(NextNode,MAT_Right);
while (!NextNode->Infinite())
{
CurrentArc = CurrentArc->Neighbour(NextNode, MAT_Right);
frontier.Append(CurrentArc);
NextNode = CurrentArc->TheOtherNode(NextNode);
NextNode = CurrentArc->TheOtherNode(NextNode);
}
}
}
//========================================================================
// function: NumberOfArcs
// purpose :
//========================================================================
Standard_Integer MAT_Zone::NumberOfArcs()const
//=================================================================================================
Standard_Integer MAT_Zone::NumberOfArcs() const
{
return frontier.Length();
}
//========================================================================
// function: ArcOnFrontier
// purpose :
//========================================================================
Handle(MAT_Arc) MAT_Zone::ArcOnFrontier(const Standard_Integer Index)const
//=================================================================================================
Handle(MAT_Arc) MAT_Zone::ArcOnFrontier(const Standard_Integer Index) const
{
return frontier.Value(Index);
}
//========================================================================
// function: NoEmptyZone
// purpose :
//========================================================================
Standard_Boolean MAT_Zone::NoEmptyZone()const
//=================================================================================================
Standard_Boolean MAT_Zone::NoEmptyZone() const
{
return (!frontier.IsEmpty());
return (!frontier.IsEmpty());
}
//========================================================================
// function: Limited
// purpose :
//========================================================================
Standard_Boolean MAT_Zone::Limited()const
//=================================================================================================
Standard_Boolean MAT_Zone::Limited() const
{
return limited;
return limited;
}
//========================================================================
// function:
// purpose :
//========================================================================
Handle(MAT_Node) MAT_Zone::NodeForTurn (const Handle(MAT_Arc)& anArc,
const Handle(MAT_BasicElt)& aBE,
const MAT_Side aSide)
const
//=================================================================================================
Handle(MAT_Node) MAT_Zone::NodeForTurn(const Handle(MAT_Arc)& anArc,
const Handle(MAT_BasicElt)& aBE,
const MAT_Side aSide) const
{
Handle(MAT_Arc) NeighbourArc;
Handle(MAT_Node) NodeSol ;
Handle(MAT_Node) NodeSol;
NodeSol = anArc->FirstNode();
NeighbourArc = anArc->Neighbour(NodeSol,aSide);
if (NeighbourArc.IsNull()) {
NeighbourArc = anArc->Neighbour(NodeSol, aSide);
if (NeighbourArc.IsNull())
{
NodeSol = anArc->SecondNode();
NeighbourArc = anArc->Neighbour(NodeSol,aSide);
NeighbourArc = anArc->Neighbour(NodeSol, aSide);
}
if (NeighbourArc.IsNull()) {
if (NeighbourArc.IsNull())
{
return NodeSol;
}
if (NeighbourArc->FirstElement() == aBE) {
if (NeighbourArc->FirstElement() == aBE)
{
return NodeSol;
}
else if (NeighbourArc->SecondElement() == aBE) {
else if (NeighbourArc->SecondElement() == aBE)
{
return NodeSol;
}
else {
else
{
return anArc->TheOtherNode(NodeSol);
}
}

View File

@@ -28,11 +28,9 @@ class MAT_BasicElt;
class MAT_Arc;
class MAT_Node;
class MAT_Zone;
DEFINE_STANDARD_HANDLE(MAT_Zone, Standard_Transient)
//! Definition of Zone of Proximity of a BasicElt :
//! ----------------------------------------------
//! A Zone of proximity is the set of the points which are
@@ -41,54 +39,37 @@ class MAT_Zone : public Standard_Transient
{
public:
Standard_EXPORT MAT_Zone();
//! Compute the frontier of the Zone of proximity.
Standard_EXPORT MAT_Zone(const Handle(MAT_BasicElt)& aBasicElt);
//! Compute the frontier of the Zone of proximity.
Standard_EXPORT void Perform (const Handle(MAT_BasicElt)& aBasicElt);
Standard_EXPORT void Perform(const Handle(MAT_BasicElt)& aBasicElt);
//! Return the number Of Arcs On the frontier of <me>.
Standard_EXPORT Standard_Integer NumberOfArcs() const;
//! Return the Arc number <Index> on the frontier.
//! of <me>.
Standard_EXPORT Handle(MAT_Arc) ArcOnFrontier (const Standard_Integer Index) const;
Standard_EXPORT Handle(MAT_Arc) ArcOnFrontier(const Standard_Integer Index) const;
//! Return TRUE if <me> is not empty .
Standard_EXPORT Standard_Boolean NoEmptyZone() const;
//! Return TRUE if <me> is Limited.
Standard_EXPORT Standard_Boolean Limited() const;
DEFINE_STANDARD_RTTIEXT(MAT_Zone,Standard_Transient)
DEFINE_STANDARD_RTTIEXT(MAT_Zone, Standard_Transient)
protected:
private:
Standard_EXPORT Handle(MAT_Node) NodeForTurn (const Handle(MAT_Arc)& anArc, const Handle(MAT_BasicElt)& aBasicElt, const MAT_Side aSide) const;
Standard_EXPORT Handle(MAT_Node) NodeForTurn(const Handle(MAT_Arc)& anArc,
const Handle(MAT_BasicElt)& aBasicElt,
const MAT_Side aSide) const;
MAT_SequenceOfArc frontier;
Standard_Boolean limited;
Standard_Boolean limited;
};
#endif // _MAT_Zone_HeaderFile