Salome HOME
Task #3231: Sketcher Offset of a curve
[modules/shaper.git] / src / GeomValidators / GeomValidators_ZeroOffset.cpp
index d6181783f4931cb7a9e647070e3c60d28dd5abfc..294fc500ee58fc2863fa5469afd8823c6519193f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2020  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include <GeomValidators_ZeroOffset.h>
@@ -40,23 +39,27 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr<ModelAPI_Feature>&
                                         const std::list<std::string>& theArguments,
                                         Events_InfoMessage& theError) const
 {
+// LCOV_EXCL_START
   if(theArguments.size() != 9) {
-    theError = "Wrong number of validator arguments in xml(expected 9).";
+    theError = "Wrong number of validator arguments in xml (expected 9).";
     return false;
   }
+// LCOV_EXCL_STOP
 
-  std::list<std::string>::const_iterator anIt = theArguments.begin(), aLast = theArguments.end();
+  std::list<std::string>::const_iterator anIt = theArguments.begin();
 
   std::string aSelectedMethod;
   if(theFeature->string(*anIt)) {
     aSelectedMethod = theFeature->string(*anIt)->value();
   }
+  if (aSelectedMethod == "ThroughAll") return true;
   anIt++;
   std::string aCreationMethod = *anIt;
   anIt++;
 
   ListOfShape aFacesList;
   if(theFeature->selection(*anIt)) {
+// LCOV_EXCL_START
     AttributeSelectionPtr aFaceSelection = theFeature->selection(*anIt);
     ResultConstructionPtr aConstruction =
       std::dynamic_pointer_cast<ModelAPI_ResultConstruction>(aFaceSelection->context());
@@ -70,6 +73,7 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr<ModelAPI_Feature>&
         }
       }
     }
+// LCOV_EXCL_STOP
   } else if(theFeature->selectionList(*anIt)) {
     AttributeSelectionListPtr aFacesSelectionList = theFeature->selectionList(*anIt);
     for(int anIndex = 0; anIndex < aFacesSelectionList->size(); anIndex++) {
@@ -133,8 +137,8 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr<ModelAPI_Feature>&
       aToShape =  anAttrSel->context()->shape();
     }
     if (aToShape->isCompound()) {
-      GeomAPI_ShapeIterator anIt(aToShape);
-      aToShape = anIt.current();
+      GeomAPI_ShapeIterator aSIt(aToShape);
+      aToShape = aSIt.current();
     }
   }
   anIt++;
@@ -152,8 +156,8 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr<ModelAPI_Feature>&
       aFromShape = anAttrSel->context()->shape();
     }
     if (aFromShape->isCompound()) {
-      GeomAPI_ShapeIterator anIt(aFromShape);
-      aFromShape = anIt.current();
+      GeomAPI_ShapeIterator aSIt(aFromShape);
+      aFromShape = aSIt.current();
     }
   }
   anIt++;
@@ -223,6 +227,7 @@ bool GeomValidators_ZeroOffset::isValid(const std::shared_ptr<ModelAPI_Feature>&
 }
 
 //=================================================================================================
+// LCOV_EXCL_START
 bool GeomValidators_ZeroOffset::isNotObligatory(std::string theFeature, std::string theAttribute)
 {
   if(theAttribute == "from_object" || theAttribute == "to_object") {
@@ -231,3 +236,4 @@ bool GeomValidators_ZeroOffset::isNotObligatory(std::string theFeature, std::str
 
   return false;
 }
+// LCOV_EXCL_STOP