From: spo Date: Wed, 28 Oct 2015 11:30:06 +0000 (+0300) Subject: Move GeomValidator_* registration from PartSet_Module to GeomValidator_Plugin X-Git-Tag: V_2.1.0~206^2~50 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b06589a45eb833587e122b52d3e9366735d3918d;p=modules%2Fshaper.git Move GeomValidator_* registration from PartSet_Module to GeomValidator_Plugin --- diff --git a/src/GeomValidators/CMakeLists.txt b/src/GeomValidators/CMakeLists.txt index 2450cf38c..c9768eb39 100644 --- a/src/GeomValidators/CMakeLists.txt +++ b/src/GeomValidators/CMakeLists.txt @@ -10,6 +10,7 @@ SET(PROJECT_HEADERS GeomValidators_Face.h GeomValidators_Finite.h GeomValidators_PartitionArguments.h + GeomValidators_Plugin.h GeomValidators_Positive.h GeomValidators_ShapeType.h GeomValidators_Tools.h @@ -24,6 +25,7 @@ SET(PROJECT_SOURCES GeomValidators_Face.cpp GeomValidators_Finite.cpp GeomValidators_PartitionArguments.cpp + GeomValidators_Plugin.cpp GeomValidators_Positive.cpp GeomValidators_ShapeType.cpp GeomValidators_Tools.cpp diff --git a/src/GeomValidators/GeomValidators_Plugin.cpp b/src/GeomValidators/GeomValidators_Plugin.cpp new file mode 100644 index 000000000..e8f8574a1 --- /dev/null +++ b/src/GeomValidators/GeomValidators_Plugin.cpp @@ -0,0 +1,45 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +// the only created instance of this plugin +static GeomValidators_Plugin* MY_GEOMVALIDATORS_INSTANCE = new GeomValidators_Plugin(); + +GeomValidators_Plugin::GeomValidators_Plugin() +{ + // register validators + SessionPtr aMgr = ModelAPI_Session::get(); + ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); + + aFactory->registerValidator("GeomValidators_BooleanArguments", new GeomValidators_BooleanArguments); + aFactory->registerValidator("GeomValidators_ConstructionComposite", new GeomValidators_ConstructionComposite); + aFactory->registerValidator("GeomValidators_Different", new GeomValidators_Different); + aFactory->registerValidator("GeomValidators_DifferentShapes", new GeomValidators_DifferentShapes); + aFactory->registerValidator("GeomValidators_Face", new GeomValidators_Face); + aFactory->registerValidator("GeomValidators_Finite", new GeomValidators_Finite); + aFactory->registerValidator("GeomValidators_PartitionArguments", new GeomValidators_PartitionArguments); + aFactory->registerValidator("GeomValidators_ShapeType", new GeomValidators_ShapeType); + aFactory->registerValidator("GeomValidators_ZeroOffset", new GeomValidators_ZeroOffset); + + // register this plugin + ModelAPI_Session::get()->registerPlugin(this); +} + +FeaturePtr GeomValidators_Plugin::createFeature(std::string theFeatureID) +{ + // feature of such kind is not found + return FeaturePtr(); +} diff --git a/src/GeomValidators/GeomValidators_Plugin.h b/src/GeomValidators/GeomValidators_Plugin.h new file mode 100644 index 000000000..3c428d96f --- /dev/null +++ b/src/GeomValidators/GeomValidators_Plugin.h @@ -0,0 +1,28 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> + +// File: GeomValidators_Plugin.h +// Created: 28 Oct 2015 +// Author: Sergey POKHODENKO + +#ifndef GEOMVALIDATORS_PLUGIN_H_ +#define GEOMVALIDATORS_PLUGIN_H_ + +#include +#include +#include + +/**\class GeomValidators_Plugin + * \ingroup Plugins + * \brief Interface common for any plugin: allows to use plugin by the plugins manager. + */ +class GEOMVALIDATORS_EXPORT GeomValidators_Plugin : public ModelAPI_Plugin +{ +public: + /// Creates the feature object of this plugin by the feature string ID + virtual FeaturePtr createFeature(std::string theFeatureID); + +public: + GeomValidators_Plugin(); +}; + +#endif diff --git a/src/PartSet/CMakeLists.txt b/src/PartSet/CMakeLists.txt index 388a735fb..3aac9e0af 100644 --- a/src/PartSet/CMakeLists.txt +++ b/src/PartSet/CMakeLists.txt @@ -115,7 +115,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/XGUI ${CMAKE_SOURCE_DIR}/src/GeomValidators ${CMAKE_SOURCE_DIR}/src/AppElements ${CAS_INCLUDE_DIRS} - ${SUIT_INCLUDE} + ${SUIT_INCLUDE} ) ADD_DEFINITIONS(-DPARTSET_EXPORTS ${CAS_DEFINITIONS}) diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 67f1bcf7a..a4582e35a 100755 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -35,22 +35,11 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include - - #include #include #include #include #include -#include #include #include @@ -207,29 +196,7 @@ void PartSet_Module::registerValidators() aFactory->registerValidator("PartSet_AngleSelection", new PartSet_AngleSelection); aFactory->registerValidator("PartSet_DifferentObjects", new PartSet_DifferentObjectsValidator); aFactory->registerValidator("PartSet_CoincidentAttr", new PartSet_CoincidentAttr); - - aFactory->registerValidator("GeomValidators_DifferentShapes", new GeomValidators_DifferentShapes); - aFactory->registerValidator("GeomValidators_ShapeType", new GeomValidators_ShapeType); - aFactory->registerValidator("GeomValidators_Face", new GeomValidators_Face); - aFactory->registerValidator("GeomValidators_Finite", new GeomValidators_Finite); - - aFactory->registerValidator("GeomValidators_ConstructionComposite", - new GeomValidators_ConstructionComposite); - - aFactory->registerValidator("GeomValidators_ZeroOffset", - new GeomValidators_ZeroOffset); - - aFactory->registerValidator("GeomValidators_BooleanArguments", - new GeomValidators_BooleanArguments); - - aFactory->registerValidator("PartSet_SketchEntityValidator", - new PartSet_SketchEntityValidator); - - aFactory->registerValidator("GeomValidators_Different", - new GeomValidators_Different); - - aFactory->registerValidator("GeomValidators_PartitionArguments", - new GeomValidators_PartitionArguments); + aFactory->registerValidator("PartSet_SketchEntityValidator", new PartSet_SketchEntityValidator); } void PartSet_Module::registerFilters()