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)
+++ /dev/null
-## 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)
+++ /dev/null
-// 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
+++ /dev/null
-// 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 <ModelAPI_AttributeSelection.h>
-#include <ModelAPI_AttributeSelectionList.h>
-#include <ModelAPI_AttributeBoolean.h>
-
-#include <ModelAPI_Session.h>
-#include <ModelAPI_Validator.h>
-
-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<ModelAPI_AttributeBoolean>(
- data()->attribute(theID));
- if (!aChoiceAttribute->value()) {
- AttributeSelectionListPtr aListAttribute =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(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<ModelAPI_AttributeSelectionList>(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);
- }
- }
- }
-}
-
+++ /dev/null
-// 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 <ModelAPI_Feature.h>
-
-/**\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
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
-
-// File: SketchShapePlugin_PageGroupBox.h
-// Created: 25 Nov 2015
-// Author: Natalia ERMOLAEVA
-
-#include <SketchShapePlugin_PageGroupBox.h>
-
-SketchShapePlugin_PageGroupBox::SketchShapePlugin_PageGroupBox(QWidget* theParent)
-: ModuleBase_PageGroupBox(theParent)
-{
-}
-
-void SketchShapePlugin_PageGroupBox::setHighlightedGroupBox(bool isHighlighted)
-{
- ModuleBase_Tools::setShadowEffect(this, isHighlighted);
-}
-
+++ /dev/null
-// 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 <ModuleBase_PageGroupBox.h>
-
-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_ */
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
-
-// File: SketchShapePlugin_Plugin.cpp
-// Created: 25 Nov 2015
-// Author: Natalia ERMOLAEVA
-
-#include <SketchShapePlugin_Plugin.h>
-#include <SketchShapePlugin_Validators.h>
-#include <SketchShapePlugin_Feature.h>
-/*
-#include <SketchShapePlugin_PageGroupBox.h>
-
-#include <Events_Loop.h>
-*/
-#include <ModelAPI_Session.h>
-#include <ModelAPI_Document.h>
-#include <ModelAPI_Validator.h>
-
-#include <ModuleBase_WidgetCreatorFactory.h>
-#include <SketchShapePlugin_WidgetCreator.h>
-/*#include <ModelAPI_Data.h>
-
-#include <ModuleBase_ModelWidget.h>
-#include <qwidget.h>
-
-#include <memory>*/
-
-// 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<SketchShapePlugin_WidgetCreator>(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();
-}
-
+++ /dev/null
-// 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 <SketchShapePlugin.h>
-#include <ModelAPI_Plugin.h>
-//#include <ModuleBase_IWidgetCreator.h>
-
-#include <ModelAPI_Feature.h>
-#include <ModelAPI_Events.h>
-
-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
+++ /dev/null
-// 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
+++ /dev/null
-// 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_
+++ /dev/null
-// 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<std::string>& 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;
-}
+++ /dev/null
-// 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 <ModelAPI_AttributeValidator.h>
-
-/**\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<std::string>& theArguments,
- std::string& theError) const;
-};
-
-#endif
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
-
-// File: SketchShapePlugin_PageGroupBox.h
-// Created: 13 Dec 2015
-// Author: Natalia ERMOLAEVA
-
-#include <SketchShapePlugin_WidgetCheckGroupBox.h>
-
-#include <SketchShapePlugin_PageGroupBox.h>
-
-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<QWidget*>(parent());
- while (aParent) {
- aShapeGroupBox = dynamic_cast<SketchShapePlugin_PageGroupBox*>(aParent);
- if (aShapeGroupBox)
- break;
- aParent = qobject_cast<QWidget*>(aParent->parent());
- }
-
- if (aShapeGroupBox)
- aShapeGroupBox->setHighlightedGroupBox(isHighlighted);
-}
-
+++ /dev/null
-// 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 <ModuleBase_WidgetCheckGroupBox.h>
-
-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_ */
+++ /dev/null
-// 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<std::string>& SketchShapePlugin_WidgetCreator::pageTypes()
-{
- return myPages;
-}
-
-const std::set<std::string>& 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;
-}
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-#ifndef SketchShapePlugin_WidgetCreator_H
-#define SketchShapePlugin_WidgetCreator_H
-
-#include <ModuleBase_IWidgetCreator.h>
-
-#include <string>
-#include <set>
-
-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<std::string>& pageTypes();
-
- /// Returns a list of possible widget types, which this creator can process
- /// \returns types
- virtual const std::set<std::string>& 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<std::string> myPages; /// types of pages
- std::set<std::string> myWidgets; /// types of widgets
-};
-
-typedef std::shared_ptr<SketchShapePlugin_WidgetCreator> SketchShapePlguinWidgetCreatorPtr;
-
-#endif
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
-
-// File: SketchShapePlugin_PageGroupBox.h
-// Created: 13 Dec 2015
-// Author: Natalia ERMOLAEVA
-
-#include <SketchShapePlugin_WidgetMultiSelector.h>
-
-#include <SketchShapePlugin_PageGroupBox.h>
-
-#include <ModuleBase_IWorkshop.h>
-
-#include <Config_WidgetAPI.h>
-
-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<QWidget*>(parent());
- while (aParent) {
- aShapeGroupBox = dynamic_cast<SketchShapePlugin_PageGroupBox*>(aParent);
- if (aShapeGroupBox)
- break;
- aParent = qobject_cast<QWidget*>(aParent->parent());
- }
-
- if (aShapeGroupBox)
- aShapeGroupBox->setHighlightedGroupBox(isHighlighted);
-}
-
+++ /dev/null
-// 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 <ModuleBase_WidgetMultiSelector.h>
-
-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_ */
+++ /dev/null
-"""
- 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
-#=========================================================================
+++ /dev/null
-<!-- Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
-
-<plugin>
- <workbench id="Sketch">
- <group id="Exchange">
- <feature id="SketchShape" title="Sketch vertices, edges and faces" tooltip="Construct vertices, edges and faces by sketch" icon=":icons/sketchshape.png">
- <shape_selector id="Sketch"
- label="Sketch"
- icon=":icons/sketch.png"
- tooltip="Select a sketch"
- shape_types="objects">
- <validator id="PartSet_SketchEntityValidator" parameters="Sketch"/>
- </shape_selector>
- <sketchshape_groupbox title="Direction">
- <sketchshape_check_groupbox id="VertexChoice" title="VERTICES" default="true" tooltip="Vertices selection on sketch">
- <sketchshape_multi_selector id="VertexList"
- label=""
- tooltip="Select list of vertices"
- type_choice="Vertices Edges Faces"
- use_external="false"
- use_choice="false">
- <validator id="SketchShapePlugin_FeatureValidator" />
- </sketchshape_multi_selector>
- </sketchshape_check_groupbox>
- <sketchshape_check_groupbox id="EdgeChoice" title="EDGES" default="true" tooltip="Edges selection on sketch">
- <sketchshape_multi_selector id="EdgeList"
- label=""
- tooltip="Select list of edges"
- type_choice="Vertices Edges Faces"
- use_external="false"
- use_choice="false">
- <validator id="SketchShapePlugin_FeatureValidator" />
- </sketchshape_multi_selector>
- </sketchshape_check_groupbox>
- <sketchshape_check_groupbox id="FaceChoice" title="FACES" default="true" tooltip="Faces selection on sketch">
- <sketchshape_multi_selector id="FaceList"
- label=""
- tooltip="Select list of faces"
- type_choice="Vertices Edges Faces"
- use_external="false"
- use_choice="false">
- <validator id="SketchShapePlugin_FeatureValidator" />
- </sketchshape_multi_selector>
- </sketchshape_check_groupbox>
- </sketchshape_groupbox>
- </feature>
- </group>
- </workbench>
-</plugin>