+ else if (anAttributeType == ModelAPI_AttributeReference::typeId()) {
+ AttributeReferencePtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
+ if (anAttr.get() != NULL)
+ aValid = isValidObject(anAttr->value(), theShapeType);
+ }
+ return aValid;
+}
+
+bool GeomValidators_ShapeType::isValidObject(const ObjectPtr& theObject,
+ const TypeOfShape theShapeType) const
+{
+ bool aValid = false;
+ if (theObject.get() != NULL) {
+ FeaturePtr aFeature = ModelAPI_Feature::feature(theObject);
+ ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(theObject);
+ if (aResult.get() != NULL) {
+ GeomShapePtr aShape = aResult->shape();
+ aValid = isValidShape(aShape, theShapeType);
+ }
+ }
+ return aValid;
+}
+
+bool GeomValidators_ShapeType::isValidShape(const GeomShapePtr theShape,
+ const TypeOfShape theShapeType) const
+{
+ bool aValid = false;
+
+ if (theShape.get() != NULL) {
+ switch (theShapeType) {
+ case Edge:
+ aValid = theShape->isEdge();
+ break;
+ case Line:
+ aValid = theShape->isEdge() && !GeomAPI_Curve(theShape).isCircle();
+ break;
+ case Circle:
+ aValid = theShape->isEdge() && GeomAPI_Curve(theShape).isCircle();
+ break;
+ case Vertex:
+ aValid = theShape->isVertex();
+ break;
+ case Solid:
+ aValid = theShape->isSolid();
+ break;
+ case Face:
+ aValid = theShape->isFace();
+ break;
+ default: break;
+ }
+ }