-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDuplicateGeometry.h
66 lines (54 loc) · 2 KB
/
DuplicateGeometry.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
* \copyright
* Copyright (c) 2012-2017, OpenGeoSys Community (http://www.opengeosys.org)
* Distributed under a Modified BSD License.
* See accompanying file LICENSE.txt or
* http://www.opengeosys.org/project/license
*
*/
#pragma once
#include <memory>
#include <string>
#include <vector>
namespace GeoLib
{
class GEOObjects;
class Point;
class Polyline;
class Surface;
/**
* Creates a copy of a geometry within GEOObjects
*/
class DuplicateGeometry final
{
public:
/**
* Creates a copy of a geometry within GEOObjects
* \param geo_objects The container for geometries
* \param input_name The geometry to be copied
* \param output_name The name of the copy (note: this might be modified by GEOObjects)
*/
DuplicateGeometry(GeoLib::GEOObjects &geo_objects,
std::string const& input_name,
std::string const& output_name);
// Returns the (possibly modified) output name of the new geometry.
std::string const& getFinalizedOutputName() const { return _output_name; }
// Returns a reference to the copied point vector for modification
std::vector<GeoLib::Point*>& getPointVectorCopy();
// Returns a reference to the copied polyline vector for modification
std::vector<GeoLib::Polyline*>& getPolylineVectorCopy();
// Returns a reference to the copied surface vector for modification
std::vector<GeoLib::Surface*>& getSurfaceVectorCopy();
private:
// creates a deep copy of the designated geometry
void duplicate(std::string const& input_name);
// creates a deep copy of the polyline vector
std::unique_ptr<std::vector<GeoLib::Polyline*>> copyPolylinesVector(
std::vector<GeoLib::Polyline*> const& polylines) const;
// creates a deep copy of the surface vector
std::unique_ptr<std::vector<GeoLib::Surface*>> copySurfacesVector(
std::vector<GeoLib::Surface*> const& surfaces) const;
std::string _output_name;
GeoLib::GEOObjects& _geo_objects;
}; // class
} // namespace