X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGeomAlgoAPI%2FGeomAlgoAPI_ShapeAPI.cpp;h=550bf68f3f0b74d9d9e824b29c685f244d4e172e;hb=b06cf1477fb1ee46d7ae260c234cac5d0000abf2;hp=5fdeaee509edf96f3dcc1221aa892d2893f5bee4;hpb=6cb54607705e4880cb22a8dd99cf211492d1d087;p=modules%2Fshaper.git diff --git a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp index 5fdeaee50..550bf68f3 100644 --- a/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp +++ b/src/GeomAlgoAPI/GeomAlgoAPI_ShapeAPI.cpp @@ -1,8 +1,22 @@ -// Copyright (C) 2014-2016 CEA/DEN, EDF R&D - -// File: GeomAlgoAPI_ShapeAPI.cpp -// Created: 17 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 +// #include "GeomAlgoAPI_ShapeAPI.h" @@ -243,9 +257,9 @@ namespace GeomAlgoAPI_ShapeAPI } //=============================================================================================== - std::shared_ptr makeTorus(std::shared_ptr theBasePoint, - std::shared_ptr theEdge, - double theRadius, double theRingRadius) + std::shared_ptr GeomAlgoAPI_ShapeAPI::makeTorus( + std::shared_ptr theBasePoint, + std::shared_ptr theEdge,double theRadius, double theRingRadius) throw (GeomAlgoAPI_Exception) { // Check if the base point is OK @@ -280,8 +294,8 @@ namespace GeomAlgoAPI_ShapeAPI } //=============================================================================================== - std::shared_ptr makeTorus(double theRadius, double theRingRadius) - throw (GeomAlgoAPI_Exception) + std::shared_ptr GeomAlgoAPI_ShapeAPI::makeTorus(double theRadius, + double theRingRadius) throw (GeomAlgoAPI_Exception) { std::shared_ptr aBasePoint = std::shared_ptr(new GeomAPI_Pnt(0.,0.,0.)); @@ -309,10 +323,11 @@ namespace GeomAlgoAPI_ShapeAPI } //=============================================================================================== - std::shared_ptr makeCone(std::shared_ptr theBasePoint, - std::shared_ptr theEdge, - double theBaseRadius, double theTopRadius, - double theHeight) throw (GeomAlgoAPI_Exception) + std::shared_ptr GeomAlgoAPI_ShapeAPI::makeCone( + std::shared_ptr theBasePoint, + std::shared_ptr theEdge, + double theBaseRadius, double theTopRadius, + double theHeight) throw (GeomAlgoAPI_Exception) { // Check if the base point is OK if (!theBasePoint) { @@ -346,8 +361,9 @@ namespace GeomAlgoAPI_ShapeAPI } //=============================================================================================== - std::shared_ptr makeCone(double theBaseRadius, double theTopRadius, - double theHeight) throw (GeomAlgoAPI_Exception) + std::shared_ptr GeomAlgoAPI_ShapeAPI::makeCone( + double theBaseRadius, double theTopRadius, + double theHeight) throw (GeomAlgoAPI_Exception) { std::shared_ptr aBasePoint = std::shared_ptr(new GeomAPI_Pnt(0.,0.,0.)); @@ -593,15 +609,15 @@ namespace GeomAlgoAPI_ShapeAPI const double theStep, const int theNumber) throw (GeomAlgoAPI_Exception) { - if (theNumber <=0) { + if (!theAxis) { std::string aError = "Multitranslation builder "; - aError+=":: the number of copies for the first direction is null or negative."; + aError+=":: the first axis is not valid"; throw GeomAlgoAPI_Exception(aError); } - if (!theAxis) { + if (theNumber <=0) { std::string aError = "Multitranslation builder "; - aError+=":: the first axis is not valid"; + aError+=":: the number of copies for the first direction is null or negative."; throw GeomAlgoAPI_Exception(aError); } @@ -623,27 +639,27 @@ namespace GeomAlgoAPI_ShapeAPI const double theSecondStep, const int theSecondNumber) throw (GeomAlgoAPI_Exception) { - if (theFirstNumber <=0) { + if (!theFirstAxis) { std::string aError = "Multitranslation builder "; - aError+=":: the number of copies for the first direction is null or negative."; + aError+=":: the first axis is not valid"; throw GeomAlgoAPI_Exception(aError); } - if (theSecondNumber <=0) { + if (!theSecondAxis) { std::string aError = "Multitranslation builder "; - aError+=":: the number of copies for the second direction is null or negative."; + aError+=":: the second axis is not valid"; throw GeomAlgoAPI_Exception(aError); } - if (!theFirstAxis) { + if (theFirstNumber <=0) { std::string aError = "Multitranslation builder "; - aError+=":: the first axis is not valid"; + aError+=":: the number of copies for the first direction is null or negative."; throw GeomAlgoAPI_Exception(aError); } - if (!theSecondAxis) { + if (theSecondNumber <=0) { std::string aError = "Multitranslation builder "; - aError+=":: the second axis is not valid"; + aError+=":: the number of copies for the second direction is null or negative."; throw GeomAlgoAPI_Exception(aError); } @@ -671,6 +687,61 @@ namespace GeomAlgoAPI_ShapeAPI return GeomAlgoAPI_CompoundBuilder::compound(aListOfShape); } + //=============================================================================================== + std::shared_ptr GeomAlgoAPI_ShapeAPI::makeMultiRotation( + std::shared_ptr theSourceShape, + std::shared_ptr theAxis, + const int theNumber) + { + if (!theAxis) { + std::string aError = "Multirotation builder "; + aError+=":: the axis is not valid"; + throw GeomAlgoAPI_Exception(aError); + } + + if (theNumber <=0) { + std::string aError = "Multirotation builder "; + aError+=":: the number of copies is null or negative."; + throw GeomAlgoAPI_Exception(aError); + } + + double anAngle = 360./theNumber; + + ListOfShape aListOfShape; + for (int i=0; i GeomAlgoAPI_ShapeAPI::makeMultiRotation( + std::shared_ptr theSourceShape, + std::shared_ptr theAxis, + const double theStep, + const int theNumber) + { + if (!theAxis) { + std::string aError = "Multirotation builder "; + aError+=":: the axis is not valid"; + throw GeomAlgoAPI_Exception(aError); + } + + if (theNumber <=0) { + std::string aError = "Multirotation builder "; + aError+=":: the number of copies is null or negative."; + throw GeomAlgoAPI_Exception(aError); + } + + ListOfShape aListOfShape; + for (int i=0; i GeomAlgoAPI_ShapeAPI::makeConeSegment( const double theRMin1, const double theRMax1,