]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'Dev_1.1.0' of newgeom:newgeom into Dev_1.1.0
authornds <natalia.donis@opencascade.com>
Thu, 2 Apr 2015 14:08:02 +0000 (17:08 +0300)
committernds <natalia.donis@opencascade.com>
Thu, 2 Apr 2015 14:08:02 +0000 (17:08 +0300)
38 files changed:
src/Model/Model_AttributeRefAttr.cpp
src/Model/Model_AttributeRefList.cpp
src/Model/Model_AttributeReference.cpp
src/Model/Model_AttributeSelection.cpp
src/Model/Model_Data.h
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_SketcherMgr.h
src/PartSet/PartSet_WidgetSketchLabel.cpp
src/SketchPlugin/SketchPlugin_ConstraintDistance.cpp
src/SketchPlugin/SketchPlugin_ConstraintFillet.cpp
src/SketchPlugin/SketchPlugin_Line.cpp
src/SketchPlugin/SketchPlugin_Line.h
src/SketchSolver/SketchSolver_ConstraintGroup.cpp
src/SketcherPrs/SketcherPrs_Coincident.cpp
src/SketcherPrs/SketcherPrs_Coincident.h
src/SketcherPrs/SketcherPrs_Equal.cpp
src/SketcherPrs/SketcherPrs_Equal.h
src/SketcherPrs/SketcherPrs_Factory.cpp
src/SketcherPrs/SketcherPrs_Factory.h
src/SketcherPrs/SketcherPrs_HVDirection.cpp
src/SketcherPrs/SketcherPrs_HVDirection.h
src/SketcherPrs/SketcherPrs_LengthDimension.cpp
src/SketcherPrs/SketcherPrs_LengthDimension.h
src/SketcherPrs/SketcherPrs_Parallel.cpp
src/SketcherPrs/SketcherPrs_Parallel.h
src/SketcherPrs/SketcherPrs_Perpendicular.cpp
src/SketcherPrs/SketcherPrs_Perpendicular.h
src/SketcherPrs/SketcherPrs_Radius.cpp
src/SketcherPrs/SketcherPrs_Radius.h
src/SketcherPrs/SketcherPrs_Rigid.cpp
src/SketcherPrs/SketcherPrs_Rigid.h
src/SketcherPrs/SketcherPrs_SymbolPrs.cpp
src/SketcherPrs/SketcherPrs_SymbolPrs.h
src/SketcherPrs/SketcherPrs_Tangent.cpp
src/SketcherPrs/SketcherPrs_Tangent.h
src/SketcherPrs/SketcherPrs_Tools.cpp
src/SketcherPrs/SketcherPrs_Tools.h
src/XGUI/XGUI_ModuleConnector.cpp

index 2d900eb142221d089617a372e714d182ebf54aa2..38e989e047ca7f10928df123f79e44117b43d02a 100644 (file)
@@ -23,8 +23,10 @@ void Model_AttributeRefAttr::setAttr(std::shared_ptr<ModelAPI_Attribute> theAttr
   string anID = aData->id(theAttr);
   if (myIsInitialized && object() == theAttr->owner() && myID->Get().IsEqual(anID.c_str()))
     return;  // nothing is changed
+  REMOVE_BACK_REF(theAttr->owner());
   myRef->Set(aData->label().Father());
   myID->Set(aData->id(theAttr).c_str());
+  ADD_BACK_REF(theAttr->owner());
   owner()->data()->sendAttributeUpdated(this);
 }
 
@@ -43,16 +45,9 @@ void Model_AttributeRefAttr::setObject(ObjectPtr theObject)
 {
   // the back reference from the previous object to the attribute should be removed
   ObjectPtr anObject = object();
-  if (anObject.get() && anObject != theObject) {
-    FeaturePtr anOwnerFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
-    if (anOwnerFeature.get()) {
-      std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(
-                                          anObject->data());
-      aData->removeBackReference(anOwnerFeature, id());
-    }
-  }
-
   if (theObject && (!myIsInitialized || myID->Get().Length() != 0 || object() != theObject)) {
+    REMOVE_BACK_REF(anObject);
+
     std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(
         theObject->data());
     myRef->Set(aData->label().Father());
@@ -64,8 +59,10 @@ void Model_AttributeRefAttr::setObject(ObjectPtr theObject)
     if (anOwnerFeature.get()) {
       aData->addBackReference(anOwnerFeature, id(), false);
     }
+    ADD_BACK_REF(theObject);
     owner()->data()->sendAttributeUpdated(this);
   } else if (theObject.get() == NULL) {
+    REMOVE_BACK_REF(anObject);
     myRef->Set(myRef->Label()); // reference to itself means that object is null
     myID->Set("");  // feature is identified by the empty ID
     owner()->data()->sendAttributeUpdated(this);
index c9722835887b00258b8e1acbac9797dac0dd06c1..c09190f3326da11cd0057ac0236d4397780762c9 100644 (file)
@@ -18,10 +18,7 @@ void Model_AttributeRefList::append(ObjectPtr theObject)
   myRef->Append(aData->label().Father());  // store label of the object
   // do it before the transaction finish to make just created/removed objects know dependencies
   // and reference from composite feature is removed automatically
-  FeaturePtr anOwnerFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
-  if (anOwnerFeature.get()) {
-    aData->addBackReference(anOwnerFeature, id());
-  }
+  ADD_BACK_REF(theObject);
 
   owner()->data()->sendAttributeUpdated(this);
 }
@@ -42,6 +39,7 @@ void Model_AttributeRefList::remove(ObjectPtr theObject)
         ObjectPtr anObj = aDoc->object(aLIter.Value());
         if (anObj.get() == NULL) {
           myRef->Remove(aLIter.Value());
+          REMOVE_BACK_REF(theObject);
           break;
         }
       }
index 860968cdd14f40f5381cea5a5193c354163104e3..9c51e545b66ee0983cfcb17eb8747ce7dfe96654 100644 (file)
@@ -21,9 +21,12 @@ void Model_AttributeReference::setValue(ObjectPtr theObject)
 {
   if(!theObject)
     return;
-  if (!myIsInitialized || value() != theObject) {
+  ObjectPtr aValue = value();
+  if (!myIsInitialized || aValue != theObject) {
+    REMOVE_BACK_REF(aValue);
+
     std::shared_ptr<Model_Data> aData = std::dynamic_pointer_cast<Model_Data>(
-        theObject->data());
+      theObject->data());
     TDF_Label anObjLab = aData->label().Father(); // object label
 
     if (owner()->document() == theObject->document()) { // same document, use reference attribute
@@ -43,10 +46,7 @@ void Model_AttributeReference::setValue(ObjectPtr theObject)
     }
     // do it before the transaction finish to make just created/removed objects know dependencies
     // and reference from composite feature is removed automatically
-    FeaturePtr anOwnerFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
-    if (anOwnerFeature.get()) {
-      aData->addBackReference(anOwnerFeature, id(), false);
-    }
+    ADD_BACK_REF(theObject);
 
     owner()->data()->sendAttributeUpdated(this);
   }
index ca0653fcc2ac05c0be6e13f45d6c37a2d525b372..3e23333451931c81706be68835312774179d2a04 100644 (file)
@@ -92,7 +92,7 @@ void Model_AttributeSelection::setValue(const ResultPtr& theContext,
   if (theSubShape.get() && !theSubShape->isNull() && theSubShape->isEdge()) {
     const TopoDS_Shape& aSubShape = theSubShape->impl<TopoDS_Shape>();
     if (aSubShape.ShapeType() == TopAbs_EDGE)
-      isDegeneratedEdge = BRep_Tool::Degenerated(TopoDS::Edge(aSubShape));
+      isDegeneratedEdge = BRep_Tool::Degenerated(TopoDS::Edge(aSubShape)) == Standard_True;
   }
   if (!theContext.get() || isDegeneratedEdge) {
     // to keep the reference attribute label
index f3fd1c384e8dfa7c6704e0f3f9cf357e64bfa60a..93de6977de7bb6cd633575d623c99ecb60a3d36f 100644 (file)
@@ -195,4 +195,28 @@ private:
     const bool theApplyConcealment = true);
 };
 
+/// Generic method to register back reference, used in referencing attributes.
+/// Without concealment change, it will be done later, on synchronization.
+#define ADD_BACK_REF(TARGET) \
+  if (TARGET.get() != NULL) { \
+    FeaturePtr anAttributeOwnerFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner()); \
+    if (anAttributeOwnerFeature.get()) { \
+      std::shared_ptr<Model_Data> aTargetData = std::dynamic_pointer_cast<Model_Data>( \
+        (TARGET)->data()); \
+      aTargetData->addBackReference(anAttributeOwnerFeature, id(), false); \
+    } \
+  }
+
+/// Generic method to unregister back reference, used in referencing attributes.
+/// Without concealment change, it will be done later, on synchronization.
+#define REMOVE_BACK_REF(TARGET) \
+  if (TARGET.get() != NULL) { \
+    FeaturePtr anAttOwnerFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner()); \
+    if (anAttOwnerFeature.get()) { \
+      std::shared_ptr<Model_Data> aTargetData = std::dynamic_pointer_cast<Model_Data>( \
+        (TARGET)->data()); \
+      aTargetData->removeBackReference(anAttOwnerFeature, id()); \
+    } \
+  }
+
 #endif
index be788bd5a89253f0b1c3ab76528bc7d41abb5e8b..ee2f5727bc45521eedd43078d2a510425e5250ce 100644 (file)
@@ -550,7 +550,7 @@ bool PartSet_Module::deleteObjects()
   // the abort leads to selection lost on constraint objects. It can be corrected after #386 issue
   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
   XGUI_Workshop* aWorkshop = aConnector->workshop();
-  ModuleBase_ISelection* aSel = aConnector->selection();
+  ModuleBase_ISelection* aSel = workshop()->selection();
   QObjectPtrList aSelectedObj = aSel->selectedPresentations();
   // if there are no selected objects in the viewer, that means that the selection in another
   // place cased this method. It is necessary to return the false value to understande in above
index 6f30ea45a915a0dd0f9b3f06c95733a3da5f4c0a..ed1ff7294d3c502b16f590fcc4378fd4eebbf2f7 100644 (file)
@@ -148,7 +148,7 @@ public:
   /// \param isChecked if true, the feature is a construction
   void setAuxiliary(const bool isChecked);
 
-
+  /// Returns state of constraints showing flag 
   bool isConstraintsShown() const { return myIsConstraintsShown; }
 
 
index 1b645c062821a47d4190355106ae8cb9fa8989a1..6be038d19d803a84cf839d7dc1e6e7e97e6e7f7f 100644 (file)
@@ -27,6 +27,7 @@
 #include <GeomAPI_XYZ.h>
 
 #include <SketchPlugin_Sketch.h>
+#include <SketcherPrs_Tools.h>
 
 #include <Precision.hxx>
 #include <gp_Pln.hxx>
@@ -360,8 +361,9 @@ void PartSet_WidgetSketchLabel::setSketchingMode()
 
   // Get default selection modes
   QIntList aModes;
-  aModes.append(AIS_DSM_Text);
-  aModes.append(AIS_DSM_Line);
+  aModes.append(SketcherPrs_Tools::Sel_Dimension_Text);
+  aModes.append(SketcherPrs_Tools::Sel_Dimension_Line);
+  aModes.append(SketcherPrs_Tools::Sel_Constraint);
   aModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_VERTEX));
   aModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum) TopAbs_EDGE));
 
index 59ca35b02cc6fcebf2681d99929a8219f415238f..b7f708a9c59578efdec9e6d06e6b9690e1c46058 100644 (file)
@@ -82,19 +82,19 @@ 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 = SketcherPrs_Tools::getFeatureLine(
-        aData, SketchPlugin_Constraint::ENTITY_A());
-    if (aLine) {
-      aPnt_B = aPoint_B->pnt();
-      aPnt_A = SketcherPrs_Tools::getProjectionPoint(aLine, aPnt_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);
-    }
+    //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;
@@ -159,19 +159,19 @@ double SketchPlugin_ConstraintDistance::calculateCurrentDistance() const
   if (aPointA && aPointB) {  // both points
     aDistance = aPointA->pnt()->distance(aPointB->pnt());
   } else {
-    if (!aPointA && aPointB) {  //Line and point
-      std::shared_ptr<SketchPlugin_Line> aLine =
-          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 =
-          SketcherPrs_Tools::getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_B());
-      if (aLine) {
-        aDistance = aLine->distanceToPoint(aPointA->pnt());
-      }
-    }
+//    if (!aPointA && aPointB) {  //Line and point
+//      std::shared_ptr<SketchPlugin_Line> aLine =
+//          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 =
+//          SketcherPrs_Tools::getFeatureLine(aData, SketchPlugin_Constraint::ENTITY_B());
+//      if (aLine) {
+//        aDistance = aLine->distanceToPoint(aPointA->pnt());
+//      }
+//    }
   }
   return aDistance;
 }
index 79cac01e7d10411a328c68a2db727a9f3eb7e2ae..e51c221295034499d99e5ba6066f25c634eb8c3e 100644 (file)
@@ -30,6 +30,8 @@
 #include <Config_PropManager.h>
 #include <Events_Loop.h>
 
+static const std::string PREVIOUS_VALUE("FilletPreviousRadius");
+
 /// \brief Attract specified point on theNewArc to the attribute of theFeature
 static void recalculateAttributes(FeaturePtr theNewArc, const std::string& theNewArcAttribute,
   FeaturePtr theFeature, const std::string& theFeatureAttribute);
@@ -45,8 +47,11 @@ void SketchPlugin_ConstraintFillet::initAttributes()
   data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId());
   data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::typeId());
   data()->addAttribute(SketchPlugin_Constraint::ENTITY_C(), ModelAPI_AttributeRefList::typeId());
+  data()->addAttribute(PREVIOUS_VALUE, ModelAPI_AttributeDouble::typeId());
   // initialize attribute not applicable for user
   data()->attribute(SketchPlugin_Constraint::ENTITY_C())->setInitialized();
+  data()->attribute(PREVIOUS_VALUE)->setInitialized();
+  std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(data()->attribute(PREVIOUS_VALUE))->setValue(0.0);
 }
 
 void SketchPlugin_ConstraintFillet::execute()
@@ -87,9 +92,17 @@ void SketchPlugin_ConstraintFillet::execute()
       FeaturePtr aFeature = aRC ? aRC->document()->feature(aRC) : 
         std::dynamic_pointer_cast<ModelAPI_Feature>(aRefAttr->object());
       if (aFeature == aFilletArcFeature) {
-        AttributeDoublePtr aRadius = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
-            aSubFeature->attribute(SketchPlugin_Constraint::VALUE()));
-        aRadius->setValue(aFilletRadius);
+        // Update radius constraint only if the value is changed in fillet's attribute
+        double aPrevRadius = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
+            aData->attribute(PREVIOUS_VALUE))->value();
+        if (aFilletRadius != aPrevRadius) {
+          AttributeDoublePtr aRadius = std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
+              aSubFeature->attribute(SketchPlugin_Constraint::VALUE()));
+          aRadius->setValue(aFilletRadius);
+          std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(
+              aData->attribute(PREVIOUS_VALUE))->setValue(aFilletRadius);
+        }
+        break;
       }
     }
     return;
index ed07e4079bd6bd7eba234a943289ec1d97b6539e..555b8ae7f4e18e85e3d490e5537bd7a6fd2c899e 100644 (file)
@@ -100,6 +100,12 @@ double SketchPlugin_Line::distanceToPoint(const std::shared_ptr<GeomAPI_Pnt2d>&
   return aDelta;
 }
 
+const std::string& SketchPlugin_Line::getKind()
+{
+  static std::string MY_KIND = SketchPlugin_Line::ID();
+  return MY_KIND;
+}
+
 bool SketchPlugin_Line::isFixed() {
   return data()->selection(EXTERNAL_ID())->context().get() != NULL;
 }
index 05d94cc65e59bd582bd6290920a1d7820d995e4a..f6d895974b981354c6eda92f0ba9c2f95f4a2dd8 100644 (file)
@@ -39,11 +39,7 @@ class SketchPlugin_Line : public SketchPlugin_SketchEntity
   }
 
   /// Returns the kind of a feature
-  SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
-  {
-    static std::string MY_KIND = SketchPlugin_Line::ID();
-    return MY_KIND;
-  }
+  SKETCHPLUGIN_EXPORT virtual const std::string& getKind();
 
   /// Returns true is sketch element is under the rigid constraint
   SKETCHPLUGIN_EXPORT virtual bool isFixed();
index 6462775d46f17a05ea0c0154febb262994f98cf8..fcdcf3617d8416f6ed3fbd4dead2fe5e96a8710e 100644 (file)
@@ -507,9 +507,7 @@ bool SketchSolver_ConstraintGroup::changeRigidConstraint(
         std::dynamic_pointer_cast<GeomDataAPI_Point>(aConstrAttr->attr());
     std::shared_ptr<GeomDataAPI_Point2D> aPoint2D =
         std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aConstrAttr->attr());
-    std::shared_ptr<SketchPlugin_Point> aSketchPoint = 
-        std::dynamic_pointer_cast<SketchPlugin_Point>(aFeature);
-    if (aPoint || aPoint2D || aSketchPoint) {
+    if (aPoint || aPoint2D || aFeature->getKind() == SketchPlugin_Point::ID()) {
       // Create SolveSpace constraint structure
       Slvs_Constraint aConstraint = Slvs_MakeConstraint(
           ++myConstrMaxID, myID, aConstrType, myWorkplane.h, 0.0,
index 86f1a1f3e53fee0ca76d99dfa9c9b1ab4ed8b056..3520df99884db5881a6d22137b95cf51e6b08dca 100644 (file)
@@ -16,8 +16,6 @@
 #include <GeomAPI_Dir.h>
 #include <GeomAPI_Pnt2d.h>
 
-#include <SketchPlugin_Point.h>
-#include <SketchPlugin_Circle.h>
 #include <SketchPlugin_Constraint.h>
 
 #include <AIS_Drawer.hxx>
@@ -33,7 +31,7 @@
 IMPLEMENT_STANDARD_HANDLE(SketcherPrs_Coincident, AIS_InteractiveObject);
 IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Coincident, AIS_InteractiveObject);
 
-SketcherPrs_Coincident::SketcherPrs_Coincident(SketchPlugin_Constraint* theConstraint, 
+SketcherPrs_Coincident::SketcherPrs_Coincident(ModelAPI_Feature* theConstraint, 
                                                const std::shared_ptr<GeomAPI_Ax3>& thePlane) 
  : AIS_InteractiveObject(), myConstraint(theConstraint), myPlane(thePlane)
 {
@@ -72,9 +70,11 @@ void SketcherPrs_Coincident::Compute(const Handle(PrsMgr_PresentationManager3d)&
 void SketcherPrs_Coincident::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
                                             const Standard_Integer aMode)
 {
-  Handle(SelectMgr_EntityOwner) aOwn = new SelectMgr_EntityOwner(this, 10);
-  Handle(Select3D_SensitivePoint) aSp = new Select3D_SensitivePoint(aOwn, myPoint);
-  aSelection->Add(aSp);
+  if ((aMode == 0) || (aMode == SketcherPrs_Tools::Sel_Constraint)) {
+    Handle(SelectMgr_EntityOwner) aOwn = new SelectMgr_EntityOwner(this, 10);
+    Handle(Select3D_SensitivePoint) aSp = new Select3D_SensitivePoint(aOwn, myPoint);
+    aSelection->Add(aSp);
+  }
 }
 
 void SketcherPrs_Coincident::SetColor(const Quantity_NameOfColor aCol)
index 72c7ec5d01a9494ab707016fc3bc8fae66e0b9d0..5aaf5d63589530db34843fe57517504a01cd1020 100644 (file)
@@ -8,12 +8,11 @@
 #define SketcherPrs_Coincident_H
 
 #include <GeomAPI_Ax3.h>
+#include <ModelAPI_Feature.h>
 
 #include <AIS_InteractiveObject.hxx>
 #include <Standard_DefineHandle.hxx>
 
-class SketchPlugin_Constraint;
-
 
 DEFINE_STANDARD_HANDLE(SketcherPrs_Coincident, AIS_InteractiveObject)
 
@@ -27,7 +26,7 @@ class SketcherPrs_Coincident: public AIS_InteractiveObject
 public:
   /// Constructor
   /// \param theResult a result object
-  Standard_EXPORT SketcherPrs_Coincident(SketchPlugin_Constraint* theConstraint, 
+  Standard_EXPORT SketcherPrs_Coincident(ModelAPI_Feature* theConstraint, 
                                          const std::shared_ptr<GeomAPI_Ax3>& thePlane);
 
   Standard_EXPORT virtual void SetColor(const Quantity_Color& aColor);
@@ -45,7 +44,7 @@ protected:
     const Standard_Integer aMode) ;
 
 private:
-  SketchPlugin_Constraint* myConstraint;
+  ModelAPI_Feature* myConstraint;
   std::shared_ptr<GeomAPI_Ax3> myPlane;
   gp_Pnt myPoint;
 };
index 7ba9a3f65ab9dddab53078881a589da978d0923a..f26682c3cae4603bccf4c216fc3f7c54691fc9a7 100644 (file)
@@ -19,7 +19,7 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Equal, SketcherPrs_SymbolPrs);
 
 static Handle(Image_AlienPixMap) MyPixMap;
 
-SketcherPrs_Equal::SketcherPrs_Equal(SketchPlugin_Constraint* theConstraint, 
+SketcherPrs_Equal::SketcherPrs_Equal(ModelAPI_Feature* theConstraint, 
                                      const std::shared_ptr<GeomAPI_Ax3>& thePlane) 
  : SketcherPrs_SymbolPrs(theConstraint, thePlane)
 {
index 4bd1a86ab53a3ec4937a923d145a7383056dd4a3..d958d412488c0c90cbe021e2e81eed08bcd5a35f 100644 (file)
@@ -9,9 +9,6 @@
 
 #include "SketcherPrs_SymbolPrs.h"
 
-class SketchPlugin_Constraint;
-class SketchPlugin_Sketch;
-
 
 DEFINE_STANDARD_HANDLE(SketcherPrs_Equal, SketcherPrs_SymbolPrs)
 
@@ -26,7 +23,7 @@ public:
   /// Constructor
   /// \param theConstraint a constraint feature
   /// \param thePlane a coordinate plane of current sketch
-  Standard_EXPORT SketcherPrs_Equal(SketchPlugin_Constraint* theConstraint, 
+  Standard_EXPORT SketcherPrs_Equal(ModelAPI_Feature* theConstraint, 
                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane);
   DEFINE_STANDARD_RTTI(SketcherPrs_Equal)
 protected:
index 04f9bf3b7fb3e91245bf03097d39f8f6f8ff10bb..7ef2368621dbf5a651055fc64e24a71af6b2fb83 100644 (file)
@@ -17,7 +17,7 @@
 #include "SketcherPrs_LengthDimension.h"
 
 #define CONSTRAINT_PRS_IMPL(NAME, CLASS) \
-AISObjectPtr SketcherPrs_Factory::NAME(SketchPlugin_Constraint* theConstraint, \
+AISObjectPtr SketcherPrs_Factory::NAME(ModelAPI_Feature* theConstraint, \
                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane) \
 { \
   std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject()); \
@@ -36,7 +36,7 @@ CONSTRAINT_PRS_IMPL(radiusConstraint, SketcherPrs_Radius);
 CONSTRAINT_PRS_IMPL(lengthDimensionConstraint, SketcherPrs_LengthDimension);
 
 
-AISObjectPtr SketcherPrs_Factory::horisontalConstraint(SketchPlugin_Constraint* theConstraint,
+AISObjectPtr SketcherPrs_Factory::horisontalConstraint(ModelAPI_Feature* theConstraint,
                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane)
 { 
   std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject()); 
@@ -45,7 +45,7 @@ AISObjectPtr SketcherPrs_Factory::horisontalConstraint(SketchPlugin_Constraint*
   return aAISObj; 
 }
 
-AISObjectPtr SketcherPrs_Factory::verticalConstraint(SketchPlugin_Constraint* theConstraint,
+AISObjectPtr SketcherPrs_Factory::verticalConstraint(ModelAPI_Feature* theConstraint,
                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane)
 { 
   std::shared_ptr<GeomAPI_AISObject> aAISObj = AISObjectPtr(new GeomAPI_AISObject()); 
index d416644f9cb315c56555cb9a04aa91bcb70b6d52..c43fb948fed15389e49ed56601f858331dbdb61b 100644 (file)
@@ -9,13 +9,13 @@
 
 #include "SketcherPrs.h"
 
+#include <ModelAPI_Feature.h>
+
 #include <GeomAPI_Ax3.h>
 #include <GeomAPI_AISObject.h>
 
-class SketchPlugin_Constraint;
-
 #define GET_CONSTRAINT_PRS(NAME) \
-  static AISObjectPtr NAME(SketchPlugin_Constraint* theConstraint, \
+  static AISObjectPtr NAME(ModelAPI_Feature* theConstraint, \
                            const std::shared_ptr<GeomAPI_Ax3>& thePlane);
 
 
index 5992db2fd4ed128240514a711feb824ea15ec785..b1459205ea1e311efa11dfb672cd284e4a41125c 100644 (file)
@@ -20,7 +20,7 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_HVDirection, SketcherPrs_SymbolPrs);
 
 static Handle(Image_AlienPixMap) MyPixMap;
 
-SketcherPrs_HVDirection::SketcherPrs_HVDirection(SketchPlugin_Constraint* theConstraint, 
+SketcherPrs_HVDirection::SketcherPrs_HVDirection(ModelAPI_Feature* theConstraint, 
                                            const std::shared_ptr<GeomAPI_Ax3>& thePlane,
                                            bool isHorisontal) 
  : SketcherPrs_SymbolPrs(theConstraint, thePlane), myIsHorisontal(isHorisontal)
index 96432d23071a59be989deb477bde3205a5333bed..079991dd285d3b39b9a083aa0cc5c40f518fe954 100644 (file)
@@ -8,9 +8,7 @@
 #define SketcherPrs_HVDirection_H
 
 #include "SketcherPrs_SymbolPrs.h"
-
-class SketchPlugin_Constraint;
-class SketchPlugin_Sketch;
+#include <ModelAPI_Feature.h>
 
 
 DEFINE_STANDARD_HANDLE(SketcherPrs_HVDirection, SketcherPrs_SymbolPrs)
@@ -26,7 +24,7 @@ public:
   /// Constructor
   /// \param theConstraint a constraint feature
   /// \param thePlane a coordinate plane of current sketch
-  Standard_EXPORT SketcherPrs_HVDirection(SketchPlugin_Constraint* theConstraint, 
+  Standard_EXPORT SketcherPrs_HVDirection(ModelAPI_Feature* theConstraint, 
                                          const std::shared_ptr<GeomAPI_Ax3>& thePlane,
                                          bool isHorisontal);
 
index 65b067782dcf50b1a9e48efc7241a5c66b3b5ea8..17c316afc3a414b606b02a66dc792276ac62f74b 100644 (file)
@@ -30,7 +30,7 @@ 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, 
+SketcherPrs_LengthDimension::SketcherPrs_LengthDimension(ModelAPI_Feature* theConstraint, 
                         const std::shared_ptr<GeomAPI_Ax3>& thePlane)
 : AIS_LengthDimension(MyDefStart, MyDefEnd, MyDefPln), 
 myConstraint(theConstraint), myPlane(thePlane)
@@ -126,14 +126,14 @@ bool SketcherPrs_LengthDimension::getPoints(gp_Pnt& thePnt1, gp_Pnt& thePnt2) co
       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(
+      FeaturePtr 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(
+      FeaturePtr aLine = SketcherPrs_Tools::getFeatureLine(
           aData, SketchPlugin_Constraint::ENTITY_B());
       if (aLine) {
         aPnt_A = aPoint_A->pnt();
@@ -151,3 +151,25 @@ bool SketcherPrs_LengthDimension::getPoints(gp_Pnt& thePnt1, gp_Pnt& thePnt2) co
   }
   return false;
 }
+
+
+
+void SketcherPrs_LengthDimension::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
+                                                   const Standard_Integer theMode)
+{
+  Standard_Integer aMode;
+  switch (theMode) {
+  case SketcherPrs_Tools::Sel_Dimension_All:
+    aMode = 0;
+    break;
+  case SketcherPrs_Tools::Sel_Dimension_Line:
+    aMode = 1;
+    break;
+  case SketcherPrs_Tools::Sel_Dimension_Text:
+    aMode = 2;
+    break;
+  default:
+    aMode = theMode;
+  }
+  AIS_LengthDimension::ComputeSelection(aSelection, aMode);
+}
index 94bd89c467c05be720ab8ed4fe64acbae6140afd..5fde8d7aa0e094f1599a18f752c4d9c1b1138e81 100644 (file)
@@ -9,12 +9,11 @@
 #define SketcherPrs_LinearDimension_H
 
 #include <GeomAPI_Ax3.h>
+#include <ModelAPI_Feature.h>
 #include <AIS_LengthDimension.hxx>
 #include <Standard_DefineHandle.hxx>
 
 
-class SketchPlugin_Constraint;
-
 DEFINE_STANDARD_HANDLE(SketcherPrs_LengthDimension, AIS_LengthDimension)
 
 /**
@@ -28,7 +27,7 @@ public:
   /// Constructor
   /// \param theConstraint a constraint feature
   /// \param thePlane a coordinate plane of current sketch
-  Standard_EXPORT SketcherPrs_LengthDimension(SketchPlugin_Constraint* theConstraint, 
+  Standard_EXPORT SketcherPrs_LengthDimension(ModelAPI_Feature* theConstraint, 
                         const std::shared_ptr<GeomAPI_Ax3>& thePlane);
 
   std::string constraintType() const;
@@ -39,11 +38,15 @@ protected:
   Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
     const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
 
+  /// Redefinition of virtual function
+  Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
+    const Standard_Integer aMode);
+
 private:
   bool getPoints(gp_Pnt& thePnt1, gp_Pnt& thePnt2) const;
 
   /// Constraint feature
-  SketchPlugin_Constraint* myConstraint;
+  ModelAPI_Feature* myConstraint;
 
   /// Plane of the current sketcher
   std::shared_ptr<GeomAPI_Ax3> myPlane;
index 71f97ceda2329387a90395a3e714b81038f2c1e4..e80fb8f784c387190422a6b109c45866e13302b5 100644 (file)
@@ -20,7 +20,7 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Parallel, SketcherPrs_SymbolPrs);
 
 static Handle(Image_AlienPixMap) MyPixMap;
 
-SketcherPrs_Parallel::SketcherPrs_Parallel(SketchPlugin_Constraint* theConstraint, 
+SketcherPrs_Parallel::SketcherPrs_Parallel(ModelAPI_Feature* theConstraint, 
                                            const std::shared_ptr<GeomAPI_Ax3>& thePlane) 
  : SketcherPrs_SymbolPrs(theConstraint, thePlane)
 {
index d0126d30b0e0e8197cff4c5f669c04ad76901493..3194a63cce7c2bc376d37dd38a87944582c8d912 100644 (file)
@@ -9,9 +9,6 @@
 
 #include "SketcherPrs_SymbolPrs.h"
 
-class SketchPlugin_Constraint;
-class SketchPlugin_Sketch;
-
 
 DEFINE_STANDARD_HANDLE(SketcherPrs_Parallel, SketcherPrs_SymbolPrs)
 
@@ -26,7 +23,7 @@ public:
   /// Constructor
   /// \param theConstraint a constraint feature
   /// \param thePlane a coordinate plane of current sketch
-  Standard_EXPORT SketcherPrs_Parallel(SketchPlugin_Constraint* theConstraint, 
+  Standard_EXPORT SketcherPrs_Parallel(ModelAPI_Feature* theConstraint, 
                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane);
   DEFINE_STANDARD_RTTI(SketcherPrs_Parallel)
 protected:
index e00b23d7df1b38283f920035608c9b48ed0c8d54..ecfd72d1181c21d3da822e6086c97f0c46b9497e 100644 (file)
@@ -20,7 +20,7 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Perpendicular, SketcherPrs_SymbolPrs);
 
 static Handle(Image_AlienPixMap) MyPixMap;
 
-SketcherPrs_Perpendicular::SketcherPrs_Perpendicular(SketchPlugin_Constraint* theConstraint, 
+SketcherPrs_Perpendicular::SketcherPrs_Perpendicular(ModelAPI_Feature* theConstraint, 
                                                      const std::shared_ptr<GeomAPI_Ax3>& thePlane) 
  : SketcherPrs_SymbolPrs(theConstraint, thePlane)
 {
index c77a09203bcdb3f0a80ab550f3227845cc301ec4..6cabbf03a4807a5ed0100904bdb30d0c424f8bb6 100644 (file)
@@ -25,7 +25,7 @@ public:
   /// Constructor
   /// \param theConstraint a constraint feature
   /// \param thePlane a coordinate plane of current sketch
-  Standard_EXPORT SketcherPrs_Perpendicular(SketchPlugin_Constraint* theConstraint, 
+  Standard_EXPORT SketcherPrs_Perpendicular(ModelAPI_Feature* theConstraint, 
                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane);
 
   DEFINE_STANDARD_RTTI(SketcherPrs_Perpendicular)
index 5e30f527fa95dd82ef66758e8b5b27c2e3aedfe6..a3643fe08698926dd83629401a1afe6adeeb77b6 100644 (file)
@@ -23,7 +23,7 @@ static const 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, 
+SketcherPrs_Radius::SketcherPrs_Radius(ModelAPI_Feature* theConstraint, 
                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane)
 : AIS_RadiusDimension(MyDefCirc), myConstraint(theConstraint), myPlane(thePlane)
 {
@@ -99,3 +99,23 @@ void SketcherPrs_Radius::Compute(const Handle(PrsMgr_PresentationManager3d)& the
 
   AIS_RadiusDimension::Compute(thePresentationManager, thePresentation, theMode);
 }
+
+void SketcherPrs_Radius::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
+                                                   const Standard_Integer theMode)
+{
+  Standard_Integer aMode;
+  switch (theMode) {
+  case SketcherPrs_Tools::Sel_Dimension_All:
+    aMode = 0;
+    break;
+  case SketcherPrs_Tools::Sel_Dimension_Line:
+    aMode = 1;
+    break;
+  case SketcherPrs_Tools::Sel_Dimension_Text:
+    aMode = 2;
+    break;
+  default:
+    aMode = theMode;
+  }
+  AIS_RadiusDimension::ComputeSelection(aSelection, aMode);
+}
index 0b32639b761dd209c4b7761ee917b0fe3036fa1d..88a3c613c219d445c55f95b06e018bd38682e8b2 100644 (file)
@@ -9,12 +9,11 @@
 #define SketcherPrs_Radius_H
 
 #include <GeomAPI_Ax3.h>
+#include <ModelAPI_Feature.h>
 
 #include <AIS_RadiusDimension.hxx>
 #include <Standard_DefineHandle.hxx>
 
-class SketchPlugin_Constraint;
-
 DEFINE_STANDARD_HANDLE(SketcherPrs_Radius, AIS_RadiusDimension)
 
 /**
@@ -27,7 +26,7 @@ public:
   /// Constructor
   /// \param theConstraint a constraint feature
   /// \param thePlane a coordinate plane of current sketch
-  Standard_EXPORT SketcherPrs_Radius(SketchPlugin_Constraint* theConstraint, 
+  Standard_EXPORT SketcherPrs_Radius(ModelAPI_Feature* theConstraint, 
                         const std::shared_ptr<GeomAPI_Ax3>& thePlane);
 
   DEFINE_STANDARD_RTTI(SketcherPrs_Radius)
@@ -36,9 +35,13 @@ protected:
   Standard_EXPORT virtual void Compute(const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
     const Handle(Prs3d_Presentation)& thePresentation, const Standard_Integer theMode = 0);
 
+  /// Redefinition of virtual function
+  Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
+    const Standard_Integer aMode);
+
 private:
   /// Constraint feature
-  SketchPlugin_Constraint* myConstraint;
+  ModelAPI_Feature* myConstraint;
 
   /// Plane of the current sketcher
   std::shared_ptr<GeomAPI_Ax3> myPlane;
index 84a36d3c017943d0afa10f58739fc211261ecc17..2a7245e1dfc809d1f91407c2a691f97d4153d632 100644 (file)
@@ -36,7 +36,7 @@ static Handle(Image_AlienPixMap) MyPixMap;
 
 
 
-SketcherPrs_Rigid::SketcherPrs_Rigid(SketchPlugin_Constraint* theConstraint, 
+SketcherPrs_Rigid::SketcherPrs_Rigid(ModelAPI_Feature* theConstraint, 
                                            const std::shared_ptr<GeomAPI_Ax3>& thePlane) 
  : SketcherPrs_SymbolPrs(theConstraint, thePlane)
 {
index 5328210773228b7eb49ae2d97703f7bc83f675fb..cabccbf07e2928bae5292a74036ddb4d750409b2 100644 (file)
@@ -9,9 +9,7 @@
 
 #include "SketcherPrs_SymbolPrs.h"
 #include <ModelAPI_Object.h>
-
-class SketchPlugin_Constraint;
-class SketchPlugin_Sketch;
+#include <ModelAPI_Feature.h>
 
 
 DEFINE_STANDARD_HANDLE(SketcherPrs_Rigid, SketcherPrs_SymbolPrs)
@@ -27,7 +25,7 @@ public:
   /// Constructor
   /// \param theConstraint a constraint feature
   /// \param thePlane a coordinate plane of current sketch
-  Standard_EXPORT SketcherPrs_Rigid(SketchPlugin_Constraint* theConstraint, 
+  Standard_EXPORT SketcherPrs_Rigid(ModelAPI_Feature* theConstraint, 
                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane);
 
 
index a74dfc82a763c68c10bebd190dc6902159b3c09d..fad57104d01a27cb599452b4e9137b4cffd406df 100644 (file)
@@ -219,7 +219,7 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_SymbolPrs, AIS_InteractiveObject);
 std::map<const char*, Handle(Image_AlienPixMap)> SketcherPrs_SymbolPrs::myIconsMap;
 
 
-SketcherPrs_SymbolPrs::SketcherPrs_SymbolPrs(SketchPlugin_Constraint* theConstraint, 
+SketcherPrs_SymbolPrs::SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint, 
                                              const std::shared_ptr<GeomAPI_Ax3>& thePlane)
  : AIS_InteractiveObject(), myConstraint(theConstraint), myPlane(thePlane)
 {
@@ -353,9 +353,11 @@ void SketcherPrs_SymbolPrs::Compute(const Handle(PrsMgr_PresentationManager3d)&
 void SketcherPrs_SymbolPrs::ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
                                             const Standard_Integer aMode)
 {
-  ClearSelected();
-  for (int i = 1; i <= mySPoints.Length(); i++)
-    aSelection->Add(mySPoints.Value(i));
+  //ClearSelected();
+  if ((aMode == 0) || (aMode == SketcherPrs_Tools::Sel_Constraint)) {
+    for (int i = 1; i <= mySPoints.Length(); i++)
+      aSelection->Add(mySPoints.Value(i));
+  }
 }
 
 
index 9145705f520bb787310682d5e9a940d17ac6ebee..446cedabcd6fb9ad28a0d6c11bf2dadae315579b 100644 (file)
@@ -8,6 +8,7 @@
 #define SketcherPrs_SymbolPrs_H
 
 #include "SketcherPrs_SensitivePoint.h"
+#include <ModelAPI_Feature.h>
 
 #include <AIS_InteractiveObject.hxx>
 #include <GeomAPI_Ax3.h>
@@ -22,7 +23,6 @@
 
 #include <OpenGl_Workspace.hxx>
 
-class SketchPlugin_Constraint;
 class OpenGl_Context;
 
 
@@ -38,7 +38,7 @@ public:
   /// Constructor
   /// \param theConstraint a constraint feature
   /// \param thePlane a coordinate plane of current sketch
-  Standard_EXPORT SketcherPrs_SymbolPrs(SketchPlugin_Constraint* theConstraint, 
+  Standard_EXPORT SketcherPrs_SymbolPrs(ModelAPI_Feature* theConstraint, 
                         const std::shared_ptr<GeomAPI_Ax3>& thePlane);
   
   virtual ~SketcherPrs_SymbolPrs();
@@ -59,7 +59,7 @@ public:
 
   Standard_EXPORT std::shared_ptr<GeomAPI_Ax3> plane() const { return myPlane; }
 
-  Standard_EXPORT SketchPlugin_Constraint* feature() const { return myConstraint; }
+  Standard_EXPORT ModelAPI_Feature* feature() const { return myConstraint; }
 
 
   Handle(Graphic3d_ArrayOfPoints) pointsArray() const { return myPntArray; }
@@ -105,7 +105,7 @@ protected:
 
 protected:
   /// Constraint feature
-  SketchPlugin_Constraint* myConstraint;
+  ModelAPI_Feature* myConstraint;
 
   /// Plane of the current sketcher
   std::shared_ptr<GeomAPI_Ax3> myPlane;
index bbee898f92e735037e25243449d0f4a4991b4497..45f32049425091c54120cc4d9426ca5457d3d15e 100644 (file)
@@ -23,7 +23,7 @@ IMPLEMENT_STANDARD_RTTIEXT(SketcherPrs_Tangent, SketcherPrs_SymbolPrs);
 
 static Handle(Image_AlienPixMap) MyPixMap;
 
-SketcherPrs_Tangent::SketcherPrs_Tangent(SketchPlugin_Constraint* theConstraint, 
+SketcherPrs_Tangent::SketcherPrs_Tangent(ModelAPI_Feature* theConstraint, 
                                            const std::shared_ptr<GeomAPI_Ax3>& thePlane) 
  : SketcherPrs_SymbolPrs(theConstraint, thePlane)
 {
index 335006da59e1cf682ef42b1167390826a387d561..78aaff550be0a6b1aba32a65701e76325c86ade5 100644 (file)
@@ -8,9 +8,7 @@
 #define SketcherPrs_Tangent_H
 
 #include "SketcherPrs_SymbolPrs.h"
-
-class SketchPlugin_Constraint;
-class SketchPlugin_Sketch;
+#include <ModelAPI_Feature.h>
 
 
 DEFINE_STANDARD_HANDLE(SketcherPrs_Tangent, SketcherPrs_SymbolPrs)
@@ -26,7 +24,7 @@ public:
   /// Constructor
   /// \param theConstraint a constraint feature
   /// \param thePlane a coordinate plane of current sketch
-  Standard_EXPORT SketcherPrs_Tangent(SketchPlugin_Constraint* theConstraint, 
+  Standard_EXPORT SketcherPrs_Tangent(ModelAPI_Feature* theConstraint, 
                                        const std::shared_ptr<GeomAPI_Ax3>& thePlane);
 
   DEFINE_STANDARD_RTTI(SketcherPrs_Tangent)
index c94864db66134292b2ffa075a1329431bdd3ba04..47468899ec7d2d7685b561f1277707b93d5c7bd8 100644 (file)
@@ -20,7 +20,7 @@
 
 namespace SketcherPrs_Tools {
 
-ObjectPtr getResult(SketchPlugin_Constraint* theFeature, const std::string& theAttrName)
+ObjectPtr getResult(ModelAPI_Feature* theFeature, const std::string& theAttrName)
 {
   std::shared_ptr<ModelAPI_Data> aData = theFeature->data();
   std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = 
@@ -40,8 +40,8 @@ std::shared_ptr<GeomAPI_Shape> getShape(ObjectPtr theObject)
 }
 
 
-std::shared_ptr<GeomAPI_Pnt2d> getPoint(SketchPlugin_Constraint* theFeature,
-                                               const std::string& theAttribute)
+std::shared_ptr<GeomAPI_Pnt2d> getPoint(ModelAPI_Feature* theFeature,
+                                        const std::string& theAttribute)
 {
   std::shared_ptr<GeomDataAPI_Point2D> aPointAttr;
 
@@ -100,30 +100,29 @@ std::shared_ptr<GeomDataAPI_Point2D> getFeaturePoint(DataPtr theData,
 }
 
 //*************************************************************************************
-std::shared_ptr<SketchPlugin_Line> getFeatureLine(DataPtr theData,
-                                                  const std::string& theAttribute)
+FeaturePtr getFeatureLine(DataPtr theData,
+                          const std::string& theAttribute)
 {
-  std::shared_ptr<SketchPlugin_Line> aLine;
+  FeaturePtr aLine;
   if (!theData)
     return aLine;
 
-  std::shared_ptr<ModelAPI_AttributeRefAttr> anAttr = std::dynamic_pointer_cast<
-      ModelAPI_AttributeRefAttr>(theData->attribute(theAttribute));
+  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 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<GeomAPI_Pnt2d> getProjectionPoint(const FeaturePtr theLine,
+                                                  const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
 {
-  std::shared_ptr<ModelAPI_Data> aData = theLine->data();
+  DataPtr 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>(
@@ -145,4 +144,4 @@ void setArrowSize(double theSize)
   MyArrowSize = theSize;
 }
 
-};
\ No newline at end of file
+};
index 29446596382d3ccdc54e012871588ec0523fa292..00a2e96630948e82c01f8d29523879ae78e0f760 100644 (file)
 #include <GeomAPI_Shape.h>
 #include <GeomAPI_Pnt2d.h>
 #include <ModelAPI_Object.h>
+#include <ModelAPI_Feature.h>
 #include <string>
 
-class SketchPlugin_Constraint;
-class SketchPlugin_Line;
 class GeomDataAPI_Point2D;
 
 #define MyTextHeight 20
 
 namespace SketcherPrs_Tools {
 
-  SKETCHERPRS_EXPORT ObjectPtr getResult(SketchPlugin_Constraint* theFeature,
-                      const std::string& theAttrName);
+/// Enumeration with modes for activation of selection custom presentations
+enum SelectionModes {
+  /// Start of enumeration
+  Sel_Mode_First = 100, 
+  
+  /// Selection mode for all constraints exclude dimensions
+  Sel_Constraint,
+  
+  /// Selection mode for whole dimension
+  Sel_Dimension_All,
+  
+  /// Selection mode for line of dimension
+  Sel_Dimension_Line,
+
+  /// Selection mode foe text of dimension
+  Sel_Dimension_Text
+};
+
+  SKETCHERPRS_EXPORT ObjectPtr getResult(ModelAPI_Feature* theFeature,
+                                         const std::string& theAttrName);
 
   SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Shape> getShape(ObjectPtr theObject);
 
-  SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Pnt2d> getPoint(SketchPlugin_Constraint* theFeature,
+  SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Pnt2d> getPoint(ModelAPI_Feature* theFeature,
                                           const std::string& theAttrName);
 
   SKETCHERPRS_EXPORT std::shared_ptr<GeomAPI_Pnt2d> getProjectionPoint(
-                        const std::shared_ptr<SketchPlugin_Line>& theLine,
+                        const FeaturePtr theLine,
                         const std::shared_ptr<GeomAPI_Pnt2d>& thePoint);
 
-  SKETCHERPRS_EXPORT std::shared_ptr<SketchPlugin_Line> getFeatureLine(DataPtr theData,
-                                                    const std::string& theAttribute);
+  SKETCHERPRS_EXPORT FeaturePtr 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,
@@ -45,4 +62,4 @@ namespace SketcherPrs_Tools {
   SKETCHERPRS_EXPORT void setArrowSize(double theSize);
 };
 
-#endif
\ No newline at end of file
+#endif
index ab9991d503365ecb453e9c9b020e00e6e68d74bd..fdc407f7be5fa95b5a577b800f2748d43d346f16 100644 (file)
@@ -68,7 +68,10 @@ void XGUI_ModuleConnector::activateSubShapesSelection(const QIntList& theTypes)
   // Convert shape types to selection types
   QIntList aModes;
   foreach(int aType, theTypes) {
-    aModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum)aType));
+    if (aType > TopAbs_SHAPE) 
+      aModes.append(aType);
+    else
+      aModes.append(AIS_Shape::SelectionMode((TopAbs_ShapeEnum)aType));
   }
   aDisp->activateObjects(aModes);
   //TODO: We have to open Local context because at neutral point filters don't work (bug 25340)