]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Create dimension presentations
authorvsv <vitaly.smetannikov@opencascade.com>
Fri, 27 Mar 2015 14:14:07 +0000 (17:14 +0300)
committervsv <vitaly.smetannikov@opencascade.com>
Fri, 27 Mar 2015 14:14:07 +0000 (17:14 +0300)
14 files changed:
src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp
src/SketchPlugin/SketchPlugin_ConstraintDistance.h
src/SketchPlugin/SketchPlugin_ConstraintLength.cpp
src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp
src/SketchPlugin/SketchPlugin_Validators.cpp
src/SketcherPrs/CMakeLists.txt
src/SketcherPrs/SketcherPrs_Factory.cpp
src/SketcherPrs/SketcherPrs_Factory.h
src/SketcherPrs/SketcherPrs_LengthDimension.cpp [new file with mode: 0644]
src/SketcherPrs/SketcherPrs_LengthDimension.h [new file with mode: 0644]
src/SketcherPrs/SketcherPrs_Radius.cpp [new file with mode: 0644]
src/SketcherPrs/SketcherPrs_Radius.h [new file with mode: 0644]
src/SketcherPrs/SketcherPrs_Tools.cpp
src/SketcherPrs/SketcherPrs_Tools.h

index 89bc7e429200644e92cf25f1a7cf015746bbc426..59ca35b02cc6fcebf2681d99929a8219f415238f 100644 (file)
@@ -9,6 +9,9 @@
 #include <SketchPlugin_Circle.h>
 #include <SketchPlugin_Line.h>
 
+#include <SketcherPrs_Tools.h>
+#include <SketcherPrs_Factory.h>
+
 #include <GeomAPI_Lin2d.h>
 #include <GeomAPI_Pnt2d.h>
 #include <GeomDataAPI_Point2D.h>
@@ -20,6 +23,7 @@
 
 const double tolerance = 1e-7;
 
+
 SketchPlugin_ConstraintDistance::SketchPlugin_ConstraintDistance()
 {
 }
@@ -66,9 +70,9 @@ bool SketchPlugin_ConstraintDistance::compute(const std::string& theAttributeId)
     return false;
 
   DataPtr aData = data();
-  std::shared_ptr<GeomDataAPI_Point2D> aPoint_A = getFeaturePoint(
+  std::shared_ptr<GeomDataAPI_Point2D> aPoint_A = SketcherPrs_Tools::getFeaturePoint(
       aData, SketchPlugin_Constraint::ENTITY_A());
-  std::shared_ptr<GeomDataAPI_Point2D> aPoint_B = getFeaturePoint(
+  std::shared_ptr<GeomDataAPI_Point2D> aPoint_B = SketcherPrs_Tools::getFeaturePoint(
       aData, SketchPlugin_Constraint::ENTITY_B());
 
   std::shared_ptr<GeomAPI_Pnt2d> aPnt_A;
@@ -78,18 +82,18 @@ bool SketchPlugin_ConstraintDistance::compute(const std::string& theAttributeId)
     aPnt_A = aPoint_A->pnt();
     aPnt_B = aPoint_B->pnt();
   } else if (!aPoint_A && aPoint_B) {
-    std::shared_ptr<SketchPlugin_Line> aLine = getFeatureLine(
+    std::shared_ptr<SketchPlugin_Line> aLine = SketcherPrs_Tools::getFeatureLine(
         aData, SketchPlugin_Constraint::ENTITY_A());
     if (aLine) {
       aPnt_B = aPoint_B->pnt();
-      aPnt_A = getProjectionPoint(aLine, aPnt_B);
+      aPnt_A = SketcherPrs_Tools::getProjectionPoint(aLine, aPnt_B);
     }
   } else if (aPoint_A && !aPoint_B) {
-    std::shared_ptr<SketchPlugin_Line> aLine = getFeatureLine(
+    std::shared_ptr<SketchPlugin_Line> aLine = SketcherPrs_Tools::getFeatureLine(
         aData, SketchPlugin_Constraint::ENTITY_B());
     if (aLine) {
       aPnt_A = aPoint_A->pnt();
-      aPnt_B = getProjectionPoint(aLine, aPnt_A);
+      aPnt_B = SketcherPrs_Tools::getProjectionPoint(aLine, aPnt_A);
     }
   }
   if (!aPnt_A || !aPnt_B)
@@ -118,61 +122,10 @@ AISObjectPtr SketchPlugin_ConstraintDistance::getAISObject(AISObjectPtr thePrevi
   if (!sketch())
     return thePrevious;
 
-  std::shared_ptr<GeomAPI_Pln> aPlane = sketch()->plane();
-
-  DataPtr aData = data();
-  std::shared_ptr<GeomDataAPI_Point2D> aPoint_A = getFeaturePoint(
-      aData, SketchPlugin_Constraint::ENTITY_A());
-  std::shared_ptr<GeomDataAPI_Point2D> aPoint_B = getFeaturePoint(
-      aData, SketchPlugin_Constraint::ENTITY_B());
-
-  std::shared_ptr<GeomAPI_Pnt2d> aPnt_A;
-  std::shared_ptr<GeomAPI_Pnt2d> aPnt_B;
-
-  if (aPoint_A && aPoint_B) {
-    aPnt_A = aPoint_A->pnt();
-    aPnt_B = aPoint_B->pnt();
-  } else if (!aPoint_A && aPoint_B) {
-    std::shared_ptr<SketchPlugin_Line> aLine = getFeatureLine(
-        aData, SketchPlugin_Constraint::ENTITY_A());
-    if (aLine) {
-      aPnt_B = aPoint_B->pnt();
-      aPnt_A = getProjectionPoint(aLine, aPnt_B);
-    }
-  } else if (aPoint_A && !aPoint_B) {
-    std::shared_ptr<SketchPlugin_Line> aLine = getFeatureLine(
-        aData, SketchPlugin_Constraint::ENTITY_B());
-    if (aLine) {
-      aPnt_A = aPoint_A->pnt();
-      aPnt_B = getProjectionPoint(aLine, aPnt_A);
-    }
-  }
-  if (!aPnt_A || !aPnt_B)
-    return AISObjectPtr();
-
-  std::shared_ptr<GeomDataAPI_Point2D> aFlyOutAttr = std::dynamic_pointer_cast<
-      GeomDataAPI_Point2D>(aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
-
-  std::shared_ptr<GeomAPI_Pnt> aPoint1 = sketch()->to3D(aPnt_A->x(), aPnt_A->y());
-  std::shared_ptr<GeomAPI_Pnt> aPoint2 = sketch()->to3D(aPnt_B->x(), aPnt_B->y());
-  if(!aFlyOutAttr->isInitialized())
-    return AISObjectPtr();
-  std::shared_ptr<GeomAPI_Pnt> aFlyoutPnt = sketch()->to3D(aFlyOutAttr->x(), aFlyOutAttr->y()/*aFPnt->x(), aFPnt->y()*/);
-
-  // value calculation
-  std::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = std::dynamic_pointer_cast<
-      ModelAPI_AttributeDouble>(aData->attribute(SketchPlugin_Constraint::VALUE()));
-  double aValue = 0;
-  // Issue #196: checking the positivity of the distance constraint
-  // there is a validator for a distance constraint, that the value should be positive
-  // in case if an invalid value is set, the current distance value is shown
-  if (aValueAttr->isInitialized())
-    aValue = aValueAttr->value();
-
   AISObjectPtr anAIS = thePrevious;
-  if (!anAIS)
-    anAIS = AISObjectPtr(new GeomAPI_AISObject);
-  anAIS->createDistance(aPoint1, aPoint2, aFlyoutPnt, aPlane, aValue);
+  if (!anAIS) {
+    anAIS = SketcherPrs_Factory::lengthDimensionConstraint(this, sketch()->coordinatePlane());
+  }
 
   // Set color from preferences
   std::vector<int> aRGB = Config_PropManager::color("Visualization", "sketch_dimension_color",
@@ -199,22 +152,22 @@ double SketchPlugin_ConstraintDistance::calculateCurrentDistance() const
 
   std::shared_ptr<ModelAPI_Data> aData = data();
   std::shared_ptr<GeomDataAPI_Point2D> aPointA =
-    getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_A());
+    SketcherPrs_Tools::getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_A());
   std::shared_ptr<GeomDataAPI_Point2D> aPointB =
-      getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_B());
+      SketcherPrs_Tools::getFeaturePoint(aData, SketchPlugin_Constraint::ENTITY_B());
 
   if (aPointA && aPointB) {  // both points
     aDistance = aPointA->pnt()->distance(aPointB->pnt());
   } else {
     if (!aPointA && aPointB) {  //Line and point
       std::shared_ptr<SketchPlugin_Line> aLine =
-          getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_A());
+          SketcherPrs_Tools::getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_A());
       if (aLine) {
         aDistance = aLine->distanceToPoint(aPointB->pnt());
       }
     } else if (aPointA && !aPointB) {  // Point and line
       std::shared_ptr<SketchPlugin_Line> aLine =
-          getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_B());
+          SketcherPrs_Tools::getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_B());
       if (aLine) {
         aDistance = aLine->distanceToPoint(aPointA->pnt());
       }
@@ -238,63 +191,3 @@ void SketchPlugin_ConstraintDistance::attributeChanged(const std::string& theID)
   }
 }
 
-//*************************************************************************************
-std::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(DataPtr theData,
-                                                       const std::string& theAttribute)
-{
-  std::shared_ptr<GeomDataAPI_Point2D> aPointAttr;
-
-  if (!theData)
-    return aPointAttr;
-
-  FeaturePtr aFeature;
-  std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = std::dynamic_pointer_cast<
-      ModelAPI_AttributeRefAttr>(theData->attribute(theAttribute));
-  if (anAttr)
-    aFeature = ModelAPI_Feature::feature(anAttr->object());
-
-  if (aFeature && aFeature->getKind() == SketchPlugin_Point::ID())
-    aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        aFeature->data()->attribute(SketchPlugin_Point::COORD_ID()));
-  else if (aFeature && aFeature->getKind() == SketchPlugin_Circle::ID())
-    aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        aFeature->data()->attribute(SketchPlugin_Circle::CENTER_ID()));
-  else if (anAttr->attr()) {
-    aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttr->attr());
-  }
-  return aPointAttr;
-}
-
-//*************************************************************************************
-std::shared_ptr<SketchPlugin_Line> getFeatureLine(DataPtr theData,
-                                                    const std::string& theAttribute)
-{
-  std::shared_ptr<SketchPlugin_Line> aLine;
-  if (!theData)
-    return aLine;
-
-  std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = std::dynamic_pointer_cast<
-      ModelAPI_AttributeRefAttr>(theData->attribute(theAttribute));
-  if (anAttr) {
-    FeaturePtr aFeature = ModelAPI_Feature::feature(anAttr->object());
-    if (aFeature && aFeature->getKind() == SketchPlugin_Line::ID()) {
-      aLine = std::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
-    }
-  }
-  return aLine;
-}
-
-//*************************************************************************************
-std::shared_ptr<GeomAPI_Pnt2d> getProjectionPoint(
-    const std::shared_ptr<SketchPlugin_Line>& theLine,
-    const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
-{
-  std::shared_ptr<ModelAPI_Data> aData = theLine->data();
-  std::shared_ptr<GeomDataAPI_Point2D> aPoint1 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-      aData->attribute(SketchPlugin_Line::START_ID()));
-  std::shared_ptr<GeomDataAPI_Point2D> aPoint2 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-      aData->attribute(SketchPlugin_Line::END_ID()));
-
-  GeomAPI_Lin2d aLin2d(aPoint1->x(), aPoint1->y(), aPoint2->x(), aPoint2->y());
-  return aLin2d.project(thePoint);
-}
index 9bc3d5d06cfe07cabe52ddb9e8c220ba7f13ecf2..3529ace3c9479171410387cc0ae9ddcc5fc2d0ae 100644 (file)
@@ -72,15 +72,4 @@ class SketchPlugin_ConstraintDistance : public SketchPlugin_ConstraintBase
   SketchPlugin_ConstraintDistance();
 };
 
-/// Obtain the point object from specified constraint parameter
-std::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(DataPtr theData,
-                                                       const std::string& theAttribute);
-
-std::shared_ptr<SketchPlugin_Line> getFeatureLine(DataPtr theData,
-                                                    const std::string& theAttribute);
-
-std::shared_ptr<GeomAPI_Pnt2d> getProjectionPoint(
-    const std::shared_ptr<SketchPlugin_Line>& theLine,
-    const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
-
 #endif
index 06cf90cb77f4ae0bd4a29de0bfbc8efab441f9a9..8162b5c613c2a15a683bbcac28376f0f3ec3a80a 100644 (file)
@@ -9,6 +9,8 @@
 
 #include <GeomDataAPI_Point2D.h>
 
+#include <SketcherPrs_Factory.h>
+
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Result.h>
@@ -110,35 +112,13 @@ bool SketchPlugin_ConstraintLength::getPoints(
 
 AISObjectPtr SketchPlugin_ConstraintLength::getAISObject(AISObjectPtr thePrevious)
 {
-  std::shared_ptr<GeomAPI_Pnt> aPoint1, aPoint2;
-  std::shared_ptr<GeomDataAPI_Point2D> aStartPoint, anEndPoint;
-  if (!getPoints(aPoint1, aPoint2, aStartPoint, anEndPoint))
-    return thePrevious; // not possible to show length because points are not defined
-
-  AttributePtr aFlyOutAttribute = data()->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT());
-  if (!aFlyOutAttribute->isInitialized()) {
-    return thePrevious; // 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 = sketch()->to3D(aFlyOutAttr->x(), aFlyOutAttr->y());
-  // value calculation
-  // TODO: has to be calculated on definition of reference object
-  double aDistance = aPoint1->distance(aPoint2);
-  std::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = std::dynamic_pointer_cast<
-      ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE()));
-  double aValue = aDistance;
-  if (aValueAttr->isInitialized())
-    aValue = aValueAttr->value();
-  else 
-    aValueAttr->setValue(aValue);
-  // End TODO
+  if (!sketch())
+    return thePrevious;
 
   AISObjectPtr anAIS = thePrevious;
-  if (!anAIS)
-    anAIS = AISObjectPtr(new GeomAPI_AISObject);
-  std::shared_ptr<GeomAPI_Pln> aPlane = sketch()->plane();
-  anAIS->createDistance(aPoint1, aPoint2, aFlyoutPnt, aPlane, aValue);
+  if (!anAIS) {
+    anAIS = SketcherPrs_Factory::lengthDimensionConstraint(this, sketch()->coordinatePlane());
+  }
 
   // Set color from preferences
   std::vector<int> aRGB = Config_PropManager::color("Visualization", "sketch_dimension_color",
index f9532a620d074dfc13b3304ab08aa0b0c6344f48..af53efa5d5424e0ba4a0ebfce0cd607c9cdd2f66 100644 (file)
@@ -10,6 +10,8 @@
 #include <SketchPlugin_Circle.h>
 #include <SketchPlugin_Point.h>
 
+#include <SketcherPrs_Factory.h>
+
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_Data.h>
 
@@ -135,42 +137,13 @@ double SketchPlugin_ConstraintRadius::circleRadius(std::shared_ptr<ModelAPI_Feat
 
 AISObjectPtr SketchPlugin_ConstraintRadius::getAISObject(AISObjectPtr thePrevious)
 {
-  std::shared_ptr<ModelAPI_Feature> aCyrcFeature;
-  double aRadius = circleRadius(aCyrcFeature);
-  if (aRadius < 0)
-    return thePrevious; // can not create a good presentation
-
-  // Flyout point
-  std::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr = std::dynamic_pointer_cast<
-      GeomDataAPI_Point2D>(data()->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
-  if (!aFlyoutAttr->isInitialized())
-    return thePrevious; // can not create a good presentation
-  std::shared_ptr<GeomAPI_Pnt> aFlyoutPnt = sketch()->to3D(aFlyoutAttr->x(), aFlyoutAttr->y());
+  if (!sketch())
+    return thePrevious;
 
-  // Prepare a circle
-  std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr;
-  if (aCyrcFeature->getKind() == SketchPlugin_Circle::ID()) { // circle
-    aCenterAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        aCyrcFeature->data()->attribute(SketchPlugin_Circle::CENTER_ID()));
-  } else { // arc
-    aCenterAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
-        aCyrcFeature->data()->attribute(SketchPlugin_Arc::CENTER_ID()));
-  }
-  std::shared_ptr<GeomAPI_Pnt> aCenter = sketch()->to3D(aCenterAttr->x(), aCenterAttr->y());
-  std::shared_ptr<GeomDataAPI_Dir> aNDir = std::dynamic_pointer_cast<GeomDataAPI_Dir>(
-      sketch()->data()->attribute(SketchPlugin_Sketch::NORM_ID()));
-  std::shared_ptr<GeomAPI_Dir> aNormal = aNDir->dir();
-  std::shared_ptr<GeomAPI_Circ> aCircle(new GeomAPI_Circ(aCenter, aNormal, aRadius));
-
-  // Value
-  std::shared_ptr<ModelAPI_AttributeDouble> aValueAttr = std::dynamic_pointer_cast<
-      ModelAPI_AttributeDouble>(data()->attribute(SketchPlugin_Constraint::VALUE()));
-  if (aValueAttr->isInitialized())
-    aRadius = aValueAttr->value();
   AISObjectPtr anAIS = thePrevious;
-  if (!anAIS)
-    anAIS = AISObjectPtr(new GeomAPI_AISObject);
-  anAIS->createRadius(aCircle, aFlyoutPnt, aRadius);
+  if (!anAIS) {
+    anAIS = SketcherPrs_Factory::radiusConstraint(this, sketch()->coordinatePlane());
+  }
 
   // Set color from preferences
   std::vector<int> aRGB = Config_PropManager::color("Visualization", "sketch_dimension_color",
index a613620761710efe89c4f014b9fc02deff3c3bac..7fb075307806cadad45cbbd38c6b1bbe83d8c297 100644 (file)
@@ -10,6 +10,8 @@
 #include "SketchPlugin_Line.h"
 #include "SketchPlugin_Arc.h"
 
+#include "SketcherPrs_Tools.h"
+
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_AttributeDouble.h>
@@ -20,6 +22,7 @@
 
 #include <GeomDataAPI_Point2D.h>
 
+
 bool SketchPlugin_DistanceAttrValidator::isValid(
   const AttributePtr& theAttribute, const std::list<std::string>& theArguments ) const
 {
@@ -58,7 +61,7 @@ bool SketchPlugin_DistanceAttrValidator::isValid(
 
     FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theAttribute->owner());
     // If it is a line then we have to check that first attribute id not a line
-    std::shared_ptr<GeomDataAPI_Point2D> aPoint = getFeaturePoint(aFeature->data(), aParamA);
+    std::shared_ptr<GeomDataAPI_Point2D> aPoint = SketcherPrs_Tools::getFeaturePoint(aFeature->data(), aParamA);
     if (aPoint)
       return true;
   }
index 4af59f94d163cd719712004c7759a863678d44a2..be597690dc06f4a92d56770896d94c5823ea341b 100644 (file)
@@ -14,6 +14,8 @@ SET(PROJECT_HEADERS
        SketcherPrs_Equal.h
        SketcherPrs_Tangent.h
        SketcherPrs_SensitivePoint.h
+       SketcherPrs_Radius.h
+       SketcherPrs_LengthDimension.h
 )
 
 SET(PROJECT_SOURCES
@@ -29,6 +31,8 @@ SET(PROJECT_SOURCES
        SketcherPrs_Equal.cpp
        SketcherPrs_Tangent.cpp
        SketcherPrs_SensitivePoint.cpp
+       SketcherPrs_Radius.cpp
+       SketcherPrs_LengthDimension.cpp
 )
 
 SET(PROJECT_LIBRARIES
index b46070694c1d2fd4db6e1df60880768f2e089b23..04f9bf3b7fb3e91245bf03097d39f8f6f8ff10bb 100644 (file)
@@ -13,6 +13,8 @@
 #include "SketcherPrs_HVDirection.h"
 #include "SketcherPrs_Equal.h"
 #include "SketcherPrs_Tangent.h"
+#include "SketcherPrs_Radius.h"
+#include "SketcherPrs_LengthDimension.h"
 
 #define CONSTRAINT_PRS_IMPL(NAME, CLASS) \
 AISObjectPtr SketcherPrs_Factory::NAME(SketchPlugin_Constraint* theConstraint, \
@@ -30,6 +32,8 @@ CONSTRAINT_PRS_IMPL(perpendicularConstraint, SketcherPrs_Perpendicular);
 CONSTRAINT_PRS_IMPL(rigidConstraint, SketcherPrs_Rigid);
 CONSTRAINT_PRS_IMPL(equalConstraint, SketcherPrs_Equal);
 CONSTRAINT_PRS_IMPL(tangentConstraint, SketcherPrs_Tangent);
+CONSTRAINT_PRS_IMPL(radiusConstraint, SketcherPrs_Radius);
+CONSTRAINT_PRS_IMPL(lengthDimensionConstraint, SketcherPrs_LengthDimension);
 
 
 AISObjectPtr SketcherPrs_Factory::horisontalConstraint(SketchPlugin_Constraint* theConstraint,
index b6feedebc887265e3cd1a0d789999b8d32d05026..d416644f9cb315c56555cb9a04aa91bcb70b6d52 100644 (file)
@@ -64,6 +64,16 @@ public:
   /// \param theConstraint the constraint
   /// \param thePlane the current sketch plane
   GET_CONSTRAINT_PRS(tangentConstraint)
+
+  /// Creates coincedent perpendicular presentation
+  /// \param theConstraint the constraint
+  /// \param thePlane the current sketch plane
+  GET_CONSTRAINT_PRS(radiusConstraint)
+
+  /// Creates coincedent perpendicular presentation
+  /// \param theConstraint the constraint
+  /// \param thePlane the current sketch plane
+  GET_CONSTRAINT_PRS(lengthDimensionConstraint)
 };
 
 #endif
diff --git a/src/SketcherPrs/SketcherPrs_LengthDimension.cpp b/src/SketcherPrs/SketcherPrs_LengthDimension.cpp
new file mode 100644 (file)
index 0000000..0f5d2b8
--- /dev/null
@@ -0,0 +1,161 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        SketcherPrs_LengthDimension.cpp
+// Created:     27 March 2015
+// Author:      Vitaly SMETANNIKOV
+
+#include "SketcherPrs_LengthDimension.h"
+#include "SketcherPrs_Tools.h"
+
+#include <SketchPlugin_Constraint.h>
+#include <SketchPlugin_ConstraintLength.h>
+#include <SketchPlugin_ConstraintDistance.h>
+#include <SketchPlugin_Line.h>
+#include <SketchPlugin_Point.h>
+#include <SketchPlugin_Circle.h>
+
+#include <GeomDataAPI_Point2D.h>
+#include <GeomAPI_Pnt.h>
+#include <GeomAPI_XYZ.h>
+#include <GeomAPI_Pnt2d.h>
+#include <GeomAPI_Lin2d.h>
+
+#include <ModelAPI_Data.h>
+
+
+const int CONSTRAINT_TEXT_HEIGHT = 20;  /// the text height of the constraint
+const int CONSTRAINT_TEXT_SELECTION_TOLERANCE = 20;  /// the text selection tolerance
+
+
+static const gp_Pnt MyDefStart(0,0,0);
+static const gp_Pnt MyDefEnd(1,0,0);
+static const gp_Pln MyDefPln(gp_Pnt(0,0,0), gp_Dir(0,0,1));
+
+
+
+
+IMPLEMENT_STANDARD_HANDLE(SketcherPrs_LengthDimension, AIS_LengthDimension);
+IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_LengthDimension, AIS_LengthDimension);
+
+SketcherPrs_LengthDimension::SketcherPrs_LengthDimension(SketchPlugin_Constraint* theConstraint, 
+                        const std::shared_ptr<GeomAPI_Ax3>& thePlane)
+: AIS_LengthDimension(MyDefStart, MyDefEnd, MyDefPln), 
+myConstraint(theConstraint), myPlane(thePlane)
+{
+  myAspect = new Prs3d_DimensionAspect();
+  myAspect->MakeArrows3d(false);
+  myAspect->MakeText3d(false);
+  myAspect->MakeTextShaded(false);
+  myAspect->MakeUnitsDisplayed(false);
+
+  SetDimensionAspect(myAspect);
+  SetSelToleranceForText2d(CONSTRAINT_TEXT_SELECTION_TOLERANCE);
+}
+
+
+void SketcherPrs_LengthDimension::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
+                                 const Handle(Prs3d_Presentation)& thePresentation, 
+                                 const Standard_Integer theMode)
+{
+  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);
+  myAspect->TextAspect()->SetHeight(CONSTRAINT_TEXT_HEIGHT);
+  myAspect->ArrowAspect()->SetLength(CONSTRAINT_TEXT_HEIGHT * 2);
+
+  SetMeasuredGeometry(aPnt1, aPnt2, myPlane->impl<gp_Ax3>());
+  AIS_LengthDimension::Compute(thePresentationManager, thePresentation, theMode);
+}
+
+bool SketcherPrs_LengthDimension::getPoints(gp_Pnt& thePnt1, gp_Pnt& thePnt2) const
+{
+  DataPtr aData = myConstraint->data();
+  if (myConstraint->getKind() == SketchPlugin_ConstraintLength::ID()) {
+    std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = 
+      std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>
+      (aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
+    if (!anAttr)
+      return false;
+
+    FeaturePtr aFeature = ModelAPI_Feature::feature(anAttr->object());
+    if (!aFeature || aFeature->getKind() != SketchPlugin_Line::ID())
+      return false;
+
+    DataPtr aLineData = aFeature->data();
+    std::shared_ptr<GeomDataAPI_Point2D> aStartPoint = 
+      std::dynamic_pointer_cast<GeomDataAPI_Point2D>
+      (aLineData->attribute(SketchPlugin_Line::START_ID()));
+    std::shared_ptr<GeomDataAPI_Point2D> aEndPoint = 
+      std::dynamic_pointer_cast<GeomDataAPI_Point2D>
+      (aLineData->attribute(SketchPlugin_Line::END_ID()));
+    thePnt1 = myPlane->to3D(aStartPoint->x(), aStartPoint->y())->impl<gp_Pnt>();
+    thePnt2 = myPlane->to3D(aEndPoint->x(), aEndPoint->y())->impl<gp_Pnt>();
+    return true;
+
+  } else if (myConstraint->getKind() == SketchPlugin_ConstraintDistance::ID()) {
+    std::shared_ptr<GeomDataAPI_Point2D> aPoint_A = SketcherPrs_Tools::getFeaturePoint(
+        aData, SketchPlugin_Constraint::ENTITY_A());
+    std::shared_ptr<GeomDataAPI_Point2D> aPoint_B = SketcherPrs_Tools::getFeaturePoint(
+        aData, SketchPlugin_Constraint::ENTITY_B());
+
+    std::shared_ptr<GeomAPI_Pnt2d> aPnt_A;
+    std::shared_ptr<GeomAPI_Pnt2d> aPnt_B;
+    if (aPoint_A && aPoint_B) {
+      aPnt_A = aPoint_A->pnt();
+      aPnt_B = aPoint_B->pnt();
+    } else if (!aPoint_A && aPoint_B) {
+      std::shared_ptr<SketchPlugin_Line> aLine = SketcherPrs_Tools::getFeatureLine(
+          aData, SketchPlugin_Constraint::ENTITY_A());
+      if (aLine) {
+        aPnt_B = aPoint_B->pnt();
+        aPnt_A = SketcherPrs_Tools::getProjectionPoint(aLine, aPnt_B);
+      }
+    } else if (aPoint_A && !aPoint_B) {
+      std::shared_ptr<SketchPlugin_Line> aLine = SketcherPrs_Tools::getFeatureLine(
+          aData, SketchPlugin_Constraint::ENTITY_B());
+      if (aLine) {
+        aPnt_A = aPoint_A->pnt();
+        aPnt_B = SketcherPrs_Tools::getProjectionPoint(aLine, aPnt_A);
+      }
+    }
+    if (!aPnt_A || !aPnt_B)
+      return false;
+
+    std::shared_ptr<GeomAPI_Pnt> aPoint1 = myPlane->to3D(aPnt_A->x(), aPnt_A->y());
+    std::shared_ptr<GeomAPI_Pnt> aPoint2 = myPlane->to3D(aPnt_B->x(), aPnt_B->y());
+    thePnt1 = aPoint1->impl<gp_Pnt>();
+    thePnt2 = aPoint2->impl<gp_Pnt>();
+    return true;
+  }
+  return false;
+}
diff --git a/src/SketcherPrs/SketcherPrs_LengthDimension.h b/src/SketcherPrs/SketcherPrs_LengthDimension.h
new file mode 100644 (file)
index 0000000..94bd89c
--- /dev/null
@@ -0,0 +1,54 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        SketcherPrs_LengthDimension.h
+// Created:     27 March 2015
+// Author:      Vitaly SMETANNIKOV
+
+
+#ifndef SketcherPrs_LinearDimension_H
+#define SketcherPrs_LinearDimension_H
+
+#include <GeomAPI_Ax3.h>
+#include <AIS_LengthDimension.hxx>
+#include <Standard_DefineHandle.hxx>
+
+
+class SketchPlugin_Constraint;
+
+DEFINE_STANDARD_HANDLE(SketcherPrs_LengthDimension, AIS_LengthDimension)
+
+/**
+* \ingroup GUI
+* A class for representation of linear dimension constraint.
+* It supports SketchPlugin_ConstraintLength and SketchPlugin_ConstraintDistance features.
+*/
+class SketcherPrs_LengthDimension : public AIS_LengthDimension
+{
+public:
+  /// Constructor
+  /// \param theConstraint a constraint feature
+  /// \param thePlane a coordinate plane of current sketch
+  Standard_EXPORT SketcherPrs_LengthDimension(SketchPlugin_Constraint* theConstraint, 
+                        const std::shared_ptr<GeomAPI_Ax3>& thePlane);
+
+  std::string constraintType() const;
+
+  DEFINE_STANDARD_RTTI(SketcherPrs_LengthDimension)
+protected:
+  /// Redefinition of virtual function
+  Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
+    const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
+
+private:
+  bool getPoints(gp_Pnt& thePnt1, gp_Pnt& thePnt2) const;
+
+  /// Constraint feature
+  SketchPlugin_Constraint* myConstraint;
+
+  /// Plane of the current sketcher
+  std::shared_ptr<GeomAPI_Ax3> myPlane;
+
+  Handle(Prs3d_DimensionAspect) myAspect;
+};
+
+#endif
\ No newline at end of file
diff --git a/src/SketcherPrs/SketcherPrs_Radius.cpp b/src/SketcherPrs/SketcherPrs_Radius.cpp
new file mode 100644 (file)
index 0000000..bdefd51
--- /dev/null
@@ -0,0 +1,103 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        SketcherPrs_Radius.cpp
+// Created:     26 March 2015
+// Author:      Vitaly SMETANNIKOV
+
+#include "SketcherPrs_Radius.h"
+
+#include <SketchPlugin_ConstraintRadius.h>
+#include <SketchPlugin_Constraint.h>
+#include <SketchPlugin_Circle.h>
+#include <SketchPlugin_Arc.h>
+
+#include <GeomDataAPI_Point2D.h>
+#include <GeomAPI_Pnt2D.h>
+#include <GeomAPI_Circ.h>
+#include <GeomAPI_XYZ.h>
+#include <ModelAPI_AttributeDouble.h>
+
+const int CONSTRAINT_TEXT_HEIGHT = 20;  /// the text height of the constraint
+const int CONSTRAINT_TEXT_SELECTION_TOLERANCE = 20;  /// the text selection tolerance
+
+static gp_Circ MyDefCirc(gp_Ax2(gp_Pnt(0,0,0), gp_Dir(0,0,1)), 1);
+
+IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Radius, AIS_RadiusDimension);
+IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Radius, AIS_RadiusDimension);
+
+SketcherPrs_Radius::SketcherPrs_Radius(SketchPlugin_Constraint* theConstraint, 
+                                       const std::shared_ptr<GeomAPI_Ax3>& thePlane)
+: AIS_RadiusDimension(MyDefCirc), myConstraint(theConstraint), myPlane(thePlane)
+{
+  myAspect = new Prs3d_DimensionAspect();
+  myAspect->MakeArrows3d(false);
+  myAspect->MakeText3d(false);
+  myAspect->MakeTextShaded(false);
+  myAspect->MakeUnitsDisplayed(false);
+  
+  SetDimensionAspect(myAspect);
+  SetSelToleranceForText2d(CONSTRAINT_TEXT_SELECTION_TOLERANCE);
+}
+
+
+void SketcherPrs_Radius::Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
+                                 const Handle(Prs3d_Presentation)& thePresentation, 
+                                 const Standard_Integer theMode)
+{
+  DataPtr aData = myConstraint->data();
+
+  // Flyout point
+  std::shared_ptr<GeomDataAPI_Point2D> aFlyoutAttr = 
+    std::dynamic_pointer_cast<GeomDataAPI_Point2D>
+    (aData->attribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT()));
+  if (!aFlyoutAttr->isInitialized())
+    return; // can not create a good presentation
+
+  std::shared_ptr<GeomAPI_Pnt> aFlyoutPnt = myPlane->to3D(aFlyoutAttr->x(), aFlyoutAttr->y());
+
+  // Get circle
+  std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = 
+    std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>
+    (aData->attribute(SketchPlugin_Constraint::ENTITY_A()));
+  if (!anAttr) return;
+
+  std::shared_ptr<ModelAPI_Feature> aCyrcFeature = ModelAPI_Feature::feature(anAttr->object());
+  double aRadius = 1;
+  std::shared_ptr<GeomDataAPI_Point2D> aCenterAttr;
+  if (aCyrcFeature->getKind() == SketchPlugin_Circle::ID()) { // circle
+    aCenterAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+        aCyrcFeature->data()->attribute(SketchPlugin_Circle::CENTER_ID()));
+    AttributeDoublePtr aCircRadius = 
+      std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
+      aCyrcFeature->data()->attribute(SketchPlugin_Circle::RADIUS_ID()));
+    aRadius = aCircRadius->value();
+  } else { // arc
+    aCenterAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+        aCyrcFeature->data()->attribute(SketchPlugin_Arc::CENTER_ID()));
+    std::shared_ptr<GeomDataAPI_Point2D> aStartAttr = 
+      std::dynamic_pointer_cast<GeomDataAPI_Point2D>
+      (aCyrcFeature->data()->attribute(SketchPlugin_Arc::START_ID()));
+    aRadius = aCenterAttr->pnt()->distance(aStartAttr->pnt());
+  }
+  std::shared_ptr<GeomAPI_Pnt> aCenter = myPlane->to3D(aCenterAttr->x(), aCenterAttr->y());
+  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();
+  anAnchorXYZ = anAnchorXYZ->decreased(aCenter->xyz());
+  std::shared_ptr<GeomAPI_Dir> aDeltaDir(new GeomAPI_Dir(anAnchorXYZ));
+  const double aDelta = 1e-3;
+  anAnchor->setX(anAnchor->x() + aDelta * aDeltaDir->x());
+  anAnchor->setY(anAnchor->y() + aDelta * aDeltaDir->y());
+  anAnchor->setZ(anAnchor->z() + aDelta * aDeltaDir->z());
+
+  SetMeasuredGeometry(aCircle.impl<gp_Circ>(), anAnchor->impl<gp_Pnt>());
+  SetCustomValue(aRadius);
+
+  myAspect->TextAspect()->SetHeight(CONSTRAINT_TEXT_HEIGHT);
+  myAspect->ArrowAspect()->SetLength(CONSTRAINT_TEXT_HEIGHT * 2.);
+  AIS_RadiusDimension::Compute(thePresentationManager, thePresentation, theMode);
+}
diff --git a/src/SketcherPrs/SketcherPrs_Radius.h b/src/SketcherPrs/SketcherPrs_Radius.h
new file mode 100644 (file)
index 0000000..0b32639
--- /dev/null
@@ -0,0 +1,49 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        SketcherPrs_Radius.h
+// Created:     26 March 2015
+// Author:      Vitaly SMETANNIKOV
+
+
+#ifndef SketcherPrs_Radius_H
+#define SketcherPrs_Radius_H
+
+#include <GeomAPI_Ax3.h>
+
+#include <AIS_RadiusDimension.hxx>
+#include <Standard_DefineHandle.hxx>
+
+class SketchPlugin_Constraint;
+
+DEFINE_STANDARD_HANDLE(SketcherPrs_Radius, AIS_RadiusDimension)
+
+/**
+* \ingroup GUI
+* A class for representation of radius constraint
+*/
+class SketcherPrs_Radius : public AIS_RadiusDimension
+{
+public:
+  /// Constructor
+  /// \param theConstraint a constraint feature
+  /// \param thePlane a coordinate plane of current sketch
+  Standard_EXPORT SketcherPrs_Radius(SketchPlugin_Constraint* theConstraint, 
+                        const std::shared_ptr<GeomAPI_Ax3>& thePlane);
+
+  DEFINE_STANDARD_RTTI(SketcherPrs_Radius)
+protected:
+  /// Redefinition of virtual function
+  Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
+    const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
+
+private:
+  /// Constraint feature
+  SketchPlugin_Constraint* myConstraint;
+
+  /// Plane of the current sketcher
+  std::shared_ptr<GeomAPI_Ax3> myPlane;
+
+  Handle(Prs3d_DimensionAspect) myAspect;
+};
+
+#endif
\ No newline at end of file
index 2c575e1a3261fbd5a26c1b8415b896e70ea40731..7fb7bf949256501a65501797387cfe951a0e45bf 100644 (file)
@@ -9,10 +9,13 @@
 #include <SketchPlugin_Constraint.h>
 #include <SketchPlugin_Point.h>
 #include <SketchPlugin_Circle.h>
+#include <SketchPlugin_Line.h>
+
 #include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_AttributeRefAttr.h>
 
 #include <GeomDataAPI_Point2D.h>
+#include <GeomAPI_Lin2d.h>
 
 
 namespace SketcherPrs_Tools {
@@ -67,5 +70,67 @@ std::shared_ptr<GeomAPI_Pnt2d> getPoint(SketchPlugin_Constraint* theFeature,
   return std::shared_ptr<GeomAPI_Pnt2d>();
 }
 
+//*************************************************************************************
+std::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(DataPtr theData,
+                                                     const std::string& theAttribute)
+{
+  std::shared_ptr<GeomDataAPI_Point2D> aPointAttr;
+
+  if (!theData)
+    return aPointAttr;
+
+  FeaturePtr aFeature;
+  std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = std::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(theData->attribute(theAttribute));
+  if (anAttr)
+    aFeature = ModelAPI_Feature::feature(anAttr->object());
+
+  if (aFeature && aFeature->getKind() == SketchPlugin_Point::ID())
+    aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+        aFeature->data()->attribute(SketchPlugin_Point::COORD_ID()));
+
+  else if (aFeature && aFeature->getKind() == SketchPlugin_Circle::ID())
+    aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+        aFeature->data()->attribute(SketchPlugin_Circle::CENTER_ID()));
+
+  else if (anAttr->attr()) {
+    aPointAttr = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(anAttr->attr());
+  }
+  return aPointAttr;
+}
+
+//*************************************************************************************
+std::shared_ptr<SketchPlugin_Line> getFeatureLine(DataPtr theData,
+                                                  const std::string& theAttribute)
+{
+  std::shared_ptr<SketchPlugin_Line> aLine;
+  if (!theData)
+    return aLine;
+
+  std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = std::dynamic_pointer_cast<
+      ModelAPI_AttributeRefAttr>(theData->attribute(theAttribute));
+  if (anAttr) {
+    FeaturePtr aFeature = ModelAPI_Feature::feature(anAttr->object());
+    if (aFeature && aFeature->getKind() == SketchPlugin_Line::ID()) {
+      aLine = std::dynamic_pointer_cast<SketchPlugin_Line>(aFeature);
+    }
+  }
+  return aLine;
+}
+
+//*************************************************************************************
+std::shared_ptr<GeomAPI_Pnt2d> getProjectionPoint(
+    const std::shared_ptr<SketchPlugin_Line>& theLine,
+    const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
+{
+  std::shared_ptr<ModelAPI_Data> aData = theLine->data();
+  std::shared_ptr<GeomDataAPI_Point2D> aPoint1 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Line::START_ID()));
+  std::shared_ptr<GeomDataAPI_Point2D> aPoint2 = std::dynamic_pointer_cast<GeomDataAPI_Point2D>(
+      aData->attribute(SketchPlugin_Line::END_ID()));
+
+  GeomAPI_Lin2d aLin2d(aPoint1->x(), aPoint1->y(), aPoint2->x(), aPoint2->y());
+  return aLin2d.project(thePoint);
+}
 
 };
\ No newline at end of file
index 3cde3ea2a6e32dd95337a71b97b30baaff23fa39..46f9fa4fc023cc123722c99d717925eded2114cb 100644 (file)
 #include <string>
 
 class SketchPlugin_Constraint;
+class SketchPlugin_Line;
+class GeomDataAPI_Point2D;
 
 namespace SketcherPrs_Tools {
 
-  ObjectPtr getResult(SketchPlugin_Constraint* theFeature,
+  SKETCHERPRS_EXPORT ObjectPtr getResult(SketchPlugin_Constraint* theFeature,
                       const std::string& theAttrName);
 
-  std::shared_ptr<GeomAPI_Shape> getShape(ObjectPtr theObject);
+  SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Shape> getShape(ObjectPtr theObject);
 
-  std::shared_ptr<GeomAPI_Pnt2d> getPoint(SketchPlugin_Constraint* theFeature,
+  SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Pnt2d> getPoint(SketchPlugin_Constraint* theFeature,
                                           const std::string& theAttrName);
 
+  SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Pnt2d> getProjectionPoint(
+                        const std::shared_ptr<SketchPlugin_Line>& theLine,
+                        const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
+
+  SKETCHERPRS_EXPORT std::shared_ptr<SketchPlugin_Line> getFeatureLine(DataPtr theData,
+                                                    const std::string& theAttribute);
+
+  /// Obtain the point object from specified constraint parameter
+  SKETCHERPRS_EXPORT std::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(DataPtr theData,
+                                                       const std::string& theAttribute);
+
 };
 
 #endif
\ No newline at end of file