-// File: BRepFill_OffsetWire.cxx
-// Created: Thu Apr 20 10:33:55 1995
-// Author: Bruno DUMORTIER
-// <dub@fuegox>
+// Created on: 1995-04-20
+// Created by: Bruno DUMORTIER
+// Copyright (c) 1995-1999 Matra Datavision
+// Copyright (c) 1999-2012 OPEN CASCADE SAS
+//
+// The content of this file is subject to the Open CASCADE Technology Public
+// License Version 6.5 (the "License"). You may not use the content of this file
+// except in compliance with the License. Please obtain a copy of the License
+// at http://www.opencascade.org and read it completely before using this file.
+//
+// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
+// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+//
+// The Original Code and all software distributed under the License is
+// distributed on an "AS IS" basis, without warranty of any kind, and the
+// Initial Developer hereby disclaims all such warranties, including without
+// limitation, any warranties of merchantability, fitness for a particular
+// purpose or non-infringement. Please see the License for the specific terms
+// and conditions governing the rights and limitations under the License.
+
// Modified by skv - Fri Jul 8 11:21:38 2005 OCC9145
#include <BRepFill_DataMapOfShapeSequenceOfPnt.hxx>
#include <BRepFill_DataMapOfShapeSequenceOfReal.hxx>
#include <BRepFill_DataMapOfOrientedShapeListOfShape.hxx>
-#include <BRepFill_DataMapIteratorOfDataMapOfOrientedShapeListOfShape.hxx>
#include <BRepFill_TrimEdgeTool.hxx>
#include <BRepLib.hxx>
#include <BRepLib_MakeVertex.hxx>
const TopoDS_Vertex& V,
const TopoDS_Face& F,
const Standard_Real Offset,
- BRepFill_DataMapOfOrientedShapeListOfShape& Map,
+ BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map,
const Handle(Geom_Plane)& RefPlane);
static void MakeOffset
(const TopoDS_Edge& E,
const TopoDS_Face& F,
const Standard_Real Offset,
- BRepFill_DataMapOfOrientedShapeListOfShape& Map,
+ BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map,
const Handle(Geom_Plane)& RefPlane);
+
+
+//=======================================================================
+//function : CheckFace
+//purpose : Check if face contains an edge with C0 continuity
+//=======================================================================
+//
+static void CheckFace(const TopoDS_Face& theFace)
+ {
+ TopExp_Explorer ex(theFace,TopAbs_EDGE);
+ for(; ex.More(); ex.Next())
+ {
+ TopoDS_Edge anEdge=TopoDS::Edge(ex.Current());
+ Standard_Real f,l;
+ const Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(anEdge,theFace,f,l);
+ if (C->Continuity() == GeomAbs_C0)
+ Standard_ConstructionError::Raise("Initial shape contains an edge with C0 continuity");
+ }
+ }
+
//=======================================================================
//function : KPartCircle
//purpose :
const Standard_Real myOffset,
const Standard_Real Alt,
TopoDS_Shape& myShape,
- BRepFill_DataMapOfOrientedShapeListOfShape& myMap,
+ BRepFill_IndexedDataMapOfOrientedShapeListOfShape& myMap,
Standard_Boolean& myIsDone)
{
- // Un seul contour qui est un cercle ferme
+ // The only contour which is a closed circle
TopExp_Explorer exp(mySpine,TopAbs_EDGE);
Standard_Integer NbEdges = 0;
TopoDS_Edge E;
TopTools_ListOfShape LL;
LL.Append(myShape);
- myMap.Bind(E,LL);
+ myMap.Add(E,LL);
}
myIsDone = Standard_True;
return Standard_True;
Init(Spine,Join);
}
-
//=======================================================================
//function : Init
//purpose :
// mySpine = TopoDS::Face(Spine.Oriented(TopAbs_FORWARD));
myJoinType = Join;
+ CheckFace(mySpine);
+
myMap.Clear();
myMapSpine.Clear();
//------------------------------------------------------------------
- // decoupe du spine pour les lieux bissecteurs.
+ // cut the spine for bissectors.
//------------------------------------------------------------------
// Modified by Sergey KHROMOV - Tue Nov 26 17:39:03 2002 Begin
static BRepMAT2d_Explorer Exp;
// Modified by Sergey KHROMOV - Tue Nov 26 17:39:03 2002 End
TopoDS_Shape aShape;
- BRepFill_DataMapOfOrientedShapeListOfShape aMap;
+ BRepFill_IndexedDataMapOfOrientedShapeListOfShape aMap;
Standard_Boolean Done;
if (KPartCircle(myWorkSpine,1.,0.,aShape,aMap,Done)) return;
//-----------------------------------------------------
- // Calcul de la carte des lieux bissecteurs a gauche.
- // et des Liens Topologie -> elements de base de la carte.
+ // Calculate the map of bissectors to the left.
+ // and Links Topology -> base elements of the map.
//-----------------------------------------------------
// Modified by Sergey KHROMOV - Tue Nov 26 17:39:03 2002 Begin
{
if (!myCallGen) {
if (!myMapSpine.IsEmpty()) {
- // myMapSpine peut etre vide si on est passe par PerformWithBilo.
+ // myMapSpine can be empty if passed by PerformWithBilo.
TopTools_DataMapIteratorOfDataMapOfShapeShape it(myMapSpine);
for (; it.More(); it.Next()) {
- if (myMap.IsBound(it.Key())) {
- if (!myMap.IsBound(it.Value())) {
+ if (myMap.Contains(it.Key())) {
+ if (!myMap.Contains(it.Value())) {
TopTools_ListOfShape L;
- myMap.Bind(it.Value(),L);
+ myMap.Add(it.Value(),L);
}
if ( !it.Value().IsSame(it.Key())) {
- myMap(it.Value()).Append(myMap(it.Key()));
- myMap.UnBind(it.Key());
+ myMap.ChangeFromKey(it.Value()).Append(myMap.ChangeFromKey(it.Key()));
+ //myMap.UnBind(it.Key());
+ TopoDS_Shape LastShape = myMap.FindKey(myMap.Extent());
+ TopTools_ListOfShape LastList;
+ LastList.Append(myMap(myMap.Extent()));
+ myMap.RemoveLast();
+ if (myMap.FindIndex(it.Key()) != 0)
+ myMap.Substitute(myMap.FindIndex(it.Key()), LastShape, LastList);
}
}
- if (myMap.IsBound(it.Key().Reversed())) {
- if (!myMap.IsBound(it.Value().Reversed())) {
+ if (myMap.Contains(it.Key().Reversed())) {
+ if (!myMap.Contains(it.Value().Reversed())) {
TopTools_ListOfShape L;
- myMap.Bind(it.Value().Reversed(),L);
+ myMap.Add(it.Value().Reversed(),L);
}
if ( !it.Value().IsSame(it.Key())) {
- myMap(it.Value().Reversed()).Append(myMap(it.Key().Reversed()));
- myMap.UnBind(it.Key().Reversed());
+ myMap.ChangeFromKey(it.Value().Reversed()).Append(myMap.ChangeFromKey(it.Key().Reversed()));
+ //myMap.UnBind(it.Key().Reversed());
+ TopoDS_Shape LastShape = myMap.FindKey(myMap.Extent());
+ TopTools_ListOfShape LastList;
+ LastList.Append(myMap(myMap.Extent()));
+ myMap.RemoveLast();
+ if (myMap.FindIndex(it.Key().Reversed()) != 0)
+ myMap.Substitute(myMap.FindIndex(it.Key().Reversed()), LastShape, LastList);
}
}
}
myCallGen = Standard_True;
}
- if (myMap.IsBound(SpineShape)) {
- return myMap(SpineShape);
+ if (myMap.Contains(SpineShape)) {
+ return myMap.FindFromKey(SpineShape);
}
else {
static TopTools_ListOfShape Empty;
BRepMAT2d_BisectingLocus newBilo;
BRepMAT2d_LinkTopoBilo newLink;
newBilo.Compute(newExp,1,MAT_Left);
+
+ if(!newBilo.IsDone())
+ {
+ myShape.Nullify();
+ myIsDone = Standard_False;
+ return;
+ }
+
newLink.Perform(newExp,newBilo);
PerformWithBiLo(myWorkSpine,Offset,newBilo,newLink,myJoinType,Alt);
PerformWithBiLo(myWorkSpine,Offset,myBilo,myLink,myJoinType,Alt);
}
- } catch (Standard_Failure) {
+ }
+ catch (...)//Every exception was caught.
+ {
myShape.Nullify();
myIsDone = Standard_False;
-
+ cout<<"An exception was caught in BRepFill_OffsetWire::Perform : ";
+ Standard_Failure::Caught()->Print(cout);
+ cout<<endl;
+
return;
}
+
// Modified by skv - Fri Jul 8 11:21:38 2005 OCC9145 End
// Modified by Sergey KHROMOV - Thu Mar 14 10:48:15 2002 Begin
TopExp_Explorer anExp(myShape, TopAbs_WIRE);
void Compute (const TopoDS_Face& Spine,
TopoDS_Shape& aShape,
- BRepFill_DataMapOfOrientedShapeListOfShape& Map,
+ BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map,
const Standard_Real Alt)
{
BRep_Builder B;
TopoDS_Wire NewW = TopoDS::Wire(aLocalShape);
// TopoDS_Wire NewW = TopoDS::Wire(CurW.Moved(L));
B.Add(aShape,NewW);
- // mise a jour de la Map.
+ // update Map.
TopoDS_Iterator it1( CurW);
TopoDS_Iterator it2( NewW);
for ( ; it1.More(); it1.Next(), it2.Next()) {
TopTools_ListOfShape List;
List.Append(it2.Value());
- Map.Bind(it1.Value(), List);
+ Map.Add(it1.Value(), List);
}
}
}
}
myMap.Clear();
- //*****************************************
- // si myOffset = 0, on ne s'emmerde pas !!
- //*****************************************
if ( Abs(myOffset) < Precision::Confusion()) {
Compute(mySpine,myShape,myMap,Alt);
myIsDone = Standard_True;
return;
}
- //******************************
- // Calcul pour un offset non nul
- //******************************
+ //********************************
+ // Calculate for a non null offset
+ //********************************
if (KPartCircle(mySpine,Offset,Alt,myShape,myMap,myIsDone)) return;
BRep_Builder myBuilder;
myBuilder.MakeCompound(TopoDS::Compound(myShape));
//---------------------------------------------------------------------
- // MapNodeVertex : associe a chaque noeud de la carte (key1) et
- // a chaque element du profil (key2) un vertex (item).
- // MapBis : ensemble des edges ou vertex (item) generes par
- // une bisectrice sur une face ou un edge (key)des
- // tuyaux ou revol.
- // MapVerPar : Map des parametres des vertex sur les edges paralleles
- // la liste contenue dans MapVerPar (E) correspond aux
- // parametres sur E des vertex contenu dans MapBis(E);
+ // MapNodeVertex : associate to each node of the map (key1) and to
+ // each element of the profile (key2) a vertex (item).
+ // MapBis : all edges or vertices (item) generated by
+ // a bisectrice on a face or an edge (key) of revolution tubes.
+ // MapVerPar : Map of parameters of vertices on parallel edges
+ // the list contained in MapVerPar (E) corresponds to
+ // parameters on E of vertices contained in MapBis(E);
//---------------------------------------------------------------------
(RefPlane->Translated( ALT * gp_Vec(RefPlane->Axis().Direction() )));
//---------------------------------------------------------------
- // Construction des Cercles et des OffsetCurves
+ // Construction of Circles and OffsetCurves
//---------------------------------------------------------------
for (Standard_Integer ic = 1; ic <= Locus.NumberOfContours(); ic++) {
#ifdef DEB
if (AffichEdge) {
- cout << " Fin Construction des primitives geometriques"<<endl;
+ cout << " End Construction of geometric primitives "<<endl;
}
#endif
//---------------------------------------------------
- // Constructions des vertex de l offset.
+ // Construction of offset vertices.
//---------------------------------------------------
BRepFill_DataMapOfOrientedShapeListOfShape Detromp;
Handle(MAT_Arc) CurrentArc;
TopoDS_Shape S [2];
TopoDS_Edge E [2];
TopLoc_Location L;
- Standard_Integer k;
+ Standard_Integer j, k;
for (Standard_Integer i = 1; i <= Locus.Graph()->NumberOfArcs(); i++) {
}
#endif
- //-----------------------------------------------------------------------
- // Recuperation des elements du spine correspondant aux basicElts separes.
- //-----------------------------------------------------------------------
+ //-------------------------------------------------------------------
+ // Return elements of the spine corresponding to separate basicElts.
+ //-------------------------------------------------------------------
S [0] = Link.GeneratingShape(CurrentArc->FirstElement());
S [1] = Link.GeneratingShape(CurrentArc->SecondElement());
BRepFill_DataMapOfShapeSequenceOfPnt MapSeqPar;
//-----------------------------------------------------------
- // Recuperation des edges paralleles sur chaque face.
- // Si pas d offset generees => saut a la bissectrice suivante.
+ // Return parallel edges on each face.
+ // If no offset generated => move to the next bissectrice.
//--------------------------------------------------------------
- if (myMap.IsBound(S[0]) && myMap.IsBound(S[1])) {
- E [0] = TopoDS::Edge(myMap(S[0]).First());
- E [1] = TopoDS::Edge(myMap(S[1]).First());
+ if (myMap.Contains(S[0]) && myMap.Contains(S[1])) {
+ E [0] = TopoDS::Edge(myMap.FindFromKey(S[0]).First());
+ E [1] = TopoDS::Edge(myMap.FindFromKey(S[1]).First());
}
else continue;
//-----------------------------------------------------------
- // Construction des vertex correspondant au noeud de la carte.
- // si ils sont sur l offset.
+ // Construction of vertices corresponding to the node of the map.
+ // if they are on the offset.
//-----------------------------------------------------------
TopoDS_Vertex VS,VE;
Handle(MAT_Node) Node1, Node2;
}
//---------------------------------------------
- // Construction des geometries.
+ // Construction of geometries.
//---------------------------------------------
BRepFill_TrimEdgeTool Trim (Bisec,
Locus.GeomElt(CurrentArc->FirstElement()),
myOffset);
//-----------------------------------------------------------
- // Construction des vertex sur les edges paralleles au spine.
+ // Construction of vertices on edges parallel to the spine.
//-----------------------------------------------------------
Trim.IntersectWith(E [0], E [1], Params);
Vertices.SetValue(1,VS);
else
- // le point n avait pas ete trouve par IntersectWith
+ // the point was not found by IntersectWith
Vertices.Prepend(VS);
}
if (EndOnEdge) {
Vertices.SetValue(Params.Length(),VE);
else
- // le point n avait pas ete trouve par IntersectWith
+ // the point was not found by IntersectWith
Vertices.Append(VE);
}
//------------------------------------------------------------
- // Mise a jour Detromp.
- // Detromp permetra de supprimer les vertex sur l offset
- // correspondant a des zones de tangences
- // dans Detromp sont ranges les vertex qui limitent
- // les portions de la bissectrices situes entre le spine et
- // l offset.
+ // Update Detromp.
+ // Detromp allows to remove vertices on the offset
+ // corresponding to tangency zones
+ // Detromp ranks the vertices that limit
+ // the parts of the bissectrices located between the spine and the
+ // offset.
//------------------------------------------------------------
if (!Detromp.IsBound(S[0])) Detromp.Bind(S[0],EmptyList);
if (!Detromp.IsBound(S[1])) Detromp.Bind(S[1],EmptyList);
UpdateDetromp (Detromp(S[0]), Detromp(S[1]), Vertices, Params,
Bisec, StartOnEdge, EndOnEdge, Trim);
//----------------------------------------------
- // Stockage des vertex sur les edges paralleles.
- // on remplit MapBis et MapVerPar.
+ // Storage of vertices on parallel edges.
+ // fill MapBis and MapVerPar.
//----------------------------------------------
if (!Vertices.IsEmpty()) {
for (k = 0; k <= 1; k++) {
}
else {
//------------------------------------------------------------
- //POUR LES CERCLES COMPLETS . la parallele peut etre contenue
- // dans la zone sans intersection avec la frontiere
- // pas d intersection
- // si myoffset est < distance des noeuds la parallele peut etre
- // valide.
+ // FOR COMPLETE CIRCLES. the parallel line can be contained
+ // in the zone without intersection with the border
+ // no intersection
+ // if myoffset is < distance of nodes the parallel can be valid.
//-------------------------------------------------------------
for (k = 0; k <= 1; k++) {
if (!MapBis.IsBound(E[k])) {
#ifdef DEB
if (AffichEdge) {
- cout << " Fin Construction des vertex sur les offsets"<<endl;
+ cout << " End Construction of vertices on offsets"<<endl;
}
#endif
//----------------------------------
- // Construction des edges paralleles.
+ // Construction of parallel edges.
//----------------------------------
TopTools_IndexedDataMapOfShapeShape MapVV;
TopoDS_Shape CurrentSpine;
- BRepFill_DataMapIteratorOfDataMapOfOrientedShapeListOfShape ite1;
+ //BRepFill_DataMapIteratorOfDataMapOfOrientedShapeListOfShape ite1;
- for (ite1.Initialize(myMap); ite1.More(); ite1.Next()) {
- CurrentSpine = ite1.Key();
- CurrentEdge = TopoDS::Edge(myMap(CurrentSpine).First());
+ for (j = 1; j <= myMap.Extent(); j++) {
+ CurrentSpine = myMap.FindKey(j);
+ CurrentEdge = TopoDS::Edge(myMap(j).First());
- myMap(CurrentSpine).Clear();
+ myMap(j).Clear();
if (MapBis.IsBound(CurrentEdge)) {
TopTools_SequenceOfShape S;
if (!MapBis(CurrentEdge).IsEmpty()) {
MapVerPar(CurrentEdge) ,
S, MapVV);
for ( k = 1; k <= S.Length(); k++) {
- myMap(CurrentSpine).Append(S.Value(k));
+ myMap(j).Append(S.Value(k));
}
}
else {
//-----------------
- // Cercles complets
+ // Complete circles
//-----------------
- myMap(CurrentSpine).Append(CurrentEdge);
+ myMap(j).Append(CurrentEdge);
}
}
}
LV.Append( NewV.Oriented(TopAbs_FORWARD) );
BRepTools_Substitution aSubst;
aSubst.Substitute( OldV, LV );
- for (ite1.Initialize(myMap); ite1.More(); ite1.Next())
+ for (j = 1; j <= myMap.Extent(); j++)
{
- TopTools_ListIteratorOfListOfShape itl(ite1.Value());
+ TopTools_ListIteratorOfListOfShape itl(myMap(j));
for (; itl.More(); itl.Next())
{
aSubst.Build(itl.Value());
if (aSubst.IsCopied(itl.Value()))
{
const TopTools_ListOfShape& listSh = aSubst.Copy(itl.Value());
+ TopAbs_Orientation SaveOr = itl.Value().Orientation();
itl.Value() = listSh.First();
+ itl.Value().Orientation(SaveOr);
}
}
}
}
//----------------------------------
- // Constructions des wires offset.
+ // Construction of offset wires.
//----------------------------------
MakeWires ();
- // Mise a jour des vertex ( Construits dans le plan Z = 0) !!!
+ // Update vertices ( Constructed in the plane Z = 0) !!!
TopTools_MapOfShape MapVertex;
for ( TopExp_Explorer exp(myShape,TopAbs_VERTEX); exp.More(); exp.Next()) {
TopoDS_Vertex V = TopoDS::Vertex(exp.Current());
}
}
- // Constructions des courbes 3d.
+ // Construction of curves 3d.
BRepLib::BuildCurves3d(myShape);
MapVertex.Clear();
TopExp_Explorer Explo( myShape, TopAbs_EDGE );
//purpose :
//=======================================================================
-BRepFill_DataMapOfOrientedShapeListOfShape&
+BRepFill_IndexedDataMapOfOrientedShapeListOfShape&
BRepFill_OffsetWire::Generated()
{
return myMap;
myMapSpine.Bind(V2,V2);
Cuts.Clear();
- // Decoupe
+ // Cut
TopoDS_Shape aLocalShape = E.Oriented(TopAbs_FORWARD);
// Modified by Sergey KHROMOV - Thu Nov 16 17:29:29 2000 Begin
if (nbEdges == 2 && nbResEdges == 0)
void BRepFill_OffsetWire::MakeWires()
{
//--------------------------------------------------------
- // creation d une liste unique des edges paralelles crees.
+ // creation of a single list of created parallel edges.
//--------------------------------------------------------
TopTools_SequenceOfShape TheEdges;
TopTools_ListOfShape TheWires;
TopTools_ListIteratorOfListOfShape itl;
- BRepFill_DataMapIteratorOfDataMapOfOrientedShapeListOfShape ite;
- TopTools_DataMapOfShapeListOfShape MVE;
- TopTools_DataMapIteratorOfDataMapOfShapeListOfShape MVEit;
+ //BRepFill_DataMapIteratorOfDataMapOfOrientedShapeListOfShape ite;
+ TopTools_IndexedDataMapOfShapeListOfShape MVE;
+ //TopTools_DataMapIteratorOfDataMapOfShapeListOfShape MVEit;
TopoDS_Vertex V1,V2,VF,CV;
+ Standard_Integer i;
- for (ite.Initialize(myMap); ite.More(); ite.Next()) {
- for (itl.Initialize(ite.Value()); itl.More(); itl.Next()) {
+ for (i = 1; i <= myMap.Extent(); i++) {
+ for (itl.Initialize(myMap(i)); itl.More(); itl.Next()) {
const TopoDS_Edge& E = TopoDS::Edge(itl.Value());
TopExp::Vertices (E,V1,V2);
if (V1.IsSame(V2) && IsSmallClosedEdge(E, V1))
continue; //remove small closed edges
- if (!MVE.IsBound(V1)) {
+ if (!MVE.Contains(V1)) {
TopTools_ListOfShape empty;
- MVE.Bind(V1,empty);
+ MVE.Add(V1,empty);
}
- MVE(V1).Append(E);
- if (!MVE.IsBound(V2)) {
+ MVE.ChangeFromKey(V1).Append(E);
+ if (!MVE.Contains(V2)) {
TopTools_ListOfShape empty;
- MVE.Bind(V2,empty);
+ MVE.Add(V2,empty);
}
- MVE(V2).Append(E);
+ MVE.ChangeFromKey(V2).Append(E);
}
}
//--------------------------------------
- // Creation des wires paralleles.
+ // Creation of parallel wires.
//--------------------------------------
BRep_Builder B;
while (!MVE.IsEmpty()) {
B.MakeWire(NW);
- MVEit.Initialize(MVE);
- for(; MVEit.More(); MVEit.Next()) {
- if(MVEit.Value().Extent() == 1) break;
- }
+ //MVEit.Initialize(MVE);
+ for (i = 1; i <= MVE.Extent(); i++)
+ if(MVE(i).Extent() == 1)
+ break;
- if(!MVEit.More()) MVEit.Initialize(MVE);
+ //if(!MVEit.More()) MVEit.Initialize(MVE);
+ if (i > MVE.Extent())
+ i = 1;
- CV = VF = TopoDS::Vertex(MVEit.Key());
- CE = TopoDS::Edge(MVEit.Value().First());
+ CV = VF = TopoDS::Vertex(MVE.FindKey(i));
+ CE = TopoDS::Edge(MVE(i).First());
End = Standard_False;
- MVE(CV).RemoveFirst();
+ MVE.ChangeFromKey(CV).RemoveFirst();
// Modified by Sergey KHROMOV - Thu Mar 14 11:29:59 2002 Begin
Standard_Boolean isClosed = Standard_False;
while(!End) {
//-------------------------------
- // Construction d un wire.
+ // Construction of a wire.
//-------------------------------
TopExp::Vertices(CE,V1,V2);
if (!CV.IsSame(V1)) CV = V1; else CV = V2;
B.Add (NW,CE);
- if (VF.IsSame(CV) || !MVE.IsBound(CV)) {
+ if (VF.IsSame(CV) || !MVE.Contains(CV)) {
// Modified by Sergey KHROMOV - Thu Mar 14 11:30:14 2002 Begin
isClosed = VF.IsSame(CV);
// Modified by Sergey KHROMOV - Thu Mar 14 11:30:15 2002 End
End = Standard_True;
- MVE.UnBind(VF);
+ //MVE.UnBind(VF);
+ TopoDS_Shape LastShape = MVE.FindKey(MVE.Extent());
+ TopTools_ListOfShape LastList;
+ LastList.Append(MVE(MVE.Extent()));
+ MVE.RemoveLast();
+ if (MVE.FindIndex(VF) != 0)
+ MVE.Substitute(MVE.FindIndex(VF), LastShape, LastList);
}
if (!End) {
- if (MVE(CV).Extent() > 2) {
- //cout <<"vertex sur plus de 2 edges dans une face."<<endl;
+ if (MVE.FindFromKey(CV).Extent() > 2) {
+ //cout <<"vertex on more that 2 edges in a face."<<endl;
}
- for ( itl.Initialize(MVE(CV)); itl.More(); itl.Next()) {
+ for ( itl.Initialize(MVE.FindFromKey(CV)); itl.More(); itl.Next()) {
if (itl.Value().IsSame(CE)) {
- MVE(CV).Remove(itl);
+ MVE.ChangeFromKey(CV).Remove(itl);
break;
}
}
- if (!MVE(CV).IsEmpty()) {
- CE = TopoDS::Edge(MVE(CV).First());
- MVE(CV).RemoveFirst();
+ if (!MVE.FindFromKey(CV).IsEmpty()) {
+ CE = TopoDS::Edge(MVE.FindFromKey(CV).First());
+ MVE.ChangeFromKey(CV).RemoveFirst();
}
- if (MVE(CV).IsEmpty()) MVE.UnBind(CV);
+ if (MVE.FindFromKey(CV).IsEmpty())
+ {
+ //MVE.UnBind(CV);
+ TopoDS_Shape LastShape = MVE.FindKey(MVE.Extent());
+ TopTools_ListOfShape LastList;
+ LastList.Append(MVE(MVE.Extent()));
+ MVE.RemoveLast();
+ if (MVE.FindIndex(CV) != 0)
+ MVE.Substitute(MVE.FindIndex(CV), LastShape, LastList);
+ }
}
}
// Modified by Sergey KHROMOV - Thu Mar 14 11:29:31 2002 Begin
TheWires.Append(NW);
}
- // mise a jour de myShape :
- // -- si un seul wire : myShape est un Wire
- // -- si plusieurs wires : myShape est un Compound.
+ // update myShape :
+ // -- if only one wire : myShape is a Wire
+ // -- if several wires : myShape is a Compound.
if ( TheWires.Extent() == 1) {
myShape = TheWires.First();
}
TopoDS_Wire& Base = TopoDS::Wire( UnclosedWires(1) );
TopoDS_Vertex Vf, Vl;
TopExp::Vertices( Base, Vf, Vl );
+ if(Vf.IsNull() || Vl.IsNull())
+ Standard_Failure::Raise("BRepFill_OffsetWire::FixHoles(): Wrong wire.");
gp_Pnt Pf, Pl;
Pf = BRep_Tool::Pnt(Vf);
Pl = BRep_Tool::Pnt(Vl);
//=======================================================================
//function : CutEdge
-//purpose : Decoupe d une edge aux extrema de courbures et aux points
-// d inflexion.
-// Les cercles fermes sont aussi decoupes en deux.
-// Si <Cuts> est vide l edge n est pas modifie.
-// Le premier et le dernier vertex de l edge originale
-// appartiennent respectivement a la premiere et derniere
-// portions.
+//purpose : Cut edge at the extrema of curvatures and points of inflexion.
+// So, closed circles are cut in two.
+// If <Cuts> is empty, the edge is not modified.
+// The first and the last vertex of the initial edge
+// belong to the first and the last parts respectively.
//=======================================================================
Standard_Integer CutEdge (const TopoDS_Edge& E,
const TopoDS_Face& F,
//if (E.Orientation() == TopAbs_REVERSED) CT2d->Reverse();
if (CT2d->BasisCurve()->IsKind(STANDARD_TYPE(Geom2d_Circle)) &&
- ( Abs(f-l) >= PI) ) {
+ ( Abs(f-l) >= M_PI) ) {
return 0;
- //---------------------------
- // Decoupe cercle ferme.
- //---------------------------
- Standard_Real m = (f + l)*0.5;
-// Modified by Sergey KHROMOV - Wed Mar 6 17:37:28 2002 Begin
- gp_Pnt P = aC->Value(m);
-
- VL = BRepLib_MakeVertex(P);
- B.UpdateVertex(VL, aTol);
-// Modified by Sergey KHROMOV - Wed Mar 6 17:37:30 2002 End
- TopoDS_Shape aLocalShape = E.EmptyCopied();
- TopoDS_Edge FE = TopoDS::Edge(aLocalShape);
- TopoDS_Edge LE = TopoDS::Edge(aLocalShape);
-// TopoDS_Edge FE = TopoDS::Edge(E.EmptyCopied());
-// TopoDS_Edge LE = TopoDS::Edge(E.EmptyCopied());
- FE.Orientation(TopAbs_FORWARD);
- LE.Orientation(TopAbs_FORWARD);
- B.Add (FE,V1);
- B.Add (FE,VL.Oriented(TopAbs_REVERSED));
- B.Range(FE, f, m);
- B.Add (LE,V2);
- B.Add (LE,VL.Oriented(TopAbs_FORWARD));
- B.Range(LE, m, l);
- Cuts.Append(FE.Oriented(E.Orientation()));
- Cuts.Append(LE.Oriented(E.Orientation()));
- //--------
- // Retour.
- //--------
- return 2;
}
//-------------------------
- // Decoupe de la courbe.
+ // Cut curve.
//-------------------------
Cuter.Perform(CT2d);
if (ForceCut == 0) {
if (Cuter.UnModified()) {
//-----------------------------
- // edge non modifiee => retour.
+ // edge not modified => return.
//-----------------------------
return 0;
} else {
// Modified by Sergey KHROMOV - Thu Nov 16 17:28:37 2000 End
//--------------------------------------
- // Creation des edges decoupees.
+ // Creation of cut edges.
//--------------------------------------
VF = V1;
const TopoDS_Vertex& V,
const TopoDS_Face& F,
const Standard_Real Offset,
- BRepFill_DataMapOfOrientedShapeListOfShape& Map,
+ BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map,
const Handle(Geom_Plane)& RefPlane)
{
- // eval the Axis of the Circle.
+ // evaluate the Axis of the Circle.
Standard_Real f,l;
Handle(Geom2d_Curve) GC = BRep_Tool::CurveOnSurface(E,F,f,l);
gp_Vec2d DX;
TopTools_ListOfShape LL;
LL.Append(OE);
- Map.Bind(V,LL);
+ Map.Add(V,LL);
#ifdef DRAW
if ( AffichGeom && !OE.IsNull()) {
void MakeOffset (const TopoDS_Edge& E,
const TopoDS_Face& F,
const Standard_Real Offset,
- BRepFill_DataMapOfOrientedShapeListOfShape& Map,
+ BRepFill_IndexedDataMapOfOrientedShapeListOfShape& Map,
const Handle(Geom_Plane)& RefPlane)
{
Standard_Real f,l;
Geom2dAdaptor_Curve AC(G2d,f,l);
if ( AC.GetType() == GeomAbs_Circle) {
- // si l offset est superieur ou egal au rayon et du cote de la
- // concavite du cercle => edge null.
+ // if the offset is greater otr equal to the radius and the side of the
+ // concavity of the circle => edge null.
gp_Circ2d C1(AC.Circle());
-#ifdef DEB
- Standard_Real radius =
-#endif
- C1.Radius();
gp_Ax22d axes( C1.Axis());
gp_Dir2d Xd = axes.XDirection();
gp_Dir2d Yd = axes.YDirection();
Standard_Real Signe = ( Crossed > 0.) ? 1. : -1.;
if (anOffset*Signe < AC.Circle().Radius()) {
- // -anOffset vient d une Etrangete adaptoresque!
+
Handle(Geom2dAdaptor_HCurve) AHC =
new Geom2dAdaptor_HCurve(G2d);
Adaptor3d_OffsetCurve Off(AHC,-anOffset);
Handle(Geom2d_Circle) CC = new Geom2d_Circle(Off.Circle());
- Standard_Real Delta = 2*PI - l + f;
+ Standard_Real Delta = 2*M_PI - l + f;
f -= 0.2*Delta; l += 0.2*Delta;
G2dOC = new Geom2d_TrimmedCurve(CC,f,l);
OE.Orientation(E.Orientation());
TopTools_ListOfShape LL;
LL.Append(OE);
- Map.Bind(E,LL);
+ Map.Add(E,LL);
#ifdef DRAW
if (AffichGeom && !OE.IsNull()) {
//=======================================================================
//function : UpdateDetromp
-//purpose : Pour chaque interval sur la bissectrice defini par params
-// test si le point milieu est a une distance > offset
-// dans ce cas les vertex correspondants aux extremites de l interval
-// sont ranges dans le detrompeur.
-// => Si un meme vertex apparait deux fois dans le detrompeur la
-// frontiere de la zone de proximitee est tangente a l offset .
+//purpose : For each interval on bissectrice defined by parameters
+// test if the medium point is at a distance > offset
+// in this case vertices corresponding to the extremities of the interval
+// are ranked in the proofing.
+// => If the same vertex appears in the proofing, the
+// border of the zone of proximity is tangent to the offset .
//=======================================================================
void UpdateDetromp (TopTools_ListOfShape& Detromp1,
U1 = Bis->FirstParameter();
if (SOnE) {
- // le premier point de la bissectrice est sur l offset
+ // the first point of the bissectrice is on the offset
V1 = TopoDS::Vertex(Vertices.Value(ii));
ii++;
}
ii ++;
}
- // test point milieu entre le dernier params et la fin de la bissectrice.
+ // test medium point between the last parameter and the end of the bissectrice.
U2 = Bis->LastParameter();
if (!EOnE) {
if (!Precision::IsInfinite(U2)) {
if (!aNode->Infinite() && Abs(aNode->Distance()-Offset) < Tol) {
//------------------------------------------------
- // le Noeud donne un vertex sur l offset
+ // the Node gives a vertex on the offset
//------------------------------------------------
if (MapNodeVertex.IsBound(aNode)) {
VN = TopoDS::Vertex(MapNodeVertex(aNode));
S.Clear();
//-----------------------------------------------------------
- // Tri des deux sequences en fonction du parametre sur l edge.
+ // Parse two sequences depending on the parameter on the edge.
//-----------------------------------------------------------
while (Change) {
Change = Standard_False;
}
//----------------------------------------------------------
- // Si un vertex n est pas dans le detrompeur il est elimine.
+ // If a vertex is not in the proofing, it is eliminated.
//----------------------------------------------------------
if (!BRep_Tool::Degenerated(E)) {
for (Standard_Integer k = 1; k <= TheVer.Length(); k ++) {
}
//----------------------------------------------------------
- // Si un vertex_double apparait deux fois dans le detrompeur
- // le vertex est elimine .
- // sinon on garde une seule de ces representations.
+ // If a vertex_double appears twice in the proofing
+ // the vertex is removed.
+ // otherwise preserve only one of its representations.
//----------------------------------------------------------
if (!BRep_Tool::Degenerated(E)) {
for (Standard_Integer k = 1; k < TheVer.Length(); k ++) {
}
}
//-----------------------------------------------------------
- // Creation des edges.
- // le nombre de vertex doit etre pair les edges a creer vont
- // d un vertex d indice impair i au vertex i+1;
+ // Creation of edges.
+ // the number of vertices should be even. The created edges
+ // go from a vertex with uneven index i to vertex i+1;
//-----------------------------------------------------------
for (Standard_Integer k = 1; k < TheVer.Length(); k = k+2) {
TopoDS_Shape aLocalShape = E.EmptyCopied();
//=======================================================================
//function : DoubleOrNotInside
-//purpose : return True si V apparait 2 fois dans LV ou n est pas dedans.
+//purpose : return True if V appears twice in LV or is not inside.
//=======================================================================
Standard_Boolean DoubleOrNotInside (const TopTools_ListOfShape& LV,
Standard_Real theFleche=0;
Standard_Boolean flecheok = Standard_False;
if (Norme > Eps) {
- // Evaluation de la fleche par interpolation . Voir IntWalk_IWalking_5.gxx
+ // Evaluation of the arrow by interpolation. See IntWalk_IWalking_5.gxx
Standard_Real N1 = Vdeb.SquareMagnitude();
Standard_Real N2 = Vdelta.SquareMagnitude();
if (N1 > Eps && N2 > Eps) {
Parameters,Points);
}
}
-
+