]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #839 Selection of Part sub-results
authornds <nds@opencascade.com>
Fri, 28 Aug 2015 16:49:07 +0000 (19:49 +0300)
committernds <nds@opencascade.com>
Fri, 28 Aug 2015 16:49:07 +0000 (19:49 +0300)
src/FeaturesPlugin/movement_widget.xml
src/FeaturesPlugin/placement_widget.xml
src/FeaturesPlugin/rotation_widget.xml
src/GeomValidators/CMakeLists.txt
src/GeomValidators/GeomValidators_PartSet.cpp [deleted file]
src/GeomValidators/GeomValidators_PartSet.h [deleted file]
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/ModuleBase/ModuleBase_WidgetSelector.cpp
src/PartSet/PartSet_Module.cpp

index e7e162d0a80d341d6f0350e635413ae7e8e6c057..7f1671d855ba828aea377f1db19f5342c7e7238f 100644 (file)
@@ -5,10 +5,8 @@
     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"
index d74132c6ec00a9c8121bf7227d3ff681dc3e28d0..26f5a90112ccc6e96be289e9ee85d2beb968b550 100644 (file)
@@ -5,10 +5,8 @@
     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" 
index 21a806adb3750f63e6ba4728bfe7b8ba10259f61..3a25011b97d4cb4eaafc5564444ff553ca212645 100755 (executable)
@@ -5,10 +5,9 @@
     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"
index 9a7338db230cf431bfb67c80e911a901cad3ebe2..6cf5f5379c4a77f981c4ee9b37751065dcfe473b 100644 (file)
@@ -8,7 +8,6 @@ SET(PROJECT_HEADERS
     GeomValidators_ConstructionComposite.h
     GeomValidators_Face.h
     GeomValidators_Finite.h
-    GeomValidators_PartSet.h
     GeomValidators_Positive.h
     GeomValidators_ShapeType.h
     GeomValidators_Tools.h
@@ -21,7 +20,6 @@ SET(PROJECT_SOURCES
     GeomValidators_ConstructionComposite.cpp
     GeomValidators_Face.cpp
     GeomValidators_Finite.cpp
-    GeomValidators_PartSet.cpp
     GeomValidators_Positive.cpp
     GeomValidators_ShapeType.cpp
     GeomValidators_Tools.cpp
diff --git a/src/GeomValidators/GeomValidators_PartSet.cpp b/src/GeomValidators/GeomValidators_PartSet.cpp
deleted file mode 100755 (executable)
index 32f2bb1..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-// 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;
-}
-
diff --git a/src/GeomValidators/GeomValidators_PartSet.h b/src/GeomValidators/GeomValidators_PartSet.h
deleted file mode 100755 (executable)
index b8b3743..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-// 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
index d58a23633d61fc24c469720b5193e08659b31d8b..8a703d3208963f6d253f7ad3863b2b09510c431c 100755 (executable)
@@ -77,14 +77,15 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen
 
   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);
   }
@@ -94,7 +95,7 @@ ModuleBase_WidgetMultiSelector::ModuleBase_WidgetMultiSelector(QWidget* theParen
                                                       : 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);
index daafd6431572392d16f687f1c714a6ada8d8275d..96cabdd000c485ef63afa193be9ffb9502a39dfa 100755 (executable)
@@ -64,6 +64,10 @@ bool ModuleBase_WidgetSelector::acceptSubShape(const GeomShapePtr& theShape,
   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;
index 19c8469e35db2fe8d149e4b68bf5d4470856e6f0..ed2c71c730c24e83e761efe59ab393777029273d 100755 (executable)
@@ -36,7 +36,6 @@
 #include <ModuleBase_OperationFeature.h>
 
 #include <GeomValidators_ShapeType.h>
-#include <GeomValidators_PartSet.h>
 #include <GeomValidators_Finite.h>
 #include <GeomValidators_Face.h>
 #include <GeomValidators_ConstructionComposite.h>
@@ -210,8 +209,6 @@ void PartSet_Module::registerValidators()
   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",