]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Revert "Issue #2593: CEA 2018-2 Geometrical Naming"
authordbv <dbv@opencascade.com>
Mon, 24 Sep 2018 12:54:38 +0000 (15:54 +0300)
committerdbv <dbv@opencascade.com>
Mon, 24 Sep 2018 12:54:38 +0000 (15:54 +0300)
This reverts commit 26dbe08c26b99ac1e02e1ab254069ccb620f0181.

54 files changed:
src/Config/Config_AttributeMessage.cpp
src/Config/Config_AttributeMessage.h
src/Config/Config_FeatureReader.cpp
src/Config/Config_Keywords.h
src/ConstructionPlugin/ConstructionPlugin_Axis.cpp
src/ConstructionPlugin/ConstructionPlugin_Plane.cpp
src/ConstructionPlugin/ConstructionPlugin_Point.cpp
src/ConstructionPlugin/ConstructionPlugin_Validators.cpp
src/ConstructionPlugin/axis_widget.xml
src/ConstructionPlugin/plane_widget.xml
src/ConstructionPlugin/point_widget.xml
src/FeaturesPlugin/FeaturesPlugin_Extrusion.cpp
src/FeaturesPlugin/FeaturesPlugin_MultiRotation.cpp
src/FeaturesPlugin/FeaturesPlugin_MultiTranslation.cpp
src/FeaturesPlugin/FeaturesPlugin_Placement.cpp
src/FeaturesPlugin/FeaturesPlugin_Placement.h
src/FeaturesPlugin/FeaturesPlugin_Revolution.cpp
src/FeaturesPlugin/FeaturesPlugin_Rotation.cpp
src/FeaturesPlugin/FeaturesPlugin_Symmetry.cpp
src/FeaturesPlugin/FeaturesPlugin_Translation.cpp
src/FeaturesPlugin/FeaturesPlugin_Validators.cpp
src/FeaturesPlugin/extrusion_widget.xml
src/FeaturesPlugin/extrusioncut_widget.xml
src/FeaturesPlugin/extrusionfuse_widget.xml
src/FeaturesPlugin/multirotation_widget.xml
src/FeaturesPlugin/multitranslation_widget.xml
src/FeaturesPlugin/placement_widget.xml
src/FeaturesPlugin/revolution_widget.xml
src/FeaturesPlugin/revolutioncut_widget.xml
src/FeaturesPlugin/revolutionfuse_widget.xml
src/FeaturesPlugin/rotation_widget.xml
src/FeaturesPlugin/symmetry_widget.xml
src/FeaturesPlugin/translation_widget.xml
src/GeomAlgoAPI/GeomAlgoAPI_Placement.cpp
src/GeomValidators/GeomValidators_Face.cpp
src/GeomValidators/GeomValidators_ShapeType.cpp
src/GeomValidators/GeomValidators_ShapeType.h
src/GeomValidators/GeomValidators_ZeroOffset.cpp
src/Model/Model_AttributeSelection.cpp
src/Model/Model_AttributeSelection.h
src/Model/Model_AttributeSelectionList.cpp
src/Model/Model_Session.cpp
src/Model/Model_Validator.cpp
src/Model/Model_Validator.h
src/ModelAPI/ModelAPI_AttributeSelection.h
src/ModelAPI/ModelAPI_Validator.h
src/ModelHighAPI/ModelHighAPI_Dumper.cpp
src/PrimitivesPlugin/PrimitivesPlugin_Cone.cpp
src/PrimitivesPlugin/PrimitivesPlugin_Cylinder.cpp
src/PrimitivesPlugin/PrimitivesPlugin_Torus.cpp
src/PrimitivesPlugin/cone_widget.xml
src/PrimitivesPlugin/cylinder_widget.xml
src/PrimitivesPlugin/torus_widget.xml
src/SketchPlugin/SketchPlugin_Sketch.cpp

index d8f2f23e8704f3817f51a22b5d4b3d5a47485131..32051337cd23c0e703978d8cd3146387bb639565 100644 (file)
@@ -27,7 +27,6 @@ Config_AttributeMessage::Config_AttributeMessage(const Events_ID theId, const vo
   myFeatureId = std::string(); // Feature unique id
   myIsObligatory = true;
   myIsConcealment = false;
-  myIsGeometricalSelection = false;
 }
 
 Config_AttributeMessage::~Config_AttributeMessage()
@@ -95,13 +94,3 @@ void Config_AttributeMessage::setMainArgument(bool isMainArg)
 {
   myIsMainArgument = isMainArg;
 }
-
-bool Config_AttributeMessage::isGeometricalSelection() const
-{
-  return myIsGeometricalSelection;
-}
-
-void Config_AttributeMessage::setGeometricalSelection(bool isGeometricalSelection)
-{
-  myIsGeometricalSelection = isGeometricalSelection;
-}
index 4df9cd8b474845d5b05003f199095464a0cb94c3..cb4ef232c79b2740c8768b8a49ccf716e3a57484 100644 (file)
@@ -42,7 +42,6 @@ class Config_AttributeMessage : public Events_Message
   bool myIsObligatory; ///< Required to be set by user, else it's feature is invalid.
   bool myIsConcealment; ///< If true, conceals features used as input
   bool myIsMainArgument; ///< Mark attribute as a main argument of the feature
-  bool myIsGeometricalSelection; ///< If true selects geometry instead of shape;
   ///< a list of pairs, if the attribute is placed inside paged containers: (case, switch)
   std::list<std::pair<std::string, std::string> > myCases;
 
@@ -70,8 +69,6 @@ public:
   CONFIG_EXPORT bool isConcealment() const;
   /// Returns true if attribute is a main argument of the feature
   CONFIG_EXPORT bool isMainArgument() const;
-  /// Returns true if attribute selects geometry instead of shape;
-  CONFIG_EXPORT bool isGeometricalSelection() const;
   /// Returns container of ids of pair of a case and switches
   CONFIG_EXPORT const std::list<std::pair<std::string, std::string> >& getCases() const;
   /// Sets ids of pair of a case and switches
@@ -87,8 +84,6 @@ public:
   CONFIG_EXPORT void setObligatory(bool isObligatory);
   /// Set a state that the attribute is a main argument of the feature
   CONFIG_EXPORT void setMainArgument(bool isMainArg);
-  /// Set attribute's geometrical selection state
-  CONFIG_EXPORT void setGeometricalSelection(bool isGeometricalSelection);
 };
 
 #endif // ATTRIBUTE_MESSAGE_H
index 85638935c9b0f60b1956bc861157111932c2c54f..c76aee821d60836bd77ae48a502ba3171e86d4f1 100644 (file)
@@ -89,9 +89,6 @@ void Config_FeatureReader::processNode(xmlNodePtr theNode)
         aMessage->setConcealment(isConcealment);
         bool isMainArg = isConcealment && getBooleanAttribute(theNode, ATTR_MAIN_ARG, false);
         aMessage->setMainArgument(isMainArg);
-        aMessage->setGeometricalSelection(getBooleanAttribute(theNode,
-                                                              ATTR_GEOMETRICAL_SELECTION,
-                                                              false));
 
         std::list<std::pair<std::string, std::string> > aCases;
         xmlNodePtr aCaseNode = hasParentRecursive(theNode,
index eb3085ce6e5b6d46b6ef29a6dfa136929284793d..beb599b206d87450a827f5692f1d08c75881dc10 100644 (file)
@@ -100,8 +100,6 @@ const static char* ATTR_USE_RESET = "use_reset";
 const static char* ATTR_GREED = "greed";
 const static char* ATTR_MODIFIED_IN_EDIT = "modified_in_edit";
 const static char* ATTR_MAIN_ARG = "main_argument";
-const static char* ATTR_GEOMETRICAL_SELECTION = "geometrical_selection";
-
 
 // WDG_INFO properties
 const static char* INFO_WDG_TEXT = FEATURE_TEXT;
index 44dbc087595f99b85c13bc0fbc0ffb3cd3367266..5f4b2f8d65fb45391d3dd4567dfc0fd923a970c3 100644 (file)
@@ -33,7 +33,6 @@
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
 #include <GeomAPI_Pln.h>
-#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Vertex.h>
 #include <GeomAlgoAPI_EdgeBuilder.h>
 #include <GeomAlgoAPI_PointBuilder.h>
@@ -163,26 +162,16 @@ void ConstructionPlugin_Axis::createAxisByPointAndDirection()
 
 void ConstructionPlugin_Axis::createAxisByCylindricalFace()
 {
-  std::shared_ptr<GeomAPI_Shape> aSelection = data()->selection(CYLINDRICAL_FACE())->value();
-    // update arguments due to the selection value
-
-  if (!aSelection.get() || aSelection->isNull()) {
-    return;
-  }
-
-  if (aSelection->isCompound()) {
-    GeomAPI_ShapeIterator anIt(aSelection);
-    aSelection = anIt.current();
-  }
-
-  if (aSelection->isFace()) {
-    std::shared_ptr<GeomAPI_Edge> anEdge = GeomAlgoAPI_EdgeBuilder::cylinderAxis(aSelection);
-
-    ResultConstructionPtr aConstr = document()->createConstruction(data());
-    aConstr->setInfinite(true);
-    aConstr->setShape(anEdge);
-    setResult(aConstr);
-  }
+    std::shared_ptr<GeomAPI_Shape> aSelection = data()->selection(CYLINDRICAL_FACE())->value();
+     // update arguments due to the selection value
+    if (aSelection && !aSelection->isNull() && aSelection->isFace()) {
+      std::shared_ptr<GeomAPI_Edge> anEdge = GeomAlgoAPI_EdgeBuilder::cylinderAxis(aSelection);
+
+      ResultConstructionPtr aConstr = document()->createConstruction(data());
+      aConstr->setInfinite(true);
+      aConstr->setShape(anEdge);
+      setResult(aConstr);
+    }
 }
 
 void ConstructionPlugin_Axis::createAxisByDimensions()
@@ -214,14 +203,7 @@ void ConstructionPlugin_Axis::createAxisByLine()
   if(!aLineShape.get()) {
     aLineShape = anEdgeSelection->context()->shape();
   }
-  GeomEdgePtr anEdge;
-  if (aLineShape->isEdge()) {
-    anEdge = aLineShape->edge();
-  }
-  else if (aLineShape->isCompound()) {
-    GeomAPI_ShapeIterator anIt(aLineShape);
-    anEdge = anIt.current()->edge();
-  }
+  std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aLineShape));
 
   ResultConstructionPtr aConstr = document()->createConstruction(data());
   aConstr->setInfinite(true);
@@ -237,14 +219,7 @@ void ConstructionPlugin_Axis::createAxisByPlaneAndPoint()
   if(!aFaceShape.get()) {
     aFaceShape = aFaceSelection->context()->shape();
   }
-  GeomFacePtr aFace;
-  if (aFaceShape->isFace()) {
-    aFace = aFaceShape->face();
-  }
-  else if (aFaceShape->isCompound()) {
-    GeomAPI_ShapeIterator anIt(aFaceShape);
-    aFace = anIt.current()->face();
-  }
+  std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aFaceShape));
   std::shared_ptr<GeomAPI_Pln> aPln = aFace->getPlane();
 
   // Get point.
@@ -278,14 +253,7 @@ void ConstructionPlugin_Axis::createAxisByTwoPlanes()
   if(!aFaceShape1.get()) {
     aFaceShape1 = aFaceSelection1->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Face> aFace1;
-  if (aFaceShape1->isFace()) {
-    aFace1 = aFaceShape1->face();
-  }
-  else if (aFaceShape1->isCompound()) {
-    GeomAPI_ShapeIterator anIt(aFaceShape1);
-    aFace1 = anIt.current()->face();
-  }
+  std::shared_ptr<GeomAPI_Face> aFace1(new GeomAPI_Face(aFaceShape1));
   std::shared_ptr<GeomAPI_Pln> aPln1 = aFace1->getPlane();
 
   std::string useOffset1 = string(USE_OFFSET1())->value();
@@ -304,14 +272,7 @@ void ConstructionPlugin_Axis::createAxisByTwoPlanes()
   if(!aFaceShape2.get()) {
     aFaceShape2 = aFaceSelection2->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Face> aFace2;
-  if (aFaceShape2->isFace()) {
-    aFace2 = aFaceShape2->face();
-  }
-  else if (aFaceShape2->isCompound()) {
-    GeomAPI_ShapeIterator anIt(aFaceShape2);
-    aFace2 = anIt.current()->face();
-  }
+  std::shared_ptr<GeomAPI_Face> aFace2(new GeomAPI_Face(aFaceShape2));
   std::shared_ptr<GeomAPI_Pln> aPln2 = aFace2->getPlane();
 
   std::string useOffset2 = string(USE_OFFSET2())->value();
index 52e2920353d9dc3709d4b6e3d9ecf746ea94bd60..3680ab50302fd64895e7c84891b99395a6ee83b3 100644 (file)
@@ -33,7 +33,6 @@
 #include <GeomAPI_Pln.h>
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_Pnt2d.h>
-#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Vertex.h>
 #include <GeomAPI_XYZ.h>
 
@@ -229,14 +228,7 @@ std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByLineAndPoint()
   if(!aLineShape.get()) {
     aLineShape = anEdgeSelection->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Edge> anEdge;
-  if (aLineShape->isEdge()) {
-    anEdge = aLineShape->edge();
-  }
-  else if (aLineShape->isCompound()) {
-    GeomAPI_ShapeIterator anIt(aLineShape);
-    anEdge = anIt.current()->edge();
-  }
+  std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aLineShape));
 
   // Get point.
   AttributeSelectionPtr aPointSelection = selection(POINT());
@@ -290,14 +282,7 @@ std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByDistanceFromOth
       return aPlane;
     }
 
-    std::shared_ptr<GeomAPI_Face> aFace;
-    if (aShape->isFace()) {
-      aFace = aShape->face();
-    }
-    else if (aShape->isCompound()) {
-      GeomAPI_ShapeIterator anIt(aShape);
-      aFace = anIt.current()->face();
-    }
+    std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aShape));
 
     std::shared_ptr<GeomAPI_Pln> aPln = aFace->getPlane();
     std::shared_ptr<GeomAPI_Pnt> aOrig = aPln->location();
@@ -320,14 +305,7 @@ std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByCoincidentPoint
   if(!aFaceShape.get()) {
     aFaceShape = aFaceSelection->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Face> aFace;
-  if (aFaceShape->isFace()) {
-    aFace = aFaceShape->face();
-  }
-  else if (aFaceShape->isCompound()) {
-    GeomAPI_ShapeIterator anIt(aFaceShape);
-    aFace = anIt.current()->face();
-  }
+  std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aFaceShape));
 
   // Get point.
   AttributeSelectionPtr aPointSelection = selection(COINCIDENT_POINT());
@@ -355,14 +333,7 @@ std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByRotation()
   if(!aFaceShape.get()) {
     aFaceShape = aFaceSelection->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Face> aFace;
-  if (aFaceShape->isFace()) {
-    aFace = aFaceShape->face();
-  }
-  else if (aFaceShape->isCompound()) {
-    GeomAPI_ShapeIterator anIt(aFaceShape);
-    aFace = anIt.current()->face();
-  }
+  std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aFaceShape));
   aFace = makeRectangularFace(aFace, aFace->getPlane());
 
   // Get axis.
@@ -371,14 +342,7 @@ std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByRotation()
   if(!anAxisShape.get()) {
     anAxisShape = anAxisSelection->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Edge> anEdge;
-  if (anAxisShape->isEdge()) {
-    anEdge = anAxisShape->edge();
-  }
-  else if (anAxisShape->isCompound()) {
-    GeomAPI_ShapeIterator anIt(anAxisShape);
-    anEdge = anIt.current()->edge();
-  }
+  std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(anAxisShape));
 
   std::shared_ptr<GeomAPI_Ax1> anAxis =
     std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
@@ -411,14 +375,7 @@ std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByTwoParallelPlan
   if(!aFaceShape1.get()) {
     aFaceShape1 = aFaceSelection1->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Face> aFace1;
-  if (aFaceShape1->isFace()) {
-    aFace1 = aFaceShape1->face();
-  }
-  else if (aFaceShape1->isCompound()) {
-    GeomAPI_ShapeIterator anIt(aFaceShape1);
-    aFace1 = anIt.current()->face();
-  }
+  std::shared_ptr<GeomAPI_Face> aFace1(new GeomAPI_Face(aFaceShape1));
   std::shared_ptr<GeomAPI_Pln> aPln1 = aFace1->getPlane();
 
   // Get plane 2.
@@ -427,14 +384,7 @@ std::shared_ptr<GeomAPI_Shape> ConstructionPlugin_Plane::createByTwoParallelPlan
   if(!aFaceShape2.get()) {
     aFaceShape2 = aFaceSelection2->context()->shape();
   }
-  std::shared_ptr<GeomAPI_Face> aFace2;
-  if (aFaceShape2->isFace()) {
-    aFace2 = aFaceShape2->face();
-  }
-  else if (aFaceShape2->isCompound()) {
-    GeomAPI_ShapeIterator anIt(aFaceShape2);
-    aFace2 = anIt.current()->face();
-  }
+  std::shared_ptr<GeomAPI_Face> aFace2(new GeomAPI_Face(aFaceShape2));
   std::shared_ptr<GeomAPI_Pln> aPln2 = aFace2->getPlane();
 
   std::shared_ptr<GeomAPI_Pnt> anOrig1 = aPln1->location();
index 688f2533302aee91a65c3caf96943348bd396819..bb59c3d550acee82307197fd38c07ec3a372ee5b 100644 (file)
@@ -36,7 +36,6 @@
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_Vertex.h>
 #include <GeomAPI_Pln.h>
-#include <GeomAPI_ShapeIterator.h>
 
 //==================================================================================================
 ConstructionPlugin_Point::ConstructionPlugin_Point()
@@ -271,14 +270,7 @@ std::list<std::shared_ptr<GeomAPI_Vertex> >
   if(!aLineShape.get()) {
     aLineShape = aLineSelection->context()->shape();
   }
-  GeomEdgePtr anEdge;
-  if (aLineShape->isEdge()) {
-    anEdge = aLineShape->edge();
-  }
-  else if (aLineShape->isCompound()) {
-    GeomAPI_ShapeIterator anIt(aLineShape);
-    anEdge = anIt.current()->edge();
-  }
+  std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aLineShape));
 
   // Get plane.
   AttributeSelectionPtr aPlaneSelection= selection(INTERSECTION_PLANE());
@@ -286,14 +278,7 @@ std::list<std::shared_ptr<GeomAPI_Vertex> >
   if(!aPlaneShape.get()) {
     aPlaneShape = aPlaneSelection->context()->shape();
   }
-  GeomFacePtr aFace;
-  if (aPlaneShape->isFace()) {
-    aFace = aPlaneShape->face();
-  }
-  else if (aPlaneShape->isCompound()) {
-    GeomAPI_ShapeIterator anIt(aPlaneShape);
-    aFace = anIt.current()->face();
-  }
+  std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aPlaneShape));
 
   if (!string(USE_OFFSET())->value().empty()) {
     double anOffset = real(OFFSET())->value();
index 50047dd6951d0c3ca7bb767df066018e4d3abfce..2390b83a4eec2b9e9327890a0c3d83f748dc02c5 100644 (file)
@@ -27,7 +27,6 @@
 #include <GeomAPI_Pln.h>
 #include <GeomAPI_Vertex.h>
 #include <GeomAPI_Pnt.h>
-#include <GeomAPI_ShapeIterator.h>
 #include <GeomAlgoAPI_ShapeTools.h>
 
 #include <ModelAPI_AttributeSelection.h>
@@ -36,7 +35,6 @@
 #include <Events_InfoMessage.h>
 
 static std::shared_ptr<GeomAPI_Edge> getEdge(const GeomShapePtr theShape);
-static std::shared_ptr<GeomAPI_Face> getFace(const GeomShapePtr theShape);
 static std::shared_ptr<GeomAPI_Lin> getLin(const GeomShapePtr theShape);
 static std::shared_ptr<GeomAPI_Pln> getPln(const GeomShapePtr theShape);
 static std::shared_ptr<GeomAPI_Pnt> getPnt(const GeomShapePtr theShape);
@@ -116,7 +114,7 @@ bool ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel::isValid(
   AttributeSelectionPtr anAttribute2 = aFeature->selection(theArguments.front());
 
   std::shared_ptr<GeomAPI_Edge> anEdge;
-  std::shared_ptr<GeomAPI_Face> aFace;
+  std::shared_ptr<GeomAPI_Pln> aPln;
 
   GeomShapePtr aShape1 = anAttribute1->value();
   ResultPtr aContext1 = anAttribute1->context();
@@ -139,20 +137,20 @@ bool ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel::isValid(
 
   bool isPlaneFirst = false;
   anEdge = getEdge(aShape1);
-
-  aFace = getFace(aShape2);
-  if(!anEdge.get() || !aFace.get()) {
+  aPln = getPln(aShape2);
+  if(!anEdge.get() || !aPln.get()) {
     anEdge = getEdge(aShape2);
-    aFace = getFace(aShape1);
+    aPln = getPln(aShape1);
     isPlaneFirst = true;
   }
 
-  if(!anEdge.get() || !aFace.get()) {
+  if(!anEdge.get() || !aPln.get()) {
     theError = "Wrong shape types selected.";
     return false;
   }
 
-  if(GeomAlgoAPI_ShapeTools::isParallel(anEdge, aFace)) {
+  std::shared_ptr<GeomAPI_Face> aPlaneFace(new GeomAPI_Face(isPlaneFirst ? aShape1 : aShape2));
+  if(GeomAlgoAPI_ShapeTools::isParallel(anEdge, aPlaneFace)) {
     theError = "Plane and edge are parallel.";
     return false;
   }
@@ -476,51 +474,25 @@ bool ConstructionPlugin_ValidatorPointThreeNonParallelPlanes::isValid(
 
 std::shared_ptr<GeomAPI_Edge> getEdge(const GeomShapePtr theShape)
 {
-  GeomEdgePtr anEdge;
-
-  if(theShape->isEdge()) {
-    anEdge = theShape->edge();
+  if(!theShape->isEdge()) {
+    return std::shared_ptr<GeomAPI_Edge>();
   }
-  else if (theShape->isCompound()) {
-    GeomAPI_ShapeIterator anIt(theShape);
-    anEdge = anIt.current()->edge();
-  }
-
-  return anEdge;
-}
 
-GeomFacePtr getFace(const GeomShapePtr theShape)
-{
-  GeomFacePtr aFace;
-
-  if (theShape->isFace()) {
-    aFace = theShape->face();
-  }
-  else if (theShape->isCompound()) {
-    GeomAPI_ShapeIterator anIt(theShape);
-    aFace = anIt.current()->face();
-  }
+  std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(theShape));
 
-  return aFace;
+  return anEdge;
 }
 
 std::shared_ptr<GeomAPI_Lin> getLin(const GeomShapePtr theShape)
 {
   std::shared_ptr<GeomAPI_Lin> aLin;
 
-  GeomEdgePtr anEdge;
-
-  if (theShape->isEdge()) {
-    anEdge = theShape->edge();
-  }
-  else if (theShape->isCompound()) {
-    GeomAPI_ShapeIterator anIt(theShape);
-    anEdge = anIt.current()->edge();
-  }
-  else {
+  if(!theShape->isEdge()) {
     return aLin;
   }
 
+  std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(theShape));
+
   if(!anEdge->isLine()) {
     return aLin;
   }
@@ -534,19 +506,12 @@ std::shared_ptr<GeomAPI_Pln> getPln(const GeomShapePtr theShape)
 {
   std::shared_ptr<GeomAPI_Pln> aPln;
 
-  GeomFacePtr aFace;
-
-  if(theShape->isFace()) {
-    aFace = theShape->face();
-  }
-  else if (theShape->isCompound()) {
-    GeomAPI_ShapeIterator anIt(theShape);
-    aFace = anIt.current()->face();
-  }
-  else {
+  if(!theShape->isFace()) {
     return aPln;
   }
 
+  std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(theShape));
+
   if(!aFace->isPlanar()) {
     return aPln;
   }
index 4ccefe0118ee526c315b9769bfa49dd1d987395c..928d0302256c95e84fcba78a2cbd44de8cdde5a5 100644 (file)
@@ -50,8 +50,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       label="Line"
                       tooltip="Select line."
                       icon="icons/Construction/edge.png"
-                      shape_types="edge"
-                      geometrical_selection="true">
+                      shape_types="edge">
         <validator id="GeomValidators_ShapeType" parameters="line"/>
       </shape_selector>
     </box>
@@ -60,8 +59,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
         label="Main object"
         icon="icons/Construction/circle.png"
         tooltip="Select a cylindrical object"
-        shape_types="face"
-        geometrical_selection="true">
+        shape_types="face">
         <validator id="GeomValidators_Face" parameters="cylinder"/>
       </shape_selector>
     </box>
@@ -70,8 +68,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       label="Plane"
                       tooltip="Select a planar face."
                       icon="icons/Construction/face.png"
-                      shape_types="face"
-                      geometrical_selection="true">
+                      shape_types="face">
         <validator id="GeomValidators_Face" parameters="plane"/>
       </shape_selector>
       <shape_selector id="point"
@@ -86,8 +83,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       label="1st plane"
                       tooltip="Select a planar face."
                       icon="icons/Construction/face.png"
-                      shape_types="face"
-                      geometrical_selection="true">
+                      shape_types="face">
         <validator id="GeomValidators_Face" parameters="plane"/>
         <validator id="ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes" parameters="plane2"/>
       </shape_selector>
@@ -99,8 +95,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       label="2nd plane"
                       tooltip="Select a planar face."
                       icon="icons/Construction/face.png"
-                      shape_types="face"
-                      geometrical_selection="true">
+                      shape_types="face">
         <validator id="GeomValidators_Face" parameters="plane"/>
         <validator id="ConstructionPlugin_ValidatorAxisTwoNotParallelPlanes" parameters="plane1"/>
       </shape_selector>
index dfe2007b3a45f38006ece69b7ca5a9ffc4d93a7a..f23a4f40604f8053683bf81bf5461866a8ddd343 100644 (file)
@@ -55,8 +55,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       label="Line"
                       tooltip="Select line."
                       icon="icons/Construction/edge.png"
-                      shape_types="edge"
-                      geometrical_selection="true">
+                      shape_types="edge">
         <validator id="GeomValidators_ShapeType" parameters="line"/>
         <validator id="ConstructionPlugin_ValidatorPlaneLinePoint" parameters="point,perpendicular"/>
       </shape_selector>
@@ -80,8 +79,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       label="Plane"
                       tooltip="Select a planar face."
                       icon="icons/Construction/face.png"
-                      shape_types="face"
-                      geometrical_selection="true">
+                      shape_types="face">
         <validator id="GeomValidators_Face" parameters="plane"/>
       </shape_selector>
       <toolbox id="by_other_plane_option">
@@ -120,8 +118,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Axis"
                           tooltip="Select line for axis."
                           icon="icons/Construction/axis.png"
-                          shape_types="edge"
-                          geometrical_selection="true">
+                          shape_types="edge">
             <validator id="GeomValidators_ShapeType" parameters="line"/>
           </shape_selector>
           <doublevalue id="angle"
@@ -143,8 +140,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       label="1st plane"
                       tooltip="Select a planar face."
                       icon="icons/Construction/face.png"
-                      shape_types="face"
-                      geometrical_selection="true">
+                      shape_types="face">
         <validator id="GeomValidators_Face" parameters="plane"/>
         <validator id="ConstructionPlugin_ValidatorPlaneTwoParallelPlanes" parameters="plane2"/>
       </shape_selector>
@@ -152,8 +148,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       label="2nd plane"
                       tooltip="Select a planar face."
                       icon="icons/Construction/face.png"
-                      shape_types="face"
-                      geometrical_selection="true">
+                      shape_types="face">
         <validator id="GeomValidators_Face" parameters="plane"/>
         <validator id="ConstructionPlugin_ValidatorPlaneTwoParallelPlanes" parameters="plane1"/>
       </shape_selector>
index 3ccf7755052a34edf6309881123bcfc1481c65e2..bd7439f8acc791f8f7d68c814c8b3e17ac248792 100644 (file)
@@ -141,8 +141,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Line"
                           tooltip="Line for intersection."
                           icon="icons/Construction/edge.png"
-                          shape_types="edge"
-                          geometrical_selection="true">
+                          shape_types="edge">
             <validator id="ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel"
                        parameters="intersection_plane"/>
           </shape_selector>
@@ -150,8 +149,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Plane"
                           tooltip="Plane for intersection."
                           icon="icons/Construction/face.png"
-                          shape_types="face"
-                          geometrical_selection="true">
+                          shape_types="face">
             <validator id="GeomValidators_Face" parameters="plane"/>
             <validator id="ConstructionPlugin_ValidatorPointEdgeAndPlaneNotParallel"
                        parameters="intersection_line"/>
index ceb01e79336a84f291aa644980e52435afb6d828..baf8f639769f49b80e20980a6b7761b807be346d 100644 (file)
@@ -31,7 +31,6 @@
 #include <GeomAPI_Dir.h>
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
-#include <GeomAPI_ShapeIterator.h>
 
 //=================================================================================================
 FeaturesPlugin_Extrusion::FeaturesPlugin_Extrusion()
@@ -96,29 +95,16 @@ bool FeaturesPlugin_Extrusion::makeExtrusions(ListOfShape& theBaseShapes,
   getBaseShapes(theBaseShapes);
 
   //Getting direction.
-  static const std::string aSelectionError = "Error: The direction shape selection is bad.";
+  std::shared_ptr<GeomAPI_Dir> aDir;
+  std::shared_ptr<GeomAPI_Edge> anEdge;
   AttributeSelectionPtr aSelection = selection(DIRECTION_OBJECT_ID());
-  GeomShapePtr aShape = aSelection->value();
-  if (!aShape.get()) {
-    if (aSelection->context().get()) {
-      aShape = aSelection->context()->shape();
-    }
-  }
-
-  GeomEdgePtr anEdge;
-  if (aShape.get()) {
-    if (aShape->isEdge())
-    {
-      anEdge = aShape->edge();
-    }
-    else if (aShape->isCompound())
-    {
-      GeomAPI_ShapeIterator anIt(aShape);
-      anEdge = anIt.current()->edge();
-    }
+  if(aSelection.get() && aSelection->value().get() && aSelection->value()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aSelection->value()));
+  } else if(aSelection->context().get() &&
+            aSelection->context()->shape().get() &&
+            aSelection->context()->shape()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aSelection->context()->shape()));
   }
-
-  std::shared_ptr<GeomAPI_Dir> aDir;
   if(anEdge.get()) {
     if(anEdge->isLine()) {
       aDir = anEdge->line()->direction();
@@ -148,10 +134,6 @@ bool FeaturesPlugin_Extrusion::makeExtrusions(ListOfShape& theBaseShapes,
       if(!aToShape.get() && aSelection->context().get()) {
         aToShape = aSelection->context()->shape();
       }
-      if (aToShape->isCompound()) {
-        GeomAPI_ShapeIterator anIt(aToShape);
-        aToShape = anIt.current();
-      }
     }
     aSelection = selection(FROM_OBJECT_ID());
     if(aSelection.get()) {
@@ -159,10 +141,6 @@ bool FeaturesPlugin_Extrusion::makeExtrusions(ListOfShape& theBaseShapes,
       if(!aFromShape.get() && aSelection->context().get()) {
         aFromShape = aSelection->context()->shape();
       }
-      if (aFromShape->isCompound()) {
-        GeomAPI_ShapeIterator anIt(aFromShape);
-        aFromShape = anIt.current();
-      }
     }
   }
 
index ea1cf57d7e874a92e981455b0faa3124bd38a7ec..5f8870f5952bb4799b2cf337555b26e35b7a766c 100644 (file)
@@ -15,7 +15,6 @@
 #include <GeomAPI_Ax1.h>
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
-#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Trsf.h>
 
 #include <ModelAPI_AttributeDouble.h>
@@ -94,44 +93,21 @@ void FeaturesPlugin_MultiRotation::performRotation1D()
   }
 
   //Getting axis.
-  static const std::string aSelectionError = "Error: The axis shape selection is bad.";
-  AttributeSelectionPtr anObjRef = selection(AXIS_ANGULAR_ID());
-  GeomShapePtr aShape = anObjRef->value();
-  if (!aShape.get()) {
-    if (anObjRef->context().get()) {
-      aShape = anObjRef->context()->shape();
-    }
-  }
-  if (!aShape.get()) {
-    setError(aSelectionError);
-    return;
-  }
-
-  GeomEdgePtr anEdge;
-  if (aShape->isEdge())
-  {
-    anEdge = aShape->edge();
-  }
-  else if (aShape->isCompound())
-  {
-    GeomAPI_ShapeIterator anIt(aShape);
-    anEdge = anIt.current()->edge();
-  }
-  else
-  {
-    setError(aSelectionError);
-    return;
+  std::shared_ptr<GeomAPI_Ax1> anAxis;
+  std::shared_ptr<GeomAPI_Edge> anEdge;
+  std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
+    selection(FeaturesPlugin_MultiRotation::AXIS_ANGULAR_ID());
+  if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
+  } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
+             anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
   }
-
-  if (!anEdge.get())
-  {
-    setError(aSelectionError);
-    return;
+  if(anEdge) {
+    anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
+                                                          anEdge->line()->direction()));
   }
 
-  std::shared_ptr<GeomAPI_Ax1> anAxis(new GeomAPI_Ax1(anEdge->line()->location(),
-                                                      anEdge->line()->direction()));
-
   // Getting number of copies.
   int nbCopies =
     integer(FeaturesPlugin_MultiRotation::NB_COPIES_ANGULAR_ID())->value();
index 76a644c2a2c8835fd9faff89ddbb59ae5a183ab9..d23742c6df621107ffa698b33a2287421fa3024d 100644 (file)
@@ -25,7 +25,6 @@
 #include <GeomAPI_Ax1.h>
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
-#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Trsf.h>
 
 #include <ModelAPI_AttributeDouble.h>
@@ -102,44 +101,21 @@ void FeaturesPlugin_MultiTranslation::performOneDirection()
   }
 
   //Getting axis.
-  static const std::string aSelectionError = "Error: The axis shape selection is bad.";
-  AttributeSelectionPtr anObjRef = selection(AXIS_FIRST_DIR_ID());
-  GeomShapePtr aShape = anObjRef->value();
-  if (!aShape.get()) {
-    if (anObjRef->context().get()) {
-      aShape = anObjRef->context()->shape();
-    }
-  }
-  if (!aShape.get()) {
-    setError(aSelectionError);
-    return;
-  }
-
-  GeomEdgePtr anEdge;
-  if (aShape->isEdge())
-  {
-    anEdge = aShape->edge();
+  std::shared_ptr<GeomAPI_Ax1> anAxis;
+  std::shared_ptr<GeomAPI_Edge> anEdge;
+  std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
+    selection(FeaturesPlugin_MultiTranslation::AXIS_FIRST_DIR_ID());
+  if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
+  } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
+             anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
   }
-  else if (aShape->isCompound())
-  {
-    GeomAPI_ShapeIterator anIt(aShape);
-    anEdge = anIt.current()->edge();
-  }
-  else
-  {
-    setError(aSelectionError);
-    return;
-  }
-
-  if (!anEdge.get())
-  {
-    setError(aSelectionError);
-    return;
+  if(anEdge) {
+    anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
+                                                          anEdge->line()->direction()));
   }
 
-  std::shared_ptr<GeomAPI_Ax1> anAxis (new GeomAPI_Ax1(anEdge->line()->location(),
-                                                       anEdge->line()->direction()));
-
   // Getting step.
   double aStep = real(FeaturesPlugin_MultiTranslation::STEP_FIRST_DIR_ID())->value();
 
@@ -246,80 +222,32 @@ void FeaturesPlugin_MultiTranslation::performTwoDirection()
   }
 
   //Getting axis.
-  static const std::string aSelectionError = "Error: The axis shape selection is bad.";
-  AttributeSelectionPtr anObjRef = selection(AXIS_FIRST_DIR_ID());
-  GeomShapePtr aShape = anObjRef->value();
-  if (!aShape.get()) {
-    if (anObjRef->context().get()) {
-      aShape = anObjRef->context()->shape();
-    }
+  std::shared_ptr<GeomAPI_Ax1> aFirstAxis;
+  std::shared_ptr<GeomAPI_Edge> anEdge;
+  std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
+    selection(FeaturesPlugin_MultiTranslation::AXIS_FIRST_DIR_ID());
+  if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
+  } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
+             anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
   }
-  if (!aShape.get()) {
-    setError(aSelectionError);
-    return;
+  if(anEdge) {
+    aFirstAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
+                                                              anEdge->line()->direction()));
   }
-
-  GeomEdgePtr anEdge;
-  if (aShape->isEdge())
-  {
-    anEdge = aShape->edge();
+  std::shared_ptr<GeomAPI_Ax1> aSecondAxis;
+  anObjRef = selection(FeaturesPlugin_MultiTranslation::AXIS_SECOND_DIR_ID());
+  if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
+  } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
+             anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
   }
-  else if (aShape->isCompound())
-  {
-    GeomAPI_ShapeIterator anIt(aShape);
-    anEdge = anIt.current()->edge();
+  if(anEdge) {
+    aSecondAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
+                                                               anEdge->line()->direction()));
   }
-  else
-  {
-    setError(aSelectionError);
-    return;
-  }
-
-  if (!anEdge.get())
-  {
-    setError(aSelectionError);
-    return;
-  }
-
-  std::shared_ptr<GeomAPI_Ax1> aFirstAxis(new GeomAPI_Ax1(anEdge->line()->location(),
-                                                          anEdge->line()->direction()));
-
-  //Getting axis.
-  anObjRef = selection(AXIS_SECOND_DIR_ID());
-  aShape = anObjRef->value();
-  if (!aShape.get()) {
-    if (anObjRef->context().get()) {
-      aShape = anObjRef->context()->shape();
-    }
-  }
-  if (!aShape.get()) {
-    setError(aSelectionError);
-    return;
-  }
-
-  if (aShape->isEdge())
-  {
-    anEdge = aShape->edge();
-  }
-  else if (aShape->isCompound())
-  {
-    GeomAPI_ShapeIterator anIt(aShape);
-    anEdge = anIt.current()->edge();
-  }
-  else
-  {
-    setError(aSelectionError);
-    return;
-  }
-
-  if (!anEdge.get())
-  {
-    setError(aSelectionError);
-    return;
-  }
-
-  std::shared_ptr<GeomAPI_Ax1> aSecondAxis(new GeomAPI_Ax1(anEdge->line()->location(),
-                                                           anEdge->line()->direction()));
 
   // Getting step.
   double aFirstStep = real(FeaturesPlugin_MultiTranslation::STEP_FIRST_DIR_ID())->value();
index 187ee252ff3a61ffbf76c18880c0f4cf9ddfd58a..ab932f01d6c21ac5993a434a9846b0253f926bda 100644 (file)
@@ -31,7 +31,6 @@
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Face.h>
 #include <GeomAPI_Pln.h>
-#include <GeomAPI_ShapeIterator.h>
 #include <GeomAlgoAPI_Placement.h>
 #include <GeomAlgoAPI_Transform.h>
 
@@ -122,8 +121,21 @@ void FeaturesPlugin_Placement::execute()
   // Verify planarity of faces and linearity of edges
   std::shared_ptr<GeomAPI_Shape> aShapes[2] = {aStartShape, anEndShape};
   for (int i = 0; i < 2; i++) {
-    if (!isShapeValid(aShapes[i])) {
-      return;
+    if (aShapes[i]->isFace()) {
+      std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aShapes[i]));
+      if (!aFace->isPlanar()) {
+        static const std::string aPlanarityError = "Error: One of selected faces is not planar.";
+        setError(aPlanarityError);
+        return;
+      }
+    }
+    else if (aShapes[i]->isEdge()) {
+      std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aShapes[i]));
+      if (!anEdge->isLine()) {
+        static const std::string aLinearityError = "Error: One of selected endges is not linear.";
+        setError(aLinearityError);
+        return;
+      }
     }
   }
 
@@ -187,48 +199,6 @@ void FeaturesPlugin_Placement::execute()
   removeResults(aResultIndex);
 }
 
-//==================================================================================================
-bool FeaturesPlugin_Placement::isShapeValid(GeomShapePtr theShape)
-{
-  if (theShape->isCompound()) {
-    GeomAPI_Shape::ShapeType aShapeType = GeomAPI_Shape::SHAPE;
-    for (GeomAPI_ShapeIterator anIt(theShape); anIt.more(); anIt.next()) {
-      GeomShapePtr aCurrentShape = anIt.current();
-      if (aShapeType == GeomAPI_Shape::SHAPE) {
-        aShapeType = aCurrentShape->shapeType();
-      }
-      else if (aShapeType != aCurrentShape->shapeType()) {
-        static const std::string aLinearityError =
-          "Error: Selected compound contains shapes with different types.";
-        setError(aLinearityError);
-        return false;
-      }
-
-      if (!isShapeValid(aCurrentShape)) {
-        return false;
-      }
-    }
-  }
-  else if (theShape->isFace()) {
-    std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(theShape));
-    if (!aFace->isPlanar()) {
-      static const std::string aPlanarityError = "Error: One of selected faces is not planar.";
-      setError(aPlanarityError);
-      return false;
-    }
-  }
-  else if (theShape->isEdge()) {
-    std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(theShape));
-    if (!anEdge->isLine()) {
-      static const std::string aLinearityError = "Error: One of selected edges is not linear.";
-      setError(aLinearityError);
-      return false;
-    }
-  }
-
-  return true;
-}
-
 //============================================================================
 void FeaturesPlugin_Placement::loadNamingDS(GeomAlgoAPI_Transform& theTransformAlgo,
                                             std::shared_ptr<ModelAPI_ResultBody> theResultBody,
index e40392c1405fc9f8bb8343f71d4f89e8b7dad256..1b8a7b6bd0e1bcf5d27adc62b6d050ee0e62af0b 100644 (file)
@@ -96,9 +96,6 @@ class FeaturesPlugin_Placement : public ModelAPI_Feature
   /// Use plugin manager for features creation
   FeaturesPlugin_Placement();
 private:
-  /// Checks validity of passed shape.
-  bool isShapeValid(GeomShapePtr theShape);
-
   /// Load Naming data structure of the feature to the document
   void loadNamingDS(GeomAlgoAPI_Transform& theTransformAlgo,
                     std::shared_ptr<ModelAPI_ResultBody> theResultBody,
index 4ac87606e659d9c0769bd44e7c421f3ddab6f00e..4a643318083edd19d5ba970d0452f74c18c0c355 100644 (file)
@@ -30,7 +30,6 @@
 
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
-#include <GeomAPI_ShapeIterator.h>
 
 //=================================================================================================
 FeaturesPlugin_Revolution::FeaturesPlugin_Revolution()
@@ -93,37 +92,17 @@ bool FeaturesPlugin_Revolution::makeRevolutions(ListOfShape& theBaseShapes,
   // Getting base shapes.
   getBaseShapes(theBaseShapes);
 
-  // Getting axis.
-  static const std::string aSelectionError = "Error: The axis shape selection is bad.";
+  //Getting axis.
+  std::shared_ptr<GeomAPI_Ax1> anAxis;
+  std::shared_ptr<GeomAPI_Edge> anEdge;
   AttributeSelectionPtr aSelection = selection(AXIS_OBJECT_ID());
-  GeomShapePtr aShape = aSelection->value();
-  if (!aShape.get()) {
-    if (aSelection->context().get()) {
-      aShape = aSelection->context()->shape();
-    }
-  }
-  if (!aShape.get()) {
-    setError(aSelectionError);
-    return false;
-  }
-
-  GeomEdgePtr anEdge;
-  if (aShape->isEdge())
-  {
-    anEdge = aShape->edge();
-  }
-  else if (aShape->isCompound())
-  {
-    GeomAPI_ShapeIterator anIt(aShape);
-    anEdge = anIt.current()->edge();
+  if(aSelection.get() && aSelection->value().get() && aSelection->value()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aSelection->value()));
+  } else if(aSelection->context().get() &&
+            aSelection->context()->shape().get() &&
+            aSelection->context()->shape()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(aSelection->context()->shape()));
   }
-  else
-  {
-    setError(aSelectionError);
-    return false;
-  }
-
-  std::shared_ptr<GeomAPI_Ax1> anAxis;
   if(anEdge.get()) {
     if(anEdge->isLine()) {
       anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
@@ -158,10 +137,6 @@ bool FeaturesPlugin_Revolution::makeRevolutions(ListOfShape& theBaseShapes,
       if(!aToShape.get() && aSelection->context().get()) {
         aToShape = aSelection->context()->shape();
       }
-      if (aToShape->isCompound()) {
-        GeomAPI_ShapeIterator anIt(aToShape);
-        aToShape = anIt.current();
-      }
     }
     aSelection = selection(FROM_OBJECT_ID());
     if(aSelection.get()) {
@@ -169,10 +144,6 @@ bool FeaturesPlugin_Revolution::makeRevolutions(ListOfShape& theBaseShapes,
       if(!aFromShape.get() && aSelection->context().get()) {
         aFromShape = aSelection->context()->shape();
       }
-      if (aFromShape->isCompound()) {
-        GeomAPI_ShapeIterator anIt(aFromShape);
-        aFromShape = anIt.current();
-      }
     }
   }
 
index 81e24480297f5e0f658bd7e9a00952e0353ae018..07d2d575c109924f51fbb72a73d1174913faded6 100755 (executable)
@@ -30,7 +30,6 @@
 
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
-#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Trsf.h>
 
 #include <FeaturesPlugin_Tools.h>
@@ -100,43 +99,20 @@ void FeaturesPlugin_Rotation::performTranslationByAxisAndAngle()
   }
 
   //Getting axis.
-  static const std::string aSelectionError = "Error: The axis shape selection is bad.";
-  AttributeSelectionPtr anObjRef = selection(AXIS_OBJECT_ID());
-  GeomShapePtr aShape = anObjRef->value();
-  if (!aShape.get()) {
-    if (anObjRef->context().get()) {
-      aShape = anObjRef->context()->shape();
-    }
-  }
-  if (!aShape.get()) {
-    setError(aSelectionError);
-    return;
+  std::shared_ptr<GeomAPI_Ax1> anAxis;
+  std::shared_ptr<GeomAPI_Edge> anEdge;
+  std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
+    selection(FeaturesPlugin_Rotation::AXIS_OBJECT_ID());
+  if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
+  } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
+             anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
   }
-
-  GeomEdgePtr anEdge;
-  if (aShape->isEdge())
-  {
-    anEdge = aShape->edge();
-  }
-  else if (aShape->isCompound())
-  {
-    GeomAPI_ShapeIterator anIt(aShape);
-    anEdge = anIt.current()->edge();
+  if(anEdge) {
+    anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
+                                                          anEdge->line()->direction()));
   }
-  else
-  {
-    setError(aSelectionError);
-    return;
-  }
-
-  if (!anEdge.get())
-  {
-    setError(aSelectionError);
-    return;
-  }
-
-  std::shared_ptr<GeomAPI_Ax1> anAxis (new GeomAPI_Ax1(anEdge->line()->location(),
-                                                       anEdge->line()->direction()));
 
   // Getting angle.
   double anAngle = real(FeaturesPlugin_Rotation::ANGLE_ID())->value();
index ff8988e80952e16bbb28918ac0629d31f230e825..d50b74aa2088b65f7e4930cac773dc6ab1a69163 100644 (file)
@@ -30,7 +30,6 @@
 #include <GeomAPI_Face.h>
 #include <GeomAPI_Lin.h>
 #include <GeomAPI_Pln.h>
-#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Trsf.h>
 
 #include <ModelAPI_AttributeBoolean.h>
@@ -196,45 +195,21 @@ void FeaturesPlugin_Symmetry::performSymmetryByAxis()
     return;
 
   //Getting axis.
-  static const std::string aSelectionError = "Error: The axis shape selection is bad.";
-  AttributeSelectionPtr anObjRef = selection(AXIS_OBJECT_ID());
-  GeomShapePtr aShape = anObjRef->value();
-  if (!aShape.get()) {
-    if (anObjRef->context().get()) {
-      aShape = anObjRef->context()->shape();
-    }
-  }
-  if (!aShape.get()) {
-    setError(aSelectionError);
-    return;
-  }
-
-  GeomEdgePtr anEdge;
-  if (aShape->isEdge())
-  {
-    anEdge = aShape->edge();
-  }
-  else if (aShape->isCompound())
-  {
-    GeomAPI_ShapeIterator anIt(aShape);
-    anEdge = anIt.current()->edge();
-  }
-  else
-  {
-    setError(aSelectionError);
-    return;
+  std::shared_ptr<GeomAPI_Ax1> anAxis;
+  std::shared_ptr<GeomAPI_Edge> anEdge;
+  std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
+    selection(FeaturesPlugin_Symmetry::AXIS_OBJECT_ID());
+  if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
+  } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
+             anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
   }
-
-  if (!anEdge.get())
-  {
-    setError(aSelectionError);
-    return;
+  if(anEdge) {
+    anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
+                                                          anEdge->line()->direction()));
   }
 
-  std::shared_ptr<GeomAPI_Ax1> anAxis (new GeomAPI_Ax1(anEdge->line()->location(),
-                                                       anEdge->line()->direction()));
-
-
   // Moving each object.
   int aResultIndex = 0;
   std::list<ResultPtr>::iterator aContext = aContextes.begin();
@@ -296,46 +271,24 @@ void FeaturesPlugin_Symmetry::performSymmetryByPlane()
   if (!collectSourceObjects(anObjects, aContextes))
     return;
 
-  //Getting plane.
-  static const std::string aSelectionError = "Error: The plane shape selection is bad.";
-  AttributeSelectionPtr anObjRef = selection(PLANE_OBJECT_ID());
-  GeomShapePtr aShape = anObjRef->value();
-  if (!aShape.get()) {
-    if (anObjRef->context().get()) {
-      aShape = anObjRef->context()->shape();
-    }
-  }
-  if (!aShape.get()) {
-    setError(aSelectionError);
-    return;
-  }
-
-  GeomFacePtr aFace;
-  if (aShape->isFace())
-  {
-    aFace = aShape->face();
-  }
-  else if (aShape->isCompound())
-  {
-    GeomAPI_ShapeIterator anIt(aShape);
-    aFace = anIt.current()->face();
+  //Getting axis.
+  std::shared_ptr<GeomAPI_Ax2> aPlane;
+  std::shared_ptr<GeomAPI_Pln> aPln;
+  std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
+    selection(FeaturesPlugin_Symmetry::PLANE_OBJECT_ID());
+  if (anObjRef && anObjRef->value() && anObjRef->value()->isFace()) {
+    aPln = std::shared_ptr<GeomAPI_Face>(new GeomAPI_Face(anObjRef->value()))->getPlane();
   }
-  else
-  {
-    setError(aSelectionError);
-    return;
+  else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
+             anObjRef->context()->shape() && anObjRef->context()->shape()->isFace()) {
+    aPln =
+      std::shared_ptr<GeomAPI_Face>(new GeomAPI_Face(anObjRef->context()->shape()))->getPlane();
   }
-
-  if (!aFace.get())
-  {
-    setError(aSelectionError);
-    return;
+  if (aPln) {
+    aPlane = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(aPln->location(),
+                                                          aPln->direction()));
   }
 
-  std::shared_ptr<GeomAPI_Ax2> aPlane(new GeomAPI_Ax2(aFace->getPlane()->location(),
-                                                      aFace->getPlane()->direction()));
-
-
   // Moving each object.
   int aResultIndex = 0;
   std::list<ResultPtr>::iterator aContext = aContextes.begin();
index f4469d2e9caa0f18f70c5be6b05221c154bcb9d3..0da4b6acc7fcfa4f99de679fa38c1efd7db4e183 100644 (file)
@@ -30,7 +30,6 @@
 
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
-#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Trsf.h>
 
 #include <GeomAlgoAPI_PointBuilder.h>
@@ -113,45 +112,21 @@ void FeaturesPlugin_Translation::performTranslationByAxisAndDistance()
   }
 
   //Getting axis.
-  static const std::string aSelectionError = "Error: The axis shape selection is bad.";
-  AttributeSelectionPtr anObjRef = selection(AXIS_OBJECT_ID());
-  GeomShapePtr aShape = anObjRef->value();
-  if (!aShape.get()) {
-    if (anObjRef->context().get()) {
-      aShape = anObjRef->context()->shape();
-    }
-  }
-  if (!aShape.get()) {
-    setError(aSelectionError);
-    return;
-  }
-
-  GeomEdgePtr anEdge;
-  if (aShape->isEdge())
-  {
-    anEdge = aShape->edge();
-  }
-  else if (aShape->isCompound())
-  {
-    GeomAPI_ShapeIterator anIt(aShape);
-    anEdge = anIt.current()->edge();
+  std::shared_ptr<GeomAPI_Ax1> anAxis;
+  std::shared_ptr<GeomAPI_Edge> anEdge;
+  std::shared_ptr<ModelAPI_AttributeSelection> anObjRef =
+    selection(FeaturesPlugin_Translation::AXIS_OBJECT_ID());
+  if(anObjRef && anObjRef->value() && anObjRef->value()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->value()));
+  } else if (anObjRef && !anObjRef->value() && anObjRef->context() &&
+             anObjRef->context()->shape() && anObjRef->context()->shape()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anObjRef->context()->shape()));
   }
-  else
-  {
-    setError(aSelectionError);
-    return;
-  }
-
-  if (!anEdge.get())
-  {
-    setError(aSelectionError);
-    return;
+  if(anEdge) {
+    anAxis = std::shared_ptr<GeomAPI_Ax1>(new GeomAPI_Ax1(anEdge->line()->location(),
+                                                          anEdge->line()->direction()));
   }
 
-  std::shared_ptr<GeomAPI_Ax1> anAxis(new GeomAPI_Ax1(anEdge->line()->location(),
-                                                      anEdge->line()->direction()));
-
-
   // Getting distance.
   double aDistance = real(FeaturesPlugin_Translation::DISTANCE_ID())->value();
 
index 0470dd73e7302a7f5588dd3a996063ab837c8865..b991e38f0b58914f2463c27ba09d21f9d4d5d4b9 100644 (file)
@@ -474,11 +474,6 @@ bool FeaturesPlugin_ValidatorExtrusionDir::isValid(
       if(aContext.get()) {
         aDirShape = aContext->shape();
       }
-
-      if (aDirShape.get() && aDirShape->isCompound()) {
-        GeomAPI_ShapeIterator anIt(aDirShape);
-        aDirShape = anIt.current();
-      }
     }
   }
 
index 6e14b846e106534fd604b8f35e67afde4f6f94bb..910a623e3bd48907dbbc846d0641782fc820b6d6 100644 (file)
@@ -41,7 +41,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                   label="Direction"
                   tooltip="Select an edge for direction"
                   shape_types="edge"
-                  geometrical_selection="true"
                   default="&lt;base normal&gt;">
     <validator id="GeomValidators_ShapeType" parameters="empty,line"/>
   </shape_selector>
@@ -75,7 +74,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                         label="Plane face"
                         tooltip="Bounding plane (select a planar face)"
                         shape_types="face"
-                        geometrical_selection="true"
                         default="&lt;base sketch&gt;">
           <validator id="GeomValidators_Face" parameters="plane"/>
         </shape_selector>
@@ -92,7 +90,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                         label="Plane face"
                         tooltip="Bounding plane (select a planar face)"
                         shape_types="face"
-                        geometrical_selection="true"
                         default="&lt;base sketch&gt;">
           <validator id="GeomValidators_Face" parameters="plane"/>
         </shape_selector>
index c8bc95a8e47c36bdfcff7de3c851da29b5a83a9e..b176ddc1812e8050c855c02a8569abd097c22aca 100755 (executable)
@@ -43,7 +43,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                     label="Direction"
                     tooltip="Select an edge for direction"
                     shape_types="edge"
-                    geometrical_selection="true"
                     default="&lt;base normal&gt;">
       <validator id="GeomValidators_ShapeType" parameters="empty,line"/>
     </shape_selector>
@@ -77,7 +76,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Plane face"
                           tooltip="Bounding plane (select a planar face)"
                           shape_types="face"
-                          geometrical_selection="true"
                           default="&lt;base sketch&gt;">
             <validator id="GeomValidators_Face" parameters="plane"/>
           </shape_selector>
@@ -93,7 +91,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Plane face"
                           tooltip="Bounding plane (select a planar face)"
                           shape_types="face"
-                          geometrical_selection="true"
                           default="&lt;base sketch&gt;">
             <validator id="GeomValidators_Face" parameters="plane"/>
           </shape_selector>
index 0891b558926a5566ae69f1c874a217e3fb110935..e65b6b4af990bcdcb52914206dae5522a2fd9ade 100644 (file)
@@ -43,7 +43,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                     label="Direction"
                     tooltip="Select an edge for direction"
                     shape_types="edge"
-                    geometrical_selection="true"
                     default="&lt;base normal&gt;">
       <validator id="GeomValidators_ShapeType" parameters="empty,line"/>
     </shape_selector>
@@ -77,7 +76,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Plane face"
                           tooltip="Bounding plane (select a planar face)"
                           shape_types="face"
-                          geometrical_selection="true"
                           default="&lt;base sketch&gt;">
             <validator id="GeomValidators_Face" parameters="plane"/>
           </shape_selector>
@@ -93,7 +91,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Plane face"
                           tooltip="Bounding plane (select a planar face)"
                           shape_types="face"
-                          geometrical_selection="true"
                           default="&lt;base sketch&gt;">
             <validator id="GeomValidators_Face" parameters="plane"/>
           </shape_selector>
index 747af9377e78f4d35915f03bedee0800297a6436..8396f4869cc40e774db9d4a965dec4816ecad978 100644 (file)
@@ -15,8 +15,7 @@
                     label="Axis"
                     tooltip="Select an edge for the angular direction"
                     shape_types="edge"
-                    default=""
-                    geometrical_selection="true">
+                    default="">
       <validator id="GeomValidators_ShapeType" parameters="line"/>
     </shape_selector>
     <optionalbox id="use_step_angular" title="Angular step">
index 4eed46173cf3984ddb6be053b99c82d0c661cddb..b6137c34ec3a8c3522ea408efb45ddf957312259 100644 (file)
@@ -34,8 +34,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                     label="Axis"
                     tooltip="Select an edge for the first direction"
                     shape_types="edge"
-                    default=""
-                    geometrical_selection="true">
+                    default="">
       <validator id="GeomValidators_ShapeType" parameters="line"/>
     </shape_selector>
     <doublevalue id="step_first_dir"
@@ -59,8 +58,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                     label="Axis"
                     tooltip="Select an edge for the second direction"
                     shape_types="edge"
-                    default=""
-                    geometrical_selection="true">
+                    default="">
       <validator id="GeomValidators_ShapeType" parameters="line"/>
     </shape_selector>
     <doublevalue id="step_second_dir"
index 684e8f394c41038ce08ef6b12f56c02f258399d6..42a493390a912e2c7ce45ee764252c21bfc0e315 100644 (file)
@@ -32,16 +32,14 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
     label="Select an object"
     icon="icons/Features/placement_from.png"
     tooltip="Select a start face, edge or vertex"
-    shape_types="face edge vertex"
-    geometrical_selection="true">
+    shape_types="face edge vertex">
     <validator id="GeomValidators_BodyShapes"/>
   </shape_selector>
   <shape_selector id="placement_end_shape"
     label="Select an object"
     icon="icons/Features/placement_to.png"
     tooltip="Select an end face, edge or vertex"
-    shape_types="face edge vertex"
-    geometrical_selection="true">
+    shape_types="face edge vertex">
     <validator id="PartSet_DifferentObjects"/>
     <validator id="GeomValidators_BodyShapes"/>
   </shape_selector>
index 3bc2c6683a86de26e96ab4e084abf0ae7efe60af..3d71c3d844b90a41682dbd5bfe7227b35f8abf25 100644 (file)
@@ -41,7 +41,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                   label="Axis"
                   tooltip="Select an edge for axis"
                   shape_types="edge"
-                  geometrical_selection="true"
                   default="">
     <validator id="GeomValidators_ShapeType" parameters="line"/>
   </shape_selector>
@@ -75,7 +74,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                         label="Plane face"
                         tooltip="Bounding plane (select a planar face)"
                         shape_types="face"
-                        geometrical_selection="true"
                         default="&lt;base sketch&gt;">
           <validator id="GeomValidators_Face" parameters="plane"/>
         </shape_selector>
@@ -92,7 +90,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                         label="Plane face"
                         tooltip="Bounding plane (select a planar face)"
                         shape_types="face"
-                        geometrical_selection="true"
                         default="&lt;base sketch&gt;">
           <validator id="GeomValidators_Face" parameters="plane"/>
         </shape_selector>
index 297fc706fd950f69ed4f2ebf63aeee680980fbf2..12f2f247f45e509048e9dd951573275a38668bfa 100644 (file)
@@ -43,7 +43,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                     label="Axis"
                     tooltip="Select an edge for axis"
                     shape_types="edge"
-                    geometrical_selection="true"
                     default="">
       <validator id="GeomValidators_ShapeType" parameters="line"/>
     </shape_selector>
@@ -77,7 +76,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Plane face"
                           tooltip="Bounding plane (select a planar face)"
                           shape_types="face"
-                          geometrical_selection="true"
                           default="&lt;sketch&gt;">
             <validator id="GeomValidators_Face" parameters="plane"/>
           </shape_selector>
@@ -93,7 +91,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Plane face"
                           tooltip="Bounding plane (select a planar face)"
                           shape_types="face"
-                          geometrical_selection="true"
                           default="&lt;sketch&gt;">
             <validator id="GeomValidators_Face" parameters="plane"/>
           </shape_selector>
index 5e358ee66b311e70648c61231b8b3b8fa1fa4a90..6d1bb83945ef55b9e1a08688f8ea6173cb2ae147 100644 (file)
@@ -43,7 +43,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                     label="Axis"
                     tooltip="Select an edge for axis"
                     shape_types="edge"
-                    geometrical_selection="true"
                     default="">
       <validator id="GeomValidators_ShapeType" parameters="line"/>
     </shape_selector>
@@ -77,7 +76,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Plane face"
                           tooltip="Bounding plane (select a planar face)"
                           shape_types="face"
-                          geometrical_selection="true"
                           default="&lt;sketch&gt;">
             <validator id="GeomValidators_Face" parameters="plane"/>
           </shape_selector>
@@ -93,7 +91,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                           label="Plane face"
                           tooltip="Bounding plane (select a planar face)"
                           shape_types="face"
-                          geometrical_selection="true"
                           default="&lt;sketch&gt;">
             <validator id="GeomValidators_Face" parameters="plane"/>
           </shape_selector>
index 41899821036b83b4031a8b91628884d4b48f32f9..c07bd8ba850eb192b91dabb611b572295cc4b740 100755 (executable)
@@ -37,8 +37,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                   label="Axis"
                   tooltip="Select an edge for axis"
                   shape_types="edge"
-                  default=""
-                  geometrical_selection="true">
+                  default="">
         <validator id="GeomValidators_ShapeType" parameters="line"/>
       </shape_selector>
       <doublevalue id="angle"
index 6d73285bbb99a2604e26300ac9a9f49c19a7c3b3..9923217faaed1415bab958bc097afdd7ceed7a27 100644 (file)
@@ -53,8 +53,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       label="Axis"
                       tooltip="Select an axis"
                       shape_types="edge"
-                      default=""
-                      geometrical_selection="true">
+                      default="">
         <validator id="GeomValidators_ShapeType" parameters="line"/>
       </shape_selector>
     </box>
index 3e5ef8260ce4c12cb05e8263d131e5476514fd42..28bb25115ef0ba4363f26de0757ae7442001644f 100644 (file)
@@ -37,8 +37,7 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
                       label="Axis"
                       tooltip="Select an edge for axis"
                       shape_types="edge"
-                      default=""
-                      geometrical_selection="true">
+                      default="">
         <validator id="GeomValidators_ShapeType" parameters="line"/>
       </shape_selector>
       <doublevalue id="distance"
index c07cda2db43205b1c52ac3070ba255f2370e973e..3e3ed5d4edfaa4fd84df68c8243bb6ddcc082986 100644 (file)
@@ -21,7 +21,6 @@
 #include "GeomAlgoAPI_Placement.h"
 
 #include <GeomAlgoAPI_DFLoader.h>
-#include <GeomAlgoAPI_ShapeTools.h>
 
 #include <GeomAPI_Dir.h>
 #include <GeomAPI_Edge.h>
@@ -29,7 +28,6 @@
 #include <GeomAPI_Lin.h>
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_Pln.h>
-#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Vertex.h>
 #include <GeomAPI_XYZ.h>
 
@@ -72,48 +70,29 @@ void GeomAlgoAPI_Placement::build(const std::shared_ptr<GeomAPI_Shape>& theSourc
 
   GProp_GProps aProps;
   static const double aPropEps = 1.e-4;
-  GeomShapePtr aShape;
-  bool isCompound = false;
   for (int i = 0; i < aNbObjects; i++) {
-    aShape = aShapes[i];
-    isCompound = false;
-    if (aShapes[i]->isCompound()) {
-      isCompound = true;
-      GeomAPI_ShapeIterator anIt(aShapes[i]);
-      aShape = anIt.current();
-
-      GeomPointPtr aPnt = GeomAlgoAPI_ShapeTools::centreOfMass(aShapes[i]);
-      aSrcDstPoints[i].SetCoord(aPnt->x(), aPnt->y(), aPnt->z());
-    }
-
-    if (aShape->isFace()) {
-      std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aShape));
+    if (aShapes[i]->isFace()) {
+      std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aShapes[i]));
       std::shared_ptr<GeomAPI_Pln> aPlane = aFace->getPlane();
       std::shared_ptr<GeomAPI_Dir> aDir = aPlane->direction();
       aSrcDstNormals[i].SetCoord(aDir->x(), aDir->y(), aDir->z());
 
-      if (!isCompound) {
-        BRepGProp::SurfaceProperties(aFace->impl<TopoDS_Face>(), aProps, aPropEps);
-        gp_Pnt aLoc = aProps.CentreOfMass();
-        aSrcDstPoints[i].SetCoord(aLoc.X(), aLoc.Y(), aLoc.Z());
-      }
+      BRepGProp::SurfaceProperties(aFace->impl<TopoDS_Face>(), aProps, aPropEps);
+      gp_Pnt aLoc = aProps.CentreOfMass();
+      aSrcDstPoints[i].SetCoord(aLoc.X(), aLoc.Y(), aLoc.Z());
     }
-    else if (aShape->isEdge()) {
-      std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aShape));
+    else if (aShapes[i]->isEdge()) {
+      std::shared_ptr<GeomAPI_Edge> anEdge(new GeomAPI_Edge(aShapes[i]));
       std::shared_ptr<GeomAPI_Lin> aLine = anEdge->line();
       std::shared_ptr<GeomAPI_Dir> aDir = aLine->direction();
+      std::shared_ptr<GeomAPI_Pnt> aFirstPnt = anEdge->firstPoint();
+      std::shared_ptr<GeomAPI_Pnt> aLastPnt = anEdge->lastPoint();
+      std::shared_ptr<GeomAPI_XYZ> aLoc = aFirstPnt->xyz()->added(aLastPnt->xyz())->multiplied(0.5);
+      aSrcDstPoints[i].SetCoord(aLoc->x(), aLoc->y(), aLoc->z());
       aSrcDstDirections[i].SetCoord(aDir->x(), aDir->y(), aDir->z());
-
-      if (!isCompound) {
-        std::shared_ptr<GeomAPI_Pnt> aFirstPnt = anEdge->firstPoint();
-        std::shared_ptr<GeomAPI_Pnt> aLastPnt = anEdge->lastPoint();
-        std::shared_ptr<GeomAPI_XYZ> aLoc = aFirstPnt->xyz()->added(aLastPnt->xyz())
-                                                            ->multiplied(0.5);
-        aSrcDstPoints[i].SetCoord(aLoc->x(), aLoc->y(), aLoc->z());
-      }
     }
-    else if (aShape->isVertex()) {
-      std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex(aShape));
+    else if (aShapes[i]->isVertex()) {
+      std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex(aShapes[i]));
       std::shared_ptr<GeomAPI_Pnt> aPnt = aVertex->point();
       aSrcDstPoints[i].SetCoord(aPnt->x(), aPnt->y(), aPnt->z());
     } else // something goes wrong
index a5f9d588cb888bb78977b362846b54f0ad8b9a7c..945f9bc34d306c14beda27425213d5b0cadb4100 100644 (file)
@@ -24,7 +24,6 @@
 #include "ModelAPI_AttributeSelection.h"
 
 #include <GeomAPI_Face.h>
-#include <GeomAPI_ShapeIterator.h>
 
 #include <GeomAbs_SurfaceType.hxx>
 
@@ -47,40 +46,6 @@ GeomAbs_SurfaceType faceType(const std::string& theType)
   return GeomAbs_Plane;
 }
 
-bool isValidFace(const GeomShapePtr theShape,
-                 const GeomAbs_SurfaceType theFaceType,
-                 Events_InfoMessage& theError)
-{
-  GeomFacePtr aGeomFace = theShape->face();
-
-  if (!aGeomFace.get()) {
-    theError = "The shape is not a face.";
-      return false;
-  }
-
-  bool aValid = true;
-
-  switch (theFaceType) {
-    case GeomAbs_Plane: {
-      aValid = aGeomFace->isPlanar();
-      if (!aValid) theError = "The shape is not a plane.";
-      break;
-    }
-    case GeomAbs_Cylinder: {
-      aValid = aGeomFace->isCylindrical();
-      if (!aValid) theError = "The shape is not a cylinder.";
-      break;
-    }
-    default: {
-      aValid = false;
-      theError = "The shape is not an available face.";
-      break;
-    }
-  }
-
-  return aValid;
-}
-
 bool GeomValidators_Face::isValid(const AttributePtr& theAttribute,
                                   const std::list<std::string>& theArguments,
                                   Events_InfoMessage& theError) const
@@ -113,22 +78,36 @@ bool GeomValidators_Face::isValid(const AttributePtr& theAttribute,
       theError = "The shape is not a face.";
     }
     else {
-      GeomAbs_SurfaceType aFaceType = GeomAbs_Plane;
-      if (theArguments.size() == 1) aFaceType = faceType(theArguments.front());
-      if (aGeomShape->isFace()) {
-        isValidFace(aGeomShape, aFaceType, theError);
+      std::shared_ptr<GeomAPI_Face> aGeomFace(new GeomAPI_Face(aGeomShape));
+      if (!aGeomFace.get()) {
+        aValid = false;
+        theError = "The shape is not a face.";
       }
-      else if (aSelectionAttr->isGeometricalSelection() && aGeomShape->isCompound()) {
-        for (GeomAPI_ShapeIterator anIt(aGeomShape); anIt.more(); anIt.next()) {
-          if (!isValidFace(anIt.current(), aFaceType, theError)) {
+      else {
+        GeomAbs_SurfaceType aFaceType = GeomAbs_Plane;
+        if (theArguments.size() == 1)
+          aFaceType = faceType(theArguments.front());
+
+        switch (aFaceType) {
+          case GeomAbs_Plane: {
+            aValid = aGeomFace->isPlanar();
+            if (!aValid)
+              theError = "The shape is not a plane.";
+          }
+          break;
+          case GeomAbs_Cylinder:{
+            aValid = aGeomFace->isCylindrical();
+            if (!aValid)
+              theError = "The shape is not a cylinder.";
+          }
+          break;
+          default: {
+            aValid = false;
+            theError = "The shape is not an available face.";
             break;
           }
         }
       }
-      else {
-        aValid = false;
-        theError = "The shape is not a face.";
-      }
     }
   }
   return aValid;
index a7638e7be7ad0e30441d7577daaf2a8b0ab9109a..afb7dd0c93eb2c6a5bb6eefa2965bd750a5b698b 100755 (executable)
@@ -22,7 +22,6 @@
 #include "GeomValidators_Tools.h"
 
 #include <GeomAPI_Curve.h>
-#include <GeomAPI_ShapeIterator.h>
 #include <GeomDataAPI_Point2D.h>
 
 #include <ModelAPI_Result.h>
@@ -131,27 +130,18 @@ bool GeomValidators_ShapeType::isValidAttribute(const AttributePtr& theAttribute
       std::dynamic_pointer_cast<ModelAPI_AttributeSelection>(theAttribute);
     GeomShapePtr aShape = anAttr->value();
     if (aShape.get())
-      aValid = isValidShape(aShape, theShapeType, anAttr->isGeometricalSelection(), theError);
+      aValid = isValidShape(aShape, theShapeType, theError);
     else {
       if (anAttr->context().get())
-        aValid = isValidObject(anAttr->context(),
-                               theShapeType,
-                               anAttr->isGeometricalSelection(),
-                               theError);
+        aValid = isValidObject(anAttr->context(), theShapeType, theError);
       else
-        aValid = isValidObject(anAttr->contextFeature(),
-                               theShapeType,
-                               anAttr->isGeometricalSelection(),
-                               theError);
+        aValid = isValidObject(anAttr->contextFeature(), theShapeType, theError);
     }
   }
   else if (anAttributeType == ModelAPI_AttributeRefAttr::typeId()) {
     AttributeRefAttrPtr anAttr = std::dynamic_pointer_cast<ModelAPI_AttributeRefAttr>(theAttribute);
     if (anAttr->isObject()) {
-      aValid = isValidObject(anAttr->object(),
-                             theShapeType,
-                             false,
-                             theError);
+      aValid = isValidObject(anAttr->object(), theShapeType, theError);
     }
     else if (theShapeType == Vertex) {
       AttributePtr aRefAttr = anAttr->attr();
@@ -172,7 +162,7 @@ bool GeomValidators_ShapeType::isValidAttribute(const AttributePtr& theAttribute
   else if (anAttributeType == ModelAPI_AttributeReference::typeId()) {
     AttributeReferencePtr anAttr =
                               std::dynamic_pointer_cast<ModelAPI_AttributeReference>(theAttribute);
-    aValid = isValidObject(anAttr->value(), theShapeType, false, theError);
+    aValid = isValidObject(anAttr->value(), theShapeType, theError);
   }
   else if (anAttributeType == ModelAPI_AttributeSelectionList::typeId()) {
     AttributeSelectionListPtr aListAttr =
@@ -200,7 +190,6 @@ bool GeomValidators_ShapeType::isValidAttribute(const AttributePtr& theAttribute
 
 bool GeomValidators_ShapeType::isValidObject(const ObjectPtr& theObject,
                                              const TypeOfShape theShapeType,
-                                             const bool theIsGeometricalSelection,
                                              Events_InfoMessage& theError) const
 {
   bool aValid = true;
@@ -225,7 +214,7 @@ bool GeomValidators_ShapeType::isValidObject(const ObjectPtr& theObject,
         aValid = false;
         theError = "The result is empty";
       } else {
-        aValid = isValidShape(aResult->shape(), theShapeType, theIsGeometricalSelection, theError);
+        aValid = isValidShape(aResult->shape(), theShapeType, theError);
       }
     } else {
       FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
@@ -242,7 +231,6 @@ bool GeomValidators_ShapeType::isValidObject(const ObjectPtr& theObject,
 
 bool GeomValidators_ShapeType::isValidShape(const GeomShapePtr theShape,
                                             const TypeOfShape theShapeType,
-                                            const bool theIsGeometricalSelection,
                                             Events_InfoMessage& theError) const
 {
   bool aValid = true;
@@ -259,21 +247,9 @@ bool GeomValidators_ShapeType::isValidShape(const GeomShapePtr theShape,
     case Edge:
       aValid = theShape->isEdge();
       break;
-    case Line: {
-      if (theIsGeometricalSelection && theShape->isCompound()) {
-        aValid = true;
-        for (GeomAPI_ShapeIterator anIt(theShape); anIt.more(); anIt.next()) {
-          if (!anIt.current()->isEdge() || !GeomAPI_Curve(anIt.current()).isLine()) {
-            aValid = false;
-            break;
-          }
-        }
-      }
-      else {
-        aValid = theShape->isEdge() && GeomAPI_Curve(theShape).isLine();
-      }
+    case Line:
+      aValid = theShape->isEdge() && GeomAPI_Curve(theShape).isLine();
       break;
-    }
     case Circle:
       aValid = theShape->isEdge() && GeomAPI_Curve(theShape).isCircle();
       break;
index 0606cd411235d36e110dfb60a8b10399b0f42694..daf9fda38d230c7d73c38e318c4a809baea31e59 100644 (file)
@@ -83,7 +83,6 @@ protected:
   /// \param[out] theError error message.
   bool isValidObject(const ObjectPtr& theObject,
                      const TypeOfShape theShapeType,
-                     const bool theIsGeometricalSelection,
                      Events_InfoMessage& theError) const;
 
   /// Returns true if the attibute's object type satisfies the argument value
@@ -92,7 +91,6 @@ protected:
   /// \param[out] theError error message.
   bool isValidShape(const GeomShapePtr theShape,
                     const TypeOfShape theShapeType,
-                    const bool theIsGeometricalSelection,
                     Events_InfoMessage& theError) const;
 
 };
index d6181783f4931cb7a9e647070e3c60d28dd5abfc..4a919d0c4b6afe96dc4c0fe774509a0478fb1863 100644 (file)
@@ -31,7 +31,6 @@
 #include <GeomAPI_Dir.h>
 #include <GeomAPI_Face.h>
 #include <GeomAPI_Shape.h>
-#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Pln.h>
 #include <GeomAPI_Pnt.h>
 
@@ -132,10 +131,6 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr<ModelAPI_Feature>&
     if(aToShape.get() == NULL && anAttrSel->context().get() != NULL) {
       aToShape =  anAttrSel->context()->shape();
     }
-    if (aToShape->isCompound()) {
-      GeomAPI_ShapeIterator anIt(aToShape);
-      aToShape = anIt.current();
-    }
   }
   anIt++;
 
@@ -151,10 +146,6 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr<ModelAPI_Feature>&
     if(aFromShape.get() == NULL && anAttrSel->context().get() != NULL) {
       aFromShape = anAttrSel->context()->shape();
     }
-    if (aFromShape->isCompound()) {
-      GeomAPI_ShapeIterator anIt(aFromShape);
-      aFromShape = anIt.current();
-    }
   }
   anIt++;
 
index 90cbe4322e7b0af7ff02ed65c703cd4f3b4fc3eb..af1020ab5a9463bf89f95b52b181196c57fe907b 100644 (file)
@@ -40,7 +40,6 @@
 #include <Events_InfoMessage.h>
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Pnt.h>
-#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Vertex.h>
 #include <GeomAlgoAPI_CompoundBuilder.h>
 #include <GeomAlgoAPI_NExplode.h>
@@ -452,10 +451,6 @@ void Model_AttributeSelection::setID(const std::string theID)
 {
   myRef.setID(theID);
   ModelAPI_AttributeSelection::setID(theID);
-  FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(owner());
-  // TODO: check if parent list have geometrical selection flag.
-  myIsGeometricalSelection =
-    ModelAPI_Session::get()->validators()->isGeometricalSelection(aFeature->getKind(), id());
 }
 
 ResultPtr Model_AttributeSelection::context()
@@ -779,7 +774,7 @@ void Model_AttributeSelection::selectBody(
       if (aEraseResults) // erase results without flash deleted and redisplay: do it after Select
         aFeatureOwner->removeResults(0, false, false);
     }
-    aSel.Select(aNewSub, aNewContext, myIsGeometricalSelection);
+    aSel.Select(aNewSub, aNewContext);
     // face may become divided after the model update, so, new labels may be added to the scope
     myScope.Clear();
 
@@ -869,14 +864,6 @@ std::string Model_AttributeSelection::namingName(const std::string& theDefaultNa
     return "";
   }
 
-  if (myIsGeometricalSelection
-      && aSubSh.get()
-      && aSubSh->isCompound())
-  {
-    GeomAPI_ShapeIterator anIt(aSubSh);
-    aSubSh = anIt.current();
-  }
-
   Model_SelectionNaming aSelNaming(selectionLabel());
   std::string aResult = aSelNaming.namingName(
     aCont, aSubSh, theDefaultName, owner()->document() != aCont->document());
index 380b998dee6e36a23ee67af78f5115fb9035107b..cafa6ea379ac2cb52855309641faef2eba8e3c79 100644 (file)
@@ -47,9 +47,6 @@ class Model_AttributeSelection : public ModelAPI_AttributeSelection
   CenterType myTmpCenterType;
   /// Reference to the partent attribute, if any (to split selection compounds in issue 1799)
   Model_AttributeSelectionList* myParent;
-  /// If true attribute selects geometry instead of shape.
-  bool myIsGeometricalSelection;
-
 public:
   /// Defines the result and its selected sub-shape
   /// \param theContext object where the sub-shape was selected
@@ -183,11 +180,6 @@ protected:
   void computeValues(ResultPtr theOldContext, ResultPtr theNewContext, TopoDS_Shape theValShape,
     TopTools_ListOfShape& theShapes);
 
-  /// Returns true if is geometrical selection.
-  virtual bool isGeometricalSelection() const {
-    return myIsGeometricalSelection;
-  };
-
   friend class Model_Data;
   friend class Model_AttributeSelectionList;
 };
index c231bfd0e2ef088a356ed57a4b5628b3223d8366..9fb4124075eac962de1a6d8b15a7770541194003 100644 (file)
@@ -332,11 +332,11 @@ std::shared_ptr<ModelAPI_AttributeSelection>
   // (if attribute is deleted and created, the abort updates attriute and makes the Attr invalid)
   std::shared_ptr<Model_AttributeSelection> aNewAttr =
     std::shared_ptr<Model_AttributeSelection>(new Model_AttributeSelection(aLabel));
+  aNewAttr->setID(id());
   if (owner()) {
     aNewAttr->setObject(owner());
     aNewAttr->setParent(this);
   }
-  aNewAttr->setID(id());
   return aNewAttr;
 }
 
index a7a032eea1b9ba564266f94911f57578cd2d688a..2a830e788a740f3414a5ad29d9de423470f07db3 100644 (file)
@@ -471,10 +471,6 @@ void Model_Session::processEvent(const std::shared_ptr<Events_Message>& theMessa
         if (!aCases.empty()) {
           validators()->registerCase(aMsgAttr->featureId(), aMsgAttr->attributeId(), aCases);
         }
-        if (aMsgAttr->isGeometricalSelection()) {
-          validators()->registerGeometricalSelection(aMsgAttr->featureId(),
-                                                     aMsgAttr->attributeId());
-        }
       }
     }
     // plugins information was started to load, so, it will be loaded
index 5bf41b28976b71d3a371eafcf31ad30f6b75d576..41fa0f7014a03e24137734cbd4bc447925905271 100644 (file)
@@ -377,27 +377,3 @@ bool Model_ValidatorsFactory::isMainArgument(std::string theFeature, std::string
   std::map<std::string, std::string>::iterator aFound = myMainArgument.find(theFeature);
   return aFound != myMainArgument.end() && aFound->second == theAttribute;
 }
-
-void Model_ValidatorsFactory::registerGeometricalSelection(std::string theFeature,
-                                                           std::string theAttribute)
-{
-  std::map<std::string, std::set<std::string> >::iterator aFind =
-    myGeometricalSelection.find(theFeature);
-  if (aFind == myGeometricalSelection.end()) {
-    std::set<std::string> aNewSet;
-    aNewSet.insert(theAttribute);
-    myGeometricalSelection[theFeature] = aNewSet;
-  }
-  else {
-    aFind->second.insert(theAttribute);
-  }
-}
-
-bool Model_ValidatorsFactory::isGeometricalSelection(std::string theFeature,
-                                                     std::string theAttribute)
-{
-  std::map<std::string, std::set<std::string> >::iterator aFind =
-    myGeometricalSelection.find(theFeature);
-  return aFind != myGeometricalSelection.end()
-         && aFind->second.find(theAttribute) != aFind->second.end();
-}
index 7dcf2ff98c2470ec64311439b3ab4d3a0f9cf5df..939cdf21390017aebd1c22b3bc2de2de5e62e94e 100644 (file)
@@ -58,7 +58,6 @@ class Model_ValidatorsFactory : public ModelAPI_ValidatorsFactory
           std::map<std::string, std::set<std::string> > > > myCases;
   /// Stores main attribute for each feature
   std::map<std::string, std::string> myMainArgument;
-  std::map<std::string, std::set<std::string> > myGeometricalSelection;
 
  public:
   /// Registers the instance of the validator by the ID
@@ -124,12 +123,6 @@ class Model_ValidatorsFactory : public ModelAPI_ValidatorsFactory
   /// Returns true is the attribute is a main argument of the feature
   virtual bool isMainArgument(std::string theFeature, std::string theAttribute);
 
-  /// Register the selection attribute as geometrical selection
-  virtual void registerGeometricalSelection(std::string theFeature, std::string theAttribute);
-
-  /// Returns true if the attribute is a geometrical selection
-  virtual bool isGeometricalSelection(std::string theFeature, std::string theAttribute);
-
 
 protected:
   /// Adds the defualt validators that are usefull for all features.
index ea37d417382e421d7f631aee82b06ec0187f779d..53e0151b8760f9943a73bc8aa73d13b6308b85d7 100644 (file)
@@ -115,9 +115,6 @@ class ModelAPI_AttributeSelection : public ModelAPI_Attribute
   /// Returns true if recompute of selection become impossible
   virtual bool isInvalid() = 0;
 
-  /// Returns true if is geometrical selection.
-  virtual bool isGeometricalSelection() const = 0;
-
   /// To virtually destroy the fields of successors
   MODELAPI_EXPORT virtual ~ModelAPI_AttributeSelection();
 
index e40e05536bbb58755672bb7329e52c7b24efeeb7..a2c8af67abe69d060c96f75bcb140f12376753e4 100644 (file)
@@ -128,12 +128,6 @@ class MODELAPI_EXPORT ModelAPI_ValidatorsFactory
  /// Returns true if the attribute must be checked (the case is selected)
   virtual bool isCase(FeaturePtr theFeature, std::string theAttribute) = 0;
 
-  /// Register the selection attribute as geometrical selection
-  virtual void registerGeometricalSelection(std::string theFeature, std::string theAttribute) = 0;
-
-  /// Returns true if the attribute is a geometrical selection
-  virtual bool isGeometricalSelection(std::string theFeature, std::string theAttribute) = 0;
-
  protected:
   /// Get instance from Session
   ModelAPI_ValidatorsFactory()
index 7e33d61fea254dd264a0e249f7b433ff07f18ddf..92eaa64f200bfb383705576329b6ddd6dbe44533 100644 (file)
@@ -25,7 +25,6 @@
 #include <GeomAPI_Pnt.h>
 #include <GeomAPI_Dir.h>
 #include <GeomAPI_ShapeExplorer.h>
-#include <GeomAPI_ShapeIterator.h>
 #include <GeomAlgoAPI_NExplode.h>
 
 #include <GeomDataAPI_Dir.h>
@@ -1068,11 +1067,6 @@ ModelHighAPI_Dumper& ModelHighAPI_Dumper::operator<<(
     isDumpByGeom = aSelectedFeature && aSelectedFeature->isInHistory();
   }
 
-  if (theAttrSelect->isGeometricalSelection() && aShape->shapeType() == GeomAPI_Shape::COMPOUND) {
-    GeomAPI_ShapeIterator anIt(aShape);
-    aShape = anIt.current();
-  }
-
   myDumpBuffer << "\"" << aShape->shapeTypeStr();
   bool aStandardDump = true;
   if (isDumpByGeom) {
index 2da170fd6ddd60a7747034ecf12541932deb87af..2c2916586faf73884dc1a01fe6be55f172f3d4ee 100644 (file)
@@ -9,7 +9,6 @@
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
 #include <GeomAPI_ShapeExplorer.h>
-#include <GeomAPI_ShapeIterator.h>
 
 #include <GeomAlgoAPI_PointBuilder.h>
 
@@ -83,43 +82,21 @@ void PrimitivesPlugin_Cone::execute()
   }
 
   // Getting axis.
-  static const std::string aSelectionError = "Error: The axis shape selection is bad.";
-  std::shared_ptr<ModelAPI_AttributeSelection> anEdgeRef = selection(AXIS_ID());
-  GeomShapePtr aShape = anEdgeRef->value();
-  if (!aShape.get()) {
-    if (anEdgeRef->context().get()) {
-      aShape = anEdgeRef->context()->shape();
-    }
-  }
-  if (!aShape.get()) {
-    setError(aSelectionError);
-    return;
-  }
+  std::shared_ptr<GeomAPI_Ax2> anAxis;
   std::shared_ptr<GeomAPI_Edge> anEdge;
-  if (aShape->isEdge())
-  {
-    anEdge = aShape->edge();
-  }
-  else if (aShape->isCompound())
-  {
-    GeomAPI_ShapeIterator anIt(aShape);
-    anEdge = anIt.current()->edge();
+  std::shared_ptr<ModelAPI_AttributeSelection> anEdgeRef =
+    selection(PrimitivesPlugin_Cone::AXIS_ID());
+  if(anEdgeRef && anEdgeRef->value() && anEdgeRef->value()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anEdgeRef->value()));
+  } else if (anEdgeRef && !anEdgeRef->value() && anEdgeRef->context() &&
+             anEdgeRef->context()->shape() && anEdgeRef->context()->shape()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anEdgeRef->context()->shape()));
   }
-  else
-  {
-    setError(aSelectionError);
-    return;
+  if(anEdge) {
+    anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(aBasePoint,
+                                                          anEdge->line()->direction()));
   }
 
-  if (!anEdge.get())
-  {
-    setError(aSelectionError);
-    return;
-  }
-
-  std::shared_ptr<GeomAPI_Ax2> anAxis(new GeomAPI_Ax2(aBasePoint,
-                                                      anEdge->line()->direction()));
-
   // Getting base radius, top radius and height
   double aBaseRadius = real(PrimitivesPlugin_Cone::BASE_RADIUS_ID())->value();
   double aTopRadius = real(PrimitivesPlugin_Cone::TOP_RADIUS_ID())->value();
index 9a80ed0ae49b138af6d91acf88abce287f411866..c3d5b82235327c599349018d31b12fb1d094574f 100644 (file)
@@ -23,7 +23,6 @@
 #include <GeomAPI_Dir.h>
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
-#include <GeomAPI_ShapeIterator.h>
 
 #include <GeomAlgoAPI_PointBuilder.h>
 
@@ -113,44 +112,21 @@ void PrimitivesPlugin_Cylinder::createCylinder(bool withAngle)
   }
 
   // Getting axis.
-  static const std::string aSelectionError = "Error: The axis shape selection is bad.";
-  std::shared_ptr<ModelAPI_AttributeSelection> anEdgeRef = selection(AXIS_ID());
-  GeomShapePtr aShape = anEdgeRef->value();
-  if (!aShape.get()) {
-    if (anEdgeRef->context().get()) {
-      aShape = anEdgeRef->context()->shape();
-    }
-  }
-  if (!aShape.get()) {
-    setError(aSelectionError);
-    return;
-  }
+  std::shared_ptr<GeomAPI_Ax2> anAxis;
   std::shared_ptr<GeomAPI_Edge> anEdge;
-  if (aShape->isEdge())
-  {
-    anEdge = aShape->edge();
-  }
-  else if (aShape->isCompound())
-  {
-    GeomAPI_ShapeIterator anIt(aShape);
-    anEdge = anIt.current()->edge();
-  }
-  else
-  {
-    setError(aSelectionError);
-    return;
-  }
-
-  if (!anEdge.get())
-  {
-    setError(aSelectionError);
-    return;
+  std::shared_ptr<ModelAPI_AttributeSelection> anEdgeRef =
+    selection(PrimitivesPlugin_Cylinder::AXIS_ID());
+  if(anEdgeRef && anEdgeRef->value() && anEdgeRef->value()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anEdgeRef->value()));
+  } else if (anEdgeRef && !anEdgeRef->value() && anEdgeRef->context() &&
+             anEdgeRef->context()->shape() && anEdgeRef->context()->shape()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anEdgeRef->context()->shape()));
+  }
+  if(anEdge) {
+    anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(aBasePoint,
+                                                          anEdge->line()->direction()));
   }
 
-  std::shared_ptr<GeomAPI_Ax2> anAxis(new GeomAPI_Ax2(aBasePoint,
-                                                      anEdge->line()->direction()));
-
-
   // Getting radius and height
   double aRadius = real(PrimitivesPlugin_Cylinder::RADIUS_ID())->value();
   double aHeight = real(PrimitivesPlugin_Cylinder::HEIGHT_ID())->value();
index cddab69e45393ef8bd4f33f44a80b873db0e08ab..a086def17e8aa7171a97ac95766409bf36cd9883 100644 (file)
@@ -9,7 +9,6 @@
 #include <GeomAPI_Edge.h>
 #include <GeomAPI_Lin.h>
 #include <GeomAPI_ShapeExplorer.h>
-#include <GeomAPI_ShapeIterator.h>
 
 #include <GeomAlgoAPI_PointBuilder.h>
 
@@ -81,43 +80,21 @@ void PrimitivesPlugin_Torus::execute()
   }
 
   // Getting axis.
-  static const std::string aSelectionError = "Error: The axis shape selection is bad.";
-  std::shared_ptr<ModelAPI_AttributeSelection> anEdgeRef = selection(AXIS_ID());
-  GeomShapePtr aShape = anEdgeRef->value();
-  if (!aShape.get()) {
-    if (anEdgeRef->context().get()) {
-      aShape = anEdgeRef->context()->shape();
-    }
-  }
-  if (!aShape.get()) {
-    setError(aSelectionError);
-    return;
-  }
+  std::shared_ptr<GeomAPI_Ax2> anAxis;
   std::shared_ptr<GeomAPI_Edge> anEdge;
-  if (aShape->isEdge())
-  {
-    anEdge = aShape->edge();
-  }
-  else if (aShape->isCompound())
-  {
-    GeomAPI_ShapeIterator anIt(aShape);
-    anEdge = anIt.current()->edge();
+  std::shared_ptr<ModelAPI_AttributeSelection> anEdgeRef =
+    selection(PrimitivesPlugin_Torus::AXIS_ID());
+  if(anEdgeRef && anEdgeRef->value() && anEdgeRef->value()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anEdgeRef->value()));
+  } else if (anEdgeRef && !anEdgeRef->value() && anEdgeRef->context() &&
+             anEdgeRef->context()->shape() && anEdgeRef->context()->shape()->isEdge()) {
+    anEdge = std::shared_ptr<GeomAPI_Edge>(new GeomAPI_Edge(anEdgeRef->context()->shape()));
   }
-  else
-  {
-    setError(aSelectionError);
-    return;
+  if(anEdge) {
+    anAxis = std::shared_ptr<GeomAPI_Ax2>(new GeomAPI_Ax2(aBasePoint,
+                                                          anEdge->line()->direction()));
   }
 
-  if (!anEdge.get())
-  {
-    setError(aSelectionError);
-    return;
-  }
-
-  std::shared_ptr<GeomAPI_Ax2> anAxis(new GeomAPI_Ax2(aBasePoint,
-                                                      anEdge->line()->direction()));
-
   // Getting radius and ring radius
   double aRadius = real(PrimitivesPlugin_Torus::RADIUS_ID())->value();
   double aRingRadius = real(PrimitivesPlugin_Torus::RING_RADIUS_ID())->value();
index 710134ca0badd3ed7b2062c3605ba7a31a2b8bc1..4f1acd5e45c350b7a1be4ff2c7abe9bb34097fb9 100644 (file)
@@ -16,7 +16,6 @@
       label="axis"
       default=""
       shape_types="edge"
-      geometrical_selection="true"
       icon="icons/Primitives/axis.png"
       tooltip="Select the axis of the cone">
     <validator id="GeomValidators_ConstructionComposite"/>
index 2474f8badd8912154304bc27e2616470fec13d42..373bafb5f2a297d4a08a5e29fd19ef1cec793527 100644 (file)
@@ -37,7 +37,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
           label="axis"
           default=""
           shape_types="edge"
-          geometrical_selection="true"
           icon="icons/Primitives/axis.png"
           tooltip="Select the axis of the cylinder">
         <validator id="GeomValidators_ConstructionComposite"/>
@@ -76,7 +75,6 @@ email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com
           label="axis"
           default=""
           shape_types="edge"
-          geometrical_selection="true"
           icon="icons/Primitives/axis.png"
           tooltip="Select the axis of the cylinder">
         <validator id="GeomValidators_ConstructionComposite"/>
index 30f6489e429fbc8a002da4f0847511f15f9c6ce9..44d0ce6888dc7938dc2c514d867066e207108764 100644 (file)
@@ -16,7 +16,6 @@
       label="axis"
       default=""
       shape_types="edge"
-      geometrical_selection="true"
       icon="icons/Primitives/axis.png"
       tooltip="Select the axis of the torus">
     <validator id="GeomValidators_ConstructionComposite"/>
index 1b7753423b460656dcadfe74cc20f17ac54bc8eb..d23ad07d0118e0c581692eef8bca4e006d6d9d26 100755 (executable)
@@ -25,7 +25,6 @@
 
 #include <GeomAPI_Dir.h>
 #include <GeomAPI_PlanarEdges.h>
-#include <GeomAPI_ShapeIterator.h>
 #include <GeomAPI_Vertex.h>
 
 #include <GeomDataAPI_Point2D.h>
@@ -256,14 +255,7 @@ void SketchPlugin_Sketch::attributeChanged(const std::string& theID) {
       std::shared_ptr<GeomAPI_Shape> aSelection = aSelAttr->value();
       if (!aSelection.get()) aSelection = aSelAttr->context()->shape();
       // update the sketch plane
-      std::shared_ptr<GeomAPI_Face> aFace;
-      if (aSelection->isFace()) {
-        aFace = aSelection->face();
-      } else if (aSelection->isCompound()) {
-        GeomAPI_ShapeIterator anIt(aSelection);
-        aFace = anIt.current()->face();
-      }
-
+      std::shared_ptr<GeomAPI_Face> aFace(new GeomAPI_Face(aSelection));
       std::shared_ptr<GeomAPI_Pln> aPlane = aFace->getPlane();
       if (aPlane) {
         double anA, aB, aC, aD;