From b8f35d5dcad613d27e85ce11f6ff56a884e34609 Mon Sep 17 00:00:00 2001 From: asl Date: Mon, 17 Aug 2015 12:28:15 +0300 Subject: [PATCH] Issue #532: validator is added to xml; new type "plane" is treated --- src/FeaturesPlugin/partition_widget.xml | 1 + src/GeomValidators/GeomValidators_ShapeType.cpp | 9 +++++++++ src/GeomValidators/GeomValidators_ShapeType.h | 1 + 3 files changed, 11 insertions(+) diff --git a/src/FeaturesPlugin/partition_widget.xml b/src/FeaturesPlugin/partition_widget.xml index 10671d60d..e46121048 100755 --- a/src/FeaturesPlugin/partition_widget.xml +++ b/src/FeaturesPlugin/partition_widget.xml @@ -18,5 +18,6 @@ type_choice="Faces" concealment="true" > + diff --git a/src/GeomValidators/GeomValidators_ShapeType.cpp b/src/GeomValidators/GeomValidators_ShapeType.cpp index cefd7a592..97ad58028 100644 --- a/src/GeomValidators/GeomValidators_ShapeType.cpp +++ b/src/GeomValidators/GeomValidators_ShapeType.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include #include @@ -32,6 +33,7 @@ GeomValidators_ShapeType::TypeOfShape GeomValidators_ShapeType::shapeType(const MyShapeTypes["circle"] = Circle; MyShapeTypes["face"] = Face; MyShapeTypes["solid"] = Solid; + MyShapeTypes["plane"] = Plane; } std::string aType = std::string(theType.c_str()); if (MyShapeTypes.find(aType) != MyShapeTypes.end()) @@ -123,6 +125,13 @@ bool GeomValidators_ShapeType::isValidObject(const ObjectPtr& theObject, if (theObject.get() != NULL) { FeaturePtr aFeature = ModelAPI_Feature::feature(theObject); ResultPtr aResult = std::dynamic_pointer_cast(theObject); + if( theShapeType==Plane ) + { + ResultConstructionPtr aResultConstruction = std::dynamic_pointer_cast(theObject); + const std::string& aKind = aFeature->getKind(); + return aResult.get() != NULL && aKind == "Plane"; + } + if (aResult.get() != NULL) { GeomShapePtr aShape = aResult->shape(); aValid = isValidShape(aShape, theShapeType); diff --git a/src/GeomValidators/GeomValidators_ShapeType.h b/src/GeomValidators/GeomValidators_ShapeType.h index daefb1e22..5d30779b1 100644 --- a/src/GeomValidators/GeomValidators_ShapeType.h +++ b/src/GeomValidators/GeomValidators_ShapeType.h @@ -34,6 +34,7 @@ class GeomValidators_ShapeType : public ModelAPI_AttributeValidator Face, Solid, Compound, + Plane, AnyShape }; -- 2.39.2