GEOS 3.6.2
SnapIfNeededOverlayOp.h
1/**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2009 2011 Sandro Santilli <strk@keybit.net>
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 ***********************************************************************
14 *
15 * Last port: operation/overlay/snap/SnapIfNeededOverlayOp.java r320 (JTS-1.12)
16 *
17 **********************************************************************/
18
19#ifndef GEOS_OP_OVERLAY_SNAP_SNAPIFNEEDEDOVERLAYOP_H
20#define GEOS_OP_OVERLAY_SNAP_SNAPIFNEEDEDOVERLAYOP_H
21
22#include <geos/operation/overlay/OverlayOp.h> // for enums
23
24#include <memory> // for auto_ptr
25
26// Forward declarations
27namespace geos {
28 namespace geom {
29 class Geometry;
30 }
31}
32
33namespace geos {
34namespace operation { // geos::operation
35namespace overlay { // geos::operation::overlay
36namespace snap { // geos::operation::overlay::snap
37
49class SnapIfNeededOverlayOp
50{
51
52public:
53
54 static std::auto_ptr<geom::Geometry>
55 overlayOp(const geom::Geometry& g0, const geom::Geometry& g1,
56 OverlayOp::OpCode opCode)
57 {
58 SnapIfNeededOverlayOp op(g0, g1);
59 return op.getResultGeometry(opCode);
60 }
61
62 static std::auto_ptr<geom::Geometry>
63 intersection(const geom::Geometry& g0, const geom::Geometry& g1)
64 {
65 return overlayOp(g0, g1, OverlayOp::opINTERSECTION);
66 }
67
68 static std::auto_ptr<geom::Geometry>
69 Union(const geom::Geometry& g0, const geom::Geometry& g1)
70 {
71 return overlayOp(g0, g1, OverlayOp::opUNION);
72 }
73
74 static std::auto_ptr<geom::Geometry>
75 difference(const geom::Geometry& g0, const geom::Geometry& g1)
76 {
77 return overlayOp(g0, g1, OverlayOp::opDIFFERENCE);
78 }
79
80 static std::auto_ptr<geom::Geometry>
81 symDifference(const geom::Geometry& g0, const geom::Geometry& g1)
82 {
83 return overlayOp(g0, g1, OverlayOp::opSYMDIFFERENCE);
84 }
85
86 SnapIfNeededOverlayOp(const geom::Geometry& g1, const geom::Geometry& g2)
87 :
88 geom0(g1),
89 geom1(g2)
90 {
91 }
92
93
94 typedef std::auto_ptr<geom::Geometry> GeomPtr;
95
96 GeomPtr getResultGeometry(OverlayOp::OpCode opCode);
97
98private:
99
100 const geom::Geometry& geom0;
101 const geom::Geometry& geom1;
102
103 // Declare type as noncopyable
104 SnapIfNeededOverlayOp(const SnapIfNeededOverlayOp& other);
105 SnapIfNeededOverlayOp& operator=(const SnapIfNeededOverlayOp& rhs);
106};
107
108
109} // namespace geos::operation::overlay::snap
110} // namespace geos::operation::overlay
111} // namespace geos::operation
112} // namespace geos
113
114#endif // ndef GEOS_OP_OVERLAY_SNAP_SNAPIFNEEDEDOVERLAYOP_H
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition Geometry.h:167
OpCode
The spatial functions supported by this class.
Definition OverlayOp.h:77
@ opSYMDIFFERENCE
The code for the Symmetric Difference overlay operation.
Definition OverlayOp.h:85
@ opUNION
The code for the Union overlay operation.
Definition OverlayOp.h:81
@ opINTERSECTION
The code for the Intersection overlay operation.
Definition OverlayOp.h:79
@ opDIFFERENCE
The code for the Difference overlay operation.
Definition OverlayOp.h:83
Contains the Geometry interface hierarchy and supporting classes.
Definition IndexedNestedRingTester.h:26
Contains classes that perform a topological overlay to compute boolean spatial functions.
Definition BufferBuilder.h:62
Provides classes for implementing operations on geometries.
Definition IndexedNestedRingTester.h:40
Basic namespace for all GEOS functionalities.
Definition IndexedNestedRingTester.h:25