Salome HOME
01bf7a88a8af2c82ca0b94f1f90dabe9cfe212d4
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_MakeShapeCustom.cpp
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #include <GeomAlgoAPI_MakeShapeCustom.h>
22
23 //=================================================================================================
24 GeomAlgoAPI_MakeShapeCustom::GeomAlgoAPI_MakeShapeCustom()
25 {}
26
27 //=================================================================================================
28 void GeomAlgoAPI_MakeShapeCustom::setResult(const std::shared_ptr<GeomAPI_Shape> theShape)
29 {
30   setShape(theShape);
31 }
32
33 //=================================================================================================
34 bool GeomAlgoAPI_MakeShapeCustom::addModified(const std::shared_ptr<GeomAPI_Shape> theBase,
35                                               const std::shared_ptr<GeomAPI_Shape> theResult)
36 {
37   return myModified.add(theBase, theResult);
38 }
39
40 //=================================================================================================
41 bool GeomAlgoAPI_MakeShapeCustom::addGenerated(const std::shared_ptr<GeomAPI_Shape> theBase,
42                                                const std::shared_ptr<GeomAPI_Shape> theResult)
43 {
44   return myGenerated.add(theBase, theResult);
45 }
46
47 //=================================================================================================
48 bool GeomAlgoAPI_MakeShapeCustom::addDeleted(const std::shared_ptr<GeomAPI_Shape> theShape)
49 {
50   return myDeleted.bind(theShape, theShape);
51 }
52
53 //=================================================================================================
54 void GeomAlgoAPI_MakeShapeCustom::generated(const std::shared_ptr<GeomAPI_Shape> theShape,
55                                             ListOfShape& theHistory)
56 {
57   ListOfShape aGenerated;
58   if(myGenerated.find(theShape, aGenerated)) {
59     theHistory.insert(theHistory.end(), aGenerated.begin(), aGenerated.end());
60   }
61 }
62
63 //=================================================================================================
64 void GeomAlgoAPI_MakeShapeCustom::modified(const std::shared_ptr<GeomAPI_Shape> theShape,
65                                            ListOfShape& theHistory)
66 {
67   ListOfShape aModified;
68   if(myModified.find(theShape, aModified)) {
69     theHistory.insert(theHistory.end(), aModified.begin(), aModified.end());
70   }
71 }
72
73 //=================================================================================================
74 bool GeomAlgoAPI_MakeShapeCustom::isDeleted(const std::shared_ptr<GeomAPI_Shape> theShape)
75 {
76   return myDeleted.isBound(theShape);
77 }