]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Arc problems fixing: 1. reentrant of the tangent arc should not fill center point...
authornds <nds@opencascade.com>
Wed, 22 Jun 2016 08:19:19 +0000 (11:19 +0300)
committernds <nds@opencascade.com>
Wed, 22 Jun 2016 08:19:48 +0000 (11:19 +0300)
2. Issue #1578 arc problems (constraint to passed point of existing arc in sketch which is not in the case of the arc)

src/ModelAPI/ModelAPI_Events.h
src/ModuleBase/ModuleBase_IModule.cpp
src/ModuleBase/ModuleBase_IModule.h
src/ModuleBase/ModuleBase_IWorkshop.h
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/PartSet/PartSet_SketcherReetntrantMgr.cpp
src/PartSet/PartSet_Tools.cpp
src/XGUI/XGUI_ModuleConnector.cpp
src/XGUI/XGUI_ModuleConnector.h
src/XGUI/XGUI_WorkshopListener.cpp

index f80dd62403021514b87b43367fe1aeaacda33083..3aa459424f5f334461d7ffa0f708a21c22c5905a 100644 (file)
@@ -34,8 +34,6 @@ static const char * EVENT_OBJECT_RENAMED = "ObjectRenamed";
 static const char * EVENT_OBJECT_MOVED = "ObjectsMoved";
 /// Event ID that visualization must be redisplayed (comes with ModelAPI_ObjectUpdatedMessage)
 static const char * EVENT_OBJECT_TO_REDISPLAY = "ObjectsToRedisplay";
-/// Event ID that visualization must be redisplayed (comes with ModelAPI_ObjectUpdatedMessage)
-static const char * EVENT_OPERATION_LAUNCHED = "OperationLaunched";
 /// Event ID that plugin is loaded (comes with ModelAPI_ObjectUpdatedMessage)
 static const char * EVENT_PLUGIN_LOADED = "PluginLoaded";
 //
index 942d9ec6584ef3a288b08f1746d3ee1238a7cd8f..fb7805fa68a793a792fa8a10c8cd3d1a97b5d5af 100644 (file)
@@ -69,7 +69,8 @@ void ModuleBase_IModule::launchModal(const QString& theCmdId)
 }
 
 
-void ModuleBase_IModule::launchOperation(const QString& theCmdId)
+void ModuleBase_IModule::launchOperation(const QString& theCmdId,
+                                         const bool isUpdatePropertyPanel)
 {
   if (!myWorkshop->canStartOperation(theCmdId))
     return;
@@ -80,18 +81,15 @@ void ModuleBase_IModule::launchOperation(const QString& theCmdId)
     ModuleBase_ISelection* aSelection = myWorkshop->selection();
     // Initialise operation with preliminary selection
     aFOperation->initSelection(aSelection, myWorkshop->viewer());
-    sendOperation(aFOperation);
+    sendOperation(aFOperation, isUpdatePropertyPanel);
   }
 }
 
 
-void ModuleBase_IModule::sendOperation(ModuleBase_Operation* theOperation)
+void ModuleBase_IModule::sendOperation(ModuleBase_Operation* theOperation,
+                                       const bool isUpdatePropertyPanel)
 {
-  static Events_ID aModuleEvent = Events_Loop::eventByName(EVENT_OPERATION_LAUNCHED);
-  std::shared_ptr<Config_PointerMessage> aMessage =
-      std::shared_ptr<Config_PointerMessage>(new Config_PointerMessage(aModuleEvent, this));
-  aMessage->setPointer(theOperation);
-  Events_Loop::loop()->send(aMessage);
+  workshop()->processLaunchOperation(theOperation, isUpdatePropertyPanel);
 }
 
 Handle(AIS_InteractiveObject) ModuleBase_IModule::createPresentation(const ResultPtr& theResult)
index f12b751f318881db81973b8bf7069978549bd9c7..78f48a39f876b3e77a85a58466e00a1ffd2a7c99 100755 (executable)
@@ -82,7 +82,8 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
 \r
   /// Creates an operation and send it to loop\r
   /// \param theCmdId the operation name\r
-  virtual void launchOperation(const QString& theCmdId);\r
+  /// \param isUpdatePropertyPanel if false, the property panel filling might be postponed\r
+  virtual void launchOperation(const QString& theCmdId, const bool isUpdatePropertyPanel = true);\r
 \r
   /// Executes feature as a modal dialog box\r
   /// \param theCmdId the operation name\r
@@ -240,7 +241,8 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
 \r
   /// Sends the operation for launching\r
   /// \param theOperation the operation\r
-  virtual void sendOperation(ModuleBase_Operation* theOperation);\r
+  /// \param isUpdatePropertyPanel if false, the property panel filling might be postponed\r
+  virtual void sendOperation(ModuleBase_Operation* theOperation, const bool isUpdatePropertyPanel = true);\r
 \r
   /// Create specific for the module presentation\r
   /// \param theResult an object for presentation\r
index c7ff4ceee902bdab60b9bebb48c8fd9e9edb0658..432b5accd1227e9d015adcbfafd46c94ed86e946 100644 (file)
@@ -76,6 +76,10 @@ Q_OBJECT
   //! Returns true if the operation with id theId can be started
   virtual bool canStartOperation(QString theId) = 0;
 
+  //! Performs the operation launch
+  //! \param theOperation an operation to be launched
+  virtual void processLaunchOperation(ModuleBase_Operation* theOperation, const bool isUpdatePropertyPanel) = 0;
+
   //! Returns started operation by the operation identifier
   //! \param theId an operation id
   //! \return an operation instance or NULL
index 1892f8b0a5ef1511c84e7199c05740cb9ccdbc8b..1b182cdf3cdab963c489ae0cdd7501f3f3ec09c0 100755 (executable)
@@ -828,12 +828,13 @@ bool PartSet_Module::canCommitOperation() const
   return true;
 }
 
-void PartSet_Module::launchOperation(const QString& theCmdId)
+void PartSet_Module::launchOperation(const QString& theCmdId,
+                                     const bool isUpdatePropertyPanel)
 {
   storeConstraintsState(theCmdId.toStdString());
   updateConstraintsState(theCmdId.toStdString());
 
-  ModuleBase_IModule::launchOperation(theCmdId);
+  ModuleBase_IModule::launchOperation(theCmdId, isUpdatePropertyPanel);
 }
 
 void PartSet_Module::storeConstraintsState(const std::string& theFeatureKind)
index f6d8fa9210ff5e3dc27fec135e5f0a6f9f2e8fc1..c71187fcbf48a810b079f1610f08da11392c152c 100755 (executable)
@@ -102,7 +102,8 @@ public:
 
   /// Creates an operation and send it to loop
   /// \param theCmdId the operation name
-  virtual void launchOperation(const QString& theCmdId);
+  /// \param isUpdatePropertyPanel if false, the property panel filling might be postponed
+  virtual void launchOperation(const QString& theCmdId, const bool isUpdatePropertyPanel = true);
 
   /// Realizes some functionality by an operation start
   /// Displays all sketcher sub-Objects, hides sketcher result, appends selection filters
index cc5f7602aa78a45708a57cda6975a04ac168cdfb..eb0432ff4823efbbc0319644d8f8a6cff149bf02 100755 (executable)
@@ -451,12 +451,16 @@ void PartSet_SketcherReetntrantMgr::restartOperation()
       myIsFlagsBlocked = true;
       FeaturePtr aPrevFeature = aFOperation->feature();
       aFOperation->commit();
-      module()->launchOperation(aFOperation->id());
+      module()->launchOperation(aFOperation->id(), false);
       // allow the same attribute values in restarted operation
       ModuleBase_OperationFeature* aCurrentOperation = dynamic_cast<ModuleBase_OperationFeature*>(
                                                                   myWorkshop->currentOperation());
       copyReetntrantAttributes(aPrevFeature, aCurrentOperation->feature());
 
+      // update property panel: it should be done because in launchOperation, the 'false' is given
+      workshop()->propertyPanel()->updateContentWidget(aCurrentOperation->feature());
+      workshop()->propertyPanel()->createContentPanel(aCurrentOperation->feature());
+
       myIsFlagsBlocked = false;
       resetFlags();
       // we should avoid processing of the signal about no more widgets attributes and 
index a08190d7b5c7caef2afd22b425a72c5ba6f2c0b3..a4e44a736698eb1ede7e54b2340645a77456a739 100755 (executable)
@@ -15,6 +15,7 @@
 #include <ModelAPI_Session.h>
 #include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_Events.h>
+#include <ModelAPI_Validator.h>
 
 #include <Events_Loop.h>
 
@@ -333,10 +334,14 @@ std::shared_ptr<GeomDataAPI_Point2D> PartSet_Tools::findFirstEqualPoint(const Fe
                                     theFeature->data()->attributes(GeomDataAPI_Point2D::typeId());
   std::list<std::shared_ptr<ModelAPI_Attribute> >::const_iterator anIt = anAttiributes.begin(),
       aLast = anAttiributes.end();
+  ModelAPI_ValidatorsFactory* aValidators = ModelAPI_Session::get()->validators();
+
   for (; anIt != aLast && !aFPoint; anIt++) {
     std::shared_ptr<GeomDataAPI_Point2D> aCurPoint = 
-      std::dynamic_pointer_cast<GeomDataAPI_Point2D>(*anIt);
-    if (aCurPoint && (aCurPoint->pnt()->distance(thePoint) < Precision::Confusion())) {
+                                             std::dynamic_pointer_cast<GeomDataAPI_Point2D>(*anIt);
+    if (aCurPoint && aCurPoint->isInitialized() &&
+        aValidators->isCase(theFeature, aCurPoint->id()) &&
+        (aCurPoint->pnt()->distance(thePoint) < Precision::Confusion())) {
       aFPoint = aCurPoint;
       break;
     }
index a01004ceb41005c4510a3e6e377d91de86a5a3dc..6312c827b50f478fd629da33c72f858007957e6e 100644 (file)
@@ -16,6 +16,7 @@
 
 #include <ModuleBase_IModule.h>
 #include <ModuleBase_ViewerPrs.h>
+#include <ModuleBase_OperationDescription.h>
 
 #include <AIS_Shape.hxx>
 
@@ -129,6 +130,26 @@ bool XGUI_ModuleConnector::canStartOperation(QString theId)
   return myWorkshop->operationMgr()->canStartOperation(theId);
 }
 
+void XGUI_ModuleConnector::processLaunchOperation(ModuleBase_Operation* theOperation,
+                                                  const bool isUpdatePropertyPanel)
+{
+  XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr();
+
+  if (anOperationMgr->startOperation(theOperation)) {
+    if (isUpdatePropertyPanel) {
+      ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(theOperation);
+      if (aFOperation) {
+        workshop()->propertyPanel()->updateContentWidget(aFOperation->feature());
+        workshop()->propertyPanel()->createContentPanel(aFOperation->feature());
+      }
+    }
+    if (!theOperation->getDescription()->hasXmlRepresentation()) {
+      if (theOperation->commit())
+        workshop()->updateCommandStatus();
+    }
+  }
+}
+
 ModuleBase_Operation* XGUI_ModuleConnector::findStartedOperation(const QString& theId)
 {
   return myWorkshop->operationMgr()->findOperation(theId);
index 89f5625dd7746ba3ed4fa6d4a03f46be28ff6c74..423bcbdcdb83d4b3f5d4155b7f639031d15eb1ac 100644 (file)
@@ -57,6 +57,11 @@ Q_OBJECT
   //! Returns true if the operation with id theId can be started
   virtual bool canStartOperation(QString theId);
 
+  //! Performs the operation launch
+  //! \param theOperation an operation to be launched
+  virtual void processLaunchOperation(ModuleBase_Operation* theOperation,
+                                      const bool isUpdatePropertyPanel);
+
   //! Returns started operation by the operation identifier. The operation manager is called.
   //! \param theId an operation id
   //! \return an operation instance or NULL
index 984388b5c6ac4b3d9850fa71431ec906c0da51c4..dff5b6209b7d8ef933479c1796d8521c9d294fa0 100755 (executable)
@@ -85,7 +85,6 @@ void XGUI_WorkshopListener::initializeEventListening()
   //Initialize event listening
   Events_Loop* aLoop = Events_Loop::loop();
   aLoop->registerListener(this, Events_InfoMessage::errorID());  //!< Listening application errors.
-  aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OPERATION_LAUNCHED));
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED));
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
@@ -158,26 +157,6 @@ void XGUI_WorkshopListener::processEvent(const std::shared_ptr<Events_Message>&
       QApplication::restoreOverrideCursor();
     }
   }
-  //An operation passed by message. Start it, process and commit.
-  else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OPERATION_LAUNCHED)) {
-    std::shared_ptr<Config_PointerMessage> aPartSetMsg =
-        std::dynamic_pointer_cast<Config_PointerMessage>(theMessage);
-    //myPropertyPanel->cleanContent();
-    ModuleBase_Operation* anOperation = (ModuleBase_Operation*) aPartSetMsg->pointer();
-    XGUI_OperationMgr* anOperationMgr = workshop()->operationMgr();
-
-    if (anOperationMgr->startOperation(anOperation)) {
-      ModuleBase_OperationFeature* aFOperation = dynamic_cast<ModuleBase_OperationFeature*>(anOperation);
-      if (aFOperation) {
-        workshop()->propertyPanel()->updateContentWidget(aFOperation->feature());
-        workshop()->propertyPanel()->createContentPanel(aFOperation->feature());
-      }
-      if (!anOperation->getDescription()->hasXmlRepresentation()) {
-        if (anOperation->commit())
-          workshop()->updateCommandStatus();
-      }
-    }
-  } 
   else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_SELFILTER_LOADED)) {
     std::shared_ptr<Config_SelectionFilterMessage> aMsg = 
       std::dynamic_pointer_cast<Config_SelectionFilterMessage>(theMessage);