1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomValidators_Tools.cpp
4 // Created: 06 Aug 2014
5 // Author: Vitaly Smetannikov
7 #include "GeomValidators_Tools.h"
9 #include "ModelAPI_AttributeRefAttr.h"
10 #include "ModelAPI_AttributeSelection.h"
11 #include "ModelAPI_AttributeReference.h"
13 namespace GeomValidators_Tools {
15 ObjectPtr getObject(const AttributePtr& theAttribute)
18 std::string anAttrType = theAttribute->attributeType();
19 if (anAttrType == ModelAPI_AttributeRefAttr::typeId()) {
20 AttributeRefAttrPtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
21 if (anAttr != NULL && anAttr->isObject())
22 anObject = anAttr->object();
24 if (anAttrType == ModelAPI_AttributeSelection::typeId()) {
25 AttributeSelectionPtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
27 anObject = anAttr->context();
29 if (anAttrType == ModelAPI_AttributeReference::typeId()) {
30 AttributeReferencePtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
31 if (anAttr.get() != NULL)
32 anObject = anAttr->value();