]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Corrections for dimensions
authorvsv <vitaly.smetannikov@opencascade.com>
Wed, 15 Apr 2015 07:06:51 +0000 (10:06 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Wed, 15 Apr 2015 07:06:51 +0000 (10:06 +0300)
src/SketcherPrs/SketcherPrs_LengthDimension.cpp
src/SketcherPrs/SketcherPrs_Radius.cpp
src/SketcherPrs/SketcherPrs_Tools.cpp
src/SketcherPrs/SketcherPrs_Tools.h

index 17c316afc3a414b606b02a66dc792276ac62f74b..d2b062bfd10b70f8c0d30629f677de10584378a5 100644 (file)
@@ -55,36 +55,37 @@ void SketcherPrs_LengthDimension::Compute(const Handle(PrsMgr_PresentationManage
   gp_Pnt aPnt1, aPnt2;
   if (!getPoints(aPnt1, aPnt2))
     return;
-  DataPtr aData = myConstraint->data();
-
-  AttributePtr aFlyOutAttribute = aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT());
-  if (!aFlyOutAttribute->isInitialized()) {
-    return; // not possible to show length because points are not defined
-  }
-  std::shared_ptr<GeomDataAPI_Point2D> aFlyOutAttr = 
-    std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aFlyOutAttribute);
-  std::shared_ptr<GeomAPI_Pnt> aFlyoutPnt = myPlane->to3D(aFlyOutAttr->x(), aFlyOutAttr->y());
-  gp_Pnt aFlyPnt = aFlyoutPnt->impl<gp_Pnt>();
-
-  double aDistance = aPnt1.Distance(aPnt2);
-
-  double aFlyout = 0;
-  double aDist = 0.0;
-  if (aDistance < Precision::Confusion())
-    aDist = aPnt1.Distance(aFlyPnt);
-  else {
-    gp_Lin aLine(aPnt1, gp_Vec(aPnt1, aPnt2));
-    aDist = aLine.Distance(aFlyPnt);
-  }
-
-  gp_XYZ aLineDir = aPnt2.XYZ().Subtracted(aPnt1.XYZ());
-  gp_XYZ aFOutDir = aFlyPnt.XYZ().Subtracted(aPnt1.XYZ());
-  gp_XYZ aNorm = myPlane->norm()->xyz()->impl<gp_XYZ>();
-  if (aLineDir.Crossed(aFOutDir).Dot(aNorm) < 0)
-    aDist = -aDist;
-  aFlyout = aDist;
-
-  SetFlyout(aFlyout);
+  //DataPtr aData = myConstraint->data();
+
+  //AttributePtr aFlyOutAttribute = aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT());
+  //if (!aFlyOutAttribute->isInitialized()) {
+  //  return; // not possible to show length because points are not defined
+  //}
+  //std::shared_ptr<GeomDataAPI_Point2D> aFlyOutAttr = 
+  //  std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aFlyOutAttribute);
+  //std::shared_ptr<GeomAPI_Pnt> aFlyoutPnt = myPlane->to3D(aFlyOutAttr->x(), aFlyOutAttr->y());
+  //gp_Pnt aFlyPnt = aFlyoutPnt->impl<gp_Pnt>();
+
+  //double aDistance = aPnt1.Distance(aPnt2);
+
+  //double aFlyout = 0;
+  //double aDist = 0.0;
+  //if (aDistance < Precision::Confusion())
+  //  aDist = aPnt1.Distance(aFlyPnt);
+  //else {
+  //  gp_Lin aLine(aPnt1, gp_Vec(aPnt1, aPnt2));
+  //  aDist = aLine.Distance(aFlyPnt);
+  //}
+
+  //gp_XYZ aLineDir = aPnt2.XYZ().Subtracted(aPnt1.XYZ());
+  //gp_XYZ aFOutDir = aFlyPnt.XYZ().Subtracted(aPnt1.XYZ());
+  //gp_XYZ aNorm = myPlane->norm()->xyz()->impl<gp_XYZ>();
+  //if (aLineDir.Crossed(aFOutDir).Dot(aNorm) < 0)
+  //  aDist = -aDist;
+  //aFlyout = aDist;
+
+  //SetFlyout(aFlyout);
+  SetFlyout(SketcherPrs_Tools::getFlyoutDistance(myConstraint, myPlane));
   SetMeasuredGeometry(aPnt1, aPnt2, myPlane->impl<gp_Ax3>());
   AIS_LengthDimension::Compute(thePresentationManager, thePresentation, theMode);
 }
index a3643fe08698926dd83629401a1afe6adeeb77b6..6f398803684351741ba609bb3fa18c9e998d45ed 100644 (file)
@@ -83,7 +83,6 @@ void SketcherPrs_Radius::Compute(const Handle(PrsMgr_PresentationManager3d)& the
   std::shared_ptr<GeomAPI_Dir> aNormal = myPlane->norm();
 
   GeomAPI_Circ aCircle(aCenter, aNormal, aRadius);
-  //gp_Circ aCircle(gp_Ax2(aCenter->impl<gp_Pnt>(), aNormal->impl<gp_Dir>()), aRadius);
     
   std::shared_ptr<GeomAPI_Pnt> anAnchor = aCircle.project(aFlyoutPnt);
   std::shared_ptr<GeomAPI_XYZ> anAnchorXYZ = anAnchor->xyz();
index 8c28de0b09ff9888dff66e7313c3a7f637fa6a6d..94b98c2951d536f3ec5daf55577b6bca4dc792ea 100644 (file)
@@ -142,4 +142,11 @@ void setArrowSize(double theSize)
   MyArrowSize = theSize;
 }
 
+double getFlyoutDistance(const ModelAPI_Feature* theConstraint, 
+                         const std::shared_ptr<GeomAPI_Ax3>& thePlane)
+{
+  return 50;
+}
+
+
 };
index 00a2e96630948e82c01f8d29523879ae78e0f760..bda6b2a73e9559e987df4028ea4ffe2076ae91a8 100644 (file)
@@ -10,6 +10,7 @@
 #include "SketcherPrs.h"
 #include <GeomAPI_Shape.h>
 #include <GeomAPI_Pnt2d.h>
+#include <GeomAPI_Ax3.h>
 #include <ModelAPI_Object.h>
 #include <ModelAPI_Feature.h>
 #include <string>
@@ -60,6 +61,9 @@ enum SelectionModes {
   SKETCHERPRS_EXPORT double getArrowSize();
 
   SKETCHERPRS_EXPORT void setArrowSize(double theSize);
+
+  SKETCHERPRS_EXPORT double getFlyoutDistance(const ModelAPI_Feature* theConstraint, 
+                                              const std::shared_ptr<GeomAPI_Ax3>& thePlane);
 };
 
 #endif