rgeo 0.1.10
Sign up to get free protection for your applications and to get access to all the features.
- data/History.rdoc +22 -0
- data/README.rdoc +124 -0
- data/Version +1 -0
- data/ext/geos_c_impl/extconf.rb +72 -0
- data/ext/geos_c_impl/factory.c +468 -0
- data/ext/geos_c_impl/factory.h +217 -0
- data/ext/geos_c_impl/geometry.c +644 -0
- data/ext/geos_c_impl/geometry.h +65 -0
- data/ext/geos_c_impl/geometry_collection.c +580 -0
- data/ext/geos_c_impl/geometry_collection.h +79 -0
- data/ext/geos_c_impl/globals.h +58 -0
- data/ext/geos_c_impl/line_string.c +468 -0
- data/ext/geos_c_impl/line_string.h +74 -0
- data/ext/geos_c_impl/main.c +65 -0
- data/ext/geos_c_impl/point.c +201 -0
- data/ext/geos_c_impl/point.h +77 -0
- data/ext/geos_c_impl/polygon.c +259 -0
- data/ext/geos_c_impl/polygon.h +76 -0
- data/ext/geos_c_impl/preface.h +42 -0
- data/lib/rgeo.rb +68 -0
- data/lib/rgeo/errors.rb +59 -0
- data/lib/rgeo/features.rb +89 -0
- data/lib/rgeo/features/curve.rb +155 -0
- data/lib/rgeo/features/factory.rb +191 -0
- data/lib/rgeo/features/geometry.rb +560 -0
- data/lib/rgeo/features/geometry_collection.rb +118 -0
- data/lib/rgeo/features/line.rb +65 -0
- data/lib/rgeo/features/line_string.rb +101 -0
- data/lib/rgeo/features/linear_ring.rb +65 -0
- data/lib/rgeo/features/multi_curve.rb +112 -0
- data/lib/rgeo/features/multi_line_string.rb +65 -0
- data/lib/rgeo/features/multi_point.rb +72 -0
- data/lib/rgeo/features/multi_polygon.rb +96 -0
- data/lib/rgeo/features/multi_surface.rb +115 -0
- data/lib/rgeo/features/point.rb +97 -0
- data/lib/rgeo/features/polygon.rb +141 -0
- data/lib/rgeo/features/surface.rb +121 -0
- data/lib/rgeo/geo_json.rb +58 -0
- data/lib/rgeo/geo_json/coder.rb +305 -0
- data/lib/rgeo/geo_json/entities.rb +284 -0
- data/lib/rgeo/geo_json/interface.rb +95 -0
- data/lib/rgeo/geography.rb +75 -0
- data/lib/rgeo/geography/common/geometry_collection_methods.rb +206 -0
- data/lib/rgeo/geography/common/geometry_methods.rb +92 -0
- data/lib/rgeo/geography/common/helper.rb +102 -0
- data/lib/rgeo/geography/common/line_string_methods.rb +187 -0
- data/lib/rgeo/geography/common/point_methods.rb +149 -0
- data/lib/rgeo/geography/common/polygon_methods.rb +122 -0
- data/lib/rgeo/geography/factories.rb +136 -0
- data/lib/rgeo/geography/factory.rb +246 -0
- data/lib/rgeo/geography/projected_window.rb +467 -0
- data/lib/rgeo/geography/simple_mercator/feature_classes.rb +320 -0
- data/lib/rgeo/geography/simple_mercator/feature_methods.rb +291 -0
- data/lib/rgeo/geography/simple_mercator/projector.rb +116 -0
- data/lib/rgeo/geography/simple_spherical/calculations.rb +70 -0
- data/lib/rgeo/geography/simple_spherical/geometry_collection_impl.rb +66 -0
- data/lib/rgeo/geography/simple_spherical/geometry_methods.rb +59 -0
- data/lib/rgeo/geography/simple_spherical/line_string_impl.rb +104 -0
- data/lib/rgeo/geography/simple_spherical/multi_line_string_impl.rb +67 -0
- data/lib/rgeo/geography/simple_spherical/multi_point_impl.rb +67 -0
- data/lib/rgeo/geography/simple_spherical/multi_polygon_impl.rb +67 -0
- data/lib/rgeo/geography/simple_spherical/point_impl.rb +85 -0
- data/lib/rgeo/geography/simple_spherical/polygon_impl.rb +66 -0
- data/lib/rgeo/geos.rb +72 -0
- data/lib/rgeo/geos/factory.rb +260 -0
- data/lib/rgeo/geos/impl_additions.rb +57 -0
- data/lib/rgeo/geos/interface.rb +74 -0
- data/lib/rgeo/version.rb +52 -0
- data/tests/geos/tc_factory.rb +91 -0
- data/tests/geos/tc_geometry_collection.rb +226 -0
- data/tests/geos/tc_line_string.rb +310 -0
- data/tests/geos/tc_misc.rb +72 -0
- data/tests/geos/tc_multi_line_string.rb +211 -0
- data/tests/geos/tc_multi_point.rb +202 -0
- data/tests/geos/tc_multi_polygon.rb +210 -0
- data/tests/geos/tc_point.rb +305 -0
- data/tests/geos/tc_polygon.rb +240 -0
- data/tests/simple_mercator/tc_point.rb +303 -0
- data/tests/simple_mercator/tc_window.rb +219 -0
- data/tests/tc_geojson.rb +230 -0
- data/tests/tc_oneoff.rb +61 -0
- metadata +162 -0
@@ -0,0 +1,191 @@
|
|
1
|
+
# -----------------------------------------------------------------------------
|
2
|
+
#
|
3
|
+
# Feature factory interface
|
4
|
+
#
|
5
|
+
# -----------------------------------------------------------------------------
|
6
|
+
# Copyright 2010 Daniel Azuma
|
7
|
+
#
|
8
|
+
# All rights reserved.
|
9
|
+
#
|
10
|
+
# Redistribution and use in source and binary forms, with or without
|
11
|
+
# modification, are permitted provided that the following conditions are met:
|
12
|
+
#
|
13
|
+
# * Redistributions of source code must retain the above copyright notice,
|
14
|
+
# this list of conditions and the following disclaimer.
|
15
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
16
|
+
# this list of conditions and the following disclaimer in the documentation
|
17
|
+
# and/or other materials provided with the distribution.
|
18
|
+
# * Neither the name of the copyright holder, nor the names of any other
|
19
|
+
# contributors to this software, may be used to endorse or promote products
|
20
|
+
# derived from this software without specific prior written permission.
|
21
|
+
#
|
22
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
25
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
26
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
27
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
33
|
+
# -----------------------------------------------------------------------------
|
34
|
+
;
|
35
|
+
|
36
|
+
|
37
|
+
module RGeo
|
38
|
+
|
39
|
+
module Features
|
40
|
+
|
41
|
+
|
42
|
+
# This is a standard interface for factories of features.
|
43
|
+
# Generally, each Features implementation will implement these
|
44
|
+
# methods as a standard way to create features.
|
45
|
+
#
|
46
|
+
# If the implementation is unable to create the given feature,
|
47
|
+
# it should return nil.
|
48
|
+
#
|
49
|
+
# Some implementations may extend this interface to provide facilities
|
50
|
+
# for creating additional objects according to the features handled
|
51
|
+
# by that implementation. Examples might include higher-dimensional
|
52
|
+
# coordinates or additional subclasses not explicitly required by the
|
53
|
+
# Simple Features Specification.
|
54
|
+
#
|
55
|
+
# A particular factory implementation may not necessarily include
|
56
|
+
# this module. Do not depend on kind_of? or === to check for
|
57
|
+
# factory-ness. This module is present primarily for documentation.
|
58
|
+
|
59
|
+
module Factory
|
60
|
+
|
61
|
+
|
62
|
+
# Parse the given string in well-known-text format and return the
|
63
|
+
# resulting feature. Returns nil if the string couldn't be parsed.
|
64
|
+
|
65
|
+
def parse_wkt(str_)
|
66
|
+
nil
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
# Parse the given string in well-known-binary format and return the
|
71
|
+
# resulting feature. Returns nil if the string couldn't be parsed.
|
72
|
+
|
73
|
+
def parse_wkb(str_)
|
74
|
+
nil
|
75
|
+
end
|
76
|
+
|
77
|
+
|
78
|
+
# Create a feature of type Point.
|
79
|
+
# The x and y parameters should be Float values.
|
80
|
+
|
81
|
+
def point(x_, y_)
|
82
|
+
nil
|
83
|
+
end
|
84
|
+
|
85
|
+
|
86
|
+
# Create a feature of type LineString.
|
87
|
+
# The given points argument should be an Enumerable of Point objects.
|
88
|
+
|
89
|
+
def line_string(points_)
|
90
|
+
nil
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
# Create a feature of type Line.
|
95
|
+
# The given point arguments should be Point objects.
|
96
|
+
|
97
|
+
def line(start_, end_)
|
98
|
+
nil
|
99
|
+
end
|
100
|
+
|
101
|
+
|
102
|
+
# Create a feature of type LinearRing.
|
103
|
+
# The given points argument should be an Enumerable of Point objects.
|
104
|
+
# If the first and last points are not equal, the ring is
|
105
|
+
# automatically closed by appending the first point to the end of the
|
106
|
+
# string.
|
107
|
+
|
108
|
+
def linear_ring(points_)
|
109
|
+
nil
|
110
|
+
end
|
111
|
+
|
112
|
+
|
113
|
+
# Create a feature of type Polygon.
|
114
|
+
# The outer_ring should be a LinearRing.
|
115
|
+
# The inner_rings should be a possibly empty Enumerable of
|
116
|
+
# LinearRing. You may also pass nil to indicate no inner rings.
|
117
|
+
|
118
|
+
def polygon(outer_ring_, inner_rings_=nil)
|
119
|
+
nil
|
120
|
+
end
|
121
|
+
|
122
|
+
|
123
|
+
# Create a feature of type GeometryCollection.
|
124
|
+
# The elems should be an Enumerable of Geometry objects.
|
125
|
+
# This method does not "flatten" collection hierarchies in the way
|
126
|
+
# that multi_point, multi_line_string, and multi_polygon do.
|
127
|
+
|
128
|
+
def collection(elems_)
|
129
|
+
nil
|
130
|
+
end
|
131
|
+
|
132
|
+
|
133
|
+
# Create a feature of type MultiPoint.
|
134
|
+
# The elems should be an Enumerable of Point objects, or collections
|
135
|
+
# whose contents, recursively expanded, eventually include only
|
136
|
+
# Point objects. The resultant MultiPoint will thus be "flattened"
|
137
|
+
# so that its elements include only those leaf Points.
|
138
|
+
# Returns nil if any of the leaf geometries is not a Point, which
|
139
|
+
# would break the MultiPoint contract.
|
140
|
+
|
141
|
+
def multi_point(elems_)
|
142
|
+
nil
|
143
|
+
end
|
144
|
+
|
145
|
+
|
146
|
+
# Create a feature of type MultiLineString.
|
147
|
+
# The elems should be an Enumerable of LineString objects, or
|
148
|
+
# collections whose contents, recursively expanded, eventually
|
149
|
+
# include only LineString objects (or subclasses thereof).
|
150
|
+
# The resultant MultiLineString will thus be "flattened" so that its
|
151
|
+
# elements include only those leaf LineStrings.
|
152
|
+
# Returns nil if any of the leaf geometries is not a LineString,
|
153
|
+
# which would break the MultiLineString contract.
|
154
|
+
|
155
|
+
def multi_line_string(elems_)
|
156
|
+
nil
|
157
|
+
end
|
158
|
+
|
159
|
+
|
160
|
+
# Create a feature of type MultiPolygon.
|
161
|
+
# The elems should be an Enumerable of Polygon objects, or
|
162
|
+
# collections whose contents, recursively expanded, eventually
|
163
|
+
# include only Polygon objects.
|
164
|
+
# The resultant MultiPolygon will thus be "flattened" so that its
|
165
|
+
# elements include only those leaf Polygons.
|
166
|
+
# Returns nil if any of the leaf geometries is not a Polygon,
|
167
|
+
# which would break the MultiPolygon contract.
|
168
|
+
# Also returns nil if any of the other assertions for MultiPolygon
|
169
|
+
# are not met-- e.g. if any of the polygons overlap.
|
170
|
+
|
171
|
+
def multi_polygon(elems_)
|
172
|
+
nil
|
173
|
+
end
|
174
|
+
|
175
|
+
|
176
|
+
# Convert an existing feature to a feature of the type created by
|
177
|
+
# this implementation.
|
178
|
+
# If force_new is true, a new object is returned even if the original
|
179
|
+
# is already of this implementation.
|
180
|
+
|
181
|
+
def convert(original_, force_new_=false)
|
182
|
+
nil
|
183
|
+
end
|
184
|
+
|
185
|
+
|
186
|
+
end
|
187
|
+
|
188
|
+
|
189
|
+
end
|
190
|
+
|
191
|
+
end
|
@@ -0,0 +1,560 @@
|
|
1
|
+
# -----------------------------------------------------------------------------
|
2
|
+
#
|
3
|
+
# Geometry feature interface
|
4
|
+
#
|
5
|
+
# -----------------------------------------------------------------------------
|
6
|
+
# Copyright 2010 Daniel Azuma
|
7
|
+
#
|
8
|
+
# All rights reserved.
|
9
|
+
#
|
10
|
+
# Redistribution and use in source and binary forms, with or without
|
11
|
+
# modification, are permitted provided that the following conditions are met:
|
12
|
+
#
|
13
|
+
# * Redistributions of source code must retain the above copyright notice,
|
14
|
+
# this list of conditions and the following disclaimer.
|
15
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
16
|
+
# this list of conditions and the following disclaimer in the documentation
|
17
|
+
# and/or other materials provided with the distribution.
|
18
|
+
# * Neither the name of the copyright holder, nor the names of any other
|
19
|
+
# contributors to this software, may be used to endorse or promote products
|
20
|
+
# derived from this software without specific prior written permission.
|
21
|
+
#
|
22
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
23
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
24
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
25
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
26
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
27
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
33
|
+
# -----------------------------------------------------------------------------
|
34
|
+
;
|
35
|
+
|
36
|
+
|
37
|
+
module RGeo
|
38
|
+
|
39
|
+
module Features
|
40
|
+
|
41
|
+
|
42
|
+
# == SFS 1.1 Description
|
43
|
+
#
|
44
|
+
# Geometry is the root class of the hierarchy. Geometry is an abstract
|
45
|
+
# (non-instantiable) class.
|
46
|
+
#
|
47
|
+
# The instantiable subclasses of Geometry defined in this International
|
48
|
+
# Standard are restricted to 0, 1 and 2-dimensional geometric objects
|
49
|
+
# that exist in 2-dimensional coordinate space (R2).
|
50
|
+
#
|
51
|
+
# All instantiable Geometry classes described in this part of ISO 19125
|
52
|
+
# are defined so that valid instances of a Geometry class are
|
53
|
+
# topologically closed, i.e. all defined geometries include their
|
54
|
+
# boundary.
|
55
|
+
#
|
56
|
+
# == Notes
|
57
|
+
#
|
58
|
+
# Geometry is defined as a module and is provided primarily
|
59
|
+
# for the sake of documentation. Implementations need not necessarily
|
60
|
+
# include this module itself. Therefore, you should not depend on the
|
61
|
+
# kind_of? method to check type. Instead, use the provided check_type
|
62
|
+
# class method. A corresponding === operator is also provided to
|
63
|
+
# to support case-when constructs.
|
64
|
+
#
|
65
|
+
# Some implementations may support higher dimensional objects or
|
66
|
+
# coordinate systems, despite the limits of the SFS.
|
67
|
+
#
|
68
|
+
# == Forms of equivalence
|
69
|
+
#
|
70
|
+
# The Geometry model defines three forms of equivalence.
|
71
|
+
#
|
72
|
+
# Spatial equivalence::
|
73
|
+
# Spatial equivalence is the weakest form of equivalence, indicating
|
74
|
+
# that the two objects represent the same region of space, but may
|
75
|
+
# be different representations of that region. For example, a
|
76
|
+
# POINT(0 0) and a MULTIPOINT(0 0, 0 0) are spatially equivalent, as
|
77
|
+
# are LINESTRING(0 0, 10 10) and
|
78
|
+
# GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0, 10 10, 0 0)).
|
79
|
+
# Objective equivalence::
|
80
|
+
# Objective equivalence is a stronger form of equivalence, indicating
|
81
|
+
# that the two objects are the same representation, but may be
|
82
|
+
# different objects. All objectively equivalent objects are spatially
|
83
|
+
# equivalent, but not all spatially equivalent objects are
|
84
|
+
# objectively equivalent. For example, none of the examples in the
|
85
|
+
# spatial equivalence section above are objectively equivalent.
|
86
|
+
# However, two separate objects that both represent POINT(1 2) are
|
87
|
+
# objectively equivalent.
|
88
|
+
# Objective identity::
|
89
|
+
# Objective identity is the strongest form, indicating that the two
|
90
|
+
# references refer to the same object. Of course, all pairs of
|
91
|
+
# references with the same objective identity are both objectively
|
92
|
+
# equivalent and spatially equivalent.
|
93
|
+
#
|
94
|
+
# Different methods test for different types of equivalence:
|
95
|
+
#
|
96
|
+
# * <tt>equals?</tt> and <tt>==</tt> test for spatial equivalence.
|
97
|
+
# * <tt>eql?</tt> tests for objective equivalence.
|
98
|
+
# * <tt>equal?</tt> tests for objective identity.
|
99
|
+
|
100
|
+
module Geometry
|
101
|
+
|
102
|
+
|
103
|
+
module ClassMethods
|
104
|
+
|
105
|
+
# Returns true if the given object is this type or a subtype
|
106
|
+
# thereof, or if it is a feature object whose geometry_type is
|
107
|
+
# this type or a subtype thereof.
|
108
|
+
#
|
109
|
+
# Note that feature objects need not actually include this module.
|
110
|
+
|
111
|
+
def check_type(rhs_)
|
112
|
+
rhs_ = rhs_.geometry_type if rhs_.respond_to?(:geometry_type)
|
113
|
+
rhs_.kind_of?(::Module) && (rhs_ == self || rhs_.include?(self))
|
114
|
+
end
|
115
|
+
alias_method :===, :check_type
|
116
|
+
|
117
|
+
|
118
|
+
def included(mod_) # :nodoc:
|
119
|
+
mod_.extend(ClassMethods)
|
120
|
+
end
|
121
|
+
|
122
|
+
end
|
123
|
+
|
124
|
+
|
125
|
+
extend ClassMethods
|
126
|
+
|
127
|
+
|
128
|
+
# Returns a factory for creating features related to this one.
|
129
|
+
# This does not necessarily need to be the same factory that created
|
130
|
+
# this object, but it should create objects that are "compatible"
|
131
|
+
# with this one. (i.e. they should be in the same spatial reference
|
132
|
+
# system by default, and it should be possible to perform relational
|
133
|
+
# operations on them.)
|
134
|
+
|
135
|
+
def factory
|
136
|
+
raise Errors::MethodUnimplemented
|
137
|
+
end
|
138
|
+
|
139
|
+
|
140
|
+
# Cast this geometry to the given type (which must be one of the
|
141
|
+
# type modules in the Features module) and return the resulting
|
142
|
+
# object. Returns nil if the cast fails because the types are not
|
143
|
+
# compatible or the object does not satisfy the assertions for the
|
144
|
+
# new type.
|
145
|
+
#
|
146
|
+
# Generally, this is only useful for casting general classes to
|
147
|
+
# subclasses; e.g. a GeometryCollection to a MultiPoint, or a
|
148
|
+
# LineString to a LinearRing.
|
149
|
+
|
150
|
+
def cast(type_)
|
151
|
+
raise Errors::MethodUnimplemented
|
152
|
+
end
|
153
|
+
|
154
|
+
|
155
|
+
# Returns true if this geometric object is objectively equivalent
|
156
|
+
# to the given object.
|
157
|
+
|
158
|
+
def eql?(another_geometry_)
|
159
|
+
raise Errors::MethodUnimplemented
|
160
|
+
end
|
161
|
+
|
162
|
+
|
163
|
+
# === SFS 1.1 Description
|
164
|
+
#
|
165
|
+
# The inherent dimension of this geometric object, which must be less
|
166
|
+
# than or equal to the coordinate dimension. This specification is
|
167
|
+
# restricted to geometries in 2-dimensional coordinate space.
|
168
|
+
#
|
169
|
+
# === Notes
|
170
|
+
#
|
171
|
+
# Returns an integer. This value is -1 for an empty geometry, 0 for
|
172
|
+
# point geometries, 1 for curves, and 2 for surfaces.
|
173
|
+
|
174
|
+
def dimension
|
175
|
+
raise Errors::MethodUnimplemented
|
176
|
+
end
|
177
|
+
|
178
|
+
|
179
|
+
# === SFS 1.1 Description
|
180
|
+
#
|
181
|
+
# Returns the instantiable subtype of Geometry of which this
|
182
|
+
# geometric object is an instantiable member.
|
183
|
+
#
|
184
|
+
# === Notes
|
185
|
+
#
|
186
|
+
# Returns one of the type modules in RGeo::Features. e.g. a point
|
187
|
+
# object would return RGeo::Features::Point. Note that this is
|
188
|
+
# different from the SFS specification, which stipulates that the
|
189
|
+
# string name of the type is returned. To obtain the name string,
|
190
|
+
# call the +name+ method of the returned module.
|
191
|
+
|
192
|
+
def geometry_type
|
193
|
+
raise Errors::MethodUnimplemented
|
194
|
+
end
|
195
|
+
|
196
|
+
|
197
|
+
# === SFS 1.1 Description
|
198
|
+
#
|
199
|
+
# Returns the Spatial Reference System ID for this geometric object.
|
200
|
+
#
|
201
|
+
# === Notes
|
202
|
+
#
|
203
|
+
# Returns an integer.
|
204
|
+
#
|
205
|
+
# This will normally be a foreign key to an index of reference systems
|
206
|
+
# stored in either the same or some other datastore.
|
207
|
+
|
208
|
+
def srid
|
209
|
+
raise Errors::MethodUnimplemented
|
210
|
+
end
|
211
|
+
|
212
|
+
|
213
|
+
# === SFS 1.1 Description
|
214
|
+
#
|
215
|
+
# The minimum bounding box for this Geometry, returned as a Geometry.
|
216
|
+
# The polygon is defined by the corner points of the bounding box
|
217
|
+
# [(MINX, MINY), (MAXX, MINY), (MAXX, MAXY), (MINX, MAXY), (MINX, MINY)].
|
218
|
+
#
|
219
|
+
# === Notes
|
220
|
+
#
|
221
|
+
# Returns an object that supports the Geometry interface.
|
222
|
+
|
223
|
+
def envelope
|
224
|
+
raise Errors::MethodUnimplemented
|
225
|
+
end
|
226
|
+
|
227
|
+
|
228
|
+
# === SFS 1.1 Description
|
229
|
+
#
|
230
|
+
# Exports this geometric object to a specific Well-known Text
|
231
|
+
# Representation of Geometry.
|
232
|
+
#
|
233
|
+
# === Notes
|
234
|
+
#
|
235
|
+
# Returns an ASCII string.
|
236
|
+
|
237
|
+
def as_text
|
238
|
+
raise Errors::MethodUnimplemented
|
239
|
+
end
|
240
|
+
|
241
|
+
|
242
|
+
# === SFS 1.1 Description
|
243
|
+
#
|
244
|
+
# Exports this geometric object to a specific Well-known Binary
|
245
|
+
# Representation of Geometry.
|
246
|
+
#
|
247
|
+
# === Notes
|
248
|
+
#
|
249
|
+
# Returns a binary string.
|
250
|
+
|
251
|
+
def as_binary
|
252
|
+
raise Errors::MethodUnimplemented
|
253
|
+
end
|
254
|
+
|
255
|
+
|
256
|
+
# === SFS 1.1 Description
|
257
|
+
#
|
258
|
+
# Returns true if this geometric object is the empty Geometry. If true,
|
259
|
+
# then this geometric object represents the empty point set for the
|
260
|
+
# coordinate space.
|
261
|
+
#
|
262
|
+
# === Notes
|
263
|
+
#
|
264
|
+
# Returns a boolean value. Note that this is different from the SFS
|
265
|
+
# specification, which stipulates an integer return value.
|
266
|
+
|
267
|
+
def is_empty?
|
268
|
+
raise Errors::MethodUnimplemented
|
269
|
+
end
|
270
|
+
|
271
|
+
|
272
|
+
# === SFS 1.1 Description
|
273
|
+
#
|
274
|
+
# Returns true if this geometric object has no anomalous geometric
|
275
|
+
# points, such as self intersection or self tangency. The description
|
276
|
+
# of each instantiable geometric class will include the specific
|
277
|
+
# conditions that cause an instance of that class to be classified as
|
278
|
+
# not simple.
|
279
|
+
#
|
280
|
+
# === Notes
|
281
|
+
#
|
282
|
+
# Returns a boolean value. Note that this is different from the SFS
|
283
|
+
# specification, which stipulates an integer return value.
|
284
|
+
|
285
|
+
def is_simple?
|
286
|
+
raise Errors::MethodUnimplemented
|
287
|
+
end
|
288
|
+
|
289
|
+
|
290
|
+
# === SFS 1.1 Description
|
291
|
+
#
|
292
|
+
# Returns the closure of the combinatorial boundary of this geometric
|
293
|
+
# object. Because the result of this function is a closure, and hence
|
294
|
+
# topologically closed, the resulting boundary can be represented using
|
295
|
+
# representational Geometry primitives.
|
296
|
+
#
|
297
|
+
# === Notes
|
298
|
+
#
|
299
|
+
# Returns an object that supports the Geometry interface.
|
300
|
+
|
301
|
+
def boundary
|
302
|
+
raise Errors::MethodUnimplemented
|
303
|
+
end
|
304
|
+
|
305
|
+
|
306
|
+
# === SFS 1.1 Description
|
307
|
+
#
|
308
|
+
# Returns true if this geometric object is "spatially equal" to
|
309
|
+
# another_geometry.
|
310
|
+
#
|
311
|
+
# === Notes
|
312
|
+
#
|
313
|
+
# Returns a boolean value. Note that this is different from the SFS
|
314
|
+
# specification, which stipulates an integer return value.
|
315
|
+
|
316
|
+
def equals?(another_geometry_)
|
317
|
+
raise Errors::MethodUnimplemented
|
318
|
+
end
|
319
|
+
|
320
|
+
|
321
|
+
# === SFS 1.1 Description
|
322
|
+
#
|
323
|
+
# Returns true if this geometric object is "spatially disjoint" from
|
324
|
+
# another_geometry.
|
325
|
+
#
|
326
|
+
# === Notes
|
327
|
+
#
|
328
|
+
# Returns a boolean value. Note that this is different from the SFS
|
329
|
+
# specification, which stipulates an integer return value.
|
330
|
+
|
331
|
+
def disjoint?(another_geometry_)
|
332
|
+
raise Errors::MethodUnimplemented
|
333
|
+
end
|
334
|
+
|
335
|
+
|
336
|
+
# === SFS 1.1 Description
|
337
|
+
#
|
338
|
+
# Returns true if this geometric object "spatially intersects"
|
339
|
+
# another_geometry.
|
340
|
+
#
|
341
|
+
# === Notes
|
342
|
+
#
|
343
|
+
# Returns a boolean value. Note that this is different from the SFS
|
344
|
+
# specification, which stipulates an integer return value.
|
345
|
+
|
346
|
+
def intersects?(another_geometry_)
|
347
|
+
raise Errors::MethodUnimplemented
|
348
|
+
end
|
349
|
+
|
350
|
+
|
351
|
+
# === SFS 1.1 Description
|
352
|
+
#
|
353
|
+
# Returns true if this geometric object "spatially touches"
|
354
|
+
# another_geometry.
|
355
|
+
#
|
356
|
+
# === Notes
|
357
|
+
#
|
358
|
+
# Returns a boolean value. Note that this is different from the SFS
|
359
|
+
# specification, which stipulates an integer return value.
|
360
|
+
|
361
|
+
def touches?(another_geometry_)
|
362
|
+
raise Errors::MethodUnimplemented
|
363
|
+
end
|
364
|
+
|
365
|
+
|
366
|
+
# === SFS 1.1 Description
|
367
|
+
#
|
368
|
+
# Returns true if this geometric object "spatially crosses"
|
369
|
+
# another_geometry.
|
370
|
+
#
|
371
|
+
# === Notes
|
372
|
+
#
|
373
|
+
# Returns a boolean value. Note that this is different from the SFS
|
374
|
+
# specification, which stipulates an integer return value.
|
375
|
+
|
376
|
+
def crosses?(another_geometry_)
|
377
|
+
raise Errors::MethodUnimplemented
|
378
|
+
end
|
379
|
+
|
380
|
+
|
381
|
+
# === SFS 1.1 Description
|
382
|
+
#
|
383
|
+
# Returns true if this geometric object is "spatially within"
|
384
|
+
# another_geometry.
|
385
|
+
#
|
386
|
+
# === Notes
|
387
|
+
#
|
388
|
+
# Returns a boolean value. Note that this is different from the SFS
|
389
|
+
# specification, which stipulates an integer return value.
|
390
|
+
|
391
|
+
def within?(another_geometry_)
|
392
|
+
raise Errors::MethodUnimplemented
|
393
|
+
end
|
394
|
+
|
395
|
+
|
396
|
+
# === SFS 1.1 Description
|
397
|
+
#
|
398
|
+
# Returns true if this geometric object "spatially contains"
|
399
|
+
# another_geometry.
|
400
|
+
#
|
401
|
+
# === Notes
|
402
|
+
#
|
403
|
+
# Returns a boolean value. Note that this is different from the SFS
|
404
|
+
# specification, which stipulates an integer return value.
|
405
|
+
|
406
|
+
def contains?(another_geometry_)
|
407
|
+
raise Errors::MethodUnimplemented
|
408
|
+
end
|
409
|
+
|
410
|
+
|
411
|
+
# === SFS 1.1 Description
|
412
|
+
#
|
413
|
+
# Returns true if this geometric object "spatially overlaps"
|
414
|
+
# another_geometry.
|
415
|
+
#
|
416
|
+
# === Notes
|
417
|
+
#
|
418
|
+
# Returns a boolean value. Note that this is different from the SFS
|
419
|
+
# specification, which stipulates an integer return value.
|
420
|
+
|
421
|
+
def overlaps?(another_geometry_)
|
422
|
+
raise Errors::MethodUnimplemented
|
423
|
+
end
|
424
|
+
|
425
|
+
|
426
|
+
# === SFS 1.1 Description
|
427
|
+
#
|
428
|
+
# Returns true if this geometric object is spatially related to
|
429
|
+
# another_geometry by testing for intersections between the interior,
|
430
|
+
# boundary and exterior of the two geometric objects as specified by
|
431
|
+
# the values in the intersection_pattern_matrix.
|
432
|
+
#
|
433
|
+
# === Notes
|
434
|
+
#
|
435
|
+
# The intersection_pattern_matrix is provided as a nine-character
|
436
|
+
# string in row-major order, representing the dimensionalities of
|
437
|
+
# the different intersections in the DE-9IM. Supported characters
|
438
|
+
# include T, F, *, 0, 1, and 2.
|
439
|
+
#
|
440
|
+
# Returns a boolean value. Note that this is different from the SFS
|
441
|
+
# specification, which stipulates an integer return value.
|
442
|
+
|
443
|
+
def relate(another_geometry_, intersection_pattern_matrix_)
|
444
|
+
raise Errors::MethodUnimplemented
|
445
|
+
end
|
446
|
+
|
447
|
+
|
448
|
+
# === SFS 1.1 Description
|
449
|
+
#
|
450
|
+
# Returns the shortest distance between any two Points in the two
|
451
|
+
# geometric objects as calculated in the spatial reference system of
|
452
|
+
# this geometric object.
|
453
|
+
#
|
454
|
+
# === Notes
|
455
|
+
#
|
456
|
+
# Returns a floating-point scalar value.
|
457
|
+
|
458
|
+
def distance(another_geometry_)
|
459
|
+
raise Errors::MethodUnimplemented
|
460
|
+
end
|
461
|
+
|
462
|
+
|
463
|
+
# === SFS 1.1 Description
|
464
|
+
#
|
465
|
+
# Returns a geometric object that represents all Points whose distance
|
466
|
+
# from this geometric object is less than or equal to distance.
|
467
|
+
# Calculations are in the spatial reference system of this geometric
|
468
|
+
# object.
|
469
|
+
#
|
470
|
+
# === Notes
|
471
|
+
#
|
472
|
+
# Returns an object that supports the Geometry interface.
|
473
|
+
|
474
|
+
def buffer(distance_)
|
475
|
+
raise Errors::MethodUnimplemented
|
476
|
+
end
|
477
|
+
|
478
|
+
|
479
|
+
# === SFS 1.1 Description
|
480
|
+
#
|
481
|
+
# Returns a geometric object that represents the convex hull of this
|
482
|
+
# geometric object.
|
483
|
+
#
|
484
|
+
# === Notes
|
485
|
+
#
|
486
|
+
# Returns an object that supports the Geometry interface.
|
487
|
+
|
488
|
+
def convex_hull()
|
489
|
+
raise Errors::MethodUnimplemented
|
490
|
+
end
|
491
|
+
|
492
|
+
|
493
|
+
# === SFS 1.1 Description
|
494
|
+
#
|
495
|
+
# Returns a geometric object that represents the Point set
|
496
|
+
# intersection of this geometric object with another_geometry.
|
497
|
+
#
|
498
|
+
# === Notes
|
499
|
+
#
|
500
|
+
# Returns an object that supports the Geometry interface.
|
501
|
+
|
502
|
+
def intersection(another_geometry_)
|
503
|
+
raise Errors::MethodUnimplemented
|
504
|
+
end
|
505
|
+
|
506
|
+
|
507
|
+
# === SFS 1.1 Description
|
508
|
+
#
|
509
|
+
# Returns a geometric object that represents the Point set
|
510
|
+
# union of this geometric object with another_geometry.
|
511
|
+
#
|
512
|
+
# === Notes
|
513
|
+
#
|
514
|
+
# Returns an object that supports the Geometry interface.
|
515
|
+
|
516
|
+
def union(another_geometry_)
|
517
|
+
raise Errors::MethodUnimplemented
|
518
|
+
end
|
519
|
+
|
520
|
+
|
521
|
+
# === SFS 1.1 Description
|
522
|
+
#
|
523
|
+
# Returns a geometric object that represents the Point set
|
524
|
+
# difference of this geometric object with another_geometry.
|
525
|
+
#
|
526
|
+
# === Notes
|
527
|
+
#
|
528
|
+
# Returns an object that supports the Geometry interface.
|
529
|
+
|
530
|
+
def difference(another_geometry_)
|
531
|
+
raise Errors::MethodUnimplemented
|
532
|
+
end
|
533
|
+
|
534
|
+
|
535
|
+
# === SFS 1.1 Description
|
536
|
+
#
|
537
|
+
# Returns a geometric object that represents the Point set symmetric
|
538
|
+
# difference of this geometric object with another_geometry.
|
539
|
+
#
|
540
|
+
# === Notes
|
541
|
+
#
|
542
|
+
# Returns an object that supports the Geometry interface.
|
543
|
+
|
544
|
+
def sym_difference(another_geometry_)
|
545
|
+
raise Errors::MethodUnimplemented
|
546
|
+
end
|
547
|
+
|
548
|
+
|
549
|
+
alias_method :==, :equals?
|
550
|
+
alias_method :-, :difference
|
551
|
+
alias_method :+, :union
|
552
|
+
alias_method :*, :intersection
|
553
|
+
|
554
|
+
|
555
|
+
end
|
556
|
+
|
557
|
+
|
558
|
+
end
|
559
|
+
|
560
|
+
end
|