#include <Config_WidgetAPI.h>
#include <Events_Loop.h>
-#include <Model_Events.h>
+#include <ModelAPI_Events.h>
#include <ModelAPI_Feature.h>
#include <ModelAPI_Data.h>
#include <QLabel>
ModuleBase_WidgetFeatureOrAttribute::ModuleBase_WidgetFeatureOrAttribute(QWidget* theParent,
- const Config_WidgetAPI* theData)
-: ModuleBase_WidgetFeature(theParent, theData)
+ const Config_WidgetAPI* theData,
+ const std::string& theParentId)
+: ModuleBase_WidgetFeature(theParent, theData, theParentId)
{
}
dynamic_cast<ModuleBase_WidgetValueFeature*>(theValue);
if (aFeatureValue) {
boost::shared_ptr<GeomAPI_Pnt2d> aValuePoint = aFeatureValue->point();
- FeaturePtr aValueFeature = aFeatureValue->feature();
-
+ ObjectPtr aValueFeature = aFeatureValue->object();
if (aValueFeature) {
- isDone = setFeature(aValueFeature);
+ isDone = setObject(aValueFeature);
}
- if (!isDone) {
+ if (!isDone && aValuePoint) {
// find the given point in the feature attributes
std::list<boost::shared_ptr<ModelAPI_Attribute> > anAttiributes =
aValueFeature->data()->attributes(GeomDataAPI_Point2D::type());
boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
ModuleBase_WidgetFeatureOrAttribute* that = (ModuleBase_WidgetFeatureOrAttribute*) this;
- if (feature())
- aRef->setFeature(feature());
+ if (object())
+ aRef->setObject(object());
else if (myAttribute)
aRef->setAttr(myAttribute);
theFeature->execute();
- Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_FEATURE_UPDATED));
+ Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
return true;
}
boost::shared_ptr<ModelAPI_AttributeRefAttr> aRef =
boost::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(aData->attribute(attributeID()));
- FeaturePtr aFeature = aRef->feature();
- setFeature(aFeature);
- myAttribute = aRef->attr();
+ FeaturePtr aFeature = boost::dynamic_pointer_cast<ModelAPI_Feature>(aRef->object());
+ if (aFeature) {
+ setObject(aFeature);
+ myAttribute = aRef->attr();
- std::string aText = "";
- if (aFeature)
- aText = aFeature->data()->getName().c_str();
- else if (myAttribute)
- aText = myAttribute->attributeType().c_str();
+ std::string aText = "";
+ if (aFeature)
+ aText = aFeature->data()->name().c_str();
+ else if (myAttribute)
+ aText = myAttribute->attributeType().c_str();
- editor()->setText(aText.c_str());
- return true;
+ editor()->setText(aText.c_str());
+ return true;
+ }
+ return false;
}
bool ModuleBase_WidgetFeatureOrAttribute::setAttribute(const boost::shared_ptr<ModelAPI_Attribute>& theAttribute)