#include <TopTools_MapOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
#include <TDF_Label.hxx>
#include <TDF_LabelList.hxx>
#include <TDF_LabelMap.hxx>
save.close();
}
//=======================================================================
-static void DbgTools_Write(const TopTools_MapOfShape& MS, const Standard_CString filename)
+static void DbgTools_Write(const TopTools_IndexedMapOfShape& MS, const Standard_CString filename)
{
if (!MS.IsEmpty ()) {
TCollection_AsciiString aNam (filename);
- Standard_Integer i(0);
- TopTools_MapIteratorOfMapOfShape it(MS);
- for(;it.More();it.Next(),i++) {
- TCollection_AsciiString aName = aNam + "_" + i + ".brep";
- DbgTools_Write ( it.Key(), aName.ToCString());
+ for (Standard_Integer anIt = 1; anIt <= MS.Extent(); ++anIt) {
+ TCollection_AsciiString aName = aNam + "_" + (anIt - 1) + ".brep";
+ DbgTools_Write (MS (anIt), aName.ToCString());
}
}
}
//purpose :
//=======================================================================
-static TopoDS_Shape MakeShape (const TopTools_MapOfShape& MS)
+static TopoDS_Shape MakeShape (const TopTools_IndexedMapOfShape& MS)
{
if (!MS.IsEmpty ()) {
- TopTools_MapIteratorOfMapOfShape it(MS);
if (MS.Extent() == 1) {
- return it.Key();
+ return MS (1);
}
else {
TopoDS_Compound C;
BRep_Builder B;
B.MakeCompound(C);
- for (; it.More(); it.Next()){
- B.Add(C,it.Key());
- }
+ for (Standard_Integer anIt = 1; anIt <= MS.Extent(); ++anIt)
+ B.Add (C, MS (anIt));
return C;
}
}
//=======================================================================
static Standard_Boolean FindModifUntil (TNaming_NewShapeIterator& it,
- TopTools_MapOfShape& MS,
+ TopTools_IndexedMapOfShape& MS,
const TopoDS_Shape& S,
const Handle(TNaming_NamedShape)& Context)
{
static void SearchModifUntil (const TDF_LabelMap& /*Valid*/,
const Handle(TNaming_NamedShape)& Target,
const TNaming_ListOfNamedShape& theListOfGenerators,
- TopTools_MapOfShape& theMS)
+ TopTools_IndexedMapOfShape& theMS)
{
#ifdef OCCT_DEBUG_MODUN
const TNaming_ListOfNamedShape& Args,
const Handle(TNaming_NamedShape)& Stop)
{
- TopTools_MapOfShape MS;
+ TopTools_IndexedMapOfShape MS;
TDF_LabelMap Forbiden;
if(!ValidArgs(Args)) return Standard_False;
TNaming_NamingTool::BuildDescendants (Stop, Forbiden); // fills Forbidden from Stop
TNaming_NamingTool::CurrentShape (Valid, Forbiden,Args.Last(),MS);
#ifdef OCCT_DEBUG_GEN
Standard_Integer i(0);
- TopTools_MapIteratorOfMapOfShape it(MS);
TCollection_AsciiString aNam("ModifUnti_MS_");
TCollection_AsciiString ext(".brep");
#endif
TNaming_Builder B(L);
- for (TopTools_MapIteratorOfMapOfShape itM(MS); itM.More(); itM.Next()) {
- const TopoDS_Shape& S = itM.Key();
+ for (Standard_Integer anItMS = 1; anItMS <= MS.Extent(); ++anItMS) {
+ const TopoDS_Shape& S = MS (anItMS);
B.Select(S,S);
#ifdef OCCT_DEBUG_GEN
TCollection_AsciiString aName = aNam + ++i + ext;
const Handle(TNaming_NamedShape)& Stop,
const Standard_Integer Index)
{
- TopTools_MapOfShape MS;
+ TopTools_IndexedMapOfShape MS;
TDF_LabelMap Forbiden;
if(!ValidArgs(Args)) return Standard_False;
TNaming_NamingTool::BuildDescendants (Stop, Forbiden);
TNaming_Builder B(L);
- for (TopTools_MapIteratorOfMapOfShape itM(MS); itM.More(); itM.Next()) {
- const TopoDS_Shape& SS = itM.Key();
+ for (Standard_Integer anItMS = 1; anItMS <= MS.Extent(); ++anItMS) {
+ const TopoDS_Shape& SS = MS (anItMS);
B.Select(SS,SS);
}
return Standard_True;
if (Args.IsEmpty()) return Standard_False;
if(!ValidArgs(Args)) return Standard_False;
TNaming_ListIteratorOfListOfNamedShape it(Args);
- TopTools_MapOfShape MS;
+ TopTools_IndexedMapOfShape MS;
TDF_LabelMap Forbiden;
#ifdef OCCT_DEBUG_INT
// end of temp. sol.
TNaming_ListIteratorOfListOfNamedShape it(Args);
- TopTools_MapOfShape MS;
+ TopTools_IndexedMapOfShape MS;
TDF_LabelMap Forbiden;
TNaming_NamingTool::BuildDescendants (Stop, Forbiden);//fill Forbidden
DbgTools_Write(Args.First()->Get(), "Generated.brep") ;
#endif
// Nouvell valeurs des generateurs dans l attribut de generation
- TopTools_MapOfShape aMS;
+ TopTools_IndexedMapOfShape aMS;
TNaming_ListOfNamedShape aGenerators;
aGenerators.Assign(Args);
aGenerators.RemoveFirst();
TNaming_Builder B(L); // NS
TopTools_ListOfShape aList;
TNaming_DataMapOfShapeMapOfShape aDM;
- for (TopTools_MapIteratorOfMapOfShape itMS(aMS); itMS.More(); itMS.Next()) {
- const TopoDS_Shape& OS = itMS.Key();
+ for (Standard_Integer anItMS = 1; anItMS <= aMS.Extent(); ++anItMS) {
+ const TopoDS_Shape& OS = aMS (anItMS);
#ifdef OCCT_DEBUG_GEN
TCollection_AsciiString aName = aNam1 + ++i + ext;
DbgTools_Write(OS, aName.ToCString()) ;
if(aLM.Extent() == 1) {//lost 1
TopTools_ListIteratorOfListOfShape itm(aLM);
TopoDS_Shape aSM = itm.Value(); // Missed
- for (TopTools_MapIteratorOfMapOfShape itMS1(aMS); itMS1.More(); itMS1.Next()) {
- const TopoDS_Shape& aS = itMS1.Key();
+ for (Standard_Integer anItMS1 = 1; anItMS1 <= aMS.Extent(); ++anItMS1) {
+ const TopoDS_Shape& aS = aMS (anItMS1);
if(aSM.ShapeType() == aS.ShapeType()) {
if(aS.ShapeType() == TopAbs_EDGE) {
TopoDS_Vertex aVCom;
}
if(!ValidArgs(Args)) return Standard_False;
const Handle(TNaming_NamedShape)& A = Args.First();
- TopTools_MapOfShape MS;
+ TopTools_IndexedMapOfShape MS;
TDF_LabelMap Forbiden;
TNaming_NamingTool::CurrentShape (Valid,Forbiden,A,MS);
#ifdef OCCT_DEBUG_SOL2
//TDF_Tool::Entry(A->Label(), entry);
#endif
TNaming_Builder B(L);
- for (TopTools_MapIteratorOfMapOfShape itM(MS); itM.More(); itM.Next()) {
- const TopoDS_Shape& S = ShapeWithType(itM.Key(),ShapeType);
+ for (Standard_Integer anItMS = 1; anItMS <= MS.Extent(); ++anItMS) {
+ const TopoDS_Shape& S = ShapeWithType (MS (anItMS), ShapeType);
#ifdef OCCT_DEBUG_SOL2
//TopAbs_Orientation Or = S.Orientation();
#endif
PrintEntries(Valid);
#endif
- TopTools_MapOfShape SCand;
+ TopTools_IndexedMapOfShape SCand;
TNaming_NamingTool::CurrentShape (Valid, Forbiden,Cand,SCand);//fills SCand with last modifications of Cand. CandNS should be at the same level (before) as NS of FilterByNBS
#ifdef OCCT_DEBUG_FNB
#endif
Standard_Boolean isDone = Standard_False;
if(SCand.Extent() == 1) { // check if a collection is inside
- TopTools_MapIteratorOfMapOfShape it(SCand);
- const TopoDS_Shape& aS = it.Key();
+ TopoDS_Shape aS = SCand (1);
if(!aS.IsNull())
if(aS.ShapeType() == TopAbs_COMPOUND && aS.ShapeType() != ShapeType) {
+ SCand.Clear();
TopoDS_Iterator itt(aS);
for(;itt.More();itt.Next())
SCand.Add(itt.Value());
- SCand.Remove(aS);
}
}
- for (TopTools_MapIteratorOfMapOfShape itCand(SCand); itCand.More(); itCand.Next()) { //1
- const TopoDS_Shape& S = itCand.Key();
+ for (Standard_Integer anItSCand = 1; anItSCand <= SCand.Extent(); ++anItSCand) { //1
+ const TopoDS_Shape& S = SCand (anItSCand);
TopTools_MapOfShape Boundaries;
if(S.ShapeType() == TopAbs_VERTEX) //# szy 31.03.10
Boundaries.Add (S); //#
DbgTools_WriteNSOnLabel(NSVois, "Next_Neighbor_") ;
#endif
- TopTools_MapOfShape SVois;
+ TopTools_IndexedMapOfShape SVois;
TNaming_NamingTool::CurrentShape (Valid, Forbiden,NSVois,SVois); // fills SVois with last modifications of NSVois
#ifdef OCCT_DEBUG_FNB
DbgTools_Write(SVois, aNam2.ToCString());
#endif
- for (TopTools_MapIteratorOfMapOfShape itVois(SVois); itVois.More(); itVois.Next()) { //6
- const TopoDS_Shape& Vois = itVois.Key();
+ for (Standard_Integer anItSVois = 1; anItSVois <= SVois.Extent(); ++anItSVois) { //6
+ const TopoDS_Shape& Vois = SVois (anItSVois);
for (TopExp_Explorer exp1(Vois,TC); exp1.More(); exp1.Next()) { //7
if (Boundaries.Contains(exp1.Current())) {
Connected = Standard_True; // has common boundaries with candidate shape
if(!ValidArgs(Args)) return Standard_False;
const Handle(TNaming_NamedShape)& A = Args.First();
- TopTools_MapOfShape MS;
+ TopTools_IndexedMapOfShape MS;
TDF_LabelMap Forbiden;
TNaming_NamingTool::BuildDescendants (Stop, Forbiden);
TNaming_NamingTool::CurrentShape (Valid,Forbiden,A,MS);
TopoDS_Shape S;
Standard_Boolean isSplit(Standard_False);
if (!MS.IsEmpty ()) {
- TopTools_MapIteratorOfMapOfShape it(MS);
if (MS.Extent() == 1) {
- S = it.Key();
+ S = MS (1);
}
else {
isSplit = Standard_True;
S = MakeShape(MS);
#ifdef OCCT_DEBUG_OR
- for(Standard_Integer i=1;it.More();it.Next(), i++) {
+ for(Standard_Integer anItMS = 1; anItMS <= MS.Extent(); anItMS++) {
TCollection_AsciiString aNam("OR_Selection_");
- TCollection_AsciiString aName = aNam + i + ".brep";
- DbgTools_Write(it.Key(), aName.ToCString());
+ TCollection_AsciiString aName = aNam + anItMS + ".brep";
+ DbgTools_Write(MS (anItMS), aName.ToCString());
}
#endif
}
aSList.Append(it.Value());
} //
- TopTools_MapOfShape MSC;
+ TopTools_IndexedMapOfShape MSC;
if(aSList.Extent() == 0) {
const Handle(TNaming_NamedShape)& Anc = Args.Last();
#ifdef OCCT_DEBUG_OR
MSC.Clear();
TNaming_NamingTool::CurrentShape (Valid,Forbiden,Anc,MSC);
if(MSC.Extent() == 1) {
- for (TopTools_MapIteratorOfMapOfShape itM(MSC); itM.More(); itM.Next()) {
- const TopoDS_Shape& AS = itM.Key();
+ for (Standard_Integer anItMSC = 1; anItMSC <= MSC.Extent(); ++anItMSC) {
+ const TopoDS_Shape& AS = MSC (anItMSC);
// <=== start 21.10.2009
TopoDS_Shape CS;
if(Index > 0) { //only for seam edge
MSC.Clear();
TNaming_NamingTool::CurrentShape (Valid,Forbiden,it.Value(),MSC);
if(MSC.Extent() == 1) {
- for (TopTools_MapIteratorOfMapOfShape itM(MSC); itM.More(); itM.Next()) {
- const TopoDS_Shape& AS = itM.Key();
- Arr->SetValue(i, 2, AS);
- }
+ Arr->SetValue(i, 2, MSC (1));
} else {
const TopoDS_Shape AS = MakeShape(MSC);
Arr->SetValue(i, 2, AS);
{
Standard_Boolean aResult(Standard_False);
if(!ValidArgs(Args)) return aResult;
- TopTools_MapOfShape MS;
+ TopTools_IndexedMapOfShape MS;
TDF_LabelMap Forbiden;
if (Args.Extent() < 1 )
Standard_ConstructionError::Raise("TNaming_Name::Solve");
const Handle(TNaming_NamedShape)& A = Args.First();
TNaming_NamingTool::CurrentShape (Valid,Forbiden,A,MS);
if (MS.Extent() != 1) return aResult;
- TopTools_MapIteratorOfMapOfShape itM(MS);
- const TopoDS_Shape& aCF = itM.Key() ;
+ const TopoDS_Shape& aCF = MS (1);
#ifdef OCCT_DEBUG_WIN
cout <<"MS Extent = " <<MS.Extent() <<endl;
DbgTools_Write(aCF, "Context_Face.brep");
ArgsE.RemoveFirst();
// fill Map with edges
TNaming_ListIteratorOfListOfNamedShape it(ArgsE);
- TopTools_MapOfShape MS;
+ TopTools_IndexedMapOfShape MS;
TDF_LabelMap Forbiden;
TNaming_NamingTool::BuildDescendants (Stop, Forbiden);//fill Forbidden
Standard_Boolean aResult(Standard_False);
if(!ValidArgs(Args))
return aResult;
- TopTools_MapOfShape MS;
+ TopTools_IndexedMapOfShape MS;
TDF_LabelMap Forbiden;
if (Args.Extent() < 1 )
Standard_ConstructionError::Raise("TNaming_Name::Solve");
const Handle(TNaming_NamedShape)& A = Args.First();
TNaming_NamingTool::CurrentShape (Valid,Forbiden,A,MS);
if (MS.Extent() != 1) return aResult;
- TopTools_MapIteratorOfMapOfShape itM(MS);
- const TopoDS_Shape& aCSO = itM.Key() ;
+ const TopoDS_Shape& aCSO = MS (1);
#ifdef OCCT_DEBUG_SHELL
cout <<"MS Extent = " <<MS.Extent() <<endl;
DbgTools_Write(aCSO, "Context_Solid.brep");
cout << "Outer Shell case" <<endl;
PrintEntry(L);
DbgTools_Write(anOuterShell, "ShellOut_S.brep");
- it.Initialize(aCSO);
+ TopoDS_Iterator it (aCSO);
for(;it.More();it.Next()){
DbgTools_Write(it.Value(), "ShOut_S.brep");
}
ArgsF.RemoveFirst();
// fill Map with faces
TNaming_ListIteratorOfListOfNamedShape it(ArgsF);
- TopTools_MapOfShape MS;
+ TopTools_IndexedMapOfShape MS;
TDF_LabelMap Forbiden;
TNaming_NamingTool::BuildDescendants (Stop, Forbiden);//fill Forbidden
#include <TDF_TagSource.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopTools_MapOfShape.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
#include <TopExp.hxx>
#include <TopExp_Explorer.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
const TopoDS_Shape& S)
{
TDF_LabelMap Forbiden;
- TopTools_MapOfShape MS;
+ TopTools_IndexedMapOfShape MS;
if (!Stop.IsNull()) TNaming_NamingTool::BuildDescendants(Stop,Forbiden);
TNaming_NamingTool::CurrentShape(MDF.GetValid(),Forbiden,NS,MS);
#ifdef OCCT_DEBUG_NBS
Write(S, "Compare_S.brep");
cout << "S: TShape = " <<S.TShape()->This() <<endl;
- Standard_Integer i =1;
- TopTools_MapIteratorOfMapOfShape it(MS);
TCollection_AsciiString aNam("Compare_MS_");
TCollection_AsciiString ext(".brep");
- for(;it.More();it.Next(), i++) {
- TCollection_AsciiString aName = aNam + i + ext;
- Write(it.Key(), aName.ToCString()) ;
- cout << aName.ToCString()<< ": TShape = " <<it.Key().TShape()->This() <<endl;
+ for (Standard_Integer anItMS = 1; anItMS <= MS.Extent(); ++anItMS) {
+ TCollection_AsciiString aName = aNam + anItMS + ext;
+ Write (MS (anItMS), aName.ToCString());
+ cout << aName.ToCString()<< ": TShape = " << MS (anItMS).TShape()->This() << endl;
}
#endif
return (MS.Contains(S) && MS.Extent() == 1);
uses Label from TDF,
LabelMap from TDF,
NamedShape from TNaming,
- MapOfShape from TopTools,
+ IndexedMapOfShape from TopTools,
Shape from TopoDS
Valid : LabelMap from TDF;
Forbiden : LabelMap from TDF;
NS : NamedShape from TNaming;
- MS : in out MapOfShape from TopTools);
+ MS : in out IndexedMapOfShape from TopTools);
CurrentShapeFromShape (myclass;
Valid : LabelMap from TDF;
Forbiden : LabelMap from TDF;
Acces : Label from TDF;
S : Shape from TopoDS;
- MS : in out MapOfShape from TopTools);
+ MS : in out IndexedMapOfShape from TopTools);
BuildDescendants (myclass;
NS : NamedShape from TNaming;
#include <TNaming_Tool.hxx>
#include <TNaming_NewShapeIterator.hxx>
#include <TNaming_Iterator.hxx>
-#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <TNaming_OldShapeIterator.hxx>
#include <TNaming_Tool.hxx>
#include <TNaming_Naming.hxx>
//=======================================================================
static void LastModif( TNaming_NewShapeIterator& it,
const TopoDS_Shape& S,
- TopTools_MapOfShape& MS,
+ TopTools_IndexedMapOfShape& MS,
const TDF_LabelMap& Updated,
const TDF_LabelMap& Forbiden)
{
MS.Add(S);
}
//=======================================================================
-static void ApplyOrientation (TopTools_MapOfShape& MS,
+static void ApplyOrientation (TopTools_IndexedMapOfShape& MS,
const TopAbs_Orientation OrientationToApply)
{
- if (!MS.IsEmpty ()) {
#ifdef OCCT_DEBUG_APPLY
+ if (!MS.IsEmpty ()) {
cout <<"OrientationToApply = " <<OrientationToApply <<endl;
- TopTools_MapIteratorOfMapOfShape it1(MS);
- for (; it1.More(); it1.Next()) {
- cout << "ApplyOrientation: TShape = " << it1.Key().TShape()->This() << " OR = " <<it1.Key().Orientation() <<endl;
- }
-#endif
- TopTools_MapOfShape aMS;
- aMS.Assign(MS);
- TopTools_MapIteratorOfMapOfShape it(aMS);
- for (; it.More(); it.Next()) {
- if(it.Key().Orientation() != OrientationToApply) {
- TopoDS_Shape aS = it.Key();
- MS.Remove(aS);
- aS.Orientation(OrientationToApply);
- MS.Add(aS);
- }
+ for (Standard_Integer anItMS1 = 1; anItMS1 <= MS.Extent(); ++anItMS1) {
+ cout << "ApplyOrientation: TShape = " << MS (anItMS1).TShape()->This() << " OR = " << MS (anItMS1).Orientation() <<endl;
}
}
+#endif
+ for (Standard_Integer anItMS = 1; anItMS <= MS.Extent(); ++anItMS)
+ {
+ MS.Substitute (anItMS, MS (anItMS).Oriented (OrientationToApply));
+ }
}
//=======================================================================
//function : CurrentShape
void TNaming_NamingTool::CurrentShape(const TDF_LabelMap& Valid,
const TDF_LabelMap& Forbiden,
const Handle(TNaming_NamedShape)& Att,
- TopTools_MapOfShape& MS)
+ TopTools_IndexedMapOfShape& MS)
{
TDF_Label Lab = Att->Label();
#ifdef OCCT_DEBUG_DESC
}
else {
// LastModif(it, S, MS, Valid, Forbiden);
- TopTools_MapOfShape MS2;
+ TopTools_IndexedMapOfShape MS2;
LastModif(it, S, MS2, Valid, Forbiden);
if (YaOrientationToApply) ApplyOrientation (MS2, OrientationToApply);//the solution to be refined
- for (TopTools_MapIteratorOfMapOfShape itMS2(MS2); itMS2.More();itMS2.Next())
- MS.Add(itMS2.Key());
+ for (Standard_Integer anItMS2 = 1; anItMS2 <= MS2.Extent(); ++anItMS2)
+ MS.Add (MS2 (anItMS2));
}
}
}
const TDF_LabelMap& Forbiden,
const TDF_Label& Acces,
const TopoDS_Shape& S,
- TopTools_MapOfShape& MS)
+ TopTools_IndexedMapOfShape& MS)
{
TNaming_NewShapeIterator it(S,Acces);
#include <TNaming_NamingTool.hxx>
#include <TNaming_NewShapeIterator.hxx>
-#include <TopTools_MapOfShape.hxx>
-#include <TopTools_MapIteratorOfMapOfShape.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#include <TopoDS_Iterator.hxx>
// mpv : external condition
TDF_LabelMap Forbiden,Valid;
- TopTools_MapOfShape MS;
+ TopTools_IndexedMapOfShape MS;
TNaming_NamingTool::CurrentShape(Valid,Forbiden,NS,MS);
return (MS.Contains(Selection) && MS.Extent() == 1);
}
NS = Ident.NamedShapeOfGeneration();
if(!NS.IsNull()) {
TDF_LabelMap Forbiden,Valid;
- TopTools_MapOfShape MS;
+ TopTools_IndexedMapOfShape MS;
TNaming_NamingTool::CurrentShape(Valid,Forbiden,NS,MS);
if(MS.Contains(Selection) && MS.Extent() == 1) {
const TopoDS_Shape& aS = Ident.ShapeArg();
FindGenerated(NS, aS, aList);
Ident.NextArg();
}
- TopTools_MapIteratorOfMapOfShape itm(MS);
- const TopoDS_Shape& aC = itm.Key();
+ const TopoDS_Shape& aC = MS (1);
Standard_Boolean isEq(Standard_False);
TopTools_ListIteratorOfListOfShape itl(aList);
for(;itl.More();itl.Next()) {
uses
- Label from TDF,
- LabelList from TDF,
- LabelMap from TDF,
- NamedShape from TNaming,
- UsedShapes from TNaming,
- Evolution from TNaming,
- MapOfNamedShape from TNaming,
- ListOfShape from TopTools,
- Shape from TopoDS,
- OldShapeIterator from TNaming,
- MapOfShape from TopTools
+ Label from TDF,
+ LabelList from TDF,
+ LabelMap from TDF,
+ NamedShape from TNaming,
+ UsedShapes from TNaming,
+ Evolution from TNaming,
+ MapOfNamedShape from TNaming,
+ ListOfShape from TopTools,
+ Shape from TopoDS,
+ OldShapeIterator from TNaming,
+ IndexedMapOfShape from TopTools
is
FirstOlds (myclass; Shapes : UsedShapes from TNaming;
S : Shape from TopoDS;
it : in out OldShapeIterator from TNaming;
- MS : in out MapOfShape from TopTools;
+ MS : in out IndexedMapOfShape from TopTools;
Labels : in out LabelList from TDF)
is private;
#include <TopoDS_Compound.hxx>
#include <BRep_Builder.hxx>
#include <TopTools_MapOfShape.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_MapIteratorOfMapOfShape.hxx>
#include <Standard_NoSuchObject.hxx>
static void LastModif( TNaming_NewShapeIterator& it,
const TopoDS_Shape& S,
- TopTools_MapOfShape& MS,
+ TopTools_IndexedMapOfShape& MS,
const TDF_LabelMap& Updated,
TDF_LabelList& Deleted)
{
//=======================================================================
static void LastModif(TNaming_NewShapeIterator& it,
- TopTools_MapOfShape& MS,
+ TopTools_IndexedMapOfShape& MS,
const TopoDS_Shape& S,
TDF_LabelList& Deleted)
{
//purpose :
//=======================================================================
-static TopoDS_Shape MakeShape (const TopTools_MapOfShape& MS)
+static TopoDS_Shape MakeShape (const TopTools_IndexedMapOfShape& MS)
{
if (!MS.IsEmpty ()) {
- TopTools_MapIteratorOfMapOfShape it(MS);
if (MS.Extent() == 1) {
- return it.Key();
+ return MS (1);
}
else {
TopoDS_Compound C;
BRep_Builder B;
B.MakeCompound(C);
- for (; it.More(); it.Next()){
- B.Add(C,it.Key());
+ for (Standard_Integer anItMS = 1; anItMS <= MS.Extent(); ++anItMS) {
+ B.Add (C, MS (anItMS));
}
return C;
}
TopoDS_Shape TNaming_Tool::GetShape(const Handle(TNaming_NamedShape)& NS)
{
TNaming_Iterator itL (NS);
- TopTools_MapOfShape MS;
+ TopTools_IndexedMapOfShape MS;
if(NS->Evolution() == TNaming_SELECTED) {
for (; itL.More(); itL.Next()) {
if(!itL.NewShape().IsNull()) {
TopoDS_Shape TNaming_Tool::OriginalShape (const Handle(TNaming_NamedShape)& NS)
{
TNaming_Iterator itL (NS);
- TopTools_MapOfShape MS;
+ TopTools_IndexedMapOfShape MS;
for (; itL.More(); itL.Next()) {
MS.Add(itL.OldShape());
}
}
//=======================================================================
-static void ApplyOrientation (TopTools_MapOfShape& MS,
+static void ApplyOrientation (TopTools_IndexedMapOfShape& MS,
const TopAbs_Orientation OrientationToApply)
{
- if (!MS.IsEmpty ()) {
- TopTools_MapOfShape aMS;
- aMS.Assign(MS);
- TopTools_MapIteratorOfMapOfShape it(aMS);
- for (; it.More(); it.Next()) {
- if(it.Key().Orientation() != OrientationToApply) {
- TopoDS_Shape aS = it.Key();
- MS.Remove(aS);
- aS.Orientation(OrientationToApply);
- MS.Add(aS);
- }
- }
- }
+ for (Standard_Integer anItMS = 1; anItMS <= MS.Extent(); ++anItMS)
+ {
+ MS.Substitute (anItMS, MS (anItMS).Oriented (OrientationToApply));
+ }
}
//=======================================================================
TopoDS_Shape TNaming_Tool::CurrentShape(const Handle(TNaming_NamedShape)& Att)
{
- TopTools_MapOfShape MS;
+ TopTools_IndexedMapOfShape MS;
TDF_LabelList Deleted;
TNaming_Iterator itL (Att);
}
else {
// LastModif(it, MS, S, Deleted);
- TopTools_MapOfShape MS2; // to be optimized later
+ TopTools_IndexedMapOfShape MS2; // to be optimized later
LastModif(it, MS2, S, Deleted);
if (YaOrientationToApply) ApplyOrientation (MS2, OrientationToApply);
- for (TopTools_MapIteratorOfMapOfShape itMS2(MS2); itMS2.More();itMS2.Next())
- MS.Add(itMS2.Key());
+ for (Standard_Integer anItMS2 = 1; anItMS2 <= MS2.Extent(); ++anItMS2)
+ MS.Add (MS2 (anItMS2));
}
}
return MakeShape (MS);
{
TDF_Label Lab = Att->Label();
- TopTools_MapOfShape MS;
+ TopTools_IndexedMapOfShape MS;
TDF_LabelList Deleted;
if (!Updated.Contains(Lab)) {
}
else {
// LastModif(it, S, MS, Updated, Deleted);
- TopTools_MapOfShape MS2; // to be optimized later
+ TopTools_IndexedMapOfShape MS2; // to be optimized later
LastModif(it, S, MS2, Updated, Deleted);
if (YaOrientationToApply) ApplyOrientation (MS2, OrientationToApply);
- for (TopTools_MapIteratorOfMapOfShape itMS2(MS2); itMS2.More();itMS2.Next())
- MS.Add(itMS2.Key());
+ for (Standard_Integer anItMS2 = 1; anItMS2 <= MS2.Extent(); ++anItMS2)
+ MS.Add(MS2 (anItMS2));
}
}
return MakeShape (MS);
//=======================================================================
static void FindModifUntil (TNaming_NewShapeIterator& it,
- TopTools_MapOfShape& MS,
+ TopTools_IndexedMapOfShape& MS,
const Handle(TNaming_NamedShape)& Context)
{
for (; it.More(); it.Next()) {
const Handle(TNaming_NamedShape)& Generation)
{
- TopTools_MapOfShape MS;
+ TopTools_IndexedMapOfShape MS;
Handle(TNaming_UsedShapes) US;
Generation->Label().Root().FindAttribute(TNaming_UsedShapes::GetID(),US);
void TNaming_Tool::FirstOlds (const Handle(TNaming_UsedShapes)& US,
const TopoDS_Shape& S,
TNaming_OldShapeIterator& it,
- TopTools_MapOfShape& MS,
+ TopTools_IndexedMapOfShape& MS,
TDF_LabelList& Labels)
{
Standard_Integer TransDef;
Standard_Integer Transdef;
Label(US,S,Transdef);
- TopTools_MapOfShape MS;
+ TopTools_IndexedMapOfShape MS;
TNaming_OldShapeIterator it(S,Transdef,US);
if (!it.More()) {
return S;
--- /dev/null
+puts "============"
+puts "OCC26155"
+puts "============"
+puts ""
+###################################################################################
+# TNaming, CurrentShape: order of shapes in Modification compound is unpredictable.
+###################################################################################
+
+pload QAcommands
+
+NewDocument D MDTV-Standard
+
+set x_ref 0.0
+set x_tol 0.1
+set result 1
+
+for {set i 1} {$i <= 50} {incr i} {
+ set lab $i:1
+
+ box b 0 0 0 10 10 10
+ box b_1 0 0 0 5 10 10
+ box b_2 5 0 0 5 10 10
+
+ BuildNamedShape D [set lab]:1 PRIMITIVE b
+ BuildNamedShape D [set lab]:1:1 MODIFY b b_1
+ BuildNamedShape D [set lab]:1:2 MODIFY b b_2
+ CurrentShape D "[set lab]:1" r
+ explode r so
+ regexp {X += +([-0-9.+eE]+)} [vprops r_1 $x_tol] full x_1
+
+ if { $x_ref == 0 } {
+ set x_ref $x_1
+ } elseif { [expr abs ($x_1 - $x_ref)] > $x_tol } {
+ puts "Error: order of components of modified shape compound is not permanent."
+ break
+ }
+}