void FeaturesPlugin_Group::initAttributes()
{
- data()->addAttribute(FeaturesPlugin_Group::NAME_ID(), ModelAPI_AttributeString::type());
+ //data()->addAttribute(FeaturesPlugin_Group::NAME_ID(), ModelAPI_AttributeString::type());
data()->addAttribute(FeaturesPlugin_Group::LIST_ID(), ModelAPI_AttributeSelectionList::type());
}
void FeaturesPlugin_Group::execute()
{
- AttributeStringPtr aNameAttr = boost::dynamic_pointer_cast<ModelAPI_AttributeString>(
- data()->attribute(FeaturesPlugin_Group::NAME_ID()));
- if (!aNameAttr)
- return;
- std::string aName = aNameAttr->value();
- data()->setName(aName);
+ //AttributeStringPtr aNameAttr = boost::dynamic_pointer_cast<ModelAPI_AttributeString>(
+ // data()->attribute(FeaturesPlugin_Group::NAME_ID()));
+ //if (!aNameAttr)
+ // return;
+ //std::string aName = aNameAttr->value();
+ //data()->setName(aName);
}
{
int aNewTag = mySize->Get() + 1;
TDF_Label aNewLab = mySize->Label().FindChild(aNewTag);
- mySubs.push_back(boost::shared_ptr<Model_AttributeSelection>(
- new Model_AttributeSelection(aNewLab)));
+
+ boost::shared_ptr<Model_AttributeSelection> aNewAttr =
+ boost::shared_ptr<Model_AttributeSelection>(new Model_AttributeSelection(aNewLab));
+ if (owner()) {
+ aNewAttr->setObject(owner());
+ }
+ mySubs.push_back(aNewAttr);
mySize->Set(aNewTag);
+ aNewAttr->setValue(theContext, theSubShape);
+ owner()->data()->sendAttributeUpdated(this);
}
int Model_AttributeSelectionList::size()
for(; aSubIter.More(); aSubIter.Next()) {
aSubIter.Value().ForgetAllAttributes(Standard_True);
}
+ owner()->data()->sendAttributeUpdated(this);
}
Model_AttributeSelectionList::Model_AttributeSelectionList(TDF_Label& theLabel)
#include <ModuleBase_IWorkshop.h>
#include <ModuleBase_Tools.h>
-#include <ModelAPI_AttributeString.h>
#include <ModelAPI_Data.h>
#include <ModelAPI_Object.h>
-#include <ModelAPI_Validator.h>
#include <ModelAPI_AttributeSelectionList.h>
#include <Config_WidgetAPI.h>
aMainLay->addWidget(aTypeLabel, 0, 0);
myTypeCombo = new QComboBox(myMainWidget);
- std::string aTypes = theData->getProperty("type_choice");
- myShapeTypes = QString::fromStdString(aTypes).split(' ');
+ // There is no sence to paramerize list of types while we can not parametrize selection mode
+ QString aTypesStr("Vertices Edges Faces Solids");
+ myShapeTypes = aTypesStr.split(' ');
myTypeCombo->addItems(myShapeTypes);
aMainLay->addWidget(myTypeCombo, 0, 1);
activateSelection(false);
}
+//********************************************************************
bool ModuleBase_WidgetMultiSelector::storeValue() const
{
// A rare case when plugin was not loaded.
return false;
}
+//********************************************************************
bool ModuleBase_WidgetMultiSelector::restoreValue()
{
- return false;
// A rare case when plugin was not loaded.
if(!myFeature)
return false;
return false;
}
+//********************************************************************
QWidget* ModuleBase_WidgetMultiSelector::getControl() const
{
return myMainWidget;
}
+//********************************************************************
QList<QWidget*> ModuleBase_WidgetMultiSelector::getControls() const
{
QList<QWidget*> result;
return ModuleBase_ModelWidget::eventFilter(theObj, theEvent);
}
+//********************************************************************
void ModuleBase_WidgetMultiSelector::onSelectionChanged()
{
ModuleBase_ISelection* aSelection = myWorkshop->selection();
mySelection.append(GeomSelection(aResult, aShape));
}
updateSelectionList();
+ storeValue();
emit valuesChanged();
}
+//********************************************************************
void ModuleBase_WidgetMultiSelector::updateSelectionList()
{
+ QString aType;
+ if (myTypeCombo->currentText().toLower() == "vertices")
+ aType = "vertex";
+ else if (myTypeCombo->currentText().toLower() == "edges")
+ aType = "edge";
+ else if (myTypeCombo->currentText().toLower() == "faces")
+ aType = "face";
+ else if (myTypeCombo->currentText().toLower() == "solids")
+ aType = "solid";
+
myListControl->clear();
int i = 1;
foreach (GeomSelection aSel, mySelection) {
QString aName(aSel.first->data()->name().c_str());
- aName += ":" + myTypeCombo->currentText() + QString::number(i);
+ aName += ":" + aType + QString("_%1").arg(i);
myListControl->addItem(aName);
i++;
}
}
+//********************************************************************
void ModuleBase_WidgetMultiSelector::filterShapes(const NCollection_List<TopoDS_Shape>& theShapesToFilter,
NCollection_List<TopoDS_Shape>& theResult)
{
}
}
+//********************************************************************
void ModuleBase_WidgetMultiSelector::activateSelection(bool toActivate)
{
myIsActive = toActivate;
}
}
+//********************************************************************
void ModuleBase_WidgetMultiSelector::onSelectionTypeChanged()
{
QString aNewType = myTypeCombo->currentText();