schleyfox-rgeo 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (150) hide show
  1. data/History.rdoc +199 -0
  2. data/README.rdoc +172 -0
  3. data/Spatial_Programming_With_RGeo.rdoc +440 -0
  4. data/Version +1 -0
  5. data/ext/geos_c_impl/extconf.rb +84 -0
  6. data/ext/geos_c_impl/factory.c +468 -0
  7. data/ext/geos_c_impl/factory.h +224 -0
  8. data/ext/geos_c_impl/geometry.c +705 -0
  9. data/ext/geos_c_impl/geometry.h +55 -0
  10. data/ext/geos_c_impl/geometry_collection.c +482 -0
  11. data/ext/geos_c_impl/geometry_collection.h +69 -0
  12. data/ext/geos_c_impl/line_string.c +509 -0
  13. data/ext/geos_c_impl/line_string.h +64 -0
  14. data/ext/geos_c_impl/main.c +70 -0
  15. data/ext/geos_c_impl/point.c +193 -0
  16. data/ext/geos_c_impl/point.h +62 -0
  17. data/ext/geos_c_impl/polygon.c +265 -0
  18. data/ext/geos_c_impl/polygon.h +66 -0
  19. data/ext/geos_c_impl/preface.h +50 -0
  20. data/ext/proj4_c_impl/extconf.rb +88 -0
  21. data/ext/proj4_c_impl/main.c +271 -0
  22. data/lib/rgeo.rb +124 -0
  23. data/lib/rgeo/cartesian.rb +60 -0
  24. data/lib/rgeo/cartesian/analysis.rb +118 -0
  25. data/lib/rgeo/cartesian/bounding_box.rb +337 -0
  26. data/lib/rgeo/cartesian/calculations.rb +161 -0
  27. data/lib/rgeo/cartesian/factory.rb +209 -0
  28. data/lib/rgeo/cartesian/feature_classes.rb +173 -0
  29. data/lib/rgeo/cartesian/feature_methods.rb +106 -0
  30. data/lib/rgeo/cartesian/interface.rb +150 -0
  31. data/lib/rgeo/coord_sys.rb +79 -0
  32. data/lib/rgeo/coord_sys/cs/entities.rb +1524 -0
  33. data/lib/rgeo/coord_sys/cs/factories.rb +208 -0
  34. data/lib/rgeo/coord_sys/cs/wkt_parser.rb +308 -0
  35. data/lib/rgeo/coord_sys/proj4.rb +312 -0
  36. data/lib/rgeo/coord_sys/srs_database/active_record_table.rb +194 -0
  37. data/lib/rgeo/coord_sys/srs_database/interface.rb +165 -0
  38. data/lib/rgeo/coord_sys/srs_database/proj4_data.rb +188 -0
  39. data/lib/rgeo/coord_sys/srs_database/sr_org.rb +108 -0
  40. data/lib/rgeo/coord_sys/srs_database/url_reader.rb +108 -0
  41. data/lib/rgeo/error.rb +63 -0
  42. data/lib/rgeo/feature.rb +88 -0
  43. data/lib/rgeo/feature/curve.rb +156 -0
  44. data/lib/rgeo/feature/factory.rb +332 -0
  45. data/lib/rgeo/feature/factory_generator.rb +138 -0
  46. data/lib/rgeo/feature/geometry.rb +614 -0
  47. data/lib/rgeo/feature/geometry_collection.rb +129 -0
  48. data/lib/rgeo/feature/line.rb +66 -0
  49. data/lib/rgeo/feature/line_string.rb +102 -0
  50. data/lib/rgeo/feature/linear_ring.rb +66 -0
  51. data/lib/rgeo/feature/multi_curve.rb +113 -0
  52. data/lib/rgeo/feature/multi_line_string.rb +66 -0
  53. data/lib/rgeo/feature/multi_point.rb +73 -0
  54. data/lib/rgeo/feature/multi_polygon.rb +97 -0
  55. data/lib/rgeo/feature/multi_surface.rb +116 -0
  56. data/lib/rgeo/feature/point.rb +120 -0
  57. data/lib/rgeo/feature/polygon.rb +141 -0
  58. data/lib/rgeo/feature/surface.rb +122 -0
  59. data/lib/rgeo/feature/types.rb +305 -0
  60. data/lib/rgeo/geographic.rb +75 -0
  61. data/lib/rgeo/geographic/factory.rb +287 -0
  62. data/lib/rgeo/geographic/interface.rb +410 -0
  63. data/lib/rgeo/geographic/proj4_projector.rb +98 -0
  64. data/lib/rgeo/geographic/projected_feature_classes.rb +213 -0
  65. data/lib/rgeo/geographic/projected_feature_methods.rb +228 -0
  66. data/lib/rgeo/geographic/projected_window.rb +467 -0
  67. data/lib/rgeo/geographic/simple_mercator_projector.rb +157 -0
  68. data/lib/rgeo/geographic/spherical_feature_classes.rb +212 -0
  69. data/lib/rgeo/geographic/spherical_feature_methods.rb +97 -0
  70. data/lib/rgeo/geographic/spherical_math.rb +206 -0
  71. data/lib/rgeo/geos.rb +72 -0
  72. data/lib/rgeo/geos/factory.rb +301 -0
  73. data/lib/rgeo/geos/impl_additions.rb +76 -0
  74. data/lib/rgeo/geos/interface.rb +139 -0
  75. data/lib/rgeo/geos/zm_factory.rb +275 -0
  76. data/lib/rgeo/geos/zm_impl.rb +432 -0
  77. data/lib/rgeo/impl_helper.rb +53 -0
  78. data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +235 -0
  79. data/lib/rgeo/impl_helper/basic_geometry_methods.rb +85 -0
  80. data/lib/rgeo/impl_helper/basic_line_string_methods.rb +197 -0
  81. data/lib/rgeo/impl_helper/basic_point_methods.rb +138 -0
  82. data/lib/rgeo/impl_helper/basic_polygon_methods.rb +121 -0
  83. data/lib/rgeo/impl_helper/math.rb +50 -0
  84. data/lib/rgeo/version.rb +52 -0
  85. data/lib/rgeo/wkrep.rb +72 -0
  86. data/lib/rgeo/wkrep/wkb_generator.rb +267 -0
  87. data/lib/rgeo/wkrep/wkb_parser.rb +315 -0
  88. data/lib/rgeo/wkrep/wkt_generator.rb +275 -0
  89. data/lib/rgeo/wkrep/wkt_parser.rb +496 -0
  90. data/test/common/geometry_collection_tests.rb +238 -0
  91. data/test/common/line_string_tests.rb +324 -0
  92. data/test/common/multi_line_string_tests.rb +209 -0
  93. data/test/common/multi_point_tests.rb +201 -0
  94. data/test/common/multi_polygon_tests.rb +208 -0
  95. data/test/common/point_tests.rb +331 -0
  96. data/test/common/polygon_tests.rb +232 -0
  97. data/test/coord_sys/tc_active_record_table.rb +102 -0
  98. data/test/coord_sys/tc_ogc_cs.rb +356 -0
  99. data/test/coord_sys/tc_proj4.rb +138 -0
  100. data/test/coord_sys/tc_proj4_srs_data.rb +76 -0
  101. data/test/coord_sys/tc_sr_org.rb +70 -0
  102. data/test/coord_sys/tc_url_reader.rb +82 -0
  103. data/test/geos/tc_factory.rb +91 -0
  104. data/test/geos/tc_geometry_collection.rb +62 -0
  105. data/test/geos/tc_line_string.rb +62 -0
  106. data/test/geos/tc_misc.rb +72 -0
  107. data/test/geos/tc_multi_line_string.rb +62 -0
  108. data/test/geos/tc_multi_point.rb +62 -0
  109. data/test/geos/tc_multi_polygon.rb +63 -0
  110. data/test/geos/tc_point.rb +86 -0
  111. data/test/geos/tc_polygon.rb +86 -0
  112. data/test/geos/tc_zmfactory.rb +85 -0
  113. data/test/projected_geographic/tc_geometry_collection.rb +62 -0
  114. data/test/projected_geographic/tc_line_string.rb +62 -0
  115. data/test/projected_geographic/tc_multi_line_string.rb +62 -0
  116. data/test/projected_geographic/tc_multi_point.rb +62 -0
  117. data/test/projected_geographic/tc_multi_polygon.rb +63 -0
  118. data/test/projected_geographic/tc_point.rb +93 -0
  119. data/test/projected_geographic/tc_polygon.rb +62 -0
  120. data/test/simple_cartesian/tc_calculations.rb +145 -0
  121. data/test/simple_cartesian/tc_geometry_collection.rb +69 -0
  122. data/test/simple_cartesian/tc_line_string.rb +70 -0
  123. data/test/simple_cartesian/tc_multi_line_string.rb +67 -0
  124. data/test/simple_cartesian/tc_multi_point.rb +67 -0
  125. data/test/simple_cartesian/tc_multi_polygon.rb +70 -0
  126. data/test/simple_cartesian/tc_point.rb +91 -0
  127. data/test/simple_cartesian/tc_polygon.rb +67 -0
  128. data/test/simple_mercator/tc_geometry_collection.rb +62 -0
  129. data/test/simple_mercator/tc_line_string.rb +62 -0
  130. data/test/simple_mercator/tc_multi_line_string.rb +62 -0
  131. data/test/simple_mercator/tc_multi_point.rb +62 -0
  132. data/test/simple_mercator/tc_multi_polygon.rb +63 -0
  133. data/test/simple_mercator/tc_point.rb +93 -0
  134. data/test/simple_mercator/tc_polygon.rb +62 -0
  135. data/test/simple_mercator/tc_window.rb +219 -0
  136. data/test/spherical_geographic/tc_calculations.rb +203 -0
  137. data/test/spherical_geographic/tc_geometry_collection.rb +70 -0
  138. data/test/spherical_geographic/tc_line_string.rb +70 -0
  139. data/test/spherical_geographic/tc_multi_line_string.rb +67 -0
  140. data/test/spherical_geographic/tc_multi_point.rb +67 -0
  141. data/test/spherical_geographic/tc_multi_polygon.rb +70 -0
  142. data/test/spherical_geographic/tc_point.rb +100 -0
  143. data/test/spherical_geographic/tc_polygon.rb +67 -0
  144. data/test/tc_cartesian_analysis.rb +107 -0
  145. data/test/tc_oneoff.rb +63 -0
  146. data/test/wkrep/tc_wkb_generator.rb +249 -0
  147. data/test/wkrep/tc_wkb_parser.rb +353 -0
  148. data/test/wkrep/tc_wkt_generator.rb +362 -0
  149. data/test/wkrep/tc_wkt_parser.rb +480 -0
  150. metadata +267 -0
@@ -0,0 +1,138 @@
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 Feature
40
+
41
+
42
+ # A FactoryGenerator is a callable object (usually a Proc) that
43
+ # takes a configuration as a hash and returns a factory. These are
44
+ # often used, e.g., by parsers to determine what factory the parsed
45
+ # geometry should have.
46
+ #
47
+ # See the call method for a list of common configuration parameters.
48
+ # Different generators will support different parameters. There is
49
+ # no mechanism defined to reflect on the parameters understood by a
50
+ # factory generator.
51
+ #
52
+ # Many of the implementations provide a factory method for creating
53
+ # factories. For example, RGeo::Cartesian::preferred_factory can be
54
+ # called to create a factory using the preferred Cartesian
55
+ # implementation. Thus, to get a corresponding factory generator,
56
+ # you can use the <tt>method</tt> method. e.g.
57
+ #
58
+ # factory_generator = ::RGeo::Cartesian.method(:preferred_factory)
59
+ #
60
+ # FactoryGenerator is defined as a module and is provided
61
+ # primarily for the sake of documentation. Implementations need not
62
+ # necessarily include this module itself. Therefore, you should not
63
+ # depend on the kind_of? method to determine if an object is a
64
+ # factory generator.
65
+
66
+ module FactoryGenerator
67
+
68
+
69
+ # Generate a factory given a configuration as a hash.
70
+ #
71
+ # If the generator does not recognize or does not support a given
72
+ # configuration value, the behavior is usually determined by the
73
+ # <tt>:strict</tt> configuration element. If <tt>strict</tt> is
74
+ # set to true, the generator should fail fast by returning nil or
75
+ # raising an exception. If it is set to false, the generator should
76
+ # attempt to do the best it can, even if it means returning a
77
+ # factory that does not match the requested configuration.
78
+ #
79
+ # Common parameters are as follows. These are intended as a
80
+ # recommendation only. There is no hard requirement for any
81
+ # particular factory generator to support them.
82
+ #
83
+ # [<tt>:strict</tt>]
84
+ # If true, return nil or raise an exception if any configuration
85
+ # was not recognized or not supportable. Otherwise, if false,
86
+ # the generator should attempt to do its best to return some
87
+ # viable factory, even if it does not strictly match the
88
+ # requested configuration. Default is usually false.
89
+ # [<tt>:srid</tt>]
90
+ # The SRID for the factory and objects it creates.
91
+ # Default is usually 0.
92
+ # [<tt>:proj4</tt>]
93
+ # The coordinate system in Proj4 format, either as a
94
+ # CoordSys::Proj4 object or as a string or hash representing the
95
+ # proj4 format. This is usually an optional parameter; the default
96
+ # is usually nil.
97
+ # [<tt>:coord_sys</tt>]
98
+ # The coordinate system in OGC form, either as a subclass of
99
+ # CoordSys::CS::CoordinateSystem, or as a string in WKT format.
100
+ # This is usually an optional parameter; the default is usually
101
+ # nil.
102
+ # [<tt>:srs_database</tt>]
103
+ # If provided, look up the Proj4 and OGC coordinate systems from
104
+ # the given database and SRID.
105
+ # [<tt>:has_z_coordinate</tt>]
106
+ # Support Z coordinates. Default is usually false.
107
+ # [<tt>:has_m_coordinate</tt>]
108
+ # Support M coordinates. Default is usually false.
109
+
110
+ def call(config_={})
111
+ nil
112
+ end
113
+
114
+
115
+ # Return a new FactoryGenerator that always returns the given
116
+ # factory.
117
+
118
+ def self.single(factory_)
119
+ ::Proc.new{ |c_| factory_ }
120
+ end
121
+
122
+
123
+ # Return a new FactoryGenerator that calls the given delegate, but
124
+ # modifies the configuration passed to it. You can provide defaults
125
+ # for configuration values not explicitly specified, and you can
126
+ # force certain values to override the given configuration.
127
+
128
+ def self.decorate(delegate_, default_config_={}, force_config_={})
129
+ ::Proc.new{ |c_| delegate_.call(default_config_.merge(c_).merge(force_config_)) }
130
+ end
131
+
132
+
133
+ end
134
+
135
+
136
+ end
137
+
138
+ end
@@ -0,0 +1,614 @@
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 Feature
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 for the
59
+ # sake of documentation. Implementations need not necessarily include
60
+ # 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 (or === operator) defined in the Type module.
63
+ #
64
+ # Some implementations may support higher dimensional objects or
65
+ # coordinate systems, despite the limits of the SFS.
66
+ #
67
+ # == Forms of equivalence
68
+ #
69
+ # The Geometry model defines three forms of equivalence.
70
+ #
71
+ # * <b>Spatial equivalence</b> is the weakest form of equivalence,
72
+ # indicating that the objects represent the same region of space,
73
+ # but may be different representations of that region. For example,
74
+ # POINT(0 0) and a MULTIPOINT(0 0) are spatially equivalent, as are
75
+ # LINESTRING(0 0, 10 10) and
76
+ # GEOMETRYCOLLECTION(POINT(0 0), LINESTRING(0 0, 10 10, 0 0)).
77
+ # As a general rule, objects must have factories that are
78
+ # Factory#eql? in order to be spatially equivalent.
79
+ #
80
+ # * <b>Objective equivalence</b> is a stronger form of equivalence,
81
+ # indicating that the objects are the same representation, but may
82
+ # be different objects. All objectively equivalent objects are
83
+ # spatially 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 as well as spatially equivalent.
88
+ #
89
+ # * <b>Objective identity</b> is the strongest form, indicating that
90
+ # the 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
+ extend Type
103
+
104
+
105
+ # Returns a factory for creating features related to this one.
106
+ # This does not necessarily need to be the same factory that created
107
+ # this object, but it should create objects that are "compatible"
108
+ # with this one. (i.e. they should be in the same spatial reference
109
+ # system by default, and it should be possible to perform relational
110
+ # operations on them.)
111
+
112
+ def factory
113
+ raise Error::UnsupportedOperation, "Method Geometry#factory not defined."
114
+ end
115
+
116
+
117
+ # Returns true if this geometric object is objectively equivalent
118
+ # to the given object.
119
+
120
+ def eql?(another_geometry_)
121
+ raise Error::UnsupportedOperation, "Method Geometry#eql? not defined."
122
+ end
123
+
124
+
125
+ # === SFS 1.1 Description
126
+ #
127
+ # The inherent dimension of this geometric object, which must be less
128
+ # than or equal to the coordinate dimension. This specification is
129
+ # restricted to geometries in 2-dimensional coordinate space.
130
+ #
131
+ # === Notes
132
+ #
133
+ # Returns an integer. This value is -1 for an empty geometry, 0 for
134
+ # point geometries, 1 for curves, and 2 for surfaces.
135
+
136
+ def dimension
137
+ raise Error::UnsupportedOperation, "Method Geometry#dimension not defined."
138
+ end
139
+
140
+
141
+ # === SFS 1.1 Description
142
+ #
143
+ # Returns the instantiable subtype of Geometry of which this
144
+ # geometric object is an instantiable member.
145
+ #
146
+ # === Notes
147
+ #
148
+ # Returns one of the type modules in RGeo::Feature. e.g. a point
149
+ # object would return RGeo::Feature::Point. Note that this is
150
+ # different from the SFS specification, which stipulates that the
151
+ # string name of the type is returned. To obtain the name string,
152
+ # call the +type_name+ method of the returned module.
153
+
154
+ def geometry_type
155
+ raise Error::UnsupportedOperation, "Method Geometry#geometry_type not defined."
156
+ end
157
+
158
+
159
+ # === SFS 1.1 Description
160
+ #
161
+ # Returns the Spatial Reference System ID for this geometric object.
162
+ #
163
+ # === Notes
164
+ #
165
+ # Returns an integer.
166
+ #
167
+ # This will normally be a foreign key to an index of reference systems
168
+ # stored in either the same or some other datastore.
169
+
170
+ def srid
171
+ raise Error::UnsupportedOperation, "Method Geometry#srid not defined."
172
+ end
173
+
174
+
175
+ # === SFS 1.1 Description
176
+ #
177
+ # The minimum bounding box for this Geometry, returned as a Geometry.
178
+ # The polygon is defined by the corner points of the bounding box
179
+ # [(MINX, MINY), (MAXX, MINY), (MAXX, MAXY), (MINX, MAXY), (MINX, MINY)].
180
+ #
181
+ # === Notes
182
+ #
183
+ # Returns an object that supports the Geometry interface.
184
+
185
+ def envelope
186
+ raise Error::UnsupportedOperation, "Method Geometry#envelope not defined."
187
+ end
188
+
189
+
190
+ # === SFS 1.1 Description
191
+ #
192
+ # Exports this geometric object to a specific Well-known Text
193
+ # Representation of Geometry.
194
+ #
195
+ # === Notes
196
+ #
197
+ # Returns an ASCII string.
198
+
199
+ def as_text
200
+ raise Error::UnsupportedOperation, "Method Geometry#as_text not defined."
201
+ end
202
+
203
+
204
+ # === SFS 1.1 Description
205
+ #
206
+ # Exports this geometric object to a specific Well-known Binary
207
+ # Representation of Geometry.
208
+ #
209
+ # === Notes
210
+ #
211
+ # Returns a binary string.
212
+
213
+ def as_binary
214
+ raise Error::UnsupportedOperation, "Method Geometry#as_binary not defined."
215
+ end
216
+
217
+
218
+ # === SFS 1.1 Description
219
+ #
220
+ # Returns true if this geometric object is the empty Geometry. If true,
221
+ # then this geometric object represents the empty point set for the
222
+ # coordinate space.
223
+ #
224
+ # === Notes
225
+ #
226
+ # Returns a boolean value. Note that this is different from the SFS
227
+ # specification, which stipulates an integer return value.
228
+
229
+ def is_empty?
230
+ raise Error::UnsupportedOperation, "Method Geometry#is_empty? not defined."
231
+ end
232
+
233
+
234
+ # === SFS 1.1 Description
235
+ #
236
+ # Returns true if this geometric object has no anomalous geometric
237
+ # points, such as self intersection or self tangency. The description
238
+ # of each instantiable geometric class will include the specific
239
+ # conditions that cause an instance of that class to be classified as
240
+ # not simple.
241
+ #
242
+ # === Notes
243
+ #
244
+ # Returns a boolean value. Note that this is different from the SFS
245
+ # specification, which stipulates an integer return value.
246
+
247
+ def is_simple?
248
+ raise Error::UnsupportedOperation, "Method Geometry#is_simple? not defined."
249
+ end
250
+
251
+
252
+ # === SFS 1.1 Description
253
+ #
254
+ # Returns the closure of the combinatorial boundary of this geometric
255
+ # object. Because the result of this function is a closure, and hence
256
+ # topologically closed, the resulting boundary can be represented using
257
+ # representational Geometry primitives.
258
+ #
259
+ # === Notes
260
+ #
261
+ # Returns an object that supports the Geometry interface.
262
+
263
+ def boundary
264
+ raise Error::UnsupportedOperation, "Method Geometry#boundary not defined."
265
+ end
266
+
267
+
268
+ # === SFS 1.1 Description
269
+ #
270
+ # Returns true if this geometric object is "spatially equal" to
271
+ # another_geometry.
272
+ #
273
+ # === Notes
274
+ #
275
+ # Returns a boolean value. Note that this is different from the SFS
276
+ # specification, which stipulates an integer return value.
277
+ #
278
+ # Although implementations are free to attempt to handle
279
+ # another_geometry values that do not share the same factory as
280
+ # this geometry, strictly speaking, the result of comparing objects
281
+ # of different factories is undefined.
282
+
283
+ def equals?(another_geometry_)
284
+ raise Error::UnsupportedOperation, "Method Geometry#equals? not defined."
285
+ end
286
+
287
+
288
+ # === SFS 1.1 Description
289
+ #
290
+ # Returns true if this geometric object is "spatially disjoint" from
291
+ # another_geometry.
292
+ #
293
+ # === Notes
294
+ #
295
+ # Returns a boolean value. Note that this is different from the SFS
296
+ # specification, which stipulates an integer return value.
297
+ #
298
+ # Although implementations are free to attempt to handle
299
+ # another_geometry values that do not share the same factory as
300
+ # this geometry, strictly speaking, the result of comparing objects
301
+ # of different factories is undefined.
302
+
303
+ def disjoint?(another_geometry_)
304
+ raise Error::UnsupportedOperation, "Method Geometry#disjoint? not defined."
305
+ end
306
+
307
+
308
+ # === SFS 1.1 Description
309
+ #
310
+ # Returns true if this geometric object "spatially intersects"
311
+ # another_geometry.
312
+ #
313
+ # === Notes
314
+ #
315
+ # Returns a boolean value. Note that this is different from the SFS
316
+ # specification, which stipulates an integer return value.
317
+ #
318
+ # Although implementations are free to attempt to handle
319
+ # another_geometry values that do not share the same factory as
320
+ # this geometry, strictly speaking, the result of comparing objects
321
+ # of different factories is undefined.
322
+
323
+ def intersects?(another_geometry_)
324
+ raise Error::UnsupportedOperation, "Method Geometry#intersects? not defined."
325
+ end
326
+
327
+
328
+ # === SFS 1.1 Description
329
+ #
330
+ # Returns true if this geometric object "spatially touches"
331
+ # another_geometry.
332
+ #
333
+ # === Notes
334
+ #
335
+ # Returns a boolean value. Note that this is different from the SFS
336
+ # specification, which stipulates an integer return value.
337
+ #
338
+ # Although implementations are free to attempt to handle
339
+ # another_geometry values that do not share the same factory as
340
+ # this geometry, strictly speaking, the result of comparing objects
341
+ # of different factories is undefined.
342
+
343
+ def touches?(another_geometry_)
344
+ raise Error::UnsupportedOperation, "Method Geometry#touches? not defined."
345
+ end
346
+
347
+
348
+ # === SFS 1.1 Description
349
+ #
350
+ # Returns true if this geometric object "spatially crosses"
351
+ # another_geometry.
352
+ #
353
+ # === Notes
354
+ #
355
+ # Returns a boolean value. Note that this is different from the SFS
356
+ # specification, which stipulates an integer return value.
357
+ #
358
+ # Although implementations are free to attempt to handle
359
+ # another_geometry values that do not share the same factory as
360
+ # this geometry, strictly speaking, the result of comparing objects
361
+ # of different factories is undefined.
362
+
363
+ def crosses?(another_geometry_)
364
+ raise Error::UnsupportedOperation, "Method Geometry#crosses? not defined."
365
+ end
366
+
367
+
368
+ # === SFS 1.1 Description
369
+ #
370
+ # Returns true if this geometric object is "spatially within"
371
+ # another_geometry.
372
+ #
373
+ # === Notes
374
+ #
375
+ # Returns a boolean value. Note that this is different from the SFS
376
+ # specification, which stipulates an integer return value.
377
+ #
378
+ # Although implementations are free to attempt to handle
379
+ # another_geometry values that do not share the same factory as
380
+ # this geometry, strictly speaking, the result of comparing objects
381
+ # of different factories is undefined.
382
+
383
+ def within?(another_geometry_)
384
+ raise Error::UnsupportedOperation, "Method Geometry#within? not defined."
385
+ end
386
+
387
+
388
+ # === SFS 1.1 Description
389
+ #
390
+ # Returns true if this geometric object "spatially contains"
391
+ # another_geometry.
392
+ #
393
+ # === Notes
394
+ #
395
+ # Returns a boolean value. Note that this is different from the SFS
396
+ # specification, which stipulates an integer return value.
397
+ #
398
+ # Although implementations are free to attempt to handle
399
+ # another_geometry values that do not share the same factory as
400
+ # this geometry, strictly speaking, the result of comparing objects
401
+ # of different factories is undefined.
402
+
403
+ def contains?(another_geometry_)
404
+ raise Error::UnsupportedOperation, "Method Geometry#contains? not defined."
405
+ end
406
+
407
+
408
+ # === SFS 1.1 Description
409
+ #
410
+ # Returns true if this geometric object "spatially overlaps"
411
+ # another_geometry.
412
+ #
413
+ # === Notes
414
+ #
415
+ # Returns a boolean value. Note that this is different from the SFS
416
+ # specification, which stipulates an integer return value.
417
+ #
418
+ # Although implementations are free to attempt to handle
419
+ # another_geometry values that do not share the same factory as
420
+ # this geometry, strictly speaking, the result of comparing objects
421
+ # of different factories is undefined.
422
+
423
+ def overlaps?(another_geometry_)
424
+ raise Error::UnsupportedOperation, "Method Geometry#overlaps? not defined."
425
+ end
426
+
427
+
428
+ # === SFS 1.1 Description
429
+ #
430
+ # Returns true if this geometric object is spatially related to
431
+ # another_geometry by testing for intersections between the interior,
432
+ # boundary and exterior of the two geometric objects as specified by
433
+ # the values in the intersection_pattern_matrix.
434
+ #
435
+ # === Notes
436
+ #
437
+ # The intersection_pattern_matrix is provided as a nine-character
438
+ # string in row-major order, representing the dimensionalities of
439
+ # the different intersections in the DE-9IM. Supported characters
440
+ # include T, F, *, 0, 1, and 2.
441
+ #
442
+ # Returns a boolean value. Note that this is different from the SFS
443
+ # specification, which stipulates an integer return value.
444
+ #
445
+ # Although implementations are free to attempt to handle
446
+ # another_geometry values that do not share the same factory as
447
+ # this geometry, strictly speaking, the result of comparing objects
448
+ # of different factories is undefined.
449
+
450
+ def relate(another_geometry_, intersection_pattern_matrix_)
451
+ raise Error::UnsupportedOperation, "Method Geometry#relate not defined."
452
+ end
453
+
454
+
455
+ # === SFS 1.1 Description
456
+ #
457
+ # Returns the shortest distance between any two Points in the two
458
+ # geometric objects as calculated in the spatial reference system of
459
+ # this geometric object.
460
+ #
461
+ # === Notes
462
+ #
463
+ # Returns a floating-point scalar value.
464
+ #
465
+ # Although implementations are free to attempt to handle
466
+ # another_geometry values that do not share the same factory as
467
+ # this geometry, strictly speaking, the result of measuring the
468
+ # distance between objects of different factories is undefined.
469
+
470
+ def distance(another_geometry_)
471
+ raise Error::UnsupportedOperation, "Method Geometry#distance not defined."
472
+ end
473
+
474
+
475
+ # === SFS 1.1 Description
476
+ #
477
+ # Returns a geometric object that represents all Points whose distance
478
+ # from this geometric object is less than or equal to distance.
479
+ # Calculations are in the spatial reference system of this geometric
480
+ # object.
481
+ #
482
+ # === Notes
483
+ #
484
+ # Returns an object that supports the Geometry interface.
485
+
486
+ def buffer(distance_)
487
+ raise Error::UnsupportedOperation, "Method Geometry#buffer not defined."
488
+ end
489
+
490
+
491
+ # === SFS 1.1 Description
492
+ #
493
+ # Returns a geometric object that represents the convex hull of this
494
+ # geometric object.
495
+ #
496
+ # === Notes
497
+ #
498
+ # Returns an object that supports the Geometry interface.
499
+
500
+ def convex_hull
501
+ raise Error::UnsupportedOperation, "Method Geometry#convex_hull not defined."
502
+ end
503
+
504
+
505
+ # === SFS 1.1 Description
506
+ #
507
+ # Returns a geometric object that represents the Point set
508
+ # intersection of this geometric object with another_geometry.
509
+ #
510
+ # === Notes
511
+ #
512
+ # Returns an object that supports the Geometry interface.
513
+ #
514
+ # Although implementations are free to attempt to handle
515
+ # another_geometry values that do not share the same factory as
516
+ # this geometry, strictly speaking, the result of performing
517
+ # operations on objects of different factories is undefined.
518
+
519
+ def intersection(another_geometry_)
520
+ raise Error::UnsupportedOperation, "Method Geometry#intersection not defined."
521
+ end
522
+
523
+
524
+ # === SFS 1.1 Description
525
+ #
526
+ # Returns a geometric object that represents the Point set
527
+ # union of this geometric object with another_geometry.
528
+ #
529
+ # === Notes
530
+ #
531
+ # Returns an object that supports the Geometry interface.
532
+ #
533
+ # Although implementations are free to attempt to handle
534
+ # another_geometry values that do not share the same factory as
535
+ # this geometry, strictly speaking, the result of performing
536
+ # operations on objects of different factories is undefined.
537
+
538
+ def union(another_geometry_)
539
+ raise Error::UnsupportedOperation, "Method Geometry#union not defined."
540
+ end
541
+
542
+
543
+ # === SFS 1.1 Description
544
+ #
545
+ # Returns a geometric object that represents the Point set
546
+ # difference of this geometric object with another_geometry.
547
+ #
548
+ # === Notes
549
+ #
550
+ # Returns an object that supports the Geometry interface.
551
+ #
552
+ # Although implementations are free to attempt to handle
553
+ # another_geometry values that do not share the same factory as
554
+ # this geometry, strictly speaking, the result of performing
555
+ # operations on objects of different factories is undefined.
556
+
557
+ def difference(another_geometry_)
558
+ raise Error::UnsupportedOperation, "Method Geometry#difference not defined."
559
+ end
560
+
561
+
562
+ # === SFS 1.1 Description
563
+ #
564
+ # Returns a geometric object that represents the Point set symmetric
565
+ # difference of this geometric object with another_geometry.
566
+ #
567
+ # === Notes
568
+ #
569
+ # Returns an object that supports the Geometry interface.
570
+ #
571
+ # Although implementations are free to attempt to handle
572
+ # another_geometry values that do not share the same factory as
573
+ # this geometry, strictly speaking, the result of performing
574
+ # operations on objects of different factories is undefined.
575
+
576
+ def sym_difference(another_geometry_)
577
+ raise Error::UnsupportedOperation, "Method Geometry#sym_difference not defined."
578
+ end
579
+
580
+
581
+ # Alias of the equals? method.
582
+
583
+ def ==(rhs_)
584
+ equals?(rhs_)
585
+ end
586
+
587
+
588
+ # Alias of the difference method.
589
+
590
+ def -(rhs_)
591
+ difference(rhs_)
592
+ end
593
+
594
+
595
+ # Alias of the union method.
596
+
597
+ def +(rhs_)
598
+ union(rhs_)
599
+ end
600
+
601
+
602
+ # Alias of the intersection method.
603
+
604
+ def *(rhs_)
605
+ intersection(rhs_)
606
+ end
607
+
608
+
609
+ end
610
+
611
+
612
+ end
613
+
614
+ end