GEOS 3.3.8

- Main Page
- Related Pages
- Namespaces
- Classes
- Files

- File List

SnapIfNeededOverlayOp.h
1 /**********************************************************************
2 * $Id: SnapIfNeededOverlayOp.h 3224 2011-02-21 12:03:25Z strk $
3 *
4 * GEOS - Geometry Engine Open Source
5 * http://geos.refractions.net
6 *
7 * Copyright (C) 2009 2011 Sandro Santilli <strk@keybit.net>
8 *
9 * This is free software; you can redistribute and/or modify it under
10 * the terms of the GNU Lesser General Public Licence as published
11 * by the Free Software Foundation.
12 * See the COPYING file for more information.
13 *
14 ***********************************************************************
15 *
16 * Last port: operation/overlay/snap/SnapIfNeededOverlayOp.java r320 (JTS-1.12)
17 *
18 **********************************************************************/
19
20 #ifndef GEOS_OP_OVERLAY_SNAP_SNAPIFNEEDEDOVERLAYOP_H
21 #define GEOS_OP_OVERLAY_SNAP_SNAPIFNEEDEDOVERLAYOP_H
22
23 #include <geos/operation/overlay/OverlayOp.h> // for enums
24
25 #include <memory> // for auto_ptr
26
27 // Forward declarations
28 namespace geos {
29 namespace geom {
30 class Geometry;
31 }
32 }
33
34 namespace geos {
35 namespace operation { // geos::operation
36 namespace overlay { // geos::operation::overlay
37 namespace snap { // geos::operation::overlay::snap
38
50 class SnapIfNeededOverlayOp
51 {
52
53 public:
54
55 static std::auto_ptr<geom::Geometry>
56 overlayOp(const geom::Geometry& g0, const geom::Geometry& g1,
57 OverlayOp::OpCode opCode)
58 {
59 SnapIfNeededOverlayOp op(g0, g1);
60 return op.getResultGeometry(opCode);
61 }
62
63 static std::auto_ptr<geom::Geometry>
64 intersection(const geom::Geometry& g0, const geom::Geometry& g1)
65 {
66 return overlayOp(g0, g1, OverlayOp::opINTERSECTION);
67 }
68
69 static std::auto_ptr<geom::Geometry>
70 Union(const geom::Geometry& g0, const geom::Geometry& g1)
71 {
72 return overlayOp(g0, g1, OverlayOp::opUNION);
73 }
74
75 static std::auto_ptr<geom::Geometry>
76 difference(const geom::Geometry& g0, const geom::Geometry& g1)
77 {
78 return overlayOp(g0, g1, OverlayOp::opDIFFERENCE);
79 }
80
81 static std::auto_ptr<geom::Geometry>
82 symDifference(const geom::Geometry& g0, const geom::Geometry& g1)
83 {
84 return overlayOp(g0, g1, OverlayOp::opSYMDIFFERENCE);
85 }
86
87 SnapIfNeededOverlayOp(const geom::Geometry& g1, const geom::Geometry& g2)
88 :
89 geom0(g1),
90 geom1(g2)
91 {
92 }
93
94
95 typedef std::auto_ptr<geom::Geometry> GeomPtr;
96
97 GeomPtr getResultGeometry(OverlayOp::OpCode opCode);
98
99 private:
100
101 const geom::Geometry& geom0;
102 const geom::Geometry& geom1;
103
104 // Declare type as noncopyable
105 SnapIfNeededOverlayOp(const SnapIfNeededOverlayOp& other);
106 SnapIfNeededOverlayOp& operator=(const SnapIfNeededOverlayOp& rhs);
107 };
108
109
110 } // namespace geos::operation::overlay::snap
111 } // namespace geos::operation::overlay
112 } // namespace geos::operation
113 } // namespace geos
114
115 #endif // ndef GEOS_OP_OVERLAY_SNAP_SNAPIFNEEDEDOVERLAYOP_H
116
117 /**********************************************************************
118 * $Log$
119 **********************************************************************/
120