Salome HOME
refs #80 - Sketch base GUI: create/draw point, circle and arc
authornds <natalia.donis@opencascade.com>
Wed, 25 Jun 2014 17:43:49 +0000 (21:43 +0400)
committernds <natalia.donis@opencascade.com>
Wed, 25 Jun 2014 17:43:49 +0000 (21:43 +0400)
1. Coincidence constraint.
2. Move radius

src/PartSet/PartSet_OperationFeatureCreate.cpp
src/SketchPlugin/SketchPlugin_ConstraintRadius.cpp
src/SketchPlugin/plugin-Sketch.xml

index 794e472d3d161e272ca03a0817de6b975c4af8a5..c8cd5c6deeebef14c28ecfbf2e82608b47208f0a 100644 (file)
@@ -17,6 +17,7 @@
 #include <SketchPlugin_ConstraintRadius.h>
 #include <SketchPlugin_ConstraintParallel.h>
 #include <SketchPlugin_ConstraintPerpendicular.h>
+#include <SketchPlugin_ConstraintCoincidence.h>
 
 #include <GeomAPI_Pnt2d.h>
 
@@ -61,7 +62,8 @@ bool PartSet_OperationFeatureCreate::canProcessKind(const std::string& theId)
          theId == SKETCH_CONSTRAINT_LENGTH_KIND ||
          theId == SKETCH_CONSTRAINT_RADIUS_KIND ||
          theId == SKETCH_CONSTRAINT_PARALLEL_KIND ||
-         theId == SKETCH_CONSTRAINT_PERPENDICULAR_KIND;
+         theId == SKETCH_CONSTRAINT_PERPENDICULAR_KIND ||
+         theId == SKETCH_CONSTRAINT_COINCIDENCE_KIND;
 }
 
 bool PartSet_OperationFeatureCreate::canBeCommitted() const
index fea246b5c3f5a7e6e8e73977bb58dcb9b9522373..6f4d17670498c8bd11569408487bd4d75480541e 100644 (file)
@@ -169,7 +169,7 @@ void SketchPlugin_ConstraintRadius::move(double theDeltaX, double theDeltaY)
   if (!aData->isValid())
     return;
 
-  //boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
-  //      boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE_PNT));
-  //aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
+  boost::shared_ptr<GeomDataAPI_Point2D> aPoint1 =
+        boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(CONSTRAINT_ATTR_FLYOUT_VALUE_PNT));
+  aPoint1->setValue(aPoint1->x() + theDeltaX, aPoint1->y() + theDeltaY);
 }
index a423f27e1660585a2384b481baabb99a78227967..ae133762314a600a2cb4dc03e7781a79c65a87da 100644 (file)
@@ -1,7 +1,7 @@
 <plugin>
   <workbench id="Sketch">
     <group id="Basic">
-      <feature id="Sketch" nested="SketchPoint SketchLine SketchCircle SketchArc SketchConstraintLength SketchConstraintRadius SketchConstraintDistance SketchConstraintParallel SketchConstraintPerpendicular" title="Sketch" tooltip="Create a new sketch or edit an existing sketch" icon=":icons/sketch.png">
+      <feature id="Sketch" nested="SketchPoint SketchLine SketchCircle SketchArc SketchConstraintLength SketchConstraintRadius SketchConstraintDistance SketchConstraintParallel SketchConstraintPerpendicular SketchConstraintCoincidence" title="Sketch" tooltip="Create a new sketch or edit an existing sketch" icon=":icons/sketch.png">
         <label title="Select a plane on which to create a sketch" tooltip="Select a plane on which to create a sketch"/> 
       <!--icon=":pictures/x_point.png"-->
       </feature>
         <point_selector id="ArcStartPoint" title="Start point" tooltip="Start point of the arc"/>
         <point_selector id="ArcEndPoint" title="End point" tooltip="End point of the arc"/>
       </feature>
-      <feature id="SketchConstraintCoincidence" title="Points coincidence" tooltip="Create constraint for the coincidence of two points" internal="1"/>
+      <feature id="SketchConstraintCoincidence" title="Points coincidence" tooltip="Create constraint for the coincidence of two points">
+        <label title="Select two points to become coincident" tooltip="Select two points to become coincident"/>
+        <feature_selector id="ConstraintEntityA" label="First point" tooltip="Select an entity in the viewer" keysequence="SketchPoint"/>
+        <feature_selector id="ConstraintEntityB" label="Last point" tooltip="Select an entity in the viewer" keysequence="SketchPoint"/>
+      </feature>
       <feature id="SketchConstraintDistance" title="Distance between objects" tooltip="Create constraint for the distance from a point to an object">
         <label title="Select point and another feature (point or point on line) between which to calculate distance" tooltip="Select point and another feature (point or point on line) between which to calculate distance"/>
         <feature_selector id="ConstraintEntityA" label="First point" tooltip="Select an entity in the viewer" keysequence="SketchPoint"/>