Salome HOME
Implementation Export STL
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Transform.cpp
index 481ae1c725300f0a7a7c2fc742f3f521f79ffe1c..2400c252a701c67bda3ff63e3bdc5e8d2c677f77 100644 (file)
@@ -1,8 +1,21 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
-
-// File:        GeomAlgoAPI_Transform.cpp
-// Created:     29 July 2015
-// Author:      Dmitry Bobylev
+// 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
+// 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
+//
 
 #include "GeomAlgoAPI_Transform.h"
 
@@ -16,7 +29,6 @@
 //=================================================================================================
 GeomAlgoAPI_Transform::GeomAlgoAPI_Transform(std::shared_ptr<GeomAPI_Shape> theSourceShape,
                                              std::shared_ptr<GeomAPI_Trsf>  theTrsf)
-: myTrsf(theTrsf)
 {
   build(theSourceShape, theTrsf);
 }
@@ -25,37 +37,33 @@ GeomAlgoAPI_Transform::GeomAlgoAPI_Transform(std::shared_ptr<GeomAPI_Shape> theS
 void GeomAlgoAPI_Transform::build(std::shared_ptr<GeomAPI_Shape> theSourceShape,
                                   std::shared_ptr<GeomAPI_Trsf>  theTrsf)
 {
-  if(!theSourceShape || !theTrsf) {
+  if (!theSourceShape || !theTrsf) {
+    myError = "Transformation :: incorrect input data.";
     return;
   }
 
   const TopoDS_Shape& aSourceShape = theSourceShape->impl<TopoDS_Shape>();
   const gp_Trsf& aTrsf = theTrsf->impl<gp_Trsf>();
 
-  if(aSourceShape.IsNull()) {
+  if (aSourceShape.IsNull()) {
+    myError = "Transformation :: source shape does not contain any actual shape.";
     return;
   }
 
   BRepBuilderAPI_Transform* aBuilder = new BRepBuilderAPI_Transform(aSourceShape, aTrsf, true);
-  if(!aBuilder) {
+  if (!aBuilder)
     return;
-  }
-  this->setImpl(aBuilder);
-  this->setBuilderType(OCCT_BRepBuilderAPI_MakeShape);
 
-  if(aBuilder->IsDone() != Standard_True) {
+  setImpl(aBuilder);
+  setBuilderType(OCCT_BRepBuilderAPI_MakeShape);
+
+  if (aBuilder->IsDone() != Standard_True)
     return;
-  }
+
   TopoDS_Shape aResult = aBuilder->Shape();
 
   std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
   aShape->setImpl(new TopoDS_Shape(aResult));
-  this->setShape(aShape);
-  this->setDone(true);
-}
-
-//=================================================================================================
-std::shared_ptr<GeomAPI_Trsf> GeomAlgoAPI_Transform::transformation() const
-{
-  return myTrsf;
+  setShape(aShape);
+  setDone(true);
 }