0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / AIS / AIS_PerpendicularRelation.cxx
index 9cfd935..313f974 100644 (file)
@@ -5,8 +5,8 @@
 //
 // 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 version 2.1 as published
+// 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.
 
-#include <Standard_NotImplemented.hxx>
-
-#include <AIS_PerpendicularRelation.ixx>
 
 #include <AIS.hxx>
-
-#include <BRepBuilderAPI_MakeFace.hxx>
-#include <BRepAdaptor_Surface.hxx>
+#include <AIS_PerpendicularRelation.hxx>
 #include <BRep_Tool.hxx>
-
+#include <BRepAdaptor_Surface.hxx>
+#include <BRepBuilderAPI_MakeFace.hxx>
 #include <DsgPrs_PerpenPresentation.hxx>
-
 #include <ElCLib.hxx>
-
+#include <gce_MakeDir.hxx>
 #include <Geom2d_Line.hxx>
-#include <GeomAPI.hxx>
-#include <Geom_Line.hxx>
+#include <Geom_Ellipse.hxx>
 #include <Geom_Line.hxx>
 #include <Geom_Plane.hxx>
-
+#include <Geom_Transformation.hxx>
+#include <GeomAPI.hxx>
+#include <gp_Pln.hxx>
+#include <gp_Pnt.hxx>
+#include <gp_Pnt2d.hxx>
+#include <gp_Trsf.hxx>
+#include <gp_Vec.hxx>
 #include <IntAna2d_AnaIntersection.hxx>
 #include <IntAna2d_IntPoint.hxx>
-
 #include <Precision.hxx>
-
+#include <Prs3d_Presentation.hxx>
+#include <Prs3d_Projector.hxx>
 #include <Select3D_SensitiveSegment.hxx>
 #include <SelectMgr_EntityOwner.hxx>
-
+#include <SelectMgr_Selection.hxx>
+#include <Standard_NotImplemented.hxx>
+#include <Standard_Type.hxx>
 #include <TopoDS.hxx>
 #include <TopoDS_Edge.hxx>
 #include <TopoDS_Face.hxx>
+#include <TopoDS_Shape.hxx>
 #include <TopoDS_Vertex.hxx>
 
-#include <gce_MakeDir.hxx>
-
-#include <gp_Pln.hxx>
-#include <gp_Pnt.hxx>
-#include <gp_Pnt2d.hxx>
-#include <gp_Trsf.hxx>
-#include <gp_Vec.hxx>
-#include <Geom_Ellipse.hxx>
+IMPLEMENT_STANDARD_RTTIEXT(AIS_PerpendicularRelation,AIS_Relation)
 
 //=======================================================================
 //function : Constructor
@@ -90,8 +86,6 @@ void AIS_PerpendicularRelation::Compute(const Handle(PrsMgr_PresentationManager3
                                        const Handle(Prs3d_Presentation)& aPresentation, 
                                        const Standard_Integer)
 {
-  aPresentation->Clear();
-
   if (myFShape.ShapeType() == mySShape.ShapeType()) {
     switch (myFShape.ShapeType()) {
     case TopAbs_FACE :
@@ -120,13 +114,13 @@ void AIS_PerpendicularRelation::Compute(const Handle(PrsMgr_PresentationManager3
 void AIS_PerpendicularRelation::Compute(const Handle(Prs3d_Projector)& aProjector,
                                        const Handle(Prs3d_Presentation)& aPresentation)
 {
-// Standard_NotImplemented::Raise("AIS_PerpendicularRelation::Compute(const Handle(Prs3d_Projector)&,const Handle(Prs3d_Presentation)&)");
+// throw Standard_NotImplemented("AIS_PerpendicularRelation::Compute(const Handle(Prs3d_Projector)&,const Handle(Prs3d_Presentation)&)");
  PrsMgr_PresentableObject::Compute( aProjector , aPresentation ) ;
 }
 
-void AIS_PerpendicularRelation::Compute(const Handle_Prs3d_Projector& aProjector, const Handle_Geom_Transformation& aTransformation, const Handle_Prs3d_Presentation& aPresentation)
+void AIS_PerpendicularRelation::Compute(const Handle(Prs3d_Projector)& aProjector, const Handle(Geom_Transformation)& aTransformation, const Handle(Prs3d_Presentation)& aPresentation)
 {
-// Standard_NotImplemented::Raise("AIS_PerpendicularRelation::Compute(const Handle_Prs3d_Projector&, const Handle_Geom_Transformation&, const Handle_Prs3d_Presentation&)");
+// throw Standard_NotImplemented("AIS_PerpendicularRelation::Compute(const Handle(Prs3d_Projector)&, const Handle(Geom_Transformation)&, const Handle(Prs3d_Presentation)&)");
  PrsMgr_PresentableObject::Compute( aProjector , aTransformation , aPresentation ) ;
 }
 
@@ -211,7 +205,7 @@ void AIS_PerpendicularRelation::ComputeTwoEdgesPerpendicular(const Handle(Prs3d_
   Handle(Geom_Line) geom_lin2;
   if ( geom1->IsInstance(STANDARD_TYPE(Geom_Ellipse)) )
     {
-      const Handle(Geom_Ellipse)& geom_el = (Handle(Geom_Ellipse)&) geom1;
+      Handle(Geom_Ellipse) geom_el (Handle(Geom_Ellipse)::DownCast (geom1));
       // construct lines through focuses
       gp_Ax1 elAx = geom_el->XAxis();
       gp_Lin ll (elAx);
@@ -224,13 +218,13 @@ void AIS_PerpendicularRelation::ComputeTwoEdgesPerpendicular(const Handle(Prs3d_
     }
   else if ( geom1->IsInstance(STANDARD_TYPE(Geom_Line)) )
     {
-      geom_lin1 = (Handle(Geom_Line)&) geom1;
+      geom_lin1 = Handle(Geom_Line)::DownCast (geom1);
     }
   else return;
 
   if (geom2->IsInstance(STANDARD_TYPE(Geom_Ellipse)))
     {
-      const Handle(Geom_Ellipse)& geom_el = (Handle(Geom_Ellipse)&) geom2;
+      Handle(Geom_Ellipse) geom_el (Handle(Geom_Ellipse)::DownCast (geom2));
       // construct lines through focuses
       gp_Ax1 elAx = geom_el->XAxis();
       gp_Lin ll (elAx);
@@ -243,7 +237,7 @@ void AIS_PerpendicularRelation::ComputeTwoEdgesPerpendicular(const Handle(Prs3d_
     }
   else if ( geom2->IsInstance(STANDARD_TYPE(Geom_Line)) )
     {
-      geom_lin2 = (Handle(Geom_Line)&) geom2;
+      geom_lin2 = Handle(Geom_Line)::DownCast (geom2);
     }
   else return;
 
@@ -254,9 +248,9 @@ void AIS_PerpendicularRelation::ComputeTwoEdgesPerpendicular(const Handle(Prs3d_
   
   // 2d lines => projection of 3d on current plane
   Handle(Geom2d_Curve) aGeom2dCurve = GeomAPI::To2d(geom_lin1,myPlane->Pln());
-  Handle(Geom2d_Line) lin1_2d = (Handle(Geom2d_Line)&) aGeom2dCurve ;
+  Handle(Geom2d_Line) lin1_2d = Handle(Geom2d_Line)::DownCast (aGeom2dCurve) ;
   aGeom2dCurve = GeomAPI::To2d(geom_lin2,myPlane->Pln());
-  Handle(Geom2d_Line) lin2_2d = (Handle(Geom2d_Line)&) aGeom2dCurve ;
+  Handle(Geom2d_Line) lin2_2d = Handle(Geom2d_Line)::DownCast (aGeom2dCurve) ;
   IntAna2d_AnaIntersection inter(lin1_2d->Lin2d(),lin2_2d->Lin2d());
   if (!inter.IsDone()) return;
   if (!inter.NbPoints()) return;