From: nds Date: Thu, 4 Jun 2015 13:30:15 +0000 (+0300) Subject: Specification controls X-Git-Tag: V_1.3.0~277 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f9be1b7f715b7c630906cfde5a1c4ed25e1a1e63;p=modules%2Fshaper.git Specification controls --- diff --git a/src/FeaturesPlugin/CMakeLists.txt b/src/FeaturesPlugin/CMakeLists.txt index 6bd7dcd40..4aa8619f0 100644 --- a/src/FeaturesPlugin/CMakeLists.txt +++ b/src/FeaturesPlugin/CMakeLists.txt @@ -7,7 +7,9 @@ SET(PROJECT_HEADERS FeaturesPlugin.h FeaturesPlugin_Plugin.h FeaturesPlugin_Extrusion.h + FeaturesPlugin_ExtrusionCut.h FeaturesPlugin_Revolution.h + FeaturesPlugin_Rotation.h FeaturesPlugin_Boolean.h FeaturesPlugin_Group.h FeaturesPlugin_Placement.h @@ -16,7 +18,9 @@ SET(PROJECT_HEADERS SET(PROJECT_SOURCES FeaturesPlugin_Plugin.cpp FeaturesPlugin_Extrusion.cpp + FeaturesPlugin_ExtrusionCut.cpp FeaturesPlugin_Revolution.cpp + FeaturesPlugin_Rotation.cpp FeaturesPlugin_Boolean.cpp FeaturesPlugin_Group.cpp FeaturesPlugin_Placement.cpp @@ -25,7 +29,9 @@ SET(PROJECT_SOURCES SET(XML_RESOURCES plugin-Features.xml extrusion_widget.xml + extrusioncut_widget.xml revolution_widget.xml + rotation_widget.xml boolean_widget.xml group_widget.xml placement_widget.xml diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.cpp b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.cpp new file mode 100755 index 000000000..cfd5b5d56 --- /dev/null +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.cpp @@ -0,0 +1,46 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +// File: FeaturesPlugin_ExtrusionCut.cpp +// Created: 12 May 2015 +// Author: Dmitry Bobylev + +#include + +#include +#include +#include +#include +#include + +//================================================================================================= +FeaturesPlugin_ExtrusionCut::FeaturesPlugin_ExtrusionCut() +{ +} + +//================================================================================================= +void FeaturesPlugin_ExtrusionCut::initAttributes() +{ + data()->addAttribute(FeaturesPlugin_ExtrusionCut::SKETCH_OBJECT_ID(), ModelAPI_AttributeReference::typeId()); + + data()->addAttribute(FeaturesPlugin_ExtrusionCut::TO_SIZE_ID(), ModelAPI_AttributeDouble::typeId()); + data()->addAttribute(FeaturesPlugin_ExtrusionCut::FROM_SIZE_ID(), ModelAPI_AttributeDouble::typeId()); + + data()->addAttribute(FeaturesPlugin_ExtrusionCut::AXIS_OBJECT_ID(), ModelAPI_AttributeReference::typeId()); + + data()->addAttribute(FeaturesPlugin_ExtrusionCut::FROM_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(FeaturesPlugin_ExtrusionCut::TO_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); + + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FeaturesPlugin_ExtrusionCut::FROM_OBJECT_ID()); + ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), FeaturesPlugin_ExtrusionCut::TO_OBJECT_ID()); + + AttributeSelectionListPtr aSelection = + std::dynamic_pointer_cast(data()->addAttribute( + FeaturesPlugin_ExtrusionCut::LIST_ID(), ModelAPI_AttributeSelectionList::typeId())); + // extrusion works with faces always + aSelection->setSelectionType("SOLID"); +} + +//================================================================================================= +void FeaturesPlugin_ExtrusionCut::execute() +{ +} diff --git a/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h new file mode 100755 index 000000000..8285682ee --- /dev/null +++ b/src/FeaturesPlugin/FeaturesPlugin_ExtrusionCut.h @@ -0,0 +1,94 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +// File: FeaturesPlugin_ExtrusionCut.h +// Created: 12 May 2015 +// Author: Dmitry Bobylev + +#ifndef FeaturesPlugin_ExtrusionCut_H_ +#define FeaturesPlugin_ExtrusionCut_H_ + +#include + +#include + +/** \class FeaturesPlugin_ExtrusionCut + * \ingroup Plugins + */ +class FeaturesPlugin_ExtrusionCut : public ModelAPI_Feature +{ + public: + /// Revolution kind. + inline static const std::string& ID() + { + static const std::string MY_REVOLUTION_ID("ExtrusionCut"); + return MY_REVOLUTION_ID; + } + + /// attribute name of references sketch entities list, it should contain a sketch result or + /// a pair a sketch result to sketch face + inline static const std::string& LIST_ID() + { + static const std::string MY_GROUP_LIST_ID("main_objects"); + return MY_GROUP_LIST_ID; + } + + /// attribute name of an object to which the extrusion grows + inline static const std::string& SKETCH_OBJECT_ID() + { + static const std::string MY_TO_OBJECT_ID("sketch"); + return MY_TO_OBJECT_ID; + } + + /// Attribute name of an object to which the extrusion grows. + inline static const std::string& AXIS_OBJECT_ID() + { + static const std::string MY_TO_OBJECT_ID("axis_object"); + return MY_TO_OBJECT_ID; + } + + /// attribute name of extrusion size + inline static const std::string& TO_SIZE_ID() + { + static const std::string MY_TO_SIZE_ID("to_size"); + return MY_TO_SIZE_ID; + } + + /// attribute name of extrusion size + inline static const std::string& FROM_SIZE_ID() + { + static const std::string MY_FROM_SIZE_ID("from_size"); + return MY_FROM_SIZE_ID; + } + + /// attribute name of an object to which the extrusion grows + inline static const std::string& TO_OBJECT_ID() + { + static const std::string MY_TO_OBJECT_ID("to_object"); + return MY_TO_OBJECT_ID; + } + + /// attribute name of tool object + inline static const std::string& FROM_OBJECT_ID() + { + static const std::string MY_FROM_OBJECT_ID("from_object"); + return MY_FROM_OBJECT_ID; + } + + /// Returns the kind of a feature + FEATURESPLUGIN_EXPORT virtual const std::string& getKind() + { + static std::string MY_KIND = FeaturesPlugin_ExtrusionCut::ID(); + return MY_KIND; + } + + /// Creates a new part document if needed. + FEATURESPLUGIN_EXPORT virtual void execute(); + + /// Request for initialization of data model of the feature: adding all attributes. + FEATURESPLUGIN_EXPORT virtual void initAttributes(); + + /// Use plugin manager for features creation. + FeaturesPlugin_ExtrusionCut(); +}; + +#endif diff --git a/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp b/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp index 3ba02779f..d069858d4 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Placement.cpp @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -26,6 +27,13 @@ FeaturesPlugin_Placement::FeaturesPlugin_Placement() void FeaturesPlugin_Placement::initAttributes() { + /* Modification for specification of 1.3.0 + AttributeSelectionListPtr aSelection = + std::dynamic_pointer_cast(data()->addAttribute( + FeaturesPlugin_Placement::LIST_ID(), ModelAPI_AttributeSelectionList::typeId())); + // extrusion works with faces always + aSelection->setSelectionType("SOLID"); + */ data()->addAttribute(FeaturesPlugin_Placement::BASE_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(FeaturesPlugin_Placement::ATTRACT_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(FeaturesPlugin_Placement::REVERSE_ID(), ModelAPI_AttributeBoolean::typeId()); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Placement.h b/src/FeaturesPlugin/FeaturesPlugin_Placement.h index 8039f37e2..b83d07e95 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Placement.h +++ b/src/FeaturesPlugin/FeaturesPlugin_Placement.h @@ -31,6 +31,14 @@ class FeaturesPlugin_Placement : public ModelAPI_Feature static const std::string MY_PLACEMENT_ID("Placement"); return MY_PLACEMENT_ID; } + /// attribute name of references sketch entities list, it should contain a sketch result or + /// a pair a sketch result to sketch face + /*Modification for specification of 1.3.0 + inline static const std::string& LIST_ID() + { + static const std::string MY_GROUP_LIST_ID("base"); + return MY_GROUP_LIST_ID; + }*/ /// attribute name of referenced object inline static const std::string& BASE_OBJECT_ID() { diff --git a/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp b/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp index c35243e8d..100dddf3e 100644 --- a/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp +++ b/src/FeaturesPlugin/FeaturesPlugin_Plugin.cpp @@ -4,9 +4,11 @@ #include #include +#include #include #include #include +#include #include @@ -30,13 +32,17 @@ FeaturePtr FeaturesPlugin_Plugin::createFeature(string theFeatureID) if (theFeatureID == FeaturesPlugin_Extrusion::ID()) { return FeaturePtr(new FeaturesPlugin_Extrusion); } else if (theFeatureID == FeaturesPlugin_Revolution::ID()) { - return FeaturePtr(new FeaturesPlugin_Revolution); + return FeaturePtr(new FeaturesPlugin_Revolution); + } else if (theFeatureID == FeaturesPlugin_Rotation::ID()) { + return FeaturePtr(new FeaturesPlugin_Rotation); } 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_Placement::ID()) { return FeaturePtr(new FeaturesPlugin_Placement); + } else if (theFeatureID == FeaturesPlugin_ExtrusionCut::ID()) { + return FeaturePtr(new FeaturesPlugin_ExtrusionCut); } // feature of such kind is not found return FeaturePtr(); diff --git a/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp b/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp new file mode 100755 index 000000000..8493688f1 --- /dev/null +++ b/src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp @@ -0,0 +1,35 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +// File: FeaturesPlugin_Rotation.cpp +// Created: 12 May 2015 +// Author: Dmitry Bobylev + +#include + +#include +#include +#include + +//================================================================================================= +FeaturesPlugin_Rotation::FeaturesPlugin_Rotation() +{ +} + +//================================================================================================= +void FeaturesPlugin_Rotation::initAttributes() +{ + AttributeSelectionListPtr aSelection = + std::dynamic_pointer_cast(data()->addAttribute( + FeaturesPlugin_Rotation::LIST_ID(), ModelAPI_AttributeSelectionList::typeId())); + // revolution works with faces always + aSelection->setSelectionType("SOLID"); + + data()->addAttribute(FeaturesPlugin_Rotation::AXIS_OBJECT_ID(), ModelAPI_AttributeSelection::typeId()); + + data()->addAttribute(FeaturesPlugin_Rotation::ANGLE_ID(), ModelAPI_AttributeDouble::typeId()); +} + +//================================================================================================= +void FeaturesPlugin_Rotation::execute() +{ +} diff --git a/src/FeaturesPlugin/FeaturesPlugin_Rotation.h b/src/FeaturesPlugin/FeaturesPlugin_Rotation.h new file mode 100755 index 000000000..b8a65d6ff --- /dev/null +++ b/src/FeaturesPlugin/FeaturesPlugin_Rotation.h @@ -0,0 +1,69 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + +// File: FeaturesPlugin_Rotation.h +// Created: 12 May 2015 +// Author: Dmitry Bobylev + +#ifndef FeaturesPlugin_Rotation_H_ +#define FeaturesPlugin_Rotation_H_ + +#include + +#include + +/** \class FeaturesPlugin_Rotation + * \ingroup Plugins + * \brief Feature for creation of revolution from the planar face. + * Revolution creates the lateral faces based on edges of the base face and + * the start and end faces and/or start and end angles. + */ +class FeaturesPlugin_Rotation : public ModelAPI_Feature +{ + public: + /// Revolution kind. + inline static const std::string& ID() + { + static const std::string MY_REVOLUTION_ID("Rotation"); + return MY_REVOLUTION_ID; + } + + /// Attribute name of references sketch entities list, it should contain a sketch result or + /// a pair a sketch result to sketch face. + inline static const std::string& LIST_ID() + { + static const std::string MY_GROUP_LIST_ID("base"); + return MY_GROUP_LIST_ID; + } + + /// Attribute name of an object to which the extrusion grows. + inline static const std::string& AXIS_OBJECT_ID() + { + static const std::string MY_TO_OBJECT_ID("axis_object"); + return MY_TO_OBJECT_ID; + } + + /// Attribute name of revolution angle. + inline static const std::string& ANGLE_ID() + { + static const std::string MY_TO_ANGLE_ID("angle"); + return MY_TO_ANGLE_ID; + } + + /// \return the kind of a feature. + FEATURESPLUGIN_EXPORT virtual const std::string& getKind() + { + static std::string MY_KIND = FeaturesPlugin_Rotation::ID(); + return MY_KIND; + } + + /// Creates a new part document if needed. + FEATURESPLUGIN_EXPORT virtual void execute(); + + /// Request for initialization of data model of the feature: adding all attributes. + FEATURESPLUGIN_EXPORT virtual void initAttributes(); + + /// Use plugin manager for features creation. + FeaturesPlugin_Rotation(); +}; + +#endif diff --git a/src/FeaturesPlugin/extrusioncut_widget.xml b/src/FeaturesPlugin/extrusioncut_widget.xml new file mode 100755 index 000000000..7e510b16d --- /dev/null +++ b/src/FeaturesPlugin/extrusioncut_widget.xml @@ -0,0 +1,65 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/FeaturesPlugin/placement_widget.xml b/src/FeaturesPlugin/placement_widget.xml index 109d0d62c..2e6b8f237 100644 --- a/src/FeaturesPlugin/placement_widget.xml +++ b/src/FeaturesPlugin/placement_widget.xml @@ -1,15 +1,26 @@ + + + diff --git a/src/FeaturesPlugin/plugin-Features.xml b/src/FeaturesPlugin/plugin-Features.xml index 288ae115b..c6f0a65f3 100644 --- a/src/FeaturesPlugin/plugin-Features.xml +++ b/src/FeaturesPlugin/plugin-Features.xml @@ -15,6 +15,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp index d20ddf8e8..755d74c59 100644 --- a/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp @@ -68,7 +68,10 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen myTypeCombo->setVisible(false); } - QLabel* aListLabel = new QLabel(tr("Selected objects:"), this); +// Modification for specification of 1.3.0 + std::string aLabelText = "";//theData->getProperty("label"); + QLabel* aListLabel = new QLabel(!aLabelText.empty() ? aLabelText.c_str() + : tr("Selected objects:"), this); aMainLay->addWidget(aListLabel, 1, 0); // if the xml definition contains one type, an information label should be shown near to the latest if (aShapeTypes.size() == 1) { diff --git a/src/PartSet/PartSet_icons.qrc b/src/PartSet/PartSet_icons.qrc index efc034cb5..1f679d324 100644 --- a/src/PartSet/PartSet_icons.qrc +++ b/src/PartSet/PartSet_icons.qrc @@ -36,6 +36,8 @@ icons/shape_group.png icons/fixed.png icons/placement.png + icons/placement_from.png + icons/placement_to.png icons/geom_export.png icons/horisontal.png icons/vertical.png diff --git a/src/PartSet/icons/placement_from.png b/src/PartSet/icons/placement_from.png new file mode 100755 index 000000000..3dee13348 Binary files /dev/null and b/src/PartSet/icons/placement_from.png differ diff --git a/src/PartSet/icons/placement_to.png b/src/PartSet/icons/placement_to.png new file mode 100755 index 000000000..219138ffa Binary files /dev/null and b/src/PartSet/icons/placement_to.png differ