#include "Model_Data.h"
#include <TDF_ChildIterator.hxx>
+#include <TopAbs_ShapeEnum.hxx>
using namespace std;
owner()->data()->sendAttributeUpdated(this);
}
+void Model_AttributeSelectionList::append(std::string theNamingName)
+{
+ int aNewTag = mySize->Get() + 1;
+ TDF_Label aNewLab = mySize->Label().FindChild(aNewTag);
+
+ std::shared_ptr<Model_AttributeSelection> aNewAttr =
+ std::shared_ptr<Model_AttributeSelection>(new Model_AttributeSelection(aNewLab));
+ if (owner()) {
+ aNewAttr->setObject(owner());
+ }
+ mySize->Set(aNewTag);
+ TopAbs_ShapeEnum aType = (TopAbs_ShapeEnum)selectionType();
+ string aTypeName;
+ switch(aType) {
+ case TopAbs_VERTEX: aTypeName = "VERT"; break;
+ case TopAbs_EDGE: aTypeName = "EDGE"; break;
+ case TopAbs_WIRE: aTypeName = "WIRE"; break;
+ case TopAbs_FACE: aTypeName = "FACE"; break;
+ case TopAbs_SHELL: aTypeName = "SHEL"; break;
+ case TopAbs_SOLID: aTypeName = "SOLD"; break;
+ case TopAbs_COMPOUND: aTypeName = "COMP"; break;
+ case TopAbs_COMPSOLID: aTypeName = "COMS"; break;
+ default:
+ return; // invalid case => empty new attribute
+ };
+ aNewAttr->selectSubShape(aTypeName, theNamingName);
+ owner()->data()->sendAttributeUpdated(this);
+}
+
int Model_AttributeSelectionList::size()
{
return mySize->Get();
MODEL_EXPORT virtual void append(
const ResultPtr& theContext, const std::shared_ptr<GeomAPI_Shape>& theSubShape);
+ /// Adds the new reference to the end of the list by the naming name of the selected shape
+ /// The type of shape is taken from the current selection type
+ MODEL_EXPORT virtual void append(std::string theNamingName);
+
/// Returns the number ofselection attributes in the list
MODEL_EXPORT virtual int size();
virtual void append(const ResultPtr& theContext,
const GeomShapePtr& theSubShape) = 0;
+ /// Adds the new reference to the end of the list by the naming name of the selected shape
+ /// The type of shape is taken from the current selection type
+ virtual void append(std::string theNamingName) = 0;
+
/// Returns the number ofselection attributes in the list
virtual int size() = 0;