From 5b8fa78e63d347bac69123804a3475ddc9ecfd9a Mon Sep 17 00:00:00 2001 From: nds Date: Tue, 16 Feb 2016 16:11:28 +0300 Subject: [PATCH] SketchShapePlugin package is removed as not used. --- CMakeLists.txt | 1 - src/SketchShapePlugin/CMakeLists.txt | 62 --------- src/SketchShapePlugin/SketchShapePlugin.h | 20 --- .../SketchShapePlugin_Feature.cpp | 75 ---------- .../SketchShapePlugin_Feature.h | 102 -------------- .../SketchShapePlugin_PageGroupBox.cpp | 18 --- .../SketchShapePlugin_PageGroupBox.h | 32 ----- .../SketchShapePlugin_Plugin.cpp | 54 -------- .../SketchShapePlugin_Plugin.h | 35 ----- .../SketchShapePlugin_Tools.cpp | 11 -- .../SketchShapePlugin_Tools.h | 15 -- .../SketchShapePlugin_Validators.cpp | 21 --- .../SketchShapePlugin_Validators.h | 31 ----- .../SketchShapePlugin_WidgetCheckGroupBox.cpp | 32 ----- .../SketchShapePlugin_WidgetCheckGroupBox.h | 33 ----- .../SketchShapePlugin_WidgetCreator.cpp | 62 --------- .../SketchShapePlugin_WidgetCreator.h | 60 -------- .../SketchShapePlugin_WidgetMultiSelector.cpp | 37 ----- .../SketchShapePlugin_WidgetMultiSelector.h | 36 ----- src/SketchShapePlugin/Test/TestSketchShape.py | 129 ------------------ src/SketchShapePlugin/plugin-SketchShape.xml | 49 ------- 21 files changed, 915 deletions(-) delete mode 100755 src/SketchShapePlugin/CMakeLists.txt delete mode 100755 src/SketchShapePlugin/SketchShapePlugin.h delete mode 100755 src/SketchShapePlugin/SketchShapePlugin_Feature.cpp delete mode 100755 src/SketchShapePlugin/SketchShapePlugin_Feature.h delete mode 100755 src/SketchShapePlugin/SketchShapePlugin_PageGroupBox.cpp delete mode 100755 src/SketchShapePlugin/SketchShapePlugin_PageGroupBox.h delete mode 100755 src/SketchShapePlugin/SketchShapePlugin_Plugin.cpp delete mode 100755 src/SketchShapePlugin/SketchShapePlugin_Plugin.h delete mode 100755 src/SketchShapePlugin/SketchShapePlugin_Tools.cpp delete mode 100755 src/SketchShapePlugin/SketchShapePlugin_Tools.h delete mode 100755 src/SketchShapePlugin/SketchShapePlugin_Validators.cpp delete mode 100755 src/SketchShapePlugin/SketchShapePlugin_Validators.h delete mode 100755 src/SketchShapePlugin/SketchShapePlugin_WidgetCheckGroupBox.cpp delete mode 100755 src/SketchShapePlugin/SketchShapePlugin_WidgetCheckGroupBox.h delete mode 100755 src/SketchShapePlugin/SketchShapePlugin_WidgetCreator.cpp delete mode 100755 src/SketchShapePlugin/SketchShapePlugin_WidgetCreator.h delete mode 100755 src/SketchShapePlugin/SketchShapePlugin_WidgetMultiSelector.cpp delete mode 100755 src/SketchShapePlugin/SketchShapePlugin_WidgetMultiSelector.h delete mode 100755 src/SketchShapePlugin/Test/TestSketchShape.py delete mode 100755 src/SketchShapePlugin/plugin-SketchShape.xml diff --git a/CMakeLists.txt b/CMakeLists.txt index 53d9986e9..baa6160a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,7 +55,6 @@ ADD_SUBDIRECTORY (src/ConstructionPlugin) ADD_SUBDIRECTORY (src/FeaturesPlugin) ADD_SUBDIRECTORY (src/SketcherPrs) ADD_SUBDIRECTORY (src/SketchPlugin) -ADD_SUBDIRECTORY (src/SketchShapePlugin) ADD_SUBDIRECTORY (src/SketchSolver) ADD_SUBDIRECTORY (src/ModuleBase) ADD_SUBDIRECTORY (src/PartSet) diff --git a/src/SketchShapePlugin/CMakeLists.txt b/src/SketchShapePlugin/CMakeLists.txt deleted file mode 100755 index f2516cd65..000000000 --- a/src/SketchShapePlugin/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -## Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -INCLUDE(Common) -INCLUDE(UnitTest) - -SET(PROJECT_HEADERS - SketchShapePlugin.h - SketchShapePlugin_Feature.h - SketchShapePlugin_PageGroupBox.h - SketchShapePlugin_Plugin.h - SketchShapePlugin_Validators.h - SketchShapePlugin_Tools.h - SketchShapePlugin_WidgetCheckGroupBox.h - SketchShapePlugin_WidgetCreator.h - SketchShapePlugin_WidgetMultiSelector.h -) - -SET(PROJECT_SOURCES - SketchShapePlugin_Feature.cpp - SketchShapePlugin_PageGroupBox.cpp - SketchShapePlugin_Plugin.cpp - SketchShapePlugin_Validators.cpp - SketchShapePlugin_Tools.cpp - SketchShapePlugin_WidgetCheckGroupBox.cpp - SketchShapePlugin_WidgetCreator.cpp - SketchShapePlugin_WidgetMultiSelector.cpp -) - -SET(PROJECT_LIBRARIES - Config - GeomAPI - GeomAlgoAPI - ModelAPI - GeomDataAPI - ModuleBase - ${QT_LIBRARIES} -) - -SET(XML_RESOURCES - plugin-SketchShape.xml -) - -ADD_DEFINITIONS(-DSKETCHSHAPEPLUGIN_EXPORTS -DWNT) -ADD_LIBRARY(SketchShapePlugin MODULE ${PROJECT_SOURCES} ${PROJECT_HEADERS} ${XML_RESOURCES}) -TARGET_LINK_LIBRARIES(SketchShapePlugin ${PROJECT_LIBRARIES}) - -INCLUDE_DIRECTORIES( - ../Config - ../Events - ../ModelAPI - ../GeomAPI - ../GeomAlgoAPI - ../GeomDataAPI - ../ModuleBase - ${SUIT_INCLUDE} - ${CAS_INCLUDE_DIRS} -) - -INSTALL(TARGETS SketchShapePlugin DESTINATION plugins) -INSTALL(FILES ${XML_RESOURCES} DESTINATION plugins) - -ADD_UNIT_TESTS(TestSketchShape.py) diff --git a/src/SketchShapePlugin/SketchShapePlugin.h b/src/SketchShapePlugin/SketchShapePlugin.h deleted file mode 100755 index e5afe35f0..000000000 --- a/src/SketchShapePlugin/SketchShapePlugin.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -#ifndef SKETCHSHAPEPLUGIN_H -#define SKETCHSHAPEPLUGIN_H - -#if defined SKETCHSHAPEPLUGIN_EXPORTS -#if defined WIN32 -#define SKETCHSHAPEPLUGIN_EXPORT __declspec( dllexport ) -#else -#define SKETCHSHAPEPLUGIN_EXPORT -#endif -#else -#if defined WIN32 -#define SKETCHSHAPEPLUGIN_EXPORT __declspec( dllimport ) -#else -#define SKETCHSHAPEPLUGIN_EXPORT -#endif -#endif - -#endif diff --git a/src/SketchShapePlugin/SketchShapePlugin_Feature.cpp b/src/SketchShapePlugin/SketchShapePlugin_Feature.cpp deleted file mode 100755 index 4de0c8de3..000000000 --- a/src/SketchShapePlugin/SketchShapePlugin_Feature.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: SketchShapePlugin_Feature.cpp -// Created: 25 Nov 2015 -// Author: Natalia ERMOLAEVA - -#include "SketchShapePlugin_Feature.h" - -#include -#include -#include - -#include -#include - -SketchShapePlugin_Feature::SketchShapePlugin_Feature() -: ModelAPI_Feature() -{ -} - -void SketchShapePlugin_Feature::initAttributes() -{ - data()->addAttribute(SKETCH_ID(), ModelAPI_AttributeSelection::typeId()); - - data()->addAttribute(VERTEX_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); - data()->addAttribute(VERTEX_CHOICE_ID(), ModelAPI_AttributeBoolean::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), VERTEX_CHOICE_ID()); - - data()->addAttribute(EDGE_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); - data()->addAttribute(EDGE_CHOICE_ID(), ModelAPI_AttributeBoolean::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), EDGE_CHOICE_ID()); - - data()->addAttribute(FACE_LIST_ID(), ModelAPI_AttributeSelectionList::typeId()); - data()->addAttribute(FACE_CHOICE_ID(), ModelAPI_AttributeBoolean::typeId()); - ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FACE_CHOICE_ID()); -} - -void SketchShapePlugin_Feature::execute() -{ -} - -void SketchShapePlugin_Feature::attributeChanged(const std::string& theID) -{ - if (theID == VERTEX_CHOICE_ID() || - theID == EDGE_CHOICE_ID() || - theID == FACE_CHOICE_ID()) { - std::string aListAttrId = theID == VERTEX_CHOICE_ID() ? VERTEX_LIST_ID() : ( - theID == EDGE_CHOICE_ID() ? EDGE_LIST_ID() : - FACE_LIST_ID()); - - AttributeBooleanPtr aChoiceAttribute = std::dynamic_pointer_cast( - data()->attribute(theID)); - if (!aChoiceAttribute->value()) { - AttributeSelectionListPtr aListAttribute = - std::dynamic_pointer_cast(data()->attribute(aListAttrId)); - aListAttribute->clear(); - } - } - else if (theID == VERTEX_LIST_ID() || - theID == EDGE_LIST_ID() || - theID == FACE_LIST_ID()) { - AttributeSelectionListPtr aSelectionListAttr = - std::dynamic_pointer_cast(data()->attribute(theID)); - for (int i = 0, aSize = aSelectionListAttr->size(); i < aSize; i++) { - AttributeSelectionPtr aSelectAttr = aSelectionListAttr->value(i); - ObjectPtr anObject = aSelectAttr->context(); - if (!anObject.get()) - continue; - else { - FeaturePtr aFeature = ModelAPI_Feature::feature(anObject); - } - } - } -} - diff --git a/src/SketchShapePlugin/SketchShapePlugin_Feature.h b/src/SketchShapePlugin/SketchShapePlugin_Feature.h deleted file mode 100755 index 0a59da95d..000000000 --- a/src/SketchShapePlugin/SketchShapePlugin_Feature.h +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: SketchShapePlugin_Feature.h -// Created: 25 Nov 2015 -// Author: Natalia ERMOLAEVA - -#ifndef SKETCHSHAPEPLUGIN_FEATURE_H_ -#define SKETCHSHAPEPLUGIN_FEATURE_H_ - -#include "SketchShapePlugin.h" - -#include - -/**\class SketchShapePlugin_Feature - * \ingroup Plugins - * \brief Feature for extraction shapes from the sketch. - * The visualization of this object is a result and - * it is calculated if all attributes are initialized. - * It is possible to extract simultaneously vertices, edges and faces. - * - */ -class SketchShapePlugin_Feature : public ModelAPI_Feature -{ - public: - /// SketchShape feature kind - inline static const std::string& ID() - { - static const std::string MY_SKETCH_SHAPE_ID("SketchShape"); - return MY_SKETCH_SHAPE_ID; - } - - /// Sketch feature - inline static const std::string& SKETCH_ID() - { - static const std::string MY_SKETCH_ID("Sketch"); - return MY_SKETCH_ID; - } - - /// State whether the vertices are selectable - inline static const std::string& VERTEX_CHOICE_ID() - { - static const std::string MY_VERTEX_CHOICE_ID("VertexChoice"); - return MY_VERTEX_CHOICE_ID; - } - - /// List of vertices to be extracted - inline static const std::string& VERTEX_LIST_ID() - { - static const std::string MY_VERTEX_LIST_ID("VertexList"); - return MY_VERTEX_LIST_ID; - } - - /// State whether the vertices are selectable - inline static const std::string& EDGE_CHOICE_ID() - { - static const std::string MY_EDGE_CHOICE_ID("EdgeChoice"); - return MY_EDGE_CHOICE_ID; - } - - /// List of vertices to be extracted - inline static const std::string& EDGE_LIST_ID() - { - static const std::string MY_EDGE_LIST_ID("EdgeList"); - return MY_EDGE_LIST_ID; - } - - /// State whether the vertices are selectable - inline static const std::string& FACE_CHOICE_ID() - { - static const std::string MY_FACE_CHOICE_ID("FaceChoice"); - return MY_FACE_CHOICE_ID; - } - - /// List of vertices to be extracted - inline static const std::string& FACE_LIST_ID() - { - static const std::string MY_FACE_LIST_ID("FaceList"); - return MY_FACE_LIST_ID; - } - - /// Returns the kind of a feature - SKETCHSHAPEPLUGIN_EXPORT virtual const std::string& getKind() - { - static std::string MY_KIND = SketchShapePlugin_Feature::ID(); - return MY_KIND; - } - - /// Creates an arc-shape - SKETCHSHAPEPLUGIN_EXPORT virtual void execute(); - - /// Request for initialization of data model of the feature: adding all attributes - SKETCHSHAPEPLUGIN_EXPORT virtual void initAttributes(); - - /// Called on change of any argument-attribute of this object - /// \param theID identifier of changed attribute - SKETCHSHAPEPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); - - /// Use plugin manager for features creation - SketchShapePlugin_Feature(); -}; - -#endif diff --git a/src/SketchShapePlugin/SketchShapePlugin_PageGroupBox.cpp b/src/SketchShapePlugin/SketchShapePlugin_PageGroupBox.cpp deleted file mode 100755 index db4d9eb70..000000000 --- a/src/SketchShapePlugin/SketchShapePlugin_PageGroupBox.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: SketchShapePlugin_PageGroupBox.h -// Created: 25 Nov 2015 -// Author: Natalia ERMOLAEVA - -#include - -SketchShapePlugin_PageGroupBox::SketchShapePlugin_PageGroupBox(QWidget* theParent) -: ModuleBase_PageGroupBox(theParent) -{ -} - -void SketchShapePlugin_PageGroupBox::setHighlightedGroupBox(bool isHighlighted) -{ - ModuleBase_Tools::setShadowEffect(this, isHighlighted); -} - diff --git a/src/SketchShapePlugin/SketchShapePlugin_PageGroupBox.h b/src/SketchShapePlugin/SketchShapePlugin_PageGroupBox.h deleted file mode 100755 index f372d14f8..000000000 --- a/src/SketchShapePlugin/SketchShapePlugin_PageGroupBox.h +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: SketchShapePlugin_PageGroupBox.h -// Created: 25 Nov 2015 -// Author: Natalia ERMOLAEVA - -#ifndef SKETCHSHAPEPLUGIN_PAGEGROUPBOX_H_ -#define SKETCHSHAPEPLUGIN_PAGEGROUPBOX_H_ - -#include - -class QWidget; - -/*! - * \ingroup GUI - * Represent a property panel's list of ModuleBase_ModelWidgets. - */ -class SketchShapePlugin_PageGroupBox : public ModuleBase_PageGroupBox -{ - //Q_OBJECT -public: - /// Constructs a page that looks like a QGroupBox - SketchShapePlugin_PageGroupBox(QWidget* theParent = 0); - /// Destructs the page - virtual ~SketchShapePlugin_PageGroupBox() {} - - //! Switch On/Off highlighting of the widget - //! Set highlight to the parent group box if there is such parent - void setHighlightedGroupBox(bool isHighlighted); -}; - -#endif /* SKETCHSHAPEPLUGIN_PAGEGROUPBOX_H_ */ diff --git a/src/SketchShapePlugin/SketchShapePlugin_Plugin.cpp b/src/SketchShapePlugin/SketchShapePlugin_Plugin.cpp deleted file mode 100755 index 9121a4219..000000000 --- a/src/SketchShapePlugin/SketchShapePlugin_Plugin.cpp +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: SketchShapePlugin_Plugin.cpp -// Created: 25 Nov 2015 -// Author: Natalia ERMOLAEVA - -#include -#include -#include -/* -#include - -#include -*/ -#include -#include -#include - -#include -#include -/*#include - -#include -#include - -#include */ - -// the only created instance of this plugin -static SketchShapePlugin_Plugin* MY_SKETCH_SHAPE_INSTANCE = new SketchShapePlugin_Plugin(); - -SketchShapePlugin_Plugin::SketchShapePlugin_Plugin() -{ - SessionPtr aMgr = ModelAPI_Session::get(); - ModelAPI_ValidatorsFactory* aFactory = aMgr->validators(); - aFactory->registerValidator("SketchShapePlugin_FeatureValidator", - new SketchShapePlugin_FeatureValidator); - - WidgetCreatorFactoryPtr aWidgetCreatorFactory = ModuleBase_WidgetCreatorFactory::get(); - aWidgetCreatorFactory->registerCreator( - std::shared_ptr(new SketchShapePlugin_WidgetCreator())); - - // register this plugin - ModelAPI_Session::get()->registerPlugin(this); -} - -FeaturePtr SketchShapePlugin_Plugin::createFeature(std::string theFeatureID) -{ - if (theFeatureID == SketchShapePlugin_Feature::ID()) { - return FeaturePtr(new SketchShapePlugin_Feature); - } - // feature of such kind is not found - return FeaturePtr(); -} - diff --git a/src/SketchShapePlugin/SketchShapePlugin_Plugin.h b/src/SketchShapePlugin/SketchShapePlugin_Plugin.h deleted file mode 100755 index 69721d20f..000000000 --- a/src/SketchShapePlugin/SketchShapePlugin_Plugin.h +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: SketchShapePlugin_Plugin.hxx -// Created: 25 Nov 2015 -// Author: Natalia ERMOLAEVA - -#ifndef SKETCHSHAPEPLUGIN_PLUGIN_H_ -#define SKETCHSHAPEPLUGIN_PLUGIN_H_ - -#include -#include -//#include - -#include -#include - -class ModuleBase_ModelWidget; -class QWidget; - -/**\class SketchShapePlugin_Plugin - * \ingroup Plugins - * \brief Interface common for any plugin: allows to use plugin by the plugins manager. - */ -//, public ModuleBase_IWidgetCreator -class SketchShapePlugin_Plugin : public ModelAPI_Plugin -{ -public: - /// Creates the feature object of this plugin by the feature string ID - virtual FeaturePtr createFeature(std::string theFeatureID); - - public: - SketchShapePlugin_Plugin(); -}; - -#endif diff --git a/src/SketchShapePlugin/SketchShapePlugin_Tools.cpp b/src/SketchShapePlugin/SketchShapePlugin_Tools.cpp deleted file mode 100755 index dc2fecd6f..000000000 --- a/src/SketchShapePlugin/SketchShapePlugin_Tools.cpp +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: SketchShapePlugin_Tools.cpp -// Created: 25 Nov 2015 -// Author: Natalia ERMOLAEVA - -#include "SketchShapePlugin_Tools.h" - -namespace SketchShapePlugin_Tools { - -} // namespace SketchShapePlugin_Tools diff --git a/src/SketchShapePlugin/SketchShapePlugin_Tools.h b/src/SketchShapePlugin/SketchShapePlugin_Tools.h deleted file mode 100755 index 412cf9cfb..000000000 --- a/src/SketchShapePlugin/SketchShapePlugin_Tools.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: SketchPlugin_Tools.h -// Created: 25 Nov 2015 -// Author: Natalia ERMOLAEVA - -#ifndef SKETCHSHAPEPLUGIN_TOOLS_H_ -#define SKETCHSHAPEPLUGIN_TOOLS_H_ - -namespace SketchShapePlugin_Tools { - - -}; // namespace SketchPlugin_Tools - -#endif // SKETCHSHAPEPLUGIN_TOOLS_H_ diff --git a/src/SketchShapePlugin/SketchShapePlugin_Validators.cpp b/src/SketchShapePlugin/SketchShapePlugin_Validators.cpp deleted file mode 100755 index 0609e53ce..000000000 --- a/src/SketchShapePlugin/SketchShapePlugin_Validators.cpp +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: SketchShapePlugin_Validators.cpp -// Created: 25 Nov 2015 -// Author: Natalia ERMOLAEVA - -#include "SketchShapePlugin_Validators.h" - -//#include "SketchShapePlugin_Feature.h" - -bool SketchShapePlugin_FeatureValidator::isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - std::string& theError) const -{ - /*if (theAttribute->attributeType() != ModelAPI_AttributeRefAttr::typeId()) { - theError = "The attribute with the " + theAttribute->attributeType() + " type is not processed"; - return false; - }*/ - - return true; -} diff --git a/src/SketchShapePlugin/SketchShapePlugin_Validators.h b/src/SketchShapePlugin/SketchShapePlugin_Validators.h deleted file mode 100755 index b883fc7c8..000000000 --- a/src/SketchShapePlugin/SketchShapePlugin_Validators.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: SketchShapePlugin_Validators.h -// Created: 25 Nov 2015 -// Author: Natalia ERMOLAEVA - -#ifndef SKETCHSHAPEPLUGIN_VALIDATORS_H -#define SKETCHSHAPEPLUGIN_VALIDATORS_H - -#include "SketchShapePlugin.h" -#include - -/**\class SketchShapePlugin_FeatureValidator - * \ingroup Validators - * \brief Validator for an attribute of sketch shape feature. - * - * It is empty. - */ -class SketchShapePlugin_FeatureValidator : public ModelAPI_AttributeValidator -{ - public: - //! returns true if attribute is valid - //! \param theAttribute the checked attribute - //! \param theArguments arguments of the attribute - //! \param theError error message - virtual bool isValid(const AttributePtr& theAttribute, - const std::list& theArguments, - std::string& theError) const; -}; - -#endif diff --git a/src/SketchShapePlugin/SketchShapePlugin_WidgetCheckGroupBox.cpp b/src/SketchShapePlugin/SketchShapePlugin_WidgetCheckGroupBox.cpp deleted file mode 100755 index 6c304fc19..000000000 --- a/src/SketchShapePlugin/SketchShapePlugin_WidgetCheckGroupBox.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: SketchShapePlugin_PageGroupBox.h -// Created: 13 Dec 2015 -// Author: Natalia ERMOLAEVA - -#include - -#include - -SketchShapePlugin_WidgetCheckGroupBox::SketchShapePlugin_WidgetCheckGroupBox(QWidget* theParent, - const Config_WidgetAPI* theData, - const std::string& theParentId) - : ModuleBase_WidgetCheckGroupBox(theParent, theData, theParentId) -{ -} - -void SketchShapePlugin_WidgetCheckGroupBox::setHighlighted(bool isHighlighted) -{ - SketchShapePlugin_PageGroupBox* aShapeGroupBox = 0; - QWidget* aParent = qobject_cast(parent()); - while (aParent) { - aShapeGroupBox = dynamic_cast(aParent); - if (aShapeGroupBox) - break; - aParent = qobject_cast(aParent->parent()); - } - - if (aShapeGroupBox) - aShapeGroupBox->setHighlightedGroupBox(isHighlighted); -} - diff --git a/src/SketchShapePlugin/SketchShapePlugin_WidgetCheckGroupBox.h b/src/SketchShapePlugin/SketchShapePlugin_WidgetCheckGroupBox.h deleted file mode 100755 index 1744081e3..000000000 --- a/src/SketchShapePlugin/SketchShapePlugin_WidgetCheckGroupBox.h +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: SketchShapePlugin_PageGroupBox.h -// Created: 13 Dec 2015 -// Author: Natalia ERMOLAEVA - -#ifndef SKETCHSHAPEPLUGIN_WIDGET_CHECK_GROUP_BOX_H_ -#define SKETCHSHAPEPLUGIN_WIDGET_CHECK_GROUP_BOX_H_ - -#include - -class QWidget; - -/*! - * \ingroup GUI - * Represent a property panel's list of ModuleBase_ModelWidgets. - */ -class SketchShapePlugin_WidgetCheckGroupBox : public ModuleBase_WidgetCheckGroupBox -{ - //Q_OBJECT -public: - /// Constructs a page that looks like a QGroupBox - SketchShapePlugin_WidgetCheckGroupBox(QWidget* theParent, const Config_WidgetAPI* theData, - const std::string& theParentId); - /// Destructs the page - virtual ~SketchShapePlugin_WidgetCheckGroupBox() {} - - //! Switch On/Off highlighting of the widget - //! Set highlight to the parent group box if there is such parent - virtual void setHighlighted(bool isHighlighted); -}; - -#endif /* SKETCHSHAPEPLUGIN_WIDGET_CHECK_GROUP_BOX_H_ */ diff --git a/src/SketchShapePlugin/SketchShapePlugin_WidgetCreator.cpp b/src/SketchShapePlugin/SketchShapePlugin_WidgetCreator.cpp deleted file mode 100755 index ad994b496..000000000 --- a/src/SketchShapePlugin/SketchShapePlugin_WidgetCreator.cpp +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -#include "SketchShapePlugin_WidgetCreator.h" - -#include "SketchShapePlugin_PageGroupBox.h" - -#include "SketchShapePlugin_WidgetMultiSelector.h" -#include "SketchShapePlugin_WidgetCheckGroupBox.h" - -SketchShapePlugin_WidgetCreator::SketchShapePlugin_WidgetCreator() -: ModuleBase_IWidgetCreator() -{ - myPages.insert("sketchshape_groupbox"); - myPages.insert("sketchshape_check_groupbox"); - - myWidgets.insert("sketchshape_multi_selector"); -} - -const std::set& SketchShapePlugin_WidgetCreator::pageTypes() -{ - return myPages; -} - -const std::set& SketchShapePlugin_WidgetCreator::widgetTypes() -{ - return myWidgets; -} - -ModuleBase_PageBase* SketchShapePlugin_WidgetCreator::createPageByType( - const std::string& theType, QWidget* theParent, - Config_WidgetAPI* theWidgetApi, std::string theParentId) -{ - ModuleBase_PageBase* aPage = 0; - if (myPages.find(theType) == myPages.end()) - return aPage; - - if (theType == "sketchshape_groupbox") { - aPage = new SketchShapePlugin_PageGroupBox(theParent); - } - else if (theType == "sketchshape_check_groupbox") { - aPage = new SketchShapePlugin_WidgetCheckGroupBox(theParent, theWidgetApi, theParentId); - } - - return aPage; -} - -ModuleBase_ModelWidget* SketchShapePlugin_WidgetCreator::createWidgetByType( - const std::string& theType, QWidget* theParent, - Config_WidgetAPI* theWidgetApi, std::string theParentId, - ModuleBase_IWorkshop* theWorkshop) -{ - ModuleBase_ModelWidget* aWidget = 0; - if (myWidgets.find(theType) == myWidgets.end()) - return aWidget; - - if (theType == "sketchshape_multi_selector") { - aWidget = new SketchShapePlugin_WidgetMultiSelector(theParent, theWorkshop, theWidgetApi, - theParentId); - } - - return aWidget; -} diff --git a/src/SketchShapePlugin/SketchShapePlugin_WidgetCreator.h b/src/SketchShapePlugin/SketchShapePlugin_WidgetCreator.h deleted file mode 100755 index 1ce859f99..000000000 --- a/src/SketchShapePlugin/SketchShapePlugin_WidgetCreator.h +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D - -#ifndef SketchShapePlugin_WidgetCreator_H -#define SketchShapePlugin_WidgetCreator_H - -#include - -#include -#include - -class ModuleBase_ModelWidget; -class ModuleBase_IWorkshop; -class QWidget; - -/** -* \ingroup GUI -* Interface to WidgetCreator which can create specific widgets by type -*/ -class SketchShapePlugin_WidgetCreator : public ModuleBase_IWidgetCreator -{ -public: - /// Default constructor - SketchShapePlugin_WidgetCreator(); - - /// Virtual destructor - ~SketchShapePlugin_WidgetCreator() {} - - /// Returns a container of possible page types, which this creator can process - /// \returns types - virtual const std::set& pageTypes(); - - /// Returns a list of possible widget types, which this creator can process - /// \returns types - virtual const std::set& widgetTypes(); - - /// Create page by its type - /// \param theType a type - /// \param theParent a parent widget - virtual ModuleBase_PageBase* createPageByType(const std::string& theType, - QWidget* theParent, - Config_WidgetAPI* theWidgetApi, - std::string theParentId); - - /// Create widget by its type - /// \param theType a type - /// \param theParent a parent widget - virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType, - QWidget* theParent, - Config_WidgetAPI* theWidgetApi, - std::string theParentId, - ModuleBase_IWorkshop* theWorkshop); - -private: - std::set myPages; /// types of pages - std::set myWidgets; /// types of widgets -}; - -typedef std::shared_ptr SketchShapePlguinWidgetCreatorPtr; - -#endif diff --git a/src/SketchShapePlugin/SketchShapePlugin_WidgetMultiSelector.cpp b/src/SketchShapePlugin/SketchShapePlugin_WidgetMultiSelector.cpp deleted file mode 100755 index f0ccc0f65..000000000 --- a/src/SketchShapePlugin/SketchShapePlugin_WidgetMultiSelector.cpp +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: SketchShapePlugin_PageGroupBox.h -// Created: 13 Dec 2015 -// Author: Natalia ERMOLAEVA - -#include - -#include - -#include - -#include - -SketchShapePlugin_WidgetMultiSelector::SketchShapePlugin_WidgetMultiSelector(QWidget* theParent, - ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData, - const std::string& theParentId) - : ModuleBase_WidgetMultiSelector(theParent, theWorkshop, theData, theParentId) -{ -} - -void SketchShapePlugin_WidgetMultiSelector::setHighlighted(bool isHighlighted) -{ - SketchShapePlugin_PageGroupBox* aShapeGroupBox = 0; - QWidget* aParent = qobject_cast(parent()); - while (aParent) { - aShapeGroupBox = dynamic_cast(aParent); - if (aShapeGroupBox) - break; - aParent = qobject_cast(aParent->parent()); - } - - if (aShapeGroupBox) - aShapeGroupBox->setHighlightedGroupBox(isHighlighted); -} - diff --git a/src/SketchShapePlugin/SketchShapePlugin_WidgetMultiSelector.h b/src/SketchShapePlugin/SketchShapePlugin_WidgetMultiSelector.h deleted file mode 100755 index 3e8c96814..000000000 --- a/src/SketchShapePlugin/SketchShapePlugin_WidgetMultiSelector.h +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: SketchShapePlugin_PageGroupBox.h -// Created: 13 Dec 2015 -// Author: Natalia ERMOLAEVA - -#ifndef SKETCHSHAPEPLUGIN_WIDGET_MULTI_SELECTOR_H_ -#define SKETCHSHAPEPLUGIN_WIDGET_MULTI_SELECTOR_H_ - -#include - -class ModuleBase_IWorkshop; -class QWidget; - -/*! - * \ingroup GUI - * Represent a property panel's list of ModuleBase_ModelWidgets. - */ -class SketchShapePlugin_WidgetMultiSelector : public ModuleBase_WidgetMultiSelector -{ - //Q_OBJECT -public: - /// Constructs a multi selector widget, which can not be highlighted itself, - /// the parent SketchShapePlugin_GroupBox is highlighted instead of it - SketchShapePlugin_WidgetMultiSelector(QWidget* theParent, ModuleBase_IWorkshop* theWorkshop, - const Config_WidgetAPI* theData, - const std::string& theParentId); - /// Destructs the page - virtual ~SketchShapePlugin_WidgetMultiSelector() {} - - //! Switch On/Off highlighting of the widget - //! Set highlight to the parent group box if there is such parent - virtual void setHighlighted(bool isHighlighted); -}; - -#endif /* SKETCHSHAPEPLUGIN_PAGEGROUPBOX_H_ */ diff --git a/src/SketchShapePlugin/Test/TestSketchShape.py b/src/SketchShapePlugin/Test/TestSketchShape.py deleted file mode 100755 index 43b8ff000..000000000 --- a/src/SketchShapePlugin/Test/TestSketchShape.py +++ /dev/null @@ -1,129 +0,0 @@ -""" - TestConstraintAngle.py - Unit test of SketchPlugin_ConstraintAngle class - - SketchPlugin_ConstraintAngle - static const std::string MY_CONSTRAINT_ANGLE_ID("SketchConstraintAngle"); - data()->addAttribute(SketchPlugin_Constraint::VALUE(), ModelAPI_AttributeDouble::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_A(), ModelAPI_AttributeRefAttr::typeId()); - data()->addAttribute(SketchPlugin_Constraint::ENTITY_B(), ModelAPI_AttributeRefAttr::typeId()); - data()->addAttribute(SketchPlugin_Constraint::FLYOUT_VALUE_PNT(), GeomDataAPI_Point2D::typeId()); - - -""" -from GeomDataAPI import * -from ModelAPI import * -import os -import math - -#========================================================================= -# Auxiliary functions -#========================================================================= - -def angle(theLine1, theLine2): - # subroutine to angle between two lines - aStartPoint1 = geomDataAPI_Point2D(theLine1.attribute("StartPoint")) - aEndPoint1 = geomDataAPI_Point2D(theLine1.attribute("EndPoint")) - aStartPoint2 = geomDataAPI_Point2D(theLine2.attribute("StartPoint")) - aEndPoint2 = geomDataAPI_Point2D(theLine2.attribute("EndPoint")) - - aDirX1 = aEndPoint1.x() - aStartPoint1.x() - aDirY1 = aEndPoint1.y() - aStartPoint1.y() - aLen1 = math.hypot(aDirX1, aDirY1) - aDirX2 = aEndPoint2.x() - aStartPoint2.x() - aDirY2 = aEndPoint2.y() - aStartPoint2.y() - aLen2 = math.hypot(aDirX2, aDirY2) - - aDot = aDirX1 * aDirX2 + aDirY1 * aDirY2 - - anAngle = math.acos(aDot / aLen1 / aLen2) - return round(anAngle * 180. / math.pi, 6) - - -#========================================================================= -# Initialization of the test -#========================================================================= - -__updated__ = "2015-09-18" - -aSession = ModelAPI_Session.get() -aDocument = aSession.moduleDocument() -#========================================================================= -# Creation of a sketch -#========================================================================= -aSession.startOperation() -aSketchCommonFeature = aDocument.addFeature("Sketch") -aSketchFeature = featureToCompositeFeature(aSketchCommonFeature) -origin = geomDataAPI_Point(aSketchFeature.attribute("Origin")) -origin.setValue(0, 0, 0) -dirx = geomDataAPI_Dir(aSketchFeature.attribute("DirX")) -dirx.setValue(1, 0, 0) -norm = geomDataAPI_Dir(aSketchFeature.attribute("Norm")) -norm.setValue(0, 0, 1) -aSession.finishOperation() -#========================================================================= -# Create two lines -#========================================================================= -aSession.startOperation() -aSketchLineA = aSketchFeature.addFeature("SketchLine") -aStartPoint = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint")) -aEndPoint = geomDataAPI_Point2D(aSketchLineA.attribute("EndPoint")) -aStartPoint.setValue(-10., 25.) -aEndPoint.setValue(100., 25.) - -aSketchLineB = aSketchFeature.addFeature("SketchLine") -aStartPoint = geomDataAPI_Point2D(aSketchLineB.attribute("StartPoint")) -aEndPoint = geomDataAPI_Point2D(aSketchLineB.attribute("EndPoint")) -aStartPoint.setValue(-20., 15.) -aEndPoint.setValue(80., 50.) -aSession.finishOperation() -#========================================================================= -# Make a constraint to keep the angle -#========================================================================= -ANGLE_DEGREE = 30. -aSession.startOperation() -aConstraint = aSketchFeature.addFeature("SketchConstraintAngle") -anAngleVal = aConstraint.real("ConstraintValue") -refattrA = aConstraint.refattr("ConstraintEntityA") -refattrB = aConstraint.refattr("ConstraintEntityB") -assert (not anAngleVal.isInitialized()) -assert (not refattrA.isInitialized()) -assert (not refattrB.isInitialized()) -anAngleVal.setValue(ANGLE_DEGREE) -refattrA.setObject(aSketchLineA.firstResult()) -refattrB.setObject(aSketchLineB.firstResult()) -aConstraint.execute() -aSession.finishOperation() -assert (anAngleVal.isInitialized()) -assert (refattrA.isInitialized()) -assert (refattrB.isInitialized()) -assert (angle(aSketchLineA, aSketchLineB) == ANGLE_DEGREE) -#========================================================================= -# Move line, check that angle is constant -#========================================================================= -aSession.startOperation() -aStartPoint = geomDataAPI_Point2D(aSketchLineA.attribute("StartPoint")) -aStartPoint.setValue(0., 30.) -aConstraint.execute() -aSession.finishOperation() -assert (angle(aSketchLineA, aSketchLineB) == ANGLE_DEGREE) -#========================================================================= -# Change angle value and check the lines are moved -#========================================================================= -NEW_ANGLE_DEGREE = 60. -aSession.startOperation() -anAngleVal.setValue(NEW_ANGLE_DEGREE) -aConstraint.execute() -aSession.finishOperation() -assert (angle(aSketchLineA, aSketchLineB) == NEW_ANGLE_DEGREE) -#========================================================================= -# TODO: improve test -# 1. remove constraint, move line's start point to -# check that constraint are not applied -# 2. check constrained distance between: -# * point and line -# * two lines -#========================================================================= -#========================================================================= -# End of test -#========================================================================= diff --git a/src/SketchShapePlugin/plugin-SketchShape.xml b/src/SketchShapePlugin/plugin-SketchShape.xml deleted file mode 100755 index ace539bf6..000000000 --- a/src/SketchShapePlugin/plugin-SketchShape.xml +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- 2.39.2