if (!theOperation)
return;
PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(theOperation);
+ if (aPreviewOp) {
+ }
}
void PartSet_Module::onSelectionChanged()
sendOperation(anOperation);
}
+void PartSet_Module::onMultiSelectionEnabled(bool theEnabled)
+{
+ XGUI_ViewerProxy* aViewer = myWorkshop->viewer();
+ aViewer->enableMultiselection(theEnabled);
+}
+
void PartSet_Module::onFeatureConstructed(boost::shared_ptr<ModelAPI_Feature> theFeature,
int theMode)
{
this, SLOT(onFeatureConstructed(boost::shared_ptr<ModelAPI_Feature>, int)));
connect(aPreviewOp, SIGNAL(launchOperation(std::string, boost::shared_ptr<ModelAPI_Feature>)),
this, SLOT(onLaunchOperation(std::string, boost::shared_ptr<ModelAPI_Feature>)));
+ connect(aPreviewOp, SIGNAL(multiSelectionEnabled(bool)),
+ this, SLOT(onMultiSelectionEnabled(bool)));
PartSet_OperationSketch* aSketchOp = dynamic_cast<PartSet_OperationSketch*>(aPreviewOp);
if (aSketchOp) {
this, SLOT(onPlaneSelected(double, double, double)));
}
}
+
return anOperation;
}
public slots:
void onFeatureTriggered();
- /// SLOT, that is called after the operation is stopped. Disconnect the sketch feature
- /// from the viewer selection and show the sketch preview.
+ /// SLOT, that is called after the operation is stopped. Switched off the modfications performed
+ /// by the operation start
void onOperationStopped(ModuleBase_Operation* theOperation);
/// SLOT, that is called by the selection in the viewer is changed.
void onLaunchOperation(std::string theName, boost::shared_ptr<ModelAPI_Feature> theFeature);
+ /// SLOT, to switch on/off the multi selection in the viewer
+ /// \param theEnabled the enabled state
+ void onMultiSelectionEnabled(bool theEnabled);
+
/// SLOT, to visualize the feature in another local context mode
/// \param theFeature the feature to be put in another local context mode
/// \param theMode the mode appeared on the feature
void PartSet_OperationEditLine::startOperation()
{
// do nothing in order to do not create a new feature
+ emit multiSelectionEnabled(false);
+}
+
+void PartSet_OperationEditLine::stopOperation()
+{
+ emit multiSelectionEnabled(true);
}
boost::shared_ptr<ModelAPI_Feature> PartSet_OperationEditLine::createFeature()
protected:
/// \brief Virtual method called when operation is started
/// Virtual method called when operation started (see start() method for more description)
- /// After the parent operation body perform, set sketch feature to the created line feature
+ /// Switch off the multi selection state
virtual void startOperation();
+ /// Virtual method called when operation stopped - committed or aborted.
+ /// Restore the multi selection state
+ virtual void stopOperation();
+
/// Creates an operation new feature
/// Returns NULL feature. This is an operation of edition, not creation.
/// \returns the created feature
void PartSet_OperationSketch::setSketchPlane(const TopoDS_Shape& theShape)
{
+ if (theShape.IsNull())
+ return;
+
// get selected shape
boost::shared_ptr<GeomAPI_Shape> aGShape(new GeomAPI_Shape);
aGShape->setImpl(new TopoDS_Shape(theShape));
/// theName the operation name
/// theFeature the operation argument
void launchOperation(std::string theName, boost::shared_ptr<ModelAPI_Feature> theFeature);
+ /// signal to enable/disable multi selection in the viewer
+ /// \param theEnabled the boolean state
+ void multiSelectionEnabled(bool theEnabled);
protected:
/// Creates an operation new feature