Salome HOME
Update copyrights
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_MakeShapeCustom.cpp
1 // Copyright (C) 2014-2019  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 email : webmaster.salome@opencascade.com
18 //
19
20 #include <GeomAlgoAPI_MakeShapeCustom.h>
21
22 //==================================================================================================
23 GeomAlgoAPI_MakeShapeCustom::GeomAlgoAPI_MakeShapeCustom()
24 {
25 }
26
27 //==================================================================================================
28 void GeomAlgoAPI_MakeShapeCustom::setResult(const GeomShapePtr theShape)
29 {
30   setShape(theShape);
31 }
32
33 //==================================================================================================
34 bool GeomAlgoAPI_MakeShapeCustom::addModified(const GeomShapePtr theOldShape,
35                                               const GeomShapePtr theNewShape)
36 {
37   if (!isValidForHistory(theNewShape)) return false;
38   GeomShapePtr aNewShape = theNewShape;
39   return myModified.add(theOldShape, aNewShape);
40 }
41
42 //==================================================================================================
43 bool GeomAlgoAPI_MakeShapeCustom::addGenerated(const GeomShapePtr theOldShape,
44                                                const GeomShapePtr theNewShape)
45 {
46   if (!isValidForHistory(theNewShape)) return false;
47   GeomShapePtr aNewShape = theNewShape;
48   return myGenerated.add(theOldShape, aNewShape);
49 }
50
51 //==================================================================================================
52 bool GeomAlgoAPI_MakeShapeCustom::addDeleted(const GeomShapePtr theOldShape)
53 {
54   return myDeleted.bind(theOldShape, theOldShape);
55 }
56
57 //==================================================================================================
58 void GeomAlgoAPI_MakeShapeCustom::generated(const GeomShapePtr theOldShape,
59                                             ListOfShape& theNewShapes)
60 {
61   ListOfShape aGenerated;
62   if(myGenerated.find(theOldShape, aGenerated)) {
63     theNewShapes.insert(theNewShapes.end(), aGenerated.begin(), aGenerated.end());
64   }
65 }
66
67 //==================================================================================================
68 void GeomAlgoAPI_MakeShapeCustom::modified(const GeomShapePtr theOldShape,
69                                            ListOfShape& theNewShapes)
70 {
71   ListOfShape aModified;
72   if(myModified.find(theOldShape, aModified)) {
73     theNewShapes.insert(theNewShapes.end(), aModified.begin(), aModified.end());
74   }
75 }
76
77 //==================================================================================================
78 bool GeomAlgoAPI_MakeShapeCustom::isDeleted(const GeomShapePtr theOldShape)
79 {
80   return myDeleted.isBound(theOldShape);
81 }