From 1c292b5bf95e18a6c8fbe407c532213e10c673c5 Mon Sep 17 00:00:00 2001 From: mpv Date: Fri, 11 Nov 2016 18:15:36 +0300 Subject: [PATCH] Put groups to the separated plugin: Collection --- CMakeCommon/Common.cmake | 25 ++ CMakeLists.txt | 32 +-- src/CollectionAPI/CMakeLists.txt | 66 +++++ src/CollectionAPI/CollectionAPI.h | 20 ++ src/CollectionAPI/CollectionAPI.i | 33 +++ .../CollectionAPI_Group.cpp} | 20 +- .../CollectionAPI_Group.h} | 40 +-- src/CollectionPlugin/CMakeLists.txt | 56 ++++ src/CollectionPlugin/CollectionPlugin.h | 20 ++ .../CollectionPlugin_Group.cpp} | 17 +- .../CollectionPlugin_Group.h} | 24 +- .../CollectionPlugin_Plugin.cpp | 29 ++ .../CollectionPlugin_Plugin.h | 29 ++ .../CollectionPlugin_msg_en.ts | 26 ++ src/CollectionPlugin/Test/TestGroup.py | 247 ++++++++++++++++++ .../group_widget.xml | 0 .../icons/shape_group.png | Bin src/CollectionPlugin/plugin-Collection.xml | 14 + src/Config/plugins.xml.in | 1 + .../ConstructionPlugin_Axis.cpp | 2 - .../ConstructionPlugin_Plugin.cpp | 4 +- src/Events/CMakeLists.txt | 4 +- src/Events/Events_Loop.cpp | 41 +-- src/ExchangePlugin/ExchangePlugin_Plugin.cpp | 4 +- src/FeaturesAPI/CMakeLists.txt | 14 +- src/FeaturesAPI/FeaturesAPI.i | 2 - src/FeaturesAPI/FeaturesAPI_swig.h | 1 - src/FeaturesPlugin/CMakeLists.txt | 4 - src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp | 7 +- src/FeaturesPlugin/FeaturesPlugin_Recover.cpp | 2 - src/FeaturesPlugin/FeaturesPlugin_msg_en.ts | 21 -- src/FeaturesPlugin/plugin-Features.xml | 6 - src/GeomAPI/GeomAPI_DataMapOfShapeShape.cpp | 2 - src/GeomAPI/GeomAPI_Pln.cpp | 2 - src/GeomData/GeomData_Dir.cpp | 2 - src/Model/Model_Application.cpp | 2 - src/Model/Model_AttributeBoolean.cpp | 2 - src/Model/Model_AttributeDocRef.cpp | 2 - src/Model/Model_AttributeRefAttr.cpp | 4 +- src/Model/Model_AttributeRefAttrList.cpp | 2 - src/Model/Model_AttributeRefList.cpp | 4 +- src/Model/Model_AttributeReference.cpp | 2 - src/Model/Model_AttributeSelection.cpp | 9 +- src/Model/Model_AttributeSelectionList.cpp | 2 - src/Model/Model_Session.cpp | 8 +- src/Model/Model_Update.cpp | 10 +- src/ModelAPI/ModelAPI_Session.cpp | 2 - src/PartSetPlugin/PartSetPlugin_Duplicate.cpp | 2 - src/PartSetPlugin/PartSetPlugin_Part.cpp | 2 - src/PartSetPlugin/PartSetPlugin_Plugin.cpp | 4 +- .../PrimitivesPlugin_Plugin.cpp | 7 +- src/PythonAPI/model/__init__.py | 1 + src/PythonAPI/model/collection/__init__.py | 4 + src/PythonAPI/model/features/__init__.py | 2 +- src/SketchPlugin/SketchPlugin_Line.cpp | 2 - src/SketchPlugin/SketchPlugin_Plugin.cpp | 4 +- src/SketchPlugin/SketchPlugin_Point.cpp | 2 - src/SketchPlugin/SketchPlugin_Sketch.cpp | 2 - 58 files changed, 668 insertions(+), 230 deletions(-) create mode 100644 src/CollectionAPI/CMakeLists.txt create mode 100644 src/CollectionAPI/CollectionAPI.h create mode 100644 src/CollectionAPI/CollectionAPI.i rename src/{FeaturesAPI/FeaturesAPI_Group.cpp => CollectionAPI/CollectionAPI_Group.cpp} (70%) rename src/{FeaturesAPI/FeaturesAPI_Group.h => CollectionAPI/CollectionAPI_Group.h} (55%) create mode 100644 src/CollectionPlugin/CMakeLists.txt create mode 100644 src/CollectionPlugin/CollectionPlugin.h rename src/{FeaturesPlugin/FeaturesPlugin_Group.cpp => CollectionPlugin/CollectionPlugin_Group.cpp} (55%) rename src/{FeaturesPlugin/FeaturesPlugin_Group.h => CollectionPlugin/CollectionPlugin_Group.h} (65%) create mode 100644 src/CollectionPlugin/CollectionPlugin_Plugin.cpp create mode 100644 src/CollectionPlugin/CollectionPlugin_Plugin.h create mode 100644 src/CollectionPlugin/CollectionPlugin_msg_en.ts create mode 100644 src/CollectionPlugin/Test/TestGroup.py rename src/{FeaturesPlugin => CollectionPlugin}/group_widget.xml (100%) rename src/{FeaturesPlugin => CollectionPlugin}/icons/shape_group.png (100%) create mode 100644 src/CollectionPlugin/plugin-Collection.xml create mode 100644 src/PythonAPI/model/collection/__init__.py diff --git a/CMakeCommon/Common.cmake b/CMakeCommon/Common.cmake index 009277a68..580e91470 100644 --- a/CMakeCommon/Common.cmake +++ b/CMakeCommon/Common.cmake @@ -13,3 +13,28 @@ IF(WIN32) ## Specific definitions: EHsc to avoid exceptions-linkage unresolved symbols ADD_DEFINITIONS(-DWIN32 -D_WINDOWS /EHsc) ENDIF(WIN32) + +IF(UNIX) + IF(CMAKE_COMPILER_IS_GNUCC) + #C++11 is not supported on some platforms, disable it + MESSAGE(STATUS "Setting -std=c++0x flag for the gcc...") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") + + #Supporting test coverage checks (gcov) in the DEBUG mode + IF(USE_TEST_COVERAGE) + INCLUDE(CodeCoverage) + MESSAGE(STATUS "Setting flags for gcov support the gcc...") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") + SET(CMAKE_SHARED_LINKER_FLAGS "-lgcov") + + SETUP_TARGET_FOR_COVERAGE(test_coverage # Name for custom target. + ctest # Name of the test driver executable that runs the tests. + coverage) # Name of output directory. + ENDIF(USE_TEST_COVERAGE) + + #SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -E") + MESSAGE(STATUS "gcc flags are: " ${CMAKE_CXX_FLAGS}) + MESSAGE(STATUS "linker flags are: " ${CMAKE_SHARED_LINKER_FLAGS}) + ENDIF(CMAKE_COMPILER_IS_GNUCC) +ENDIF(UNIX) diff --git a/CMakeLists.txt b/CMakeLists.txt index ba85cc200..7a2007df6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,31 +26,6 @@ ENDIF() # It could be called only once FIND_PACKAGE(LibXml2 REQUIRED) -IF(UNIX) - IF(CMAKE_COMPILER_IS_GNUCC) - #C++11 is not supported on some platforms, disable it - MESSAGE(STATUS "Setting -std=c++0x flag for the gcc...") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") - - #Supporting test coverage checks (gcov) in the DEBUG mode - IF(USE_TEST_COVERAGE) - INCLUDE(CodeCoverage) - MESSAGE(STATUS "Setting flags for gcov support the gcc...") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") - SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g -O0 -fprofile-arcs -ftest-coverage") - SET(CMAKE_SHARED_LINKER_FLAGS "-lgcov") - - SETUP_TARGET_FOR_COVERAGE(test_coverage # Name for custom target. - ctest # Name of the test driver executable that runs the tests. - coverage) # Name of output directory. - ENDIF(USE_TEST_COVERAGE) - - #SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -E") - MESSAGE(STATUS "gcc flags are: " ${CMAKE_CXX_FLAGS}) - MESSAGE(STATUS "linker flags are: " ${CMAKE_SHARED_LINKER_FLAGS}) - ENDIF(CMAKE_COMPILER_IS_GNUCC) -ENDIF(UNIX) - IF(${HAVE_SALOME}) SET(SHAPER_INSTALL_ADDONS bin/salome CACHE INTERNAL "" FORCE) SET(SHAPER_INSTALL_BIN lib/salome CACHE INTERNAL "" FORCE) @@ -63,6 +38,8 @@ IF(${HAVE_SALOME}) SET(SHAPER_INSTALL_XML_RESOURCES share/salome/resources/shaper CACHE INTERNAL "" FORCE) SET(SHAPER_INSTALL_GUI_DOC share/doc/salome/gui/SHAPER CACHE INTERNAL "" FORCE) SET(SHAPER_INSTALL_TUI_DOC share/doc/salome/tui/SHAPER CACHE INTERNAL "" FORCE) + # without SALOME there is another kind of documentation, separated one + ADD_SUBDIRECTORY (doc) ELSE(${HAVE_SALOME}) SET(SHAPER_INSTALL_ADDONS addons CACHE INTERNAL "" FORCE) SET(SHAPER_INSTALL_BIN bin CACHE INTERNAL "" FORCE) @@ -77,9 +54,6 @@ ELSE(${HAVE_SALOME}) SET(SHAPER_INSTALL_TUI_DOC doc CACHE INTERNAL "" FORCE) ENDIF(${HAVE_SALOME}) -#IF(CMAKE_BUILD_TYPE MATCHES Release) -ADD_SUBDIRECTORY (doc) -#ENDIF(CMAKE_BUILD_TYPE MATCHES Release) ADD_SUBDIRECTORY (src/Config) ADD_SUBDIRECTORY (src/Events) ADD_SUBDIRECTORY (src/Model) @@ -96,6 +70,7 @@ ADD_SUBDIRECTORY (src/ConstructionPlugin) ADD_SUBDIRECTORY (src/BuildPlugin) ADD_SUBDIRECTORY (src/PrimitivesPlugin) ADD_SUBDIRECTORY (src/FeaturesPlugin) +ADD_SUBDIRECTORY (src/CollectionPlugin) ADD_SUBDIRECTORY (src/SamplePanelPlugin) ADD_SUBDIRECTORY (src/SketcherPrs) ADD_SUBDIRECTORY (src/SketchPlugin) @@ -117,6 +92,7 @@ ADD_SUBDIRECTORY (src/ConnectorAPI) ADD_SUBDIRECTORY (src/ConstructionAPI) ADD_SUBDIRECTORY (src/ExchangeAPI) ADD_SUBDIRECTORY (src/FeaturesAPI) +ADD_SUBDIRECTORY (src/CollectionAPI) ADD_SUBDIRECTORY (src/ParametersAPI) ADD_SUBDIRECTORY (src/PartSetAPI) ADD_SUBDIRECTORY (src/PrimitivesAPI) diff --git a/src/CollectionAPI/CMakeLists.txt b/src/CollectionAPI/CMakeLists.txt new file mode 100644 index 000000000..9d43f619f --- /dev/null +++ b/src/CollectionAPI/CMakeLists.txt @@ -0,0 +1,66 @@ +## Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +INCLUDE(Common) + +SET(PROJECT_HEADERS + CollectionAPI.h + CollectionAPI_Group.h +) + +SET(PROJECT_SOURCES + CollectionAPI_Group.cpp +) + +SET(PROJECT_LIBRARIES + ModelAPI + ModelHighAPI +) + +INCLUDE_DIRECTORIES( + ${PROJECT_SOURCE_DIR}/src/Events + ${PROJECT_SOURCE_DIR}/src/ModelAPI + ${PROJECT_SOURCE_DIR}/src/ModelHighAPI +) + +# Plugin headers dependency +INCLUDE_DIRECTORIES( + ${PROJECT_SOURCE_DIR}/src/GeomAPI + ${PROJECT_SOURCE_DIR}/src/GeomAlgoAPI + ${PROJECT_SOURCE_DIR}/src/GeomDataAPI + ${PROJECT_SOURCE_DIR}/src/CollectionPlugin +) + +ADD_DEFINITIONS(-DCOLLECTIONAPI_EXPORTS) +ADD_LIBRARY(CollectionAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS}) +TARGET_LINK_LIBRARIES(CollectionAPI ${PROJECT_LIBRARIES}) + +# SWIG wrapper + +INCLUDE(PythonAPI) + +SET_SOURCE_FILES_PROPERTIES(CollectionAPI.i PROPERTIES CPLUSPLUS ON) +SET_SOURCE_FILES_PROPERTIES(CollectionAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow") + +SET(SWIG_LINK_LIBRARIES + CollectionAPI + ModelHighAPI + ModelAPI + ${PYTHON_LIBRARIES} +) + +SET(SWIG_MODULE_CollectionAPI_EXTRA_DEPS ${SWIG_MODULE_CollectionAPI_EXTRA_DEPS} + ${PROJECT_SOURCE_DIR}/src/ModelHighAPI/ModelHighAPI.i + doxyhelp.i + ${PROJECT_HEADERS} +) + +SWIG_ADD_MODULE(CollectionAPI python CollectionAPI.i ${PROJECT_HEADERS}) +SWIG_LINK_LIBRARIES(CollectionAPI ${SWIG_LINK_LIBRARIES}) + +IF(WIN32) + SET_TARGET_PROPERTIES(_CollectionAPI PROPERTIES DEBUG_OUTPUT_NAME _CollectionAPI_d) +ENDIF(WIN32) + +INSTALL(TARGETS _CollectionAPI DESTINATION ${SHAPER_INSTALL_SWIG}) +INSTALL(TARGETS CollectionAPI DESTINATION ${SHAPER_INSTALL_BIN}) +INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/CollectionAPI.py DESTINATION ${SHAPER_INSTALL_SWIG}) diff --git a/src/CollectionAPI/CollectionAPI.h b/src/CollectionAPI/CollectionAPI.h new file mode 100644 index 000000000..2b5ff7439 --- /dev/null +++ b/src/CollectionAPI/CollectionAPI.h @@ -0,0 +1,20 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +#ifndef COLLECTIONAPI_H +#define COLLECTIONAPI_H + +#if defined COLLECTIONAPI_EXPORTS +#if defined WIN32 +#define COLLECTIONAPI_EXPORT __declspec( dllexport ) +#else +#define COLLECTIONAPI_EXPORT +#endif +#else +#if defined WIN32 +#define COLLECTIONAPI_EXPORT __declspec( dllimport ) +#else +#define COLLECTIONAPI_EXPORT +#endif +#endif + +#endif diff --git a/src/CollectionAPI/CollectionAPI.i b/src/CollectionAPI/CollectionAPI.i new file mode 100644 index 000000000..0fbf143e0 --- /dev/null +++ b/src/CollectionAPI/CollectionAPI.i @@ -0,0 +1,33 @@ +/* CollectionAPI.i */ + +%module CollectionAPI + +%{ +#ifndef CollectionAPI_swig_H_ +#define CollectionAPI_swig_H_ + + #include + + #include "CollectionAPI.h" + #include "CollectionAPI_Group.h" + +#endif // CollectionAPI_swig_H_ +%} + +%include "doxyhelp.i" + +// import other modules +%import "ModelHighAPI.i" + +// to avoid error on this +#define COLLECTIONAPI_EXPORT + +// standard definitions +%include "typemaps.i" +%include "std_shared_ptr.i" + +// shared pointers +%shared_ptr(CollectionAPI_Group) + +// all supported interfaces +%include "CollectionAPI_Group.h" diff --git a/src/FeaturesAPI/FeaturesAPI_Group.cpp b/src/CollectionAPI/CollectionAPI_Group.cpp similarity index 70% rename from src/FeaturesAPI/FeaturesAPI_Group.cpp rename to src/CollectionAPI/CollectionAPI_Group.cpp index d12e73f45..9d9e7207b 100644 --- a/src/FeaturesAPI/FeaturesAPI_Group.cpp +++ b/src/CollectionAPI/CollectionAPI_Group.cpp @@ -1,10 +1,10 @@ // Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> -// File: FeaturesAPI_Group.cpp +// File: CollectionAPI_Group.cpp // Created: 07 June 2016 // Author: Dmitry Bobylev -#include "FeaturesAPI_Group.h" +#include "CollectionAPI_Group.h" #include #include @@ -12,14 +12,14 @@ #include //================================================================================================== -FeaturesAPI_Group::FeaturesAPI_Group(const std::shared_ptr& theFeature) +CollectionAPI_Group::CollectionAPI_Group(const std::shared_ptr& theFeature) : ModelHighAPI_Interface(theFeature) { initialize(); } //================================================================================================== -FeaturesAPI_Group::FeaturesAPI_Group(const std::shared_ptr& theFeature, +CollectionAPI_Group::CollectionAPI_Group(const std::shared_ptr& theFeature, const std::list& theGroupList) : ModelHighAPI_Interface(theFeature) { @@ -29,13 +29,13 @@ FeaturesAPI_Group::FeaturesAPI_Group(const std::shared_ptr& th } //================================================================================================== -FeaturesAPI_Group::~FeaturesAPI_Group() +CollectionAPI_Group::~CollectionAPI_Group() { } //================================================================================================== -void FeaturesAPI_Group::setGroupList(const std::list& theGroupList) +void CollectionAPI_Group::setGroupList(const std::list& theGroupList) { fillAttribute(theGroupList, mygroupList); @@ -43,12 +43,12 @@ void FeaturesAPI_Group::setGroupList(const std::list& th } //================================================================================================== -void FeaturesAPI_Group::dump(ModelHighAPI_Dumper& theDumper) const +void CollectionAPI_Group::dump(ModelHighAPI_Dumper& theDumper) const { FeaturePtr aBase = feature(); const std::string& aDocName = theDumper.name(aBase->document()); - AttributeSelectionListPtr anAttrList = aBase->selectionList(FeaturesPlugin_Group::LIST_ID()); + AttributeSelectionListPtr anAttrList = aBase->selectionList(CollectionPlugin_Group::LIST_ID()); theDumper << aBase << " = model.addGroup(" << aDocName << ", " << anAttrList << ")" << std::endl; } @@ -57,6 +57,6 @@ void FeaturesAPI_Group::dump(ModelHighAPI_Dumper& theDumper) const GroupPtr addGroup(const std::shared_ptr& thePart, const std::list& theGroupList) { - std::shared_ptr aFeature = thePart->addFeature(FeaturesAPI_Group::ID()); - return GroupPtr(new FeaturesAPI_Group(aFeature, theGroupList)); + std::shared_ptr aFeature = thePart->addFeature(CollectionAPI_Group::ID()); + return GroupPtr(new CollectionAPI_Group(aFeature, theGroupList)); } diff --git a/src/FeaturesAPI/FeaturesAPI_Group.h b/src/CollectionAPI/CollectionAPI_Group.h similarity index 55% rename from src/FeaturesAPI/FeaturesAPI_Group.h rename to src/CollectionAPI/CollectionAPI_Group.h index f4d2dd11b..0aeaa8bf2 100644 --- a/src/FeaturesAPI/FeaturesAPI_Group.h +++ b/src/CollectionAPI/CollectionAPI_Group.h @@ -1,15 +1,15 @@ // Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> -// File: FeaturesAPI_Group.h +// File: CollectionAPI_Group.h // Created: 07 June 2016 // Author: Dmitry Bobylev -#ifndef FeaturesAPI_Group_H_ -#define FeaturesAPI_Group_H_ +#ifndef CollectionAPI_Group_H_ +#define CollectionAPI_Group_H_ -#include "FeaturesAPI.h" +#include "CollectionAPI.h" -#include +#include #include #include @@ -17,45 +17,45 @@ class ModelHighAPI_Dumper; class ModelHighAPI_Selection; -/// \class FeaturesAPI_Group +/// \class CollectionAPI_Group /// \ingroup CPPHighAPI /// \brief Interface for Group feature. -class FeaturesAPI_Group: public ModelHighAPI_Interface +class CollectionAPI_Group: public ModelHighAPI_Interface { public: /// Constructor without values. - FEATURESAPI_EXPORT - explicit FeaturesAPI_Group(const std::shared_ptr& theFeature); + COLLECTIONAPI_EXPORT + explicit CollectionAPI_Group(const std::shared_ptr& theFeature); /// Constructor with values. - FEATURESAPI_EXPORT - FeaturesAPI_Group(const std::shared_ptr& theFeature, + COLLECTIONAPI_EXPORT + CollectionAPI_Group(const std::shared_ptr& theFeature, const std::list& theGroupList); /// Destructor. - FEATURESAPI_EXPORT - virtual ~FeaturesAPI_Group(); + COLLECTIONAPI_EXPORT + virtual ~CollectionAPI_Group(); - INTERFACE_1(FeaturesPlugin_Group::ID(), - groupList, FeaturesPlugin_Group::LIST_ID(), + INTERFACE_1(CollectionPlugin_Group::ID(), + groupList, CollectionPlugin_Group::LIST_ID(), ModelAPI_AttributeSelectionList, /** Group list*/) /// Set main objects. - FEATURESAPI_EXPORT + COLLECTIONAPI_EXPORT void setGroupList(const std::list& theGroupList); /// Dump wrapped feature - FEATURESAPI_EXPORT + COLLECTIONAPI_EXPORT virtual void dump(ModelHighAPI_Dumper& theDumper) const; }; /// Pointer on Group object. -typedef std::shared_ptr GroupPtr; +typedef std::shared_ptr GroupPtr; /// \ingroup CPPHighAPI /// \brief Create Group feature. -FEATURESAPI_EXPORT +COLLECTIONAPI_EXPORT GroupPtr addGroup(const std::shared_ptr& thePart, const std::list& theGroupList); -#endif // FeaturesAPI_Group_H_ +#endif // CollectionAPI_Group_H_ diff --git a/src/CollectionPlugin/CMakeLists.txt b/src/CollectionPlugin/CMakeLists.txt new file mode 100644 index 000000000..c9acd7da1 --- /dev/null +++ b/src/CollectionPlugin/CMakeLists.txt @@ -0,0 +1,56 @@ +## Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> + +INCLUDE(Common) +INCLUDE(UnitTest) + +SET(PROJECT_HEADERS + CollectionPlugin.h + CollectionPlugin_Plugin.h + CollectionPlugin_Group.h +) + +SET(PROJECT_SOURCES + CollectionPlugin_Plugin.cpp + CollectionPlugin_Group.cpp +) + +SET(XML_RESOURCES + plugin-Collection.xml + group_widget.xml +) + +SET(TEXT_RESOURCES + CollectionPlugin_msg_en.ts +) + +SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES}) + + +INCLUDE_DIRECTORIES( + ../ModelAPI + ../GeomAPI + ../GeomAlgoAPI + ../GeomValidators + ../Events +) + +SET(PROJECT_LIBRARIES + Events + ModelAPI + GeomAPI + GeomAlgoAPI + GeomValidators +) + +ADD_DEFINITIONS(-DCOLLECTIONPLUGIN_EXPORTS) +ADD_LIBRARY(CollectionPlugin MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${XML_RESOURCES} ${TEXT_RESOURCES}) +TARGET_LINK_LIBRARIES(CollectionPlugin ${PROJECT_LIBRARIES}) + +INSTALL(TARGETS CollectionPlugin DESTINATION ${SHAPER_INSTALL_PLUGIN_FILES}) +INSTALL(FILES ${XML_RESOURCES} DESTINATION ${SHAPER_INSTALL_XML_RESOURCES}) +INSTALL(DIRECTORY icons/ DESTINATION ${SHAPER_INSTALL_XML_RESOURCES}/icons/Collection) +INSTALL(FILES ${TEXT_RESOURCES} DESTINATION ${SHAPER_INSTALL_XML_RESOURCES}) + +ADD_UNIT_TESTS( + TestGroup.py +) diff --git a/src/CollectionPlugin/CollectionPlugin.h b/src/CollectionPlugin/CollectionPlugin.h new file mode 100644 index 000000000..61e4d7129 --- /dev/null +++ b/src/CollectionPlugin/CollectionPlugin.h @@ -0,0 +1,20 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> + +#ifndef COLLECTIONPLUGIN_H +#define COLLECTIONPLUGIN_H + +#if defined COLLECTIONPLUGIN_EXPORTS +#if defined WIN32 +#define COLLECTIONPLUGIN_EXPORT __declspec( dllexport ) +#else +#define COLLECTIONPLUGIN_EXPORT +#endif +#else +#if defined WIN32 +#define COLLECTIONPLUGIN_EXPORT __declspec( dllimport ) +#else +#define COLLECTIONPLUGIN_EXPORT +#endif +#endif + +#endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Group.cpp b/src/CollectionPlugin/CollectionPlugin_Group.cpp similarity index 55% rename from src/FeaturesPlugin/FeaturesPlugin_Group.cpp rename to src/CollectionPlugin/CollectionPlugin_Group.cpp index 182a1d74c..c62b7d0d9 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Group.cpp +++ b/src/CollectionPlugin/CollectionPlugin_Group.cpp @@ -1,10 +1,10 @@ // Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> -// File: FeaturesPlugin_Group.cpp +// File: CollectionPlugin_Group.cpp // Created: 08 Oct 2014 // Author: Sergey BELASH -#include "FeaturesPlugin_Group.h" +#include "CollectionPlugin_Group.h" #include #include @@ -13,20 +13,17 @@ #include #include - -using namespace std; - -FeaturesPlugin_Group::FeaturesPlugin_Group() +CollectionPlugin_Group::CollectionPlugin_Group() { } -void FeaturesPlugin_Group::initAttributes() +void CollectionPlugin_Group::initAttributes() { - //data()->addAttribute(FeaturesPlugin_Group::NAME_ID(), ModelAPI_AttributeString::typeId()); - data()->addAttribute(FeaturesPlugin_Group::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); + //data()->addAttribute(CollectionPlugin_Group::NAME_ID(), ModelAPI_AttributeString::typeId()); + data()->addAttribute(CollectionPlugin_Group::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); } -void FeaturesPlugin_Group::execute() +void CollectionPlugin_Group::execute() { if (results().empty() || firstResult()->isDisabled()) { // just create result if not exists ResultPtr aGroup = document()->createGroup(data()); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Group.h b/src/CollectionPlugin/CollectionPlugin_Group.h similarity index 65% rename from src/FeaturesPlugin/FeaturesPlugin_Group.h rename to src/CollectionPlugin/CollectionPlugin_Group.h index 50f82339a..b569ebfd6 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Group.h +++ b/src/CollectionPlugin/CollectionPlugin_Group.h @@ -1,24 +1,24 @@ // Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> -// File: FeaturesPlugin_Group.h +// File: CollectionPlugin_Group.h // Created: 08 Oct 2014 // Author: Sergey BELASH -#ifndef FEATURESPLUGIN_GROUP_H_ -#define FEATURESPLUGIN_GROUP_H_ +#ifndef COLLECTIONPLUGIN_GROUP_H_ +#define COLLECTIONPLUGIN_GROUP_H_ -#include "FeaturesPlugin.h" +#include "CollectionPlugin.h" #include #include -/**\class FeaturesPlugin_Group +/**\class CollectionPlugin_Group * \ingroup Plugins * \brief Feature for selection of sub-shapes of some shapes. * * All selected sub-shapes must be of equal type (vertex, edge, face, etc) but may * be selected on different objects. */ -class FeaturesPlugin_Group : public ModelAPI_Feature +class CollectionPlugin_Group : public ModelAPI_Feature { public: /// Extrusion kind @@ -35,23 +35,23 @@ class FeaturesPlugin_Group : public ModelAPI_Feature } /// Returns the kind of a feature - FEATURESPLUGIN_EXPORT virtual const std::string& getKind() + COLLECTIONPLUGIN_EXPORT virtual const std::string& getKind() { - static std::string MY_KIND = FeaturesPlugin_Group::ID(); + static std::string MY_KIND = CollectionPlugin_Group::ID(); return MY_KIND; } /// Creates a new part document if needed - FEATURESPLUGIN_EXPORT virtual void execute(); + COLLECTIONPLUGIN_EXPORT virtual void execute(); /// Request for initialization of data model of the feature: adding all attributes - FEATURESPLUGIN_EXPORT virtual void initAttributes(); + COLLECTIONPLUGIN_EXPORT virtual void initAttributes(); /// Result of groups is created on the fly and don't stored to the document - FEATURESPLUGIN_EXPORT virtual bool isPersistentResult() {return true;} + COLLECTIONPLUGIN_EXPORT virtual bool isPersistentResult() {return true;} /// Use plugin manager for features creation - FeaturesPlugin_Group(); + CollectionPlugin_Group(); }; diff --git a/src/CollectionPlugin/CollectionPlugin_Plugin.cpp b/src/CollectionPlugin/CollectionPlugin_Plugin.cpp new file mode 100644 index 000000000..87c0dda93 --- /dev/null +++ b/src/CollectionPlugin/CollectionPlugin_Plugin.cpp @@ -0,0 +1,29 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> + +#include + +#include +#include + +#include +#include + +// the only created instance of this plugin +static CollectionPlugin_Plugin* MY_COLLECTION_INSTANCE = new CollectionPlugin_Plugin(); + +CollectionPlugin_Plugin::CollectionPlugin_Plugin() +{ + SessionPtr aMgr = ModelAPI_Session::get(); + // register this plugin + ModelAPI_Session::get()->registerPlugin(this); +} + +FeaturePtr CollectionPlugin_Plugin::createFeature(std::string theFeatureID) +{ + if (theFeatureID == CollectionPlugin_Group::ID()) { + return FeaturePtr(new CollectionPlugin_Group); + } + + // feature of such kind is not found + return FeaturePtr(); +} diff --git a/src/CollectionPlugin/CollectionPlugin_Plugin.h b/src/CollectionPlugin/CollectionPlugin_Plugin.h new file mode 100644 index 000000000..383fe5989 --- /dev/null +++ b/src/CollectionPlugin/CollectionPlugin_Plugin.h @@ -0,0 +1,29 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> + +// File: CollectionPlugin_Plugin.hxx +// Created: 07 July 2014 +// Author: Vitaly SMETANNIKOV + +#ifndef CollectionPlugin_Plugin_H_ +#define CollectionPlugin_Plugin_H_ + +#include "CollectionPlugin.h" +#include +#include + +/**\class CollectionPlugin_Plugin + * \ingroup Plugins + * \brief The main class for management the 3D features as plugin. + */ +class COLLECTIONPLUGIN_EXPORT CollectionPlugin_Plugin : public ModelAPI_Plugin +{ + public: + /// Creates the feature object of this plugin by the feature string ID + virtual FeaturePtr createFeature(std::string theFeatureID); + + public: + /// Default constructor + CollectionPlugin_Plugin(); +}; + +#endif diff --git a/src/CollectionPlugin/CollectionPlugin_msg_en.ts b/src/CollectionPlugin/CollectionPlugin_msg_en.ts new file mode 100644 index 000000000..4e73b5b4a --- /dev/null +++ b/src/CollectionPlugin/CollectionPlugin_msg_en.ts @@ -0,0 +1,26 @@ + + + + + + Group + + group_list - GeomValidators_BodyShapes: Error: Context is empty. + Selected object has empty context. + + + group_list - GeomValidators_BodyShapes: Error: Result construction selected. + Constructions not allowed for selection. + + + group_list - GeomValidators_BodyShapes: Error: Attribute \"%1\" does not supported by this validator. + Attribute "%1" does not supported by "GeomValidators_BodyShapes" validator. + + + + Model_FeatureValidator: Attribute "group_list" is not initialized. + Objects not selected. + + + + diff --git a/src/CollectionPlugin/Test/TestGroup.py b/src/CollectionPlugin/Test/TestGroup.py new file mode 100644 index 000000000..139d41208 --- /dev/null +++ b/src/CollectionPlugin/Test/TestGroup.py @@ -0,0 +1,247 @@ +""" + TestBoolean.py + Unit test of FeaturesPlugin_Group class + + class FeaturesPlugin_Group + static const std::string MY_GROUP_ID("Group"); + static const std::string MY_GROUP_LIST_ID("group_list"); + + data()->addAttribute(FeaturesPlugin_Group::LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); +""" +#========================================================================= +# Initialization of the test +#========================================================================= +from ModelAPI import * +from GeomDataAPI import * +from GeomAlgoAPI import * +from GeomAPI import * + +__updated__ = "2014-12-16" + +aSession = ModelAPI_Session.get() +# Create a part for extrusions & boolean +aSession.startOperation() +aPartFeature = aSession.moduleDocument().addFeature("Part") +aSession.finishOperation() +aPart = aSession.activeDocument() +#========================================================================= +# Create a sketch with triangle and extrude it +#========================================================================= +aSession.startOperation() +aTriangleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) +origin = geomDataAPI_Point(aTriangleSketchFeature.attribute("Origin")) +origin.setValue(0, 0, 0) +dirx = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirX")) +dirx.setValue(1, 0, 0) +norm = geomDataAPI_Dir(aTriangleSketchFeature.attribute("Norm")) +norm.setValue(0, 0, 1) +aSketchLineA = aTriangleSketchFeature.addFeature("SketchLine") +aSketchLineB = aTriangleSketchFeature.addFeature("SketchLine") +aSketchLineC = aTriangleSketchFeature.addFeature("SketchLine") +aLineAStartPoint = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint")) +aLineAEndPoint = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint")) +aLineBStartPoint = geomDataAPI_Point2D(aSketchLineB.attribute("StartPoint")) +aLineBEndPoint = geomDataAPI_Point2D(aSketchLineB.attribute("EndPoint")) +aLineCStartPoint = geomDataAPI_Point2D(aSketchLineC.attribute("StartPoint")) +aLineCEndPoint = geomDataAPI_Point2D(aSketchLineC.attribute("EndPoint")) +aLineAStartPoint.setValue(-100., 0.) +aLineAEndPoint.setValue(100., 0.) +aLineBStartPoint.setValue(100., 0.) +aLineBEndPoint.setValue(0., 173.2) +aLineCStartPoint.setValue(0., 173.2) +aLineCEndPoint.setValue(-100., 0.) +aSession.finishOperation() +# Build sketch faces +aSession.startOperation() +aSketchResult = aTriangleSketchFeature.firstResult() +aSketchEdges = modelAPI_ResultConstruction(aSketchResult).shape() +origin = geomDataAPI_Point(aTriangleSketchFeature.attribute("Origin")).pnt() +dirX = geomDataAPI_Dir(aTriangleSketchFeature.attribute("DirX")).dir() +norm = geomDataAPI_Dir(aTriangleSketchFeature.attribute("Norm")).dir() +aSketchFaces = ShapeList() +GeomAlgoAPI_SketchBuilder.createFaces(origin, dirX, norm, aSketchEdges, aSketchFaces) +# Create extrusion on them +anExtrusionFt = aPart.addFeature("Extrusion") +anExtrusionFt.selectionList("base").append(aSketchResult, aSketchFaces[0]) +anExtrusionFt.string("CreationMethod").setValue("BySizes") +anExtrusionFt.real("to_size").setValue(50) +anExtrusionFt.real("from_size").setValue(50) +anExtrusionFt.real("to_offset").setValue(0) #TODO: remove +anExtrusionFt.real("from_offset").setValue(0) #TODO: remove +anExtrusionFt.execute() +aSession.finishOperation() +anExtrusionBody = modelAPI_ResultBody(anExtrusionFt.firstResult()) +#========================================================================= +# Create group of vertex +#========================================================================= +aSession.startOperation() +aGroupFeature = aSession.activeDocument().addFeature("Group") +aSelectionListAttr = aGroupFeature.selectionList("group_list") +aSelectionListAttr.setSelectionType("vertex") +aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1") +aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1_1") +aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1") +aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1_1") +aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1_1") +aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1_1") +aSession.finishOperation() +#========================================================================= +# Check results +#========================================================================= +assert(aSelectionListAttr.size() == 6) +aGroupResult = aGroupFeature.firstResult() +assert(aGroupResult) +#========================================================================= +# Create group of edges +#========================================================================= +aSession.startOperation() +aGroupFeature = aSession.activeDocument().addFeature("Group") +aSelectionListAttr = aGroupFeature.selectionList("group_list") +aSelectionListAttr.setSelectionType("edge") +aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/Generated_Face_1") +aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_2") +aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/Generated_Face_1") +aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/From_Face_1_1") +aSelectionListAttr.append("Extrusion_1_1/Generated_Face_1&Extrusion_1_1/To_Face_1_1") +aSelectionListAttr.append("Extrusion_1_1/Generated_Face_1&Extrusion_1_1/From_Face_1_1") +aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/To_Face_1_1") +aSelectionListAttr.append("Extrusion_1_1/Generated_Face_2&Extrusion_1_1/From_Face_1_1") +aSelectionListAttr.append("Extrusion_1_1/Generated_Face_3&Extrusion_1_1/To_Face_1_1") +aSession.finishOperation() +#========================================================================= +# Check results +#========================================================================= +assert(aSelectionListAttr.size() == 9) +aGroupResult = aGroupFeature.firstResult() +assert(aGroupResult) +#========================================================================= +# Create group of faces +#========================================================================= +aSession.startOperation() +aGroupFeature = aSession.activeDocument().addFeature("Group") +aSelectionListAttr = aGroupFeature.selectionList("group_list") +aSelectionListAttr.setSelectionType("face") +aShapeExplorer = GeomAPI_ShapeExplorer(anExtrusionBody.shape(), GeomAPI_Shape.FACE) +while aShapeExplorer.more(): + aSelectionListAttr.append(anExtrusionBody, aShapeExplorer.current()) + aShapeExplorer.next(); +aSession.finishOperation() +#========================================================================= +# Check results +#========================================================================= +assert(aSelectionListAttr.size() == 5) +aGroupResult = aGroupFeature.firstResult() +assert(aGroupResult) +#========================================================================= +# Create group of solids +#========================================================================= +aSession.startOperation() +aGroupFeature = aSession.activeDocument().addFeature("Group") +aSelectionListAttr = aGroupFeature.selectionList("group_list") +aSelectionListAttr.setSelectionType("face") +aSelectionListAttr.append(anExtrusionBody, None) +aSession.finishOperation() +#========================================================================= +# Check results +#========================================================================= +assert(aSelectionListAttr.size() == 1) +aGroupResult = aGroupFeature.firstResult() +assert(aGroupResult) + +#========================================================================= +# Create group of face +#========================================================================= +aSession.startOperation() +aGroupFeature = aSession.activeDocument().addFeature("Group") +aSelectionListAttr = aGroupFeature.selectionList("group_list") +aSelectionListAttr.setSelectionType("face") +aSelectionListAttr.append("Extrusion_1_1/To_Face_1_1") +aSession.finishOperation() +#========================================================================= +# Check results +#========================================================================= +assert(aSelectionListAttr.size() == 1) +aGroupResult = aGroupFeature.firstResult() +assert(aGroupResult) + +#========================================================================= +# Create a sketch circle to extrude +#========================================================================= +aSession.startOperation() +aCircleSketchFeature = featureToCompositeFeature(aPart.addFeature("Sketch")) +origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")) +origin.setValue(0, 0, 0) +dirx = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")) +dirx.setValue(1, 0, 0) +norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")) +norm.setValue(0, 0, 1) +# Create circle +aSketchCircle = aCircleSketchFeature.addFeature("SketchCircle") +anCircleCentr = geomDataAPI_Point2D(aSketchCircle.attribute("CircleCenter")) +aCircleRadius = aSketchCircle.real("CircleRadius") +anCircleCentr.setValue(0., 57.74) +aCircleRadius.setValue(50.) +aSession.finishOperation() +#========================================================================= +# Make extrusion on circle +#========================================================================= +# Build shape from sketcher results +aCircleSketchResult = aCircleSketchFeature.firstResult() +aCircleSketchEdges = modelAPI_ResultConstruction(aCircleSketchResult).shape() +origin = geomDataAPI_Point(aCircleSketchFeature.attribute("Origin")).pnt() +dirX = geomDataAPI_Dir(aCircleSketchFeature.attribute("DirX")).dir() +norm = geomDataAPI_Dir(aCircleSketchFeature.attribute("Norm")).dir() +aCircleSketchFaces = ShapeList() +GeomAlgoAPI_SketchBuilder.createFaces(origin, dirX, norm, aCircleSketchEdges, aCircleSketchFaces) +assert(len(aCircleSketchFaces) > 0) +assert(aCircleSketchFaces[0] is not None) +# Create extrusion +aSession.startOperation() +anExtrusionFt = aPart.addFeature("Extrusion") +assert (anExtrusionFt.getKind() == "Extrusion") +# selection type FACE=4 +anExtrusionFt.selectionList("base").append(aCircleSketchResult, aCircleSketchFaces[0]) +anExtrusionFt.string("CreationMethod").setValue("BySizes") +anExtrusionFt.real("to_size").setValue(50) +anExtrusionFt.real("from_size").setValue(50) +anExtrusionFt.real("to_offset").setValue(0) #TODO: remove +anExtrusionFt.real("from_offset").setValue(0) #TODO: remove +anExtrusionFt.execute() +aSession.finishOperation() +aCylinderBody = modelAPI_ResultBody(anExtrusionFt.firstResult()) + +#========================================================================= +# Create a cut +#========================================================================= +aSession.startOperation() +aBooleanFt = aPart.addFeature("Boolean") +aBooleanFt.selectionList("main_objects").append(anExtrusionBody, None) +aBooleanFt.selectionList("tool_objects").append(aCylinderBody, None) +aBooleanTypeCut = 0 +aBooleanFt.integer("bool_type").setValue(aBooleanTypeCut) +aBooleanFt.execute() +aSession.finishOperation() + +#========================================================================= +# Move group feature +#========================================================================= +aSession.startOperation() +aPart.moveFeature(aGroupFeature, aBooleanFt) +aSession.finishOperation() + +#========================================================================= +# Check results +#========================================================================= +aFactory = ModelAPI_Session.get().validators() +assert(aFactory.validate(aGroupFeature)) +assert(aSelectionListAttr.size() == 1) +assert(len(aGroupFeature.results()) > 0) +aGroupResult = aGroupFeature.firstResult() +assert(aGroupResult) +assert(aGroupResult.shape()) +#========================================================================= +# End of test +#========================================================================= + +import model +assert(model.checkPythonDump()) diff --git a/src/FeaturesPlugin/group_widget.xml b/src/CollectionPlugin/group_widget.xml similarity index 100% rename from src/FeaturesPlugin/group_widget.xml rename to src/CollectionPlugin/group_widget.xml diff --git a/src/FeaturesPlugin/icons/shape_group.png b/src/CollectionPlugin/icons/shape_group.png similarity index 100% rename from src/FeaturesPlugin/icons/shape_group.png rename to src/CollectionPlugin/icons/shape_group.png diff --git a/src/CollectionPlugin/plugin-Collection.xml b/src/CollectionPlugin/plugin-Collection.xml new file mode 100644 index 000000000..09bc12beb --- /dev/null +++ b/src/CollectionPlugin/plugin-Collection.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + diff --git a/src/Config/plugins.xml.in b/src/Config/plugins.xml.in index 54a02fdff..9f654a7b0 100644 --- a/src/Config/plugins.xml.in +++ b/src/Config/plugins.xml.in @@ -9,6 +9,7 @@ + diff --git a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp index 2f504c2c5..13e7e9562 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Axis.cpp @@ -31,8 +31,6 @@ #include #endif -using namespace std; - static const double defaultAxisSize = 100; ConstructionPlugin_Axis::ConstructionPlugin_Axis() diff --git a/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp b/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp index 40c016f50..4c20ecd89 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Plugin.cpp @@ -11,8 +11,6 @@ #include #include -using namespace std; - // the only created instance of this plugin static ConstructionPlugin_Plugin* MY_CONSTRUCTION_INSTANCE = new ConstructionPlugin_Plugin(); @@ -42,7 +40,7 @@ ConstructionPlugin_Plugin::ConstructionPlugin_Plugin() Config_Prop::Color, ConstructionPlugin_Plane::DEFAULT_COLOR()); } -FeaturePtr ConstructionPlugin_Plugin::createFeature(string theFeatureID) +FeaturePtr ConstructionPlugin_Plugin::createFeature(std::string theFeatureID) { if (theFeatureID == ConstructionPlugin_Point::ID()) { return FeaturePtr(new ConstructionPlugin_Point); diff --git a/src/Events/CMakeLists.txt b/src/Events/CMakeLists.txt index 5982c15de..a51b4ecbd 100644 --- a/src/Events/CMakeLists.txt +++ b/src/Events/CMakeLists.txt @@ -12,7 +12,7 @@ SET(PROJECT_HEADERS Events_Listener.h Events_Loop.h Events_LongOp.h - Events_InfoMessage.h + Events_InfoMessage.h ) SET(PROJECT_SOURCES @@ -21,7 +21,7 @@ SET(PROJECT_SOURCES Events_Listener.cpp Events_Loop.cpp Events_LongOp.cpp - Events_InfoMessage.cpp + Events_InfoMessage.cpp ) ADD_DEFINITIONS(-DEVENTS_EXPORTS) diff --git a/src/Events/Events_Loop.cpp b/src/Events/Events_Loop.cpp index eaaf57be8..cd2e65f92 100644 --- a/src/Events/Events_Loop.cpp +++ b/src/Events/Events_Loop.cpp @@ -10,8 +10,6 @@ #include #include -using namespace std; - Events_Loop* Events_Loop::loop() { // initialized on initialization of the application @@ -22,10 +20,10 @@ Events_Loop* Events_Loop::loop() Events_ID Events_Loop::eventByName(const char* theName) { ///! All events created in this session, uniquely identified by the text and char pointer - static map CREATED_EVENTS; + static std::map CREATED_EVENTS; char* aResult; - string aName(theName); - map::iterator aFound = CREATED_EVENTS.find(aName); + std::string aName(theName); + std::map::iterator aFound = CREATED_EVENTS.find(aName); if (aFound == CREATED_EVENTS.end()) { //not created yet #ifdef WIN32 aResult = _strdup(theName); // copy to make unique internal pointer @@ -42,7 +40,8 @@ Events_ID Events_Loop::eventByName(const char* theName) void Events_Loop::sendProcessEvent(const std::shared_ptr& theMessage, std::list& theListeners, const bool theFlushedNow) { - for (list::iterator aL = theListeners.begin(); aL != theListeners.end(); aL++) { + std::list::iterator aL = theListeners.begin(); + for (; aL != theListeners.end(); aL++) { if (theFlushedNow && (*aL)->groupMessages()) { (*aL)->groupWhileFlush(theMessage); } else { @@ -75,10 +74,10 @@ void Events_Loop::send(const std::shared_ptr& theMessage, bool i } } // send - map > >::iterator aFindID = myListeners.find( - theMessage->eventID().eventText()); + std::map > >::iterator aFindID = + myListeners.find(theMessage->eventID().eventText()); if (aFindID != myListeners.end()) { - map >::iterator aFindSender = aFindID->second.find( + std::map >::iterator aFindSender = aFindID->second.find( theMessage->sender()); if (aFindSender != aFindID->second.end()) { sendProcessEvent(theMessage, aFindSender->second, isFlushedNow && isGroup); @@ -99,21 +98,22 @@ void Events_Loop::registerListener(Events_Listener* theListener, const Events_ID myImmediateListeners[theID.eventText()] = theListener; return; } - map > >::iterator aFindID = myListeners.find( - theID.eventText()); + std::map > >::iterator aFindID = + myListeners.find(theID.eventText()); if (aFindID == myListeners.end()) { // create container associated with ID - myListeners[theID.eventText()] = map >(); + myListeners[theID.eventText()] = std::map >(); aFindID = myListeners.find(theID.eventText()); } - map >::iterator aFindSender = aFindID->second.find(theSender); + std::map >::iterator aFindSender = + aFindID->second.find(theSender); if (aFindSender == aFindID->second.end()) { // create container associated with sender - aFindID->second[theSender] = list(); + aFindID->second[theSender] = std::list(); aFindSender = aFindID->second.find(theSender); } // check that listener was not registered wit hsuch parameters before - list& aListeners = aFindSender->second; - for (list::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++) + std::list& aListeners = aFindSender->second; + for (std::list::iterator aL = aListeners.begin(); aL != aListeners.end(); aL++) if (*aL == theListener) return; // avoid duplicates @@ -191,12 +191,13 @@ void Events_Loop::flush(const Events_ID& theID) } } // send accumulated messages to "groupListeners" - map > >::iterator aFindID = myListeners.find( - theID.eventText()); + std::map > >::iterator aFindID = + myListeners.find(theID.eventText()); if (aFindID != myListeners.end()) { - map >::iterator aFindSender = aFindID->second.begin(); + std::map >::iterator aFindSender = + aFindID->second.begin(); for(; aFindSender != aFindID->second.end(); aFindSender++) { - list::iterator aListener = aFindSender->second.begin(); + std::list::iterator aListener = aFindSender->second.begin(); for(; aListener != aFindSender->second.end(); aListener++) { if ((*aListener)->groupMessages()) { (*aListener)->flushGrouped(theID); diff --git a/src/ExchangePlugin/ExchangePlugin_Plugin.cpp b/src/ExchangePlugin/ExchangePlugin_Plugin.cpp index af3018145..08dcb202b 100644 --- a/src/ExchangePlugin/ExchangePlugin_Plugin.cpp +++ b/src/ExchangePlugin/ExchangePlugin_Plugin.cpp @@ -17,8 +17,6 @@ #include -using namespace std; - // the only created instance of this plugin static ExchangePlugin_Plugin* MY_EXCHANGE_INSTANCE = new ExchangePlugin_Plugin(); @@ -34,7 +32,7 @@ ExchangePlugin_Plugin::ExchangePlugin_Plugin() new ExchangePlugin_ExportFormatValidator); } -FeaturePtr ExchangePlugin_Plugin::createFeature(string theFeatureID) +FeaturePtr ExchangePlugin_Plugin::createFeature(std::string theFeatureID) { if (theFeatureID == ExchangePlugin_ImportFeature::ID()) { return FeaturePtr(new ExchangePlugin_ImportFeature); diff --git a/src/FeaturesAPI/CMakeLists.txt b/src/FeaturesAPI/CMakeLists.txt index 70ea1166d..3f4e5fe9a 100644 --- a/src/FeaturesAPI/CMakeLists.txt +++ b/src/FeaturesAPI/CMakeLists.txt @@ -7,7 +7,6 @@ SET(PROJECT_HEADERS FeaturesAPI_Boolean.h FeaturesAPI_Extrusion.h FeaturesAPI_ExtrusionBoolean.h - FeaturesAPI_Group.h FeaturesAPI_Intersection.h FeaturesAPI_Partition.h FeaturesAPI_Pipe.h @@ -25,7 +24,6 @@ SET(PROJECT_SOURCES FeaturesAPI_Boolean.cpp FeaturesAPI_Extrusion.cpp FeaturesAPI_ExtrusionBoolean.cpp - FeaturesAPI_Group.cpp FeaturesAPI_Intersection.cpp FeaturesAPI_Partition.cpp FeaturesAPI_Pipe.cpp @@ -58,8 +56,7 @@ INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR}/src/FeaturesPlugin ) -#TODO(spo): is ${CAS_DEFINITIONS} necessary? -ADD_DEFINITIONS(-DFEATURESAPI_EXPORTS ${CAS_DEFINITIONS}) +ADD_DEFINITIONS(-DFEATURESAPI_EXPORTS) ADD_LIBRARY(FeaturesAPI SHARED ${PROJECT_SOURCES} ${PROJECT_HEADERS}) TARGET_LINK_LIBRARIES(FeaturesAPI ${PROJECT_LIBRARIES}) @@ -70,7 +67,6 @@ INCLUDE(PythonAPI) SET_SOURCE_FILES_PROPERTIES(FeaturesAPI.i PROPERTIES CPLUSPLUS ON) SET_SOURCE_FILES_PROPERTIES(FeaturesAPI.i PROPERTIES SWIG_DEFINITIONS "-shadow") -#TODO(spo): is ModelAPI necessary or it could be received by INTERFACE_ (may require modern CMake)? SET(SWIG_LINK_LIBRARIES FeaturesAPI ModelHighAPI @@ -94,11 +90,3 @@ ENDIF(WIN32) INSTALL(TARGETS _FeaturesAPI DESTINATION ${SHAPER_INSTALL_SWIG}) INSTALL(TARGETS FeaturesAPI DESTINATION ${SHAPER_INSTALL_BIN}) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/FeaturesAPI.py DESTINATION ${SHAPER_INSTALL_SWIG}) - -# Tests -INCLUDE(UnitTest) - -ADD_UNIT_TESTS( -) - -# ADD_SUBDIRECTORY (Test) diff --git a/src/FeaturesAPI/FeaturesAPI.i b/src/FeaturesAPI/FeaturesAPI.i index cc7cbdd54..7a8a55628 100644 --- a/src/FeaturesAPI/FeaturesAPI.i +++ b/src/FeaturesAPI/FeaturesAPI.i @@ -24,7 +24,6 @@ %shared_ptr(FeaturesAPI_ExtrusionBoolean) %shared_ptr(FeaturesAPI_ExtrusionCut) %shared_ptr(FeaturesAPI_ExtrusionFuse) -%shared_ptr(FeaturesAPI_Group) %shared_ptr(FeaturesAPI_Intersection) %shared_ptr(FeaturesAPI_Partition) %shared_ptr(FeaturesAPI_Pipe) @@ -43,7 +42,6 @@ %include "FeaturesAPI_Boolean.h" %include "FeaturesAPI_Extrusion.h" %include "FeaturesAPI_ExtrusionBoolean.h" -%include "FeaturesAPI_Group.h" %include "FeaturesAPI_Intersection.h" %include "FeaturesAPI_Partition.h" %include "FeaturesAPI_Pipe.h" diff --git a/src/FeaturesAPI/FeaturesAPI_swig.h b/src/FeaturesAPI/FeaturesAPI_swig.h index 8fff1a42b..6e25cbad6 100644 --- a/src/FeaturesAPI/FeaturesAPI_swig.h +++ b/src/FeaturesAPI/FeaturesAPI_swig.h @@ -13,7 +13,6 @@ #include "FeaturesAPI_Boolean.h" #include "FeaturesAPI_Extrusion.h" #include "FeaturesAPI_ExtrusionBoolean.h" - #include "FeaturesAPI_Group.h" #include "FeaturesAPI_Intersection.h" #include "FeaturesAPI_Partition.h" #include "FeaturesAPI_Pipe.h" diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index 61eddab92..34a303c08 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -12,7 +12,6 @@ SET(PROJECT_HEADERS FeaturesPlugin_Rotation.h FeaturesPlugin_Translation.h FeaturesPlugin_Boolean.h - FeaturesPlugin_Group.h FeaturesPlugin_Intersection.h FeaturesPlugin_Partition.h FeaturesPlugin_Pipe.h @@ -39,7 +38,6 @@ SET(PROJECT_SOURCES FeaturesPlugin_Rotation.cpp FeaturesPlugin_Translation.cpp FeaturesPlugin_Boolean.cpp - FeaturesPlugin_Group.cpp FeaturesPlugin_Intersection.cpp FeaturesPlugin_Partition.cpp FeaturesPlugin_Pipe.cpp @@ -69,7 +67,6 @@ SET(XML_RESOURCES rotation_widget.xml translation_widget.xml boolean_widget.xml - group_widget.xml recover_widget.xml partition_widget.xml placement_widget.xml @@ -128,7 +125,6 @@ ADD_UNIT_TESTS(TestExtrusion.py TestBooleanFill.py TestMultiBoolean.py TestSerialBoolean.py - TestGroup.py TestIntersection.py TestUnion.py TestRemoveSubShapes.py diff --git a/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp b/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp index c4049c0e2..a602a866f 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp @@ -6,7 +6,6 @@ #include #include #include -#include #include #include #include @@ -28,8 +27,6 @@ #include -using namespace std; - // the only created instance of this plugin static FeaturesPlugin_Plugin* MY_FEATURES_INSTANCE = new FeaturesPlugin_Plugin(); @@ -68,7 +65,7 @@ FeaturesPlugin_Plugin::FeaturesPlugin_Plugin() ModelAPI_Session::get()->registerPlugin(this); } -FeaturePtr FeaturesPlugin_Plugin::createFeature(string theFeatureID) +FeaturePtr FeaturesPlugin_Plugin::createFeature(std::string theFeatureID) { if (theFeatureID == FeaturesPlugin_Extrusion::ID()) { return FeaturePtr(new FeaturesPlugin_Extrusion); @@ -80,8 +77,6 @@ FeaturePtr FeaturesPlugin_Plugin::createFeature(string theFeatureID) return FeaturePtr(new FeaturesPlugin_Translation); } else if (theFeatureID == FeaturesPlugin_Boolean::ID()) { return FeaturePtr(new FeaturesPlugin_Boolean); - } else if (theFeatureID == FeaturesPlugin_Group::ID()) { - return FeaturePtr(new FeaturesPlugin_Group); } else if (theFeatureID == FeaturesPlugin_Intersection::ID()) { return FeaturePtr(new FeaturesPlugin_Intersection); } else if (theFeatureID == FeaturesPlugin_Partition::ID()) { diff --git a/src/FeaturesPlugin/FeaturesPlugin_Recover.cpp b/src/FeaturesPlugin/FeaturesPlugin_Recover.cpp index 59a2526ca..e521c3a29 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Recover.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Recover.cpp @@ -16,8 +16,6 @@ #include #include -using namespace std; - FeaturesPlugin_Recover::FeaturesPlugin_Recover() { } diff --git a/src/FeaturesPlugin/FeaturesPlugin_msg_en.ts b/src/FeaturesPlugin/FeaturesPlugin_msg_en.ts index fc2a2a3ca..eaf0e9ff7 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_msg_en.ts +++ b/src/FeaturesPlugin/FeaturesPlugin_msg_en.ts @@ -2165,27 +2165,6 @@ - - Group - - group_list - GeomValidators_BodyShapes: Error: Context is empty. - Selected object has empty context. - - - group_list - GeomValidators_BodyShapes: Error: Result construction selected. - Constructions not allowed for selection. - - - group_list - GeomValidators_BodyShapes: Error: Attribute \"%1\" does not supported by this validator. - Attribute "%1" does not supported by "GeomValidators_BodyShapes" validator. - - - - Model_FeatureValidator: Attribute "group_list" is not initialized. - Objects not selected. - - - Union diff --git a/src/FeaturesPlugin/plugin-Features.xml b/src/FeaturesPlugin/plugin-Features.xml index cd08911d6..b7f98d6ae 100644 --- a/src/FeaturesPlugin/plugin-Features.xml +++ b/src/FeaturesPlugin/plugin-Features.xml @@ -49,12 +49,6 @@ - - - #include #include -using namespace std; - GeomAPI_DataMapOfShapeShape::GeomAPI_DataMapOfShapeShape() : GeomAPI_Interface(new TopTools_DataMapOfShapeShape){} diff --git a/src/GeomAPI/GeomAPI_Pln.cpp b/src/GeomAPI/GeomAPI_Pln.cpp index ba5960e87..3f3e44a7e 100644 --- a/src/GeomAPI/GeomAPI_Pln.cpp +++ b/src/GeomAPI/GeomAPI_Pln.cpp @@ -15,8 +15,6 @@ #include -using namespace std; - GeomAPI_Pln::GeomAPI_Pln(const std::shared_ptr& theAxis) : GeomAPI_Interface(new gp_Ax3(theAxis->impl())) { diff --git a/src/GeomData/GeomData_Dir.cpp b/src/GeomData/GeomData_Dir.cpp index 477a89c20..b1378d171 100644 --- a/src/GeomData/GeomData_Dir.cpp +++ b/src/GeomData/GeomData_Dir.cpp @@ -11,8 +11,6 @@ #include #include -using namespace std; - void GeomData_Dir::setValue(const double theX, const double theY, const double theZ) { if (!myIsInitialized || myCoords->Value(0) != theX || myCoords->Value(1) != theY diff --git a/src/Model/Model_Application.cpp b/src/Model/Model_Application.cpp index 87b6894d3..287989715 100644 --- a/src/Model/Model_Application.cpp +++ b/src/Model/Model_Application.cpp @@ -19,8 +19,6 @@ static bool FirstCall = true; IMPLEMENT_STANDARD_HANDLE(Model_Application, TDocStd_Application) IMPLEMENT_STANDARD_RTTIEXT(Model_Application, TDocStd_Application) -using namespace std; - static Handle_Model_Application TheApplication = new Model_Application; //======================================================================= diff --git a/src/Model/Model_AttributeBoolean.cpp b/src/Model/Model_AttributeBoolean.cpp index d576a8870..f7111f127 100644 --- a/src/Model/Model_AttributeBoolean.cpp +++ b/src/Model/Model_AttributeBoolean.cpp @@ -8,8 +8,6 @@ #include #include -using namespace std; - void Model_AttributeBoolean::setValue(bool theValue) { Standard_Boolean aValue = theValue ? Standard_True : Standard_False; diff --git a/src/Model/Model_AttributeDocRef.cpp b/src/Model/Model_AttributeDocRef.cpp index a2aef9d7d..30d978752 100644 --- a/src/Model/Model_AttributeDocRef.cpp +++ b/src/Model/Model_AttributeDocRef.cpp @@ -9,8 +9,6 @@ #include #include -using namespace std; - void Model_AttributeDocRef::setValue(std::shared_ptr theDoc) { if (myID->Get() != theDoc->id()) { diff --git a/src/Model/Model_AttributeRefAttr.cpp b/src/Model/Model_AttributeRefAttr.cpp index 6456b68a8..034620126 100644 --- a/src/Model/Model_AttributeRefAttr.cpp +++ b/src/Model/Model_AttributeRefAttr.cpp @@ -10,8 +10,6 @@ #include "Model_Objects.h" #include -using namespace std; - bool Model_AttributeRefAttr::isObject() { return myID->Get().Length() == 0; @@ -21,7 +19,7 @@ void Model_AttributeRefAttr::setAttr(std::shared_ptr theAttr { std::shared_ptr aData = std::dynamic_pointer_cast( theAttr->owner()->data()); - string anID = aData->id(theAttr); + std::string anID = aData->id(theAttr); if (myIsInitialized && object() == theAttr->owner() && myID->Get().IsEqual(anID.c_str())) return; // nothing is changed REMOVE_BACK_REF(theAttr->owner()); diff --git a/src/Model/Model_AttributeRefAttrList.cpp b/src/Model/Model_AttributeRefAttrList.cpp index 7da878e87..d743f05aa 100755 --- a/src/Model/Model_AttributeRefAttrList.cpp +++ b/src/Model/Model_AttributeRefAttrList.cpp @@ -12,8 +12,6 @@ #include #include -using namespace std; - void Model_AttributeRefAttrList::append(ObjectPtr theObject) { std::shared_ptr aData = std::dynamic_pointer_cast(theObject->data()); diff --git a/src/Model/Model_AttributeRefList.cpp b/src/Model/Model_AttributeRefList.cpp index 388c4dfd5..7179ef11f 100644 --- a/src/Model/Model_AttributeRefList.cpp +++ b/src/Model/Model_AttributeRefList.cpp @@ -13,8 +13,6 @@ #include #include -using namespace std; - void Model_AttributeRefList::append(ObjectPtr theObject) { if (owner()->document() == theObject->document()) { @@ -163,7 +161,7 @@ ObjectPtr Model_AttributeRefList::iteratedObject(TDF_ListIteratorOfLabelList& th return anObj; } -list Model_AttributeRefList::list() +std::list Model_AttributeRefList::list() { std::list aResult; std::shared_ptr aDoc = std::dynamic_pointer_cast( diff --git a/src/Model/Model_AttributeReference.cpp b/src/Model/Model_AttributeReference.cpp index 4d08bb209..55c645b45 100644 --- a/src/Model/Model_AttributeReference.cpp +++ b/src/Model/Model_AttributeReference.cpp @@ -16,8 +16,6 @@ #include #include -using namespace std; - void Model_AttributeReference::setValue(ObjectPtr theObject) { // now allow to deselect in this attribute: extrusion from/to diff --git a/src/Model/Model_AttributeSelection.cpp b/src/Model/Model_AttributeSelection.cpp index 3dadaf30b..2fdb15e68 100644 --- a/src/Model/Model_AttributeSelection.cpp +++ b/src/Model/Model_AttributeSelection.cpp @@ -61,7 +61,6 @@ #include #include -using namespace std; //#define DEB_NAMING 1 #ifdef DEB_NAMING #include @@ -230,8 +229,8 @@ std::shared_ptr Model_AttributeSelection::value() if (selectionLabel().FindAttribute(TDataStd_Name::GetID(), aName)) { std::string aSubShapeName(TCollection_AsciiString(aName->Get()).ToCString()); std::size_t aPartEnd = aSubShapeName.find('/'); - if (aPartEnd != string::npos && aPartEnd != aSubShapeName.rfind('/')) { - string aNameInPart = aSubShapeName.substr(aPartEnd + 1); + if (aPartEnd != std::string::npos && aPartEnd != aSubShapeName.rfind('/')) { + std::string aNameInPart = aSubShapeName.substr(aPartEnd + 1); int anIndex; std::string aType; // to reuse already existing selection the type is not needed return aPart->shapeInPart(aNameInPart, aType, anIndex); @@ -957,12 +956,12 @@ void Model_AttributeSelection::selectSubShape( // check this is Part-name: 2 delimiters in the name std::size_t aPartEnd = theSubShapeName.find('/'); - if (aPartEnd != string::npos && aPartEnd != theSubShapeName.rfind('/')) { + if (aPartEnd != std::string::npos && aPartEnd != theSubShapeName.rfind('/')) { std::string aPartName = theSubShapeName.substr(0, aPartEnd); ObjectPtr aFound = owner()->document()->objectByName(ModelAPI_ResultPart::group(), aPartName); if (aFound.get()) { // found such part, so asking it for the name ResultPartPtr aPart = std::dynamic_pointer_cast(aFound); - string aNameInPart = theSubShapeName.substr(aPartEnd + 1); + std::string aNameInPart = theSubShapeName.substr(aPartEnd + 1); int anIndex; std::shared_ptr aSelected = aPart->shapeInPart(aNameInPart, theType, anIndex); if (aSelected.get()) { diff --git a/src/Model/Model_AttributeSelectionList.cpp b/src/Model/Model_AttributeSelectionList.cpp index aa9ff1cc0..a6d25f7ad 100644 --- a/src/Model/Model_AttributeSelectionList.cpp +++ b/src/Model/Model_AttributeSelectionList.cpp @@ -22,8 +22,6 @@ #include #include -using namespace std; - void Model_AttributeSelectionList::append( const ResultPtr& theContext, const std::shared_ptr& theSubShape, const bool theTemporarily) diff --git a/src/Model/Model_Session.cpp b/src/Model/Model_Session.cpp index 75cb32ee0..790664f05 100644 --- a/src/Model/Model_Session.cpp +++ b/src/Model/Model_Session.cpp @@ -29,8 +29,6 @@ #include #include -using namespace std; - static Model_Session* myImpl = new Model_Session(); // t oredirect all calls to the root document @@ -144,7 +142,7 @@ std::list Model_Session::redoList() return ROOT_DOC->redoList(); } -FeaturePtr Model_Session::createFeature(string theFeatureID, Model_Document* theDocOwner) +FeaturePtr Model_Session::createFeature(std::string theFeatureID, Model_Document* theDocOwner) { if (this != myImpl) { return myImpl->createFeature(theFeatureID, theDocOwner); @@ -292,10 +290,10 @@ void Model_Session::setActiveDocument( std::list > Model_Session::allOpenedDocuments() { - list > aResult; + std::list > aResult; aResult.push_back(moduleDocument()); // add subs recursively - list >::iterator aDoc = aResult.begin(); + std::list >::iterator aDoc = aResult.begin(); for(; aDoc != aResult.end(); aDoc++) { DocumentPtr anAPIDoc = *aDoc; std::shared_ptr aDoc = std::dynamic_pointer_cast(anAPIDoc); diff --git a/src/Model/Model_Update.cpp b/src/Model/Model_Update.cpp index 31160251c..6efd1b1a7 100755 --- a/src/Model/Model_Update.cpp +++ b/src/Model/Model_Update.cpp @@ -31,8 +31,6 @@ #include #include -using namespace std; - Model_Update MY_UPDATER_INSTANCE; /// the only one instance initialized on load of the library //#define DEB_UPDATE @@ -719,9 +717,9 @@ void Model_Update::updateArguments(FeaturePtr theFeature) { } } // update the selection attributes if any - list aRefs = + std::list aRefs = theFeature->data()->attributes(ModelAPI_AttributeSelection::typeId()); - list::iterator aRefsIter = aRefs.begin(); + std::list::iterator aRefsIter = aRefs.begin(); for (; aRefsIter != aRefs.end(); aRefsIter++) { std::shared_ptr aSel = std::dynamic_pointer_cast(*aRefsIter); @@ -900,9 +898,9 @@ void Model_Update::updateSelection(const std::set >::iterator anObj = theObjects.begin(); for(; anObj != theObjects.end(); anObj++) { - list aRefs = + std::list aRefs = (*anObj)->data()->attributes(ModelAPI_AttributeSelection::typeId()); - list::iterator aRefsIter = aRefs.begin(); + std::list::iterator aRefsIter = aRefs.begin(); for (; aRefsIter != aRefs.end(); aRefsIter++) { std::shared_ptr aSel = std::dynamic_pointer_cast(*aRefsIter); diff --git a/src/ModelAPI/ModelAPI_Session.cpp b/src/ModelAPI/ModelAPI_Session.cpp index 11f3df4c2..fba142217 100644 --- a/src/ModelAPI/ModelAPI_Session.cpp +++ b/src/ModelAPI/ModelAPI_Session.cpp @@ -37,8 +37,6 @@ #include #endif -using namespace std; - #ifdef _DEBUG #include #endif diff --git a/src/PartSetPlugin/PartSetPlugin_Duplicate.cpp b/src/PartSetPlugin/PartSetPlugin_Duplicate.cpp index 7b3e303d7..4e900e8c4 100644 --- a/src/PartSetPlugin/PartSetPlugin_Duplicate.cpp +++ b/src/PartSetPlugin/PartSetPlugin_Duplicate.cpp @@ -13,8 +13,6 @@ #include #include -using namespace std; - void PartSetPlugin_Duplicate::execute() { std::shared_ptr aPManager = ModelAPI_Session::get(); diff --git a/src/PartSetPlugin/PartSetPlugin_Part.cpp b/src/PartSetPlugin/PartSetPlugin_Part.cpp index c40a0eadf..9c358dd7f 100644 --- a/src/PartSetPlugin/PartSetPlugin_Part.cpp +++ b/src/PartSetPlugin/PartSetPlugin_Part.cpp @@ -12,8 +12,6 @@ #include #include -using namespace std; - PartSetPlugin_Part::PartSetPlugin_Part() { } diff --git a/src/PartSetPlugin/PartSetPlugin_Plugin.cpp b/src/PartSetPlugin/PartSetPlugin_Plugin.cpp index f892c57a7..9794e3a38 100644 --- a/src/PartSetPlugin/PartSetPlugin_Plugin.cpp +++ b/src/PartSetPlugin/PartSetPlugin_Plugin.cpp @@ -14,8 +14,6 @@ #include #endif -using namespace std; - // the only created instance of this plugin static PartSetPlugin_Plugin* MY_PARTSET_INSTANCE = new PartSetPlugin_Plugin(); @@ -25,7 +23,7 @@ PartSetPlugin_Plugin::PartSetPlugin_Plugin() ModelAPI_Session::get()->registerPlugin(this); } -FeaturePtr PartSetPlugin_Plugin::createFeature(string theFeatureID) +FeaturePtr PartSetPlugin_Plugin::createFeature(std::string theFeatureID) { if (theFeatureID == PartSetPlugin_Part::ID()) { return FeaturePtr(new PartSetPlugin_Part); diff --git a/src/PrimitivesPlugin/PrimitivesPlugin_Plugin.cpp b/src/PrimitivesPlugin/PrimitivesPlugin_Plugin.cpp index b4281ea41..bf3e1716c 100644 --- a/src/PrimitivesPlugin/PrimitivesPlugin_Plugin.cpp +++ b/src/PrimitivesPlugin/PrimitivesPlugin_Plugin.cpp @@ -7,17 +7,12 @@ #include #include - #include #include - #include - #include -using namespace std; - // the only created instance of this plugin static PrimitivesPlugin_Plugin* MY_PRIMITIVES_INSTANCE = new PrimitivesPlugin_Plugin(); @@ -27,7 +22,7 @@ PrimitivesPlugin_Plugin::PrimitivesPlugin_Plugin() ModelAPI_Session::get()->registerPlugin(this); } -FeaturePtr PrimitivesPlugin_Plugin::createFeature(string theFeatureID) +FeaturePtr PrimitivesPlugin_Plugin::createFeature(std::string theFeatureID) { if (theFeatureID == PrimitivesPlugin_Box::ID()) { return FeaturePtr(new PrimitivesPlugin_Box); diff --git a/src/PythonAPI/model/__init__.py b/src/PythonAPI/model/__init__.py index fc24671cd..4330709c2 100644 --- a/src/PythonAPI/model/__init__.py +++ b/src/PythonAPI/model/__init__.py @@ -19,6 +19,7 @@ from connection import * from construction import * from exchange import * from features import * +from collection import * from parameter import * from partset import * from primitives import * diff --git a/src/PythonAPI/model/collection/__init__.py b/src/PythonAPI/model/collection/__init__.py new file mode 100644 index 000000000..4189aac10 --- /dev/null +++ b/src/PythonAPI/model/collection/__init__.py @@ -0,0 +1,4 @@ +"""Package for Collection plugin for the Parametric Geometry API of the Modeler. +""" + +from CollectionAPI import addGroup diff --git a/src/PythonAPI/model/features/__init__.py b/src/PythonAPI/model/features/__init__.py index f0b317407..90c7d95fc 100644 --- a/src/PythonAPI/model/features/__init__.py +++ b/src/PythonAPI/model/features/__init__.py @@ -7,4 +7,4 @@ from FeaturesAPI import addRevolution, addRevolutionCut, addRevolutionFuse from FeaturesAPI import addPipe from FeaturesAPI import addCut, addFuse, addCommon, addSmash, addFill from FeaturesAPI import addIntersection, addPartition, addUnion, addRemoveSubShapes -from FeaturesAPI import addGroup, addRecover +from FeaturesAPI import addRecover diff --git a/src/SketchPlugin/SketchPlugin_Line.cpp b/src/SketchPlugin/SketchPlugin_Line.cpp index 553d1f2e0..10e1ed235 100644 --- a/src/SketchPlugin/SketchPlugin_Line.cpp +++ b/src/SketchPlugin/SketchPlugin_Line.cpp @@ -21,8 +21,6 @@ #include #include -using namespace std; - SketchPlugin_Line::SketchPlugin_Line() : SketchPlugin_SketchEntity() {} diff --git a/src/SketchPlugin/SketchPlugin_Plugin.cpp b/src/SketchPlugin/SketchPlugin_Plugin.cpp index e69e107b3..2c6c5772f 100644 --- a/src/SketchPlugin/SketchPlugin_Plugin.cpp +++ b/src/SketchPlugin/SketchPlugin_Plugin.cpp @@ -48,8 +48,6 @@ //#define SET_PLANES_COLOR_IN_PREFERENCES -using namespace std; - // the only created instance of this plugin static SketchPlugin_Plugin* MY_SKETCH_INSTANCE = new SketchPlugin_Plugin(); @@ -122,7 +120,7 @@ SketchPlugin_Plugin::SketchPlugin_Plugin() #endif } -FeaturePtr SketchPlugin_Plugin::createFeature(string theFeatureID) +FeaturePtr SketchPlugin_Plugin::createFeature(std::string theFeatureID) { if (theFeatureID == SketchPlugin_Sketch::ID()) { return FeaturePtr(new SketchPlugin_Sketch); diff --git a/src/SketchPlugin/SketchPlugin_Point.cpp b/src/SketchPlugin/SketchPlugin_Point.cpp index 94027d674..2bfe7e60a 100644 --- a/src/SketchPlugin/SketchPlugin_Point.cpp +++ b/src/SketchPlugin/SketchPlugin_Point.cpp @@ -18,8 +18,6 @@ #include #include -using namespace std; - SketchPlugin_Point::SketchPlugin_Point() : SketchPlugin_SketchEntity() { diff --git a/src/SketchPlugin/SketchPlugin_Sketch.cpp b/src/SketchPlugin/SketchPlugin_Sketch.cpp index ca6011196..4de9585ee 100755 --- a/src/SketchPlugin/SketchPlugin_Sketch.cpp +++ b/src/SketchPlugin/SketchPlugin_Sketch.cpp @@ -39,8 +39,6 @@ #include #include -using namespace std; - SketchPlugin_Sketch::SketchPlugin_Sketch() { } -- 2.39.2