0022048: Visualization, AIS_InteractiveContext - single object selection should alway...
[occt.git] / src / AIS / AIS_PerpendicularRelation.cxx
old mode 100755 (executable)
new mode 100644 (file)
index 1a0fe0c..313f974
@@ -1,65 +1,56 @@
 // Created on: 1996-12-05
 // Created by: Jean-Pierre COMBE/Odile Olivier
 // Copyright (c) 1996-1999 Matra Datavision
-// Copyright (c) 1999-2012 OPEN CASCADE SAS
+// Copyright (c) 1999-2014 OPEN CASCADE SAS
 //
-// The content of this file is subject to the Open CASCADE Technology Public
-// License Version 6.5 (the "License"). You may not use the content of this file
-// except in compliance with the License. Please obtain a copy of the License
-// at http://www.opencascade.org and read it completely before using this file.
+// This file is part of Open CASCADE Technology software library.
 //
-// The Initial Developer of the Original Code is Open CASCADE S.A.S., having its
-// main offices at: 1, place des Freres Montgolfier, 78280 Guyancourt, France.
+// 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.
 //
-// The Original Code and all software distributed under the License is
-// distributed on an "AS IS" basis, without warranty of any kind, and the
-// Initial Developer hereby disclaims all such warranties, including without
-// limitation, any warranties of merchantability, fitness for a particular
-// purpose or non-infringement. Please see the License for the specific terms
-// and conditions governing the rights and limitations under the License.
+// 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
@@ -95,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 :
@@ -125,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 ) ;
 }
 
@@ -216,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);
@@ -229,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);
@@ -248,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;
 
@@ -259,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;