- // create the operation
- ModuleBase_Operation* anOperation = 0;
- if (theCmdId == PartSet_OperationSketch::Type()) {
- anOperation = new PartSet_OperationSketch(theCmdId.c_str(), this);
- } else {
- ModuleBase_Operation* aCurOperation = myWorkshop->currentOperation();
- CompositeFeaturePtr aSketch;
- PartSet_OperationSketchBase* aPrevOp = dynamic_cast<PartSet_OperationSketchBase*>(aCurOperation);
- if (aPrevOp) {
- aSketch = aPrevOp->sketch();
- }
- if (PartSet_OperationFeatureCreate::canProcessKind(theCmdId)) {
- anOperation = new PartSet_OperationFeatureCreate(theCmdId.c_str(), this, aSketch);
- } else if (theCmdId == PartSet_OperationFeatureEditMulti::Type()) {
- anOperation = new PartSet_OperationFeatureEditMulti(theCmdId.c_str(), this, aSketch);
- } else if (theCmdId == PartSet_OperationFeatureEdit::Type()) {
- anOperation = new PartSet_OperationFeatureEdit(theCmdId.c_str(), this, aSketch);
- }
- }
-
- if (!anOperation) {
- anOperation = new ModuleBase_Operation(theCmdId.c_str(), this);
- }
-
- // set operation description and list of widgets corresponding to the feature xml definition
- std::string aFeatureKind = theFeatureKind.empty() ? theCmdId : theFeatureKind;
-
- std::string aPluginFileName = featureFile(aFeatureKind);
- Config_WidgetReader aWdgReader = Config_WidgetReader(aPluginFileName);
- aWdgReader.readAll();
- std::string aXmlCfg = aWdgReader.featureWidgetCfg(aFeatureKind);
- std::string aDescription = aWdgReader.featureDescription(aFeatureKind);
-
- anOperation->getDescription()->setDescription(QString::fromStdString(aDescription));
- anOperation->getDescription()->setXmlRepresentation(QString::fromStdString(aXmlCfg));
-
- // connect the operation
- PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
- if (aPreviewOp) {
- connect(aPreviewOp, SIGNAL(featureConstructed(ObjectPtr, int)), this,
- SLOT(onFeatureConstructed(ObjectPtr, int)));
- connect(aPreviewOp, SIGNAL(restartRequired(std::string, ObjectPtr)), this,
- SLOT(onRestartOperation(std::string, ObjectPtr)));
- // 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)));
- connect(aPreviewOp, SIGNAL(setSelection(const QList<ObjectPtr>&)), this,
- SLOT(onSetSelection(const QList<ObjectPtr>&)));
-
- PartSet_OperationSketch* aSketchOp = dynamic_cast<PartSet_OperationSketch*>(aPreviewOp);
- if (aSketchOp) {
- connect(aSketchOp, SIGNAL(planeSelected(double, double, double)), this,
- SLOT(onPlaneSelected(double, double, double)));
- connect(aSketchOp, SIGNAL(fitAllView()), this, SLOT(onFitAllView()));