}
return AISObjectPtr();
}
+
+void SketchPlugin_Sketch::erase()
+{
+ boost::shared_ptr<ModelAPI_AttributeRefList> aRefList = boost::dynamic_pointer_cast<
+ ModelAPI_AttributeRefList>(data()->attribute(SketchPlugin_Sketch::FEATURES_ID()));
+ std::list<ObjectPtr> aFeatures = aRefList->list();
+ std::list<ObjectPtr>::const_iterator anIt = aFeatures.begin();
+ for (; anIt != aFeatures.end(); anIt++) {
+ FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(*anIt);
+ if (aFeature)
+ document()->removeFeature(aFeature);
+ }
+ SketchPlugin_Feature::erase();
+}
if (aSelected > 0) {
SessionPtr aMgr = ModelAPI_Session::get();
XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+ bool hasResult = false;
+ bool hasFeature = false;
+ foreach(ObjectPtr aObj, aObjects)
+ {
+ FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
+ ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(aObj);
+ if (aResult)
+ hasResult = true;
+ if (aFeature)
+ hasFeature = true;
+ if (hasFeature && hasResult)
+ break;
+ }
//Process Feature
if (aSelected == 1) {
ObjectPtr aObject = aObjects.first();
if (aObject) {
ResultPartPtr aPart = boost::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
if (aPart) {
if (aMgr->activeDocument() == aPart->partDoc())
aMenu->addAction(action("DEACTIVATE_PART_CMD"));
else
aMenu->addAction(action("ACTIVATE_PART_CMD"));
- } else if (aFeature) {
+ } else if (hasFeature) {
aMenu->addAction(action("EDIT_CMD"));
} else {
if (aDisplayer->isVisible(aObject))
if (aMgr->activeDocument() != aMgr->moduleDocument())
aMenu->addAction(action("ACTIVATE_PART_CMD"));
}
- } else if (aSelected >= 1) {
- bool hasResult = false;
- bool hasFeature = false;
- foreach(ObjectPtr aObj, aObjects)
- {
- FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
- ResultPtr aResult = boost::dynamic_pointer_cast<ModelAPI_Result>(aObj);
- if (aResult)
- hasResult = true;
- if (aFeature)
- hasFeature = true;
- if (hasFeature && hasResult)
- break;
- }
+ } else {
if (hasResult) {
aMenu->addAction(action("SHOW_CMD"));
aMenu->addAction(action("HIDE_CMD"));
aMenu->addAction(action("SHOW_ONLY_CMD"));
}
- if (hasFeature)
- aMenu->addAction(action("DELETE_CMD"));
}
+ if (hasFeature)
+ aMenu->addAction(action("DELETE_CMD"));
}
aMenu->addActions(myWorkshop->objectBrowser()->actions());
if (aMenu->actions().size() > 0) {