Salome HOME
Added unit-test that checks the issue #1379 is fixed
[modules/shaper.git] / src / ConstructionPlugin / ConstructionPlugin_Axis.cpp
index 8c59aa01c704f0bb1fee23693c387519ece28151..5f4b2f8d65fb45391d3dd4567dfc0fd923a970c3 100644 (file)
@@ -1,10 +1,22 @@
-// Copyright (C) 2014-2016 CEA/DEN, EDF R&D
-
-// File:        ConstructionPlugin_Axis.cpp
-// Created:     12 Dec 2014
-// Author:      Vitaly Smetannikov
-
-// Modified by CEA (delegation to Alyotech) : 29 Mar 2016 
+// 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 "ConstructionPlugin_Axis.h"
 
@@ -31,8 +43,6 @@
 #include <iostream>
 #endif
 
-using namespace std;
-
 static const double defaultAxisSize = 100;
 
 ConstructionPlugin_Axis::ConstructionPlugin_Axis()
@@ -43,7 +53,7 @@ void ConstructionPlugin_Axis::initAttributes()
 {
   data()->addAttribute(ConstructionPlugin_Axis::METHOD(),
                        ModelAPI_AttributeString::typeId());
-  
+
   // Attributes needed to build the axis using the "two points" method
   data()->addAttribute(ConstructionPlugin_Axis::POINT_FIRST(),
                        ModelAPI_AttributeSelection::typeId());
@@ -59,11 +69,11 @@ void ConstructionPlugin_Axis::initAttributes()
                        ModelAPI_AttributeDouble::typeId());
   data()->addAttribute(ConstructionPlugin_Axis::Z_DIRECTION(),
                        ModelAPI_AttributeDouble::typeId());
-  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), 
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
       ConstructionPlugin_Axis::X_DIRECTION());
-  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), 
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
       ConstructionPlugin_Axis::Y_DIRECTION());
-  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(), 
+  ModelAPI_Session::get()->validators()->registerNotObligatory(getKind(),
       ConstructionPlugin_Axis::Z_DIRECTION());
 
   //Attributes needed to build the axis using the "three dimensions" method
@@ -125,13 +135,13 @@ void ConstructionPlugin_Axis::createAxisByPointAndDirection()
   AttributeDoublePtr aXAttr = data()->real(ConstructionPlugin_Axis::X_DIRECTION());
   AttributeDoublePtr aYAttr = data()->real(ConstructionPlugin_Axis::Y_DIRECTION());
   AttributeDoublePtr aZAttr = data()->real(ConstructionPlugin_Axis::Z_DIRECTION());
-  if ((aRef1.get() != NULL) && (aXAttr.get() != NULL) && 
+  if ((aRef1.get() != NULL) && (aXAttr.get() != NULL) &&
       (aYAttr.get() != NULL) && (aZAttr.get() != NULL)) {
     GeomShapePtr aShape1 = aRef1->value();
     if (!aShape1.get())
       aShape1 = aRef1->context()->shape();
 
-    std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex(aXAttr->value(), 
+    std::shared_ptr<GeomAPI_Vertex> aVertex(new GeomAPI_Vertex(aXAttr->value(),
                                                                aYAttr->value(),
                                                                aZAttr->value()));
     if (aShape1->isVertex() && (!aShape1->isEqual(aVertex))) {
@@ -171,7 +181,7 @@ void ConstructionPlugin_Axis::createAxisByDimensions()
   double aDY = data()->real(DY())->value();
   double aDZ = data()->real(DZ())->value();
 
-  if (fabs(aDX) < MINIMAL_LENGTH()  && fabs(aDY) < MINIMAL_LENGTH() && 
+  if (fabs(aDX) < MINIMAL_LENGTH()  && fabs(aDY) < MINIMAL_LENGTH() &&
       fabs(aDZ) < MINIMAL_LENGTH()) {
     setError("Axis builder with dimensions  :: all dimensions are null", false);
     return ;
@@ -182,7 +192,7 @@ void ConstructionPlugin_Axis::createAxisByDimensions()
   ResultConstructionPtr aConstr = document()->createConstruction(data());
   aConstr->setInfinite(true);
   aConstr->setShape(anEdge);
-  setResult(aConstr);    
+  setResult(aConstr);
 }
 
 void ConstructionPlugin_Axis::createAxisByLine()