0024002: Overall code and build procedure refactoring -- automatic
[occt.git] / src / AIS / AIS_SymmetricRelation.cxx
index fa1c214..fc48372 100644 (file)
 // Alternatively, this file may be used under the terms of Open CASCADE
 // commercial license or contractual agreement.
 
-#define BUC60915        //GG 05/06/01 Enable to compute the requested arrow size
-//                      if any in all dimensions.
 
-#include <Standard_NotImplemented.hxx>
-
-#include <AIS_SymmetricRelation.ixx>
 #include <AIS.hxx>
-#include <AIS_Drawer.hxx>
-
-#include <gce_MakeLin.hxx>
-#include <SelectMgr_EntityOwner.hxx>
-#include <Select3D_SensitiveSegment.hxx>
-#include <Select3D_SensitiveBox.hxx>
-#include <Precision.hxx>
-#include <TopoDS.hxx>
+#include <AIS_SymmetricRelation.hxx>
 #include <BRep_Tool.hxx>
-#include <BRepAdaptor_Surface.hxx>
 #include <BRepAdaptor_Curve.hxx>
-#include <gp_Lin.hxx>
-#include <gp_Circ.hxx>
-#include <gp_Pnt.hxx>
+#include <BRepAdaptor_Surface.hxx>
+#include <DsgPrs_SymmetricPresentation.hxx>
 #include <ElCLib.hxx>
-#include <gp_Pln.hxx>
-#include <gp_Dir.hxx>
+#include <gce_MakeLin.hxx>
+#include <Geom_Circle.hxx>
+#include <Geom_Line.hxx>
+#include <Geom_Plane.hxx>
+#include <Geom_Transformation.hxx>
 #include <gp_Ax1.hxx>
 #include <gp_Ax2.hxx>
-
-#include <Geom_Plane.hxx>
-#include <Geom_Line.hxx>
-#include <Geom_Circle.hxx>
-#include <TopExp_Explorer.hxx>
-
+#include <gp_Circ.hxx>
+#include <gp_Dir.hxx>
+#include <gp_Lin.hxx>
+#include <gp_Pln.hxx>
+#include <gp_Pnt.hxx>
 #include <Precision.hxx>
-#include <Prs3d_Drawer.hxx>
 #include <Prs3d_ArrowAspect.hxx>
 #include <Prs3d_DimensionAspect.hxx>
-
-#include <DsgPrs_SymmetricPresentation.hxx>
+#include <Prs3d_Drawer.hxx>
+#include <Prs3d_Presentation.hxx>
+#include <Prs3d_Projector.hxx>
+#include <Select3D_SensitiveBox.hxx>
+#include <Select3D_SensitiveSegment.hxx>
+#include <SelectMgr_EntityOwner.hxx>
+#include <SelectMgr_Selection.hxx>
+#include <Standard_NotImplemented.hxx>
+#include <Standard_Type.hxx>
+#include <TopExp_Explorer.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Shape.hxx>
 
 //=======================================================================
 //function : AIS_SymmetricRelation
@@ -240,11 +237,8 @@ void AIS_SymmetricRelation::ComputeSelection(const Handle(SelectMgr_Selection)&
     
     //=======================Pour les arcs======================    
   if(cu1.GetType() == GeomAbs_Circle) { 
-    BRep_Tool::Curve(TopoDS::Edge(myFShape),F,L);
-//    Handle(Geom_Circle) geom_circ1 = (Handle(Geom_Circle)&) BRep_Tool::Curve(TopoDS::Edge(myFShape),F,L);
-//JR/Hp
     Handle(Geom_Curve) aGeomCurve = BRep_Tool::Curve(TopoDS::Edge(myFShape),F,L);
-    Handle(Geom_Circle) geom_circ1 = (Handle(Geom_Circle)&) aGeomCurve ;
+    Handle(Geom_Circle) geom_circ1 = Handle(Geom_Circle)::DownCast (aGeomCurve) ;
 //    Handle(Geom_Circle) geom_circ1 = (const Handle(Geom_Circle)&) BRep_Tool::Curve(TopoDS::Edge(myFShape),F,L);
     gp_Circ circ1(geom_circ1->Circ());
     gp_Pnt OffsetPnt(myPosition.X(),myPosition.Y(),myPosition.Z());
@@ -420,13 +414,13 @@ void AIS_SymmetricRelation::ComputeTwoEdgesSymmetric(const Handle(Prs3d_Presenta
   myAxisDirAttach = laxis.Direction();
 
   if(cu1.GetType() == GeomAbs_Line){
-    const Handle(Geom_Line)& geom_lin1 = (Handle(Geom_Line)&) geom1;
+    Handle(Geom_Line) geom_lin1 (Handle(Geom_Line)::DownCast (geom1));
     gp_Lin l1(geom_lin1->Lin());
     myFDirAttach = l1.Direction();
   }
   gp_Circ circ;
   if(cu1.GetType() == GeomAbs_Circle){
-    const Handle(Geom_Circle)& geom_cir1 = (Handle(Geom_Circle)&) geom1;
+    Handle(Geom_Circle) geom_cir1 (Handle(Geom_Circle)::DownCast (geom1));
     gp_Circ c(geom_cir1->Circ());
     circ = c;
   }
@@ -447,13 +441,13 @@ void AIS_SymmetricRelation::ComputeTwoEdgesSymmetric(const Handle(Prs3d_Presenta
 */
   Standard_Boolean idem = Standard_False;
   if (isInfinite1 && isInfinite2) { // geom1 et geom2 sont des lignes
-    const gp_Lin& line2 = ((Handle(Geom_Line)&) geom2)->Lin();
+    const gp_Lin& line2 = Handle(Geom_Line)::DownCast (geom2)->Lin();
     if (myAutomaticPosition) {
-      myFAttach = ((Handle(Geom_Line)&) geom1)->Lin().Location();      
+      myFAttach = Handle(Geom_Line)::DownCast (geom1)->Lin().Location();      
       mySAttach = ElCLib::Value(ElCLib::Parameter(line2,myFAttach),line2);
     }
     else {
-      const gp_Lin& line1 = ((Handle(Geom_Line)&) geom1)->Lin();
+      const gp_Lin& line1 = Handle(Geom_Line)::DownCast (geom1)->Lin();
       myFAttach = ElCLib::Value(ElCLib::Parameter(line1,myPosition),line1);
       mySAttach = ElCLib::Value(ElCLib::Parameter(line2,myFAttach),line2);
     }
@@ -489,18 +483,16 @@ void AIS_SymmetricRelation::ComputeTwoEdgesSymmetric(const Handle(Prs3d_Presenta
   }
   else if (isInfinite1) {// geom1 et geom2 sont des lignes
     mySAttach = ptat21;
-    const gp_Lin& line1 = ((Handle(Geom_Line)&) geom1)->Lin();
+    const gp_Lin& line1 = Handle(Geom_Line)::DownCast (geom1)->Lin();
     myFAttach = ElCLib::Value(ElCLib::Parameter(line1,mySAttach),line1);
   }
   else if (isInfinite2) {// geom1 et geom2 sont des lignes
     myFAttach = ptat11;
-    const gp_Lin& line2 = ((Handle(Geom_Line)&) geom2)->Lin();
+    const gp_Lin& line2 = Handle(Geom_Line)::DownCast (geom2)->Lin();
     mySAttach = ElCLib::Value(ElCLib::Parameter(line2,myFAttach),line2);
   }
 
-#ifdef BUC60915
   if( !myArrowSizeIsDefined )
-#endif
     myArrowSize = myFAttach.Distance(mySAttach)/50.;
   //----------------------------------------------------
  
@@ -510,7 +502,7 @@ void AIS_SymmetricRelation::ComputeTwoEdgesSymmetric(const Handle(Prs3d_Presenta
   gp_Pnt PjFAttach = ElCLib::Value(ElCLib::Parameter(laxis,myFAttach),laxis); 
  
   if (PjFAttach.IsEqual(myFAttach,Precision::Confusion())){
-    const Handle(Geom_Line)& geom_lin2 = (Handle(Geom_Line)&) geom2;
+    Handle(Geom_Line) geom_lin2 (Handle(Geom_Line)::DownCast (geom2));
     gp_Lin l2(geom_lin2->Lin());
     myFDirAttach = l2.Direction();
     gp_Pnt PntTempo;
@@ -599,9 +591,7 @@ void AIS_SymmetricRelation::ComputeTwoVerticesSymmetric(const Handle(Prs3d_Prese
   AIS::ComputeGeometry(TopoDS::Vertex(myFShape), myFAttach, myPlane, isOnPlane1);
   AIS::ComputeGeometry(TopoDS::Vertex(mySShape), mySAttach, myPlane, isOnPlane2);
 
-#ifdef BUC60915
   if( !myArrowSizeIsDefined )
-#endif
     myArrowSize = myFAttach.Distance(mySAttach)/50.;
   
   if (isOnPlane1 && isOnPlane2)