- // 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->operationMgr()->currentOperation();
- FeaturePtr 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);
-
- //QString aXmlRepr = QString::fromStdString(aXmlCfg);
- //ModuleBase_WidgetFactory aFactory = ModuleBase_WidgetFactory(aXmlRepr.toStdString(),
- // myWorkshop->moduleConnector());
- //QWidget* aContent = myWorkshop->propertyPanel()->contentWidget();
- //qDeleteAll(aContent->children());
- //aFactory.createWidget(aContent);
-
- anOperation->getDescription()->setDescription(QString::fromStdString(aDescription));
- anOperation->getDescription()->setXmlRepresentation(QString::fromStdString(aXmlCfg));
-
- //anOperation->setModelWidgets(aXmlRepr.toStdString(), aFactory.getModelWidgets());
-
- // 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(launchOperation(std::string, ObjectPtr)), this,
- SLOT(onLaunchOperation(std::string, ObjectPtr)));
- 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>&)));
-
- connect(aPreviewOp, SIGNAL(closeLocalContext()), this, SLOT(onCloseLocalContext()));
-
- 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()));