2. Issue #1578 arc problems (constraint to passed point of existing arc in sketch which is not in the case of the arc)
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";
//
}
-void ModuleBase_IModule::launchOperation(const QString& theCmdId)
+void ModuleBase_IModule::launchOperation(const QString& theCmdId,
+ const bool isUpdatePropertyPanel)
{
if (!myWorkshop->canStartOperation(theCmdId))
return;
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)
\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
\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
//! 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
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)
/// 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
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
#include <ModelAPI_Session.h>
#include <ModelAPI_ResultConstruction.h>
#include <ModelAPI_Events.h>
+#include <ModelAPI_Validator.h>
#include <Events_Loop.h>
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;
}
#include <ModuleBase_IModule.h>
#include <ModuleBase_ViewerPrs.h>
+#include <ModuleBase_OperationDescription.h>
#include <AIS_Shape.hxx>
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);
//! 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
//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));
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);