0031687: Draw Harness, ViewerTest - extend command vrenderparams with option updating...
[occt.git] / src / AIS / AIS_Axis.cxx
index e116b13..5c1d8c3 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-
 #include <AIS_Axis.hxx>
+
 #include <Aspect_TypeOfLine.hxx>
 #include <DsgPrs_XYZAxisPresentation.hxx>
 #include <Geom_Axis1Placement.hxx>
 #include <Geom_Axis2Placement.hxx>
 #include <Geom_Line.hxx>
-#include <Geom_Transformation.hxx>
 #include <GeomAdaptor_Curve.hxx>
 #include <gp_Ax1.hxx>
 #include <gp_Ax2.hxx>
 #include <Prs3d_Drawer.hxx>
 #include <Prs3d_LineAspect.hxx>
 #include <Prs3d_Presentation.hxx>
-#include <Prs3d_Projector.hxx>
 #include <Quantity_Color.hxx>
 #include <Select3D_SensitiveSegment.hxx>
-#include <SelectBasics_EntityOwner.hxx>
 #include <SelectMgr_EntityOwner.hxx>
 #include <SelectMgr_Selection.hxx>
-#include <Standard_Type.hxx>
 #include <StdPrs_Curve.hxx>
 #include <TColgp_Array1OfPnt.hxx>
 #include <TopoDS.hxx>
@@ -81,11 +77,11 @@ myIsXYZAxis(Standard_True)
   Standard_Real aLength;
   try {
     aLength = UnitsAPI::AnyToLS(100. ,"mm");
-  } catch (Standard_Failure) {
+  } catch (Standard_Failure const&) {
     aLength = 0.1;
   }
   DA->SetAxisLength(aLength,aLength,aLength);
-  Quantity_NameOfColor col = Quantity_NOC_TURQUOISE;
+  Quantity_Color col (Quantity_NOC_TURQUOISE);
   DA->LineAspect(Prs3d_DP_XAxis)->SetColor(col);
   DA->LineAspect(Prs3d_DP_YAxis)->SetColor(col);
   DA->LineAspect(Prs3d_DP_ZAxis)->SetColor(col);
@@ -185,12 +181,6 @@ void AIS_Axis::Compute(const Handle(PrsMgr_PresentationManager3d)&,
 
 }
 
-void AIS_Axis::Compute(const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTransformation, const Handle(Prs3d_Presentation)& aPresentation)
-{
-// throw Standard_NotImplemented("AIS_Axis::Compute(const Handle(Prs3d_Projector)&, const Handle(Geom_Transformation)&, const Handle(Prs3d_Presentation)&)");
-  PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation ) ;
-}
-
 //=======================================================================
 //function : ComputeSelection
 //purpose  : 
@@ -199,8 +189,7 @@ void AIS_Axis::Compute(const Handle(Prs3d_Projector)& aProjector, const Handle(G
 void AIS_Axis::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
                                const Standard_Integer)
 {
-  Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner(this);
-  eown -> SelectBasics_EntityOwner::Set(3);
+  Handle(SelectMgr_EntityOwner) eown = new SelectMgr_EntityOwner (this, 3);
   Handle(Select3D_SensitiveSegment) seg = new Select3D_SensitiveSegment(eown,
                                                                        myPfirst,
                                                                        myPlast);
@@ -209,15 +198,8 @@ void AIS_Axis::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
 
 //=======================================================================
 //function : SetColor
-//purpose  : 
+//purpose  :
 //=======================================================================
-
-
-void AIS_Axis::SetColor(const Quantity_NameOfColor aCol)
-{
-  SetColor(Quantity_Color(aCol));
-}
-
 void AIS_Axis::SetColor(const Quantity_Color &aCol)
 {
   hasOwnColor=Standard_True;
@@ -228,7 +210,7 @@ void AIS_Axis::SetColor(const Quantity_Color &aCol)
   DA->LineAspect(Prs3d_DP_XAxis)->SetColor(aCol);
   DA->LineAspect(Prs3d_DP_YAxis)->SetColor(aCol);
   DA->LineAspect(Prs3d_DP_ZAxis)->SetColor(aCol);
-  
+  SynchronizeAspects();
 }
 
 //=======================================================================
@@ -237,7 +219,6 @@ void AIS_Axis::SetColor(const Quantity_Color &aCol)
 //=======================================================================
 void AIS_Axis::SetWidth(const Standard_Real aValue)
 {
-  
   if(aValue<0.0) return;
   if(aValue==0) UnsetWidth();
   
@@ -247,16 +228,7 @@ void AIS_Axis::SetWidth(const Standard_Real aValue)
   DA->LineAspect(Prs3d_DP_XAxis)->SetWidth(aValue);
   DA->LineAspect(Prs3d_DP_YAxis)->SetWidth(aValue);
   DA->LineAspect(Prs3d_DP_ZAxis)->SetWidth(aValue);
-}
-
-
-//=======================================================================
-//function : Compute
-//purpose  : to avoid warning
-//=======================================================================
-void AIS_Axis::Compute(const Handle(Prs3d_Projector)&, 
-                      const Handle(Prs3d_Presentation)&)
-{
+  SynchronizeAspects();
 }
 
 //=======================================================================
@@ -273,7 +245,7 @@ void AIS_Axis::ComputeFields()
     const gp_Dir& oX   = anAxis.XDirection();
     const gp_Dir& oY   = anAxis.YDirection();
     const gp_Dir& oZ   = anAxis.Direction();
-    Quantity_Length xo,yo,zo,x = 0.,y = 0.,z = 0.;
+    Standard_Real xo,yo,zo,x = 0.,y = 0.,z = 0.;
     Orig.Coord(xo,yo,zo);
     myPfirst.SetCoord(xo,yo,zo);
     
@@ -331,14 +303,13 @@ AcceptDisplayMode(const Standard_Integer aMode) const
 //=======================================================================
 void AIS_Axis::UnsetColor()
 {
-  
   myDrawer->LineAspect()->SetColor(Quantity_NOC_RED);
-
-  hasOwnColor=Standard_False;
+  hasOwnColor = Standard_False;
 
   myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetColor(Quantity_NOC_TURQUOISE);
   myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetColor(Quantity_NOC_TURQUOISE);
   myDrawer->DatumAspect()->LineAspect(Prs3d_DP_ZAxis)->SetColor(Quantity_NOC_TURQUOISE);
+  SynchronizeAspects();
 }
 //=======================================================================
 //function : UnsetWidth
@@ -347,10 +318,10 @@ void AIS_Axis::UnsetColor()
 
 void AIS_Axis::UnsetWidth()
 {
-  myOwnWidth = 0.0;
+  myOwnWidth = 0.0f;
   myDrawer->LineAspect()->SetWidth(1.);
   myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetWidth(1.);
   myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetWidth(1.);
   myDrawer->DatumAspect()->LineAspect(Prs3d_DP_ZAxis)->SetWidth(1.);
+  SynchronizeAspects();
 }
-