<multi_selector id="base_objects"
label="Objects:"
tooltip="Select any kind of objects."
- type_choice="vertices edges wires faces shells solids compsolids compounds"
+ shape_types="vertices edges wires faces shells solids compsolids compounds"
concealment="true">
</multi_selector>
</source>
<multi_selector id="base_objects"
label="Solids and CompSolids:"
tooltip="Select solids or compsolids."
- type_choice="faces shells solids compsolids"
+ shape_types="faces shells solids compsolids"
concealment="true">
<validator id="BuildPlugin_ValidatorBaseForBuild" parameters="face,shell,solid,compsolid"/>
</multi_selector>
<multi_selector id="base_objects"
label="Edges:"
tooltip="Select edges on sketch or edges objects."
- type_choice="edges"
+ shape_types="edges"
concealment="true">
<validator id="BuildPlugin_ValidatorBaseForBuild" parameters="edge"/>
</multi_selector>
<multi_selector id="base_objects"
label="Objects:"
tooltip="Select edges, wires or faces."
- type_choice="edges wires faces"
+ shape_types="edges wires faces"
concealment="true">
<validator id="BuildPlugin_ValidatorBaseForBuild" parameters="edge,wire,face"/>
</multi_selector>
<multi_selector id="base_objects"
label="Segments and wires:"
tooltip="Select edges or wires."
- type_choice="edges wires"
+ shape_types="edges wires"
concealment="false">
<validator id="PartSet_DifferentObjects"/>
<validator id="BuildPlugin_ValidatorFillingSelection"/>
<multi_selector id="base_objects"
label="Points and vertices:"
tooltip="Select points or vertices objects."
- type_choice="vertices"
+ shape_types="vertices"
concealment="true">
<validator id="GeomValidators_DifferentShapes"/>
</multi_selector>
<multi_selector id="base_objects"
label="Points and vertices:"
tooltip="Select points or vertices objects."
- type_choice="vertices"
+ shape_types="vertices"
concealment="true">
<validator id="GeomValidators_DifferentShapes"/>
</multi_selector>
<multi_selector id="base_objects"
label="Faces and shells:"
tooltip="Select faces or shells objects."
- type_choice="faces shells"
+ shape_types="faces shells"
concealment="true">
<validator id="BuildPlugin_ValidatorBaseForBuild" parameters="face,shell"/>
</multi_selector>
<multi_selector id="base_objects"
label="Faces and shells:"
tooltip="Select faces or shells."
- type_choice="faces shells"
+ shape_types="faces shells"
concealment="true">
<validator id="BuildPlugin_ValidatorBaseForBuild" parameters="face,shell"/>
</multi_selector>
<multi_selector id="subshapes"
label="Sub-Shapes:"
tooltip="Select shapes on sketch to add."
- type_choice="vertices edges"
+ shape_types="vertices edges"
concealment="true"
clear_in_neutral_point="false">
<validator id="BuildPlugin_ValidatorSubShapesSelection" parameters="Sketch"/>
<multi_selector id="base_objects"
label="Vertices:"
tooltip="Select vertices on sketch or vertex objects."
- type_choice="vertices"
+ shape_types="vertices"
concealment="true">
</multi_selector>
</source>
<multi_selector id="base_objects"
label="Segments and wires:"
tooltip="Select edges on sketch, edges or wires objects."
- type_choice="edges wires"
+ shape_types="edges wires"
concealment="true">
<validator id="BuildPlugin_ValidatorBaseForBuild" parameters="edge,wire"/>
</multi_selector>
{
// applicable the groups only
ResultPtr aGroupResult = theSelection->context();
- if (aGroupResult->groupName() != ModelAPI_ResultGroup::group()) {
+ if (!aGroupResult.get() || aGroupResult->groupName() != ModelAPI_ResultGroup::group()) {
theError = "Error: Groups can be selected only.";
return false;
}
<multi_selector id="group_list"
label="Base groups:"
tooltip="Select a set of groups"
- type_choice="objects">
+ shape_types="objects"
+ allow_objects="Group">
<validator id="CollectionPlugin_OperationAttribute"/>
</multi_selector>
</source>
<multi_selector id="group_list"
label="Base groups:"
tooltip="Select a set of groups"
- type_choice="objects">
+ shape_types="objects">
<validator id="CollectionPlugin_OperationAttribute"/>
</multi_selector>
</source>
<multi_selector id="group_list"
label="Main groups:"
tooltip="Select a set of groups"
- type_choice="objects">
+ shape_types="objects">
<validator id="CollectionPlugin_OperationAttribute" parameters="tools_list"/>
</multi_selector>
<multi_selector id="tools_list"
label="Tool groups:"
tooltip="Select a set of groups"
- type_choice="objects">
+ shape_types="objects">
<validator id="CollectionPlugin_OperationAttribute" parameters="group_list"/>
</multi_selector>
</source>
</namevalue>
<multi_selector id="group_list"
tooltip="Select a set of objects"
- type_choice="Vertices Edges Faces Solids"
+ shape_types="Vertices Edges Faces Solids"
use_choice="true"
use_filters="FiltersSelection"
clear_in_neutral_point="false"
</export_file_selector>
<multi_selector id="selection_list"
tooltip="Select a set of objects"
- type_choice="Vertices Edges Faces Solids Compsolids Objects">
+ shape_types="Vertices Edges Faces Solids Compsolids Objects">
<validator id="GeomValidators_Finite"/>
</multi_selector>
</case>
label="Objects"
icon=""
tooltip="Select objects"
- type_choice="vertices edges wires faces shells solids compsolids compounds"
+ shape_types="vertices edges wires faces shells solids compsolids compounds"
use_choice="false"
concealment="true">
<validator id="FeaturesPlugin_ValidatorBooleanCommonSelection"/>
label="Main objects"
icon=""
tooltip="Select objects"
- type_choice="vertices edges wires faces shells solids compsolids compounds"
+ shape_types="vertices edges wires faces shells solids compsolids compounds"
use_choice="false"
concealment="true">
<validator id="PartSet_DifferentObjects"/>
label="Tool objects"
icon=""
tooltip="Select tools"
- type_choice="vertices edges wires faces shells solids compsolids compounds"
+ shape_types="vertices edges wires faces shells solids compsolids compounds"
use_choice="false"
concealment="true" >
<validator id="PartSet_DifferentObjects"/>
label="Objects"
icon=""
tooltip="Select objects"
- type_choice="vertices edges wires faces shells solids compsolids compounds"
+ shape_types="vertices edges wires faces shells solids compsolids compounds"
use_choice="false"
concealment="true">
<validator id="FeaturesPlugin_ValidatorBooleanFuseSelection"/>
label="Main objects"
icon=""
tooltip="Select objects"
- type_choice="vertices edges wires faces shells solids compsolids compounds"
+ shape_types="vertices edges wires faces shells solids compsolids compounds"
use_choice="false"
concealment="true">
<validator id="PartSet_DifferentObjects"/>
label="Tool objects"
icon=""
tooltip="Select tools"
- type_choice="vertices edges wires faces shells solids compsolids compounds"
+ shape_types="vertices edges wires faces shells solids compsolids compounds"
use_choice="false"
concealment="true" >
<validator id="PartSet_DifferentObjects"/>
label="Main objects"
icon=""
tooltip="Select objects"
- type_choice="faces solids compsolids"
+ shape_types="faces solids compsolids"
use_choice="false"
concealment="true">
<validator id="PartSet_DifferentObjects"/>
label="Tool objects"
icon=""
tooltip="Select tools"
- type_choice="faces solids compsolids"
+ shape_types="faces solids compsolids"
use_choice="false"
concealment="true" >
<validator id="PartSet_DifferentObjects"/>
label="Main objects"
icon=""
tooltip="Select objects"
- type_choice="vertices edges wires faces shells solids compsolids compounds"
+ shape_types="vertices edges wires faces shells solids compsolids compounds"
use_choice="false"
concealment="true">
<validator id="PartSet_DifferentObjects"/>
label="Tool objects"
icon=""
tooltip="Select tools"
- type_choice="vertices edges wires faces shells solids compsolids compounds"
+ shape_types="vertices edges wires faces shells solids compsolids compounds"
use_choice="false"
concealment="true" >
<validator id="PartSet_DifferentObjects"/>
label="Main objects"
icon=""
tooltip="Select objects"
- type_choice="vertices edges wires faces shells solids compsolids compounds"
+ shape_types="vertices edges wires faces shells solids compsolids compounds"
use_choice="false"
concealment="true">
<validator id="PartSet_DifferentObjects"/>
label="Tool objects"
icon=""
tooltip="Select tools"
- type_choice="vertices edges wires faces shells solids compsolids compounds"
+ shape_types="vertices edges wires faces shells solids compsolids compounds"
use_choice="false"
concealment="true" >
<validator id="PartSet_DifferentObjects"/>
<multi_selector id="base"
label="Base objects:"
tooltip="Select a base objects"
- type_choice="vertices edges wires faces shells compounds"
+ shape_types="vertices edges wires faces shells compounds"
concealment="true">
<validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face,shell,compound"/>
</multi_selector>
label="Select a sketch face"
icon="icons/Features/sketch.png"
tooltip="Select a sketch face"
- type_choice="wires faces shells"
+ shape_types="wires faces shells"
concealment="true">
<validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="face,shell"/>
</multi_selector>
label="Cut from:"
icon="icons/Features/cut_shape.png"
tooltip="Objects to Cut"
- type_choice="Objects"
+ shape_types="Objects"
use_choice="false"
concealment="true"
main_argument="true">
label="Select a sketch face"
icon="icons/Features/sketch.png"
tooltip="Select a sketch face"
- type_choice="vertices edges wires faces shells compounds"
+ shape_types="vertices edges wires faces shells compounds"
concealment="true">
<validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face,shell,compound"/>
</multi_selector>
label="Fuse with:"
icon="icons/Features/cut_shape.png"
tooltip="Objects to Fuse"
- type_choice="Objects"
+ shape_types="Objects"
use_choice="false"
concealment="true"
main_argument="true">
label="Faces or/and edges"
icon=""
tooltip="Select objects"
- type_choice="edges faces"
+ shape_types="edges faces"
use_choice="false"
concealment="true">
<validator id="PartSet_DifferentObjects"/>
label="Faces or/and edges"
icon=""
tooltip="Select objects"
- type_choice="edges faces"
+ shape_types="edges faces"
use_choice="false"
concealment="true">
<validator id="PartSet_DifferentObjects"/>
label="Objects"
icon="icons/Features/cut_shape.png"
tooltip="Select objects(compounds, compsolids, solids, shells, faces or edges)"
- type_choice="edges faces shells solids compsolids compounds"
+ shape_types="edges faces shells solids compsolids compounds"
use_choice="false"
concealment="true">
<validator id="PartSet_DifferentObjects"/>
label="Main objects"
icon=""
tooltip="Select objects"
- type_choice="objects"
+ shape_types="objects"
concealment="true">
<validator id="FeaturesPlugin_ValidatorTransform"/>
</multi_selector>
label="Main objects"
icon=""
tooltip="Select objects"
- type_choice="objects"
+ shape_types="objects"
concealment="true">
<validator id="FeaturesPlugin_ValidatorTransform"/>
</multi_selector>
<multi_selector id="base_objects"
label="Base objects:"
tooltip="Select objects for partitioning."
- type_choice="objects"
+ shape_types="objects"
concealment="true"
clear_in_neutral_point="false">
<validator id="FeaturesPlugin_ValidatorPartitionSelection" parameters="Plane"/>
<multi_selector id="base_objects"
label="Base objects:"
tooltip="Select a base objects"
- type_choice="vertices edges wires faces shells compsolids"
+ shape_types="vertices edges wires faces shells compsolids"
use_choice="false"
concealment="true">
<validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face,shell,compound"/>
<multi_selector id="locations_objects"
label="Locations:"
tooltip="Select one or more vertices to specify the locations"
- type_choice="vertex">
+ shape_types="vertex">
<validator id="FeaturesPlugin_ValidatorPipeLocations"/>
</multi_selector>
</box>
label="Select objects to move"
icon="icons/Features/cut_shape.png"
tooltip="Select objects"
- type_choice="objects"
+ shape_types="objects"
concealment="true" >
<validator id="FeaturesPlugin_ValidatorTransform"/>
</multi_selector>
<multi_selector id="subshapes_to_remove"
label="Sub-Shapes to remove:"
tooltip="Select shapes to remove."
- type_choice="vertices edges wires faces shells solids compsolids compounds"
+ shape_types="vertices edges wires faces shells solids compsolids compounds"
clear_in_neutral_point="false">
<validator id="FeaturesPlugin_ValidatorRemoveSubShapesSelection"/>
</multi_selector>
<multi_selector id="subshapes_to_keep"
label="Sub-Shapes to keep:"
tooltip="Select shapes to keep."
- type_choice="vertices edges wires faces shells solids compsolids compounds"
+ shape_types="vertices edges wires faces shells solids compsolids compounds"
clear_in_neutral_point="false">
<validator id="FeaturesPlugin_ValidatorRemoveSubShapesSelection"/>
</multi_selector>
<multi_selector id="base"
label="Base objects:"
tooltip="Select a base objects"
- type_choice="vertices edges wires faces shells compounds"
+ shape_types="vertices edges wires faces shells compounds"
concealment="true">
<validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face,shell,compound"/>
</multi_selector>
label="Select a sketch face"
icon="icons/Features/sketch.png"
tooltip="Select a sketch face"
- type_choice="wires faces shells"
+ shape_types="wires faces shells"
concealment="true">
<validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="face,shell"/>
</multi_selector>
label="Cut from:"
icon="icons/Features/cut_shape.png"
tooltip="Objects to Cut"
- type_choice="Objects"
+ shape_types="Objects"
use_choice="false"
concealment="true"
main_argument="true">
label="Select a sketch face"
icon="icons/Features/sketch.png"
tooltip="Select a sketch face"
- type_choice="vertices edges wires faces shells compounds"
+ shape_types="vertices edges wires faces shells compounds"
concealment="true">
<validator id="FeaturesPlugin_ValidatorBaseForGeneration" parameters="vertex,edge,wire,face,shell,compound"/>
</multi_selector>
label="Fuse with:"
icon="icons/Features/cut_shape.png"
tooltip="Objects to Fuse"
- type_choice="Objects"
+ shape_types="Objects"
use_choice="false"
concealment="true"
main_argument="true">
label="Main objects"
icon=""
tooltip="Select solid objects"
- type_choice="objects"
+ shape_types="objects"
concealment="true">
<validator id="FeaturesPlugin_ValidatorTransform"/>
</multi_selector>
label="Main objects"
icon=""
tooltip="Select solid objects"
- type_choice="objects"
+ shape_types="objects"
concealment="true">
<validator id="FeaturesPlugin_ValidatorTransform"/>
</multi_selector>
label="Main objects"
icon=""
tooltip="Select objects"
- type_choice="objects"
+ shape_types="objects"
concealment="true">
<validator id="FeaturesPlugin_ValidatorTransform"/>
</multi_selector>
label="Main objects"
icon=""
tooltip="Select objects"
- type_choice="objects"
+ shape_types="objects"
concealment="true">
<validator id="FeaturesPlugin_ValidatorTransform"/>
</multi_selector>
label="Main objects"
icon="icons/Features/cut_shape.png"
tooltip="Select solid objects"
- type_choice="solid objects"
+ shape_types="solid objects"
concealment="true">
<validator id="FeaturesPlugin_ValidatorTransform"/>
</multi_selector>
label="Main objects"
icon="icons/Features/cut_shape.png"
tooltip="Select solid objects"
- type_choice="solid objects"
+ shape_types="solid objects"
concealment="true">
<validator id="FeaturesPlugin_ValidatorTransform"/>
</multi_selector>
label="Main objects"
icon="icons/Features/cut_shape.png"
tooltip="Select solid objects"
- type_choice="solid objects"
+ shape_types="solid objects"
concealment="true">
<validator id="FeaturesPlugin_ValidatorTransform"/>
</multi_selector>
label="Main objects"
icon=""
tooltip="Select solid objects"
- type_choice="objects"
+ shape_types="objects"
concealment="true">
<validator id="FeaturesPlugin_ValidatorTransform"/>
</multi_selector>
label="Main objects"
icon=""
tooltip="Select solid objects"
- type_choice="objects"
+ shape_types="objects"
concealment="true">
<validator id="FeaturesPlugin_ValidatorTransform"/>
</multi_selector>
label="Main objects"
icon=""
tooltip="Select solid objects"
- type_choice="objects"
+ shape_types="objects"
concealment="true">
<validator id="FeaturesPlugin_ValidatorTransform"/>
</multi_selector>
<multi_selector id="base_objects"
label="Base objects:"
tooltip="Select solids for union."
- type_choice="faces solids compsolids"
+ shape_types="faces solids compsolids"
use_choice="false"
concealment="true">
<validator id="FeaturesPlugin_ValidatorUnionSelection"/>
<multi_selector id="BelongsTo__BelongsTo"
label="Objects:"
tooltip="Select objects to limit selection."
- type_choice="objects">
+ shape_types="objects">
</multi_selector>
</filter>
<multi_selector id="OnGeometry__OnGeometry"
label="Shapes:"
tooltip="Select objects to limit selection."
- type_choice="edges faces">
+ shape_types="edges faces">
<validator id="FiltersPlugin_ShapeType"/>
</multi_selector>
</filter>
<multi_selector id="OnLine__OnLine"
label="Lines:"
tooltip="Select vertices or segments."
- type_choice="edges">
+ shape_types="edges">
<validator id="GeomValidators_ShapeType" parameters="line"/>
</multi_selector>
</filter>
<multi_selector id="OnPlane__OnPlane"
label="Planes:"
tooltip="Select planes or planar faces."
- type_choice="faces">
+ shape_types="faces">
<validator id="GeomValidators_ShapeType" parameters="plane"/>
</multi_selector>
</filter>
ModuleBase_ITreeNode.h
ModuleBase_WidgetSelectionFilter.h
ModuleBase_IStepPrs.h
+ ModuleBase_SelectionFilterType.h
)
SET(PROJECT_MOC_HEADERS
// SLOT(onMouseDoubleClick(QMouseEvent*)));
}
+ModuleBase_IModule::~ModuleBase_IModule()
+{
+ std::map<ModuleBase_SelectionFilterType, Handle(SelectMgr_Filter)>::const_iterator aFiltersIt =
+ mySelectionFilters.begin();
+ for (; aFiltersIt != mySelectionFilters.end(); aFiltersIt++) {
+ Handle(SelectMgr_Filter) aFilter = aFiltersIt->second;
+ if (!aFilter.IsNull())
+ aFilter.Nullify();
+ }
+}
+
+
void ModuleBase_IModule::launchModal(const QString& theCmdId)
{
bool isCommitted;
theXmlCfg = aWdgReader.featureWidgetCfg(theFeatureId);
theDescription = aWdgReader.featureDescription(theFeatureId);
}
+
+
+//******************************************************
+QIntList ModuleBase_IModule::selectionFilters()
+{
+ QIntList aTypes;
+
+ std::map<ModuleBase_SelectionFilterType, Handle(SelectMgr_Filter)>::const_iterator aFiltersIt =
+ mySelectionFilters.begin();
+ for (; aFiltersIt != mySelectionFilters.end(); aFiltersIt++)
+ aTypes.append(aFiltersIt->first);
+
+ return aTypes;
+}
+
+//******************************************************
+void ModuleBase_IModule::registerSelectionFilter(const ModuleBase_SelectionFilterType theFilterType,
+ const Handle(SelectMgr_Filter)& theFilter)
+{
+ mySelectionFilters[theFilterType] = theFilter;
+}
+
+//******************************************************
+Handle(SelectMgr_Filter) ModuleBase_IModule::selectionFilter(const int theType)
+{
+ ModuleBase_SelectionFilterType aType = (ModuleBase_SelectionFilterType)theType;
+
+ if (mySelectionFilters.find(aType) != mySelectionFilters.end())
+ return mySelectionFilters[aType];
+ else
+ return Handle(SelectMgr_Filter)();
+}
#include "ModuleBase.h"
#include "ModuleBase_IWorkshop.h"
+#include <ModuleBase_SelectionFilterType.h>
#include <ModelAPI_Feature.h>
#include <ModelAPI_Attribute.h>
/// \param theParent instance of workshop interface
ModuleBase_IModule(ModuleBase_IWorkshop* theParent);
- virtual ~ModuleBase_IModule() {}
+ virtual ~ModuleBase_IModule();
/// Stores the current selection
virtual void storeSelection() {}
/// Returns types of registered module selection filters
/// \param theSelectionFilters [out] container of type value
- virtual QIntList selectionFilters() { return QIntList(); }
+ virtual QIntList selectionFilters();
/// Returns selection filter
/// \param theType selection filter type
/// \param theFilter instance of filter
- virtual Handle(SelectMgr_Filter) selectionFilter(const int theType) = 0;
+ virtual Handle(SelectMgr_Filter) selectionFilter(const int theType);
+
+ /// Append selection filter into the module and type of the filter in internal container
+ /// \param theFilterType selection filter type
+ /// \param theFilter added filter
+ void registerSelectionFilter(const ModuleBase_SelectionFilterType theFilterType,
+ const Handle(SelectMgr_Filter)& theFilter);
/// Return true if the custom presentation is activated
/// \param theFlag a flag of level of customization, which means that only part of sub-elements
/// Map of features in XML
std::map<std::string, std::string> myFeaturesInFiles;
+
+ std::map<ModuleBase_SelectionFilterType, Handle(SelectMgr_Filter)> mySelectionFilters;
+
};
--- /dev/null
+// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef ModuleBase_SelectionFilterType_H
+#define ModuleBase_SelectionFilterType_H
+
+#include "ModuleBase.h"
+
+/// Enumeration to specify module selection filters
+enum MODULEBASE_EXPORT ModuleBase_SelectionFilterType {
+ SF_GlobalFilter, /// filter for different documents, group results
+ SF_FilterInfinite, /// filter for infinite construction results
+ SF_ResultGroupNameFilter, /// filter for selection some kind of results
+ SF_SketchCirclePointFilter, /// filter for selection circle points on current sketch
+ SF_SketchPlaneFilter /// filter for selection in the current sketch plane only
+};
+
+#endif
Standard_EXPORT virtual
Standard_Boolean IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const;
+ /// Add an object type name to list of non selectable objects
+ /// \param theType - a name of an object type
+ Standard_EXPORT void addNonSelectableType(const QString& theType)
+ {
+ if (!myNonSelectableTypes.contains(theType))
+ myNonSelectableTypes.append(theType);
+ }
+
+ /// Removes an object type name from list of non selectable objects
+ /// \param theType - a name of an object type
+ Standard_EXPORT void removeNonSelectableType(const QString& theType)
+ {
+ if (myNonSelectableTypes.contains(theType))
+ myNonSelectableTypes.removeAll(theType);
+ }
+
+ /// Returns list of non-selectable an object type names
+ Standard_EXPORT QStringList nonSelectableTypes() const
+ {
+ return myNonSelectableTypes;
+ }
+
DEFINE_STANDARD_RTTIEXT(ModuleBase_ShapeDocumentFilter, SelectMgr_Filter)
protected:
/// Reference to workshop
ModuleBase_IWorkshop* myWorkshop;
+
+ QStringList myNonSelectableTypes;
};
/**
myIsSetSelectionBlocked(false), myCurrentHistoryIndex(-1),
myIsFirst(true), myFiltersWgt(0)
{
- std::string aPropertyTypes = theData->getProperty("type_choice");
+ std::string aPropertyTypes = theData->getProperty("shape_types");
QString aTypesStr = aPropertyTypes.c_str();
myShapeTypes = aTypesStr.split(' ', QString::SkipEmptyParts);
myIsUseChoice = theData->getBooleanAttribute("use_choice", false);
+ QString aAllowedList(theData->getProperty("allow_objects").c_str());
+ if (!aAllowedList.isEmpty())
+ myAllowedObjects = aAllowedList.split(' ', QString::SkipEmptyParts);
+
QVBoxLayout* aMainLay = new QVBoxLayout(this);
ModuleBase_Tools::adjustMargins(aMainLay);
{
ModuleBase_WidgetSelector::activateCustom();
- myWorkshop->module()->activateCustomPrs(myFeature,
+ ModuleBase_IModule* aModule = myWorkshop->module();
+ aModule->activateCustomPrs(myFeature,
ModuleBase_IModule::CustomizeHighlightedObjects, true);
clearSelectedHistory();
+ if (myAllowedObjects.length() > 0) {
+ Handle(SelectMgr_Filter) aFilter = aModule->selectionFilter(SF_GlobalFilter);
+ if (!aFilter.IsNull()) {
+ Handle(ModuleBase_ShapeDocumentFilter) aDocFilter =
+ Handle(ModuleBase_ShapeDocumentFilter)::DownCast(aFilter);
+ if (!aDocFilter.IsNull()) {
+ QStringList aSelFilters = aDocFilter->nonSelectableTypes();
+ foreach(QString aType, aSelFilters) {
+ if (aSelFilters.contains(aType)) {
+ aDocFilter->removeNonSelectableType(aType);
+ myTmpAllowed.append(aType);
+ }
+ }
+ }
+ }
+ }
}
//********************************************************************
myWorkshop->module()->deactivateCustomPrs(ModuleBase_IModule::CustomizeHighlightedObjects, true);
clearSelectedHistory();
+ if (myTmpAllowed.length() > 0) {
+ ModuleBase_IModule* aModule = myWorkshop->module();
+ Handle(SelectMgr_Filter) aFilter = aModule->selectionFilter(SF_GlobalFilter);
+ if (!aFilter.IsNull()) {
+ Handle(ModuleBase_ShapeDocumentFilter) aDocFilter =
+ Handle(ModuleBase_ShapeDocumentFilter)::DownCast(aFilter);
+ if (!aDocFilter.IsNull()) {
+ foreach(QString aType, myTmpAllowed) {
+ aDocFilter->addNonSelectableType(aType);
+ }
+ }
+ }
+ myTmpAllowed.clear();
+ }
}
//********************************************************************
* \code
* <multi_selector id="group_list"
* tooltip="Select a set of objects"
-* type_choice="Vertices Edges Faces Solids" />
+* shape_types="Vertices Edges Faces Solids" />
* \endcode
* It uses following parameters:
* - id - is a name of corresponded attribute
* - tooltip - a tooltip for the widget
-* - type_choice - list of expected shape types.
+* - shape_types - list of expected shape types.
*/
class MODULEBASE_EXPORT ModuleBase_WidgetMultiSelector : public ModuleBase_WidgetSelector
{
ModuleBase_FilterStarter* myFiltersWgt;
QObjectPtrList myVisibleObjects;
+ QStringList myAllowedObjects;
+ QStringList myTmpAllowed;
};
#endif /* MODULEBASE_WIDGETFILESELECTOR_H_ */
IMPLEMENT_STANDARD_RTTIEXT(PartSet_GlobalFilter, ModuleBase_ShapeDocumentFilter);
+PartSet_GlobalFilter::PartSet_GlobalFilter(ModuleBase_IWorkshop* theWorkshop)
+ : ModuleBase_ShapeDocumentFilter(theWorkshop)
+{
+ addNonSelectableType(ModelAPI_ResultField::group().c_str());
+ addNonSelectableType(ModelAPI_ResultGroup::group().c_str());
+}
+
+
Standard_Boolean PartSet_GlobalFilter::IsOk(const Handle(SelectMgr_EntityOwner)& theOwner) const
{
bool aValid = true;
if (aResultGroupName == ModelAPI_ResultPart::group()) {
SessionPtr aMgr = ModelAPI_Session::get();
aValid = aMgr->activeDocument() == aMgr->moduleDocument();
- } else if (aResultGroupName == ModelAPI_ResultField::group()) {
+ } else if (myNonSelectableTypes.contains(aResultGroupName.c_str())) {
aValid = Standard_False;
} else
aValid = Standard_True;
// only and there can not be Group feature
FeaturePtr aFeature = ModelAPI_Feature::feature(aObj);
if (aFeature) {
- aValid = aFeature->getKind() != "Group";
+ aValid = !myNonSelectableTypes.contains(aFeature->getKind().c_str());
} else
aValid = Standard_True;
}
public:
/// Constructor
/// \param theWorkshop a pointer to workshop
- PartSet_GlobalFilter(ModuleBase_IWorkshop* theWorkshop)
- : ModuleBase_ShapeDocumentFilter(theWorkshop) {}
+ PartSet_GlobalFilter(ModuleBase_IWorkshop* theWorkshop);
/// Returns True if selected presentation can be selected
/// \param theOwner an owner of the persentation
//******************************************************
PartSet_Module::~PartSet_Module()
{
- std::map<XGUI_SelectionFilterType, Handle(SelectMgr_Filter)>::const_iterator aFiltersIt =
- mySelectionFilters.begin();
- for (; aFiltersIt != mySelectionFilters.end(); aFiltersIt++) {
- Handle(SelectMgr_Filter) aFilter = aFiltersIt->second;
- if (!aFilter.IsNull())
- aFilter.Nullify();
- }
delete myCustomPrs;
delete myOverconstraintListener;
delete myRoot;
{
bool isSketchActive = mySketchMgr->activeSketch().get();
- std::map<XGUI_SelectionFilterType, Handle(SelectMgr_Filter)>::const_iterator aFiltersIt =
+ std::map<ModuleBase_SelectionFilterType, Handle(SelectMgr_Filter)>::const_iterator aFiltersIt =
mySelectionFilters.begin();
for (; aFiltersIt != mySelectionFilters.end(); aFiltersIt++) {
int aFilterType = aFiltersIt->first;
// using sketch filters only if sketch operation is active
if (!isSketchActive &&
- mySketchMgr->sketchSelectionFilter((XGUI_SelectionFilterType)aFilterType))
+ mySketchMgr->sketchSelectionFilter((ModuleBase_SelectionFilterType)aFilterType))
continue;
// using filtering of construction results only from faces panel
}
}
-//******************************************************
-QIntList PartSet_Module::selectionFilters()
-{
- QIntList aTypes;
-
- std::map<XGUI_SelectionFilterType, Handle(SelectMgr_Filter)>::const_iterator aFiltersIt =
- mySelectionFilters.begin();
- for (; aFiltersIt != mySelectionFilters.end(); aFiltersIt++)
- aTypes.append(aFiltersIt->first);
-
- return aTypes;
-}
-
-//******************************************************
-void PartSet_Module::registerSelectionFilter(const XGUI_SelectionFilterType theFilterType,
- const Handle(SelectMgr_Filter)& theFilter)
-{
- mySelectionFilters[theFilterType] = theFilter;
-}
-
-//******************************************************
-Handle(SelectMgr_Filter) PartSet_Module::selectionFilter(const int theType)
-{
- XGUI_SelectionFilterType aType = (XGUI_SelectionFilterType)theType;
-
- if (mySelectionFilters.find(aType) != mySelectionFilters.end())
- return mySelectionFilters[aType];
- else
- return Handle(SelectMgr_Filter)();
-}
-
//******************************************************
void PartSet_Module::customSubShapesSelectionModes(QIntList& theModes)
{
#include "PartSet.h"
#include "PartSet_Tools.h"
#include "PartSet_OverconstraintListener.h"
-#include "XGUI_SelectionFilterType.h"
#include "PartSet_SketcherMgr.h"
#include <ModuleBase_IModule.h>
virtual void moduleSelectionFilters(const QIntList& theFilterTypes,
SelectMgr_ListOfFilter& theSelectionFilters);
- /// Returns types of registered module selection filters
- /// \param theSelectionFilters [out] container of type value
- virtual QIntList selectionFilters();
-
- /// Append selection filter into the module and type of the filter in internal container
- /// \param theFilterType selection filter type
- /// \param theFilter added filter
- void registerSelectionFilter(const XGUI_SelectionFilterType theFilterType,
- const Handle(SelectMgr_Filter)& theFilter);
-
- /// Returns selection filter
- /// \param theType selection filter type
- /// \param theFilter instance of filter
- virtual Handle(SelectMgr_Filter) selectionFilter(const int theType);
/// Returns whether the mouse enter the viewer's window
/// \return true if items are added and there is no necessity to provide standard menu
private:
bool myIsOperationIsLaunched; /// state of application between launch and stop operation
- std::map<XGUI_SelectionFilterType, Handle(SelectMgr_Filter)> mySelectionFilters;
PartSet_SketcherMgr* mySketchMgr;
PartSet_SketcherReentrantMgr* mySketchReentrantMgr;
}
}
-bool PartSet_SketcherMgr::sketchSelectionFilter(const XGUI_SelectionFilterType theFilterType)
+bool PartSet_SketcherMgr::sketchSelectionFilter(const ModuleBase_SelectionFilterType theFilterType)
{
return mySelectionFilterTypes.find(theFilterType) != mySelectionFilterTypes.end();
}
-void PartSet_SketcherMgr::registerSelectionFilter(const XGUI_SelectionFilterType theFilterType,
+void PartSet_SketcherMgr::registerSelectionFilter(const ModuleBase_SelectionFilterType theFilterType,
const Handle(SelectMgr_Filter)& theFilter)
{
mySelectionFilterTypes.insert(theFilterType);
#include "PartSet.h"
#include "PartSet_PreviewSketchPlane.h"
-#include "XGUI_SelectionFilterType.h"
#include "PartSet_Tools.h"
#include <ModelAPI_Feature.h>
#include <ModelAPI_Attribute.h>
#include <ModelAPI_CompositeFeature.h>
#include <ModelAPI_Result.h>
+#include <ModuleBase_SelectionFilterType.h>
#include <ModuleBase_Definitions.h>
#include <ModuleBase_ModelWidget.h>
/// Returns true if the filter is created by the sketch manager
/// \param theFilterType a checked type
/// \return boolean value
- bool sketchSelectionFilter(const XGUI_SelectionFilterType theFilterType);
+ bool sketchSelectionFilter(const ModuleBase_SelectionFilterType theFilterType);
/// Append selection filter into the module and type of the filter in internal container
/// \param theFilterType selection filter type
/// \param theFilter added filter
- void registerSelectionFilter(const XGUI_SelectionFilterType theFilterType,
+ void registerSelectionFilter(const ModuleBase_SelectionFilterType theFilterType,
const Handle(SelectMgr_Filter)& theFilter);
/// Commit the operation if it is possible. If the operation is dimention constraint,
CompositeFeaturePtr myCurrentSketch;
- std::set<XGUI_SelectionFilterType> mySelectionFilterTypes;
+ std::set<ModuleBase_SelectionFilterType> mySelectionFilterTypes;
FeatureToSelectionMap myCurrentSelection;
bool myPreviousUpdateViewerEnabled;
<sketch_multi_selector id="ConstraintMirrorList"
label="Segments:"
tooltip="Select list of objects to be mirrored"
- type_choice="Edges"
+ shape_types="Edges"
use_external="true"
greed ="true">
<validator id="SketchPlugin_MirrorAttr" />
<sketch_multi_selector id="MultiTranslationList"
label="Segments:"
tooltip="Select list of objects to be translated"
- type_choice="Edges"
+ shape_types="Edges"
use_external="true"
greed ="true">
<validator id="SketchPlugin_CopyValidator" />
<sketch_multi_selector id="MultiRotationList"
label="Segments:"
tooltip="Select list of objects to be rotated"
- type_choice="Edges"
+ shape_types="Edges"
use_external="true"
greed ="true">
<validator id="SketchPlugin_CopyValidator" />
XGUI_SalomeConnector.h
XGUI_Selection.h
XGUI_SelectionActivate.h
- XGUI_SelectionFilterType.h
XGUI_SelectionMgr.h
XGUI_Tools.h
XGUI_TransparencyWidget.h
//
#include "XGUI_FacesPanel.h"
+#include "XGUI_ObjectsBrowser.h"
+#include "XGUI_SelectionMgr.h"
+#include "XGUI_Tools.h"
+#include "XGUI_Workshop.h"
+
+#include <ModuleBase_IModule.h>
+#include <ModuleBase_ISelection.h>
+#include <ModuleBase_IWorkshop.h>
+#include <ModuleBase_ListView.h>
+#include <ModuleBase_ResultPrs.h>
+#include <ModuleBase_Tools.h>
+#include <ModuleBase_ViewerPrs.h>
+#include <ModuleBase_SelectionFilterType.h>
#include <Config_PropManager.h>
#include <Events_Loop.h>
#include <ModelAPI_Events.h>
-#include <ModuleBase_IModule.h>
-#include <ModuleBase_ISelection.h>
-#include "ModuleBase_IWorkshop.h"
-#include "ModuleBase_ListView.h"
-#include "ModuleBase_ResultPrs.h"
-#include "ModuleBase_Tools.h"
-#include "ModuleBase_ViewerPrs.h"
-
-#include "XGUI_ObjectsBrowser.h"
-#include "XGUI_SelectionMgr.h"
-#include "XGUI_SelectionFilterType.h"
-#include "XGUI_Tools.h"
-#include "XGUI_Workshop.h"
-
#include <QAction>
#include <QCheckBox>
#include <QFocusEvent>
+++ /dev/null
-// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
-//
-// This library is free software; you can redistribute it and/or
-// modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation; either
-// version 2.1 of the License, or (at your option) any later version.
-//
-// This library is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#ifndef XGUI_SelectionFilterType_H
-#define XGUI_SelectionFilterType_H
-
-#include "XGUI.h"
-
-/// Enumeration to specify module selection filters
-enum XGUI_EXPORT XGUI_SelectionFilterType {
- SF_GlobalFilter, /// filter for different documents, group results
- SF_FilterInfinite, /// filter for infinite construction results
- SF_ResultGroupNameFilter, /// filter for selection some kind of results
- SF_SketchCirclePointFilter, /// filter for selection circle points on current sketch
- SF_SketchPlaneFilter /// filter for selection in the current sketch plane only
-};
-
-#endif