Salome HOME
Fix for the issue #2753 : error when dump/load script
[modules/shaper.git] / src / PrimitivesPlugin / PrimitivesPlugin_Box.cpp
index 554e7012bab8424fca68e51a1f6cec91e053f027..6d08828f0fc84a4f9bc1157dc6836813ba95540d 100644 (file)
@@ -1,8 +1,22 @@
-// Copyright (C) 2014-2016 CEA/DEN, EDF R&D
-
-// File:        PrimitivesPlugin_Box.cpp
-// Created:     10 Mar 2016
-// Author:      Clarisse Genrault (CEA)
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
 
 #include <PrimitivesPlugin_Box.h>
 
@@ -15,6 +29,7 @@
 #include <GeomAlgoAPI_PointBuilder.h>
 
 #include <memory>
+#include <iostream>
 
 //=================================================================================================
 PrimitivesPlugin_Box::PrimitivesPlugin_Box() // Nothing to do during instantiation
@@ -61,8 +76,7 @@ void PrimitivesPlugin_Box::createBoxByDimensions()
   // These checks should be made to the GUI for the feature but
   // the corresponding validator does not exist yet.
   if (!aBoxAlgo->check()) {
-    // The error is not displayed in a popup window. It must be in the status bar.
-    setError(aBoxAlgo->getError(), false);
+    setError(aBoxAlgo->getError());
     return;
   }
 
@@ -110,8 +124,7 @@ void PrimitivesPlugin_Box::createBoxByTwoPoints()
   // These checks should be made to the GUI for the feature but
   // the corresponding validator does not exist yet.
   if (!aBoxAlgo->check()) {
-    // The error is not displayed in a popup window. It must be in the message console.
-    setError(aBoxAlgo->getError(), false);
+    setError(aBoxAlgo->getError());
     return;
   }
 
@@ -121,12 +134,12 @@ void PrimitivesPlugin_Box::createBoxByTwoPoints()
   // Check if the creation of the box
   if(!aBoxAlgo->isDone()) {
     // The error is not displayed in a popup window. It must be in the message console.
-    setError(aBoxAlgo->getError(), false);
+    setError(aBoxAlgo->getError());
     return;
   }
   if(!aBoxAlgo->checkValid("Box builder with two points")) {
     // The error is not displayed in a popup window. It must be in the message console.
-    setError(aBoxAlgo->getError(), false);
+    setError(aBoxAlgo->getError());
     return;
   }
 
@@ -150,10 +163,11 @@ void PrimitivesPlugin_Box::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Box> theBoxA
   int num = 1;
   std::map< std::string, std::shared_ptr<GeomAPI_Shape> > listOfFaces =
     theBoxAlgo->getCreatedFaces();
-  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator
-       it=listOfFaces.begin(); it!=listOfFaces.end(); ++it) {
-    std::shared_ptr<GeomAPI_Shape> aFace = (*it).second;
-    theResultBox->generated(aFace, (*it).first, num++);
+  for (std::map< std::string, std::shared_ptr<GeomAPI_Shape> >::iterator it = listOfFaces.begin();
+       it != listOfFaces.end();
+       ++it)
+  {
+    theResultBox->generated((*it).second, (*it).first);
   }
 }