0028726: Quantity_NameOfColor should be replaced by Quantity_Color in function input...
[occt.git] / src / AIS / AIS_PlaneTrihedron.cxx
index c1b8aa3..b2edcb4 100644 (file)
 // + (-1) selection mode token into account 
 // (SAMTECH specific)
 
-#include <DsgPrs_XYZAxisPresentation.hxx>
+#include <AIS_InteractiveObject.hxx>
 #include <AIS_Line.hxx>
-#include <Geom_Line.hxx>
-
-#include <AIS_PlaneTrihedron.ixx>
-
-#include <DsgPrs_DatumPrs.hxx>
-#include <SelectMgr_EntityOwner.hxx>
-#include <Select3D_SensitiveSegment.hxx>
-#include <Select3D_SensitivePoint.hxx>
+#include <AIS_PlaneTrihedron.hxx>
+#include <AIS_Point.hxx>
+#include <Aspect_TypeOfLine.hxx>
+#include <DsgPrs_XYZAxisPresentation.hxx>
 #include <Geom_Axis1Placement.hxx>
 #include <Geom_Axis2Placement.hxx>
 #include <Geom_CartesianPoint.hxx>
+#include <Geom_Line.hxx>
+#include <Geom_Plane.hxx>
+#include <Geom_Transformation.hxx>
 #include <gp_Ax2.hxx>
 #include <gp_Pln.hxx>
 #include <gp_Pnt.hxx>
 #include <gp_Vec.hxx>
-#include <Prs3d_Drawer.hxx>
-#include <Prs3d_LineAspect.hxx>
-#include <Prs3d_DatumAspect.hxx>
+#include <Graphic3d_AspectFillArea3d.hxx>
 #include <Graphic3d_AspectLine3d.hxx>
-#include <Graphic3d_Structure.hxx>
 #include <Graphic3d_MaterialAspect.hxx>
-#include <Graphic3d_AspectFillArea3d.hxx>
-#include <Aspect_TypeOfLine.hxx>
-#include <AIS_Drawer.hxx>
-#include <UnitsAPI.hxx>
+#include <Graphic3d_Structure.hxx>
+#include <Prs3d_DatumAspect.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <Prs3d_LineAspect.hxx>
+#include <Prs3d_Presentation.hxx>
+#include <Prs3d_Projector.hxx>
+#include <Quantity_Color.hxx>
+#include <Select3D_SensitivePoint.hxx>
+#include <Select3D_SensitiveSegment.hxx>
+#include <SelectMgr_EntityOwner.hxx>
+#include <SelectMgr_Selection.hxx>
+#include <Standard_Type.hxx>
 #include <TColgp_Array1OfPnt.hxx>
+#include <TCollection_AsciiString.hxx>
+#include <UnitsAPI.hxx>
 
-#include <Select3D_SensitiveFace.hxx>
+IMPLEMENT_STANDARD_RTTIEXT(AIS_PlaneTrihedron,AIS_InteractiveObject)
 
 void  ExtremityPoints(TColgp_Array1OfPnt& PP,const Handle(Geom_Plane)& myPlane,const Handle(Prs3d_Drawer)& myDrawer);
 
@@ -62,11 +68,10 @@ AIS_PlaneTrihedron::AIS_PlaneTrihedron(const Handle(Geom_Plane)& aPlane)
 //POP  Standard_Real aLength = UnitsAPI::CurrentFromLS (100. ,"LENGTH");
   Standard_Real aLength = UnitsAPI::AnyToLS (100. ,"mm");
   DA->SetAxisLength(aLength,aLength,aLength);
-  Quantity_NameOfColor col = Quantity_NOC_ROYALBLUE1;
-  DA->FirstAxisAspect()->SetColor(col);
-  DA->SecondAxisAspect()->SetColor(col);
-  DA->SetDrawFirstAndSecondAxis(Standard_True);
-  DA->SetDrawThirdAxis(Standard_False);
+  Quantity_Color col (Quantity_NOC_ROYALBLUE1);
+  DA->LineAspect(Prs3d_DP_XAxis)->SetColor(col);
+  DA->LineAspect(Prs3d_DP_YAxis)->SetColor(col);
+  DA->SetDrawDatumAxes(Prs3d_DA_XYAxis);
   myDrawer->SetDatumAspect(DA); // odl - specific is created because it is modified
   myShapes[0] = Position();
   myShapes[1] = XAxis();
@@ -139,7 +144,7 @@ void AIS_PlaneTrihedron::SetLength(const Standard_Real theLength) {
 }
 
 Standard_Real AIS_PlaneTrihedron::GetLength() const {
-  return myDrawer->DatumAspect()->FirstAxisLength();
+  return myDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis);
 }
 
 //=======================================================================
@@ -150,11 +155,10 @@ void AIS_PlaneTrihedron::Compute(const Handle(PrsMgr_PresentationManager3d)&,
                                    const Handle(Prs3d_Presentation)& aPresentation, 
                                    const Standard_Integer)
 {
-  aPresentation->Clear();
   aPresentation->SetDisplayPriority(5);
   // drawing axis in X direction
   gp_Pnt first, last;
-  Standard_Real value = myDrawer->DatumAspect()->FirstAxisLength();
+  Standard_Real value = myDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis);
   gp_Dir xDir = myPlane->Position().Ax2().XDirection();
 
   gp_Pnt orig = myPlane->Position().Ax2().Location();
@@ -164,22 +168,22 @@ void AIS_PlaneTrihedron::Compute(const Handle(PrsMgr_PresentationManager3d)&,
   first.SetCoord( xo, yo, zo );
   last.SetCoord( xo + x * value, yo + y * value, zo + z * value );
   
-  DsgPrs_XYZAxisPresentation::Add( aPresentation, myDrawer->DatumAspect()->FirstAxisAspect(), myDrawer->ArrowAspect(), myDrawer->TextAspect(), xDir, value, myXLabel.ToCString(), first, last );
+  DsgPrs_XYZAxisPresentation::Add( aPresentation, myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis), myDrawer->ArrowAspect(), myDrawer->TextAspect(), xDir, value, myXLabel.ToCString(), first, last );
   
   // drawing axis in Y direction
-  value = myDrawer->DatumAspect()->SecondAxisLength();
+  value = myDrawer->DatumAspect()->AxisLength(Prs3d_DP_YAxis);
   gp_Dir yDir = myPlane->Position().Ax2().YDirection();
 
   yDir.Coord( x, y, z );
   last.SetCoord( xo + x * value, yo + y * value, zo + z * value );
-  DsgPrs_XYZAxisPresentation::Add( aPresentation, myDrawer->DatumAspect()->FirstAxisAspect(), myDrawer->ArrowAspect(), myDrawer->TextAspect(), yDir, value, myYLabel.ToCString(), first, last );
+  DsgPrs_XYZAxisPresentation::Add( aPresentation, myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis), myDrawer->ArrowAspect(), myDrawer->TextAspect(), yDir, value, myYLabel.ToCString(), first, last );
 
   aPresentation->SetInfiniteState (Standard_True);
 }
 
 void AIS_PlaneTrihedron::Compute(const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTransformation, const Handle(Prs3d_Presentation)& aPresentation)
 {
-// Standard_NotImplemented::Raise("AIS_PlaneTrihedron::Compute(const Handle(Prs3d_Projector)&, const Handle(Geom_Transformation)&, const Handle(Prs3d_Presentation)&)");
+// throw Standard_NotImplemented("AIS_PlaneTrihedron::Compute(const Handle(Prs3d_Projector)&, const Handle(Geom_Transformation)&, const Handle(Prs3d_Presentation)&)");
  PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation) ;
 }
 
@@ -212,7 +216,8 @@ void AIS_PlaneTrihedron::ComputeSelection(const Handle(SelectMgr_Selection)& aSe
   case 1:
     {  //origine
       Prior = 8;
-      eown= new SelectMgr_EntityOwner(myShapes[0],Prior);
+      const Handle(SelectMgr_SelectableObject)& anObj = myShapes[0]; // to avoid ambiguity
+      eown= new SelectMgr_EntityOwner(anObj,Prior);
       aSelection->Add(new Select3D_SensitivePoint(eown,myPlane->Location()));
 
       break;
@@ -221,7 +226,8 @@ void AIS_PlaneTrihedron::ComputeSelection(const Handle(SelectMgr_Selection)& aSe
     { //axes ... priorite 7
       Prior = 7;
       for (Standard_Integer i=1; i<=2;i++){
-       eown= new SelectMgr_EntityOwner(myShapes[i],Prior);
+        const Handle(SelectMgr_SelectableObject)& anObj = myShapes[i]; // to avoid ambiguity
+       eown= new SelectMgr_EntityOwner(anObj,Prior);
        aSelection->Add(new Select3D_SensitiveSegment(eown,PP(1),PP(i+1)));
 
       }
@@ -236,17 +242,12 @@ void AIS_PlaneTrihedron::ComputeSelection(const Handle(SelectMgr_Selection)& aSe
   }
 }
 
-void AIS_PlaneTrihedron::SetColor(const Quantity_NameOfColor aCol)
-{
-  SetColor(Quantity_Color(aCol));
-}
-
 void AIS_PlaneTrihedron::SetColor(const Quantity_Color &aCol)
 {
   hasOwnColor=Standard_True;
-  myOwnColor = aCol;
-  myDrawer->DatumAspect()->FirstAxisAspect()->SetColor(aCol);
-  myDrawer->DatumAspect()->SecondAxisAspect()->SetColor(aCol);
+  myDrawer->SetColor (aCol);
+  myDrawer->DatumAspect()->LineAspect(Prs3d_DP_XAxis)->SetColor(aCol);
+  myDrawer->DatumAspect()->LineAspect(Prs3d_DP_YAxis)->SetColor(aCol);
 }
 
 
@@ -267,12 +268,12 @@ void  ExtremityPoints(TColgp_Array1OfPnt& PP,const Handle(Geom_Plane)& myPlane,c
   gp_Ax2 theax(myPlane->Position().Ax2());
   PP(1) = theax.Location();
 
-  Standard_Real len = myDrawer->DatumAspect()->FirstAxisLength();
+  Standard_Real len = myDrawer->DatumAspect()->AxisLength(Prs3d_DP_XAxis);
   gp_Vec vec = theax.XDirection();
   vec *= len;
   PP(2) = PP(1).Translated(vec);
   
-  len = myDrawer->DatumAspect()->SecondAxisLength();
+  len = myDrawer->DatumAspect()->AxisLength(Prs3d_DP_YAxis);
   vec = theax.YDirection();
   vec *= len;
   PP(3) = PP(1).Translated(vec);