From 139976bbdb4d10dbedc4ce966f7bef2843b83bcd Mon Sep 17 00:00:00 2001 From: nds Date: Thu, 26 Mar 2015 11:23:14 +0300 Subject: [PATCH] Union of validator and filter functionalities. It renames the shape validator to the external validator. --- src/SketchPlugin/CMakeLists.txt | 4 ++-- ...idator.cpp => SketchPlugin_ExternalValidator.cpp} | 6 +++--- ...eValidator.h => SketchPlugin_ExternalValidator.h} | 6 +++--- src/SketchPlugin/SketchPlugin_Plugin.cpp | 11 ++++------- src/SketchPlugin/plugin-Sketch.xml | 12 ++++++------ 5 files changed, 18 insertions(+), 21 deletions(-) rename src/SketchPlugin/{SketchPlugin_ShapeValidator.cpp => SketchPlugin_ExternalValidator.cpp} (88%) rename src/SketchPlugin/{SketchPlugin_ShapeValidator.h => SketchPlugin_ExternalValidator.h} (86%) diff --git a/src/SketchPlugin/CMakeLists.txt b/src/SketchPlugin/CMakeLists.txt index 22ce7d27e..e94f680c1 100644 --- a/src/SketchPlugin/CMakeLists.txt +++ b/src/SketchPlugin/CMakeLists.txt @@ -28,7 +28,7 @@ SET(PROJECT_HEADERS SketchPlugin_ConstraintTangent.h SketchPlugin_ConstraintMirror.h SketchPlugin_ConstraintFillet.h - SketchPlugin_ShapeValidator.h + SketchPlugin_ExternalValidator.h SketchPlugin_Validators.h ) @@ -55,7 +55,7 @@ SET(PROJECT_SOURCES SketchPlugin_ConstraintTangent.cpp SketchPlugin_ConstraintMirror.cpp SketchPlugin_ConstraintFillet.cpp - SketchPlugin_ShapeValidator.cpp + SketchPlugin_ExternalValidator.cpp SketchPlugin_Validators.cpp ) diff --git a/src/SketchPlugin/SketchPlugin_ShapeValidator.cpp b/src/SketchPlugin/SketchPlugin_ExternalValidator.cpp similarity index 88% rename from src/SketchPlugin/SketchPlugin_ShapeValidator.cpp rename to src/SketchPlugin/SketchPlugin_ExternalValidator.cpp index 0722ce1b3..7b8587188 100644 --- a/src/SketchPlugin/SketchPlugin_ShapeValidator.cpp +++ b/src/SketchPlugin/SketchPlugin_ExternalValidator.cpp @@ -4,7 +4,7 @@ // Created: 27 Feb 2015 // Author: Natalia ERMOLAEVA -#include "SketchPlugin_ShapeValidator.h" +#include "SketchPlugin_ExternalValidator.h" #include "SketchPlugin_Feature.h" #include @@ -12,7 +12,7 @@ #include #include -bool SketchPlugin_ShapeValidator::isValid(const AttributePtr& theAttribute, +bool SketchPlugin_ExternalValidator::isValid(const AttributePtr& theAttribute, const std::list& theArguments) const { if (theArguments.size() != 1) @@ -32,7 +32,7 @@ bool SketchPlugin_ShapeValidator::isValid(const AttributePtr& theAttribute, return true; } -bool SketchPlugin_ShapeValidator::isExternalAttribute(const AttributePtr& theAttribute) const +bool SketchPlugin_ExternalValidator::isExternalAttribute(const AttributePtr& theAttribute) const { bool isExternal = false; AttributeRefAttrPtr anAttribute = std::dynamic_pointer_cast(theAttribute); diff --git a/src/SketchPlugin/SketchPlugin_ShapeValidator.h b/src/SketchPlugin/SketchPlugin_ExternalValidator.h similarity index 86% rename from src/SketchPlugin/SketchPlugin_ShapeValidator.h rename to src/SketchPlugin/SketchPlugin_ExternalValidator.h index d07581ebd..62d95bfe0 100644 --- a/src/SketchPlugin/SketchPlugin_ShapeValidator.h +++ b/src/SketchPlugin/SketchPlugin_ExternalValidator.h @@ -4,8 +4,8 @@ // Created: 27 Feb 2015 // Author: Natalia ERMOLAEVA -#ifndef SketchPlugin_ShapeValidator_H -#define SketchPlugin_ShapeValidator_H +#ifndef SketchPlugin_ExternalValidator_H +#define SketchPlugin_ExternalValidator_H #include #include @@ -16,7 +16,7 @@ * * Allows to select points only. */ -class SketchPlugin_ShapeValidator : public ModelAPI_AttributeValidator +class SketchPlugin_ExternalValidator : public ModelAPI_AttributeValidator { public: /// returns true if the feature of attribute do not contain external features in the given attribute and diff --git a/src/SketchPlugin/SketchPlugin_Plugin.cpp b/src/SketchPlugin/SketchPlugin_Plugin.cpp index 04347759e..68302fee1 100644 --- a/src/SketchPlugin/SketchPlugin_Plugin.cpp +++ b/src/SketchPlugin/SketchPlugin_Plugin.cpp @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include @@ -51,15 +51,12 @@ SketchPlugin_Plugin::SketchPlugin_Plugin() ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); aFactory->registerValidator("SketchPlugin_DistanceAttr", new SketchPlugin_DistanceAttrValidator); - //aFactory->registerValidator("SketchPlugin_DifferentObjects", - // new SketchPlugin_DifferentObjectsValidator); - - aFactory->registerValidator("SketchPlugin_ShapeValidator", - new SketchPlugin_ShapeValidator); + aFactory->registerValidator("SketchPlugin_ExternalValidator", + new SketchPlugin_ExternalValidator); // register this plugin ModelAPI_Session::get()->registerPlugin(this); - + Config_PropManager::registerProp("Visualization", "sketch_entity_color", "Sketch enity color", Config_Prop::Color, SKETCH_ENTITY_COLOR); diff --git a/src/SketchPlugin/plugin-Sketch.xml b/src/SketchPlugin/plugin-Sketch.xml index f1bc36d9b..9127d418f 100644 --- a/src/SketchPlugin/plugin-Sketch.xml +++ b/src/SketchPlugin/plugin-Sketch.xml @@ -57,7 +57,7 @@ label="First object" tooltip="Select point, line end point, line, center of circle or arc." shape_types="edge vertex"> - + /> - + @@ -108,14 +108,14 @@ - + - + @@ -125,7 +125,7 @@ - + @@ -133,7 +133,7 @@ label="Last line" tooltip="Select an line" shape_types="edge"> - + -- 2.39.2