Salome HOME
Fix for naming in Build features.
[modules/shaper.git] / src / GeomAlgoAPI / GeomAlgoAPI_Copy.cpp
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        GeomAlgoAPI_Copy.cpp
4 // Created:     06 Sept 2016
5 // Author:      Dmitry Bobylev
6
7 #include "GeomAlgoAPI_Copy.h"
8
9
10 #include <BRepBuilderAPI_Copy.hxx>
11
12 //=================================================================================================
13 GeomAlgoAPI_Copy::GeomAlgoAPI_Copy(const std::shared_ptr<GeomAPI_Shape> theShape,
14                                    const bool theCopyGeom,
15                                    const bool theCopyMesh)
16 {
17   build(theShape, theCopyGeom, theCopyMesh);
18 }
19
20
21 //=================================================================================================
22 void GeomAlgoAPI_Copy::build(const std::shared_ptr<GeomAPI_Shape> theShape,
23                              const bool theCopyGeom,
24                              const bool theCopyMesh)
25 {
26   if(!theShape.get()) {
27     return;
28   }
29
30   // Getting shape.
31   const TopoDS_Shape& aBaseShape = theShape->impl<TopoDS_Shape>();
32
33   // Creating copy.
34   BRepBuilderAPI_Copy* aBuilder = new BRepBuilderAPI_Copy(aBaseShape, theCopyGeom, theCopyMesh);
35   this->setImpl(aBuilder);
36   this->setBuilderType(OCCT_BRepBuilderAPI_MakeShape);
37
38   TopoDS_Shape aResult = aBuilder->Shape();
39
40   std::shared_ptr<GeomAPI_Shape> aShape(new GeomAPI_Shape());
41   aShape->setImpl(new TopoDS_Shape(aResult));
42   this->setShape(aShape);
43   this->setDone(true);
44 }