}
}
+void PartSet_Module::onContextMenuCommand(const QString& theId, bool isChecked)
+{
+ QFeatureList aFeatures = myWorkshop->selector()->selectedFeatures();
+ if (theId == "EDIT_CMD" && (aFeatures.size() > 0)) {
+ editFeature(aFeatures.first());
+ }
+}
+
void PartSet_Module::onMousePressed(QMouseEvent* theEvent)
{
PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(
aDisplayer->UpdateViewer();
}
+void PartSet_Module::editFeature(FeaturePtr theFeature)
+{
+ /*if (!theFeature)
+ return;
+
+ if (theFeature->getKind() == "Sketch") {
+ onLaunchOperation(theFeature->getKind(), theFeature);
+ visualizePreview(theFeature, true);
+ }*/
+}
/// 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 afetr the popup menu action clicked.
+ void onContextMenuCommand(const QString& theId, bool isChecked);
/// SLOT, that is called by mouse press in the viewer.
/// The mouse released point is sent to the current operation to be processed.
/// \param theEvent the mouse event
/// \param theOperation the operation
void sendOperation(ModuleBase_Operation* theOperation);
+protected:
+ //! Edits the feature
+ void editFeature(FeaturePtr theFeature);
+
private:
XGUI_Workshop* myWorkshop;
PartSet_Listener* myListener;
return;
boost::shared_ptr<ModelAPI_Data> aData = theFeature->data();
+ if (!aData->isValid())
+ return;
boost::shared_ptr<GeomDataAPI_Point2D> aPoint =
boost::dynamic_pointer_cast<GeomDataAPI_Point2D>(aData->attribute(theAttribute));
return aModes;
}
+void PartSet_OperationSketch::init(boost::shared_ptr<ModelAPI_Feature> theFeature,
+ const std::list<XGUI_ViewerPrs>& thePresentations)
+{
+ setFeature(theFeature);
+}
+
boost::shared_ptr<ModelAPI_Feature> PartSet_OperationSketch::sketch() const
{
return feature();
const std::list<XGUI_ViewerPrs>& theHighlighted)
{
if (!hasSketchPlane()) {
- XGUI_ViewerPrs aPrs = theHighlighted.front();
- const TopoDS_Shape& aShape = aPrs.shape();
- if (!aShape.IsNull())
- setSketchPlane(aShape);
+ if (!theHighlighted.empty()) {
+ XGUI_ViewerPrs aPrs = theHighlighted.front();
+ const TopoDS_Shape& aShape = aPrs.shape();
+ if (!aShape.IsNull())
+ setSketchPlane(aShape);
+ }
}
else {
if (theHighlighted.size() == 1) {
boost::shared_ptr<SketchPlugin_Feature> aFeature;
boost::shared_ptr<ModelAPI_Data> aData = feature()->data();
+ if (!aData->isValid())
+ return aPreviewMap;
boost::shared_ptr<ModelAPI_AttributeRefList> aRefList =
boost::dynamic_pointer_cast<ModelAPI_AttributeRefList>(aData->attribute(SKETCH_ATTR_FEATURES));
aLast = aFeatures.end();
for (; anIt != aLast; anIt++) {
aFeature = boost::dynamic_pointer_cast<SketchPlugin_Feature>(*anIt);
- if (!aFeature)
- continue;
boost::shared_ptr<GeomAPI_Shape> aPreview = aFeature->preview();
if (aPreview)
aPreviewMap[aFeature] = aPreview;
/// \return the selection mode
virtual std::list<int> getSelectionModes(boost::shared_ptr<ModelAPI_Feature> theFeature) const;
+ /// Initializes some fields accorging to the feature
+ /// \param theFeature the feature
+ /// \param thePresentations the list of additional presentations
+ virtual void init(boost::shared_ptr<ModelAPI_Feature> theFeature,
+ const std::list<XGUI_ViewerPrs>& thePresentations);
+
/// Returns the operation sketch feature
/// \returns the sketch instance
virtual boost::shared_ptr<ModelAPI_Feature> sketch() const;