]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'master' of newgeom:newgeom
authorszy <szy@opencascade.com>
Wed, 29 Oct 2014 12:40:05 +0000 (15:40 +0300)
committerszy <szy@opencascade.com>
Wed, 29 Oct 2014 12:40:05 +0000 (15:40 +0300)
78 files changed:
linux_env.sh
salome_run.sh
src/ConstructionPlugin/Test/TestPointName.py
src/ExchangePlugin/ExchangePlugin_ImportFeature.h
src/Model/Model_Data.cpp
src/Model/Model_Update.cpp
src/ModelAPI/ModelAPI.i
src/ModelAPI/ModelAPI_AttributeBoolean.h
src/ModelAPI/ModelAPI_AttributeDocRef.h
src/ModelAPI/ModelAPI_AttributeRefAttr.h
src/ModelAPI/ModelAPI_AttributeRefList.h
src/ModelAPI/ModelAPI_AttributeReference.h
src/ModelAPI/ModelAPI_CompositeFeature.h
src/ModelAPI/ModelAPI_Feature.cpp
src/ModelAPI/ModelAPI_Feature.h
src/ModelAPI/ModelAPI_Object.h
src/ModelAPI/Test/TestUndoRedo.py
src/ModuleBase/ModuleBase_IModule.cpp
src/ModuleBase/ModuleBase_IModule.h
src/ModuleBase/ModuleBase_IPropertyPanel.h
src/ModuleBase/ModuleBase_ISelection.h
src/ModuleBase/ModuleBase_IWorkshop.h
src/ModuleBase/ModuleBase_Operation.cpp
src/ModuleBase/ModuleBase_Operation.h
src/ModuleBase/ModuleBase_ResultPrs.cpp
src/ModuleBase/ModuleBase_ViewerFilters.cpp
src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp
src/ModuleBase/ModuleBase_WidgetFactory.cpp
src/ModuleBase/ModuleBase_WidgetFeature.cpp
src/ModuleBase/ModuleBase_WidgetFileSelector.cpp
src/ModuleBase/ModuleBase_WidgetPoint2D.cpp
src/NewGeom/NewGeom_DataModel.cpp
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/PartSet/PartSet_OperationFeatureBase.cpp
src/PartSet/PartSet_OperationFeatureBase.h
src/PartSet/PartSet_OperationFeatureCreate.cpp
src/PartSet/PartSet_OperationFeatureCreate.h
src/PartSet/PartSet_OperationFeatureEdit.cpp
src/PartSet/PartSet_OperationFeatureEdit.h
src/PartSet/PartSet_OperationFeatureEditMulti.cpp
src/PartSet/PartSet_OperationFeatureEditMulti.h
src/PartSet/PartSet_OperationSketch.cpp
src/PartSet/PartSet_OperationSketch.h
src/PartSet/PartSet_OperationSketchBase.cpp
src/PartSet/PartSet_OperationSketchBase.h
src/PartSet/PartSet_Tools.cpp
src/PartSet/PartSet_Tools.h
src/PartSet/PartSet_Validators.cpp
src/PartSetPlugin/PartSetPlugin_Duplicate.cpp
src/PartSetPlugin/PartSetPlugin_Remove.cpp
src/SketchPlugin/SketchPlugin_Arc.cpp
src/SketchPlugin/SketchPlugin_Circle.cpp
src/SketchPlugin/SketchPlugin_Line.cpp
src/SketchPlugin/SketchPlugin_Point.cpp
src/SketchPlugin/SketchPlugin_Sketch.cpp
src/SketchPlugin/SketchPlugin_Sketch.h
src/SketchPlugin/SketchPlugin_Validators.cpp
src/SketchPlugin/Test/TestConstraintConcidence.py
src/SketchPlugin/Test/TestConstraintDistance.py
src/SketchPlugin/Test/TestConstraintLength.py
src/SketchPlugin/Test/TestConstraintParallel.py
src/SketchPlugin/Test/TestConstraintPerpendicular.py
src/SketchPlugin/Test/TestConstraintRadius.py
src/SketchPlugin/Test/TestSketchArcCircle.py
src/SketchPlugin/Test/TestSketchPointLine.py
src/XGUI/XGUI_Command.cpp
src/XGUI/XGUI_ContextMenuMgr.cpp
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_ModuleConnector.cpp
src/XGUI/XGUI_ModuleConnector.h
src/XGUI/XGUI_OperationMgr.cpp
src/XGUI/XGUI_PropertyPanel.cpp
src/XGUI/XGUI_PropertyPanel.h
src/XGUI/XGUI_Selection.cpp
src/XGUI/XGUI_Selection.h
src/XGUI/XGUI_ViewWindow.cpp
src/XGUI/XGUI_Workshop.cpp

index f6bdf5dcecbfab0e09bbe355b1dd50e154061db9..fcbe77b868e98322647ced4401e595e1065a1a57 100644 (file)
@@ -35,9 +35,9 @@ export PATH=${CASROOT}:${PATH}
 ##
 
 #------ NewGEOM ------
-export NEW_GEOM_ROOT_DIR=${ROOT_DIR}/install
-export PATH=${NEW_GEOM_ROOT_DIR}/bin:${NEW_GEOM_ROOT_DIR}/plugins:${PATH}
-export PYTHONPATH=${NEW_GEOM_ROOT_DIR}/swig:${PYTHONPATH}
-export LD_LIBRARY_PATH=${NEW_GEOM_ROOT_DIR}/bin:${NEW_GEOM_ROOT_DIR}/swig:${NEW_GEOM_ROOT_DIR}/plugins:${LD_LIBRARY_PATH}
-export NEW_GEOM_CONFIG_FILE=${NEW_GEOM_ROOT_DIR}/plugins
-export NewGeomResources=${NEW_GEOM_ROOT_DIR}/resources
+export NEWGEOM_ROOT_DIR=${ROOT_DIR}/install
+export PATH=${NEWGEOM_ROOT_DIR}/bin:${NEWGEOM_ROOT_DIR}/plugins:${PATH}
+export PYTHONPATH=${NEWGEOM_ROOT_DIR}/swig:${PYTHONPATH}
+export LD_LIBRARY_PATH=${NEWGEOM_ROOT_DIR}/bin:${NEWGEOM_ROOT_DIR}/swig:${NEWGEOM_ROOT_DIR}/plugins:${LD_LIBRARY_PATH}
+export NEW_GEOM_CONFIG_FILE=${NEWGEOM_ROOT_DIR}/plugins
+export NewGeomResources=${NEWGEOM_ROOT_DIR}/resources
index 5ef39f4abd64642495e48aeb6b3f9b67ed30985c..78609177af1cff3586a7f2959390aced63849001 100755 (executable)
@@ -7,6 +7,7 @@ source ${ROOT_DIR}/sources/linux_env.sh
 
 # Correcting path which defined with error
 export LD_LIBRARY_PATH=${KERNEL_ROOT_DIR}/lib/salome:${LD_LIBRARY_PATH}
-export LightAppConfig=${ROOT_DIR}/install/share/salome/resources/newgeom:${GUI_ROOT_DIR}/share/salome/resources/gui
+export SalomeAppConfig=${ROOT_DIR}/install/share/salome/resources/newgeom:${GUI_ROOT_DIR}/share/salome/resources/gui
 
-SUITApp LightApp --modules=NewGeom
\ No newline at end of file
+${PYTHONBIN} "${KERNEL_ROOT_DIR}/bin/salome/envSalome.py"
+${PYTHONBIN} "${KERNEL_ROOT_DIR}/bin/salome/runSalome.py"
index 740bd52df948bef566b46c4c73af4f5cfc80a296..df76871f2d02cf6e0488d9e9df9c8fbbdea7a3f8 100644 (file)
@@ -6,10 +6,11 @@ aDoc = aSession.moduleDocument()
 aSession.startOperation()
 aFeature = aDoc.addFeature("Point")
 aFeatureData = aFeature.data()
+assert(aFeatureData is not None)
 aFeatureData.real("x").setValue(0.)
 aFeatureData.real("y").setValue(0.)
 aFeatureData.real("z").setValue(0.)
-aFeatureName = aFeatureData.name()
+aFeatureName = aFeature.name()
 aFeature.execute()
 aSession.finishOperation()
 
index 3745d16607caaa0f0b9c7565538c6c4cf276921b..f5747807267792edae667eea97e399c0c32cc6b6 100644 (file)
@@ -57,7 +57,7 @@ class ExchangePlugin_ImportFeature : public ModelAPI_Feature
 
   EXCHANGEPLUGIN_EXPORT virtual bool isInHistory()
   {
-    return false;
+    return true;
   }
 
  protected:
index fe65a751d7719525fa0721b123a776b358241481..a3a1177410a933b240cda98348d735da7eff1481 100644 (file)
@@ -17,6 +17,7 @@
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_Result.h>
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_Session.h>
 
 #include <GeomData_Point.h>
 #include <GeomData_Point2D.h>
index ccdd45e77d1588a490b8edec85e784be4178a34c..c6a669718b51b5456b35293d41880af09acfee91 100644 (file)
@@ -17,6 +17,7 @@
 #include <ModelAPI_Result.h>
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_CompositeFeature.h>
+#include <ModelAPI_Session.h>
 #include <Events_Loop.h>
 #include <Events_LongOp.h>
 #include <Events_Error.h>
index 7ff2bfc8e52974b6b3030849510dac2f7d67c6e1..ba16e8f1c1a2ffbe453e7956f5d3b59105f8092a 100644 (file)
@@ -8,6 +8,7 @@
   #include "ModelAPI_Session.h"
   #include "ModelAPI_Object.h"
   #include "ModelAPI_Feature.h"
+  #include "ModelAPI_CompositeFeature.h"
   #include "ModelAPI_Data.h"
   #include "ModelAPI_Attribute.h"
   #include "ModelAPI_AttributeDocRef.h"
   #include "ModelAPI_ResultBody.h"
   #include "ModelAPI_ResultPart.h"
   
-  template<class T> boost::shared_ptr<T> castTo(boost::shared_ptr<ModelAPI_Result> theObject) 
+  template<class T1, class T2> 
+  boost::shared_ptr<T1> boost_cast(boost::shared_ptr<T2> theObject)
   { 
-    return boost::dynamic_pointer_cast<T>(theObject); 
+    return boost::dynamic_pointer_cast<T1>(theObject); 
   }
   
-   
 %}
 
 // to avoid error on this
@@ -52,6 +53,7 @@
 %shared_ptr(ModelAPI_Session)
 %shared_ptr(ModelAPI_Object)
 %shared_ptr(ModelAPI_Feature)
+%shared_ptr(ModelAPI_CompositeFeature)
 %shared_ptr(ModelAPI_Data)
 %shared_ptr(ModelAPI_Attribute)
 %shared_ptr(ModelAPI_AttributeDocRef)
@@ -76,6 +78,7 @@
 %include "ModelAPI_Session.h"
 %include "ModelAPI_Object.h"
 %include "ModelAPI_Feature.h"
+%include "ModelAPI_CompositeFeature.h"
 %include "ModelAPI_Data.h"
 %include "ModelAPI_Attribute.h"
 %include "ModelAPI_AttributeDocRef.h"
 %template(ObjectList) std::list<boost::shared_ptr<ModelAPI_Object> >;
 %template(ResultList) std::list<boost::shared_ptr<ModelAPI_Result> >;
 
-template<class T> boost::shared_ptr<T> castTo(boost::shared_ptr<ModelAPI_Result> theObject);
-%template(modelAPI_ResultConstruction) castTo<ModelAPI_ResultConstruction>;
-%template(modelAPI_ResultBody) castTo<ModelAPI_ResultBody>;
-%template(modelAPI_ResultPart) castTo<ModelAPI_ResultPart>;
+template<class T1, class T2> boost::shared_ptr<T1> boost_cast(boost::shared_ptr<T2> theObject);
+%template(modelAPI_CompositeFeature) boost_cast<ModelAPI_CompositeFeature, ModelAPI_Feature>;
+%template(modelAPI_ResultConstruction) boost_cast<ModelAPI_ResultConstruction, ModelAPI_Result>;
+%template(modelAPI_ResultBody) boost_cast<ModelAPI_ResultBody, ModelAPI_Result>;
+%template(modelAPI_ResultPart) boost_cast<ModelAPI_ResultPart, ModelAPI_Result>;
+
+
index dcd76efc7a9b7184de03fe8cbcf42c25899f0ab8..cf431322bf298de5b87f8aea74aa707746ad4c43 100644 (file)
@@ -45,4 +45,6 @@ class ModelAPI_AttributeBoolean : public ModelAPI_Attribute
   }
 };
 
+typedef boost::shared_ptr<ModelAPI_AttributeBoolean> AttributeBooleanPtr;
+
 #endif
index 7ee1ff1ca0477a790475474e05c6aea5bd620d54..cf7cc84f379c0f8cab8cb209312d4034fd8a3c06 100644 (file)
@@ -46,4 +46,6 @@ class ModelAPI_AttributeDocRef : public ModelAPI_Attribute
   }
 };
 
+typedef boost::shared_ptr<ModelAPI_AttributeDocRef> AttributeDocRefPtr;
+
 #endif
index dc862f3a63d37bda21f87d2fb6fcd6f1ecedfd24..a3bf80601bbac2ade06f79d8de8f621b32b2276b 100644 (file)
@@ -56,4 +56,6 @@ class ModelAPI_AttributeRefAttr : public ModelAPI_Attribute
   }
 };
 
+typedef boost::shared_ptr<ModelAPI_AttributeRefAttr> AttributeRefAttrPtr;
+
 #endif
index abb39beb645cc8b9bb3cf6b58c54cb291406aa88..d8edfe8d0bfdb1a4d8411512cc6b1823e3fdabda 100644 (file)
@@ -51,4 +51,6 @@ class ModelAPI_AttributeRefList : public ModelAPI_Attribute
   }
 };
 
+typedef boost::shared_ptr<ModelAPI_AttributeRefList> AttributeRefListPtr;
+
 #endif
index 14d63ae32551893516dcd42ab8b0b3df4faf0fc9..5354e8af54a15214a9d8ee3d76873107b4a65286 100644 (file)
@@ -46,4 +46,6 @@ class ModelAPI_AttributeReference : public ModelAPI_Attribute
   }
 };
 
+typedef boost::shared_ptr<ModelAPI_AttributeReference> AttributeReferencePtr;
+
 #endif
index 28c4d6d2a4847523a0e7ebe6da0b52d253d53382..878ca849fb5d0fe0cfe9900eeb17840ccd9b522e 100644 (file)
@@ -27,6 +27,9 @@ public:
 
   /// Returns the sub-feature unique identifier in this composite feature by zero-base index
   virtual int subFeatureId(const int theIndex) const = 0;
+
+  /// Returns true if feature or reuslt belong to this composite feature as subs
+  virtual bool isSub(ObjectPtr theObject) const = 0;
 };
 
 //! Pointer on the composite feature object
index b3dc06045a0461975b881b84a58398613e2281ab..14a1e396f55f0ad3c252e315a7c2c8f93d1937d0 100644 (file)
@@ -7,6 +7,7 @@
 #include <ModelAPI_Result.h>
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Document.h>
+#include <ModelAPI_Session.h>
 #include <Events_Loop.h>
 
 const std::list<boost::shared_ptr<ModelAPI_Result> >& ModelAPI_Feature::results()
index a6c51d0407958d4831cc29773cc8e127aec5e9d1..269471f84f9404277236c65c621970f087295e49 100644 (file)
@@ -5,13 +5,27 @@
 #ifndef ModelAPI_Feature_H_
 #define ModelAPI_Feature_H_
 
-#include "ModelAPI_Object.h"
-#include "ModelAPI_Session.h"
+#include <ModelAPI.h>
+#include <ModelAPI_Object.h>
+#include <ModelAPI_AttributeBoolean.h>
+#include <ModelAPI_AttributeDocRef.h>
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_AttributeInteger.h>
+#include <ModelAPI_AttributeRefAttr.h>
+#include <ModelAPI_AttributeReference.h>
+#include <ModelAPI_AttributeSelection.h>
+#include <ModelAPI_AttributeSelectionList.h>
+#include <ModelAPI_AttributeString.h>
+#include <ModelAPI_AttributeRefList.h>
+#include <ModelAPI_Data.h>
+#include <ModelAPI_Document.h>
+#include <ModelAPI_Result.h>
 
-#include <string>
-#include <list>
 #include <boost/shared_ptr.hpp>
 
+#include <list>
+#include <string>
+
 class ModelAPI_Data;
 class ModelAPI_Document;
 class ModelAPI_Result;
@@ -36,6 +50,12 @@ class ModelAPI_Feature : public ModelAPI_Object
     return MY_GROUP;
   }
 
+  /// Returns document this feature belongs to
+  virtual boost::shared_ptr<ModelAPI_Document> document() const
+  {
+    return ModelAPI_Object::document();
+  }
+
   /// Returns the group identifier of this result
   virtual std::string groupName()
   {
@@ -84,9 +104,73 @@ class ModelAPI_Feature : public ModelAPI_Object
 
   MODELAPI_EXPORT static boost::shared_ptr<ModelAPI_Feature> feature(ObjectPtr theObject);
 
+ //
+ // Helper methods, aliases for data()->method()
+ // -----------------------------------------------------------------------------------------------
+  inline std::string name()
+  {
+    return data()->name();
+  }
+
+  inline boost::shared_ptr<ModelAPI_AttributeBoolean> boolean(const std::string& theID)
+  {
+    return data()->boolean(theID);
+  }
+
+  inline boost::shared_ptr<ModelAPI_AttributeDocRef> document(const std::string& theID)
+  {
+    return data()->document(theID);
+  }
+
+  inline boost::shared_ptr<ModelAPI_AttributeDouble> real(const std::string& theID)
+  {
+    return data()->real(theID);
+  }
+
+  inline boost::shared_ptr<ModelAPI_AttributeInteger> integer(const std::string& theID)
+  {
+    return data()->integer(theID);
+  }
+
+  inline boost::shared_ptr<ModelAPI_AttributeRefAttr> refattr(const std::string& theID)
+  {
+    return data()->refattr(theID);
+  }
+
+  inline boost::shared_ptr<ModelAPI_AttributeReference> reference(const std::string& theID)
+  {
+    return data()->reference(theID);
+  }
+
+  inline boost::shared_ptr<ModelAPI_AttributeRefList> reflist(const std::string& theID)
+  {
+    return data()->reflist(theID);
+  }
+
+  inline boost::shared_ptr<ModelAPI_AttributeSelection> selection(const std::string& theID)
+  {
+    return data()->selection(theID);
+  }
+
+  inline boost::shared_ptr<ModelAPI_AttributeSelectionList> selectionList(const std::string& theID)
+  {
+    return data()->selectionList(theID);
+  }
+
+  inline boost::shared_ptr<ModelAPI_AttributeString> string(const std::string& theID)
+  {
+    return data()->string(theID);
+  }
+
+  inline boost::shared_ptr<ModelAPI_Attribute> attribute(const std::string& theID)
+  {
+    return data()->attribute(theID);
+  }
+ // -----------------------------------------------------------------------------------------------
 };
 
 //! Pointer on feature object
 typedef boost::shared_ptr<ModelAPI_Feature> FeaturePtr;
 
 #endif
+
index f6e3c6c3228d6b34867361e7ab06a8060b3c06d5..7ac6696f5ad5b0433b2d662bd2c5917f6858372f 100644 (file)
@@ -46,7 +46,7 @@ class ModelAPI_Object
   }
 
   /// Returns document this feature belongs to
-  virtual boost::shared_ptr<ModelAPI_Document> document()
+  virtual boost::shared_ptr<ModelAPI_Document> document() const
   {
     return myDoc;
   }
index 1d0a37209b80cba0da6721496cb0f3d4a349a71b..26f54acb57863f07827cc21a36449d08221d9668 100644 (file)
@@ -6,13 +6,12 @@ assert(not aSession.canRedo())
 \r
 aSession.startOperation()\r
 aFeature = aDoc.addFeature("Point")\r
-aFeatureData = aFeature.data()\r
 # Since validators are introduced we have to initialize all\r
 # the feature's attributes\r
-aFeatureData.real("x").setValue(1.)\r
-aFeatureData.real("y").setValue(-1.)\r
-aFeatureData.real("z").setValue(0.)\r
-aFeatureName = aFeatureData.name()\r
+aFeature.real("x").setValue(1.)\r
+aFeature.real("y").setValue(-1.)\r
+aFeature.real("z").setValue(0.)\r
+aFeatureName = aFeature.name()\r
 assert(aFeatureName == "Point_1")\r
 \r
 aFeature.execute()\r
index c8b347f76914e8fff388af20d1e54292233ad4c9..df2502fbbb4af73292b0b998b5d25cd7f405544a 100644 (file)
@@ -1,5 +1,6 @@
 
 #include "ModuleBase_IModule.h"
+#include "ModuleBase_IViewer.h"
 #include "ModuleBase_ViewerPrs.h"
 #include "ModuleBase_Operation.h"
 #include "ModuleBase_ISelection.h"
 #include <Config_PointerMessage.h>
 
 
+ModuleBase_IModule::ModuleBase_IModule(ModuleBase_IWorkshop* theParent)
+  : QObject(theParent), myWorkshop(theParent) 
+{
+  connect(myWorkshop, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
+  connect(myWorkshop->viewer(), SIGNAL(mousePress(QMouseEvent*)), this,
+          SLOT(onMousePressed(QMouseEvent*)));
+  connect(myWorkshop->viewer(), SIGNAL(mouseRelease(QMouseEvent*)), this,
+          SLOT(onMouseReleased(QMouseEvent*)));
+  connect(myWorkshop->viewer(), SIGNAL(mouseMove(QMouseEvent*)), this,
+          SLOT(onMouseMoved(QMouseEvent*)));
+  connect(myWorkshop->viewer(), SIGNAL(keyRelease(QKeyEvent*)), this,
+          SLOT(onKeyRelease(QKeyEvent*)));
+  connect(myWorkshop->viewer(), SIGNAL(mouseDoubleClick(QMouseEvent*)), this,
+          SLOT(onMouseDoubleClick(QMouseEvent*)));
+}
+
+
 void ModuleBase_IModule::launchOperation(const QString& theCmdId)
 {
   ModuleBase_Operation* anOperation = createOperation(theCmdId.toStdString());
   ModuleBase_ISelection* aSelection = myWorkshop->selection();
   // Initialise operation with preliminary selection
-  std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
-  std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
-  anOperation->initSelection(aSelected, aHighlighted);
+  anOperation->initSelection(aSelection);
   sendOperation(anOperation);
 }
 
index 3bea34002f32817fddaea37358746822060ccc83..5787ccfb09989d5aa62afee6753a0117fc91b384 100644 (file)
-#ifndef ModuleBase_IModule_H\r
-#define ModuleBase_IModule_H\r
-\r
+#ifndef ModuleBase_IModule_H
+#define ModuleBase_IModule_H
+
 #include "ModuleBase.h"
-#include "ModuleBase_IWorkshop.h"\r
-\r
-#include <QString>\r
-#include <QObject>\r
-\r
-\r
-class QAction;\r
-class Config_WidgetAPI;\r
-class ModuleBase_ModelWidget;\r
-class ModuleBase_Operation;\r
-class ModuleBase_IWorkshop;\r
-\r
-/**\r
- * Interface to a module\r
- */\r
-class MODULEBASE_EXPORT ModuleBase_IModule : public QObject\r
-{\r
- public:\r
-\r
-   ModuleBase_IModule(ModuleBase_IWorkshop* theParent): QObject(theParent), myWorkshop(theParent) {}\r
-\r
-  virtual ~ModuleBase_IModule() {}\r
-\r
-  /// Reads description of features from XML file \r
-  virtual void createFeatures() = 0;\r
-\r
-  /// Called on creation of menu item in desktop\r
-  virtual void featureCreated(QAction*) = 0;\r
-\r
-  /// Creates an operation and send it to loop\r
-  /// \param theCmdId the operation name\r
-  virtual void launchOperation(const QString& theCmdId);\r
-\r
-  /// Called when it is necessary to update a command state (enable or disable it)\r
-  //virtual bool isFeatureEnabled(const QString& theCmdId) const = 0;\r
-\r
-  /// Creates custom widgets for property panel\r
-  virtual QWidget* createWidgetByType(const std::string& theType, QWidget* theParent,\r
-                                      Config_WidgetAPI* theWidgetApi,\r
-                                      QList<ModuleBase_ModelWidget*>& theModelWidgets)\r
-  {\r
-    return 0;\r
-  }\r
-\r
-  ModuleBase_IWorkshop* workshop() const { return myWorkshop; }\r
-\r
- protected:\r
-  /// Sends the operation for launching\r
-  /// \param theOperation the operation\r
-  void sendOperation(ModuleBase_Operation* theOperation);\r
-\r
-  /// Creates a new operation\r
-  /// \param theCmdId the operation name\r
-  /// \param theFeatureKind a kind of feature to get the feature xml description\r
-  virtual ModuleBase_Operation* createOperation(const std::string& theCmdId,\r
-                                        const std::string& theFeatureKind = "") = 0;\r
-\r
-\r
-protected:\r
-\r
-  ModuleBase_IWorkshop* myWorkshop;\r
-\r
-};\r
-\r
-//! This function must return a new module instance.\r
-extern "C" {\r
-typedef ModuleBase_IModule* (*CREATE_FUNC)(ModuleBase_IWorkshop*);\r
-}\r
-\r
-#define CREATE_MODULE "createModule"\r
-\r
-#endif //ModuleBase_IModule\r
+#include "ModuleBase_IWorkshop.h"
+
+#include <QString>
+#include <QObject>
+
+
+class QAction;
+class QMouseEvent;\r
+class QKeyEvent;\r
+class Config_WidgetAPI;
+class ModuleBase_ModelWidget;
+class ModuleBase_Operation;
+class ModuleBase_IWorkshop;
+
+/**
+ * Interface to a module
+ */
+class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
+{
+  Q_OBJECT
+ public:
+
+   ModuleBase_IModule(ModuleBase_IWorkshop* theParent);
+
+  virtual ~ModuleBase_IModule() {}
+
+  /// Reads description of features from XML file 
+  virtual void createFeatures() = 0;
+
+  /// Called on creation of menu item in desktop
+  virtual void featureCreated(QAction*) = 0;
+
+  /// Creates an operation and send it to loop
+  /// \param theCmdId the operation name
+  virtual void launchOperation(const QString& theCmdId);
+
+  /// Called when it is necessary to update a command state (enable or disable it)
+  //virtual bool isFeatureEnabled(const QString& theCmdId) const = 0;
+
+  /// Creates custom widgets for property panel
+  virtual QWidget* createWidgetByType(const std::string& theType, QWidget* theParent,
+                                      Config_WidgetAPI* theWidgetApi,
+                                      QList<ModuleBase_ModelWidget*>& theModelWidgets)
+  {
+    return 0;
+  }
+
+  ModuleBase_IWorkshop* workshop() const { return myWorkshop; }
+
+protected slots:
+
+  /// Called on selection changed event
+  virtual void onSelectionChanged() {}
+
+  /// SLOT, that is called by mouse press in the viewer.\r
+  /// The mouse released point is sent to the current operation to be processed.\r
+  /// \param theEvent the mouse event\r
+  virtual void onMousePressed(QMouseEvent* theEvent) {}\r
+\r
+  /// SLOT, that is called by mouse release in the viewer.\r
+  /// The mouse released point is sent to the current operation to be processed.\r
+  /// \param theEvent the mouse event\r
+  virtual void onMouseReleased(QMouseEvent* theEvent) {}\r
+  \r
+  /// SLOT, that is called by mouse move in the viewer.\r
+  /// The mouse moved point is sent to the current operation to be processed.\r
+  /// \param theEvent the mouse event\r
+  virtual void onMouseMoved(QMouseEvent* theEvent) {}\r
+\r
+  /// SLOT, that is called by the mouse double click in the viewer.\r
+  /// \param theEvent the mouse event\r
+  virtual void onMouseDoubleClick(QMouseEvent* theEvent) {}\r
+\r
+  /// SLOT, that is called by the key in the viewer is clicked.\r
+  /// \param theEvent the mouse event\r
+  virtual void onKeyRelease(QKeyEvent* theEvent) {}\r
+
+ protected:
+  /// Sends the operation for launching
+  /// \param theOperation the operation
+  void sendOperation(ModuleBase_Operation* theOperation);
+
+  /// Creates a new operation
+  /// \param theCmdId the operation name
+  /// \param theFeatureKind a kind of feature to get the feature xml description
+  virtual ModuleBase_Operation* createOperation(const std::string& theCmdId,
+                                        const std::string& theFeatureKind = "") = 0;
+
+
+protected:
+
+  ModuleBase_IWorkshop* myWorkshop;
+
+};
+
+//! This function must return a new module instance.
+extern "C" {
+typedef ModuleBase_IModule* (*CREATE_FUNC)(ModuleBase_IWorkshop*);
+}
+
+#define CREATE_MODULE "createModule"
+
+#endif //ModuleBase_IModule
index b43a3d42c1ec92ff548cf6b883220a8282ca4728..7f8d9d32d3c06e0a915adce51a348ed52db54e42 100644 (file)
@@ -24,6 +24,9 @@ public:
   /// Returns currently active widget
   virtual ModuleBase_ModelWidget* activeWidget() const = 0;
 
+  /// Returns all property panel's widget created by WidgetFactory
+  virtual const QList<ModuleBase_ModelWidget*>& modelWidgets() const = 0;
+
 signals:
   /// The signal about key release on the control, that corresponds to the attribute
   /// \param theEvent key release event
index 72845616b89eea80aad2a15e2175a7d42a506a31..c1b06ca1b71fae47724684d7c339f41e2fdcd158 100644 (file)
@@ -14,7 +14,7 @@
 #include <NCollection_List.hxx>
 #include <TopoDS_Shape.hxx>
 
-#include <list>
+#include <QList>
 
 class ModuleBase_ISelection
 {
@@ -23,12 +23,12 @@ class ModuleBase_ISelection
   /// Returns a list of viewer selected presentations
   /// \param theShapeTypeToSkip the shapes with this type will be skipped during the result list build
   /// \return list of presentations
-  virtual std::list<ModuleBase_ViewerPrs> getSelected(int theShapeTypeToSkip = -1) const = 0;
+  virtual QList<ModuleBase_ViewerPrs> getSelected(int theShapeTypeToSkip = -1) const = 0;
 
   /// Returns a list of viewer highlited presentations
   /// \param theShapeTypeToSkip the shapes with this type will be skipped during the result list build
   /// \return list of presentations
-  virtual std::list<ModuleBase_ViewerPrs> getHighlighted(int theShapeTypeToSkip = -1) const = 0;
+  virtual QList<ModuleBase_ViewerPrs> getHighlighted(int theShapeTypeToSkip = -1) const = 0;
 
   /**
    * Returns list of features currently selected in 3d viewer
index d6d3c416b33aa6bce54ee4d12f0a456cb1e9a27b..12e9aef22040c91a4a762d8028dcb794291c48b7 100644 (file)
@@ -56,6 +56,10 @@ Q_OBJECT
   //! Returns data object by AIS
   virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const = 0;
 
+  //! Select features clearing previous selection. 
+  //! If the list is empty then selection will be cleared
+  virtual void setSelected(const QList<ObjectPtr>& theFeatures) = 0;
+
 signals:
   void selectionChanged();
 
index 36bc9f6f3cc2fca75a21fcc5bc9911a018728a66..896da097e6160d7f73ed867ea9b9c3a5dc48869d 100644 (file)
@@ -12,6 +12,7 @@
 #include "ModuleBase_WidgetValueFeature.h"
 #include "ModuleBase_ViewerPrs.h"
 #include "ModuleBase_IPropertyPanel.h"
+#include "ModuleBase_ISelection.h"
 
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_Document.h>
@@ -20,7 +21,9 @@
 #include <ModelAPI_Document.h>
 #include <ModelAPI_Events.h>
 #include <ModelAPI_Result.h>
+#include <ModelAPI_Object.h>
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_Session.h>
 
 #include <GeomAPI_Pnt2d.h>
 
@@ -232,33 +235,75 @@ void ModuleBase_Operation::setRunning(bool theState)
   }
 }
 
-void ModuleBase_Operation::activateByPreselection()
+bool ModuleBase_Operation::activateByPreselection()
 {
   if (!myPropertyPanel)
-    return;
-  ModuleBase_ModelWidget* aActiveWgt = myPropertyPanel->activeWidget();
-  if ((myPreSelection.size() > 0) && aActiveWgt) {
-    const ModuleBase_ViewerPrs& aPrs = myPreSelection.front();
+    return false;
+  if (myPreSelection.empty())
+    return false;
+  const QList<ModuleBase_ModelWidget*>& aWidgets = myPropertyPanel->modelWidgets();
+  if (aWidgets.empty())
+    return false;
+  
+  ModuleBase_ModelWidget* aWgt;
+  ModuleBase_ViewerPrs aPrs;
+  QList<ModuleBase_ModelWidget*>::const_iterator aWIt;
+  QList<ModuleBase_ViewerPrs>::const_iterator aPIt;
+  for (aWIt = aWidgets.constBegin(), aPIt = myPreSelection.constBegin();
+       (aWIt != aWidgets.constEnd()) && (aPIt != myPreSelection.constEnd());
+       ++aWIt, ++aPIt) {
+    aWgt = (*aWIt);
+    aPrs = (*aPIt);
     ModuleBase_WidgetValueFeature aValue;
     aValue.setObject(aPrs.object());
-    if (aActiveWgt->setValue(&aValue)) {
-      myPreSelection.remove(aPrs);
-      myPropertyPanel->activateNextWidget();
-    }
-    // If preselection is enough to make a valid feature - apply it immediately
+    if (!aWgt->setValue(&aValue))
+      break;
   }
+  if (canBeCommitted()) {
+    // if all widgets are filled with selection
+    commit();
+    return true;
+  }
+
+  //ModuleBase_ModelWidget* aActiveWgt = myPropertyPanel->activeWidget();
+  //if ((myPreSelection.size() > 0) && aActiveWgt) {
+  //  const ModuleBase_ViewerPrs& aPrs = myPreSelection.first();
+  //  ModuleBase_WidgetValueFeature aValue;
+  //  aValue.setObject(aPrs.object());
+  //  if (aActiveWgt->setValue(&aValue)) {
+  //    myPreSelection.removeOne(aPrs);
+  //    myPropertyPanel->activateNextWidget();
+  //  }
+  //  // If preselection is enough to make a valid feature - apply it immediately
+  //}
+  return false;
 }
 
-void ModuleBase_Operation::initSelection(
-    const std::list<ModuleBase_ViewerPrs>& theSelected,
-    const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
+void ModuleBase_Operation::initSelection(ModuleBase_ISelection* theSelection)
 {
-  myPreSelection = theSelected;
+  myPreSelection.clear();
+
+  // Check that the selected result are not results of operation feature
+  QList<ModuleBase_ViewerPrs> aSelected = theSelection->getSelected();
+  FeaturePtr aFeature = feature();
+  if (aFeature) {
+    std::list<ResultPtr> aResults = aFeature->results();
+    QList<ObjectPtr> aResList;
+    std::list<ResultPtr>::const_iterator aIt;
+    for (aIt = aResults.begin(); aIt != aResults.end(); ++aIt)
+      aResList.append(*aIt);
+
+    foreach (ModuleBase_ViewerPrs aPrs, aSelected) {
+      if ((!aResList.contains(aPrs.object())) && (aPrs.object() != aFeature))
+        myPreSelection.append(aPrs);
+    }
+  } else
+    myPreSelection = aSelected;
 }
 
 void ModuleBase_Operation::onWidgetActivated(ModuleBase_ModelWidget* theWidget)
 {
-  activateByPreselection();
+  //activateByPreselection();
   //if (theWidget && myPropertyPanel) {
   //  myPropertyPanel->activateNextWidget();
   ////  //emit activateNextWidget(myActiveWidget);
index 80cab9e125b85f9afd783ed2480d906f86bf41ce..9d1a1c04ad2e3310c2040d0ac03ccbedddc93b0d 100644 (file)
@@ -21,6 +21,7 @@
 class ModuleBase_ModelWidget;
 class ModuleBase_OperationDescription;
 class ModuleBase_IPropertyPanel;
+class ModuleBase_ISelection;
 
 class QKeyEvent;
 
@@ -116,13 +117,15 @@ Q_OBJECT
   /// Initialisation of operation with preliminary selection
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
-  virtual void initSelection(const std::list<ModuleBase_ViewerPrs>& theSelected,
-                             const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+  virtual void initSelection(ModuleBase_ISelection* theSelection);
 
   virtual void setPropertyPanel(ModuleBase_IPropertyPanel* theProp);
 
   ModuleBase_IPropertyPanel* propertyPanel() const { return myPropertyPanel; }
 
+  /// Activates widgets by preselection if it is accepted
+  virtual bool activateByPreselection();
+
 signals:
   void started();  /// the operation is started
   void aborted();  /// the operation is aborted
@@ -204,9 +207,6 @@ signals:
   /// Returns pointer to the root document.
   boost::shared_ptr<ModelAPI_Document> document() const;
 
-  /// Activates widgets by preselection if it is accepted
-  virtual void activateByPreselection();
-
   /// Set value to the active widget
   /// \param theFeature the feature
   /// \param theX the horizontal coordinate
@@ -230,7 +230,7 @@ signals:
   QStringList myNestedFeatures;
 
   /// List of pre-selected object 
-  std::list<ModuleBase_ViewerPrs> myPreSelection;
+  QList<ModuleBase_ViewerPrs> myPreSelection;
 
   /// Access to property panel
   ModuleBase_IPropertyPanel* myPropertyPanel;
index b039e9bfd34ee9223d29f27acbf8d207968f362c..6de0bba8fc0d5037959669ea11288756b16420f4 100644 (file)
@@ -46,6 +46,8 @@ void ModuleBase_ResultPrs::Compute(const Handle(PrsMgr_PresentationManager3d)& t
                                    const Standard_Integer theMode)
 {
   boost::shared_ptr<GeomAPI_Shape> aShapePtr = ModelAPI_Tools::shape(myResult);
+  if (!aShapePtr)
+    return;
   myOriginalShape = aShapePtr->impl<TopoDS_Shape>();
   Set(aShapePtr->impl<TopoDS_Shape>());
   AIS_Shape::Compute(thePresentationManager, thePresentation, theMode);
index 6d2209de55682358037e820fc66a94b06e34cef0..b10437101a851b008480626dab1abd86a57e9dae 100644 (file)
@@ -74,6 +74,9 @@ Standard_Boolean ModuleBase_ShapeInPlaneFilter::IsOk(const Handle(SelectMgr_Enti
           return aD1 && aD2 && aD3;
         }
       }
+    } else {
+      // This is not object controlled by the filter
+      return Standard_True;
     }
   }
   return Standard_False;
index d6d6d65664c8ab14edb97d487d63a621780fdf68..922ab91519dde70b29a459e79aa762472c752bff 100644 (file)
@@ -19,7 +19,6 @@
 #include <QLayout>
 #include <QLabel>
 #include <QEvent>
-#include <QKeyEvent>
 #include <QTimer>
 
 #include <math.h>
index cbe7503a8e7a43833324fc3c275308d389ebf3db..bd45e4ee04ae26eabd8b8a42cbde496e3f80423b 100644 (file)
@@ -27,6 +27,7 @@
 #include <ModuleBase_WidgetMultiSelector.h>
 
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_Session.h>
 
 #include <Config_Keywords.h>
 #include <Config_WidgetAPI.h>
@@ -57,6 +58,7 @@ ModuleBase_WidgetFactory::ModuleBase_WidgetFactory(const std::string& theXmlRepr
 
 ModuleBase_WidgetFactory::~ModuleBase_WidgetFactory()
 {
+  delete myWidgetApi;
 }
 
 void ModuleBase_WidgetFactory::createWidget(QWidget* theParent)
index fcc226b3ea4cc67660f9edd0dc78992a95c30f01..faf664fe53e9d48180ac7323988e5be4e256808f 100644 (file)
@@ -21,6 +21,7 @@
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_ResultValidator.h>
 #include <ModelAPI_RefAttrValidator.h>
+#include <ModelAPI_Session.h>
 
 #include <QWidget>
 #include <QLineEdit>
index d2369702f9ec3f2e2a106f267fba9cb6b7cf680c..36191b141ad90918838b0122f2bacc47ccbc7fa0 100644 (file)
@@ -9,6 +9,7 @@
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Object.h>
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_Session.h>
 #include <ModuleBase_WidgetFileSelector.h>
 #include <ModuleBase_Tools.h>
 
index 5b2f24a14c2c8de452d76cc21c6ebfef03f8d21b..21cef047dc80351fff5b0ca7a32d1aaa36d132b8 100644 (file)
@@ -23,7 +23,6 @@
 #include <QGridLayout>
 #include <QLabel>
 #include <QEvent>
-#include <QKeyEvent>
 
 #include <cfloat>
 #include <climits>
index 3b494373ff98b1190a2c8f83ca88cf7727db2103..267cb064740a4958beddfe3dc732bd7836e29f4c 100644 (file)
@@ -3,6 +3,8 @@
 
 #include <XGUI_Workshop.h>
 
+#include <ModelAPI_Session.h>
+
 #include <LightApp_Study.h>
 #include <CAM_Application.h>
 #include <SUIT_Tools.h>
index b2f838d1a9a7d72038c3b586a9613c81c4cb8865..f38381ef85160fcedbbb5b29dd2744766a84d947 100644 (file)
@@ -18,6 +18,7 @@
 #include <ModelAPI_Events.h>
 #include <ModelAPI_Validator.h>
 #include <ModelAPI_Data.h>
+#include <ModelAPI_Session.h>
 
 #include <GeomDataAPI_Point2D.h>
 #include <GeomDataAPI_Point.h>
@@ -87,16 +88,6 @@ PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
   connect(aContextMenuMgr, SIGNAL(actionTriggered(const QString&, bool)), this,
           SLOT(onContextMenuCommand(const QString&, bool)));
 
-  connect(myWorkshop->viewer(), SIGNAL(mousePress(QMouseEvent*)), this,
-          SLOT(onMousePressed(QMouseEvent*)));
-  connect(myWorkshop->viewer(), SIGNAL(mouseRelease(QMouseEvent*)), this,
-          SLOT(onMouseReleased(QMouseEvent*)));
-  connect(myWorkshop->viewer(), SIGNAL(mouseMove(QMouseEvent*)), this,
-          SLOT(onMouseMoved(QMouseEvent*)));
-  connect(myWorkshop->viewer(), SIGNAL(keyRelease(QKeyEvent*)), this,
-          SLOT(onKeyRelease(QKeyEvent*)));
-  connect(myWorkshop->viewer(), SIGNAL(mouseDoubleClick(QMouseEvent*)), this,
-          SLOT(onMouseDoubleClick(QMouseEvent*)));
 }
 
 PartSet_Module::~PartSet_Module()
@@ -224,14 +215,27 @@ void PartSet_Module::onMousePressed(QMouseEvent* theEvent)
   XGUI_Workshop* aXWshp = xWorkshop();
   PartSet_OperationSketchBase* aPreviewOp = 
     dynamic_cast<PartSet_OperationSketchBase*>(workshop()->currentOperation());
-  Handle(V3d_View) aView = myWorkshop->viewer()->activeView();
-  if (aPreviewOp && (!aView.IsNull())) {
+  if (aPreviewOp) {
     ModuleBase_ISelection* aSelection = workshop()->selection();
     // Initialise operation with preliminary selection
-    std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
-    std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
-
-    aPreviewOp->mousePressed(theEvent, aView, aSelected, aHighlighted);
+    //QList<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
+    //QList<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
+    //QList<ObjectPtr> aObjList;
+    //bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
+    //if (aHasShift) {
+    //  foreach(ModuleBase_ViewerPrs aPrs, aSelected)
+    //    aObjList.append(aPrs.object());
+
+    //  foreach (ModuleBase_ViewerPrs aPrs, aHighlighted) {
+    //    if (!aObjList.contains(aPrs.object()))
+    //      aObjList.append(aPrs.object());
+    //  }
+    //} else {
+    //  foreach(ModuleBase_ViewerPrs aPrs, aHighlighted)
+    //    aObjList.append(aPrs.object());
+    //}
+    //onSetSelection(aObjList);
+    aPreviewOp->mousePressed(theEvent, myWorkshop->viewer(), aSelection);
   }
 }
 
@@ -239,14 +243,10 @@ void PartSet_Module::onMouseReleased(QMouseEvent* theEvent)
 {
   PartSet_OperationSketchBase* aPreviewOp = 
     dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop->currentOperation());
-  Handle(V3d_View) aView = myWorkshop->viewer()->activeView();
-  if (aPreviewOp && (!aView.IsNull())) {
+  if (aPreviewOp) {
     ModuleBase_ISelection* aSelection = workshop()->selection();
     // Initialise operation with preliminary selection
-    std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
-    std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
-
-    aPreviewOp->mouseReleased(theEvent, aView, aSelected, aHighlighted);
+    aPreviewOp->mouseReleased(theEvent, myWorkshop->viewer(), aSelection);
   }
 }
 
@@ -254,9 +254,8 @@ void PartSet_Module::onMouseMoved(QMouseEvent* theEvent)
 {
   PartSet_OperationSketchBase* aPreviewOp = 
     dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop->currentOperation());
-  Handle(V3d_View) aView = myWorkshop->viewer()->activeView();
-  if (aPreviewOp && (!aView.IsNull()))
-    aPreviewOp->mouseMoved(theEvent, aView);
+  if (aPreviewOp)
+    aPreviewOp->mouseMoved(theEvent, myWorkshop->viewer());
 }
 
 void PartSet_Module::onKeyRelease(QKeyEvent* theEvent)
@@ -276,9 +275,7 @@ void PartSet_Module::onMouseDoubleClick(QMouseEvent* theEvent)
   if (aPreviewOp && (!aView.IsNull())) {
     ModuleBase_ISelection* aSelection = workshop()->selection();
     // Initialise operation with preliminary selection
-    std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
-    std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
-    aPreviewOp->mouseDoubleClick(theEvent, aView, aSelected, aHighlighted);
+    aPreviewOp->mouseDoubleClick(theEvent, aView, aSelection);
   }
 }
 
@@ -314,9 +311,7 @@ void PartSet_Module::onRestartOperation(std::string theName, ObjectPtr theObject
     }
     ModuleBase_ISelection* aSelection = workshop()->selection();
     // Initialise operation with preliminary selection
-    std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
-    std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
-    aSketchOp->initSelection(aSelected, aHighlighted);
+    aSketchOp->initSelection(aSelection);
   } //else if (aFeature) {
     //anOperation->setFeature(aFeature);
     ////Deactivate result of current feature in order to avoid its selection
@@ -371,13 +366,14 @@ void PartSet_Module::setSketchingMode(const gp_Pln& thePln)
   // Clear standard selection modes
   aDisplayer->setSelectionModes(aModes);
   aDisplayer->openLocalContext();
-  // Get default selection modes
-  aModes = sketchSelectionModes(ObjectPtr());
-  aDisplayer->activateObjectsOutOfContext(aModes);
 
   // Set filter
   mySketchFilter = new ModuleBase_ShapeInPlaneFilter(thePln);
   aDisplayer->addSelectionFilter(mySketchFilter);
+
+  // Get default selection modes
+  aModes = sketchSelectionModes(ObjectPtr());
+  aDisplayer->activateObjectsOutOfContext(aModes);
 }
 
 void PartSet_Module::onFeatureConstructed(ObjectPtr theFeature, int theMode)
@@ -453,8 +449,10 @@ ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdI
             SLOT(onFeatureConstructed(ObjectPtr, int)));
     connect(aPreviewOp, SIGNAL(restartRequired(std::string, ObjectPtr)), this,
             SLOT(onRestartOperation(std::string, ObjectPtr)));
-    connect(aPreviewOp, SIGNAL(multiSelectionEnabled(bool)), this,
-            SLOT(onMultiSelectionEnabled(bool)));
+    // If manage multi selection the it will be impossible to select more then one
+    // object under operation Edit
+//    connect(aPreviewOp, SIGNAL(multiSelectionEnabled(bool)), this,
+//            SLOT(onMultiSelectionEnabled(bool)));
 
     connect(aPreviewOp, SIGNAL(stopSelection(const QList<ObjectPtr>&, const bool)), this,
             SLOT(onStopSelection(const QList<ObjectPtr>&, const bool)));
@@ -605,3 +603,23 @@ gp_Pln PartSet_Module::getSketchPlane(FeaturePtr theSketch) const
   return gp_Pln(aOrig, aDir);
 }
 
+
+void PartSet_Module::onSelectionChanged()
+{
+  ModuleBase_ISelection* aSelect = myWorkshop->selection();
+  QList<ModuleBase_ViewerPrs> aSelected = aSelect->getSelected();
+  // We need to stop edit operation if selection is cleared
+  if (aSelected.size() == 0) {
+    PartSet_OperationFeatureEdit* anEditOp = 
+      dynamic_cast<PartSet_OperationFeatureEdit*>(myWorkshop->currentOperation());
+    if (!anEditOp)
+      return;
+    anEditOp->commit();
+  } else {
+    PartSet_OperationSketchBase* aSketchOp = 
+      dynamic_cast<PartSet_OperationSketchBase*>(myWorkshop->currentOperation());
+    if (aSketchOp) {
+      aSketchOp->selectionChanged(aSelect);
+    }
+  }
+}
index 79379ffc49403e1734ece9fa633d3c26fbba883b..f5851100ce749aa309c4dd6dc8367c7d74f60aee 100644 (file)
@@ -17,8 +17,6 @@
 
 #include <boost/shared_ptr.hpp>
 
-class QMouseEvent;
-class QKeyEvent;
 class PartSet_Listener;
 class ModelAPI_Feature;
 class XGUI_ViewerPrs;
@@ -70,26 +68,6 @@ Q_OBJECT
   void onOperationStopped(ModuleBase_Operation* theOperation);
   /// SLOT, that is called afetr the popup menu action clicked.
   void onContextMenuCommand(const QString& theId, bool isChecked);
-  /// SLOT, that is called by mouse press in the viewer.
-  /// The mouse released point is sent to the current operation to be processed.
-  /// \param theEvent the mouse event
-  void onMousePressed(QMouseEvent* theEvent);
-  /// SLOT, that is called by mouse release in the viewer.
-  /// The mouse released point is sent to the current operation to be processed.
-  /// \param theEvent the mouse event
-  void onMouseReleased(QMouseEvent* theEvent);
-  /// SLOT, that is called by mouse move in the viewer.
-  /// The mouse moved point is sent to the current operation to be processed.
-  /// \param theEvent the mouse event
-  void onMouseMoved(QMouseEvent* theEvent);
-
-  /// SLOT, that is called by the key in the viewer is clicked.
-  /// \param theEvent the mouse event
-  void onKeyRelease(QKeyEvent* theEvent);
-
-  /// SLOT, that is called by the mouse double click in the viewer.
-  /// \param theEvent the mouse event
-  void onMouseDoubleClick(QMouseEvent* theEvent);
 
   /// SLOT, to apply to the current viewer the operation
   /// \param theX the X projection value
@@ -129,6 +107,33 @@ Q_OBJECT
   /// \param the attribute of the feature
   void onStorePoint2D(ObjectPtr theFeature, const std::string& theAttribute);
 
+protected slots:
+  /// Called on selection changed event
+  virtual void onSelectionChanged();
+
+  /// SLOT, that is called by mouse press in the viewer.
+  /// The mouse released point is sent to the current operation to be processed.
+  /// \param theEvent the mouse event
+  virtual void onMousePressed(QMouseEvent* theEvent);
+
+  /// SLOT, that is called by mouse release in the viewer.
+  /// The mouse released point is sent to the current operation to be processed.
+  /// \param theEvent the mouse event
+  virtual void onMouseReleased(QMouseEvent* theEvent);
+  
+  /// SLOT, that is called by mouse move in the viewer.
+  /// The mouse moved point is sent to the current operation to be processed.
+  /// \param theEvent the mouse event
+  virtual void onMouseMoved(QMouseEvent* theEvent);
+
+  /// SLOT, that is called by the mouse double click in the viewer.
+  /// \param theEvent the mouse event
+  virtual void onMouseDoubleClick(QMouseEvent* theEvent);
+
+  /// SLOT, that is called by the key in the viewer is clicked.
+  /// \param theEvent the mouse event
+  virtual void onKeyRelease(QKeyEvent* theEvent);
+
  protected:
   /// Creates a new operation
   /// \param theCmdId the operation name
index 9955fa5f05a9eefd10a419b6c013c83b66c0df61..458410aba5f87f446abc99c8d228e1a6a1b5f9bd 100644 (file)
@@ -25,6 +25,8 @@
 #include <ModuleBase_WidgetPoint2D.h>
 #include <ModuleBase_WidgetValueFeature.h>
 #include "ModuleBase_IPropertyPanel.h"
+#include "ModuleBase_ISelection.h"
+#include "ModuleBase_IViewer.h"
 
 #include <XGUI_Constants.h>
 
@@ -59,35 +61,36 @@ CompositeFeaturePtr PartSet_OperationFeatureBase::sketch() const
   return mySketch;
 }
 
-void PartSet_OperationFeatureBase::mouseReleased(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                                 const std::list<ModuleBase_ViewerPrs>& theSelected,
-                                                 const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
+void PartSet_OperationFeatureBase::mouseReleased(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer,
+                                                 ModuleBase_ISelection* theSelection)
 {
-  gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView);
+  Handle(V3d_View) aView = theViewer->activeView();
+  gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), aView);
   double aX = aPoint.X(), anY = aPoint.Y();
+  QList<ModuleBase_ViewerPrs> aSelected = theSelection->getSelected();
 
-  if (theSelected.empty()) {
-    PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
+  if (aSelected.empty()) {
+    PartSet_Tools::convertTo2D(aPoint, sketch(), aView, aX, anY);
   } else {
-    ModuleBase_ViewerPrs aPrs = theSelected.front();
+    ModuleBase_ViewerPrs aPrs = aSelected.first();
     const TopoDS_Shape& aShape = aPrs.shape();
     if (!aShape.IsNull()) {
       if (aShape.ShapeType() == TopAbs_VERTEX) { // a point is selected
         const TopoDS_Vertex& aVertex = TopoDS::Vertex(aShape);
         if (!aVertex.IsNull()) {
           aPoint = BRep_Tool::Pnt(aVertex);
-          PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
+          PartSet_Tools::convertTo2D(aPoint, sketch(), aView, aX, anY);
           ModuleBase_ModelWidget* aActiveWgt = myPropertyPanel->activeWidget();
           PartSet_Tools::setConstraints(sketch(), feature(), aActiveWgt->attributeID(), aX, anY);
         }
       } else if (aShape.ShapeType() == TopAbs_EDGE) { // a line is selected
-        PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
+        PartSet_Tools::convertTo2D(aPoint, sketch(), aView, aX, anY);
       }
     }
   }
   ObjectPtr aFeature;
-  if (!theSelected.empty()) {
-    ModuleBase_ViewerPrs aPrs = theSelected.front();
+  if (!aSelected.empty()) {
+    ModuleBase_ViewerPrs aPrs = aSelected.first();
     aFeature = aPrs.object();
   } else {
     aFeature = feature();  // for the widget distance only
index a9651e6f85536884b551d5f99f0ffcdb409fe76d..cde5fb6756674e736437cfc49e2bb817d5ccc6db 100644 (file)
@@ -42,9 +42,8 @@ Q_OBJECT
   /// \param theView a viewer to have the viewer the eye position
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
-  virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
-                             const std::list<ModuleBase_ViewerPrs>& theSelected,
-                             const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+  virtual void mouseReleased(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer,
+                             ModuleBase_ISelection* theSelection);
 
 
  protected:
index 0bc2d9238b818f5f51b4ccc8cc1afd29dca400f2..c2780006535a3cc6645a7c75db092c66c516f3a2 100644 (file)
@@ -27,6 +27,8 @@
 #include <ModuleBase_WidgetValueFeature.h>
 #include <ModuleBase_ViewerPrs.h>
 #include <ModuleBase_IPropertyPanel.h>
+#include <ModuleBase_ISelection.h>
+#include <ModuleBase_IViewer.h>
 
 #include <XGUI_Constants.h>
 
@@ -77,11 +79,12 @@ bool PartSet_OperationFeatureCreate::canBeCommitted() const
   return false;
 }
 
-void PartSet_OperationFeatureCreate::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
+void PartSet_OperationFeatureCreate::mouseMoved(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer)
 {
     double aX, anY;
-    gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView);
-    PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
+    Handle(V3d_View) aView = theViewer->activeView();
+    gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), aView);
+    PartSet_Tools::convertTo2D(aPoint, sketch(), aView, aX, anY);
     setWidgetValue(feature(), aX, anY);
     flushUpdated();
 }
@@ -101,37 +104,39 @@ void PartSet_OperationFeatureCreate::keyReleased(const int theKey)
   }
 }
 
-void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                                 const std::list<ModuleBase_ViewerPrs>& theSelected,
-                                                 const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
+void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer,
+                                                   ModuleBase_ISelection* theSelection)
 {
-  gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView);
+  Handle(V3d_View) aView = theViewer->activeView();
+  gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), aView);
   double aX = aPoint.X(), anY = aPoint.Y();
   bool isClosedContour = false;
 
-  if (theSelected.empty()) {
-    PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
+  QList<ModuleBase_ViewerPrs> aSelected = theSelection->getSelected();
+
+  if (aSelected.empty()) {
+    PartSet_Tools::convertTo2D(aPoint, sketch(), aView, aX, anY);
   } else {
-    ModuleBase_ViewerPrs aPrs = theSelected.front();
+    ModuleBase_ViewerPrs aPrs = aSelected.first();
     const TopoDS_Shape& aShape = aPrs.shape();
     if (!aShape.IsNull()) {
       if (aShape.ShapeType() == TopAbs_VERTEX) { // a point is selected
         const TopoDS_Vertex& aVertex = TopoDS::Vertex(aShape);
         if (!aVertex.IsNull()) {
           aPoint = BRep_Tool::Pnt(aVertex);
-          PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
+          PartSet_Tools::convertTo2D(aPoint, sketch(), aView, aX, anY);
           ModuleBase_ModelWidget* aActiveWgt = myPropertyPanel->activeWidget();
           PartSet_Tools::setConstraints(sketch(), feature(), aActiveWgt->attributeID(), aX, anY);
           isClosedContour = true;
         }
       } else if (aShape.ShapeType() == TopAbs_EDGE) { // a line is selected
-        PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
+        PartSet_Tools::convertTo2D(aPoint, sketch(), aView, aX, anY);
       }
     }
   }
   ObjectPtr aFeature;
-  if (!theSelected.empty()) {
-    ModuleBase_ViewerPrs aPrs = theSelected.front();
+  if (!aSelected.empty()) {
+    ModuleBase_ViewerPrs aPrs = aSelected.first();
     aFeature = aPrs.object();
   } else {
     aFeature = feature();  // for the widget distance only
@@ -155,7 +160,7 @@ void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, Handle
 void PartSet_OperationFeatureCreate::startOperation()
 {
   PartSet_OperationSketchBase::startOperation();
-  emit multiSelectionEnabled(false);
+  //emit multiSelectionEnabled(false);
 }
 
 void PartSet_OperationFeatureCreate::abortOperation()
@@ -167,7 +172,7 @@ void PartSet_OperationFeatureCreate::abortOperation()
 void PartSet_OperationFeatureCreate::stopOperation()
 {
   PartSet_OperationSketchBase::stopOperation();
-  emit multiSelectionEnabled(true);
+  //emit multiSelectionEnabled(true);
 }
 
 void PartSet_OperationFeatureCreate::afterCommitOperation()
index b13b8ece551344d3efb079359872832f4d886f77..bbc83f5007c9143d6b61abfac82c4eae195c9870 100644 (file)
@@ -42,16 +42,15 @@ Q_OBJECT
   /// Gives the current mouse point in the viewer
   /// \param thePoint a point clicked in the viewer
   /// \param theEvent the mouse event
-  virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
+  virtual void mouseMoved(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer);
 
   /// Gives the current selected objects to be processed by the operation
   /// \param theEvent the mouse event
   /// \param theView a viewer to have the viewer the eye position
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
-  virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
-                             const std::list<ModuleBase_ViewerPrs>& theSelected,
-                             const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+  virtual void mouseReleased(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer,
+                             ModuleBase_ISelection* theSelection);
   /// Processes the key pressed in the view
   /// \param theKey a key value
   virtual void keyReleased(const int theKey);
index 16e2b44370ae89345e43b8faf42c09064ad472c9..f84466fe2e4261ff5f6613e2ac569d574659d31e 100644 (file)
@@ -5,6 +5,7 @@
 #include <PartSet_OperationFeatureEdit.h>
 #include <PartSet_Tools.h>
 #include <PartSet_OperationSketch.h>
+#include <PartSet_OperationFeatureEditMulti.h>
 
 #include <SketchPlugin_Constraint.h>
 
@@ -12,6 +13,8 @@
 #include <ModuleBase_WidgetEditor.h>
 #include <ModuleBase_ViewerPrs.h>
 #include <ModuleBase_IPropertyPanel.h>
+#include <ModuleBase_ISelection.h>
+#include <ModuleBase_IViewer.h>
 
 #include <ModelAPI_Events.h>
 
@@ -52,62 +55,82 @@ PartSet_OperationFeatureEdit::~PartSet_OperationFeatureEdit()
 }
 
 
-void PartSet_OperationFeatureEdit::mousePressed(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                                const std::list<ModuleBase_ViewerPrs>& theSelected,
-                                                const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+void PartSet_OperationFeatureEdit::mousePressed(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer, ModuleBase_ISelection* theSelection)
 {
   ModuleBase_ModelWidget* aActiveWgt = myPropertyPanel->activeWidget();
   if(aActiveWgt && aActiveWgt->isViewerSelector()) {
     // Almost do nothing, all stuff in on PartSet_OperationFeatureBase::mouseReleased
-    PartSet_OperationFeatureBase::mousePressed(theEvent, theView, theSelected, theHighlighted);
+    PartSet_OperationFeatureBase::mousePressed(theEvent, theViewer, theSelection);
     return;
   }
+  QList<ModuleBase_ViewerPrs> aSelected = theSelection->getSelected();
+  QList<ModuleBase_ViewerPrs> aHighlighted = theSelection->getHighlighted();
+  bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
+  if (aHasShift && !aHighlighted.empty()) {
+    foreach (ModuleBase_ViewerPrs aPrs, aHighlighted) {
+      aSelected.append(aPrs);
+    }
+  }
   ObjectPtr aObject;
-  if (!theHighlighted.empty())
-    aObject = theHighlighted.front().object();
-  if (!aObject && !theSelected.empty())  // changed for a constrain
-    aObject = theSelected.front().object();
+  if (!aSelected.empty()) {
+    aObject = aSelected.first().object();
+  } else {   
+    if (!aHighlighted.empty())
+      aObject = aHighlighted.first().object();
+  }
+  //if (!theHighlighted.empty())
+  //  aObject = theHighlighted.front().object();
+  //if (!aObject && !theSelected.empty())  // changed for a constrain
+  //  aObject = theSelected.front().object();
 
   FeaturePtr aFeature = ModelAPI_Feature::feature(aObject);
-  if (!aFeature || aFeature != feature()) {
+  if (!aFeature || aFeature != feature() || (aSelected.size() > 1)) {
     if (commit()) {
+      theViewer->enableSelection(true);
       emit featureConstructed(feature(), FM_Deactivation);
 
+      // If we have selection and prehilighting with shift pressed 
+      // Then we have to select all these objects and restart as multi edit operfation
       //bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
       //if (aHasShift && !theHighlighted.empty()) {
       //  QList<ObjectPtr> aSelected;
       //  std::list<ModuleBase_ViewerPrs>::const_iterator aIt;
       //  for (aIt = theSelected.cbegin(); aIt != theSelected.cend(); ++aIt)
       //    aSelected.append((*aIt).object());
-        /*for (aIt = theHighlighted.cbegin(); aIt != theHighlighted.cend(); ++aIt) {
-         if (!aSelected.contains((*aIt).object()))
-         aSelected.append((*aIt).object());
-         }*/
-        //aSelected.push_back(feature());
-        //aSelected.push_back(theHighlighted.front().object());
-        //emit setSelection(aSelected);
+
+      //  for (aIt = theHighlighted.cbegin(); aIt != theHighlighted.cend(); ++aIt) {
+      //    if (!aSelected.contains((*aIt).object()))
+      //      aSelected.append((*aIt).object());
+      //  }
+      //  emit setSelection(aSelected);
       //} else 
       if (aFeature) {
-        restartOperation(PartSet_OperationFeatureEdit::Type(), aFeature);
+        std::string anOperationType =
+            (aSelected.size() > 1) ?
+                PartSet_OperationFeatureEditMulti::Type() : PartSet_OperationFeatureEdit::Type();
+        restartOperation(anOperationType, aFeature);
       }
+      //}
     }
   }
 }
 
-void PartSet_OperationFeatureEdit::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
+void PartSet_OperationFeatureEdit::mouseMoved(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer)
 {
   if (!(theEvent->buttons() & Qt::LeftButton))
     return;
+  Handle(V3d_View) aView = theViewer->activeView();
+  gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), aView);
 
-  gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView);
+  theViewer->enableSelection(false);
 
-  blockSelection(true);
+  //blockSelection(true);
   if (myCurPoint.myIsInitialized) {
     double aCurX, aCurY;
-    PartSet_Tools::convertTo2D(myCurPoint.myPoint, sketch(), theView, aCurX, aCurY);
+    PartSet_Tools::convertTo2D(myCurPoint.myPoint, sketch(), aView, aCurX, aCurY);
 
     double aX, anY;
-    PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
+    PartSet_Tools::convertTo2D(aPoint, sketch(), aView, aX, anY);
 
     double aDeltaX = aX - aCurX;
     double aDeltaY = anY - aCurY;
@@ -127,29 +150,29 @@ void PartSet_OperationFeatureEdit::mouseMoved(QMouseEvent* theEvent, Handle(V3d_
 }
 
 void PartSet_OperationFeatureEdit::mouseReleased(
-    QMouseEvent* theEvent, Handle(V3d_View) theView,
-    const std::list<ModuleBase_ViewerPrs>& theSelected,
-    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+    QMouseEvent* theEvent, ModuleBase_IViewer* theViewer,
+    ModuleBase_ISelection* theSelection)
 {
+  theViewer->enableSelection(true);
   ModuleBase_ModelWidget* aActiveWgt = 0;
   if (myPropertyPanel)
     aActiveWgt = myPropertyPanel->activeWidget();
   if(aActiveWgt && aActiveWgt->isViewerSelector()) {
     // Almost do nothing, all stuff in on PartSet_OperationFeatureBase::mouseReleased
-    PartSet_OperationFeatureBase::mouseReleased(theEvent, theView, theSelected, theHighlighted);
-  } else {
-    blockSelection(false);
-  }
+    PartSet_OperationFeatureBase::mouseReleased(theEvent, theViewer, theSelection);
+  }// else {
+    //blockSelection(false);
+  //}
 }
 
 void PartSet_OperationFeatureEdit::mouseDoubleClick(
     QMouseEvent* theEvent, Handle_V3d_View theView,
-    const std::list<ModuleBase_ViewerPrs>& theSelected,
-    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+    ModuleBase_ISelection* theSelection)
 {
   // TODO the functionality is important only for constraint feature. Should be moved in another place
-  if (!theSelected.empty()) {
-    ModuleBase_ViewerPrs aFeaturePrs = theSelected.front();
+  QList<ModuleBase_ViewerPrs> aSelected = theSelection->getSelected();
+  if (!aSelected.empty()) {
+    ModuleBase_ViewerPrs aFeaturePrs = aSelected.first();
     if (!aFeaturePrs.owner().IsNull()) {
       Handle(AIS_DimensionOwner) anOwner = Handle(AIS_DimensionOwner)::DownCast(
           aFeaturePrs.owner());
@@ -169,36 +192,36 @@ void PartSet_OperationFeatureEdit::mouseDoubleClick(
 void PartSet_OperationFeatureEdit::startOperation()
 {
   PartSet_OperationSketchBase::startOperation();
-  emit multiSelectionEnabled(false);
+  //emit multiSelectionEnabled(false);
 
   myCurPoint.clear();
 }
 
 void PartSet_OperationFeatureEdit::stopOperation()
 {
-  emit multiSelectionEnabled(true);
+  //emit multiSelectionEnabled(true);
 
-  blockSelection(false, false);
+  //blockSelection(false, false);
 }
 
-void PartSet_OperationFeatureEdit::blockSelection(bool isBlocked, const bool isRestoreSelection)
-{
-  if (myIsBlockedSelection == isBlocked)
-    return;
-
-  myIsBlockedSelection = isBlocked;
-  QList<ObjectPtr> aFeatureList;
-  aFeatureList.append(feature());
-
-  if (isBlocked) {
-    emit setSelection(QList<ObjectPtr>());
-    emit stopSelection(aFeatureList, true);
-  } else {
-    emit stopSelection(aFeatureList, false);
-    if (isRestoreSelection)
-      emit setSelection(aFeatureList);
-  }
-}
+//void PartSet_OperationFeatureEdit::blockSelection(bool isBlocked, const bool isRestoreSelection)
+//{
+//  if (myIsBlockedSelection == isBlocked)
+//    return;
+//
+//  myIsBlockedSelection = isBlocked;
+//  QList<ObjectPtr> aFeatureList;
+//  aFeatureList.append(feature());
+//
+//  //if (isBlocked) {
+//  //  emit setSelection(QList<ObjectPtr>());
+//  //  emit stopSelection(aFeatureList, true);
+//  //} else {
+//  //  emit stopSelection(aFeatureList, false);
+//  //  if (isRestoreSelection)
+//  //    emit setSelection(aFeatureList);
+//  //}
+//}
 
 FeaturePtr PartSet_OperationFeatureEdit::createFeature(const bool theFlushMessage,
   CompositeFeaturePtr theCompositeFeature)
index 1b741a56a06b2a2d578d9920cabe5305d03d37b4..293c63d952fd60f68267e7d34dafd04fc3d808bf 100644 (file)
@@ -11,6 +11,7 @@
 #include <QObject>
 
 class QMouseEvent;
+class ModuleBase_ISelection;
 
 /*!
  \class PartSet_OperationFeatureEdit
@@ -75,21 +76,19 @@ Q_OBJECT
   /// \param theView a viewer to have the viewer the eye position
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
-  virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
-                            const std::list<ModuleBase_ViewerPrs>& theSelected,
-                            const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+  virtual void mousePressed(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer, ModuleBase_ISelection* theSelection);
+
   /// Gives the current mouse point in the viewer
   /// \param theEvent the mouse event
   /// \param theView a viewer to have the viewer the eye position
-  virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
+  virtual void mouseMoved(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer);
   /// Gives the current selected objects to be processed by the operation
   /// \param thePoint a point clicked in the viewer
   /// \param theEvent the mouse event
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
-  virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
-                             const std::list<ModuleBase_ViewerPrs>& theSelected,
-                             const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+  virtual void mouseReleased(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer,
+                             ModuleBase_ISelection* theSelection);
 
   /// Processes the mouse double click in the point
   /// \param theEvent the mouse event
@@ -97,8 +96,7 @@ Q_OBJECT
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
   virtual void mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
-                                const std::list<ModuleBase_ViewerPrs>& theSelected,
-                                const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+                                ModuleBase_ISelection* theSelection);
 
  protected:
   /// \brief Virtual method called when operation is started
@@ -123,7 +121,7 @@ Q_OBJECT
   /// the internal operation features are to be selected
   /// \param isBlocked the state whether the operation is blocked or unblocked
   /// \param isRestoreSelection the state whether the selected objects should be reselected
-  void blockSelection(bool isBlocked, const bool isRestoreSelection = true);
+  //void blockSelection(bool isBlocked, const bool isRestoreSelection = true);
 
   /// Sends the features
   void sendFeatures();
index 7be21c613875411547a41c30fd7bcded3f536c6f..4b10858a0bc40ff31371022d816479a616c610e3 100644 (file)
@@ -8,6 +8,8 @@
 
 #include <ModuleBase_OperationDescription.h>
 #include <ModuleBase_ViewerPrs.h>
+#include <ModuleBase_IViewer.h>
+#include <ModuleBase_ISelection.h>
 
 #include <ModelAPI_Events.h>
 
@@ -46,20 +48,17 @@ PartSet_OperationFeatureEditMulti::~PartSet_OperationFeatureEditMulti()
 }
 
 
-bool isContains(const std::list<ModuleBase_ViewerPrs>& theSelected, const ModuleBase_ViewerPrs& thePrs)
+bool isContains(const QList<ModuleBase_ViewerPrs>& theSelected, const ModuleBase_ViewerPrs& thePrs)
 {
-  std::list<ModuleBase_ViewerPrs>::const_iterator anIt;
-  for (anIt = theSelected.cbegin(); anIt != theSelected.cend(); ++anIt) {
-    if ((*anIt).object() == thePrs.object())
+  foreach (ModuleBase_ViewerPrs aPrs, theSelected) {
+    if (aPrs.object() == thePrs.object())
       return true;
   }
   return false;
 }
 
 
-void PartSet_OperationFeatureEditMulti::initSelection(
-    const std::list<ModuleBase_ViewerPrs>& theSelected,
-    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+void PartSet_OperationFeatureEditMulti::initSelection(ModuleBase_ISelection* theSelection)
 {
   //if (!theHighlighted.empty()) {
   //  // if there is highlighted object, we check whether it is in the list of selected objects
@@ -77,18 +76,18 @@ void PartSet_OperationFeatureEditMulti::initSelection(
   //  else
   //    myFeatures = theSelected;
   //} else
-  myFeatures = theSelected;
+  myFeatures = theSelection->getSelected();
+  QList<ModuleBase_ViewerPrs> aHighlighted = theSelection->getHighlighted();
   // add highlighted elements if they are not selected
-  std::list<ModuleBase_ViewerPrs>::const_iterator anIt = theHighlighted.cbegin();
-  for ( ; anIt != theHighlighted.cend(); ++anIt) {
-    if (!isContains(myFeatures, (*anIt)))
-      myFeatures.push_back(*anIt);
+  foreach (ModuleBase_ViewerPrs aPrs, aHighlighted) {
+    if (!isContains(myFeatures, aPrs))
+      myFeatures.append(aPrs);
   }
   // Remove current feature if it is in the list (it will be moved as main feature)
-  std::list<ModuleBase_ViewerPrs>::iterator anEraseIt = myFeatures.begin();
-  for ( ; anEraseIt != myFeatures.end(); ++anEraseIt) {
-    if (ModelAPI_Feature::feature((*anEraseIt).object()) == feature()) {
-      myFeatures.erase(anEraseIt);
+  foreach (ModuleBase_ViewerPrs aPrs, myFeatures) {
+    FeaturePtr aF = ModelAPI_Feature::feature(aPrs.object());
+    if (ModelAPI_Feature::feature(aPrs.object()) == feature()) {
+      myFeatures.removeOne(aPrs);
       break;
     }
   }
@@ -99,27 +98,28 @@ CompositeFeaturePtr PartSet_OperationFeatureEditMulti::sketch() const
   return mySketch;
 }
 
-void PartSet_OperationFeatureEditMulti::mousePressed(
-    QMouseEvent* theEvent, Handle(V3d_View) theView,
-    const std::list<ModuleBase_ViewerPrs>& /*theSelected*/,
-    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
-{
-}
+//void PartSet_OperationFeatureEditMulti::mousePressed(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer, ModuleBase_ISelection* theSelection)
+//{
+//}
 
-void PartSet_OperationFeatureEditMulti::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
+void PartSet_OperationFeatureEditMulti::mouseMoved(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer)
 {
   if (!(theEvent->buttons() & Qt::LeftButton))
     return;
 
-  gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView);
+  if (theViewer->isSelectionEnabled())
+    theViewer->enableSelection(false);
+
+  Handle(V3d_View) aView = theViewer->activeView();
+  gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), aView);
 
-  blockSelection(true);
+  //blockSelection(true);
   if (myCurPoint.myIsInitialized) {
     double aCurX, aCurY;
-    PartSet_Tools::convertTo2D(myCurPoint.myPoint, sketch(), theView, aCurX, aCurY);
+    PartSet_Tools::convertTo2D(myCurPoint.myPoint, sketch(), aView, aCurX, aCurY);
 
     double aX, anY;
-    PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
+    PartSet_Tools::convertTo2D(aPoint, sketch(), aView, aX, anY);
 
     double aDeltaX = aX - aCurX;
     double aDeltaY = anY - aCurY;
@@ -128,10 +128,8 @@ void PartSet_OperationFeatureEditMulti::mouseMoved(QMouseEvent* theEvent, Handle
         SketchPlugin_Feature>(feature());
     aSketchFeature->move(aDeltaX, aDeltaY);
 
-    std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(), 
-      aLast = myFeatures.end();
-    for (; anIt != aLast; anIt++) {
-      ObjectPtr aObject = (*anIt).object();
+    foreach (ModuleBase_ViewerPrs aPrs, myFeatures) {
+      ObjectPtr aObject = aPrs.object();
       if (!aObject || aObject == feature())
         continue;
       FeaturePtr aFeature = ModelAPI_Feature::feature(aObject);
@@ -148,16 +146,13 @@ void PartSet_OperationFeatureEditMulti::mouseMoved(QMouseEvent* theEvent, Handle
 }
 
 void PartSet_OperationFeatureEditMulti::mouseReleased(
-    QMouseEvent* theEvent, Handle(V3d_View) theView,
-    const std::list<ModuleBase_ViewerPrs>& /*theSelected*/,
-    const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
+    QMouseEvent* theEvent, ModuleBase_IViewer* theViewer,
+    ModuleBase_ISelection* theSelection)
 {
+  theViewer->enableSelection(true);
   if (commit()) {
-    std::list<ModuleBase_ViewerPrs> aFeatures = myFeatures;
-    std::list<ModuleBase_ViewerPrs>::const_iterator anIt = aFeatures.begin(), aLast =
-        aFeatures.end();
-    for (; anIt != aLast; anIt++) {
-      ObjectPtr aFeature = (*anIt).object();
+    foreach (ModuleBase_ViewerPrs aPrs, myFeatures) {
+      ObjectPtr aFeature = aPrs.object();
       if (aFeature) {
         emit featureConstructed(aFeature, FM_Deactivation);
       }
@@ -168,54 +163,51 @@ void PartSet_OperationFeatureEditMulti::mouseReleased(
 void PartSet_OperationFeatureEditMulti::startOperation()
 {
   PartSet_OperationSketchBase::startOperation();
-  emit multiSelectionEnabled(false);
+  //emit multiSelectionEnabled(false);
 
-  blockSelection(true);
+  //blockSelection(true);
 
   myCurPoint.clear();
 }
 
 void PartSet_OperationFeatureEditMulti::stopOperation()
 {
-  emit multiSelectionEnabled(true);
+  //emit multiSelectionEnabled(true);
 
-  blockSelection(false, true);
+  //blockSelection(false, true);
 
   myFeatures.clear();
 }
 
-void PartSet_OperationFeatureEditMulti::blockSelection(bool isBlocked,
-                                                       const bool isRestoreSelection)
-{
-  if (myIsBlockedSelection == isBlocked)
-    return;
-
-  myIsBlockedSelection = isBlocked;
-  QList<ObjectPtr> aFeatureList;
-  std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast =
-      myFeatures.end();
-  /*for(; anIt != aLast; anIt++)
-   aFeatureList.append((*anIt).feature());*/
-  if (isBlocked) {
-    emit setSelection(QList<ObjectPtr>());
-    emit stopSelection(aFeatureList, true);
-  } else {
-    emit stopSelection(aFeatureList, false);
-    if (isRestoreSelection) {
-      emit setSelection(aFeatureList);
-    }
-  }
-}
+//void PartSet_OperationFeatureEditMulti::blockSelection(bool isBlocked,
+//                                                       const bool isRestoreSelection)
+//{
+//  if (myIsBlockedSelection == isBlocked)
+//    return;
+//
+//  myIsBlockedSelection = isBlocked;
+//  QList<ObjectPtr> aFeatureList;
+////  std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast =
+////      myFeatures.end();
+//  /*for(; anIt != aLast; anIt++)
+//   aFeatureList.append((*anIt).feature());*/
+//  //if (isBlocked) {
+//  //  emit setSelection(QList<ObjectPtr>());
+//  //  emit stopSelection(aFeatureList, true);
+//  //} else {
+//  //  emit stopSelection(aFeatureList, false);
+//  //  if (isRestoreSelection) {
+//  //    emit setSelection(aFeatureList);
+//  //  }
+//  //}
+//}
 
 void PartSet_OperationFeatureEditMulti::sendFeatures()
 {
   static Events_ID anEvent = Events_Loop::eventByName(EVENT_OBJECT_MOVED);
 
-  std::list<FeaturePtr> aFeatures;
-  std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast =
-      myFeatures.end();
-  for (; anIt != aLast; anIt++) {
-    ObjectPtr aFeature = (*anIt).object();
+  foreach (ModuleBase_ViewerPrs aPrs, myFeatures) {
+    ObjectPtr aFeature = aPrs.object();
     if (!aFeature)
       continue;
 
index 1008f3deb34b39173b6bb64b1da76675fe8ae9ea..77a9dbb5408916e6bc38c7300a677213d99f7801 100644 (file)
@@ -9,6 +9,7 @@
 
 #include <PartSet_OperationSketchBase.h>
 #include <QObject>
+#include <QList>
 
 #include <list>
 
@@ -75,8 +76,7 @@ Q_OBJECT
   /// Initialisation of operation with preliminary selection
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
-  virtual void initSelection(const std::list<ModuleBase_ViewerPrs>& theSelected,
-                             const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+  virtual void initSelection(ModuleBase_ISelection* theSelection);
 
   /// Returns the operation sketch feature
   /// \returns the sketch instance
@@ -87,21 +87,21 @@ Q_OBJECT
   /// \param theView a viewer to have the viewer the eye position
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
-  virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
-                            const std::list<ModuleBase_ViewerPrs>& theSelected,
-                            const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+  //virtual void mousePressed(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer, ModuleBase_ISelection* theSelection);
+
   /// Gives the current mouse point in the viewer
   /// \param theEvent the mouse event
   /// \param theView a viewer to have the viewer the eye position
-  virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
+  virtual void mouseMoved(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer);
+
   /// Gives the current selected objects to be processed by the operation
   /// \param thePoint a point clicked in the viewer
   /// \param theEvent the mouse event
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
-  virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
-                             const std::list<ModuleBase_ViewerPrs>& theSelected,
-                             const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+  virtual void mouseReleased(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer, 
+                             ModuleBase_ISelection* theSelection);
+
  protected:
   /// \brief Virtual method called when operation is started
   /// Virtual method called when operation started (see start() method for more description)
@@ -118,14 +118,14 @@ Q_OBJECT
   /// the internal operation features are to be selected
   /// \param isBlocked the state whether the operation is blocked or unblocked
   /// \param isRestoreSelection the state whether the selected objects should be reselected
-  void blockSelection(bool isBlocked, const bool isRestoreSelection = true);
+  //void blockSelection(bool isBlocked, const bool isRestoreSelection = true);
 
   /// Sends the features
   void sendFeatures();
 
  private:
   CompositeFeaturePtr mySketch;  ///< the sketch feature
-  std::list<ModuleBase_ViewerPrs> myFeatures;  ///< the features to apply the edit operation
+  QList<ModuleBase_ViewerPrs> myFeatures;  ///< the features to apply the edit operation
   Point myCurPoint;  ///< the current 3D point clicked or moved
   bool myIsBlockedSelection;  ///< the state of the last state of selection blocked signal
 };
index 6deab5b2801ddc8ff68401fefd96e418e62be863..331f7e63e24b2ea1b26a17e99d3870b7bf353cfc 100644 (file)
@@ -22,6 +22,8 @@
 #include <GeomAPI_XYZ.h>
 
 #include <ModuleBase_ViewerPrs.h>
+#include <ModuleBase_ISelection.h>
+#include <ModuleBase_IViewer.h>
 #include <Events_Loop.h>
 
 #include <AIS_Shape.hxx>
@@ -53,49 +55,63 @@ CompositeFeaturePtr PartSet_OperationSketch::sketch() const
   return boost::dynamic_pointer_cast<ModelAPI_CompositeFeature>(feature());
 }
 
-void PartSet_OperationSketch::mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
-                                           const std::list<ModuleBase_ViewerPrs>& theSelected,
-                                           const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+void PartSet_OperationSketch::mousePressed(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer, ModuleBase_ISelection* theSelection)
 {
   if (hasSketchPlane()) {
     // if shift button is pressed and there are some already selected objects, the operation should
     // not be started. We just want to combine some selected objects.
     bool aHasShift = (theEvent->modifiers() & Qt::ShiftModifier);
-    if (aHasShift && theSelected.size() > 0)
-      return;
-
-    if (theHighlighted.size() == 1) {
-      ObjectPtr aFeature = theHighlighted.front().object();
+    QList<ModuleBase_ViewerPrs> aSelected = theSelection->getSelected();
+    QList<ModuleBase_ViewerPrs> aHighlighted = theSelection->getHighlighted();
+    //if (aHasShift && (aSelected.size() > 0)) {
+      foreach(ModuleBase_ViewerPrs aPrs, aHighlighted)
+        aSelected.append(aPrs);
+    //}
+    //if (aHasShift && aSelected.size() > 0)
+    //  return;
+
+    if (aSelected.size() > 0) {
+      ObjectPtr aFeature = aSelected.first().object();
       if (aFeature) {
         std::string anOperationType =
-            (theSelected.size() > 1) ?
+            (aSelected.size() > 1) ?
                 PartSet_OperationFeatureEditMulti::Type() : PartSet_OperationFeatureEdit::Type();
         restartOperation(anOperationType, aFeature);
       }
-    } else
-      myFeatures = theHighlighted;
-
-  } else {
-    if (!theHighlighted.empty()) {
-      ModuleBase_ViewerPrs aPrs = theHighlighted.front();
-      const TopoDS_Shape& aShape = aPrs.shape();
-      if (!aShape.IsNull())
-        setSketchPlane(aShape);
-    }
+    } //else
+    //myFeatures = aSelected;
+
+  } 
+}
+
+
+void PartSet_OperationSketch::selectionChanged(ModuleBase_ISelection* theSelection)
+{
+  if (hasSketchPlane()) 
+    return;
+
+  QList<ModuleBase_ViewerPrs> aSelected = theSelection->getSelected();
+  if (!aSelected.empty()) {
+    ModuleBase_ViewerPrs aPrs = aSelected.first();
+    // We have to select a plane before any operation
+    const TopoDS_Shape& aShape = aPrs.shape();
+    if (!aShape.IsNull())
+      setSketchPlane(aShape);
   }
 }
 
-void PartSet_OperationSketch::mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
-                                            const std::list<ModuleBase_ViewerPrs>& theSelected,
-                                            const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+
+void PartSet_OperationSketch::mouseReleased(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer,
+                                            ModuleBase_ISelection* theSelection)
 {
+  QList<ModuleBase_ViewerPrs> aSelected = theSelection->getSelected();
   if (hasSketchPlane()) {
     /// TODO: OCC bug: 25034 - the highlighted list should be filled not only for AIS_Shape
     /// but for other IO, for example constraint dimensions.
     /// It is empty and we have to use the process mouse release to start edition operation
     /// for these objects
-    if (theSelected.size() == 1) {
-      ObjectPtr aObject = theSelected.front().object();
+    if (aSelected.size() == 1) {
+      ObjectPtr aObject = aSelected.first().object();
       if (aObject) {
         restartOperation(PartSet_OperationFeatureEdit::Type(), aObject);
       }
@@ -103,13 +119,14 @@ void PartSet_OperationSketch::mouseReleased(QMouseEvent* theEvent, Handle_V3d_Vi
   }
 }
 
-void PartSet_OperationSketch::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
+void PartSet_OperationSketch::mouseMoved(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer)
 {
   if (!hasSketchPlane() || !(theEvent->buttons() & Qt::LeftButton) || myFeatures.empty())
     return;
 
   if (myFeatures.size() != 1) {
-    FeaturePtr aFeature = PartSet_Tools::nearestFeature(theEvent->pos(), theView, feature(),
+    Handle(V3d_View) aView = theViewer->activeView();
+    FeaturePtr aFeature = PartSet_Tools::nearestFeature(theEvent->pos(), aView, feature(),
                                                         myFeatures);
     if (aFeature)
       restartOperation(PartSet_OperationFeatureEditMulti::Type(), aFeature);
index d3ede8b3d0aec290ccf814e72e9da2674092557c..47601096f7b1af293facbb3c9fd3e2daf98aeb70 100644 (file)
@@ -12,6 +12,7 @@
 #include <SketchPlugin_Sketch.h>
 
 #include <QObject>
+#include <QList>
 
 class Handle_AIS_InteractiveObject;
 
@@ -50,22 +51,20 @@ Q_OBJECT
   /// \param theView a viewer to have the viewer the eye position
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
-  virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
-                            const std::list<ModuleBase_ViewerPrs>& theSelected,
-                            const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+  virtual void mousePressed(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer, ModuleBase_ISelection* theSelection);
+
   /// Processes the mouse release in the point
   /// \param theEvent the mouse event
   /// \param theView a viewer to have the viewer the eye position
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
-  virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
-                             const std::list<ModuleBase_ViewerPrs>& theSelected,
-                             const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+  virtual void mouseReleased(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer,
+                             ModuleBase_ISelection* theSelection);
 
   /// Gives the current mouse point in the viewer
   /// \param thePoint a point clicked in the viewer
   /// \param theEvent the mouse event
-  virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
+  virtual void mouseMoved(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer);
 
   /// Returns the list of the nested features
   /// \return the list of subfeatures
@@ -88,6 +87,9 @@ Q_OBJECT
   /// Set the plane to the current sketch
   /// \param theShape the shape
   void setSketchPlane(const TopoDS_Shape& theShape);
+  
+  /// Called on selection changed when the operation is active
+  virtual void selectionChanged(ModuleBase_ISelection* theSelection);
 
   /// If operation needs to redisplay its result during operation
   /// then this method has to return True
@@ -111,7 +113,7 @@ signals:
   virtual void afterCommitOperation();
 
  private:
-  std::list<ModuleBase_ViewerPrs> myFeatures;  ///< the features to apply the edit operation
+  QList<ModuleBase_ViewerPrs> myFeatures;  ///< the features to apply the edit operation
 };
 
 #endif
index d8cd8ec7e860324884ff529f4daa330cc5282783..1f7550403123cabec03ac0a7ad79dacf3d6a482b 100644 (file)
@@ -7,6 +7,7 @@
 #include <ModelAPI_ResultBody.h>
 
 #include <ModuleBase_IPropertyPanel.h>
+#include <ModuleBase_IViewer.h>
 #include <ModuleBase_ModelWidget.h>
 #include <ModuleBase_WidgetValueFeature.h>
 
@@ -60,25 +61,24 @@ FeaturePtr PartSet_OperationSketchBase::createFeature(const bool theFlushMessage
   return myFeature;
 }
 
-void PartSet_OperationSketchBase::mousePressed(
-    QMouseEvent* theEvent, Handle_V3d_View theView,
-    const std::list<ModuleBase_ViewerPrs>& theSelected,
-    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+void PartSet_OperationSketchBase::mousePressed(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer, ModuleBase_ISelection* theSelection)
 {
 }
 void PartSet_OperationSketchBase::mouseReleased(
-    QMouseEvent* theEvent, Handle_V3d_View theView,
-    const std::list<ModuleBase_ViewerPrs>& theSelected,
-    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+    QMouseEvent* theEvent, ModuleBase_IViewer* theViewer,
+    ModuleBase_ISelection* theSelection)
 {
 }
-void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
+void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer)
 {
 }
 void PartSet_OperationSketchBase::mouseDoubleClick(
     QMouseEvent* theEvent, Handle_V3d_View theView,
-    const std::list<ModuleBase_ViewerPrs>& theSelected,
-    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
+    ModuleBase_ISelection* theSelection)
+{
+}
+
+void PartSet_OperationSketchBase::selectionChanged(ModuleBase_ISelection* theSelection)
 {
 }
 
@@ -96,26 +96,3 @@ void PartSet_OperationSketchBase::restartOperation(const std::string& theType, O
 }
 
 
-
-void PartSet_OperationSketchBase::activateByPreselection()
-{
-  if (!myPropertyPanel)
-    return;
-  ModuleBase_ModelWidget* aActiveWgt = myPropertyPanel->activeWidget();
-  if ((myPreSelection.size() > 0) && aActiveWgt) {
-    const ModuleBase_ViewerPrs& aPrs = myPreSelection.front();
-    ModuleBase_WidgetValueFeature aValue;
-    aValue.setObject(aPrs.object());
-    if (aActiveWgt->setValue(&aValue)) {
-      myPreSelection.remove(aPrs);
-      if(isValid()) {
-        //myActiveWidget = NULL;
-        commit();
-      } else {
-        myPropertyPanel->activateNextWidget();
-        //emit activateNextWidget(myActiveWidget);
-      }
-    }
-    // If preselection is enough to make a valid feature - apply it immediately
-  }
-}
index c7d639348f858daae620f6403558e1f81e3f17a6..ef3991a9a1710c0557e48c23b3f22d77d44c7830 100644 (file)
@@ -27,6 +27,8 @@ class Handle_V3d_View;
 class QMouseEvent;
 class GeomAPI_Shape;
 class ModuleBase_ViewerPrs;
+class ModuleBase_ISelection;
+class ModuleBase_IViewer;
 
 /*!
  \class PartSet_OperationSketchBase
@@ -69,23 +71,20 @@ Q_OBJECT
   /// \param theView a viewer to have the viewer the eye position
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
-  virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
-                            const std::list<ModuleBase_ViewerPrs>& theSelected,
-                            const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+  virtual void mousePressed(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer, ModuleBase_ISelection* theSelection);
 
   /// Processes the mouse release in the point
   /// \param theEvent the mouse event
   /// \param theView a viewer to have the viewer the eye position
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
-  virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
-                             const std::list<ModuleBase_ViewerPrs>& theSelected,
-                             const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+  virtual void mouseReleased(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer,
+                             ModuleBase_ISelection* theSelection);
 
   /// Processes the mouse move in the point
   /// \param theEvent the mouse event
   /// \param theView a viewer to have the viewer the eye position
-  virtual void mouseMoved(QMouseEvent* theEvent, Handle_V3d_View theView);
+  virtual void mouseMoved(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer);
 
   /// Processes the mouse double click in the point
   /// \param theEvent the mouse event
@@ -93,8 +92,11 @@ Q_OBJECT
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
   virtual void mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
-                                const std::list<ModuleBase_ViewerPrs>& theSelected,
-                                const std::list<ModuleBase_ViewerPrs>& theHighlighted);
+                                ModuleBase_ISelection* theSelection);
+
+  
+  /// Called on selection changed when the operation is active
+  virtual void selectionChanged(ModuleBase_ISelection* theSelection);
 
   /// Emits a signal about the operation start. This signal has an information about the feature.
   /// If the provided feature is empty, the current operation feature is used.
@@ -123,7 +125,7 @@ signals:
 
   /// signal to enable/disable multi selection in the viewer
   /// \param theEnabled the boolean state
-  void multiSelectionEnabled(bool theEnabled);
+  //void multiSelectionEnabled(bool theEnabled);
 
   /// signal to enable/disable selection in the viewer
   /// \param theFeatures a list of features to be disabled
@@ -141,9 +143,6 @@ signals:
   /// \param theFlushMessage the flag whether the create message should be flushed
   /// \returns the created feature
   virtual FeaturePtr createFeature(const bool theFlushMessage = true);
-
-  /// Activates widgets by preselection if it is accepted
-  virtual void activateByPreselection();
 };
 
 #endif
index 892f610a0d36e43ebc4511f884184f9c97cc98bb..dc4feb845df6099a441ecbec50a169b55709155c 100644 (file)
@@ -8,6 +8,7 @@
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeRefList.h>
 #include <ModelAPI_Document.h>
+#include <ModelAPI_Session.h>
 
 #include <GeomDataAPI_Point.h>
 #include <GeomDataAPI_Dir.h>
@@ -139,21 +140,17 @@ void PartSet_Tools::convertTo3D(const double theX, const double theY, FeaturePtr
 
 FeaturePtr PartSet_Tools::nearestFeature(QPoint thePoint, Handle_V3d_View theView,
                                          FeaturePtr theSketch,
-                                         const std::list<ModuleBase_ViewerPrs>& theFeatures)
+                                         const QList<ModuleBase_ViewerPrs>& theFeatures)
 {
   double aX, anY;
   gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(thePoint, theView);
   PartSet_Tools::convertTo2D(aPoint, theSketch, theView, aX, anY);
 
   FeaturePtr aFeature;
-  std::list<ModuleBase_ViewerPrs>::const_iterator anIt = theFeatures.begin(), aLast = theFeatures
-      .end();
-
   FeaturePtr aDeltaFeature;
   double aMinDelta = -1;
   ModuleBase_ViewerPrs aPrs;
-  for (; anIt != aLast; anIt++) {
-    aPrs = *anIt;
+  foreach (ModuleBase_ViewerPrs aPrs, theFeatures) {
     if (!aPrs.object())
       continue;
     boost::shared_ptr<SketchPlugin_Feature> aSketchFeature = boost::dynamic_pointer_cast<
index 160814747f5184035d4814a27d8a85688519e865..872102d8b6d9022e9beea3a9cada4c2105cf5de3 100644 (file)
 #include <gp_Pnt.hxx>
 
 #include <QPoint>
+#include <QList>
 
 #include <ModelAPI_CompositeFeature.h>
 
 #include <boost/shared_ptr.hpp>
 
-#include <list>
-
 class Handle_V3d_View;
 class ModuleBase_ViewerPrs;
 class GeomDataAPI_Point2D;
@@ -59,7 +58,7 @@ class PARTSET_EXPORT PartSet_Tools
   /// \param theSketch the sketch feature
   /// \param theFeatures the list of selected presentations
   static FeaturePtr nearestFeature(QPoint thePoint, Handle_V3d_View theView, FeaturePtr theSketch,
-                                   const std::list<ModuleBase_ViewerPrs>& theFeatures);
+                                   const QList<ModuleBase_ViewerPrs>& theFeatures);
 
   /// Returns pointer to the root document.
   static boost::shared_ptr<ModelAPI_Document> document();
index d464e85ab1534fec6c88e9e2434f31ecb3e1990c..7a976bda33749c371cf392ef0478f5217e0edfc6 100644 (file)
@@ -9,17 +9,15 @@
 #include <BRep_Tool.hxx>
 #include <GeomAdaptor_Curve.hxx>
 #include <GeomAbs_CurveType.hxx>
+#include <ModuleBase_ISelection.h>
 
 #include <list>
 
 int shapesNbPoints(const ModuleBase_ISelection* theSelection)
 {
-  std::list<ModuleBase_ViewerPrs> aList = theSelection->getSelected();
-  std::list<ModuleBase_ViewerPrs>::iterator it;
-  ModuleBase_ViewerPrs aPrs;
+  QList<ModuleBase_ViewerPrs> aList = theSelection->getSelected();  
   int aCount = 0;
-  for (it = aList.begin(); it != aList.end(); ++it) {
-    aPrs = *it;
+  foreach (ModuleBase_ViewerPrs aPrs, aList) {
     const TopoDS_Shape& aShape = aPrs.shape();
     if (!aShape.IsNull()) {
       if (aShape.ShapeType() == TopAbs_VERTEX)
@@ -31,12 +29,9 @@ int shapesNbPoints(const ModuleBase_ISelection* theSelection)
 
 int shapesNbLines(const ModuleBase_ISelection* theSelection)
 {
-  std::list<ModuleBase_ViewerPrs> aList = theSelection->getSelected();
-  std::list<ModuleBase_ViewerPrs>::iterator it;
-  ModuleBase_ViewerPrs aPrs;
+  QList<ModuleBase_ViewerPrs> aList = theSelection->getSelected();
   int aCount = 0;
-  for (it = aList.begin(); it != aList.end(); ++it) {
-    aPrs = *it;
+  foreach(ModuleBase_ViewerPrs aPrs, aList) {
     const TopoDS_Shape& aShape = aPrs.shape();
     if (!aShape.IsNull()) {
       if (aShape.ShapeType() == TopAbs_EDGE) {
@@ -78,12 +73,10 @@ bool PartSet_ParallelValidator::isValid(const ModuleBase_ISelection* theSelectio
 
 bool PartSet_RadiusValidator::isValid(const ModuleBase_ISelection* theSelection) const
 {
-  std::list<ModuleBase_ViewerPrs> aList = theSelection->getSelected();
-  std::list<ModuleBase_ViewerPrs>::iterator it;
+  QList<ModuleBase_ViewerPrs> aList = theSelection->getSelected();
   ModuleBase_ViewerPrs aPrs;
   int aCount = 0;
-  for (it = aList.begin(); it != aList.end(); ++it) {
-    aPrs = *it;
+  foreach (ModuleBase_ViewerPrs aPrs, aList) {
     const TopoDS_Shape& aShape = aPrs.shape();
     if (!aShape.IsNull()) {
       if (aShape.ShapeType() == TopAbs_EDGE) {
index a2f006fa42880133ca20e36835d2a5f534517cf3..8c6e8cc0ae117285373734155090805ffa58069d 100644 (file)
@@ -8,6 +8,7 @@
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Document.h>
 #include <ModelAPI_ResultPart.h>
+#include <ModelAPI_Session.h>
 
 using namespace std;
 
index 5494949d8337448b660da84d563b46943b42ff1a..d459d9753a76aa8e4bb3176279b186e2c7f3e4ac 100644 (file)
@@ -8,6 +8,7 @@
 #include <ModelAPI_Data.h>
 #include <ModelAPI_AttributeDocRef.h>
 #include <ModelAPI_ResultPart.h>
+#include <ModelAPI_Session.h>
 
 void PartSetPlugin_Remove::execute()
 {
index ec9d227deec81d97d63e91b2eec985cee2d73a7b..ae0b225ecb25e93cf741d734f4555bffa62c44ee 100644 (file)
@@ -8,6 +8,7 @@
 #include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_AttributeSelection.h>
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_Session.h>
 
 #include <GeomAPI_Circ2d.h>
 #include <GeomAPI_Pnt2d.h>
index 4828a0f7b91a7b247e6e833caa30d6abaf493664..e4d9d8e94411e5185246105a54ee92cf61a1a975 100644 (file)
@@ -8,6 +8,8 @@
 #include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_AttributeSelection.h>
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_AttributeDouble.h>
+#include <ModelAPI_Session.h>
 
 #include <GeomAPI_Pnt2d.h>
 #include <GeomDataAPI_Point2D.h>
@@ -15,7 +17,6 @@
 #include <GeomAlgoAPI_PointBuilder.h>
 #include <GeomAlgoAPI_EdgeBuilder.h>
 #include <GeomAlgoAPI_CompoundBuilder.h>
-#include <ModelAPI_AttributeDouble.h>
 
 SketchPlugin_Circle::SketchPlugin_Circle()
     : SketchPlugin_Feature()
index 72a20f8618db061541c325f0ca7162a8f8d992ff..ccefb4bec3aba9a144313b2a8842b55e11629a54 100644 (file)
@@ -8,6 +8,7 @@
 #include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_AttributeSelection.h>
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_Session.h>
 
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_Lin2d.h>
index c198e9b90fd22c44e7c066ea30ee88a022aa2df1..1ad78684f8ab806ea8676054956b1083aac3aa47 100644 (file)
@@ -9,6 +9,7 @@
 #include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_AttributeSelection.h>
 #include <ModelAPI_Validator.h>
+#include <ModelAPI_Session.h>
 
 #include <GeomAPI_Pnt2d.h>
 
index a66bd9ffb1b6a3040a79c005147862739e5db233..5429b2b605668573097dbc9bd76ff09713971433 100644 (file)
@@ -131,6 +131,25 @@ int SketchPlugin_Sketch::subFeatureId(const int theIndex) const
   return subFeature(theIndex)->data()->featureId();
 }
 
+bool SketchPlugin_Sketch::isSub(ObjectPtr theObject) const
+{
+  // check is this feature of result
+  FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
+  if (!aFeature) {
+    ResultPtr aRes = boost::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+    if (aRes)
+      aFeature = document()->feature(aRes);
+  }
+  if (aFeature) {
+    list<ObjectPtr> aSubs = data()->reflist(SketchPlugin_Sketch::FEATURES_ID())->list();
+    for(list<ObjectPtr>::iterator aSubIt = aSubs.begin(); aSubIt != aSubs.end(); aSubIt++) {
+      if (*aSubIt == aFeature)
+        return true;
+    }
+  }
+  return false;
+}
+
 boost::shared_ptr<GeomAPI_Pnt> SketchPlugin_Sketch::to3D(const double theX, const double theY)
 {
   boost::shared_ptr<GeomDataAPI_Point> aC = boost::dynamic_pointer_cast<GeomDataAPI_Point>(
index 79b478f7cb1df43f693d667e37760ffb293de962..23147d97f612f11077809ff5b8b773ad7d7f2690 100644 (file)
@@ -126,6 +126,9 @@ class SketchPlugin_Sketch : public ModelAPI_CompositeFeature, public GeomAPI_IPr
   /// Returns the sub-feature unique identifier in this composite feature by zero-base index
   SKETCHPLUGIN_EXPORT virtual int subFeatureId(const int theIndex) const;
 
+  /// Returns true if feature or reuslt belong to this composite feature as subs
+  SKETCHPLUGIN_EXPORT virtual bool isSub(ObjectPtr theObject) const;
+
   /// Construction result is allways recomuted on the fly
   SKETCHPLUGIN_EXPORT virtual bool isPersistentResult() {return false;}
 
index 555f0abfeb50e3e2c0b05225e91e83e658fa2b93..b71d5adbd69b29d7baf6f03b3c0e9e924ebe2fc9 100644 (file)
@@ -9,6 +9,7 @@
 #include <ModelAPI_ResultValidator.h>
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeRefAttr.h>
+#include <ModelAPI_Session.h>
 #include <GeomDataAPI_Point2D.h>
 
 bool SketchPlugin_DistanceAttrValidator::isValid(const FeaturePtr& theFeature,
index da616ce62143c5b0bba43d69ce88657b0b1d66e7..dedb420a5d7d41bc0b34474d21a33d4e16c1381f 100644 (file)
@@ -22,7 +22,7 @@ from ModelAPI import *
 # Initialization of the test
 #=========================================================================
 
-__updated__ = "2014-07-28"
+__updated__ = "2014-10-28"
 
 aSession = ModelAPI_Session.get()
 aDocument = aSession.moduleDocument()
@@ -31,37 +31,34 @@ aDocument = aSession.moduleDocument()
 #=========================================================================
 aSession.startOperation()
 aSketchFeature = aDocument.addFeature("Sketch")
-aSketchFeatureData = aSketchFeature.data()
-origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin"))
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
-dirx = geomDataAPI_Dir(aSketchFeatureData.attribute("DirX"))
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeatureData.attribute("DirY"))
+diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
 diry.setValue(0, 1, 0)
-norm = geomDataAPI_Dir(aSketchFeatureData.attribute("Norm"))
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
 #=========================================================================
 # Create a line and an arc
 #=========================================================================
 aSession.startOperation()
-aSketchReflist = aSketchFeatureData.reflist("Features")
+aSketchReflist = aSketchFeature.reflist("Features")
 aSketchArc = aDocument.addFeature("SketchArc")
 aSketchReflist.append(aSketchArc)
-aSketchArcData = aSketchArc.data()
-anArcCentr = geomDataAPI_Point2D(aSketchArcData.attribute("ArcCenter"))
+anArcCentr = geomDataAPI_Point2D(aSketchArc.attribute("ArcCenter"))
 anArcStartPoint = geomDataAPI_Point2D(
-    aSketchArcData.attribute("ArcStartPoint"))
-anArcEndPoint = geomDataAPI_Point2D(aSketchArcData.attribute("ArcEndPoint"))
+    aSketchArc.attribute("ArcStartPoint"))
+anArcEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("ArcEndPoint"))
 aSketchFeature = aDocument.addFeature("SketchConstraintCoincidence")
 anArcCentr.setValue(10., 10.)
 anArcStartPoint.setValue(0., 50.)
 anArcEndPoint.setValue(50., 0.)
 aSketchLine = aDocument.addFeature("SketchLine")
 aSketchReflist.append(aSketchLine)
-aSketchLineData = aSketchLine.data()
-aLineStartPoint = geomDataAPI_Point2D(aSketchLineData.attribute("StartPoint"))
-aLineEndPoint = geomDataAPI_Point2D(aSketchLineData.attribute("EndPoint"))
+aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint"))
+aLineEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint"))
 # Lets initialize line start at circle's end:
 aLineStartPoint.setValue(50., 0.)
 aLineEndPoint.setValue(100., 25.)
@@ -72,9 +69,8 @@ aSession.finishOperation()
 aSession.startOperation()
 aConstraint = aDocument.addFeature("SketchConstraintCoincidence")
 aSketchReflist.append(aConstraint)
-aConstraintData = aConstraint.data()
-reflistA = aConstraintData.refattr("ConstraintEntityA")
-reflistB = aConstraintData.refattr("ConstraintEntityB")
+reflistA = aConstraint.refattr("ConstraintEntityA")
+reflistB = aConstraint.refattr("ConstraintEntityB")
 reflistA.setAttr(anArcEndPoint)
 reflistB.setAttr(aLineStartPoint)
 aSession.finishOperation()
index 2d84321be0cf622a7f9d2b150233ed27e99138de..4c50263b2e1baf1ee85da7b24d4deffc29d85aee 100644 (file)
@@ -26,7 +26,7 @@ import math
 # Initialization of the test
 #=========================================================================
 
-__updated__ = "2014-07-29"
+__updated__ = "2014-10-28"
 
 
 def distance(pointA, pointB):
@@ -44,33 +44,28 @@ aDocument = aSession.moduleDocument()
 # Creation of a sketch
 #=========================================================================
 aSession.startOperation()
-aSketchFeature = aDocument.addFeature("Sketch")
-aSketchFeatureData = aSketchFeature.data()
-origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin"))
+aSketchCommonFeature = aDocument.addFeature("Sketch")
+aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
-dirx = geomDataAPI_Dir(aSketchFeatureData.attribute("DirX"))
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeatureData.attribute("DirY"))
+diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
 diry.setValue(0, 1, 0)
-norm = geomDataAPI_Dir(aSketchFeatureData.attribute("Norm"))
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
 #=========================================================================
 # Create a point and a line
 #=========================================================================
 aSession.startOperation()
-aSketchReflist = aSketchFeatureData.reflist("Features")
-aSketchPoint = aDocument.addFeature("SketchPoint")
-aSketchReflist.append(aSketchPoint)
-aSketchPointData = aSketchPoint.data()
+aSketchPoint = aSketchFeature.addFeature("SketchPoint")
 aSketchPointCoords = geomDataAPI_Point2D(
-    aSketchPointData.attribute("PointCoordindates"))
+    aSketchPoint.attribute("PointCoordindates"))
 aSketchPointCoords.setValue(50., 50.)
-aSketchLine = aDocument.addFeature("SketchLine")
-aSketchReflist.append(aSketchLine)
-aLineAStartPoint = geomDataAPI_Point2D(
-    aSketchLine.data().attribute("StartPoint"))
-aLineAEndPoint = geomDataAPI_Point2D(aSketchLine.data().attribute("EndPoint"))
+aSketchLine = aSketchFeature.addFeature("SketchLine")
+aLineAStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint"))
+aLineAEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint"))
 aLineAStartPoint.setValue(0., 25.)
 aLineAEndPoint.setValue(100., 25.)
 aSession.finishOperation()
@@ -79,12 +74,10 @@ aSession.finishOperation()
 #=========================================================================
 assert (distance(aSketchPointCoords, aLineAStartPoint) != 25.)
 aSession.startOperation()
-aConstraint = aDocument.addFeature("SketchConstraintDistance")
-aSketchReflist.append(aConstraint)
-aConstraintData = aConstraint.data()
-aDistance = aConstraintData.real("ConstraintValue")
-refattrA = aConstraintData.refattr("ConstraintEntityA")
-refattrB = aConstraintData.refattr("ConstraintEntityB")
+aConstraint = aSketchFeature.addFeature("SketchConstraintDistance")
+aDistance = aConstraint.real("ConstraintValue")
+refattrA = aConstraint.refattr("ConstraintEntityA")
+refattrB = aConstraint.refattr("ConstraintEntityB")
 assert (not aDistance.isInitialized())
 assert (not refattrA.isInitialized())
 assert (not refattrB.isInitialized())
index 28f032e4ad309da415c1e6b4fd1ed1e5e25530cc..48acf2c6b612bc12b12749f1bd089b5c8025f7ca 100644 (file)
@@ -15,7 +15,7 @@ from ModelAPI import *
 # Initialization of the test
 #=========================================================================
 
-__updated__ = "2014-09-26"
+__updated__ = "2014-10-28"
 
 aSession = ModelAPI_Session.get()
 aDocument = aSession.moduleDocument()
@@ -23,27 +23,24 @@ aDocument = aSession.moduleDocument()
 # Creation of a sketch
 #=========================================================================
 aSession.startOperation()
-aSketchFeature = aDocument.addFeature("Sketch")
-aSketchFeatureData = aSketchFeature.data()
-origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin"))
+aSketchCommonFeature = aDocument.addFeature("Sketch")
+aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
-dirx = geomDataAPI_Dir(aSketchFeatureData.attribute("DirX"))
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeatureData.attribute("DirY"))
+diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
 diry.setValue(0, 1, 0)
-norm = geomDataAPI_Dir(aSketchFeatureData.attribute("Norm"))
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
 #=========================================================================
 # Create a line with length 100
 #=========================================================================
 aSession.startOperation()
-aSketchReflist = aSketchFeatureData.reflist("Features")
-aSketchLineA = aDocument.addFeature("SketchLine")
-aSketchReflist.append(aSketchLineA)
-aLineAStartPoint = geomDataAPI_Point2D(
-    aSketchLineA.data().attribute("StartPoint"))
-aLineAEndPoint = geomDataAPI_Point2D(aSketchLineA.data().attribute("EndPoint"))
+aSketchLineA = aSketchFeature.addFeature("SketchLine")
+aLineAStartPoint = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint"))
+aLineAEndPoint = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint"))
 aLineAStartPoint.setValue(0., 25.)
 aLineAEndPoint.setValue(100., 25.)
 aSession.finishOperation()
@@ -51,11 +48,9 @@ aSession.finishOperation()
 # Make a constraint to keep the length
 #=========================================================================
 aSession.startOperation()
-aLengthConstraint = aDocument.addFeature("SketchConstraintLength")
-aSketchReflist.append(aLengthConstraint)
-aConstraintData = aLengthConstraint.data()
-refattrA = aConstraintData.refattr("ConstraintEntityA")
-aLength = aConstraintData.real("ConstraintValue")
+aLengthConstraint = aSketchFeature.addFeature("SketchConstraintLength")
+refattrA = aLengthConstraint.refattr("ConstraintEntityA")
+aLength = aLengthConstraint.real("ConstraintValue")
 assert (not refattrA.isInitialized())
 assert (not aLength.isInitialized())
 
index aa244cee7ab3d08a016b464dbf6cf6a4068d130d..18fbc6832dfbec36bc441442cdab8e6ff41163d4 100644 (file)
@@ -15,7 +15,7 @@ from ModelAPI import *
 # Initialization of the test
 #=========================================================================
 
-__updated__ = "2014-09-26"
+__updated__ = "2014-10-28"
 
 aSession = ModelAPI_Session.get()
 aDocument = aSession.moduleDocument()
@@ -23,38 +23,31 @@ aDocument = aSession.moduleDocument()
 # Creation of a sketch
 #=========================================================================
 aSession.startOperation()
-aSketchFeature = aDocument.addFeature("Sketch")
-aSketchFeatureData = aSketchFeature.data()
-origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin"))
+aSketchCommonFeature = aDocument.addFeature("Sketch")
+aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
-dirx = geomDataAPI_Dir(aSketchFeatureData.attribute("DirX"))
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeatureData.attribute("DirY"))
+diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
 diry.setValue(0, 1, 0)
-norm = geomDataAPI_Dir(aSketchFeatureData.attribute("Norm"))
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
 #=========================================================================
 # Create two lines which are not parallel
 #=========================================================================
 aSession.startOperation()
-aSketchReflist = aSketchFeatureData.reflist("Features")
 # line A
-aSketchLineA = aDocument.addFeature("SketchLine")
-aSketchReflist.append(aSketchLineA)
-aLineAStartPoint = geomDataAPI_Point2D(
-    aSketchLineA.data().attribute("StartPoint"))
-aLineAEndPoint = geomDataAPI_Point2D(
-    aSketchLineA.data().attribute("EndPoint"))
-aSketchLineB = aDocument.addFeature("SketchLine")
+aSketchLineA = aSketchFeature.addFeature("SketchLine")
+aLineAStartPoint = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint"))
+aLineAEndPoint = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint"))
+aSketchLineB = aSketchFeature.addFeature("SketchLine")
 aLineAStartPoint.setValue(0., 25)
 aLineAEndPoint.setValue(85., 25)
 # line B
-aSketchReflist.append(aSketchLineB)
-aLineBStartPoint = geomDataAPI_Point2D(
-    aSketchLineB.data().attribute("StartPoint"))
-aLineBEndPoint = geomDataAPI_Point2D(
-    aSketchLineB.data().attribute("EndPoint"))
+aLineBStartPoint = geomDataAPI_Point2D(aSketchLineB.attribute("StartPoint"))
+aLineBEndPoint = geomDataAPI_Point2D(aSketchLineB.attribute("EndPoint"))
 aLineBStartPoint.setValue(0., 50)
 aLineBEndPoint.setValue(80., 75)
 aSession.finishOperation()
@@ -64,10 +57,8 @@ aSession.finishOperation()
 #=========================================================================
 for eachFeature in [aSketchLineA, aSketchLineB]:
     aSession.startOperation()
-    aLengthConstraint = aDocument.addFeature("SketchConstraintLength")
-    aSketchReflist.append(aLengthConstraint)
-    aLengthConstraintData = aLengthConstraint.data()
-    refattrA = aLengthConstraintData.refattr("ConstraintEntityA")
+    aLengthConstraint = aSketchFeature.addFeature("SketchConstraintLength")
+    refattrA = aLengthConstraint.refattr("ConstraintEntityA")
     aResultA = modelAPI_ResultConstruction(eachFeature.firstResult())
     assert (aResultA is not None)
     refattrA.setObject(aResultA)
@@ -86,11 +77,9 @@ assert (aLineBEndPoint.y() == 75)
 # Link lines with parallel constraint
 #=========================================================================
 aSession.startOperation()
-aParallelConstraint = aDocument.addFeature("SketchConstraintParallel")
-aSketchReflist.append(aParallelConstraint)
-aConstraintData = aParallelConstraint.data()
-refattrA = aConstraintData.refattr("ConstraintEntityA")
-refattrB = aConstraintData.refattr("ConstraintEntityB")
+aParallelConstraint = aSketchFeature.addFeature("SketchConstraintParallel")
+refattrA = aParallelConstraint.refattr("ConstraintEntityA")
+refattrB = aParallelConstraint.refattr("ConstraintEntityB")
 # aResultA is already defined for the length constraint
 aResultA = modelAPI_ResultConstruction(eachFeature.firstResult())
 aResultB = modelAPI_ResultConstruction(aSketchLineB.firstResult())
index 192f1d9ac12078f44d72a074f72b79d1157d54af..38b605f233f80cc82a0f393cd11cc87d36d26981 100644 (file)
@@ -22,7 +22,7 @@ from ModelAPI import *
 # Initialization of the test
 #=========================================================================
 
-__updated__ = "2014-09-26"
+__updated__ = "2014-10-28"
 
 aSession = ModelAPI_Session.get()
 aDocument = aSession.moduleDocument()
@@ -30,38 +30,31 @@ aDocument = aSession.moduleDocument()
 # Creation of a sketch
 #=========================================================================
 aSession.startOperation()
-aSketchFeature = aDocument.addFeature("Sketch")
-aSketchFeatureData = aSketchFeature.data()
-origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin"))
+aSketchCommonFeature = aDocument.addFeature("Sketch")
+aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
-dirx = geomDataAPI_Dir(aSketchFeatureData.attribute("DirX"))
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeatureData.attribute("DirY"))
+diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
 diry.setValue(0, 1, 0)
-norm = geomDataAPI_Dir(aSketchFeatureData.attribute("Norm"))
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
 #=========================================================================
 # Create two lines which are already perpendicular
 #=========================================================================
 aSession.startOperation()
-aSketchReflist = aSketchFeatureData.reflist("Features")
 # line A
-aSketchLineA = aDocument.addFeature("SketchLine")
-aSketchReflist.append(aSketchLineA)
-aLineAStartPoint = geomDataAPI_Point2D(
-    aSketchLineA.data().attribute("StartPoint"))
-aLineAEndPoint = geomDataAPI_Point2D(
-    aSketchLineA.data().attribute("EndPoint"))
-aSketchLineB = aDocument.addFeature("SketchLine")
+aSketchLineA = aSketchFeature.addFeature("SketchLine")
+aLineAStartPoint = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint"))
+aLineAEndPoint = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint"))
+# line B
+aSketchLineB = aSketchFeature.addFeature("SketchLine")
 aLineAStartPoint.setValue(0., 25)
 aLineAEndPoint.setValue(85., 25)
-# line B
-aSketchReflist.append(aSketchLineB)
-aLineBStartPoint = geomDataAPI_Point2D(
-    aSketchLineB.data().attribute("StartPoint"))
-aLineBEndPoint = geomDataAPI_Point2D(
-    aSketchLineB.data().attribute("EndPoint"))
+aLineBStartPoint = geomDataAPI_Point2D(aSketchLineB.attribute("StartPoint"))
+aLineBEndPoint = geomDataAPI_Point2D(aSketchLineB.attribute("EndPoint"))
 aLineBStartPoint.setValue(25., 40.)
 aLineBEndPoint.setValue(25., 125.)
 aSession.finishOperation()
@@ -72,10 +65,8 @@ aSession.finishOperation()
 
 for eachFeature in [aSketchLineA, aSketchLineB]:
     aSession.startOperation()
-    aLengthConstraint = aDocument.addFeature("SketchConstraintLength")
-    aSketchReflist.append(aLengthConstraint)
-    aLengthConstraintData = aLengthConstraint.data()
-    refattrA = aLengthConstraintData.refattr("ConstraintEntityA")
+    aLengthConstraint = aSketchFeature.addFeature("SketchConstraintLength")
+    refattrA = aLengthConstraint.refattr("ConstraintEntityA")
     aResultA = modelAPI_ResultConstruction(eachFeature.firstResult())
     assert (aResultA is not None)
     refattrA.setObject(aResultA)
@@ -95,12 +86,10 @@ assert (aLineBEndPoint.y() == 125)
 # Link lines with perpendicular constraint
 #=========================================================================
 aSession.startOperation()
-aPerpendicularConstraint = aDocument.addFeature(
+aPerpendicularConstraint = aSketchFeature.addFeature(
     "SketchConstraintPerpendicular")
-aSketchReflist.append(aPerpendicularConstraint)
-aConstraintData = aPerpendicularConstraint.data()
-refattrA = aConstraintData.refattr("ConstraintEntityA")
-refattrB = aConstraintData.refattr("ConstraintEntityB")
+refattrA = aPerpendicularConstraint.refattr("ConstraintEntityA")
+refattrB = aPerpendicularConstraint.refattr("ConstraintEntityB")
 # aResultA is already defined for the length constraint
 aResultB = modelAPI_ResultConstruction(aSketchLineB.firstResult())
 assert (aResultB is not None)
index 630beb124a11f53709ffe9de1d9837628666e389..afe60ba4f4971bb09d57c0ea3e9d08f63e28533e 100644 (file)
@@ -24,7 +24,7 @@ import math
 # Initialization of the test
 #=========================================================================
 
-__updated__ = "2014-09-26"
+__updated__ = "2014-10-28"
 
 aSession = ModelAPI_Session.get()
 aDocument = aSession.moduleDocument()
@@ -32,41 +32,34 @@ aDocument = aSession.moduleDocument()
 # Creation of a sketch
 #=========================================================================
 aSession.startOperation()
-aSketchFeature = aDocument.addFeature("Sketch")
-aSketchFeatureData = aSketchFeature.data()
-origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin"))
+aSketchCommonFeature = aDocument.addFeature("Sketch")
+aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
-dirx = geomDataAPI_Dir(aSketchFeatureData.attribute("DirX"))
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeatureData.attribute("DirY"))
+diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
 diry.setValue(0, 1, 0)
-norm = geomDataAPI_Dir(aSketchFeatureData.attribute("Norm"))
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
 #=========================================================================
 # Creation of an arc and a circle
 #=========================================================================
 aSession.startOperation()
-aSketchReflist = aSketchFeatureData.reflist("Features")
-aSketchArc = aDocument.addFeature("SketchArc")
-aSketchReflist.append(aSketchArc)
-aSketchArcData = aSketchArc.data()
-anArcCentr = geomDataAPI_Point2D(aSketchArcData.attribute("ArcCenter"))
+aSketchArc = aSketchFeature.addFeature("SketchArc")
+anArcCentr = geomDataAPI_Point2D(aSketchArc.attribute("ArcCenter"))
 anArcCentr.setValue(10., 10.)
-anArcStartPoint = geomDataAPI_Point2D(
-    aSketchArcData.attribute("ArcStartPoint"))
+anArcStartPoint = geomDataAPI_Point2D(aSketchArc.attribute("ArcStartPoint"))
 anArcStartPoint.setValue(0., 50.)
-anArcEndPoint = geomDataAPI_Point2D(aSketchArcData.attribute("ArcEndPoint"))
+anArcEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("ArcEndPoint"))
 anArcEndPoint.setValue(50., 0.)
 aSession.finishOperation()
 # Circle
 aSession.startOperation()
-aSketchCircle = aDocument.addFeature("SketchCircle")
-aSketchReflist.append(aSketchCircle)
-aSketchCircleData = aSketchCircle.data()
-anCircleCentr = geomDataAPI_Point2D(
-    aSketchCircleData.attribute("CircleCenter"))
-aCircleRadius = aSketchCircleData.real("CircleRadius")
+aSketchCircle = aSketchFeature.addFeature("SketchCircle")
+anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("CircleCenter"))
+aCircleRadius = aSketchCircle.real("CircleRadius")
 anCircleCentr.setValue(-25., -25)
 aCircleRadius.setValue(25.)
 aSession.finishOperation()
@@ -74,11 +67,9 @@ aSession.finishOperation()
 # Make a constraint to keep the radius of the arc
 #=========================================================================
 aSession.startOperation()
-aConstraint = aDocument.addFeature("SketchConstraintRadius")
-aSketchReflist.append(aConstraint)
-aConstraintData = aConstraint.data()
-aRadius = aConstraintData.real("ConstraintValue")
-aRefObject = aConstraintData.refattr("ConstraintEntityA")
+aConstraint = aSketchFeature.addFeature("SketchConstraintRadius")
+aRadius = aConstraint.real("ConstraintValue")
+aRefObject = aConstraint.refattr("ConstraintEntityA")
 aResult = aSketchArc.firstResult()
 assert (aResult is not None)
 aRefObject.setObject(modelAPI_ResultConstruction(aResult))
@@ -90,11 +81,9 @@ assert (aRefObject.isInitialized())
 # Make a constraint to keep the radius of the circle
 #=========================================================================
 aSession.startOperation()
-aConstraint = aDocument.addFeature("SketchConstraintRadius")
-aSketchReflist.append(aConstraint)
-aConstraintData = aConstraint.data()
-aRadius = aConstraintData.real("ConstraintValue")
-aRefObject = aConstraintData.refattr("ConstraintEntityA")
+aConstraint = aSketchFeature.addFeature("SketchConstraintRadius")
+aRadius = aConstraint.real("ConstraintValue")
+aRefObject = aConstraint.refattr("ConstraintEntityA")
 aResult = aSketchCircle.firstResult()
 assert (aResult is not None)
 aRefObject.setObject(modelAPI_ResultConstruction(aResult))
index 4223d5c35d104583365f346c354538e8d3a2a320..8ce7a3186b3bef32c439dceab06b871ab1098e45 100644 (file)
@@ -22,7 +22,7 @@
 from GeomDataAPI import *
 from ModelAPI import *
 
-__updated__ = "2014-07-25"
+__updated__ = "2014-10-28"
 
 aSession = ModelAPI_Session.get()
 aDocument = aSession.moduleDocument()
@@ -30,49 +30,49 @@ aDocument = aSession.moduleDocument()
 # Creation of a sketch
 #=========================================================================
 aSession.startOperation()
-aSketchFeature = aDocument.addFeature("Sketch")
-aSketchFeatureData = aSketchFeature.data()
-origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin"))
+#aSketchFeature = aDocument.addFeature("Sketch")
+aSketchCommonFeature = aDocument.addFeature("Sketch")
+aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
-dirx = geomDataAPI_Dir(aSketchFeatureData.attribute("DirX"))
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeatureData.attribute("DirY"))
+diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
 diry.setValue(0, 1, 0)
-norm = geomDataAPI_Dir(aSketchFeatureData.attribute("Norm"))
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
 #=========================================================================
 # Creation of an arc
 # 1. Test SketchPlugin_Arc attributes
-# 2. 
+# 2.
 #=========================================================================
 aSession.startOperation()
-aSketchReflist = aSketchFeatureData.reflist("Features")
+aSketchReflist = aSketchFeature.reflist("Features")
 assert (not aSketchReflist.isInitialized())
 assert (aSketchReflist.size() == 0)
 assert (len(aSketchReflist.list()) == 0)
-aSketchArc = aDocument.addFeature("SketchArc")
+aSketchArc = aSketchFeature.addFeature("SketchArc")
 assert (aSketchArc.getKind() == "SketchArc")
-aSketchReflist.append(aSketchArc)
-aSketchArcData = aSketchArc.data()
-anArcCentr = geomDataAPI_Point2D(aSketchArcData.attribute("ArcCenter"))
+anArcCentr = geomDataAPI_Point2D(aSketchArc.attribute("ArcCenter"))
 assert (anArcCentr.x() == 0)
 assert (anArcCentr.y() == 0)
 assert (not anArcCentr.isInitialized())
-anArcCentr.setValue(10.,10.)
-anArcStartPoint = geomDataAPI_Point2D(aSketchArcData.attribute("ArcStartPoint"))
+anArcCentr.setValue(10., 10.)
+anArcStartPoint = geomDataAPI_Point2D(
+    aSketchArc.attribute("ArcStartPoint"))
 assert (anArcStartPoint.x() == 0)
 assert (anArcStartPoint.y() == 0)
 assert (not anArcStartPoint.isInitialized())
 anArcStartPoint.setValue(0., 50.)
-anArcEndPoint = geomDataAPI_Point2D(aSketchArcData.attribute("ArcEndPoint"))
+anArcEndPoint = geomDataAPI_Point2D(aSketchArc.attribute("ArcEndPoint"))
 assert (anArcEndPoint.x() == 0)
 assert (anArcEndPoint.y() == 0)
 assert (not anArcEndPoint.isInitialized())
 anArcEndPoint.setValue(50., 0.)
 aSession.finishOperation()
 # check that values have been changed
-aSketchReflist = aSketchFeatureData.reflist("Features")
+aSketchReflist = aSketchFeature.reflist("Features")
 assert (aSketchReflist.size() == 1)
 assert (len(aSketchReflist.list()) == 1)
 assert (anArcCentr.x() == 10.0)
@@ -81,15 +81,16 @@ assert (anArcStartPoint.x() == 0.0)
 assert (anArcStartPoint.y() == 50.0)
 assert (anArcEndPoint.x() == 50.0)
 assert (anArcEndPoint.y() == 0.0)
-#===============================================================================
+#=========================================================================
 # Edit the arc:
 # 1. Move whole arc
-# 2. Change the start point 
-#===============================================================================
+# 2. Change the start point
+#=========================================================================
 aSession.startOperation()
 deltaX, deltaY = 5., 10.
 anArcCentr.setValue(anArcCentr.x() + deltaX, anArcCentr.y() + deltaY)
-anArcStartPoint.setValue(anArcStartPoint.x() + deltaX, anArcStartPoint.y() + deltaY)
+anArcStartPoint.setValue(
+    anArcStartPoint.x() + deltaX, anArcStartPoint.y() + deltaY)
 anArcEndPoint.setValue(anArcEndPoint.x() + deltaX, anArcEndPoint.y() + deltaY)
 aSession.finishOperation()
 assert (anArcCentr.x() == 15)
@@ -111,32 +112,30 @@ assert (anArcStartPoint.y() == 60)
 assert (anArcEndPoint.x() != aPrevEndPointX)
 assert (anArcEndPoint.y() != aPrevEndPointY)
 #=========================================================================
-# Check results of the Arc 
+# Check results of the Arc
 #=========================================================================
 aResult = aSketchArc.firstResult()
 aResultConstruction = modelAPI_ResultConstruction(aResult)
 aShape = aResultConstruction.shape()
 assert (aShape is not None)
 assert (not aShape.isNull())
-#===============================================================================
+#=========================================================================
 # Create a circle
 # 1. Test SketchPlugin_Circle.h attributes
 # 2. ModelAPI_AttributeDouble attribute
-#===============================================================================
+#=========================================================================
 aSession.startOperation()
-aSketchReflist = aSketchFeatureData.reflist("Features")
+aSketchReflist = aSketchFeature.reflist("Features")
 # Arc is already added
 assert (aSketchReflist.size() == 1)
 assert (len(aSketchReflist.list()) == 1)
-aSketchCircle = aDocument.addFeature("SketchCircle")
+aSketchCircle = aSketchFeature.addFeature("SketchCircle")
 assert (aSketchCircle.getKind() == "SketchCircle")
-aSketchReflist.append(aSketchCircle)
-aSketchCircleData = aSketchCircle.data()
-anCircleCentr = geomDataAPI_Point2D(aSketchCircleData.attribute("CircleCenter"))
+anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("CircleCenter"))
 assert (anCircleCentr.x() == 0)
 assert (anCircleCentr.y() == 0)
 assert (not anCircleCentr.isInitialized())
-aCircleRadius = aSketchCircleData.real("CircleRadius");
+aCircleRadius = aSketchCircle.real("CircleRadius")
 assert (type(aCircleRadius) == ModelAPI_AttributeDouble)
 # ModelAPI_AttributeDouble.type() is checked in ModelAPI_TestConstants
 assert (aCircleRadius.attributeType() == ModelAPI_AttributeDouble.type())
@@ -147,11 +146,11 @@ assert (anCircleCentr.x() == -25)
 assert (anCircleCentr.y() == -25)
 assert (aCircleRadius.value() == 25)
 aSession.finishOperation()
-#===============================================================================
+#=========================================================================
 # Edit the Cricle
 # 1. Check that changing the centr of a circle does not affects radius
 # 2. and vise versa; also check that int is acceptable as well as a real
-#===============================================================================
+#=========================================================================
 aSession.startOperation()
 anCircleCentr.setValue(10, 60)
 aSession.finishOperation()
@@ -164,6 +163,6 @@ aSession.finishOperation()
 assert (anCircleCentr.x() == 10)
 assert (anCircleCentr.y() == 60)
 assert (aCircleRadius.value() == 20)
-#===============================================================================
+#=========================================================================
 # End of test
-#===============================================================================
+#=========================================================================
index dd90e27fd7df9ed05f8b921f913b93e5fb2b63da..df3f7cd64b6ab67a7ce2803a59d3c9409402f28a 100644 (file)
@@ -4,7 +4,7 @@
 from GeomDataAPI import *
 from ModelAPI import *
 
-__updated__ = "2014-07-24"
+__updated__ = "2014-10-28"
 
 aSession = ModelAPI_Session.get()
 aDocument = aSession.moduleDocument()
@@ -12,32 +12,32 @@ aDocument = aSession.moduleDocument()
 # Creation of a sketch
 #=========================================================================
 aSession.startOperation()
-aSketchFeature = aDocument.addFeature("Sketch")
+aSketchCommonFeature = aDocument.addFeature("Sketch")
+aSketchFeature = modelAPI_CompositeFeature(aSketchCommonFeature)
 assert (aSketchFeature.getKind() == "Sketch")
-aSketchFeatureData = aSketchFeature.data()
-origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin"))
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 origin.setValue(0, 0, 0)
-dirx = geomDataAPI_Dir(aSketchFeatureData.attribute("DirX"))
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 dirx.setValue(1, 0, 0)
-diry = geomDataAPI_Dir(aSketchFeatureData.attribute("DirY"))
+diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
 diry.setValue(0, 1, 0)
-norm = geomDataAPI_Dir(aSketchFeatureData.attribute("Norm"))
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 norm.setValue(0, 0, 1)
 aSession.finishOperation()
 # check that values have been changed
-origin = geomDataAPI_Point(aSketchFeatureData.attribute("Origin"))
+origin = geomDataAPI_Point(aSketchFeature.attribute("Origin"))
 assert (origin.x() == 0)
 assert (origin.y() == 0)
 assert (origin.z() == 0)
-dirx = geomDataAPI_Dir(aSketchFeatureData.attribute("DirX"))
+dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX"))
 assert (dirx.x() == 1)
 assert (dirx.y() == 0)
 assert (dirx.z() == 0)
-diry = geomDataAPI_Dir(aSketchFeatureData.attribute("DirY"))
+diry = geomDataAPI_Dir(aSketchFeature.attribute("DirY"))
 assert (diry.x() == 0)
 assert (diry.y() == 1)
 assert (diry.z() == 0)
-norm = geomDataAPI_Dir(aSketchFeatureData.attribute("Norm"))
+norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm"))
 assert (norm.x() == 0)
 assert (norm.y() == 0)
 assert (norm.z() == 1)
@@ -45,15 +45,14 @@ assert (norm.z() == 1)
 # Creation of a point
 #=========================================================================
 aSession.startOperation()
-aSketchReflist = aSketchFeatureData.reflist("Features")
+aSketchReflist = aSketchFeature.reflist("Features")
 assert (not aSketchReflist.isInitialized())
 assert(aSketchReflist.size() == 0)
 assert (len(aSketchReflist.list()) == 0)
-aSketchPoint = aDocument.addFeature("SketchPoint")
+# aSketchPoint = aDocument.addFeature("SketchPoint")
+aSketchPoint = aSketchFeature.addFeature("SketchPoint")
 assert (aSketchPoint.getKind() == "SketchPoint")
-aSketchReflist.append(aSketchPoint)
-aSketchPointData = aSketchPoint.data()
-coords = geomDataAPI_Point2D(aSketchPointData.attribute("PointCoordindates"))
+coords = geomDataAPI_Point2D(aSketchPoint.attribute("PointCoordindates"))
 assert (coords.x() == 0)
 assert (coords.y() == 0)
 assert (not coords.isInitialized())
@@ -62,25 +61,23 @@ coords.setValue(10., 10.)
 assert (coords.isInitialized())
 aSession.finishOperation()
 # check that values have been changed
-aSketchReflist = aSketchFeatureData.reflist("Features")
+aSketchReflist = aSketchFeature.reflist("Features")
 assert (aSketchReflist.size() == 1)
 assert (len(aSketchReflist.list()) == 1)
-aSketchPointData = aSketchPoint.data()
-coords = geomDataAPI_Point2D(aSketchPointData.attribute("PointCoordindates"))
+coords = geomDataAPI_Point2D(aSketchPoint.attribute("PointCoordindates"))
 assert (coords.x() == 10.0)
 assert (coords.y() == 10.0)
-#===============================================================================
+#=========================================================================
 # Creation of a line
-#===============================================================================
+#=========================================================================
 aSession.startOperation()
-aSketchLine = aDocument.addFeature("SketchLine")
+# aSketchLine = aDocument.addFeature("SketchLine")
+aSketchLine = aSketchFeature.addFeature("SketchLine")
 assert (aSketchLine.getKind() == "SketchLine")
-aSketchReflist.append(aSketchLine)
 assert (aSketchReflist.size() == 2)
 assert (len(aSketchReflist.list()) == 2)
-aSketchLineData = aSketchLine.data()
-aLineStartPoint = geomDataAPI_Point2D(aSketchLineData.attribute("StartPoint"))
-aLineEndPoint= geomDataAPI_Point2D(aSketchLineData.attribute("EndPoint"))
+aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint"))
+aLineEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint"))
 assert (aLineStartPoint.x() == 0)
 assert (aLineStartPoint.y() == 0)
 assert (not aLineStartPoint.isInitialized())
@@ -94,17 +91,17 @@ assert (aLineStartPoint.isInitialized())
 assert (aLineEndPoint.isInitialized())
 aSession.finishOperation()
 # check that values have been changed
-aSketchLineData = aSketchLine.data()
-aLineStartPoint = geomDataAPI_Point2D(aSketchLineData.attribute("StartPoint"))
-aLineEndPoint= geomDataAPI_Point2D(aSketchLineData.attribute("EndPoint"))
+aLineStartPoint = geomDataAPI_Point2D(aSketchLine.attribute("StartPoint"))
+aLineEndPoint = geomDataAPI_Point2D(aSketchLine.attribute("EndPoint"))
 assert (aLineStartPoint.x() == 50.0)
 assert (aLineStartPoint.y() == 50.0)
 assert (aLineEndPoint.x() == 60.0)
 assert (aLineEndPoint.y() == 60.0)
-#===============================================================================
+#=========================================================================
 # Check the results
-#===============================================================================
+#=========================================================================
 aResult = aSketchLine.firstResult()
+assert (aResult is not None)
 aResultConstruction = modelAPI_ResultConstruction(aResult)
 aShape = aResultConstruction.shape()
 assert (aShape is not None)
index 4f726ab5d442b62cc99675b5ffe0fc175ee138d4..1194dc4543785c84b0339555b385dab588506de9 100644 (file)
@@ -49,6 +49,7 @@ QWidget* XGUI_Command::createWidget(QWidget* theParent)
     QString aToolTip = toolTip();
     if (!aKeys.isEmpty()) {
       aToolTip = QString("%1 (%2)").arg(aToolTip).arg(aKeys.toString());
+      aButton->setShortcut(aKeys);
     }
     if (!aToolTip.isEmpty()) {
       aButton->setToolTip(aToolTip);
index 84bf0d7beaea67bbcafb0bb59a3ae0ea4f75740a..a9618988920f1a3df15eb3303d335e16bed1a827 100644 (file)
@@ -13,6 +13,7 @@
 #include <ModelAPI_AttributeDocRef.h>
 #include <ModelAPI_Object.h>
 #include <ModelAPI_ResultPart.h>
+#include <ModelAPI_Session.h>
 
 #include <QAction>
 #include <QContextMenuEvent>
index 736de32d2d7059deaafe0394e5b8e1d83f5cf0cd..0bdf7633e70b7beec87742510e57237057f02272 100644 (file)
@@ -232,14 +232,11 @@ void XGUI_Displayer::setSelected(const QList<ObjectPtr>& theResults, const bool
   aContext->ClearSelected();
   foreach(ObjectPtr aResult, theResults)
   {
-    if (myResult2AISObjectMap.find(aResult) == myResult2AISObjectMap.end())
-      continue;
-
-    AISObjectPtr anObj = myResult2AISObjectMap[aResult];
-    if (anObj) {
+    if (isVisible(aResult)) {
+      AISObjectPtr anObj = myResult2AISObjectMap[aResult];
       Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
       if (!anAIS.IsNull())
-        aContext->AddOrRemoveSelected(anAIS, false);
+        aContext->SetSelected(anAIS, false);
     }
   }
   if (isUpdateViewer)
index 5bb4445fe695490c00a5d2208e28fd17533224e6..6a3c81a9f35b5ccda61750026914f4970ff75231 100644 (file)
@@ -88,4 +88,10 @@ ObjectPtr XGUI_ModuleConnector::findPresentedObject(const AISObjectPtr& theAIS)
 {
   XGUI_Displayer* aDisp = myWorkshop->displayer();
   return aDisp->getObject(theAIS);
+}
+
+void XGUI_ModuleConnector::setSelected(const QList<ObjectPtr>& theFeatures)
+{
+  XGUI_Displayer* aDisp = myWorkshop->displayer();
+  aDisp->setSelected(theFeatures);
 }
\ No newline at end of file
index f6d071f2ac375615cbca24a72b832d1d8e632a18..8a869f1d0db026bc03fafe78162c78df67dad92e 100644 (file)
@@ -50,6 +50,10 @@ Q_OBJECT
   //! Returns data object by AIS
   virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const;
 
+  //! Select features clearing previous selection. 
+  //! If the list is empty then selection will be cleared
+  virtual void setSelected(const QList<ObjectPtr>& theFeatures);
+
   XGUI_Workshop* workshop() const { return myWorkshop; }
 
 private:
index 33a411c0b37e71c5543947846c338dbaa24be69e..f93cb6b6a22a0b2f74a10be0d71596484de0ac36 100644 (file)
@@ -13,8 +13,6 @@
 XGUI_OperationMgr::XGUI_OperationMgr(QObject* theParent)
     : QObject(theParent)
 {
-  // listen to Escape signal to stop the current operation
-  qApp->installEventFilter(this);
 }
 
 XGUI_OperationMgr::~XGUI_OperationMgr()
@@ -68,8 +66,8 @@ bool XGUI_OperationMgr::eventFilter(QObject *theObject, QEvent *theEvent)
 {
   if (theEvent->type() == QEvent::KeyRelease) {
     QKeyEvent* aKeyEvent = dynamic_cast<QKeyEvent*>(theEvent);
-    if(aKeyEvent && onKeyReleased(aKeyEvent)) {
-      return true;
+    if(aKeyEvent) {
+      return onKeyReleased(aKeyEvent);
     }
   }
   return QObject::eventFilter(theObject, theEvent);
@@ -226,10 +224,6 @@ bool XGUI_OperationMgr::onKeyReleased(QKeyEvent* theEvent)
   ModuleBase_Operation* anOperation = currentOperation();
   bool isAccepted = true;
   switch (theEvent->key()) {
-    case Qt::Key_Escape: {
-      onAbortOperation();
-    }
-      break;
     case Qt::Key_Return:
     case Qt::Key_Enter: {
       commitOperation();
index 9f6a706cfb418d9c8b7d368440be2e1d8b3cc487..94712d811a10ed6f52df4a2fb43c0a8586d70d40 100644 (file)
@@ -57,6 +57,7 @@ XGUI_PropertyPanel::XGUI_PropertyPanel(QWidget* theParent)
   aBtn->setToolTip(tr("Cancel"));
   aBtn->setObjectName(XGUI::PROP_PANEL_CANCEL);
   aBtn->setFlat(true);
+  aBtn->setShortcut(QKeySequence(Qt::Key_Escape));
   aBtnLay->addWidget(aBtn);
 
   myCustomWidget = new QWidget(aContent);
index ebd529d11056c439f61df3f0353d807501862ea7..04c4d1ed3c5521bfe40ab28368bc5de21968f906 100644 (file)
@@ -28,11 +28,14 @@ Q_OBJECT
   /// Returns main widget of the property panel, which children will be created
   /// by WidgetFactory using the XML definition
   QWidget* contentWidget();
+
   /// Brings back all widget created by widget factory for signal/slot
   /// connections and further processing
   void setModelWidgets(const QList<ModuleBase_ModelWidget*>& theWidgets);
+
   /// Returns all property panel's widget created by WidgetFactory
-  const QList<ModuleBase_ModelWidget*>& modelWidgets() const;
+  virtual const QList<ModuleBase_ModelWidget*>& modelWidgets() const;
+
   /// Removes all widgets in the widget area of the property panel
   void cleanContent();
 
index 1b91cb3dccad3b2dc905d617c40f91ebf8b16474..7ef11f4f66cb2d08724364aaedf882d93e04fffa 100644 (file)
@@ -19,10 +19,10 @@ XGUI_Selection::XGUI_Selection(XGUI_Workshop* theWorkshop)
 {
 }
 
-std::list<ModuleBase_ViewerPrs> XGUI_Selection::getSelected(int theShapeTypeToSkip) const
+QList<ModuleBase_ViewerPrs> XGUI_Selection::getSelected(int theShapeTypeToSkip) const
 {
   std::set<ObjectPtr> aPrsFeatures;
-  std::list<ModuleBase_ViewerPrs> aPresentations;
+  QList<ModuleBase_ViewerPrs> aPresentations;
   XGUI_Displayer* aDisplayer = myWorkshop->displayer();
 
   Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
@@ -44,15 +44,15 @@ std::list<ModuleBase_ViewerPrs> XGUI_Selection::getSelected(int theShapeTypeToSk
     }
     Handle(SelectMgr_EntityOwner) anOwner = aContext->SelectedOwner();
     aPrs.setOwner(anOwner);
-    aPresentations.push_back(aPrs);
+    aPresentations.append(aPrs);
   }
   return aPresentations;
 }
 
-std::list<ModuleBase_ViewerPrs> XGUI_Selection::getHighlighted(int theShapeTypeToSkip) const
+QList<ModuleBase_ViewerPrs> XGUI_Selection::getHighlighted(int theShapeTypeToSkip) const
 {
   std::set<ObjectPtr> aPrsFeatures;
-  std::list<ModuleBase_ViewerPrs> aPresentations;
+  QList<ModuleBase_ViewerPrs> aPresentations;
   XGUI_Displayer* aDisplayer = myWorkshop->displayer();
 
   Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
index 5f399a7ee32450f7ba0d3258a3d35b283d2c0154..4868a9a80f7ffad28785f15f05cc8d354a26d158 100644 (file)
@@ -16,8 +16,6 @@
 #include <NCollection_List.hxx>
 #include <TopoDS_Shape.hxx>
 
-#include <list>
-
 class XGUI_Workshop;
 
 class XGUI_EXPORT XGUI_Selection : public ModuleBase_ISelection
@@ -28,12 +26,12 @@ class XGUI_EXPORT XGUI_Selection : public ModuleBase_ISelection
   /// Returns a list of viewer selected presentations
   /// \param theShapeTypeToSkip the shapes with this type will be skipped during the result list build
   /// \return list of presentations
-  virtual std::list<ModuleBase_ViewerPrs> getSelected(int theShapeTypeToSkip = -1) const;
+  virtual QList<ModuleBase_ViewerPrs> getSelected(int theShapeTypeToSkip = -1) const;
 
   /// Returns a list of viewer highlited presentations
   /// \param theShapeTypeToSkip the shapes with this type will be skipped during the result list build
   /// \return list of presentations
-  virtual std::list<ModuleBase_ViewerPrs> getHighlighted(int theShapeTypeToSkip = -1) const;
+  virtual QList<ModuleBase_ViewerPrs> getHighlighted(int theShapeTypeToSkip = -1) const;
 
   /**
    * Returns list of currently selected objects
index 2d2b4cc1c0738208ae8e7777ead8350c0a7c844d..b64386288fe908cad45948a44f5f7a6d6599e46e 100644 (file)
@@ -175,7 +175,9 @@ XGUI_ViewWindow::XGUI_ViewWindow(XGUI_Viewer* theViewer, V3d_TypeOfView theType)
       myEventStarted(false),
       myIsActive(false),
       myLastState(WindowNormalState),
-      myOperation(NOTHING)
+      myOperation(NOTHING),
+      myGripWgt(0),
+      myPicture(0)
 {
   mySelectedPoint = gp_Pnt(0., 0., 0.);
   setFrameStyle(QFrame::Raised);
index 6fd3bd0f3b02ab2d7175a6451fb563be63a8c845..22358aab96a01a69400684a6fc335bd2a2d5d9ed 100644 (file)
@@ -513,10 +513,7 @@ void XGUI_Workshop::onOperationStarted()
     ModuleBase_Tools::zeroMargins(myPropertyPanel->contentWidget());
 
     QList<ModuleBase_ModelWidget*> aWidgets = aFactory.getModelWidgets();
-    QList<ModuleBase_ModelWidget*>::const_iterator anIt = aWidgets.begin(), aLast = aWidgets.end();
-    ModuleBase_ModelWidget* aWidget;
-    for (; anIt != aLast; anIt++) {
-      aWidget = *anIt;
+    foreach (ModuleBase_ModelWidget* aWidget, aWidgets) {
       aWidget->setFeature(aOperation->feature());
       aWidget->enableFocusProcessing();
       QObject::connect(aWidget, SIGNAL(valuesChanged()), this, SLOT(onWidgetValuesChanged()));
@@ -528,7 +525,8 @@ void XGUI_Workshop::onOperationStarted()
 
     aOperation->setPropertyPanel(myPropertyPanel);
     myPropertyPanel->setModelWidgets(aWidgets);
-    myPropertyPanel->activateNextWidget(NULL);
+    if (!aOperation->activateByPreselection())
+      myPropertyPanel->activateNextWidget(NULL);
     // Widget activation (from the previous method) may commit the current operation
     // if pre-selection is enougth for it. So we shouldn't update prop panel's title
     if(myOperationMgr->isCurrentOperation(aOperation)) {
@@ -1010,6 +1008,7 @@ void XGUI_Workshop::createDockWidgets()
   hidePropertyPanel();  //<! Invisible by default
   hideObjectBrowser();
   aDesktop->tabifyDockWidget(aObjDock, myPropertyPanel);
+  myPropertyPanel->installEventFilter(myOperationMgr);
 
   QPushButton* aOkBtn = myPropertyPanel->findChild<QPushButton*>(XGUI::PROP_PANEL_OK);
   connect(aOkBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onCommitOperation()));