#include <ModelAPI_Feature.h>
/// attribute name of referenced face
-const std::string EXTRUSION_FACE = "extrusion_select_face";
+const std::string EXTRUSION_FACE = "extrusion_face";
/// attribute name of extrusion size
const std::string EXTRUSION_SIZE = "extrusion_size";
<source>
- <selector id="extrusion_select_face"
+ <selector id="extrusion_face"
label="Select a face"
icon=":icons/sketch.png"
tooltip="Select a face for extrusion"
if (myRef.IsNull()) {
boost::shared_ptr<Model_Data> aMyData =
boost::dynamic_pointer_cast<Model_Data>(owner()->data());
- TDF_Reference::Set(aMyData->label(), aData->label());
+ myRef = TDF_Reference::Set(aMyData->label(), aData->label());
} else {
myRef->Set(aData->label());
}
void ModuleBase_Operation::startOperation()
{
- setFeature(createFeature());
+ if (!myFeature)
+ setFeature(createFeature());
//emit callSlot();
//commit();
}
virtual void keyReleased(std::string theName, QKeyEvent* theEvent) {};
+ /// Sets the operation feature
+ void setFeature(boost::shared_ptr<ModelAPI_Feature> theFeature);
+
protected:
/// Virtual method called when operation started (see start() method for more description)
/// Default impl calls corresponding slot and commits immediately.
/// \returns the created feature
virtual boost::shared_ptr<ModelAPI_Feature> createFeature(const bool theFlushMessage = true);
- /// Returns the operation feature
- /// \return the feature
- void setFeature(boost::shared_ptr<ModelAPI_Feature> theFeature);
-
private:
boost::shared_ptr<ModelAPI_Feature> myFeature; /// the operation feature to be handled
};
#include "ModuleBase_SelectorWidget.h"
#include "ModuleBase_IWorkshop.h"
+#include <Events_Loop.h>
+#include <Model_Events.h>
+
#include <ModelAPI_Data.h>
#include <ModelAPI_Object.h>
#include <ModelAPI_AttributeReference.h>
boost::shared_ptr<ModelAPI_AttributeReference> aRef =
boost::dynamic_pointer_cast<ModelAPI_AttributeReference>(aData->attribute(myFeatureAttributeID));
- aRef->setFeature(mySelectedFeature);
+ bool isBlocked = this->blockSignals(true);
+ aRef->setValue(mySelectedFeature);
+ Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_UPDATED));
+ this->blockSignals(isBlocked);
return true;
}
boost::shared_ptr<ModelAPI_AttributeReference> aRef =
boost::dynamic_pointer_cast<ModelAPI_AttributeReference>(aData->attribute(myFeatureAttributeID));
+ bool isBlocked = this->blockSignals(true);
mySelectedFeature = aRef->value();
updateSelectionName();
+
+ this->blockSignals(isBlocked);
return true;
}
return;
// TODO: Check that the selection corresponds to selection type
+ if (aFeature->getKind().compare("Sketch") != 0)
+ return;
+
mySelectedFeature = aFeature;
if (mySelectedFeature) {
updateSelectionName();
std::list<XGUI_ViewerPrs> aSelected = aDisplayer->GetSelected(TopAbs_VERTEX);
std::list<XGUI_ViewerPrs> aHighlighted = aDisplayer->GetHighlighted(TopAbs_VERTEX);
aPreviewOp->init(theFeature, aSelected, aHighlighted);
+ } else {
+ anOperation->setFeature(theFeature);
}
sendOperation(anOperation);
myWorkshop->actionsMgr()->updateCheckState();
if (!theFeature)
return;
- if (theFeature->getKind() == "Sketch") {
+// if (theFeature->getKind() == "Sketch") {
FeaturePtr aFeature = theFeature;
if (XGUI_Tools::isModelObject(aFeature)) {
ObjectPtr aObject = boost::dynamic_pointer_cast<ModelAPI_Object>(aFeature);
onLaunchOperation(aFeature->getKind(), aFeature);
updateCurrentPreview(aFeature->getKind());
}
- }
+// }
}