From 5605ef234012343d8ded1f089d2d1f68c173793d Mon Sep 17 00:00:00 2001 From: vsr Date: Mon, 13 Dec 2010 06:37:03 +0000 Subject: [PATCH] Merge from V5_1_main 10/12/2010 --- src/GEOMAlgo/GEOMAlgo_BuilderSolid.cxx | 178 +++++++++++++----- src/GEOMAlgo/GEOMAlgo_Builder_1.cxx | 19 +- src/GEOMAlgo/GEOMAlgo_Builder_2.cxx | 99 ++++++---- src/GEOMAlgo/GEOMAlgo_ShapeSet.cdl | 9 +- src/GEOMAlgo/GEOMAlgo_ShapeSet.cxx | 52 ++--- src/GEOMAlgo/GEOMAlgo_ShapeSet.hxx | 99 +++++----- src/OBJECT/GEOM_AISShape.cxx | 5 + src/OCC2VTK/GEOM_EdgeSource.cxx | 11 +- src/OCC2VTK/GEOM_EdgeSource.h | 2 +- .../TransformationGUI_MultiRotationDlg.cxx | 17 +- .../TransformationGUI_MultiTranslationDlg.cxx | 37 ++-- 11 files changed, 316 insertions(+), 212 deletions(-) diff --git a/src/GEOMAlgo/GEOMAlgo_BuilderSolid.cxx b/src/GEOMAlgo/GEOMAlgo_BuilderSolid.cxx index 2bc49887d..07be8c7fb 100755 --- a/src/GEOMAlgo/GEOMAlgo_BuilderSolid.cxx +++ b/src/GEOMAlgo/GEOMAlgo_BuilderSolid.cxx @@ -95,10 +95,14 @@ static void MakeInternalShells(const TopTools_MapOfShape& , TopTools_ListOfShape& ); -//modified by NIZNHY-PKV Tue Aug 5 15:06:50 2008f static - Standard_Boolean IsClosedShell(const TopoDS_Shell& theShell); -//modified by NIZNHY-PKV Tue Aug 5 15:06:57 2008t + Standard_Boolean IsClosedShell(const TopoDS_Shell& ); + +//modified by NIZNHY-PKV Tue Oct 26 13:30:39 2010f +static + Standard_Boolean RefineShell(const TopoDS_Shell& , + TopoDS_Shell& ); +//modified by NIZNHY-PKV Tue Oct 26 13:30:42 2010t //======================================================================= //function : @@ -187,15 +191,17 @@ static if (!myShapesToAvoid.Contains(aF)) { TopExp::MapShapesAndAncestors(aF, TopAbs_EDGE, TopAbs_FACE, aMEF); } - else { - int a=0; + /* + else { + int a=0; } + */ } aNbE=aMEF.Extent(); // // 2. myFacesToAvoid for (i=1; i<=aNbE; ++i) { - const TopoDS_Edge& aE=TopoDS::Edge(aMEF.FindKey(i)); + const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aMEF.FindKey(i))); if (BRep_Tool::Degenerated(aE)) { continue; } @@ -209,7 +215,7 @@ static // aOrE=aE.Orientation(); // - const TopoDS_Face& aF1=TopoDS::Face(aLF.First()); + const TopoDS_Face& aF1=*((TopoDS_Face*)(&aLF.First())); if (aNbF==1) { if (aOrE==TopAbs_INTERNAL) { continue; @@ -218,7 +224,7 @@ static myShapesToAvoid.Add(aF1); } else if (aNbF==2) { - const TopoDS_Face& aF2=TopoDS::Face(aLF.Last()); + const TopoDS_Face& aF2=*((TopoDS_Face*)(&aLF.Last())); if (aF2.IsSame(aF1)) { if (BRep_Tool::IsClosed(aE, aF1)) { continue; @@ -233,7 +239,7 @@ static myShapesToAvoid.Add(aF2); } } - //DEB + /*//DEB else { TopTools_ListIteratorOfListOfShape aItLF; // @@ -243,7 +249,7 @@ static int a=0; } } - //DEB + *///DEB }// for (i=1; i<=aNbE; ++i) { // if (!bFound) { @@ -262,12 +268,12 @@ static // myLoops.Clear(); // - Standard_Integer aNbLF, aNbOff, aNbFP, aNbFA; + Standard_Integer aNbLF, aNbOff, aNbFP; TopAbs_Orientation anOr; TopoDS_Edge aEL; BRep_Builder aBB; NMTTools_CoupleOfShape aCSOff; - TopTools_MapOfOrientedShape AddedFacesMap;//, aMFP; + TopTools_MapOfOrientedShape AddedFacesMap; TopTools_IndexedDataMapOfShapeListOfShape aEFMap, aMEFP; TopTools_ListIteratorOfListOfShape aItF, aIt; TopTools_MapIteratorOfMapOfOrientedShape aItM; @@ -304,12 +310,12 @@ static // loop on faces added to Shell; add their neighbor faces to Shell and so on TopoDS_Iterator aItAddedF (aShell); for (; aItAddedF.More(); aItAddedF.Next()) { - const TopoDS_Face& aF = TopoDS::Face(aItAddedF.Value()); + const TopoDS_Face& aF = *((TopoDS_Face*)(&aItAddedF.Value())); // // loop on edges of aF; find a good neighbor face of aF by aE TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE); for (; aEdgeExp.More(); aEdgeExp.Next()) { - const TopoDS_Edge& aE = TopoDS::Edge(aEdgeExp.Current()); + const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aEdgeExp.Current())); // //1 if (aMEFP.Contains(aE)) { @@ -344,7 +350,7 @@ static // aItLF.Initialize(aLF); for (; aItLF.More(); aItLF.Next()) { - const TopoDS_Face& aFL=TopoDS::Face(aItLF.Value()); + const TopoDS_Face& aFL=*((TopoDS_Face*)(&aItLF.Value())); if (myShapesToAvoid.Contains(aFL)) { continue; } @@ -372,7 +378,7 @@ static // TopoDS_Face aSelF; if (aNbOff==1) { - aSelF=TopoDS::Face(aLCSOff.First().Shape2()); + aSelF=*((TopoDS_Face*)(&aLCSOff.First().Shape2())); } else if (aNbOff>1){ GEOMAlgo_Tools3D::GetFaceOff(aE, aF, aLCSOff, aSelF); @@ -384,24 +390,22 @@ static } } // for (; aEdgeExp.More(); aEdgeExp.Next()) { } //for (; aItAddedF.More(); aItAddedF.Next()) { - //modified by NIZNHY-PKV Tue Aug 5 15:07:08 2008f - //myLoops.Append(aShell); + // if (IsClosedShell(aShell)) { myLoops.Append(aShell); } - /* + //modified by NIZNHY-PKV Wed Oct 27 07:10:41 2010f else { - TopoDS_Iterator aItS; - aItS.Initialize(aShell); - for (; aItS.More(); aItS.Next()) { - const TopoDS_Shape& aFs=aItS.Value(); - aMFP.Add(aFs); + Standard_Boolean bRefine; + TopoDS_Shell aShx; + // + bRefine=RefineShell(aShell, aShx); + if (bRefine) { + myLoops.Append(aShx); } } - */ - //modified by NIZNHY-PKV Tue Aug 5 15:07:30 2008t - } // for (; aItF.More(); aItF.Next()) { - //modified by NIZNHY-PKV Tue Aug 5 15:07:35 2008f + //modified by NIZNHY-PKV Wed Oct 27 07:10:44 2010t + } // for (; aItF.More(); aItF.Next()) { // // Post Treatment TopTools_MapOfOrientedShape aMP; @@ -417,14 +421,14 @@ static } } // - // b. collect all edges that are to avoid + // b. collect all faces that are to avoid aItM.Initialize(myShapesToAvoid); for (; aItM.More(); aItM.Next()) { const TopoDS_Shape& aF=aItM.Key(); aMP.Add(aF); } // - // c. add all edges that are not processed to myShapesToAvoid + // c. add all faces that are not processed to myShapesToAvoid aIt.Initialize (myShapes); for (; aIt.More(); aIt.Next()) { const TopoDS_Shape& aF=aIt.Value(); @@ -432,7 +436,6 @@ static myShapesToAvoid.Add(aF); } } - //modified by NIZNHY-PKV Tue Aug 5 15:07:44 2008t //================================================= // // 2.Internal Shells @@ -442,8 +445,6 @@ static aEFMap.Clear(); AddedFacesMap.Clear(); // - aNbFA=myShapesToAvoid.Extent(); - // aItM.Initialize(myShapesToAvoid); for (; aItM.More(); aItM.Next()) { const TopoDS_Shape& aFF=aItM.Key(); @@ -464,15 +465,15 @@ static // TopoDS_Iterator aItAddedF (aShell); for (; aItAddedF.More(); aItAddedF.Next()) { - const TopoDS_Face& aF = TopoDS::Face(aItAddedF.Value()); + const TopoDS_Face& aF = *((TopoDS_Face*)(&aItAddedF.Value())); // TopExp_Explorer aEdgeExp(aF, TopAbs_EDGE); for (; aEdgeExp.More(); aEdgeExp.Next()) { - const TopoDS_Edge& aE = TopoDS::Edge(aEdgeExp.Current()); + const TopoDS_Edge& aE = *((TopoDS_Edge*)(&aEdgeExp.Current())); const TopTools_ListOfShape& aLF=aEFMap.FindFromKey(aE); aItF.Initialize(aLF); for (; aItF.More(); aItF.Next()) { - const TopoDS_Face& aFL=TopoDS::Face(aItF.Value()); + const TopoDS_Face& aFL=*((TopoDS_Face*)(&aItF.Value())); if (AddedFacesMap.Add(aFL)){ aBB.Add(aShell, aFL); } @@ -518,10 +519,8 @@ static } else{ // check if a shell is a hole - //XX bIsHole=IsHole(aShell, myContext); - //bIsHole=GEOMAlgo_BuilderTools::IsHole(aShell); - //XX + // if (bIsHole) { aHoleShells.Append(aShell); TopExp::MapShapes(aShell, TopAbs_FACE, aMHF); @@ -581,7 +580,7 @@ static // 3. Add aHoles to Solids aItMSH.Initialize(aMSH); for (; aItMSH.More(); aItMSH.Next()) { - TopoDS_Solid aSolid=TopoDS::Solid(aItMSH.Key()); + TopoDS_Solid aSolid=*((TopoDS_Solid*)(&aItMSH.Key())); // const TopTools_ListOfShape& aLH=aItMSH.Value(); aShellIt.Initialize(aLH); @@ -637,7 +636,7 @@ static // 2 Process solids aSolidIt.Initialize(myAreas); for ( ; aSolidIt.More(); aSolidIt.Next()) { - TopoDS_Solid& aSolid=TopoDS::Solid(aSolidIt.Value()); + TopoDS_Solid& aSolid=*((TopoDS_Solid*)(&aSolidIt.Value())); // aMEF.Clear(); TopExp::MapShapesAndAncestors(aSolid, TopAbs_EDGE, TopAbs_FACE, aMEF); @@ -646,7 +645,7 @@ static aMFP.Clear(); aItMF.Initialize(aMF); for (; aItMF.More(); aItMF.Next()) { - const TopoDS_Face& aF=TopoDS::Face(aItMF.Key()); + const TopoDS_Face& aF=*((TopoDS_Face*)(&aItMF.Key())); if (GEOMAlgo_Tools3D::IsInternalFace(aF, aSolid, aMEF, 1.e-14, *myContext)) { aMFP.Add(aF); } @@ -792,7 +791,6 @@ Standard_Boolean IsGrowthShell(const TopoDS_Shape& theShell, } return bRet; } -//modified by NIZNHY-PKV Tue Aug 5 15:07:50 2008f //======================================================================= //function : IsClosedShell //purpose : @@ -811,18 +809,15 @@ Standard_Boolean IsClosedShell(const TopoDS_Shell& theShell) const TopoDS_Face& aF=TopoDS::Face(aIt.Value()); aExp.Init(aF, TopAbs_EDGE); for (; aExp.More(); aExp.Next()) { - const TopoDS_Edge& aE=TopoDS::Edge(aExp.Current()); + const TopoDS_Edge& aE=*((TopoDS_Edge*)(&aExp.Current())); if (BRep_Tool::Degenerated(aE)) { continue; } - /* - if (BRep_Tool::IsClosed(aE, aF)) { - continue; - } - */ + // if (aE.Orientation()==TopAbs_INTERNAL) { continue; } + // if (!aM.Add(aE)) { aM.Remove(aE); } @@ -835,8 +830,89 @@ Standard_Boolean IsClosedShell(const TopoDS_Shell& theShell) } return bRet; } -//modified by NIZNHY-PKV Tue Aug 5 15:08:07 2008t -//BRepTools::Write(aFF, "ff"); +//modified by NIZNHY-PKV Tue Oct 26 13:30:23 2010f +//======================================================================= +//function : RefineShell +//purpose : +//======================================================================= + Standard_Boolean RefineShell(const TopoDS_Shell& aShell, + TopoDS_Shell& aShx) + +{ + Standard_Boolean bRet; + Standard_Integer i, aNbE, aNbF; + TopAbs_Orientation aOrE; + TopTools_IndexedDataMapOfShapeListOfShape aMEF; + TopTools_MapOfOrientedShape aMFx; + // + bRet=Standard_False; + // + TopExp::MapShapesAndAncestors(aShell, TopAbs_EDGE, TopAbs_FACE, aMEF); + aNbE=aMEF.Extent(); + for (i=1; i<=aNbE; ++i) { + const TopoDS_Edge &aE=*((TopoDS_Edge*)(&aMEF.FindKey(i))); + // + if (BRep_Tool::Degenerated(aE)) { + continue; + } + // + aOrE=aE.Orientation(); + // + const TopTools_ListOfShape& aLF=aMEF(i); + aNbF=aLF.Extent(); + if (!aNbF) { + continue; + } + // + const TopoDS_Face& aF1=*((TopoDS_Face*)(&aLF.First())); + if (aNbF==1) { + if (aOrE==TopAbs_INTERNAL) { + continue; + } + aMFx.Add(aF1); + } + // + else if (aNbF==2) { + const TopoDS_Face& aF2=*((TopoDS_Face*)(&aLF.Last())); + if (aF2.IsSame(aF1)) { + if (BRep_Tool::IsClosed(aE, aF1)) { + continue; + } + if (aOrE==TopAbs_INTERNAL) { + continue; + } + aMFx.Add(aF1); + aMFx.Add(aF2); + } + } + } + // + aNbF=aMFx.Extent(); + if (!aNbF) { + return bRet; + } + // + BRep_Builder aBB; + TopoDS_Iterator aIt; + // + aNbF=0; + aBB.MakeShell(aShx); + aIt.Initialize(aShell); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aF=aIt.Value(); + if (!aMFx.Contains(aF)) { + aBB.Add(aShx, aF); + ++aNbF; + } + } + // + if (aNbF) { + bRet=IsClosedShell(aShx); + } + // + return bRet; +} +//modified by NIZNHY-PKV Tue Oct 26 13:30:26 2010t // // ErrorStatus : // 11 - Null Context diff --git a/src/GEOMAlgo/GEOMAlgo_Builder_1.cxx b/src/GEOMAlgo/GEOMAlgo_Builder_1.cxx index a6a2885ea..2c9f3d66e 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder_1.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder_1.cxx @@ -116,7 +116,7 @@ static IntTools_Context& aCtx=pPF->ChangeContext(); // Standard_Boolean bToReverse; - Standard_Integer i, aNb, aNbSp, nSp, nSpR, nSpx, aIsCB; + Standard_Integer i, aNb, aNbSp, nSp, nSpR, nSpx, aIsCB, aNbLB; TColStd_ListIteratorOfListOfInteger aItLB; TColStd_ListOfInteger aLB; TopoDS_Edge aEE, aESpR; @@ -150,16 +150,17 @@ static nSp=aPB.Edge(); const TopoDS_Shape& aSp=aDS.Shape(nSp); // - //modified by NIZNHY-PKV Fri Nov 30 10:40:36 2007 f - //const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB); const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB, aIsCB); - //modified by NIZNHY-PKV Fri Nov 30 10:40:48 2007t + //modified by NIZNHY-PKV Wed Oct 27 11:19:30 2010f + aNbLB=aLB.Extent(); + if (aIsCB && aNbLB<2) { + aIsCB=0; + } + //modified by NIZNHY-PKV Wed Oct 27 11:19:34 2010t + // nSpR=aPBR.Edge(); const TopoDS_Shape& aSpR=aDS.Shape(nSpR); - //modified by NIZNHY-PKV Fri Nov 30 10:41:39 2007f - //if (aSpR.IsSame(aSp) && aSpR.IsSame(aE)) { if (aSpR.IsSame(aSp) && aSpR.IsSame(aE) && !aIsCB) { - //modified by NIZNHY-PKV Fri Nov 30 10:41:46 2007t continue; } // @@ -183,10 +184,7 @@ static aIt.Initialize(aLPB); for (; aIt.More(); aIt.Next()) { const BOPTools_PaveBlock& aPB=aIt.Value(); - //modified by NIZNHY-PKV Fri Nov 30 10:42:15 2007f - //const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB); const BOPTools_PaveBlock& aPBR=pPF->RealPaveBlock(aPB, aLB, aIsCB); - //modified by NIZNHY-PKV Fri Nov 30 10:42:20 2007t nSpR=aPBR.Edge(); const TopoDS_Shape& aSpR=aDS.Shape(nSpR); // @@ -203,7 +201,6 @@ static const TopoDS_Shape& aSpx=aDS.Shape(nSpx); mySameDomainShapes.Add(aSpx ,aSpR); } - // } } // diff --git a/src/GEOMAlgo/GEOMAlgo_Builder_2.cxx b/src/GEOMAlgo/GEOMAlgo_Builder_2.cxx index b35ec2975..2aa155bb5 100755 --- a/src/GEOMAlgo/GEOMAlgo_Builder_2.cxx +++ b/src/GEOMAlgo/GEOMAlgo_Builder_2.cxx @@ -70,6 +70,8 @@ #include #include +#include + #include #include #include @@ -84,7 +86,8 @@ #include #include #include -#include + +#include static void UpdateCandidates(const Standard_Integer , @@ -254,6 +257,9 @@ static aNbSE=aLSE.Extent(); if (aNbSE) { aMFP.Add(i); + //modified by NIZNHY-PKV Wed Oct 27 11:40:57 2010f + break; + //modified by NIZNHY-PKV Wed Oct 27 11:41:07 2010t } } } @@ -358,46 +364,35 @@ static } // // 2.2. Build images Faces - GEOMAlgo_BuilderFace aBF; + TopTools_ListOfShape aLFR; + GEOMAlgo_ShapeSet aS1, aS2; // - aBF.SetFace(aFF); - aBF.SetContext(aCtx); const TopTools_ListOfShape& aSE=aWES.StartElements(); - // - //DEB f - /* - { - TopoDS_Compound aCx; - BRep_Builder aBBx; - TopTools_ListIteratorOfListOfShape aItx; + //modified by NIZNHY-PKV Thu Oct 28 08:30:41 2010f + aS1.Add(aSE); + aS2.Add(aFF, TopAbs_EDGE); + if (aS1.IsEqual(aS2)) { + aLFR.Append(aF); + } + //modified by NIZNHY-PKV Thu Oct 28 08:30:42 2010t + else { + GEOMAlgo_BuilderFace aBF; // - aBBx.MakeCompound(aCx); - aBBx.Add(aCx, aFF); - aItx.Initialize(aSE); - for (; aItx.More(); aItx.Next()) { - TopoDS_Shape& aEx=aItx.Value(); - aBBx.Add(aCx, aEx); - } - int a=0; - } - */ - //DEB t - // - aBF.SetShapes(aSE); - // - aBF.Perform(); - // - const TopTools_ListOfShape& aLF=aBF.Areas(); - // - TopTools_ListOfShape aLFR; - // - aIt.Initialize(aLF); - for (; aIt.More(); aIt.Next()) { - TopoDS_Shape& aFR=aIt.Value(); - if (anOriF==TopAbs_REVERSED) { - aFR.Orientation(TopAbs_REVERSED); + aBF.SetFace(aFF); + aBF.SetContext(aCtx); + aBF.SetShapes(aSE); + // <-DEB + aBF.Perform(); + // + const TopTools_ListOfShape& aLF=aBF.Areas(); + aIt.Initialize(aLF); + for (; aIt.More(); aIt.Next()) { + TopoDS_Shape& aFR=aIt.Value(); + if (anOriF==TopAbs_REVERSED) { + aFR.Orientation(TopAbs_REVERSED); + } + aLFR.Append(aFR); } - aLFR.Append(aFR); } // // 2.3. Collect draft images Faces @@ -530,7 +525,7 @@ static //======================================================================= void GEOMAlgo_Builder::FillImagesFaces1() { - Standard_Integer i, aNb, iSense; + Standard_Integer i, aNb, iSense, aNbLFx; TopoDS_Face aF, aFSp, aFSD; TopTools_ListOfShape aLFx; TopTools_ListIteratorOfListOfShape aIt; @@ -568,7 +563,16 @@ static aLFx.Append(aFSD); } } - if (!myImages.HasImage(aF)) {//XX + if (!myImages.HasImage(aF)) { + //modified by NIZNHY-PKV Wed Oct 27 14:41:34 2010f + aNbLFx=aLFx.Extent(); + if (aNbLFx==1) { + const TopoDS_Shape& aFx=aLFx.First(); + if (aF.IsSame(aFx)) { + continue; + } + } + //modified by NIZNHY-PKV Wed Oct 27 14:41:36 2010t myImages.Bind(aF, aLFx); } } @@ -803,3 +807,20 @@ void UpdateCandidates(const Standard_Integer theNF, theMFMV.Add(theNF, aMV); } } + +/* + { + TopoDS_Compound aCx; + BRep_Builder aBBx; + TopTools_ListIteratorOfListOfShape aItx; + // + aBBx.MakeCompound(aCx); + aBBx.Add(aCx, aFF); + aItx.Initialize(aSE); + for (; aItx.More(); aItx.Next()) { + TopoDS_Shape& aEx=aItx.Value(); + aBBx.Add(aCx, aEx); + } + int a=0; + } + */ diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeSet.cdl b/src/GEOMAlgo/GEOMAlgo_ShapeSet.cdl index 14744f7f4..31c89d754 100755 --- a/src/GEOMAlgo/GEOMAlgo_ShapeSet.cdl +++ b/src/GEOMAlgo/GEOMAlgo_ShapeSet.cdl @@ -73,7 +73,14 @@ is ---Purpose: Returns the Set returns ListOfShape from TopTools; ---C++: return const & - + --modified by NIZNHY-PKV Wed Oct 28 13:51:45 2010f + IsEqual(me; + theOther: ShapeSet from GEOMAlgo) + ---Purpose: Returns True if the Set==theSet + returns Boolean from Standard; + ---C++: alias operator == + --modified by NIZNHY-PKV Wed Oct 28 13:51:50 2010t + fields myMap : MapOfOrientedShape from TopTools is protected; myList : ListOfShape from TopTools is protected; diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeSet.cxx b/src/GEOMAlgo/GEOMAlgo_ShapeSet.cxx index 32f16eebd..2a1310070 100755 --- a/src/GEOMAlgo/GEOMAlgo_ShapeSet.cxx +++ b/src/GEOMAlgo/GEOMAlgo_ShapeSet.cxx @@ -96,17 +96,6 @@ //======================================================================= const TopTools_ListOfShape& GEOMAlgo_ShapeSet::GetSet()const { - /* - TopTools_ListOfShape *pL; - TopTools_MapIteratorOfMapOfOrientedShape aIt; - // - pL=(TopTools_ListOfShape *)&myList; - pL->Clear(); - aIt.Initialize(myMap); - for (; aIt.More(); aIt.Next()) { - pL->Append(aIt.Key()); - } - */ return myList; } //======================================================================= @@ -140,16 +129,6 @@ //======================================================================= void GEOMAlgo_ShapeSet::Subtract(const GEOMAlgo_ShapeSet& theOther) { - /* - TopTools_MapIteratorOfMapOfOrientedShape aIt; - // - aIt.Initialize(theOther.myMap); - for (; aIt.More(); aIt.Next()) { - const TopoDS_Shape& aS=aIt.Key(); - myMap.Remove(aS); - } - */ - // TopTools_ListIteratorOfListOfShape aIt; TopTools_ListOfShape aLS; // @@ -166,3 +145,34 @@ // myList=aLS; } +//modified by NIZNHY-PKV Wed Oct 28 13:51:36 2010f +//======================================================================= +//function : IsEqual +//purpose : +//======================================================================= + Standard_Boolean GEOMAlgo_ShapeSet::IsEqual(const GEOMAlgo_ShapeSet& theOther)const +{ + Standard_Boolean bRet; + Standard_Integer aNb1, aNb2; + TopAbs_Orientation aOr; + TopTools_ListIteratorOfListOfShape aIt; + // + bRet=Standard_True; + aNb1=myList.Extent(); + const TopTools_ListOfShape& aLS2=theOther.GetSet(); + aNb2=aLS2.Extent(); + if (aNb1!=aNb2) { + return !bRet; + } + // + aIt.Initialize(myList); + for (; aIt.More(); aIt.Next()) { + const TopoDS_Shape& aS=aIt.Value(); + if(!theOther.myMap.Contains(aS)) { + bRet=!bRet; + break; + } + } + return bRet; +} +//modified by NIZNHY-PKV Wed Oct 28 13:51:38 2010t diff --git a/src/GEOMAlgo/GEOMAlgo_ShapeSet.hxx b/src/GEOMAlgo/GEOMAlgo_ShapeSet.hxx index 7c9136641..618a4dee3 100644 --- a/src/GEOMAlgo/GEOMAlgo_ShapeSet.hxx +++ b/src/GEOMAlgo/GEOMAlgo_ShapeSet.hxx @@ -23,6 +23,13 @@ #ifndef _GEOMAlgo_ShapeSet_HeaderFile #define _GEOMAlgo_ShapeSet_HeaderFile +#ifndef _Standard_HeaderFile +#include +#endif +#ifndef _Standard_Macro_HeaderFile +#include +#endif + #ifndef _TopTools_MapOfOrientedShape_HeaderFile #include #endif @@ -39,59 +46,48 @@ class TopTools_ListOfShape; class TopoDS_Shape; -#ifndef _Standard_HeaderFile -#include -#endif -#ifndef _Standard_Macro_HeaderFile -#include -#endif - //! Implementation some formal
//! opereations with Set of shapes
class GEOMAlgo_ShapeSet { - public: - void* operator new(size_t,void* anAddress) - { - return anAddress; - } - void* operator new(size_t size) - { - return Standard::Allocate(size); - } - void operator delete(void *anAddress) - { - if (anAddress) Standard::Free((Standard_Address&)anAddress); - } - // Methods PUBLIC - // - -//! Empty constructor
-Standard_EXPORT GEOMAlgo_ShapeSet(); - -//! Adds shapes from the list theLS to the Set
-Standard_EXPORT void Add(const TopTools_ListOfShape& theLS) ; - -//! Adds shape theShape to the Set
-Standard_EXPORT void Add(const TopoDS_Shape& theShape) ; - -//! Adds sub-shapes of shape theShape,
+ void* operator new(size_t,void* anAddress) + { + return anAddress; + } + void* operator new(size_t size) + { + return Standard::Allocate(size); + } + void operator delete(void *anAddress) + { + if (anAddress) Standard::Free((Standard_Address&)anAddress); + } + + //! Empty constructor
+ Standard_EXPORT GEOMAlgo_ShapeSet(); + //! Adds shapes from the list theLS to the Set
+ Standard_EXPORT void Add(const TopTools_ListOfShape& theLS) ; + //! Adds shape theShape to the Set
+ Standard_EXPORT void Add(const TopoDS_Shape& theShape) ; + //! Adds sub-shapes of shape theShape,
//! that have type theType to the Set
-Standard_EXPORT void Add(const TopoDS_Shape& theShape,const TopAbs_ShapeEnum theType) ; - -//! Removes shapes of theSet from the Set
-Standard_EXPORT void Subtract(const GEOMAlgo_ShapeSet& theSet) ; - -//! Clears internal fields
-Standard_EXPORT void Clear() ; - -//! Returns True if the Set contains
+ Standard_EXPORT void Add(const TopoDS_Shape& theShape,const TopAbs_ShapeEnum theType) ; + //! Removes shapes of theSet from the Set
+ Standard_EXPORT void Subtract(const GEOMAlgo_ShapeSet& theSet) ; + //! Clears internal fields
+ Standard_EXPORT void Clear() ; + //! Returns True if the Set contains
//! all shapes of theSet
-Standard_EXPORT Standard_Boolean Contains(const GEOMAlgo_ShapeSet& theSet) const; - -//! Returns the Set
-Standard_EXPORT const TopTools_ListOfShape& GetSet() const; + Standard_EXPORT Standard_Boolean Contains(const GEOMAlgo_ShapeSet& theSet) const; + //! Returns the Set
+ Standard_EXPORT const TopTools_ListOfShape& GetSet() const; + //! Returns True if the Set==theSet
+ Standard_EXPORT Standard_Boolean IsEqual(const GEOMAlgo_ShapeSet& theOther) const; + Standard_Boolean operator ==(const GEOMAlgo_ShapeSet& theOther) const +{ + return IsEqual(theOther); +} @@ -99,24 +95,16 @@ Standard_EXPORT const TopTools_ListOfShape& GetSet() const; protected: - // Methods PROTECTED - // - // Fields PROTECTED - // TopTools_MapOfOrientedShape myMap; TopTools_ListOfShape myList; -private: +private: - // Methods PRIVATE - // - // Fields PRIVATE - // }; @@ -126,7 +114,6 @@ private: // other Inline functions and methods (like "C++: function call" methods) -// #endif diff --git a/src/OBJECT/GEOM_AISShape.cxx b/src/OBJECT/GEOM_AISShape.cxx index 2317414ad..451babeb8 100644 --- a/src/OBJECT/GEOM_AISShape.cxx +++ b/src/OBJECT/GEOM_AISShape.cxx @@ -33,6 +33,7 @@ #include "GEOM_AISShape.ixx" #include "SALOME_InteractiveObject.hxx" +#include "GEOM_AISVector.hxx" // Open CASCADE Includes #include @@ -210,10 +211,14 @@ void GEOM_AISShape::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresent if (isShowVectors()) { + const bool isVector = IsKind(STANDARD_TYPE(GEOM_AISVector)); TopExp_Explorer Exp ( myshape, TopAbs_EDGE ); for ( ; Exp.More(); Exp.Next() ) { TopoDS_Vertex aV1, aV2; TopoDS_Edge anEdgeE = TopoDS::Edge(Exp.Current()); + if ( !isVector ) + // draw curve direction (issue 0021087) + anEdgeE.Orientation( TopAbs_FORWARD ); if ( anEdgeE.IsNull() ) continue; diff --git a/src/OCC2VTK/GEOM_EdgeSource.cxx b/src/OCC2VTK/GEOM_EdgeSource.cxx index e44cc81e0..54f4ece23 100755 --- a/src/OCC2VTK/GEOM_EdgeSource.cxx +++ b/src/OCC2VTK/GEOM_EdgeSource.cxx @@ -65,8 +65,11 @@ Execute() TEdgeSet::Iterator anIter (myEdgeSet); for (; anIter.More(); anIter.Next()) { - const TopoDS_Edge& anEdge = anIter.Value(); - OCC2VTK(anEdge,aPolyData,aPts,myIsVector); + TopoDS_Edge anEdge = anIter.Value(); + if ( !myIsVector ) + // draw curve direction (issue 0021087) + anEdge.Orientation( TopAbs_FORWARD ); + OCC2VTK(anEdge,aPolyData,aPts,myIsVector||myIsVectorMode); } } @@ -263,10 +266,10 @@ void GEOM_EdgeSource::OCC2VTK (const TopoDS_Edge& theEdge, void GEOM_EdgeSource::SetVectorMode (bool theMode) { - myIsVector = theMode; + myIsVectorMode = theMode; } bool GEOM_EdgeSource::GetVectorMode () { - return myIsVector; + return !myIsVector && myIsVectorMode; } diff --git a/src/OCC2VTK/GEOM_EdgeSource.h b/src/OCC2VTK/GEOM_EdgeSource.h index 9ef08683f..6ea230d55 100755 --- a/src/OCC2VTK/GEOM_EdgeSource.h +++ b/src/OCC2VTK/GEOM_EdgeSource.h @@ -57,7 +57,7 @@ protected: TEdgeSet myEdgeSet; // The flag is common for all edges, because the shape, // representing a vector, can have only one edge. - bool myIsVector; + bool myIsVector, myIsVectorMode; void Execute(); diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx index aebe44d82..8916a8b74 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx @@ -19,11 +19,10 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// GEOM GEOMGUI : GUI for Geometry component +// File : TransformationGUI_MultiRotationDlg.cxx +// Author : Damien COQUERET, Open CASCADE S.A.S. -// GEOM GEOMGUI : GUI for Geometry component -// File : TransformationGUI_MultiRotationDlg.cxx -// Author : Damien COQUERET, Open CASCADE S.A.S. -// #include "TransformationGUI_MultiRotationDlg.h" #include @@ -196,7 +195,7 @@ void TransformationGUI_MultiRotationDlg::Init() void TransformationGUI_MultiRotationDlg::SetDoubleSpinBoxStep (double step) { GroupDimensions->SpinBox_DX2->setSingleStep(step); - + // san: Commented so as not to override specific step settings //GroupPoints->SpinBox_DX->setSingleStep((int)step); //GroupDimensions->SpinBox_DX1->setSingleStep(step); @@ -549,11 +548,11 @@ bool TransformationGUI_MultiRotationDlg::isValid (QString& msg) case 0: ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; break; - case 1: + case 1: ok = GroupDimensions->SpinBox_DX1->isValid( msg, !IsPreview() ) && ok; ok = GroupDimensions->SpinBox_DY1->isValid( msg, !IsPreview() ) && ok; ok = GroupDimensions->SpinBox_DX2->isValid( msg, !IsPreview() ) && ok; - ok = GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) && ok; + ok = GroupDimensions->SpinBox_DY2->isValid( msg, !IsPreview() ) && ok; break; } return !(myBase->_is_nil() || myVector->_is_nil()) && ok; @@ -638,8 +637,8 @@ void TransformationGUI_MultiRotationDlg::restoreSubShapes (SALOMEDS::Study_ptr anArgs->length(1); anArgs[0] = myBase; getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs, - /*theFindMethod=*/GEOM::FSM_Transformed, - /*theInheritFirstArg=*/true, + /*theFindMethod=*/GEOM::FSM_GetInPlace, + /*theInheritFirstArg=*/false, mainFrame()->CheckBoxAddPrefix->isChecked()); } } diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx index 36f2a54dc..fdb8ca0e1 100644 --- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx @@ -19,11 +19,10 @@ // // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // +// GEOM GEOMGUI : GUI for Geometry component +// File : TransformationGUI_MultiTranslationDlg.cxx +// Author : Damien COQUERET, Open CASCADE S.A.S. -// GEOM GEOMGUI : GUI for Geometry component -// File : TransformationGUI_MultiTranslationDlg.cxx -// Author : Damien COQUERET, Open CASCADE S.A.S. -// #include "TransformationGUI_MultiTranslationDlg.h" #include @@ -197,13 +196,13 @@ void TransformationGUI_MultiTranslationDlg::Init() connect(GroupDimensions->SpinBox_DX2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); connect(GroupDimensions->SpinBox_DY2, SIGNAL(valueChanged(int)), this, SLOT(ValueChangedInSpinBox(int))); - connect(GroupPoints->SpinBox_DX, SIGNAL(textChanged(const QString& )), + connect(GroupPoints->SpinBox_DX, SIGNAL(textChanged(const QString& )), this, SLOT(TextValueChangedInSpinBox(const QString& ))); - connect(GroupDimensions->SpinBox_DX1, SIGNAL(textChanged(const QString& )), + connect(GroupDimensions->SpinBox_DX1, SIGNAL(textChanged(const QString& )), this, SLOT(TextValueChangedInSpinBox(const QString& ))); - connect(GroupDimensions->SpinBox_DX2, SIGNAL(textChanged(const QString& )), + connect(GroupDimensions->SpinBox_DX2, SIGNAL(textChanged(const QString& )), this, SLOT(TextValueChangedInSpinBox(const QString& ))); - + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double))); connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(ReverseStepU())); @@ -222,9 +221,9 @@ void TransformationGUI_MultiTranslationDlg::Init() void TransformationGUI_MultiTranslationDlg::SetDoubleSpinBoxStep (double step) { GroupPoints->SpinBox_DX->setSingleStep(step); - GroupDimensions->SpinBox_DX1->setSingleStep(step); + GroupDimensions->SpinBox_DX1->setSingleStep(step); GroupDimensions->SpinBox_DX2->setSingleStep(step); - + // san : Commented so as not to override specific step settings //GroupPoints->SpinBox_DY->setSingleStep((int)step); //GroupDimensions->SpinBox_DY1->setSingleStep((int)step); @@ -536,25 +535,25 @@ void TransformationGUI_MultiTranslationDlg::TextValueChangedInSpinBox( const QSt { QObject* send = (QObject*)sender(); bool isDigit = true; - + switch (getConstructorId()) { - case 0: + case 0: GroupPoints->SpinBox_DX->text().toDouble(&isDigit); if(!isDigit){ GroupPoints->CheckButton1->setChecked(false); } GroupPoints->CheckButton1->setEnabled(isDigit); break; - case 1: + case 1: if (send == GroupDimensions->SpinBox_DX1) { GroupDimensions->SpinBox_DX1->text().toDouble(&isDigit); - if(!isDigit) + if(!isDigit) GroupDimensions->CheckButton1->setChecked(false); GroupDimensions->CheckButton1->setEnabled(isDigit); } else if(send == GroupDimensions->SpinBox_DX2){ GroupDimensions->SpinBox_DX2->text().toDouble(&isDigit); - if(!isDigit) + if(!isDigit) GroupDimensions->CheckButton2->setChecked(false); GroupDimensions->CheckButton2->setEnabled(isDigit); } @@ -655,7 +654,7 @@ GEOM::GEOM_IOperations_ptr TransformationGUI_MultiTranslationDlg::createOperatio bool TransformationGUI_MultiTranslationDlg::isValid (QString& msg) { int aConstructorId = getConstructorId(); - + if (aConstructorId == 0) { bool ok = true; ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok; @@ -762,8 +761,8 @@ void TransformationGUI_MultiTranslationDlg::restoreSubShapes (SALOMEDS::Study_pt anArgs->length(1); anArgs[0] = myBase; getGeomEngine()->RestoreSubShapesSO(theStudy, theSObject, anArgs, - /*theFindMethod=*/GEOM::FSM_Transformed, - /*theInheritFirstArg=*/true, + /*theFindMethod=*/GEOM::FSM_GetInPlace, + /*theInheritFirstArg=*/false, mainFrame()->CheckBoxAddPrefix->isChecked()); } } @@ -784,7 +783,7 @@ void TransformationGUI_MultiTranslationDlg::createPathPreview ( GEOM::GEOM_Objec TopoDS_Shape aVector = BRepBuilderAPI_MakeEdge(BRep_Tool::Pnt(aFirst), BRep_Tool::Pnt(aLast)).Shape(); const char* aName = "tmpVector"; Handle(GEOM_AISVector) anIO = new GEOM_AISVector( aVector, aName ); - + // add Prs to preview SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); SOCC_Prs* aPrs = dynamic_cast(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); -- 2.39.2