Salome HOME
updated copyright message
[modules/shaper.git] / src / GeomAPI / GeomAPI_WireExplorer.cpp
1 // Copyright (C) 2014-2023  CEA, EDF
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 <GeomAPI_WireExplorer.h>
21
22 #include <GeomAPI_Edge.h>
23 #include <GeomAPI_Vertex.h>
24 #include <GeomAPI_Wire.h>
25
26 #include <BRepTools_WireExplorer.hxx>
27
28 #define MY_EXPLORER implPtr<BRepTools_WireExplorer>()
29
30 GeomAPI_WireExplorer::GeomAPI_WireExplorer()
31   : GeomAPI_Interface(new BRepTools_WireExplorer())
32 {
33 }
34
35 GeomAPI_WireExplorer::GeomAPI_WireExplorer(const GeomWirePtr& theWire)
36   : GeomAPI_Interface(new BRepTools_WireExplorer(theWire->impl<TopoDS_Wire>()))
37 {
38 }
39
40 void GeomAPI_WireExplorer::init(const GeomWirePtr& theWire)
41 {
42   MY_EXPLORER->Init(theWire->impl<TopoDS_Wire>());
43 }
44
45 bool GeomAPI_WireExplorer::more() const
46 {
47   return MY_EXPLORER->More() == Standard_True;
48 }
49
50 void GeomAPI_WireExplorer::next()
51 {
52   MY_EXPLORER->Next();
53 }
54
55 std::shared_ptr<GeomAPI_Edge> GeomAPI_WireExplorer::current()
56 {
57   const TopoDS_Edge& aShape = MY_EXPLORER->Current();
58   std::shared_ptr<GeomAPI_Edge> aGeomShape(new GeomAPI_Edge());
59   aGeomShape->setImpl(new TopoDS_Edge(aShape));
60   return aGeomShape;
61 }
62
63 std::shared_ptr<GeomAPI_Vertex> GeomAPI_WireExplorer::currentVertex()
64 {
65   const TopoDS_Vertex& aShape = MY_EXPLORER->CurrentVertex();
66   std::shared_ptr<GeomAPI_Vertex> aGeomShape(new GeomAPI_Vertex());
67   aGeomShape->setImpl(new TopoDS_Vertex(aShape));
68   return aGeomShape;
69 }
70
71 void GeomAPI_WireExplorer::clear()
72 {
73   MY_EXPLORER->Clear();
74 }