#include <GeomAPI_Pnt.h>
#include <GeomAPI_Vertex.h>
#include <GeomAlgoAPI_CompoundBuilder.h>
+#include <GeomAlgoAPI_NExplode.h>
#include <TNaming_Selector.hxx>
#include <TNaming_NamedShape.hxx>
reset();
}
+void Model_AttributeSelection::selectSubShape(const std::string& theType,
+ const std::string& theContextName, const int theIndex)
+{
+ // selection of context by name
+ //std::string aNamingContextName = theContextName + "/";
+ //selectSubShape(theType, aNamingContextName);
+ std::shared_ptr<Model_Document> aDoc =
+ std::dynamic_pointer_cast<Model_Document>(owner()->document());
+ if (aDoc.get()) {
+ bool aUnique = true;
+ std::string aContextName = theContextName;
+ std::string anEmptySub = "";
+ ResultPtr aContext = aDoc->findByName(aContextName, anEmptySub, aUnique);
+ //ResultPtr aContext = context();
+ if (aContext.get()) {
+ GeomShapePtr aContShape = aContext->shape();
+ if (aContShape.get()) {
+ GeomAlgoAPI_NExplode aNExp(aContShape, GeomAPI_Shape::shapeTypeByStr(theType));
+ GeomShapePtr aValue = aNExp.shape(theIndex);
+ if (aValue.get())
+ setValue(aContext, aValue);
+ }
+ }
+ }
+}
+
int Model_AttributeSelection::Id()
{
int anID = 0;