1 #ifndef OSMIUM_GEOM_OGR_HPP
2 #define OSMIUM_GEOM_OGR_HPP
51 # pragma warning(push)
52 # pragma warning(disable : 4458)
53 # pragma warning(disable : 4251)
55 # pragma GCC diagnostic push
57 # pragma GCC diagnostic ignored "-Wdocumentation-unknown-command"
59 # pragma GCC diagnostic ignored "-Wfloat-equal"
60 # pragma GCC diagnostic ignored "-Wold-style-cast"
61 # pragma GCC diagnostic ignored "-Wpadded"
62 # pragma GCC diagnostic ignored "-Wredundant-decls"
63 # pragma GCC diagnostic ignored "-Wshadow"
72 #include <ogrsf_frmts.h>
77 # pragma GCC diagnostic pop
89 class OGRFactoryImpl {
93 typedef std::unique_ptr<OGRPoint> point_type;
94 typedef std::unique_ptr<OGRLineString> linestring_type;
95 typedef std::unique_ptr<OGRPolygon> polygon_type;
96 typedef std::unique_ptr<OGRMultiPolygon> multipolygon_type;
97 typedef std::unique_ptr<OGRLinearRing> ring_type;
101 linestring_type m_linestring;
102 multipolygon_type m_multipolygon;
103 polygon_type m_polygon;
108 OGRFactoryImpl() =
default;
113 return point_type(
new OGRPoint(xy.
x, xy.
y));
118 void linestring_start() {
119 m_linestring = std::unique_ptr<OGRLineString>(
new OGRLineString());
123 assert(!!m_linestring);
124 m_linestring->addPoint(xy.
x, xy.
y);
127 linestring_type linestring_finish(
size_t ) {
128 return std::move(m_linestring);
133 void polygon_start() {
134 m_ring = std::unique_ptr<OGRLinearRing>(
new OGRLinearRing());
139 m_ring->addPoint(xy.
x, xy.
y);
142 polygon_type polygon_finish(
size_t ) {
143 std::unique_ptr<OGRPolygon> polygon = std::unique_ptr<OGRPolygon>(
new OGRPolygon());
144 polygon->addRingDirectly(m_ring.release());
150 void multipolygon_start() {
151 m_multipolygon.reset(
new OGRMultiPolygon());
154 void multipolygon_polygon_start() {
155 m_polygon.reset(
new OGRPolygon());
158 void multipolygon_polygon_finish() {
159 assert(!!m_multipolygon);
161 m_multipolygon->addGeometryDirectly(m_polygon.release());
164 void multipolygon_outer_ring_start() {
165 m_ring.reset(
new OGRLinearRing());
168 void multipolygon_outer_ring_finish() {
171 m_polygon->addRingDirectly(m_ring.release());
174 void multipolygon_inner_ring_start() {
175 m_ring.reset(
new OGRLinearRing());
178 void multipolygon_inner_ring_finish() {
181 m_polygon->addRingDirectly(m_ring.release());
187 m_ring->addPoint(xy.
x, xy.
y);
190 multipolygon_type multipolygon_finish() {
191 assert(!!m_multipolygon);
192 return std::move(m_multipolygon);
199 template <
class TProjection = IdentityProjection>
206 #endif // OSMIUM_GEOM_OGR_HPP
double y
Definition: coordinates.hpp:50
Definition: factory.hpp:146
Namespace for everything in the Osmium library.
Definition: assembler.hpp:55
Definition: coordinates.hpp:47
double x
Definition: coordinates.hpp:49