label="Main objects"
icon=":icons/cut_shape.png"
tooltip="Select a solid objects"
- type_choice="Objects Solids"
- use_choice="false"
+ type_choice=""
concealment="true">
- <validator id="GeomValidators_PartSet"/>
</multi_selector>
<shape_selector id="axis_object"
icon=":icons/axis.png"
label="Select a solid objects"
icon=":icons/cut_shape.png"
tooltip="Select a solid objects"
- type_choice="Objects Solids"
- use_choice="false"
+ type_choice=""
concealment="true" >
- <validator id="GeomValidators_PartSet"/>
</multi_selector>
<shape_selector id="placement_start_face"
label="Select an object"
label="Main objects"
icon=":icons/cut_shape.png"
tooltip="Select a solid objects"
- type_choice="Objects Solids"
+ type_choice=""
use_choice="false"
concealment="true">
- <validator id="GeomValidators_PartSet"/>
</multi_selector>
<shape_selector id="axis_object"
icon=":icons/axis.png"
GeomValidators_ConstructionComposite.h
GeomValidators_Face.h
GeomValidators_Finite.h
- GeomValidators_PartSet.h
GeomValidators_Positive.h
GeomValidators_ShapeType.h
GeomValidators_Tools.h
GeomValidators_ConstructionComposite.cpp
GeomValidators_Face.cpp
GeomValidators_Finite.cpp
- GeomValidators_PartSet.cpp
GeomValidators_Positive.cpp
GeomValidators_ShapeType.cpp
GeomValidators_Tools.cpp
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: GeomValidators_PartSet.cpp
-// Created: 27 Aug 2015
-// Author: Natalia ERMOLAEVA
-
-#include <GeomValidators_PartSet.h>
-#include <GeomValidators_Tools.h>
-
-#include <ModelAPI_AttributeSelectionList.h>
-#include <ModelAPI_Session.h>
-
-#include <TopAbs_ShapeEnum.hxx>
-#include <TopoDS_Shape.hxx>
-#include <TopoDS_Iterator.hxx>
-
-bool GeomValidators_PartSet::isValid(const AttributePtr& theAttribute,
- const std::list<std::string>& theArguments,
- std::string& theError) const
-{
- bool aValid = false;
- SessionPtr aMgr = ModelAPI_Session::get();
- bool isPartSetDocument = aMgr->activeDocument() == aMgr->moduleDocument();
- if (!isPartSetDocument)
- aValid = true;
- else {
- // only hole objects should be selected in PartSet document, there is no decomposition
- if (theAttribute->attributeType() == ModelAPI_AttributeSelectionList::typeId()) {
- AttributeSelectionListPtr aSelectionListAttr =
- std::dynamic_pointer_cast<ModelAPI_AttributeSelectionList>(theAttribute);
- for (int i = 0, aSize = aSelectionListAttr->size(); i < aSize; i++) {
- AttributeSelectionPtr aSelectAttr = aSelectionListAttr->value(i);
- GeomShapePtr aShape = aSelectAttr->value();
- aValid = !aShape.get();
- }
- }
- }
-
- return aValid;
-}
-
+++ /dev/null
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File: GeomValidators_PartSet.h
-// Created: 27 Aug 2015
-// Author: Natalia ERMOLAEVA
-
-#ifndef GeomValidators_PartSet_H
-#define GeomValidators_PartSet_H
-
-#include <GeomValidators.h>
-#include <ModelAPI_AttributeValidator.h>
-
-/**
-* \ingroup Validators
-* A validator for partset document. When PartSet is active, the attribute can accept only
-* shape, which coincide to the shape of result.
-*/
-class GeomValidators_PartSet : public ModelAPI_AttributeValidator
-{
-public:
- //! returns true if attribute is valid
- //! \param theAttribute the checked attribute
- //! \param theArguments arguments of the attribute
- GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
- const std::list<std::string>& theArguments,
- std::string& theError) const;
-};
-
-#endif
std::string aPropertyTypes = theData->getProperty("type_choice");
QString aTypesStr = aPropertyTypes.c_str();
- QStringList aShapeTypes = aTypesStr.split(' ');
+ QStringList aShapeTypes = aTypesStr.split(' ', QString::SkipEmptyParts);
myIsUseChoice = theData->getBooleanAttribute("use_choice", true);
- myTypeCombo->addItems(aShapeTypes);
+ if (!aShapeTypes.empty())
+ myTypeCombo->addItems(aShapeTypes);
aMainLay->addWidget(myTypeCombo, 0, 1);
// if the xml definition contains one type, the controls to select a type should not be shown
- if (aShapeTypes.size() == 1 || !myIsUseChoice) {
+ if (aShapeTypes.size() <= 1 || !myIsUseChoice) {
aTypeLabel->setVisible(false);
myTypeCombo->setVisible(false);
}
: 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) {
+ if (aShapeTypes.size() <= 1) {
QString aLabelIcon = QString::fromStdString(theData->widgetIcon());
if (!aLabelIcon.isEmpty()) {
QLabel* aSelectedLabel = new QLabel("", this);
GeomShapePtr aShape = theShape;
QIntList aShapeTypes = getShapeTypes();
+ if (aShapeTypes.empty()) {
+ aValid = true;
+ return aValid;
+ }
// when the SHAPE type is provided by XML, the hole result shape can be selected.
if (!aShape.get() && aShapeTypes.contains(TopAbs_SHAPE)) {
aValid = true;
#include <ModuleBase_OperationFeature.h>
#include <GeomValidators_ShapeType.h>
-#include <GeomValidators_PartSet.h>
#include <GeomValidators_Finite.h>
#include <GeomValidators_Face.h>
#include <GeomValidators_ConstructionComposite.h>
aFactory->registerValidator("GeomValidators_ShapeType", new GeomValidators_ShapeType);
aFactory->registerValidator("GeomValidators_Face", new GeomValidators_Face);
- aFactory->registerValidator("GeomValidators_PartSet", new GeomValidators_PartSet);
-
aFactory->registerValidator("GeomValidators_Finite", new GeomValidators_Finite);
aFactory->registerValidator("GeomValidators_ConstructionComposite",