Salome HOME
Fix for the issue #2808 : Documentation on the "Groups" panel. Added description...
[modules/shaper.git] / src / BuildPlugin / BuildPlugin_Vertex.cpp
index d70bcc49761ce6b80324df941ac67a19ad03bdaa..585682a32ff6bde03ee202ab3a898ce1bdbc975f 100644 (file)
@@ -1,14 +1,30 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        BuildPlugin_Vertex.cpp
-// Created:     18 April 2016
-// Author:      Dmitry Bobylev
+// 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 "BuildPlugin_Vertex.h"
 
 #include <ModelAPI_AttributeSelectionList.h>
 #include <ModelAPI_ResultBody.h>
 
+#include <GeomAlgoAPI_Copy.h>
+
 //=================================================================================================
 BuildPlugin_Vertex::BuildPlugin_Vertex()
 {
@@ -59,9 +75,30 @@ void BuildPlugin_Vertex::execute()
       return;
     }
 
+    // Copy shape.
+    GeomAlgoAPI_Copy aCopyAlgo(aShape);
+
+    // Check that algo is done.
+    if(!aCopyAlgo.isDone()) {
+      setError("Error: " + getKind() + " algorithm failed.");
+      return;
+    }
+
+    // Check if shape is not null.
+    if(!aCopyAlgo.shape().get() || aCopyAlgo.shape()->isNull()) {
+      setError("Error: Resulting shape is null.");
+      return;
+    }
+
+    // Check that resulting shape is valid.
+    if(!aCopyAlgo.isValid()) {
+      setError("Error: Resulting shape is not valid.");
+      return;
+    }
+
     // Store result.
     ResultBodyPtr aResultBody = document()->createBody(data(), aResultIndex);
-    aResultBody->store(aShape);
+    aResultBody->storeModified(aShape, aCopyAlgo.shape());
     setResult(aResultBody, aResultIndex);
     ++aResultIndex;
   }