icon=":icons/plane.png"
label="Plane face"
tooltip="Select a planar face"
- shape_types="face">
+ shape_types="face"
+ default="<sketch>">
<validator id="GeomValidators_Face" parameters="plane"/>
</shape_selector>
<doublevalue
icon=":icons/plane_inverted.png"
label="Plane face"
tooltip="Select a planar face"
- shape_types="face">
+ shape_types="face"
+ default="<sketch>">
<validator id="GeomValidators_Face" parameters="plane"/>
</shape_selector>
<doublevalue
if(aNumber > 1) return false;
return true;
}
-std::string Model_AttributeSelection::namingName()
+std::string Model_AttributeSelection::namingName(const std::string& theDefaultName)
{
std::string aName("");
- if(!this->isInitialized()) return aName;
+ if(!this->isInitialized())
+ return !theDefaultName.empty() ? theDefaultName : aName;
Handle(TDataStd_Name) anAtt;
if(selectionLabel().FindAttribute(TDataStd_Name::GetID(), anAtt)) {
aName = TCollection_AsciiString(anAtt->Get()).ToCString();
ResultPtr aCont = context();
aName = "Undefined name";
if(!aCont.get() || aCont->shape()->isNull())
- return aName;
+ return !theDefaultName.empty() ? theDefaultName : aName;
if (!aSubSh.get() || aSubSh->isNull()) { // no subshape, so just the whole feature name
return aCont->data()->name();
}
MODEL_EXPORT virtual bool update();
/// Returns a textual string of the selection
- MODEL_EXPORT virtual std::string namingName();
+ /// \param theDefaultValue a name, which is returned if the naming name can not be obtained
+ MODEL_EXPORT virtual std::string namingName(const std::string& theDefaultValue = "");
/// Returns an Id of the selection
/// NOTE: This method has been added for temporary export of groups towards old GEOM
MODELAPI_EXPORT virtual std::string attributeType();
/// Returns a textual string of the selection
- virtual std::string namingName() = 0;
+ /// \param theDefaultValue a value, which is used if the naming name can not be obtained
+ virtual std::string namingName(const std::string& theDefaultValue = "") = 0;
/// Returns an id of the selection
virtual int Id() = 0;
bool isNameUpdated = false;
AttributeSelectionPtr aSelect = aData->selection(attributeID());
if (aSelect) {
- myTextLine->setText(QString::fromStdString(aSelect->namingName()));
+ myTextLine->setText(QString::fromStdString(aSelect->namingName(getDefaultValue())));
isNameUpdated = true;
}
if (!isNameUpdated) {
}
}
else {
- myTextLine->setText("");
+ myTextLine->setText(getDefaultValue().c_str());
}
}
}