0025695: Visualization, AIS_InteractiveContext - define default HilightMode
[occt.git] / src / AIS / AIS_PlaneTrihedron.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 73cf9d7..67ca778
@@ -1,50 +1,60 @@
-// File:       AIS_PlaneTrihedron.cxx
-// Created:    Fri Dec 13 15:33:04 1996
-// Author:     Jean-Pierre COMBE
-//             <jpr>
-
-#define GER61351               //GG_171199     Enable to set an object RGB color
-//                                               instead a restricted object NameOfColor.
-
-#define OCC218                  //SAV using DsgPrs_XYZAxisPresentation to draw axes.
-                                // + X/YAxis() returns AIS_Line instead of AIS_Axis
-                                // + (-1) selection mode token into account 
-                                // (SAMTECH specific)
-
-#ifdef OCC218
-#include <DsgPrs_XYZAxisPresentation.hxx>
+// Created on: 1996-12-13
+// Created by: Jean-Pierre COMBE
+// Copyright (c) 1996-1999 Matra Datavision
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+// + X/YAxis() returns AIS_Line instead of AIS_Axis
+// + (-1) selection mode token into account 
+// (SAMTECH specific)
+
+#include <AIS_InteractiveObject.hxx>
 #include <AIS_Line.hxx>
-#include <Geom_Line.hxx>
-#endif
-
-#include <AIS_PlaneTrihedron.ixx>
-
+#include <AIS_PlaneTrihedron.hxx>
+#include <AIS_Point.hxx>
+#include <Aspect_TypeOfLine.hxx>
 #include <DsgPrs_DatumPrs.hxx>
-#include <SelectMgr_EntityOwner.hxx>
-#include <Select3D_SensitiveSegment.hxx>
-#include <Select3D_SensitivePoint.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>
-
-#define OCC10
+IMPLEMENT_STANDARD_RTTIEXT(AIS_PlaneTrihedron,AIS_InteractiveObject)
 
 void  ExtremityPoints(TColgp_Array1OfPnt& PP,const Handle(Geom_Plane)& myPlane,const Handle(Prs3d_Drawer)& myDrawer);
 
@@ -64,15 +74,13 @@ AIS_PlaneTrihedron::AIS_PlaneTrihedron(const Handle(Geom_Plane)& aPlane)
   DA->SecondAxisAspect()->SetColor(col);
   DA->SetDrawFirstAndSecondAxis(Standard_True);
   DA->SetDrawThirdAxis(Standard_False);
-  myDrawer->SetDatumAspect(DA); // odl - on en cree un specifique puisqu'on le modifie
+  myDrawer->SetDatumAspect(DA); // odl - specific is created because it is modified
   myShapes[0] = Position();
   myShapes[1] = XAxis();
   myShapes[2] = YAxis();
 
-#ifdef OCC218
   myXLabel = TCollection_AsciiString( "X" );
   myYLabel = TCollection_AsciiString( "Y" );
-#endif
 }
 
 //=======================================================================
@@ -100,7 +108,6 @@ AIS_PlaneTrihedron::AIS_PlaneTrihedron(const Handle(Geom_Plane)& aPlane)
 //function : XAxis
 //purpose  : 
 //=======================================================================
-#ifdef OCC218
 Handle(AIS_Line) AIS_PlaneTrihedron::XAxis() const 
 {
   Handle(Geom_Line) aGLine = new Geom_Line(myPlane->Pln().XAxis());
@@ -108,21 +115,11 @@ Handle(AIS_Line) AIS_PlaneTrihedron::XAxis() const
   aLine->SetColor(Quantity_NOC_ROYALBLUE1);
   return aLine;
 }
-#else
-Handle(AIS_Axis) AIS_PlaneTrihedron::XAxis() const 
-{
-  Handle(Geom_Axis1Placement) anAx1 = new Geom_Axis1Placement(myPlane->Pln().XAxis());
-  Handle(AIS_Axis) anAxis = new AIS_Axis (anAx1);
-  anAxis->SetTypeOfAxis(AIS_TOAX_XAxis);
-  return anAxis;
-}
-#endif
 
 //=======================================================================
 //function : YAxis
 //purpose  : 
 //=======================================================================
-#ifdef OCC218
 Handle(AIS_Line) AIS_PlaneTrihedron::YAxis() const 
 {
   Handle(Geom_Line) aGLine = new Geom_Line(myPlane->Pln().YAxis());
@@ -130,15 +127,6 @@ Handle(AIS_Line) AIS_PlaneTrihedron::YAxis() const
   aLine->SetColor(Quantity_NOC_ROYALBLUE1);
   return aLine;
 }
-#else
-Handle(AIS_Axis) AIS_PlaneTrihedron::YAxis() const 
-{
-  Handle(Geom_Axis1Placement) anAx1 = new Geom_Axis1Placement(myPlane->Pln().YAxis());
-  Handle(AIS_Axis) anAxis = new AIS_Axis (anAx1);
-  anAxis->SetTypeOfAxis(AIS_TOAX_YAxis);
-  return anAxis;
-}
-#endif
 
 //=======================================================================
 //function : Position
@@ -152,7 +140,6 @@ Handle(AIS_Point) AIS_PlaneTrihedron::Position() const
   return aPt;
 }
 
-#ifdef OCC10
 void AIS_PlaneTrihedron::SetLength(const Standard_Real theLength) {
   myDrawer->DatumAspect()->SetAxisLength(theLength, theLength, theLength);
   SetToUpdate();
@@ -161,7 +148,6 @@ void AIS_PlaneTrihedron::SetLength(const Standard_Real theLength) {
 Standard_Real AIS_PlaneTrihedron::GetLength() const {
   return myDrawer->DatumAspect()->FirstAxisLength();
 }
-#endif
 
 //=======================================================================
 //function : Compute
@@ -171,11 +157,7 @@ void AIS_PlaneTrihedron::Compute(const Handle(PrsMgr_PresentationManager3d)&,
                                    const Handle(Prs3d_Presentation)& aPresentation, 
                                    const Standard_Integer)
 {
-  aPresentation->Clear();
   aPresentation->SetDisplayPriority(5);
-#ifndef OCC218
-  DsgPrs_DatumPrs::Add(aPresentation,myPlane->Position().Ax2(),myDrawer);
-#else
   // drawing axis in X direction
   gp_Pnt first, last;
   Standard_Real value = myDrawer->DatumAspect()->FirstAxisLength();
@@ -198,13 +180,12 @@ void AIS_PlaneTrihedron::Compute(const Handle(PrsMgr_PresentationManager3d)&,
   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 );
 
-#endif
   aPresentation->SetInfiniteState (Standard_True);
 }
 
-void AIS_PlaneTrihedron::Compute(const Handle_Prs3d_Projector& aProjector, const Handle_Geom_Transformation& aTransformation, const Handle_Prs3d_Presentation& aPresentation)
+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&)");
+// Standard_NotImplemented::Raise("AIS_PlaneTrihedron::Compute(const Handle(Prs3d_Projector)&, const Handle(Geom_Transformation)&, const Handle(Prs3d_Presentation)&)");
  PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation) ;
 }
 
@@ -237,7 +218,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;
@@ -246,47 +228,35 @@ 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)));
 
       }
       break;
     }
-#ifdef OCC218
   case -1:
     {
       Prior = 5;
       aSelection->Clear();
       break;
     }
-#endif
   }
 }
 
 void AIS_PlaneTrihedron::SetColor(const Quantity_NameOfColor aCol)
-#ifdef GER61351
 {
   SetColor(Quantity_Color(aCol));
 }
 
 void AIS_PlaneTrihedron::SetColor(const Quantity_Color &aCol)
-#endif
 {
   hasOwnColor=Standard_True;
-  myOwnColor = aCol;
+  myDrawer->SetColor (aCol);
   myDrawer->DatumAspect()->FirstAxisAspect()->SetColor(aCol);
   myDrawer->DatumAspect()->SecondAxisAspect()->SetColor(aCol);
 }
 
-//=======================================================================
-//function : Compute
-//purpose  : to avoid warning
-//=======================================================================
-void AIS_PlaneTrihedron::Compute(const Handle(PrsMgr_PresentationManager2d)&, 
-                              const Handle(Graphic2d_GraphicObject)&,
-                              const Standard_Integer)
-{
-}
 
 void AIS_PlaneTrihedron::Compute(const Handle(Prs3d_Projector)&, 
                               const Handle(Prs3d_Presentation)&)