void PartSet_Module::createFeatures()
{
//Registering of validators
- PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
+ SessionPtr aMgr = ModelAPI_Session::get();
ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
aFactory->registerValidator("PartSet_DistanceValidator", new PartSet_DistanceValidator);
aFactory->registerValidator("PartSet_LengthValidator", new PartSet_LengthValidator);
connect(theFeature, SIGNAL(triggered(bool)), this, SLOT(onFeatureTriggered()));
}
-QStringList PartSet_Module::nestedFeatures(QString)
-{
- return QStringList();
-}
-
std::string PartSet_Module::featureFile(const std::string& theFeatureId)
{
return myFeaturesInFiles[theFeatureId];
myWorkshop->viewer()->fitAll();
}
-void PartSet_Module::onLaunchOperation(std::string theName, ObjectPtr theObject)
+void PartSet_Module::onRestartOperation(std::string theName, ObjectPtr theObject)
{
FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
- if (!aFeature) {
- qDebug("Warning! Restart operation without feature!");
- return;
- }
- ModuleBase_Operation* anOperation = createOperation(theName.c_str(),
- aFeature ? aFeature->getKind() : "");
- PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
- if (aPreviewOp) {
+
+ std::string aKind = aFeature ? aFeature->getKind() : "";
+ ModuleBase_Operation* anOperation = createOperation(theName, aKind);
+ PartSet_OperationSketchBase* aSketchOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
+ if (aSketchOp) {
XGUI_Selection* aSelection = myWorkshop->selector()->selection();
// Initialise operation with preliminary selection
std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
- aPreviewOp->initFeature(aFeature);
- aPreviewOp->initSelection(aSelected, aHighlighted);
- } else {
+ aSketchOp->initFeature(aFeature);
+ aSketchOp->initSelection(aSelected, aHighlighted);
+ } else if (aFeature) {
anOperation->setEditingFeature(aFeature);
//Deactivate result of current feature in order to avoid its selection
XGUI_Displayer* aDisplayer = myWorkshop->displayer();
ModuleBase_Operation* aCurOperation = myWorkshop->operationMgr()->currentOperation();
FeaturePtr aSketch;
PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
- if (aPrevOp)
+ if (aPrevOp) {
aSketch = aPrevOp->sketch();
- if (PartSet_OperationFeatureCreate::canProcessKind(theCmdId))
+ }
+ if (PartSet_OperationFeatureCreate::canProcessKind(theCmdId)) {
anOperation = new PartSet_OperationFeatureCreate(theCmdId.c_str(), this, aSketch);
- else if (theCmdId == PartSet_OperationFeatureEditMulti::Type())
+ } else if (theCmdId == PartSet_OperationFeatureEditMulti::Type()) {
anOperation = new PartSet_OperationFeatureEditMulti(theCmdId.c_str(), this, aSketch);
- else if (theCmdId == PartSet_OperationFeatureEdit::Type())
+ } else if (theCmdId == PartSet_OperationFeatureEdit::Type()) {
anOperation = new PartSet_OperationFeatureEdit(theCmdId.c_str(), this, aSketch);
+ }
}
if (!anOperation) {
if (aPreviewOp) {
connect(aPreviewOp, SIGNAL(featureConstructed(ObjectPtr, int)), this,
SLOT(onFeatureConstructed(ObjectPtr, int)));
- connect(aPreviewOp, SIGNAL(launchOperation(std::string, ObjectPtr)), this,
- SLOT(onLaunchOperation(std::string, ObjectPtr)));
+ connect(aPreviewOp, SIGNAL(restartRequired(std::string, ObjectPtr)), this,
+ SLOT(onRestartOperation(std::string, ObjectPtr)));
connect(aPreviewOp, SIGNAL(multiSelectionEnabled(bool)), this,
SLOT(onMultiSelectionEnabled(bool)));
void PartSet_Module::sendOperation(ModuleBase_Operation* theOperation)
{
static Events_ID aModuleEvent = Events_Loop::eventByName(EVENT_OPERATION_LAUNCHED);
- Config_PointerMessage aMessage(aModuleEvent, this);
- aMessage.setPointer(theOperation);
+ boost::shared_ptr<Config_PointerMessage> aMessage =
+ boost::shared_ptr<Config_PointerMessage>(new Config_PointerMessage(aModuleEvent, this));
+ aMessage->setPointer(theOperation);
Events_Loop::loop()->send(aMessage);
}
//}
//if (aFeature) {
- onLaunchOperation(theFeature->getKind(), theFeature);
+ onRestartOperation(theFeature->getKind(), theFeature);
updateCurrentPreview(theFeature->getKind());
//}
// }