]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'master' of newgeom:newgeom
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 26 Jun 2014 13:23:56 +0000 (17:23 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 26 Jun 2014 13:23:56 +0000 (17:23 +0400)
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_OperationSketch.cpp
src/PartSet/PartSet_OperationSketch.h
src/PartSet/PartSet_OperationSketchBase.cpp
src/PartSet/PartSet_OperationSketchBase.h
src/SketchPlugin/SketchPlugin_ConstraintParallel.cpp
src/SketchPlugin/SketchPlugin_ConstraintPerpendicular.cpp
src/SketchPlugin/plugin-Sketch.xml

index d9009a68fefe1778c5c7f103df79899ededad5a5..206bbaa5baf315cbcc56ceeb352745f6bb5f6a7a 100644 (file)
@@ -317,16 +317,14 @@ void PartSet_Module::onFeatureConstructed(FeaturePtr theFeature, int theMode)
     FeaturePtr aSketch;
     PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
     if (aPrevOp) {
-      std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> > aList = aPrevOp->subPreview();
+      std::list<FeaturePtr> aList = aPrevOp->subFeatures();
       XGUI_Displayer* aDisplayer = myWorkshop->displayer();
       std::list<int> aModes = aPrevOp->getSelectionModes(aPrevOp->feature());
 
-      std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >::const_iterator
-                                                             anIt = aList.begin(), aLast = aList.end();
-      for (; anIt != aLast; anIt++) {
-        FeaturePtr aFeature = (*anIt).first;
-        visualizePreview(aFeature, false, false);
-      }
+      std::list<FeaturePtr>::const_iterator anIt = aList.begin(),
+                                            aLast = aList.end();
+      for (; anIt != aLast; anIt++)
+        visualizePreview(*anIt, false, false);
       aDisplayer->updateViewer();
     }
   }
@@ -477,23 +475,19 @@ void PartSet_Module::updateCurrentPreview(const std::string& theCmdId)
   if (!aFeature || aFeature->getKind() != theCmdId)
     return;
 
-  std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> > aList = aPreviewOp->subPreview();
+  std::list<FeaturePtr> aList = aPreviewOp->subFeatures();
   XGUI_Displayer* aDisplayer = myWorkshop->displayer();
   std::list<int> aModes = aPreviewOp->getSelectionModes(aPreviewOp->feature());
 
-  std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >::const_iterator
-                                                         anIt = aList.begin(), aLast = aList.end();
+  std::list<FeaturePtr>::const_iterator anIt = aList.begin(), 
+                                        aLast = aList.end();
   for (; anIt != aLast; anIt++) {
-    FeaturePtr aFeature = (*anIt).first;
     boost::shared_ptr<SketchPlugin_Feature> aSPFeature = 
-      boost::dynamic_pointer_cast<SketchPlugin_Feature>((*anIt).first);
+      boost::dynamic_pointer_cast<SketchPlugin_Feature>(*anIt);
     if (!aSPFeature)
       continue;
-
-    Handle(AIS_InteractiveObject) anAIS = aSPFeature->getAISShape(aDisplayer->getAISObject(aFeature));
-    if (!anAIS.IsNull())
-      aDisplayer->redisplay(aFeature, anAIS, false);
-    aDisplayer->activateInLocalContext(aFeature, aModes, false);
+    visualizePreview(*anIt, true, false);
+    aDisplayer->activateInLocalContext(*anIt, aModes, false);
   }
   aDisplayer->updateViewer();
 }
index b035dca5ca7c26e6c8f2b0b1cddf42856419fdea..87f7635a58c1798cff6f4ec9b5fd86b94778829b 100644 (file)
@@ -137,29 +137,15 @@ void PartSet_OperationSketch::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View)
   }
 }
 
-std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >
-                                                        PartSet_OperationSketch::subPreview() const
+std::list<FeaturePtr> PartSet_OperationSketch::subFeatures() const
 {
-  std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> > aPreviewMap;
-
-  boost::shared_ptr<SketchPlugin_Feature> aFeature;
-
   boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
   if (!aData->isValid())
-    return aPreviewMap;
+    return std::list<FeaturePtr>();
   boost::shared_ptr<ModelAPI_AttributeRefList> aRefList =
         boost::dynamic_pointer_cast<ModelAPI_AttributeRefList>(aData->attribute(SKETCH_ATTR_FEATURES));
 
-  std::list<FeaturePtr > aFeatures = aRefList->list();
-  std::list<FeaturePtr >::const_iterator anIt = aFeatures.begin(),
-                                                                  aLast = aFeatures.end();
-  for (; anIt != aLast; anIt++) {
-    aFeature = boost::dynamic_pointer_cast<SketchPlugin_Feature>(*anIt);
-    boost::shared_ptr<GeomAPI_Shape> aPreview = aFeature->preview();
-    if (aPreview)
-      aPreviewMap[aFeature] = aPreview;
-  }
-  return aPreviewMap;
+  return aRefList->list();
 }
 
 void PartSet_OperationSketch::stopOperation()
index 37c0482cac0275bd2be5912d6103c1bf56e0547e..df7243a49fa6a4978e438de4fdb7b77e82a56227 100644 (file)
@@ -68,10 +68,9 @@ public:
   /// \param theEvent the mouse event
   virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
 
-  /// Returns the map of the operation previews including the nested feature previews
-  /// \return the map of feature to the feature preview
-  virtual std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >
-                                                                           subPreview() const;
+  /// Returns the list of the nested features
+  /// \return the list of subfeatures
+  virtual std::list<FeaturePtr> subFeatures() const;
 
   /// Virtual method called when operation stopped - committed or aborted.
   /// Emits a signal to hide the preview of the operation
index 60396b8146cb94edf019f9132ee383942275f1b5..117195468dec6912ae0ce6843be9687ca736314d 100644 (file)
@@ -38,10 +38,9 @@ boost::shared_ptr<GeomAPI_Shape> PartSet_OperationSketchBase::preview(
   return aFeature->preview();
 }
 
-std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >
-                                                     PartSet_OperationSketchBase::subPreview() const
+std::list<FeaturePtr> PartSet_OperationSketchBase::subFeatures() const
 {
-  return std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> >();
+  return std::list<FeaturePtr>();
 }
 
 std::list<int> PartSet_OperationSketchBase::getSelectionModes(FeaturePtr theFeature) const
index f5caebdbf968649f550e7a8b2e6c4054890d0e38..8fa6439d7ff636505e4aa484783f1eaaf3848717 100644 (file)
 #include <ModuleBase_Operation.h>
 
 #include <XGUI_Constants.h>
+#include <XGUI_Displayer.h>
 
 #include <QObject>
 
+#include <AIS_InteractiveObject.hxx>
+
 #include <map>
 
 class Handle_V3d_View;
@@ -48,9 +51,9 @@ public:
   /// \param theFeature the feature object to obtain the preview
   static boost::shared_ptr<GeomAPI_Shape> preview(FeaturePtr theFeature);
 
-  /// Returns the map of the operation previews including the nested feature previews
-  /// \return the map of feature to the feature preview
-  virtual std::map<FeaturePtr, boost::shared_ptr<GeomAPI_Shape> > subPreview() const;
+  /// Returns the list of the nested features
+  /// \return the list of subfeatures
+  virtual std::list<FeaturePtr> subFeatures() const;
 
   /// Returns the operation local selection mode
   /// \param theFeature the feature object to get the selection mode
index 342b2c1de18a81f2fb42e825669971b2509083f3..92e23ead40c5c274df3cc10ab2bf83b5b4dc5bc5 100644 (file)
@@ -12,6 +12,8 @@
 #include <AIS_ParallelRelation.hxx>
 #include <Geom_Plane.hxx>
 
+#include <GeomDataAPI_Point2D.h>
+
 SketchPlugin_ConstraintParallel::SketchPlugin_ConstraintParallel()
 {
 }
@@ -20,6 +22,7 @@ void SketchPlugin_ConstraintParallel::initAttributes()
 {
   data()->addAttribute(CONSTRAINT_ATTR_ENTITY_A, ModelAPI_AttributeRefAttr::type());
   data()->addAttribute(CONSTRAINT_ATTR_ENTITY_B, ModelAPI_AttributeRefAttr::type());
+  data()->addAttribute(CONSTRAINT_ATTR_FLYOUT_VALUE_PNT, GeomDataAPI_Point2D::type());
 }
 
 void SketchPlugin_ConstraintParallel::execute()
index ca5e229728e7a777f12c9e00da517b739af8ba2c..d3646af7e083cade81dba5c5d700872d8b8619a0 100644 (file)
@@ -4,6 +4,8 @@
 
 #include "SketchPlugin_ConstraintPerpendicular.h"
 
+#include <GeomDataAPI_Point2D.h>
+
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_Data.h>
 #include <SketchPlugin_Line.h>
@@ -20,6 +22,7 @@ void SketchPlugin_ConstraintPerpendicular::initAttributes()
 {
   data()->addAttribute(CONSTRAINT_ATTR_ENTITY_A, ModelAPI_AttributeRefAttr::type());
   data()->addAttribute(CONSTRAINT_ATTR_ENTITY_B, ModelAPI_AttributeRefAttr::type());
+  data()->addAttribute(CONSTRAINT_ATTR_FLYOUT_VALUE_PNT, GeomDataAPI_Point2D::type());
 }
 
 void SketchPlugin_ConstraintPerpendicular::execute()
index 582a118c6f283370a4e381938c5a179de791d239..20c8e80d547ec5dcd2b0bc6b7ca1fca87b1d0c6a 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 SketchConstraintCoincidence" 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" 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="Coincident" 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 point in the viewer" keysequence="SketchPoint"/>
-        <feature_selector id="ConstraintEntityB" label="Last point" tooltip="Select an point in the viewer" keysequence="SketchPoint"/>
-      </feature>
+      <feature id="SketchConstraintCoincidence" title="Coincident" tooltip="Create constraint for the coincidence of two points" internal="1"/>
       <feature id="SketchConstraintDistance" title="Distance" 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 point in the viewer" keysequence="SketchPoint"/>
       <feature id="SketchConstraintParallel" title="Parallel" tooltip="Create constraint defining two parallel lines">
         <feature_selector id="ConstraintEntityA" label="First line" tooltip="Select an line in the viewer" keysequence="SketchLine"/>
         <feature_selector id="ConstraintEntityB" label="Last line" tooltip="Select an line in the viewer" keysequence="SketchLine"/>
+        <point_selector id="ConstraintFlyoutValuePnt" internal="1"/>
       </feature>
       <feature id="SketchConstraintPerpendicular" title="Perpendicular" tooltip="Create constraint defining two perpendicular lines">
         <feature_selector id="ConstraintEntityA" label="First line" tooltip="Select an line in the viewer" keysequence="SketchLine"/>
         <feature_selector id="ConstraintEntityB" label="Last line" tooltip="Select an line in the viewer" keysequence="SketchLine"/>
+        <point_selector id="ConstraintFlyoutValuePnt" internal="1"/>
       </feature>
     </group>
   </workbench>