mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-14 13:30:48 +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:
@@ -14,7 +14,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <Bisector_Bisec.hxx>
|
||||
#include <BRepMAT2d_BisectingLocus.hxx>
|
||||
#include <BRepMAT2d_Explorer.hxx>
|
||||
@@ -36,39 +35,37 @@
|
||||
#include <TColGeom2d_SequenceOfGeometry.hxx>
|
||||
#include <Geom2d_Curve.hxx>
|
||||
|
||||
static void CutSketch (MAT2d_SequenceOfSequenceOfGeometry& Figure,
|
||||
MAT2d_DataMapOfBiIntInteger& NbSect);
|
||||
|
||||
static void CutSketch(MAT2d_SequenceOfSequenceOfGeometry& Figure,
|
||||
MAT2d_DataMapOfBiIntInteger& NbSect);
|
||||
|
||||
//=============================================================================
|
||||
//function : BRepMAT2d_BisectingLocus
|
||||
//purpose : Constructeur vide.
|
||||
// function : BRepMAT2d_BisectingLocus
|
||||
// purpose : Constructeur vide.
|
||||
//=============================================================================
|
||||
BRepMAT2d_BisectingLocus::BRepMAT2d_BisectingLocus()
|
||||
: isDone(Standard_False),
|
||||
nbContours(0)
|
||||
: isDone(Standard_False),
|
||||
nbContours(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//function : Compute
|
||||
//purpose : Calcul de la carte des lieux bisecteurs sur le contour defini par
|
||||
// function : Compute
|
||||
// purpose : Calcul de la carte des lieux bisecteurs sur le contour defini par
|
||||
// <anExplo>.
|
||||
//=============================================================================
|
||||
void BRepMAT2d_BisectingLocus::Compute(BRepMAT2d_Explorer& anExplo,
|
||||
void BRepMAT2d_BisectingLocus::Compute(BRepMAT2d_Explorer& anExplo,
|
||||
const Standard_Integer IndexLine,
|
||||
const MAT_Side aSide,
|
||||
const GeomAbs_JoinType aJoinType,
|
||||
const Standard_Boolean IsOpenResult)
|
||||
{
|
||||
MAT2d_Mat2d TheMAT( IsOpenResult );
|
||||
MAT2d_Mat2d TheMAT(IsOpenResult);
|
||||
Handle(MAT_ListOfBisector) TheRoots = new MAT_ListOfBisector();
|
||||
MAT2d_SequenceOfSequenceOfGeometry Figure;
|
||||
Standard_Integer i;
|
||||
|
||||
nbSect.Clear();
|
||||
theGraph = new MAT_Graph();
|
||||
theGraph = new MAT_Graph();
|
||||
nbContours = anExplo.NumberOfContours();
|
||||
if (nbContours == 0)
|
||||
{
|
||||
@@ -78,10 +75,12 @@ void BRepMAT2d_BisectingLocus::Compute(BRepMAT2d_Explorer& anExplo,
|
||||
//---------------------------------
|
||||
// Lecture des donnees de anExplo.
|
||||
//---------------------------------
|
||||
for (i = 1; i <= anExplo.NumberOfContours(); i++) {
|
||||
TColGeom2d_SequenceOfGeometry Line;
|
||||
for (i = 1; i <= anExplo.NumberOfContours(); i++)
|
||||
{
|
||||
TColGeom2d_SequenceOfGeometry Line;
|
||||
Figure.Append(Line);
|
||||
for (anExplo.Init(i); anExplo.More(); anExplo.Next()) {
|
||||
for (anExplo.Init(i); anExplo.More(); anExplo.Next())
|
||||
{
|
||||
Figure.ChangeValue(i).Append(anExplo.Value());
|
||||
}
|
||||
}
|
||||
@@ -89,16 +88,16 @@ void BRepMAT2d_BisectingLocus::Compute(BRepMAT2d_Explorer& anExplo,
|
||||
//-----------------------
|
||||
// Decoupage des courbes.
|
||||
//-----------------------
|
||||
CutSketch(Figure,nbSect);
|
||||
CutSketch(Figure, nbSect);
|
||||
|
||||
//----------------------------------------------------------
|
||||
// Construction du circuit sur lequel est calcule la carte.
|
||||
//----------------------------------------------------------
|
||||
Handle(MAT2d_Circuit) ACircuit = new MAT2d_Circuit(aJoinType, IsOpenResult);
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 17:43:47 2002 Begin
|
||||
// ACircuit->Perform(Figure,IndexLine,(aSide == MAT_Left));
|
||||
ACircuit->Perform(Figure,anExplo.GetIsClosed(), IndexLine,(aSide == MAT_Left));
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 17:43:48 2002 End
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 17:43:47 2002 Begin
|
||||
// ACircuit->Perform(Figure,IndexLine,(aSide == MAT_Left));
|
||||
ACircuit->Perform(Figure, anExplo.GetIsClosed(), IndexLine, (aSide == MAT_Left));
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 17:43:48 2002 End
|
||||
|
||||
// -----------------------
|
||||
// Initialistion du Tool.
|
||||
@@ -115,37 +114,39 @@ void BRepMAT2d_BisectingLocus::Compute(BRepMAT2d_Explorer& anExplo,
|
||||
else
|
||||
TheMAT.CreateMat(theTool);
|
||||
|
||||
isDone = TheMAT.IsDone(); if (!isDone) return;
|
||||
isDone = TheMAT.IsDone();
|
||||
if (!isDone)
|
||||
return;
|
||||
|
||||
// ----------------------------------------------------------------
|
||||
// Recuperation du resultat de l algorithme et creation du graphe.
|
||||
// ----------------------------------------------------------------
|
||||
for (TheMAT.Init(); TheMAT.More(); TheMAT.Next()) {
|
||||
for (TheMAT.Init(); TheMAT.More(); TheMAT.Next())
|
||||
{
|
||||
TheRoots->BackAdd(TheMAT.Bisector());
|
||||
}
|
||||
|
||||
theGraph->Perform(TheMAT.SemiInfinite(),
|
||||
TheRoots,
|
||||
theTool.NumberOfItems(),
|
||||
TheMAT.NumberOfBisectors());
|
||||
TheRoots,
|
||||
theTool.NumberOfItems(),
|
||||
TheMAT.NumberOfBisectors());
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Fusion des elements de base doubles si plusieurs lignes dans Exploset.
|
||||
//-----------------------------------------------------------------------
|
||||
if (anExplo.NumberOfContours() > 1) {
|
||||
if (anExplo.NumberOfContours() > 1)
|
||||
{
|
||||
MAT_DataMapOfIntegerBasicElt NewMap;
|
||||
Standard_Integer IndexLast = 1;
|
||||
Standard_Integer IndexLast = 1;
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
// Construction de NewMap dont les elements sont ordonnes suivant les
|
||||
// lignes du contour et qui ne contient pas d element dupliques.
|
||||
// em meme temps fusion des arcs dupliques et mise a jour des noeuds.
|
||||
//-----------------------------------------------------------------------
|
||||
for ( i = 1; i <= anExplo.NumberOfContours(); i++) {
|
||||
RenumerationAndFusion(i,
|
||||
theTool.Circuit()->LineLength(i),
|
||||
IndexLast,
|
||||
NewMap);
|
||||
for (i = 1; i <= anExplo.NumberOfContours(); i++)
|
||||
{
|
||||
RenumerationAndFusion(i, theTool.Circuit()->LineLength(i), IndexLast, NewMap);
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------
|
||||
@@ -153,64 +154,63 @@ void BRepMAT2d_BisectingLocus::Compute(BRepMAT2d_Explorer& anExplo,
|
||||
// et compactage de la map des Arcs (ie Elimination des trous du a la
|
||||
// fusion d arcs ).et de celle des Nodes.
|
||||
//-----------------------------------------------------------------------
|
||||
theGraph->ChangeBasicElts(NewMap);
|
||||
theGraph->ChangeBasicElts(NewMap);
|
||||
theGraph->CompactArcs();
|
||||
theGraph->CompactNodes();
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : RenumerationAndFusion
|
||||
//purpose :
|
||||
//=============================================================================
|
||||
void BRepMAT2d_BisectingLocus::RenumerationAndFusion
|
||||
(const Standard_Integer ILine,
|
||||
const Standard_Integer LengthLine,
|
||||
Standard_Integer& IndexLast,
|
||||
MAT_DataMapOfIntegerBasicElt& NewMap)
|
||||
//=================================================================================================
|
||||
|
||||
void BRepMAT2d_BisectingLocus::RenumerationAndFusion(const Standard_Integer ILine,
|
||||
const Standard_Integer LengthLine,
|
||||
Standard_Integer& IndexLast,
|
||||
MAT_DataMapOfIntegerBasicElt& NewMap)
|
||||
{
|
||||
Standard_Integer IndFirst;
|
||||
Standard_Integer i,j;
|
||||
Standard_Integer GeomIndexArc1,GeomIndexArc2,GeomIndexArc3,GeomIndexArc4;
|
||||
Standard_Boolean MergeArc1,MergeArc2;
|
||||
Standard_Integer i, j;
|
||||
Standard_Integer GeomIndexArc1, GeomIndexArc2, GeomIndexArc3, GeomIndexArc4;
|
||||
Standard_Boolean MergeArc1, MergeArc2;
|
||||
|
||||
for ( i = 1; i <= LengthLine; i++) {
|
||||
const TColStd_SequenceOfInteger& S = theTool.Circuit()->RefToEqui(ILine,i);
|
||||
for (i = 1; i <= LengthLine; i++)
|
||||
{
|
||||
const TColStd_SequenceOfInteger& S = theTool.Circuit()->RefToEqui(ILine, i);
|
||||
|
||||
IndFirst = S.Value(1);
|
||||
NewMap.Bind(IndexLast,theGraph->ChangeBasicElt(IndFirst));
|
||||
NewMap.Bind(IndexLast, theGraph->ChangeBasicElt(IndFirst));
|
||||
IndexLast++;
|
||||
|
||||
for(j = 2; j <= S.Length(); j++){
|
||||
for (j = 2; j <= S.Length(); j++)
|
||||
{
|
||||
theGraph->FusionOfBasicElts(IndFirst,
|
||||
S.Value(j),
|
||||
MergeArc1,
|
||||
GeomIndexArc1,
|
||||
GeomIndexArc2,
|
||||
MergeArc2,
|
||||
GeomIndexArc3,
|
||||
GeomIndexArc4);
|
||||
if(MergeArc1) {
|
||||
theTool.BisecFusion(GeomIndexArc1,GeomIndexArc2);
|
||||
S.Value(j),
|
||||
MergeArc1,
|
||||
GeomIndexArc1,
|
||||
GeomIndexArc2,
|
||||
MergeArc2,
|
||||
GeomIndexArc3,
|
||||
GeomIndexArc4);
|
||||
if (MergeArc1)
|
||||
{
|
||||
theTool.BisecFusion(GeomIndexArc1, GeomIndexArc2);
|
||||
}
|
||||
if(MergeArc2) {
|
||||
theTool.BisecFusion(GeomIndexArc3,GeomIndexArc4);
|
||||
if (MergeArc2)
|
||||
{
|
||||
theTool.BisecFusion(GeomIndexArc3, GeomIndexArc4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : IsDone
|
||||
//Purpose :
|
||||
//=============================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean BRepMAT2d_BisectingLocus::IsDone() const
|
||||
{
|
||||
return isDone;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : Graph
|
||||
// function : Graph
|
||||
//
|
||||
//=============================================================================
|
||||
Handle(MAT_Graph) BRepMAT2d_BisectingLocus::Graph() const
|
||||
@@ -219,135 +219,132 @@ Handle(MAT_Graph) BRepMAT2d_BisectingLocus::Graph() const
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : NumberOfContours
|
||||
// function : NumberOfContours
|
||||
//
|
||||
//=============================================================================
|
||||
Standard_Integer BRepMAT2d_BisectingLocus::NumberOfContours () const
|
||||
Standard_Integer BRepMAT2d_BisectingLocus::NumberOfContours() const
|
||||
{
|
||||
return nbContours;
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : NumberOfElts
|
||||
// function : NumberOfElts
|
||||
//
|
||||
//=============================================================================
|
||||
Standard_Integer BRepMAT2d_BisectingLocus::NumberOfElts
|
||||
(const Standard_Integer IndLine) const
|
||||
Standard_Integer BRepMAT2d_BisectingLocus::NumberOfElts(const Standard_Integer IndLine) const
|
||||
{
|
||||
return theTool.Circuit()->LineLength(IndLine);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : NumberOfSect
|
||||
// function : NumberOfSect
|
||||
//
|
||||
//=============================================================================
|
||||
Standard_Integer BRepMAT2d_BisectingLocus::NumberOfSections
|
||||
(const Standard_Integer IndLine,
|
||||
const Standard_Integer Index )
|
||||
const
|
||||
Standard_Integer BRepMAT2d_BisectingLocus::NumberOfSections(const Standard_Integer IndLine,
|
||||
const Standard_Integer Index) const
|
||||
{
|
||||
MAT2d_BiInt B(IndLine,Index);
|
||||
MAT2d_BiInt B(IndLine, Index);
|
||||
return nbSect(B);
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : BasicElt
|
||||
// function : BasicElt
|
||||
//
|
||||
//=============================================================================
|
||||
Handle(MAT_BasicElt) BRepMAT2d_BisectingLocus::BasicElt
|
||||
(const Standard_Integer IndLine,
|
||||
const Standard_Integer Index )
|
||||
const
|
||||
Handle(MAT_BasicElt) BRepMAT2d_BisectingLocus::BasicElt(const Standard_Integer IndLine,
|
||||
const Standard_Integer Index) const
|
||||
{
|
||||
Standard_Integer i;
|
||||
Standard_Integer Ind = Index;
|
||||
|
||||
for (i = 1 ; i < IndLine ; i++){
|
||||
for (i = 1; i < IndLine; i++)
|
||||
{
|
||||
Ind = Ind + theTool.Circuit()->LineLength(i);
|
||||
}
|
||||
return theGraph->BasicElt(Ind);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//function : GeomBis
|
||||
// function : GeomBis
|
||||
//
|
||||
//=============================================================================
|
||||
Bisector_Bisec BRepMAT2d_BisectingLocus::GeomBis (const Handle(MAT_Arc)& anArc,
|
||||
Standard_Boolean& Reverse)
|
||||
const
|
||||
Bisector_Bisec BRepMAT2d_BisectingLocus::GeomBis(const Handle(MAT_Arc)& anArc,
|
||||
Standard_Boolean& Reverse) const
|
||||
{
|
||||
Reverse = Standard_False;
|
||||
|
||||
Handle(Geom2d_Curve) Bis (theTool.GeomBis(anArc->GeomIndex()).Value());
|
||||
Handle(Geom2d_Curve) Bis(theTool.GeomBis(anArc->GeomIndex()).Value());
|
||||
|
||||
if (Bis->FirstParameter() <= -Precision::Infinite()) {
|
||||
if (Bis->FirstParameter() <= -Precision::Infinite())
|
||||
{
|
||||
Reverse = Standard_True;
|
||||
}
|
||||
else if (Bis->LastParameter() < Precision::Infinite()) {
|
||||
else if (Bis->LastParameter() < Precision::Infinite())
|
||||
{
|
||||
gp_Pnt2d PF = Bis->Value(Bis->FirstParameter());
|
||||
gp_Pnt2d PL = Bis->Value(Bis->LastParameter());
|
||||
gp_Pnt2d PNode = GeomElt(anArc->FirstNode());
|
||||
if (PNode.SquareDistance(PF) > PNode.SquareDistance(PL))
|
||||
if (PNode.SquareDistance(PF) > PNode.SquareDistance(PL))
|
||||
Reverse = Standard_True;
|
||||
}
|
||||
return theTool.GeomBis(anArc->GeomIndex());
|
||||
}
|
||||
|
||||
//=============================================================================
|
||||
//function : GeomElt
|
||||
// function : GeomElt
|
||||
//
|
||||
//=============================================================================
|
||||
Handle(Geom2d_Geometry) BRepMAT2d_BisectingLocus::GeomElt
|
||||
(const Handle(MAT_BasicElt)& aBasicElt) const
|
||||
Handle(Geom2d_Geometry) BRepMAT2d_BisectingLocus::GeomElt(
|
||||
const Handle(MAT_BasicElt)& aBasicElt) const
|
||||
{
|
||||
return theTool.GeomElt(aBasicElt->GeomIndex());
|
||||
return theTool.GeomElt(aBasicElt->GeomIndex());
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//function : GeomElt
|
||||
// function : GeomElt
|
||||
//
|
||||
//=============================================================================
|
||||
gp_Pnt2d BRepMAT2d_BisectingLocus::GeomElt(const Handle(MAT_Node)& aNode) const
|
||||
gp_Pnt2d BRepMAT2d_BisectingLocus::GeomElt(const Handle(MAT_Node)& aNode) const
|
||||
{
|
||||
return theTool.GeomPnt(aNode->GeomIndex());
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
//function : CutSketch
|
||||
// function : CutSketch
|
||||
//
|
||||
//=============================================================================
|
||||
static void CutSketch (MAT2d_SequenceOfSequenceOfGeometry& Figure,
|
||||
MAT2d_DataMapOfBiIntInteger& NbSect)
|
||||
static void CutSketch(MAT2d_SequenceOfSequenceOfGeometry& Figure,
|
||||
MAT2d_DataMapOfBiIntInteger& NbSect)
|
||||
{
|
||||
MAT2d_CutCurve Cuter;
|
||||
Standard_Integer i,j,k,ico;
|
||||
Standard_Integer i, j, k, ico;
|
||||
Standard_Integer ICurveInit;
|
||||
Standard_Integer NbSection;
|
||||
|
||||
for ( i = 1; i <= Figure.Length(); i++) {
|
||||
TColGeom2d_SequenceOfGeometry& Contour = Figure.ChangeValue(i);
|
||||
ICurveInit = 0;
|
||||
for (i = 1; i <= Figure.Length(); i++)
|
||||
{
|
||||
TColGeom2d_SequenceOfGeometry& Contour = Figure.ChangeValue(i);
|
||||
ICurveInit = 0;
|
||||
|
||||
for ( j = 1; j <= Contour.Length(); j++) {
|
||||
for (j = 1; j <= Contour.Length(); j++)
|
||||
{
|
||||
ICurveInit++;
|
||||
Cuter.Perform(Handle(Geom2d_Curve)::DownCast(Contour.ChangeValue(j)));
|
||||
NbSection = 1;
|
||||
if (!Cuter.UnModified()) {
|
||||
ico = j;
|
||||
NbSection = Cuter.NbCurves();
|
||||
for ( k = 1; k <= NbSection; k++) {
|
||||
Contour.InsertAfter(j,Cuter.Value(k));
|
||||
j++;
|
||||
}
|
||||
Contour.Remove(ico);
|
||||
j--;
|
||||
if (!Cuter.UnModified())
|
||||
{
|
||||
ico = j;
|
||||
NbSection = Cuter.NbCurves();
|
||||
for (k = 1; k <= NbSection; k++)
|
||||
{
|
||||
Contour.InsertAfter(j, Cuter.Value(k));
|
||||
j++;
|
||||
}
|
||||
Contour.Remove(ico);
|
||||
j--;
|
||||
}
|
||||
MAT2d_BiInt B(i,ICurveInit);
|
||||
NbSect.Bind(B,NbSection);
|
||||
MAT2d_BiInt B(i, ICurveInit);
|
||||
NbSect.Bind(B, NbSection);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -36,7 +36,6 @@ class MAT_Node;
|
||||
class Bisector_Bisec;
|
||||
class MAT_Arc;
|
||||
|
||||
|
||||
//! BisectingLocus generates and contains the Bisecting_Locus
|
||||
//! of a set of lines from Geom2d, defined by <ExploSet>.
|
||||
//!
|
||||
@@ -71,87 +70,76 @@ class MAT_Arc;
|
||||
//! the figure described by the Explorer from BRepMAT2d.
|
||||
//! - The Arcs correspond to the bisectors.
|
||||
//! - The Nodes are the extremities of the arcs.
|
||||
class BRepMAT2d_BisectingLocus
|
||||
class BRepMAT2d_BisectingLocus
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT BRepMAT2d_BisectingLocus();
|
||||
|
||||
|
||||
//! Computation of the Bisector_Locus in a set of Lines
|
||||
//! defined in <anExplo>.
|
||||
//! The bisecting locus are computed on the side <aSide>
|
||||
//! from the line <LineIndex> in <anExplo>.
|
||||
Standard_EXPORT void Compute (BRepMAT2d_Explorer& anExplo, const Standard_Integer LineIndex = 1, const MAT_Side aSide = MAT_Left, const GeomAbs_JoinType aJoinType = GeomAbs_Arc, const Standard_Boolean IsOpenResult = Standard_False);
|
||||
|
||||
Standard_EXPORT void Compute(BRepMAT2d_Explorer& anExplo,
|
||||
const Standard_Integer LineIndex = 1,
|
||||
const MAT_Side aSide = MAT_Left,
|
||||
const GeomAbs_JoinType aJoinType = GeomAbs_Arc,
|
||||
const Standard_Boolean IsOpenResult = Standard_False);
|
||||
|
||||
//! Returns True if Compute has succeeded.
|
||||
Standard_EXPORT Standard_Boolean IsDone() const;
|
||||
|
||||
|
||||
//! Returns <theGraph> of <me>.
|
||||
Standard_EXPORT Handle(MAT_Graph) Graph() const;
|
||||
|
||||
|
||||
//! Returns the number of contours.
|
||||
Standard_EXPORT Standard_Integer NumberOfContours() const;
|
||||
|
||||
|
||||
//! Returns the number of BasicElts on the line
|
||||
//! <IndLine>.
|
||||
Standard_EXPORT Standard_Integer NumberOfElts (const Standard_Integer IndLine) const;
|
||||
|
||||
Standard_EXPORT Standard_Integer NumberOfElts(const Standard_Integer IndLine) const;
|
||||
|
||||
//! Returns the number of sections of a curve.
|
||||
//! this curve is the Indexth curve in the IndLineth contour
|
||||
//! given by anExplo.
|
||||
Standard_EXPORT Standard_Integer NumberOfSections (const Standard_Integer IndLine, const Standard_Integer Index) const;
|
||||
|
||||
Standard_EXPORT Standard_Integer NumberOfSections(const Standard_Integer IndLine,
|
||||
const Standard_Integer Index) const;
|
||||
|
||||
//! Returns the BasicElts located at the position
|
||||
//! <Index> on the contour designed by <IndLine>.
|
||||
//! Remark: the BasicElts on a contour are sorted.
|
||||
Standard_EXPORT Handle(MAT_BasicElt) BasicElt (const Standard_Integer IndLine, const Standard_Integer Index) const;
|
||||
|
||||
Standard_EXPORT Handle(MAT_BasicElt) BasicElt(const Standard_Integer IndLine,
|
||||
const Standard_Integer Index) const;
|
||||
|
||||
//! Returns the geometry linked to the <BasicElt>.
|
||||
Standard_EXPORT Handle(Geom2d_Geometry) GeomElt (const Handle(MAT_BasicElt)& aBasicElt) const;
|
||||
|
||||
Standard_EXPORT Handle(Geom2d_Geometry) GeomElt(const Handle(MAT_BasicElt)& aBasicElt) const;
|
||||
|
||||
//! Returns the geometry of type <gp> linked to
|
||||
//! the <Node>.
|
||||
Standard_EXPORT gp_Pnt2d GeomElt (const Handle(MAT_Node)& aNode) const;
|
||||
|
||||
Standard_EXPORT gp_Pnt2d GeomElt(const Handle(MAT_Node)& aNode) const;
|
||||
|
||||
//! Returns the geometry of type <Bissec>
|
||||
//! linked to the arc <ARC>.
|
||||
//! <Reverse> is False when the FirstNode of <anArc>
|
||||
//! correspond to the first point of geometry.
|
||||
Standard_EXPORT Bisector_Bisec GeomBis (const Handle(MAT_Arc)& anArc, Standard_Boolean& Reverse) const;
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT Bisector_Bisec GeomBis(const Handle(MAT_Arc)& anArc,
|
||||
Standard_Boolean& Reverse) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT void Fusion();
|
||||
|
||||
Standard_EXPORT void RenumerationAndFusion (const Standard_Integer IndexLine, const Standard_Integer LengthLine, Standard_Integer& IndexLast, MAT_DataMapOfIntegerBasicElt& NewMap);
|
||||
|
||||
Standard_EXPORT void RenumerationAndFusion(const Standard_Integer IndexLine,
|
||||
const Standard_Integer LengthLine,
|
||||
Standard_Integer& IndexLast,
|
||||
MAT_DataMapOfIntegerBasicElt& NewMap);
|
||||
|
||||
Handle(MAT_Graph) theGraph;
|
||||
MAT2d_Tool2d theTool;
|
||||
Standard_Boolean isDone;
|
||||
Handle(MAT_Graph) theGraph;
|
||||
MAT2d_Tool2d theTool;
|
||||
Standard_Boolean isDone;
|
||||
MAT2d_DataMapOfBiIntInteger nbSect;
|
||||
Standard_Integer nbContours;
|
||||
|
||||
|
||||
Standard_Integer nbContours;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BRepMAT2d_BisectingLocus_HeaderFile
|
||||
|
@@ -11,7 +11,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#ifndef BRepMAT2d_DataMapIteratorOfDataMapOfBasicEltShape_HeaderFile
|
||||
#define BRepMAT2d_DataMapIteratorOfDataMapOfBasicEltShape_HeaderFile
|
||||
|
||||
|
@@ -11,7 +11,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#ifndef BRepMAT2d_DataMapIteratorOfDataMapOfShapeSequenceOfBasicElt_HeaderFile
|
||||
#define BRepMAT2d_DataMapIteratorOfDataMapOfShapeSequenceOfBasicElt_HeaderFile
|
||||
|
||||
|
@@ -21,8 +21,8 @@
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
typedef NCollection_DataMap<Handle(MAT_BasicElt),TopoDS_Shape> BRepMAT2d_DataMapOfBasicEltShape;
|
||||
typedef NCollection_DataMap<Handle(MAT_BasicElt),TopoDS_Shape>::Iterator BRepMAT2d_DataMapIteratorOfDataMapOfBasicEltShape;
|
||||
|
||||
typedef NCollection_DataMap<Handle(MAT_BasicElt), TopoDS_Shape> BRepMAT2d_DataMapOfBasicEltShape;
|
||||
typedef NCollection_DataMap<Handle(MAT_BasicElt), TopoDS_Shape>::Iterator
|
||||
BRepMAT2d_DataMapIteratorOfDataMapOfBasicEltShape;
|
||||
|
||||
#endif
|
||||
|
@@ -22,8 +22,9 @@
|
||||
#include <TopTools_ShapeMapHasher.hxx>
|
||||
#include <NCollection_DataMap.hxx>
|
||||
|
||||
typedef NCollection_DataMap<TopoDS_Shape,MAT_SequenceOfBasicElt,TopTools_ShapeMapHasher> BRepMAT2d_DataMapOfShapeSequenceOfBasicElt;
|
||||
typedef NCollection_DataMap<TopoDS_Shape,MAT_SequenceOfBasicElt,TopTools_ShapeMapHasher>::Iterator BRepMAT2d_DataMapIteratorOfDataMapOfShapeSequenceOfBasicElt;
|
||||
|
||||
typedef NCollection_DataMap<TopoDS_Shape, MAT_SequenceOfBasicElt, TopTools_ShapeMapHasher>
|
||||
BRepMAT2d_DataMapOfShapeSequenceOfBasicElt;
|
||||
typedef NCollection_DataMap<TopoDS_Shape, MAT_SequenceOfBasicElt, TopTools_ShapeMapHasher>::Iterator
|
||||
BRepMAT2d_DataMapIteratorOfDataMapOfShapeSequenceOfBasicElt;
|
||||
|
||||
#endif
|
||||
|
@@ -14,7 +14,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <BRepBuilderAPI_MakeFace.hxx>
|
||||
@@ -47,54 +46,48 @@
|
||||
|
||||
//
|
||||
// Modified by Sergey KHROMOV - Thu Dec 5 10:38:14 2002 Begin
|
||||
static TopoDS_Edge MakeEdge(const Handle(Geom2d_Curve) &theCurve,
|
||||
const TopoDS_Face &theFace,
|
||||
const TopoDS_Vertex &theVFirst,
|
||||
const TopoDS_Vertex &theVLast);
|
||||
static TopoDS_Edge MakeEdge(const Handle(Geom2d_Curve)& theCurve,
|
||||
const TopoDS_Face& theFace,
|
||||
const TopoDS_Vertex& theVFirst,
|
||||
const TopoDS_Vertex& theVLast);
|
||||
// Modified by Sergey KHROMOV - Thu Dec 5 10:38:16 2002 End
|
||||
//
|
||||
static GeomAbs_CurveType GetCurveType(const Handle(Geom2d_Curve)& theC2d);
|
||||
static Handle(Geom2d_TrimmedCurve) AdjustCurveEnd (const Handle(Geom2d_BoundedCurve)& theC2d,
|
||||
const gp_Pnt2d theP, const Standard_Boolean isFirst);
|
||||
static GeomAbs_CurveType GetCurveType(const Handle(Geom2d_Curve)& theC2d);
|
||||
static Handle(Geom2d_TrimmedCurve) AdjustCurveEnd(const Handle(Geom2d_BoundedCurve)& theC2d,
|
||||
const gp_Pnt2d theP,
|
||||
const Standard_Boolean isFirst);
|
||||
|
||||
//
|
||||
//=======================================================================
|
||||
//function : BRepMAT2d_Explorer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
BRepMAT2d_Explorer::BRepMAT2d_Explorer()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepMAT2d_Explorer
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
BRepMAT2d_Explorer::BRepMAT2d_Explorer(const TopoDS_Face& aFace)
|
||||
{
|
||||
Perform (aFace);
|
||||
Perform(aFace);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BRepMAT2d_Explorer::Perform(const TopoDS_Face& aFace)
|
||||
{
|
||||
Clear();
|
||||
myShape = aFace;
|
||||
TopoDS_Face F = TopoDS::Face(aFace);
|
||||
myShape = aFace;
|
||||
TopoDS_Face F = TopoDS::Face(aFace);
|
||||
F.Orientation(TopAbs_FORWARD);
|
||||
TopExp_Explorer Exp (F,TopAbs_WIRE);
|
||||
TopExp_Explorer Exp(F, TopAbs_WIRE);
|
||||
// Modified by Sergey KHROMOV - Tue Nov 26 16:10:37 2002 Begin
|
||||
Handle(Geom_Surface) aSurf = BRep_Tool::Surface(F);
|
||||
TopoDS_Face aNewF = BRepBuilderAPI_MakeFace(aSurf, Precision::Confusion());
|
||||
|
||||
while (Exp.More()) {
|
||||
Add (TopoDS::Wire (Exp.Current()),F, aNewF);
|
||||
while (Exp.More())
|
||||
{
|
||||
Add(TopoDS::Wire(Exp.Current()), F, aNewF);
|
||||
Exp.Next();
|
||||
}
|
||||
|
||||
@@ -105,20 +98,17 @@ void BRepMAT2d_Explorer::Perform(const TopoDS_Face& aFace)
|
||||
// Modified by Sergey KHROMOV - Tue Nov 26 16:10:38 2002 End
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine,
|
||||
const TopoDS_Face& aFace,
|
||||
TopoDS_Face& aNewFace)
|
||||
{
|
||||
const TopoDS_Face& aFace,
|
||||
TopoDS_Face& aNewFace)
|
||||
{
|
||||
// Modified by skv - Wed Jun 23 12:23:01 2004 Integration Begin
|
||||
// Taking into account side of bisecting loci construction.
|
||||
// TopoDS_Wire aWFwd = TopoDS::Wire(Spine.Oriented(TopAbs_FORWARD));
|
||||
// BRepTools_WireExplorer anExp(aWFwd, aFace);
|
||||
BRepTools_WireExplorer anExp(Spine, aFace);
|
||||
BRepTools_WireExplorer anExp(Spine, aFace);
|
||||
// Modified by skv - Wed Jun 23 12:23:02 2004 Integration End
|
||||
TopTools_IndexedDataMapOfShapeShape anOldNewE;
|
||||
if (!anExp.More())
|
||||
@@ -131,8 +121,8 @@ void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine,
|
||||
myIsClosed(currentContour) = (Spine.Closed()) ? Standard_True : Standard_False;
|
||||
|
||||
TopoDS_Edge aFirstEdge = anExp.Current();
|
||||
TopoDS_Edge aPrevEdge = aFirstEdge;
|
||||
Standard_Real UFirst,ULast, aD;
|
||||
TopoDS_Edge aPrevEdge = aFirstEdge;
|
||||
Standard_Real UFirst, ULast, aD;
|
||||
Handle(Geom2d_Curve) C2d;
|
||||
Handle(Geom2d_TrimmedCurve) CT2d;
|
||||
Handle(Geom2d_TrimmedCurve) aFirstCurve;
|
||||
@@ -142,14 +132,14 @@ void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine,
|
||||
// Modified by skv - Mon Jul 11 19:00:25 2005 Integration Begin
|
||||
// Set the confusion tolerance in accordance with the further algo
|
||||
// Standard_Real aTolConf = Precision::Confusion();
|
||||
Standard_Real aTolConf = 1.e-8;
|
||||
Standard_Real aTolConf = 1.e-8;
|
||||
// Modified by skv - Mon Jul 11 19:00:25 2005 Integration End
|
||||
Standard_Boolean isModif = Standard_False;
|
||||
Standard_Boolean isModif = Standard_False;
|
||||
|
||||
// Treatment of the first edge of a wire.
|
||||
anOldNewE.Add(aFirstEdge, aFirstEdge);
|
||||
C2d = BRep_Tool::CurveOnSurface (aFirstEdge, aFace, UFirst, ULast);
|
||||
CT2d = new Geom2d_TrimmedCurve(C2d,UFirst,ULast);
|
||||
C2d = BRep_Tool::CurveOnSurface(aFirstEdge, aFace, UFirst, ULast);
|
||||
CT2d = new Geom2d_TrimmedCurve(C2d, UFirst, ULast);
|
||||
|
||||
if (aFirstEdge.Orientation() == TopAbs_REVERSED)
|
||||
CT2d->Reverse();
|
||||
@@ -162,20 +152,22 @@ void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine,
|
||||
anExp.Next();
|
||||
|
||||
// Treatment of the next edges:
|
||||
for (; anExp.More(); anExp.Next()) {
|
||||
const TopoDS_Edge& anEdge = anExp.Current();
|
||||
for (; anExp.More(); anExp.Next())
|
||||
{
|
||||
const TopoDS_Edge& anEdge = anExp.Current();
|
||||
|
||||
anOldNewE.Add(anEdge, anEdge);
|
||||
C2d = BRep_Tool::CurveOnSurface (anEdge, aFace, UFirst, ULast);
|
||||
CT2d = new Geom2d_TrimmedCurve(C2d,UFirst,ULast);
|
||||
C2d = BRep_Tool::CurveOnSurface(anEdge, aFace, UFirst, ULast);
|
||||
CT2d = new Geom2d_TrimmedCurve(C2d, UFirst, ULast);
|
||||
|
||||
if (anEdge.Orientation() == TopAbs_REVERSED)
|
||||
CT2d->Reverse();
|
||||
|
||||
aPCurFirst = CT2d->Value(CT2d->FirstParameter());
|
||||
//
|
||||
aD=aPLast.Distance(aPCurFirst);
|
||||
if (aD > aTolConf) {
|
||||
aD = aPLast.Distance(aPCurFirst);
|
||||
if (aD > aTolConf)
|
||||
{
|
||||
// There are two ways how to fill holes:
|
||||
// First, to create a line between these two points.
|
||||
// Second, create a BSpline curve and to add the last point of the previous
|
||||
@@ -184,24 +176,24 @@ void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine,
|
||||
// code should be rewritten.
|
||||
isModif = Standard_True;
|
||||
//
|
||||
Standard_Integer aNbC = theCurves.Value(currentContour).Length();
|
||||
Handle(Geom2d_BoundedCurve) CPrev =
|
||||
Handle(Geom2d_BoundedCurve)::DownCast(theCurves.ChangeValue(currentContour).ChangeValue(aNbC));
|
||||
Standard_Integer aNbC = theCurves.Value(currentContour).Length();
|
||||
Handle(Geom2d_BoundedCurve) CPrev = Handle(Geom2d_BoundedCurve)::DownCast(
|
||||
theCurves.ChangeValue(currentContour).ChangeValue(aNbC));
|
||||
//
|
||||
GeomAbs_CurveType TCPrev = GetCurveType(CPrev);
|
||||
GeomAbs_CurveType TCCurr = GetCurveType(CT2d);
|
||||
//
|
||||
if(TCCurr <= TCPrev)
|
||||
if (TCCurr <= TCPrev)
|
||||
{
|
||||
CT2d = AdjustCurveEnd (CT2d, aPLast, Standard_True);
|
||||
CT2d = AdjustCurveEnd(CT2d, aPLast, Standard_True);
|
||||
// Creation of new edge.
|
||||
TopoDS_Edge aNewEdge;
|
||||
TopoDS_Edge aNewEdge;
|
||||
TopoDS_Vertex aVf = TopExp::FirstVertex(anEdge);
|
||||
TopoDS_Vertex aVl = TopExp::LastVertex(anEdge);
|
||||
|
||||
if (anEdge.Orientation() == TopAbs_FORWARD)
|
||||
aNewEdge = MakeEdge(CT2d, aNewFace, aVf, aVl);
|
||||
else
|
||||
else
|
||||
aNewEdge = MakeEdge(CT2d->Reversed(), aNewFace, aVf, aVl);
|
||||
|
||||
aNewEdge.Orientation(anEdge.Orientation());
|
||||
@@ -211,24 +203,22 @@ void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine,
|
||||
else
|
||||
{
|
||||
gp_Pnt2d aP = CT2d->Value(CT2d->FirstParameter());
|
||||
CPrev = AdjustCurveEnd(CPrev, aP, Standard_False);
|
||||
CPrev = AdjustCurveEnd(CPrev, aP, Standard_False);
|
||||
theCurves.ChangeValue(currentContour).ChangeValue(aNbC) = CPrev;
|
||||
//Change previous edge
|
||||
TopoDS_Edge aNewEdge;
|
||||
// Change previous edge
|
||||
TopoDS_Edge aNewEdge;
|
||||
TopoDS_Vertex aVf = TopExp::FirstVertex(aPrevEdge);
|
||||
TopoDS_Vertex aVl = TopExp::LastVertex(aPrevEdge);
|
||||
|
||||
if (aPrevEdge.Orientation() == TopAbs_FORWARD)
|
||||
aNewEdge = MakeEdge(CPrev, aNewFace, aVf, aVl);
|
||||
else
|
||||
else
|
||||
aNewEdge = MakeEdge(CPrev->Reversed(), aNewFace, aVf, aVl);
|
||||
|
||||
aNewEdge.Orientation(aPrevEdge.Orientation());
|
||||
|
||||
anOldNewE.ChangeFromKey(aPrevEdge) = aNewEdge;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
aPLast = CT2d->Value(CT2d->LastParameter());
|
||||
@@ -238,29 +228,30 @@ void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine,
|
||||
|
||||
// Check of the distance between the first and the last point of wire
|
||||
// if the wire is closed.
|
||||
if (myIsClosed(currentContour) && aPLast.Distance(aPFirst) > aTolConf) {
|
||||
if (myIsClosed(currentContour) && aPLast.Distance(aPFirst) > aTolConf)
|
||||
{
|
||||
isModif = Standard_True;
|
||||
|
||||
//
|
||||
Standard_Integer aNbC = theCurves.Value(currentContour).Length();
|
||||
Handle(Geom2d_BoundedCurve) CPrev =
|
||||
Handle(Geom2d_BoundedCurve)::DownCast(theCurves.ChangeValue(currentContour).ChangeValue(aNbC));
|
||||
//
|
||||
//
|
||||
Standard_Integer aNbC = theCurves.Value(currentContour).Length();
|
||||
Handle(Geom2d_BoundedCurve) CPrev = Handle(Geom2d_BoundedCurve)::DownCast(
|
||||
theCurves.ChangeValue(currentContour).ChangeValue(aNbC));
|
||||
//
|
||||
GeomAbs_CurveType TCPrev = GetCurveType(CPrev);
|
||||
GeomAbs_CurveType TCCurr = GetCurveType(aFirstCurve);
|
||||
//
|
||||
if(TCCurr <= TCPrev)
|
||||
if (TCCurr <= TCPrev)
|
||||
{
|
||||
aFirstCurve = AdjustCurveEnd(aFirstCurve, aPLast, Standard_True);
|
||||
theCurves.ChangeValue(currentContour).ChangeValue(1) = aFirstCurve;
|
||||
// Creation of new edge.
|
||||
TopoDS_Edge aNewEdge;
|
||||
TopoDS_Edge aNewEdge;
|
||||
TopoDS_Vertex aVf = TopExp::FirstVertex(aFirstEdge);
|
||||
TopoDS_Vertex aVl = TopExp::LastVertex(aFirstEdge);
|
||||
|
||||
if (aFirstEdge.Orientation() == TopAbs_FORWARD)
|
||||
aNewEdge = MakeEdge(aFirstCurve, aNewFace, aVf, aVl);
|
||||
else
|
||||
else
|
||||
aNewEdge = MakeEdge(aFirstCurve->Reversed(), aNewFace, aVf, aVl);
|
||||
|
||||
aNewEdge.Orientation(aFirstEdge.Orientation());
|
||||
@@ -270,38 +261,38 @@ void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine,
|
||||
else
|
||||
{
|
||||
gp_Pnt2d aP = aFirstCurve->Value(aFirstCurve->FirstParameter());
|
||||
CPrev = AdjustCurveEnd(CPrev, aP, Standard_False);
|
||||
CPrev = AdjustCurveEnd(CPrev, aP, Standard_False);
|
||||
theCurves.ChangeValue(currentContour).ChangeValue(aNbC) = CPrev;
|
||||
//Change previous edge
|
||||
TopoDS_Edge aNewEdge;
|
||||
// Change previous edge
|
||||
TopoDS_Edge aNewEdge;
|
||||
TopoDS_Vertex aVf = TopExp::FirstVertex(aPrevEdge);
|
||||
TopoDS_Vertex aVl = TopExp::LastVertex(aPrevEdge);
|
||||
|
||||
if (aPrevEdge.Orientation() == TopAbs_FORWARD)
|
||||
aNewEdge = MakeEdge(CPrev, aNewFace, aVf, aVl);
|
||||
else
|
||||
else
|
||||
aNewEdge = MakeEdge(CPrev->Reversed(), aNewFace, aVf, aVl);
|
||||
|
||||
aNewEdge.Orientation(aPrevEdge.Orientation());
|
||||
|
||||
anOldNewE.ChangeFromKey(aPrevEdge) = aNewEdge;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
TopoDS_Wire aNewWire;
|
||||
BRep_Builder aBuilder;
|
||||
|
||||
if (isModif) {
|
||||
if (isModif)
|
||||
{
|
||||
Standard_Integer i;
|
||||
Standard_Integer aNbEdges = anOldNewE.Extent();
|
||||
|
||||
aBuilder.MakeWire(aNewWire);
|
||||
|
||||
for (i = 1; i <= aNbEdges; i++) {
|
||||
const TopoDS_Shape &aKey = anOldNewE.FindKey(i);
|
||||
const TopoDS_Shape &aNewEdge = anOldNewE.FindFromIndex(i);
|
||||
for (i = 1; i <= aNbEdges; i++)
|
||||
{
|
||||
const TopoDS_Shape& aKey = anOldNewE.FindKey(i);
|
||||
const TopoDS_Shape& aNewEdge = anOldNewE.FindFromIndex(i);
|
||||
|
||||
aBuilder.Add(aNewWire, aNewEdge);
|
||||
myModifShapes.Add(aKey, aNewEdge);
|
||||
@@ -315,17 +306,15 @@ void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine,
|
||||
// aNewWire.Orientation(Spine.Orientation());
|
||||
// Modified by skv - Fri Nov 12 17:22:12 2004 Integration End
|
||||
myModifShapes.Add(Spine, aNewWire);
|
||||
} else
|
||||
}
|
||||
else
|
||||
aNewWire = Spine;
|
||||
|
||||
aBuilder.Add(aNewFace, aNewWire);
|
||||
// Modified by Sergey KHROMOV - Tue Nov 26 14:25:53 2002 End
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : CheckConnection
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
// Modified by Sergey KHROMOV - Tue Nov 26 17:21:44 2002 Begin
|
||||
// void BRepMAT2d_Explorer::CheckConnection()
|
||||
@@ -343,20 +332,18 @@ void BRepMAT2d_Explorer::Add(const TopoDS_Wire& Spine,
|
||||
// else
|
||||
// BCurve = Handle( Geom2d_BSplineCurve )::DownCast( theCurves(i)(j) );
|
||||
// BCurve->SetPole( 1, P1 );
|
||||
// theCurves(i)(j) = new Geom2d_TrimmedCurve( BCurve, BCurve->FirstParameter(), BCurve->LastParameter() );
|
||||
// theCurves(i)(j) = new Geom2d_TrimmedCurve( BCurve, BCurve->FirstParameter(),
|
||||
// BCurve->LastParameter() );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// Modified by Sergey KHROMOV - Tue Nov 26 17:21:29 2002 End
|
||||
|
||||
//=======================================================================
|
||||
//function : Clear
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BRepMAT2d_Explorer::Clear()
|
||||
{
|
||||
theCurves.Clear() ;
|
||||
{
|
||||
theCurves.Clear();
|
||||
currentContour = 0;
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 16:07:55 2002 Begin
|
||||
myIsClosed.Clear();
|
||||
@@ -364,137 +351,91 @@ void BRepMAT2d_Explorer::Clear()
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 16:07:55 2002 End
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : NewContour
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BRepMAT2d_Explorer::NewContour()
|
||||
{
|
||||
{
|
||||
TColGeom2d_SequenceOfCurve Contour;
|
||||
theCurves.Append(Contour);
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 16:12:05 2002 Begin
|
||||
myIsClosed.Append(Standard_False);
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 16:12:05 2002 End
|
||||
currentContour ++ ;
|
||||
currentContour++;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Add
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BRepMAT2d_Explorer::Add(const Handle(Geom2d_Curve)& aCurve)
|
||||
{
|
||||
{
|
||||
theCurves.ChangeValue(currentContour).Append(aCurve);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : NumberOfContours
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Integer BRepMAT2d_Explorer::NumberOfContours() const
|
||||
{
|
||||
return theCurves.Length() ;
|
||||
Standard_Integer BRepMAT2d_Explorer::NumberOfContours() const
|
||||
{
|
||||
return theCurves.Length();
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : NumberOfCurves
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Integer BRepMAT2d_Explorer::NumberOfCurves
|
||||
(const Standard_Integer IndexContour)
|
||||
const
|
||||
{
|
||||
Standard_Integer BRepMAT2d_Explorer::NumberOfCurves(const Standard_Integer IndexContour) const
|
||||
{
|
||||
return theCurves.Value(IndexContour).Length();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BRepMAT2d_Explorer::Init(const Standard_Integer IndexContour)
|
||||
{
|
||||
{
|
||||
currentContour = IndexContour;
|
||||
current = 1;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : More
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepMAT2d_Explorer::More() const
|
||||
{
|
||||
Standard_Boolean BRepMAT2d_Explorer::More() const
|
||||
{
|
||||
return (current <= NumberOfCurves(currentContour));
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Next
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BRepMAT2d_Explorer::Next()
|
||||
{
|
||||
{
|
||||
current++;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(Geom2d_Curve) BRepMAT2d_Explorer::Value() const
|
||||
{
|
||||
Handle(Geom2d_Curve) BRepMAT2d_Explorer::Value() const
|
||||
{
|
||||
return theCurves.Value(currentContour).Value(current);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : Shape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
TopoDS_Shape BRepMAT2d_Explorer::Shape() const
|
||||
{
|
||||
return myShape;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : Contour
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
const TColGeom2d_SequenceOfCurve& BRepMAT2d_Explorer::Contour
|
||||
(const Standard_Integer IC)
|
||||
const
|
||||
const TColGeom2d_SequenceOfCurve& BRepMAT2d_Explorer::Contour(const Standard_Integer IC) const
|
||||
{
|
||||
return theCurves.Value(IC);
|
||||
}
|
||||
|
||||
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 17:40:07 2002 Begin
|
||||
//=======================================================================
|
||||
//function : IsModified
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
Standard_Boolean BRepMAT2d_Explorer::IsModified
|
||||
(const TopoDS_Shape &aShape) const
|
||||
Standard_Boolean BRepMAT2d_Explorer::IsModified(const TopoDS_Shape& aShape) const
|
||||
{
|
||||
if (myModifShapes.Contains(aShape)) {
|
||||
const TopoDS_Shape &aNewShape = myModifShapes.FindFromKey(aShape);
|
||||
const Standard_Boolean isSame = aNewShape.IsSame(aShape);
|
||||
if (myModifShapes.Contains(aShape))
|
||||
{
|
||||
const TopoDS_Shape& aNewShape = myModifShapes.FindFromKey(aShape);
|
||||
const Standard_Boolean isSame = aNewShape.IsSame(aShape);
|
||||
|
||||
return !isSame;
|
||||
}
|
||||
@@ -502,16 +443,13 @@ Standard_Boolean BRepMAT2d_Explorer::IsModified
|
||||
return Standard_False;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : ModifiedShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
TopoDS_Shape BRepMAT2d_Explorer::ModifiedShape
|
||||
(const TopoDS_Shape &aShape) const
|
||||
TopoDS_Shape BRepMAT2d_Explorer::ModifiedShape(const TopoDS_Shape& aShape) const
|
||||
{
|
||||
if (myModifShapes.Contains(aShape)) {
|
||||
const TopoDS_Shape &aNewShape = myModifShapes.FindFromKey(aShape);
|
||||
if (myModifShapes.Contains(aShape))
|
||||
{
|
||||
const TopoDS_Shape& aNewShape = myModifShapes.FindFromKey(aShape);
|
||||
|
||||
return aNewShape;
|
||||
}
|
||||
@@ -519,31 +457,28 @@ TopoDS_Shape BRepMAT2d_Explorer::ModifiedShape
|
||||
return aShape;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GetIsClosed
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
const TColStd_SequenceOfBoolean &BRepMAT2d_Explorer::GetIsClosed() const
|
||||
const TColStd_SequenceOfBoolean& BRepMAT2d_Explorer::GetIsClosed() const
|
||||
{
|
||||
return myIsClosed;
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : MakeEdge
|
||||
//purpose : Creation of an edge by 2d curve, face and two vertices.
|
||||
// function : MakeEdge
|
||||
// purpose : Creation of an edge by 2d curve, face and two vertices.
|
||||
//=======================================================================
|
||||
|
||||
TopoDS_Edge MakeEdge(const Handle(Geom2d_Curve) &theCurve,
|
||||
const TopoDS_Face &theFace,
|
||||
const TopoDS_Vertex &theVFirst,
|
||||
const TopoDS_Vertex &theVLast)
|
||||
TopoDS_Edge MakeEdge(const Handle(Geom2d_Curve)& theCurve,
|
||||
const TopoDS_Face& theFace,
|
||||
const TopoDS_Vertex& theVFirst,
|
||||
const TopoDS_Vertex& theVLast)
|
||||
{
|
||||
TopoDS_Edge aNewEdge;
|
||||
BRep_Builder aBuilder;
|
||||
TopoDS_Edge aNewEdge;
|
||||
BRep_Builder aBuilder;
|
||||
constexpr Standard_Real aTol = Precision::Confusion();
|
||||
Standard_Real aFPar = theCurve->FirstParameter();
|
||||
Standard_Real aLPar = theCurve->LastParameter();
|
||||
Standard_Real aFPar = theCurve->FirstParameter();
|
||||
Standard_Real aLPar = theCurve->LastParameter();
|
||||
|
||||
aBuilder.MakeEdge(aNewEdge);
|
||||
aBuilder.UpdateEdge(aNewEdge, theCurve, theFace, aTol);
|
||||
@@ -553,62 +488,73 @@ TopoDS_Edge MakeEdge(const Handle(Geom2d_Curve) &theCurve,
|
||||
|
||||
return aNewEdge;
|
||||
}
|
||||
|
||||
// Modified by Sergey KHROMOV - Wed Mar 6 17:40:14 2002 End
|
||||
//
|
||||
//=======================================================================
|
||||
//function : GetCurveType
|
||||
//purpose : Get curve type.
|
||||
// function : GetCurveType
|
||||
// purpose : Get curve type.
|
||||
//=======================================================================
|
||||
|
||||
GeomAbs_CurveType GetCurveType(const Handle(Geom2d_Curve)& theC2d)
|
||||
{
|
||||
GeomAbs_CurveType aTypeCurve = GeomAbs_OtherCurve;
|
||||
Handle(Standard_Type) TheType = theC2d->DynamicType();
|
||||
if ( TheType == STANDARD_TYPE(Geom2d_TrimmedCurve)) {
|
||||
TheType = Handle(Geom2d_TrimmedCurve)::DownCast (theC2d)->BasisCurve()->DynamicType();
|
||||
GeomAbs_CurveType aTypeCurve = GeomAbs_OtherCurve;
|
||||
Handle(Standard_Type) TheType = theC2d->DynamicType();
|
||||
if (TheType == STANDARD_TYPE(Geom2d_TrimmedCurve))
|
||||
{
|
||||
TheType = Handle(Geom2d_TrimmedCurve)::DownCast(theC2d)->BasisCurve()->DynamicType();
|
||||
}
|
||||
|
||||
if ( TheType == STANDARD_TYPE(Geom2d_Circle)) {
|
||||
if (TheType == STANDARD_TYPE(Geom2d_Circle))
|
||||
{
|
||||
aTypeCurve = GeomAbs_Circle;
|
||||
}
|
||||
else if ( TheType ==STANDARD_TYPE(Geom2d_Line)) {
|
||||
else if (TheType == STANDARD_TYPE(Geom2d_Line))
|
||||
{
|
||||
aTypeCurve = GeomAbs_Line;
|
||||
}
|
||||
else if ( TheType == STANDARD_TYPE(Geom2d_Ellipse)) {
|
||||
else if (TheType == STANDARD_TYPE(Geom2d_Ellipse))
|
||||
{
|
||||
aTypeCurve = GeomAbs_Ellipse;
|
||||
}
|
||||
else if ( TheType == STANDARD_TYPE(Geom2d_Parabola)) {
|
||||
else if (TheType == STANDARD_TYPE(Geom2d_Parabola))
|
||||
{
|
||||
aTypeCurve = GeomAbs_Parabola;
|
||||
}
|
||||
else if ( TheType == STANDARD_TYPE(Geom2d_Hyperbola)) {
|
||||
else if (TheType == STANDARD_TYPE(Geom2d_Hyperbola))
|
||||
{
|
||||
aTypeCurve = GeomAbs_Hyperbola;
|
||||
}
|
||||
else if ( TheType == STANDARD_TYPE(Geom2d_BezierCurve)) {
|
||||
else if (TheType == STANDARD_TYPE(Geom2d_BezierCurve))
|
||||
{
|
||||
aTypeCurve = GeomAbs_BezierCurve;
|
||||
}
|
||||
else if ( TheType == STANDARD_TYPE(Geom2d_BSplineCurve)) {
|
||||
else if (TheType == STANDARD_TYPE(Geom2d_BSplineCurve))
|
||||
{
|
||||
aTypeCurve = GeomAbs_BSplineCurve;
|
||||
}
|
||||
else if ( TheType == STANDARD_TYPE(Geom2d_OffsetCurve)) {
|
||||
else if (TheType == STANDARD_TYPE(Geom2d_OffsetCurve))
|
||||
{
|
||||
aTypeCurve = GeomAbs_OffsetCurve;
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
aTypeCurve = GeomAbs_OtherCurve;
|
||||
}
|
||||
return aTypeCurve;
|
||||
return aTypeCurve;
|
||||
}
|
||||
//=======================================================================
|
||||
//function : AdjustCurveEnd
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
Handle(Geom2d_TrimmedCurve) AdjustCurveEnd (const Handle(Geom2d_BoundedCurve)& theC2d,
|
||||
const gp_Pnt2d theP, const Standard_Boolean isFirst)
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
Handle(Geom2d_TrimmedCurve) AdjustCurveEnd(const Handle(Geom2d_BoundedCurve)& theC2d,
|
||||
const gp_Pnt2d theP,
|
||||
const Standard_Boolean isFirst)
|
||||
{
|
||||
GeomAbs_CurveType aType = GetCurveType(theC2d);
|
||||
if(aType == GeomAbs_Line)
|
||||
if (aType == GeomAbs_Line)
|
||||
{
|
||||
//create new line
|
||||
if(isFirst)
|
||||
// create new line
|
||||
if (isFirst)
|
||||
{
|
||||
gp_Pnt2d aP = theC2d->Value(theC2d->LastParameter());
|
||||
return GCE2d_MakeSegment(theP, aP);
|
||||
@@ -621,21 +567,18 @@ Handle(Geom2d_TrimmedCurve) AdjustCurveEnd (const Handle(Geom2d_BoundedCurve)& t
|
||||
}
|
||||
else
|
||||
{
|
||||
//Convert to BSpline and adjust first pole
|
||||
Handle(Geom2d_BSplineCurve) BCurve =
|
||||
// Convert to BSpline and adjust first pole
|
||||
Handle(Geom2d_BSplineCurve) BCurve =
|
||||
Geom2dConvert::CurveToBSplineCurve(theC2d, Convert_QuasiAngular);
|
||||
if(isFirst)
|
||||
if (isFirst)
|
||||
{
|
||||
BCurve->SetPole(1, theP);
|
||||
return new Geom2d_TrimmedCurve(BCurve, BCurve->FirstParameter(),
|
||||
BCurve->LastParameter());
|
||||
return new Geom2d_TrimmedCurve(BCurve, BCurve->FirstParameter(), BCurve->LastParameter());
|
||||
}
|
||||
else
|
||||
{
|
||||
BCurve->SetPole(BCurve->NbPoles(), theP);
|
||||
return new Geom2d_TrimmedCurve(BCurve, BCurve->FirstParameter(),
|
||||
BCurve->LastParameter());
|
||||
return new Geom2d_TrimmedCurve(BCurve, BCurve->FirstParameter(), BCurve->LastParameter());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -31,69 +31,57 @@ class TopoDS_Face;
|
||||
class TopoDS_Wire;
|
||||
class Geom2d_Curve;
|
||||
|
||||
|
||||
//! Construct an explorer from wires, face, set of curves
|
||||
//! from Geom2d to compute the bisecting Locus.
|
||||
class BRepMAT2d_Explorer
|
||||
class BRepMAT2d_Explorer
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT BRepMAT2d_Explorer();
|
||||
|
||||
|
||||
Standard_EXPORT BRepMAT2d_Explorer(const TopoDS_Face& aFace);
|
||||
|
||||
|
||||
//! Clear the contents of <me>.
|
||||
Standard_EXPORT void Clear();
|
||||
|
||||
Standard_EXPORT void Perform (const TopoDS_Face& aFace);
|
||||
|
||||
|
||||
Standard_EXPORT void Perform(const TopoDS_Face& aFace);
|
||||
|
||||
//! Returns the Number of contours.
|
||||
Standard_EXPORT Standard_Integer NumberOfContours() const;
|
||||
|
||||
|
||||
//! Returns the Number of Curves in the Contour number
|
||||
//! <IndexContour>.
|
||||
Standard_EXPORT Standard_Integer NumberOfCurves (const Standard_Integer IndexContour) const;
|
||||
|
||||
Standard_EXPORT Standard_Integer NumberOfCurves(const Standard_Integer IndexContour) const;
|
||||
|
||||
//! Initialisation of an Iterator on the curves of
|
||||
//! the Contour number <IndexContour>.
|
||||
Standard_EXPORT void Init (const Standard_Integer IndexContour);
|
||||
|
||||
Standard_EXPORT void Init(const Standard_Integer IndexContour);
|
||||
|
||||
//! Return False if there is no more curves on the Contour
|
||||
//! initialised by the method Init.
|
||||
Standard_EXPORT Standard_Boolean More() const;
|
||||
|
||||
|
||||
//! Move to the next curve of the current Contour.
|
||||
Standard_EXPORT void Next();
|
||||
|
||||
|
||||
//! Returns the current curve on the current Contour.
|
||||
Standard_EXPORT Handle(Geom2d_Curve) Value() const;
|
||||
|
||||
|
||||
Standard_EXPORT TopoDS_Shape Shape() const;
|
||||
|
||||
Standard_EXPORT const TColGeom2d_SequenceOfCurve& Contour (const Standard_Integer IndexContour) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsModified (const TopoDS_Shape& aShape) const;
|
||||
|
||||
|
||||
Standard_EXPORT const TColGeom2d_SequenceOfCurve& Contour(
|
||||
const Standard_Integer IndexContour) const;
|
||||
|
||||
Standard_EXPORT Standard_Boolean IsModified(const TopoDS_Shape& aShape) const;
|
||||
|
||||
//! If the shape is not modified, returns the shape itself.
|
||||
Standard_EXPORT TopoDS_Shape ModifiedShape (const TopoDS_Shape& aShape) const;
|
||||
|
||||
Standard_EXPORT TopoDS_Shape ModifiedShape(const TopoDS_Shape& aShape) const;
|
||||
|
||||
Standard_EXPORT const TColStd_SequenceOfBoolean& GetIsClosed() const;
|
||||
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
//! Construction from a set of curves from Geom2d.
|
||||
//! Assume the orientation of the closed lines are
|
||||
//! compatible. (ie if A is in B, the orientation of A and B
|
||||
@@ -112,28 +100,21 @@ private:
|
||||
//!
|
||||
//! No control of this rules is done in the construction
|
||||
//! of the explorer
|
||||
Standard_EXPORT void Add (const TopoDS_Wire& Spine, const TopoDS_Face& aFace, TopoDS_Face& aNewFace);
|
||||
|
||||
Standard_EXPORT void Add(const TopoDS_Wire& Spine,
|
||||
const TopoDS_Face& aFace,
|
||||
TopoDS_Face& aNewFace);
|
||||
|
||||
Standard_EXPORT void NewContour();
|
||||
|
||||
|
||||
//! Add the curve <aCurve> at me.
|
||||
Standard_EXPORT void Add (const Handle(Geom2d_Curve)& aCurve);
|
||||
Standard_EXPORT void Add(const Handle(Geom2d_Curve)& aCurve);
|
||||
|
||||
|
||||
MAT2d_SequenceOfSequenceOfCurve theCurves;
|
||||
Standard_Integer current;
|
||||
Standard_Integer currentContour;
|
||||
TopoDS_Shape myShape;
|
||||
TColStd_SequenceOfBoolean myIsClosed;
|
||||
MAT2d_SequenceOfSequenceOfCurve theCurves;
|
||||
Standard_Integer current;
|
||||
Standard_Integer currentContour;
|
||||
TopoDS_Shape myShape;
|
||||
TColStd_SequenceOfBoolean myIsClosed;
|
||||
TopTools_IndexedDataMapOfShapeShape myModifShapes;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BRepMAT2d_Explorer_HeaderFile
|
||||
|
@@ -14,7 +14,6 @@
|
||||
// Alternatively, this file may be used under the terms of Open CASCADE
|
||||
// commercial license or contractual agreement.
|
||||
|
||||
|
||||
#include <BRepMAT2d_BisectingLocus.hxx>
|
||||
#include <BRepMAT2d_Explorer.hxx>
|
||||
#include <BRepMAT2d_LinkTopoBilo.hxx>
|
||||
@@ -37,37 +36,26 @@
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <TopTools_SequenceOfShape.hxx>
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepMAT2d_LinkTopoBilo
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
BRepMAT2d_LinkTopoBilo::BRepMAT2d_LinkTopoBilo()
|
||||
: current(0),
|
||||
isEmpty(Standard_True)
|
||||
: current(0),
|
||||
isEmpty(Standard_True)
|
||||
{
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : BRepMAT2d_LinkTopoBilo
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
BRepMAT2d_LinkTopoBilo::BRepMAT2d_LinkTopoBilo(
|
||||
const BRepMAT2d_Explorer& Explo,
|
||||
const BRepMAT2d_BisectingLocus& BiLo)
|
||||
BRepMAT2d_LinkTopoBilo::BRepMAT2d_LinkTopoBilo(const BRepMAT2d_Explorer& Explo,
|
||||
const BRepMAT2d_BisectingLocus& BiLo)
|
||||
{
|
||||
Perform (Explo,BiLo);
|
||||
Perform(Explo, BiLo);
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : Perform
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
void BRepMAT2d_LinkTopoBilo::Perform(const BRepMAT2d_Explorer& Explo,
|
||||
const BRepMAT2d_BisectingLocus& BiLo)
|
||||
void BRepMAT2d_LinkTopoBilo::Perform(const BRepMAT2d_Explorer& Explo,
|
||||
const BRepMAT2d_BisectingLocus& BiLo)
|
||||
{
|
||||
myMap.Clear();
|
||||
myBEShape.Clear();
|
||||
@@ -75,241 +63,243 @@ void BRepMAT2d_LinkTopoBilo::Perform(const BRepMAT2d_Explorer& Explo,
|
||||
TopoDS_Shape S = Explo.Shape();
|
||||
Standard_Integer IndContour = 1;
|
||||
|
||||
if (S.ShapeType() == TopAbs_FACE) {
|
||||
TopExp_Explorer Exp (S,TopAbs_WIRE);
|
||||
|
||||
while (Exp.More()) {
|
||||
LinkToWire(TopoDS::Wire (Exp.Current()),Explo,IndContour,BiLo);
|
||||
if (S.ShapeType() == TopAbs_FACE)
|
||||
{
|
||||
TopExp_Explorer Exp(S, TopAbs_WIRE);
|
||||
|
||||
while (Exp.More())
|
||||
{
|
||||
LinkToWire(TopoDS::Wire(Exp.Current()), Explo, IndContour, BiLo);
|
||||
Exp.Next();
|
||||
IndContour++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
throw Standard_ConstructionError("BRepMAT2d_LinkTopoBilo::Perform");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Init
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BRepMAT2d_LinkTopoBilo::Init(const TopoDS_Shape& S)
|
||||
{
|
||||
isEmpty = Standard_False;
|
||||
current = 1;
|
||||
if (myMap.IsBound(S)) myKey = S; else isEmpty = Standard_True;
|
||||
if (myMap.IsBound(S))
|
||||
myKey = S;
|
||||
else
|
||||
isEmpty = Standard_True;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : More
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Standard_Boolean BRepMAT2d_LinkTopoBilo::More()
|
||||
Standard_Boolean BRepMAT2d_LinkTopoBilo::More()
|
||||
{
|
||||
if (isEmpty) return Standard_False;
|
||||
return (current <= myMap(myKey).Length());
|
||||
if (isEmpty)
|
||||
return Standard_False;
|
||||
return (current <= myMap(myKey).Length());
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : Next
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BRepMAT2d_LinkTopoBilo::Next()
|
||||
{
|
||||
current++;
|
||||
}
|
||||
|
||||
//=================================================================================================
|
||||
|
||||
//=======================================================================
|
||||
//function : Value
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
|
||||
Handle(MAT_BasicElt) BRepMAT2d_LinkTopoBilo::Value() const
|
||||
Handle(MAT_BasicElt) BRepMAT2d_LinkTopoBilo::Value() const
|
||||
{
|
||||
return myMap(myKey).Value(current);
|
||||
}
|
||||
|
||||
//=======================================================================
|
||||
//function : GeneratingShape
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
TopoDS_Shape BRepMAT2d_LinkTopoBilo::GeneratingShape
|
||||
(const Handle(MAT_BasicElt)& BE) const
|
||||
TopoDS_Shape BRepMAT2d_LinkTopoBilo::GeneratingShape(const Handle(MAT_BasicElt)& BE) const
|
||||
{
|
||||
return myBEShape(BE);
|
||||
}
|
||||
|
||||
static void LinkToContour(const BRepMAT2d_Explorer& Explo,
|
||||
const Standard_Integer IndC,
|
||||
const BRepMAT2d_BisectingLocus& BiLo,
|
||||
TColStd_DataMapOfIntegerInteger& Link);
|
||||
static void LinkToContour(const BRepMAT2d_Explorer& Explo,
|
||||
const Standard_Integer IndC,
|
||||
const BRepMAT2d_BisectingLocus& BiLo,
|
||||
TColStd_DataMapOfIntegerInteger& Link);
|
||||
|
||||
//=======================================================================
|
||||
//function : LinkToWire
|
||||
//purpose :
|
||||
//=======================================================================
|
||||
//=================================================================================================
|
||||
|
||||
void BRepMAT2d_LinkTopoBilo::LinkToWire(const TopoDS_Wire& W,
|
||||
const BRepMAT2d_Explorer& Explo,
|
||||
const Standard_Integer IndC,
|
||||
const BRepMAT2d_BisectingLocus& BiLo)
|
||||
const BRepMAT2d_Explorer& Explo,
|
||||
const Standard_Integer IndC,
|
||||
const BRepMAT2d_BisectingLocus& BiLo)
|
||||
{
|
||||
BRepTools_WireExplorer TheExp (W);
|
||||
Standard_Integer KC;
|
||||
TopoDS_Vertex VF,VL;
|
||||
TopoDS_Shape S;
|
||||
Handle(MAT_BasicElt) BE;
|
||||
Handle(Standard_Type) Type;
|
||||
TopTools_SequenceOfShape TopoSeq;
|
||||
MAT_SequenceOfBasicElt EmptySeq;
|
||||
BRepTools_WireExplorer TheExp(W);
|
||||
Standard_Integer KC;
|
||||
TopoDS_Vertex VF, VL;
|
||||
TopoDS_Shape S;
|
||||
Handle(MAT_BasicElt) BE;
|
||||
Handle(Standard_Type) Type;
|
||||
TopTools_SequenceOfShape TopoSeq;
|
||||
MAT_SequenceOfBasicElt EmptySeq;
|
||||
|
||||
TColStd_DataMapIteratorOfDataMapOfIntegerInteger Ite;
|
||||
TColStd_DataMapOfIntegerInteger LinkBECont;
|
||||
TColStd_DataMapOfIntegerInteger LinkBECont;
|
||||
|
||||
|
||||
for (;TheExp.More();TheExp.Next()) {
|
||||
for (; TheExp.More(); TheExp.Next())
|
||||
{
|
||||
TopoSeq.Append(TheExp.Current());
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------
|
||||
// Construction Links BasicElt => Curve of contour IndC.
|
||||
//-----------------------------------------------------
|
||||
LinkToContour(Explo,IndC,BiLo,LinkBECont);
|
||||
|
||||
LinkToContour(Explo, IndC, BiLo, LinkBECont);
|
||||
|
||||
//---------------------------------------------------------------
|
||||
// Iteration on BasicElts. The associated index is the same for
|
||||
// the curves of the contour and the edges. .
|
||||
//---------------------------------------------------------------
|
||||
for (Ite.Initialize(LinkBECont); Ite.More(); Ite.Next()) {
|
||||
BE = BiLo.Graph()->BasicElt(Ite.Key());
|
||||
Type = BiLo.GeomElt(BE)->DynamicType();
|
||||
KC = Ite.Value();
|
||||
S = TopoSeq.Value(Abs(KC));
|
||||
for (Ite.Initialize(LinkBECont); Ite.More(); Ite.Next())
|
||||
{
|
||||
BE = BiLo.Graph()->BasicElt(Ite.Key());
|
||||
Type = BiLo.GeomElt(BE)->DynamicType();
|
||||
KC = Ite.Value();
|
||||
S = TopoSeq.Value(Abs(KC));
|
||||
|
||||
if (Type == STANDARD_TYPE(Geom2d_CartesianPoint)) {
|
||||
if (S.Orientation() == TopAbs_REVERSED) {
|
||||
TopExp::Vertices(TopoDS::Edge(S),VL,VF);
|
||||
if (Type == STANDARD_TYPE(Geom2d_CartesianPoint))
|
||||
{
|
||||
if (S.Orientation() == TopAbs_REVERSED)
|
||||
{
|
||||
TopExp::Vertices(TopoDS::Edge(S), VL, VF);
|
||||
}
|
||||
else {
|
||||
TopExp::Vertices(TopoDS::Edge(S),VF,VL);
|
||||
else
|
||||
{
|
||||
TopExp::Vertices(TopoDS::Edge(S), VF, VL);
|
||||
}
|
||||
if (KC > 0) S = VL; else S = VF;
|
||||
if (KC > 0)
|
||||
S = VL;
|
||||
else
|
||||
S = VF;
|
||||
}
|
||||
if (!myMap.IsBound(S)) {
|
||||
myMap.Bind(S,EmptySeq);
|
||||
if (!myMap.IsBound(S))
|
||||
{
|
||||
myMap.Bind(S, EmptySeq);
|
||||
}
|
||||
myMap(S).Append(BE);
|
||||
|
||||
if (KC < 0)
|
||||
if (KC < 0)
|
||||
myBEShape.Bind(BE, S.Oriented(TopAbs::Reverse(S.Orientation())));
|
||||
else
|
||||
myBEShape.Bind(BE, S);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
//function : LinkToContour
|
||||
//purpose : Association to each basicElt of the curre of the initial
|
||||
// function : LinkToContour
|
||||
// purpose : Association to each basicElt of the curre of the initial
|
||||
// contour from which it comes.
|
||||
//=======================================================================
|
||||
|
||||
void LinkToContour (const BRepMAT2d_Explorer& Explo,
|
||||
const Standard_Integer IndC,
|
||||
const BRepMAT2d_BisectingLocus& BiLo,
|
||||
TColStd_DataMapOfIntegerInteger& Link)
|
||||
void LinkToContour(const BRepMAT2d_Explorer& Explo,
|
||||
const Standard_Integer IndC,
|
||||
const BRepMAT2d_BisectingLocus& BiLo,
|
||||
TColStd_DataMapOfIntegerInteger& Link)
|
||||
{
|
||||
Handle (MAT_BasicElt) BE;
|
||||
Handle (Geom2d_Geometry) GeomBE;
|
||||
Handle (Standard_Type) Type;
|
||||
Standard_Boolean DirectSense = Standard_True;
|
||||
Standard_Boolean LastPoint = Standard_False;
|
||||
Standard_Integer NbSect,ISect;
|
||||
Handle(MAT_BasicElt) BE;
|
||||
Handle(Geom2d_Geometry) GeomBE;
|
||||
Handle(Standard_Type) Type;
|
||||
Standard_Boolean DirectSense = Standard_True;
|
||||
Standard_Boolean LastPoint = Standard_False;
|
||||
Standard_Integer NbSect, ISect;
|
||||
|
||||
//---------------------------------------------------
|
||||
// NbSect : number of sections on the current curve.
|
||||
// ISect : Counter on sections.
|
||||
//---------------------------------------------------
|
||||
|
||||
const TColGeom2d_SequenceOfCurve& Cont = Explo.Contour(IndC);
|
||||
|
||||
const TColGeom2d_SequenceOfCurve& Cont = Explo.Contour(IndC);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//Initialization of the explorer on the first curve of the contour.
|
||||
// Initialization of the explorer on the first curve of the contour.
|
||||
//------------------------------------------------------------------
|
||||
Standard_Integer IndOnCont = 1;
|
||||
Standard_Integer PrecIndOnCont = -1;
|
||||
NbSect = BiLo.NumberOfSections(IndC,1);
|
||||
ISect = 0;
|
||||
Standard_Integer IndOnCont = 1;
|
||||
Standard_Integer PrecIndOnCont = -1;
|
||||
NbSect = BiLo.NumberOfSections(IndC, 1);
|
||||
ISect = 0;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Parsing of base elements associated to contour IndC.
|
||||
// Rq : the base elements are ordered.
|
||||
//------------------------------------------------------------------
|
||||
for (Standard_Integer i = 1; i <= BiLo.NumberOfElts(IndC); i++) {
|
||||
for (Standard_Integer i = 1; i <= BiLo.NumberOfElts(IndC); i++)
|
||||
{
|
||||
|
||||
BE = BiLo.BasicElt(IndC,i);
|
||||
GeomBE = BiLo.GeomElt (BE);
|
||||
BE = BiLo.BasicElt(IndC, i);
|
||||
GeomBE = BiLo.GeomElt(BE);
|
||||
Type = GeomBE->DynamicType();
|
||||
|
||||
if (Type != STANDARD_TYPE(Geom2d_CartesianPoint)) {
|
||||
if (Type != STANDARD_TYPE(Geom2d_CartesianPoint))
|
||||
{
|
||||
ISect++;
|
||||
//----------------------------------------------------------------
|
||||
// The base element is a curve associated with the current curve.
|
||||
//----------------------------------------------------------------
|
||||
if (DirectSense) {
|
||||
Link.Bind(BE->Index(), IndOnCont);
|
||||
if (DirectSense)
|
||||
{
|
||||
Link.Bind(BE->Index(), IndOnCont);
|
||||
}
|
||||
else {
|
||||
Link.Bind(BE->Index(), -IndOnCont);
|
||||
else
|
||||
{
|
||||
Link.Bind(BE->Index(), -IndOnCont);
|
||||
}
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
//-----------------------------------------------------------------
|
||||
// The base element is a point associated with the previous curve.
|
||||
//-----------------------------------------------------------------
|
||||
if (DirectSense || LastPoint) {
|
||||
Link.Bind(BE->Index(), PrecIndOnCont);
|
||||
if (DirectSense || LastPoint)
|
||||
{
|
||||
Link.Bind(BE->Index(), PrecIndOnCont);
|
||||
}
|
||||
else {
|
||||
Link.Bind(BE->Index(), -PrecIndOnCont);
|
||||
else
|
||||
{
|
||||
Link.Bind(BE->Index(), -PrecIndOnCont);
|
||||
}
|
||||
}
|
||||
|
||||
PrecIndOnCont = IndOnCont;
|
||||
//----------------------------------------------------------------------
|
||||
// Passage to the next curve in Explo, when all parts
|
||||
// Passage to the next curve in Explo, when all parts
|
||||
// of curves corresponding to the initial curve have been parsed.
|
||||
//---------------------------------------------------------------------
|
||||
if (Type != STANDARD_TYPE(Geom2d_CartesianPoint) && ISect == NbSect) {
|
||||
if (IndOnCont < Cont.Length() && DirectSense) {
|
||||
IndOnCont++;
|
||||
NbSect = BiLo.NumberOfSections(IndC,IndOnCont);
|
||||
ISect = 0;
|
||||
if (Type != STANDARD_TYPE(Geom2d_CartesianPoint) && ISect == NbSect)
|
||||
{
|
||||
if (IndOnCont < Cont.Length() && DirectSense)
|
||||
{
|
||||
IndOnCont++;
|
||||
NbSect = BiLo.NumberOfSections(IndC, IndOnCont);
|
||||
ISect = 0;
|
||||
}
|
||||
else {
|
||||
//-----------------------------------------------------
|
||||
// For open lines restart in the other direction.
|
||||
//-----------------------------------------------------
|
||||
if (!DirectSense) {
|
||||
IndOnCont--;
|
||||
if (IndOnCont != 0) NbSect = BiLo.NumberOfSections(IndC,IndOnCont);
|
||||
LastPoint = Standard_False;
|
||||
}
|
||||
else {
|
||||
LastPoint = Standard_True;
|
||||
}
|
||||
ISect = 0;
|
||||
DirectSense = Standard_False;
|
||||
else
|
||||
{
|
||||
//-----------------------------------------------------
|
||||
// For open lines restart in the other direction.
|
||||
//-----------------------------------------------------
|
||||
if (!DirectSense)
|
||||
{
|
||||
IndOnCont--;
|
||||
if (IndOnCont != 0)
|
||||
NbSect = BiLo.NumberOfSections(IndC, IndOnCont);
|
||||
LastPoint = Standard_False;
|
||||
}
|
||||
else
|
||||
{
|
||||
LastPoint = Standard_True;
|
||||
}
|
||||
ISect = 0;
|
||||
DirectSense = Standard_False;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -30,74 +30,57 @@ class BRepMAT2d_BisectingLocus;
|
||||
class MAT_BasicElt;
|
||||
class TopoDS_Wire;
|
||||
|
||||
|
||||
//! Constructs links between the Wire or the Face of the explorer and
|
||||
//! the BasicElts contained in the bisecting locus.
|
||||
class BRepMAT2d_LinkTopoBilo
|
||||
class BRepMAT2d_LinkTopoBilo
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
|
||||
Standard_EXPORT BRepMAT2d_LinkTopoBilo();
|
||||
|
||||
|
||||
//! Constructs the links Between S and BiLo.
|
||||
//!
|
||||
//! raises if <S> is not a face.
|
||||
Standard_EXPORT BRepMAT2d_LinkTopoBilo(const BRepMAT2d_Explorer& Explo, const BRepMAT2d_BisectingLocus& BiLo);
|
||||
|
||||
Standard_EXPORT BRepMAT2d_LinkTopoBilo(const BRepMAT2d_Explorer& Explo,
|
||||
const BRepMAT2d_BisectingLocus& BiLo);
|
||||
|
||||
//! Constructs the links Between S and BiLo.
|
||||
//!
|
||||
//! raises if <S> is not a face or a wire.
|
||||
Standard_EXPORT void Perform (const BRepMAT2d_Explorer& Explo, const BRepMAT2d_BisectingLocus& BiLo);
|
||||
|
||||
Standard_EXPORT void Perform(const BRepMAT2d_Explorer& Explo,
|
||||
const BRepMAT2d_BisectingLocus& BiLo);
|
||||
|
||||
//! Initialise the Iterator on <S>
|
||||
//! <S> is an edge or a vertex of the initial
|
||||
//! wire or face.
|
||||
//! raises if <S> is not an edge or a vertex.
|
||||
Standard_EXPORT void Init (const TopoDS_Shape& S);
|
||||
|
||||
Standard_EXPORT void Init(const TopoDS_Shape& S);
|
||||
|
||||
//! Returns True if there is a current BasicElt.
|
||||
Standard_EXPORT Standard_Boolean More();
|
||||
|
||||
|
||||
//! Proceed to the next BasicElt.
|
||||
Standard_EXPORT void Next();
|
||||
|
||||
|
||||
//! Returns the current BasicElt.
|
||||
Standard_EXPORT Handle(MAT_BasicElt) Value() const;
|
||||
|
||||
|
||||
//! Returns the Shape linked to <aBE>.
|
||||
Standard_EXPORT TopoDS_Shape GeneratingShape (const Handle(MAT_BasicElt)& aBE) const;
|
||||
|
||||
|
||||
|
||||
Standard_EXPORT TopoDS_Shape GeneratingShape(const Handle(MAT_BasicElt)& aBE) const;
|
||||
|
||||
protected:
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private:
|
||||
|
||||
|
||||
Standard_EXPORT void LinkToWire (const TopoDS_Wire& W, const BRepMAT2d_Explorer& Explo, const Standard_Integer IndexContour, const BRepMAT2d_BisectingLocus& BiLo);
|
||||
|
||||
Standard_EXPORT void LinkToWire(const TopoDS_Wire& W,
|
||||
const BRepMAT2d_Explorer& Explo,
|
||||
const Standard_Integer IndexContour,
|
||||
const BRepMAT2d_BisectingLocus& BiLo);
|
||||
|
||||
BRepMAT2d_DataMapOfShapeSequenceOfBasicElt myMap;
|
||||
BRepMAT2d_DataMapOfBasicEltShape myBEShape;
|
||||
TopoDS_Shape myKey;
|
||||
Standard_Integer current;
|
||||
Standard_Boolean isEmpty;
|
||||
|
||||
|
||||
BRepMAT2d_DataMapOfBasicEltShape myBEShape;
|
||||
TopoDS_Shape myKey;
|
||||
Standard_Integer current;
|
||||
Standard_Boolean isEmpty;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // _BRepMAT2d_LinkTopoBilo_HeaderFile
|
||||
|
Reference in New Issue
Block a user