Salome HOME
Correct misprint
[modules/shaper.git] / src / PrimitivesPlugin / PrimitivesPlugin_Cylinder.cpp
index fd336ae8bfe73efce1fb3ca3b47887b11629a426..c3d5b82235327c599349018d31b12fb1d094574f 100644 (file)
@@ -1,8 +1,22 @@
-// Copyright (C) 2014-201x CEA/DEN, EDF R&D
-
-// File:        PrimitivesPlugin_Cylinder.cpp
-// Created:     09 Jan 2017
-// 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_Cylinder.h>
 
@@ -19,8 +33,6 @@
 #include <ModelAPI_ResultConstruction.h>
 #include <ModelAPI_Session.h>
 
-#include <iostream>
-
 //=================================================================================================
 PrimitivesPlugin_Cylinder::PrimitivesPlugin_Cylinder()
 {
@@ -31,19 +43,19 @@ void PrimitivesPlugin_Cylinder::initAttributes()
 {
   data()->addAttribute(PrimitivesPlugin_Cylinder::CREATION_METHOD(),
                        ModelAPI_AttributeString::typeId());
-  
+
   data()->addAttribute(PrimitivesPlugin_Cylinder::BASE_POINT_ID(),
                        ModelAPI_AttributeSelection::typeId());
   data()->addAttribute(PrimitivesPlugin_Cylinder::AXIS_ID(),
                        ModelAPI_AttributeSelection::typeId());
-  
+
   data()->addAttribute(PrimitivesPlugin_Cylinder::RADIUS_ID(),
                        ModelAPI_AttributeDouble::typeId());
   data()->addAttribute(PrimitivesPlugin_Cylinder::HEIGHT_ID(),
                        ModelAPI_AttributeDouble::typeId());
   data()->addAttribute(PrimitivesPlugin_Cylinder::ANGLE_ID(),
                        ModelAPI_AttributeDouble::typeId());
-  
+
   // Initialize the base point of the cylinder at the origin if the base point is not filled.
   AttributeSelectionPtr aBasePoint = data()->selection(BASE_POINT_ID());
   if (!aBasePoint->isInitialized()) {
@@ -54,10 +66,10 @@ void PrimitivesPlugin_Cylinder::initAttributes()
       aBasePoint->setValue(aPointRes, std::shared_ptr<GeomAPI_Shape>());
     }
   }
-  
+
   // Initialize the axis at the OZ axis if the axis is not filled.
   AttributeSelectionPtr anAxis = data()->selection(AXIS_ID());
-  if (!anAxis->isInitialized()) { 
+  if (!anAxis->isInitialized()) {
     ObjectPtr anAxisObj = ModelAPI_Session::get()->moduleDocument()
       ->objectByName(ModelAPI_ResultConstruction::group(), "OZ");
     if (anAxisObj.get()) {
@@ -98,7 +110,7 @@ void PrimitivesPlugin_Cylinder::createCylinder(bool withAngle)
       aBasePoint = GeomAlgoAPI_PointBuilder::point(aShape1);
     }
   }
+
   // Getting axis.
   std::shared_ptr<GeomAPI_Ax2> anAxis;
   std::shared_ptr<GeomAPI_Edge> anEdge;
@@ -114,21 +126,21 @@ void PrimitivesPlugin_Cylinder::createCylinder(bool withAngle)
     anAxis = std::shared_ptr<GeomAPI_Ax2>(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();
-  
+
   std::shared_ptr<GeomAlgoAPI_Cylinder> aCylinderAlgo;
   if (withAngle) {
     // Getting angle
     double anAngle = real(PrimitivesPlugin_Cylinder::ANGLE_ID())->value();
-    aCylinderAlgo = 
+    aCylinderAlgo =
       std::shared_ptr<GeomAlgoAPI_Cylinder>(new GeomAlgoAPI_Cylinder(anAxis,
                                                                      aRadius, aHeight,
                                                                      anAngle));
   } else {
-    aCylinderAlgo = 
+    aCylinderAlgo =
       std::shared_ptr<GeomAlgoAPI_Cylinder>(new GeomAlgoAPI_Cylinder(anAxis,
                                                                      aRadius, aHeight));
   }
@@ -136,7 +148,7 @@ void PrimitivesPlugin_Cylinder::createCylinder(bool withAngle)
   // These checks should be made to the GUI for the feature but
   // the corresponding validator does not exist yet.
   if (!aCylinderAlgo->check()) {
-    setError(aCylinderAlgo->getError(), false);
+    setError(aCylinderAlgo->getError());
     return;
   }
 
@@ -146,12 +158,12 @@ void PrimitivesPlugin_Cylinder::createCylinder(bool withAngle)
   // Check if the creation of the cylinder
   if(!aCylinderAlgo->isDone()) {
     // The error is not displayed in a popup window. It must be in the message console.
-    setError(aCylinderAlgo->getError(), false);
+    setError(aCylinderAlgo->getError());
     return;
   }
   if(!aCylinderAlgo->checkValid("Cylinder builder")) {
     // The error is not displayed in a popup window. It must be in the message console.
-    setError(aCylinderAlgo->getError(), false);
+    setError(aCylinderAlgo->getError());
     return;
   }
 
@@ -165,7 +177,6 @@ void PrimitivesPlugin_Cylinder::createCylinder(bool withAngle)
 void PrimitivesPlugin_Cylinder::loadNamingDS(std::shared_ptr<GeomAlgoAPI_Cylinder> theCylinderAlgo,
                                              std::shared_ptr<ModelAPI_ResultBody> theResultCylinder)
 {
-  
   // Load the result
   theResultCylinder->store(theCylinderAlgo->shape());