0028714: Dimension of TDataStd_Real is not serialized to document
[occt.git] / src / DDataStd / DDataStd_DrawDriver.cxx
old mode 100755 (executable)
new mode 100644 (file)
index ead2555..3d793bb
@@ -1,73 +1,73 @@
-// File:       DDataStd_DrawDriver.cxx
-// Created:    Mon Sep  7 11:32:44 1998
-// Author:     Denis PASCAL
-//             <dp@dingox.paris1.matra-dtv.fr>
-
+// Created on: 1998-09-07
+// Created by: Denis PASCAL
+// Copyright (c) 1998-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.
 
-#include <DDataStd_DrawDriver.ixx>
 
-#include <Draw.hxx>
-#include <Draw_Drawable3D.hxx>
-#include <DDataStd.hxx>
-#include <TDF_Label.hxx>
-#include <TDF_Tool.hxx>
-#include <TNaming_Tool.hxx>
-#include <TopoDS.hxx>
+#include <BRep_Builder.hxx>
+#include <BRep_Tool.hxx>
 #include <DBRep.hxx>
+#include <DBRep_DrawableShape.hxx>
+#include <DDataStd.hxx>
+#include <DDataStd_DrawDriver.hxx>
+#include <Draw.hxx>
 #include <Draw_Appli.hxx>
-#include <TNaming_Tool.hxx>
-#include <TDataStd_Integer.hxx>
-#include <TDataStd_Real.hxx>
-#include <BRep_Tool.hxx>
+#include <Draw_Axis3D.hxx>
 #include <Draw_Drawable3D.hxx>
 #include <Draw_Marker3D.hxx>
-#include <TCollection_AsciiString.hxx>
+#include <DrawDim_Angle.hxx>
+#include <DrawDim_Distance.hxx>
+#include <DrawDim_PlanarAngle.hxx>
+#include <DrawDim_PlanarDiameter.hxx>
+#include <DrawDim_PlanarDistance.hxx>
+#include <DrawDim_PlanarRadius.hxx>
+#include <DrawDim_Radius.hxx>
+#include <DrawTrSurf_Surface.hxx>
 #include <Geom_CartesianPoint.hxx>
-#include <BRep_Builder.hxx>
-#include <TopoDS_Compound.hxx>
-#include <TDF_Tool.hxx>
-#include <TCollection_AsciiString.hxx>
-#include <TDataStd.hxx>
-#include <gp_Pln.hxx>
-#include <gp_Ax3.hxx>
 #include <Geom_Plane.hxx>
-//
-// attribut affichable
-//
-#include <TNaming_NamedShape.hxx>
+#include <gp_Ax3.hxx>
+#include <gp_Pln.hxx>
+#include <Standard_Type.hxx>
+#include <TCollection_AsciiString.hxx>
 #include <TDataStd.hxx>
-#include <TDataXtd_GeometryEnum.hxx>
-#include <TDataXtd_Point.hxx>
+#include <TDataStd_Integer.hxx>
+#include <TDataStd_Real.hxx>
 #include <TDataXtd_Axis.hxx>
-#include <TDataXtd_Plane.hxx>
+#include <TDataXtd_Constraint.hxx>
 #include <TDataXtd_Geometry.hxx>
+#include <TDataXtd_GeometryEnum.hxx>
+#include <TDataXtd_Plane.hxx>
+#include <TDataXtd_Point.hxx>
 #include <TDF_ChildIterator.hxx>
-#include <TDF_LabelList.hxx> 
+#include <TDF_Label.hxx>
+#include <TDF_LabelList.hxx>
 #include <TDF_ListIteratorOfLabelList.hxx>
-//
-// drawable object
-//
-#include <DrawTrSurf_Surface.hxx>
-#include <Draw_Axis3D.hxx>
-#include <DrawDim_Distance.hxx>
-#include <DrawDim_Radius.hxx>
-#include <DrawDim_Angle.hxx>
-#include <DrawDim_PlanarDistance.hxx>
-#include <DrawDim_PlanarRadius.hxx>
-#include <DrawDim_PlanarAngle.hxx>
-#include <DrawDim_PlanarDiameter.hxx>
-#include <DBRep_DrawableShape.hxx>
+#include <TDF_Tool.hxx>
+#include <TNaming_NamedShape.hxx>
+#include <TNaming_Tool.hxx>
+#include <TopoDS.hxx>
+#include <TopoDS_Compound.hxx>
+#include <TopoDS_Shape.hxx>
 
+IMPLEMENT_STANDARD_RTTIEXT(DDataStd_DrawDriver,MMgt_TShared)
+
+// attribut affichable
+// drawable object
 static Standard_Integer DISCRET    = 100;
 static Standard_Integer NBISOS     = 10;
 static Standard_Real    THESIZE       = 1000.;
 
-// Unused
-#ifdef DEB
-static Standard_Real    PLANETHESIZE  = 100.;
-static Standard_Real    DEFLECTION = 0.0;
-#endif
-
 static Handle(DDataStd_DrawDriver) DrawDriver;
 
 
@@ -148,7 +148,6 @@ Handle(Draw_Drawable3D) DDataStd_DrawDriver::Drawable (const TDF_Label& L) const
     case TDataXtd_POINT :
       {  
        return DrawableShape(L,Draw_jaune,Standard_False);
-       break;
       }
     case TDataXtd_LINE :
     case TDataXtd_CIRCLE :
@@ -156,7 +155,6 @@ Handle(Draw_Drawable3D) DDataStd_DrawDriver::Drawable (const TDF_Label& L) const
     case TDataXtd_SPLINE :
       {  
        return DrawableShape(L,Draw_cyan,Standard_False);
-       break;
       }  
     case TDataXtd_ANY_GEOM :
       { 
@@ -197,13 +195,13 @@ Handle(Draw_Drawable3D) DDataStd_DrawDriver::DrawableConstraint (const Handle(TD
   case TDataXtd_RADIUS:
     {
       if (A->IsPlanar()) {
-       D = new DrawDim_PlanarRadius (TNaming_Tool::GetShape(A->GetGeometry(1)));
+        D = new DrawDim_PlanarRadius (TNaming_Tool::GetShape(A->GetGeometry(1)));
       }
       else {
-       TopoDS_Shape aLocalShape = Geometry(A,1,TopAbs_FACE);
-       TopoDS_Face F1 = TopoDS::Face(aLocalShape);
-//     TopoDS_Face F1 = TopoDS::Face(Geometry(A,1,TopAbs_FACE));
-       if (!F1.IsNull()) D = new DrawDim_Radius(F1);
+        TopoDS_Shape aLocalShape = Geometry(A,1,TopAbs_FACE);
+        TopoDS_Face F1 = TopoDS::Face(aLocalShape);
+        // TopoDS_Face F1 = TopoDS::Face(Geometry(A,1,TopAbs_FACE));
+        if (!F1.IsNull()) D = new DrawDim_Radius(F1);
       }
     }
     break;
@@ -238,25 +236,11 @@ Handle(Draw_Drawable3D) DDataStd_DrawDriver::DrawableConstraint (const Handle(TD
   case TDataXtd_DISTANCE:
     {
       if (A->IsPlanar()) {
-       D = new DrawDim_PlanarDistance (TNaming_Tool::GetShape(A->GetGeometry(1)),
-                                       TNaming_Tool::GetShape(A->GetGeometry(2)));
-      }
-      else {
-       break;
-       TopoDS_Shape aLocalShape = (Geometry (A, 1, TopAbs_FACE));
-       TopoDS_Face F1 = TopoDS::Face (aLocalShape);
-//     TopoDS_Face F1 = TopoDS::Face (Geometry (A, 1, TopAbs_FACE));
-       if (A->NbGeometries() == 1) D = new DrawDim_Distance (F1);
-       else {
-         TopoDS_Shape aLocalShape = Geometry(A,2,TopAbs_FACE);
-         TopoDS_Face F2 = TopoDS::Face(aLocalShape);
-//       TopoDS_Face F2 = TopoDS::Face(Geometry(A,2,TopAbs_FACE));
-         D = new DrawDim_Distance(F1,F2);
-       }
+        D = new DrawDim_PlanarDistance (TNaming_Tool::GetShape(A->GetGeometry(1)),
+                                        TNaming_Tool::GetShape(A->GetGeometry(2)));
       }
+      break;
     }
-    break;
-    
   case TDataXtd_ANGLE:
     {     
       if (A->IsPlanar()) {
@@ -355,7 +339,9 @@ Handle(Draw_Drawable3D) DDataStd_DrawDriver::DrawableConstraint (const Handle(TD
   if (!D.IsNull()) {
     if (!A->GetValue().IsNull()) {
       Standard_Real val = A->GetValue()->Get();
-      if (A->GetValue()->GetDimension() == TDataStd_ANGULAR) val = (180.*val)/PI;
+      Standard_DISABLE_DEPRECATION_WARNINGS
+      if (A->GetValue()->GetDimension() == TDataStd_ANGULAR) val = (180. * val) / M_PI;
+      Standard_ENABLE_DEPRECATION_WARNINGS
       D->SetValue(val);
     }
     // unverified constraints are red (default is white)