0028681: UnifySameDomain distorts face boundary when merges a chain of small linear...
[occt.git] / src / V3d / V3d_Viewer_3.cxx
index e2c2075..7d3805a 100644 (file)
 #include <V3d_RectangularGrid.hxx>
 #include <V3d_View.hxx>
 #include <V3d_Viewer.hxx>
-#include <Visual3d_ViewManager.hxx>
-
-/*----------------------------------------------------------------------*/
-/*
- * Static variable
- */
-static TCollection_AsciiString _XLetter() {
-    static TCollection_AsciiString XLetter("X");
-return XLetter;
-}
-#define XLetter _XLetter()
-
-static TCollection_AsciiString _YLetter() {
-    static TCollection_AsciiString YLetter("Y");
-return YLetter;
-}
-#define YLetter _YLetter()
-
-static TCollection_AsciiString _ZLetter() {
-    static TCollection_AsciiString ZLetter("Z");
-return ZLetter;
-}
-#define ZLetter _ZLetter()
 
 /*----------------------------------------------------------------------*/
 
@@ -79,12 +56,13 @@ void V3d_Viewer::SetPrivilegedPlane(const gp_Ax3& aPlane)
 {
   myPrivilegedPlane = aPlane;
   Grid()->SetDrawMode(Grid()->DrawMode());
-  for (InitActiveViews (); MoreActiveViews (); NextActiveViews ())
-    ActiveView ()->SetGrid (myPrivilegedPlane, Grid ());
+  for (V3d_ListOfView::Iterator anActiveViewIter (myActiveViews); anActiveViewIter.More(); anActiveViewIter.Next())
+  {
+    anActiveViewIter.Value()->SetGrid (myPrivilegedPlane, Grid());
+  }
+
   if(myDisplayPlane)
     DisplayPrivilegedPlane(Standard_True,myDisplayPlaneLength);
-  else
-    Update();
 }
 
 /*----------------------------------------------------------------------*/
@@ -95,16 +73,15 @@ gp_Ax3 V3d_Viewer::PrivilegedPlane() const
 }
 
 /*----------------------------------------------------------------------*/
-void V3d_Viewer::DisplayPrivilegedPlane(const Standard_Boolean OnOff, const Quantity_Length aSize)
+void V3d_Viewer::DisplayPrivilegedPlane(const Standard_Boolean OnOff, const Standard_Real aSize)
 {
-  Standard_Boolean Change = (myDisplayPlane != OnOff);
   myDisplayPlane = OnOff;
   myDisplayPlaneLength = aSize;
 
   if(myDisplayPlane)
   {
     if(myPlaneStructure.IsNull()) {
-      myPlaneStructure = new Graphic3d_Structure(MyViewer);
+      myPlaneStructure = new Graphic3d_Structure(StructureManager());
       myPlaneStructure->SetInfiniteState(Standard_True);
       myPlaneStructure->Display();
     }
@@ -128,17 +105,17 @@ void V3d_Viewer::DisplayPrivilegedPlane(const Standard_Boolean OnOff, const Quan
     const gp_Pnt pX(p0.XYZ() + myDisplayPlaneLength*myPrivilegedPlane.XDirection().XYZ());
     aPrims->AddVertex(p0);
     aPrims->AddVertex(pX);
-    Group->Text(XLetter.ToCString(),Graphic3d_Vertex(pX.X(),pX.Y(),pX.Z()),1./81.);
+    Group->Text("X",Graphic3d_Vertex(pX.X(),pX.Y(),pX.Z()),1./81.);
 
     const gp_Pnt pY(p0.XYZ() + myDisplayPlaneLength*myPrivilegedPlane.YDirection().XYZ());
     aPrims->AddVertex(p0);
     aPrims->AddVertex(pY);
-    Group->Text(YLetter.ToCString(),Graphic3d_Vertex(pY.X(),pY.Y(),pY.Z()),1./81.);
+    Group->Text("Y",Graphic3d_Vertex(pY.X(),pY.Y(),pY.Z()),1./81.);
     
     const gp_Pnt pZ(p0.XYZ() + myDisplayPlaneLength*myPrivilegedPlane.Direction().XYZ());
     aPrims->AddVertex(p0);
     aPrims->AddVertex(pZ);
-    Group->Text(ZLetter.ToCString(),Graphic3d_Vertex(pZ.X(),pZ.Y(),pZ.Z()),1./81.);
+    Group->Text("Z",Graphic3d_Vertex(pZ.X(),pZ.Y(),pZ.Z()),1./81.);
 
     Group->AddPrimitiveArray(aPrims);
 
@@ -148,7 +125,6 @@ void V3d_Viewer::DisplayPrivilegedPlane(const Standard_Boolean OnOff, const Quan
   {
     if( !myPlaneStructure.IsNull() )  myPlaneStructure->Erase();
   }
-  if(Change) Update();
 }
 
 /*----------------------------------------------------------------------*/