rgeo-dschee 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (176) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE.txt +29 -0
  3. data/ext/geos_c_impl/coordinates.c +65 -0
  4. data/ext/geos_c_impl/coordinates.h +2 -0
  5. data/ext/geos_c_impl/extconf.rb +43 -0
  6. data/ext/geos_c_impl/factory.c +995 -0
  7. data/ext/geos_c_impl/factory.h +238 -0
  8. data/ext/geos_c_impl/geometry.c +1093 -0
  9. data/ext/geos_c_impl/geometry.h +23 -0
  10. data/ext/geos_c_impl/geometry_collection.c +757 -0
  11. data/ext/geos_c_impl/geometry_collection.h +46 -0
  12. data/ext/geos_c_impl/line_string.c +675 -0
  13. data/ext/geos_c_impl/line_string.h +32 -0
  14. data/ext/geos_c_impl/main.c +40 -0
  15. data/ext/geos_c_impl/point.c +236 -0
  16. data/ext/geos_c_impl/point.h +30 -0
  17. data/ext/geos_c_impl/polygon.c +359 -0
  18. data/ext/geos_c_impl/polygon.h +43 -0
  19. data/ext/geos_c_impl/preface.h +38 -0
  20. data/ext/proj4_c_impl/extconf.rb +62 -0
  21. data/ext/proj4_c_impl/main.c +315 -0
  22. data/lib/rgeo.rb +89 -0
  23. data/lib/rgeo/cartesian.rb +25 -0
  24. data/lib/rgeo/cartesian/analysis.rb +77 -0
  25. data/lib/rgeo/cartesian/bounding_box.rb +398 -0
  26. data/lib/rgeo/cartesian/calculations.rb +113 -0
  27. data/lib/rgeo/cartesian/factory.rb +347 -0
  28. data/lib/rgeo/cartesian/feature_classes.rb +100 -0
  29. data/lib/rgeo/cartesian/feature_methods.rb +88 -0
  30. data/lib/rgeo/cartesian/interface.rb +135 -0
  31. data/lib/rgeo/coord_sys.rb +43 -0
  32. data/lib/rgeo/coord_sys/cs/entities.rb +1315 -0
  33. data/lib/rgeo/coord_sys/cs/factories.rb +148 -0
  34. data/lib/rgeo/coord_sys/cs/wkt_parser.rb +272 -0
  35. data/lib/rgeo/coord_sys/proj4.rb +293 -0
  36. data/lib/rgeo/coord_sys/srs_database/interface.rb +115 -0
  37. data/lib/rgeo/coord_sys/srs_database/proj4_data.rb +140 -0
  38. data/lib/rgeo/coord_sys/srs_database/sr_org.rb +62 -0
  39. data/lib/rgeo/coord_sys/srs_database/url_reader.rb +63 -0
  40. data/lib/rgeo/error.rb +27 -0
  41. data/lib/rgeo/feature.rb +54 -0
  42. data/lib/rgeo/feature/curve.rb +111 -0
  43. data/lib/rgeo/feature/factory.rb +278 -0
  44. data/lib/rgeo/feature/factory_generator.rb +96 -0
  45. data/lib/rgeo/feature/geometry.rb +624 -0
  46. data/lib/rgeo/feature/geometry_collection.rb +95 -0
  47. data/lib/rgeo/feature/line.rb +26 -0
  48. data/lib/rgeo/feature/line_string.rb +60 -0
  49. data/lib/rgeo/feature/linear_ring.rb +26 -0
  50. data/lib/rgeo/feature/mixins.rb +143 -0
  51. data/lib/rgeo/feature/multi_curve.rb +71 -0
  52. data/lib/rgeo/feature/multi_line_string.rb +26 -0
  53. data/lib/rgeo/feature/multi_point.rb +33 -0
  54. data/lib/rgeo/feature/multi_polygon.rb +57 -0
  55. data/lib/rgeo/feature/multi_surface.rb +73 -0
  56. data/lib/rgeo/feature/point.rb +84 -0
  57. data/lib/rgeo/feature/polygon.rb +97 -0
  58. data/lib/rgeo/feature/surface.rb +79 -0
  59. data/lib/rgeo/feature/types.rb +284 -0
  60. data/lib/rgeo/geographic.rb +40 -0
  61. data/lib/rgeo/geographic/factory.rb +450 -0
  62. data/lib/rgeo/geographic/interface.rb +489 -0
  63. data/lib/rgeo/geographic/proj4_projector.rb +58 -0
  64. data/lib/rgeo/geographic/projected_feature_classes.rb +107 -0
  65. data/lib/rgeo/geographic/projected_feature_methods.rb +212 -0
  66. data/lib/rgeo/geographic/projected_window.rb +383 -0
  67. data/lib/rgeo/geographic/simple_mercator_projector.rb +110 -0
  68. data/lib/rgeo/geographic/spherical_feature_classes.rb +100 -0
  69. data/lib/rgeo/geographic/spherical_feature_methods.rb +134 -0
  70. data/lib/rgeo/geographic/spherical_math.rb +188 -0
  71. data/lib/rgeo/geos.rb +89 -0
  72. data/lib/rgeo/geos/capi_factory.rb +470 -0
  73. data/lib/rgeo/geos/capi_feature_classes.rb +129 -0
  74. data/lib/rgeo/geos/ffi_factory.rb +592 -0
  75. data/lib/rgeo/geos/ffi_feature_classes.rb +83 -0
  76. data/lib/rgeo/geos/ffi_feature_methods.rb +574 -0
  77. data/lib/rgeo/geos/interface.rb +202 -0
  78. data/lib/rgeo/geos/utils.rb +74 -0
  79. data/lib/rgeo/geos/zm_factory.rb +405 -0
  80. data/lib/rgeo/geos/zm_feature_classes.rb +80 -0
  81. data/lib/rgeo/geos/zm_feature_methods.rb +344 -0
  82. data/lib/rgeo/impl_helper.rb +19 -0
  83. data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +185 -0
  84. data/lib/rgeo/impl_helper/basic_geometry_methods.rb +61 -0
  85. data/lib/rgeo/impl_helper/basic_line_string_methods.rb +146 -0
  86. data/lib/rgeo/impl_helper/basic_point_methods.rb +104 -0
  87. data/lib/rgeo/impl_helper/basic_polygon_methods.rb +87 -0
  88. data/lib/rgeo/impl_helper/math.rb +14 -0
  89. data/lib/rgeo/impl_helper/utils.rb +29 -0
  90. data/lib/rgeo/version.rb +3 -0
  91. data/lib/rgeo/wkrep.rb +37 -0
  92. data/lib/rgeo/wkrep/wkb_generator.rb +201 -0
  93. data/lib/rgeo/wkrep/wkb_parser.rb +251 -0
  94. data/lib/rgeo/wkrep/wkt_generator.rb +207 -0
  95. data/lib/rgeo/wkrep/wkt_parser.rb +415 -0
  96. data/lib/rgeo/yaml.rb +23 -0
  97. data/test/cartesian_analysis_test.rb +65 -0
  98. data/test/cartesian_bbox_test.rb +123 -0
  99. data/test/common/factory_tests.rb +78 -0
  100. data/test/common/geometry_collection_tests.rb +237 -0
  101. data/test/common/line_string_tests.rb +330 -0
  102. data/test/common/multi_line_string_tests.rb +182 -0
  103. data/test/common/multi_point_tests.rb +200 -0
  104. data/test/common/multi_polygon_tests.rb +191 -0
  105. data/test/common/point_tests.rb +370 -0
  106. data/test/common/polygon_tests.rb +261 -0
  107. data/test/coord_sys/ogc_cs_test.rb +342 -0
  108. data/test/coord_sys/proj4_srs_data_test.rb +41 -0
  109. data/test/coord_sys/proj4_test.rb +150 -0
  110. data/test/coord_sys/sr_org_test.rb +32 -0
  111. data/test/coord_sys/url_reader_test.rb +42 -0
  112. data/test/geos_capi/factory_test.rb +31 -0
  113. data/test/geos_capi/geometry_collection_test.rb +24 -0
  114. data/test/geos_capi/line_string_test.rb +24 -0
  115. data/test/geos_capi/misc_test.rb +116 -0
  116. data/test/geos_capi/multi_line_string_test.rb +24 -0
  117. data/test/geos_capi/multi_point_test.rb +24 -0
  118. data/test/geos_capi/multi_polygon_test.rb +39 -0
  119. data/test/geos_capi/parsing_unparsing_test.rb +40 -0
  120. data/test/geos_capi/point_test.rb +72 -0
  121. data/test/geos_capi/polygon_test.rb +154 -0
  122. data/test/geos_capi/zmfactory_test.rb +57 -0
  123. data/test/geos_ffi/factory_test.rb +31 -0
  124. data/test/geos_ffi/geometry_collection_test.rb +24 -0
  125. data/test/geos_ffi/line_string_test.rb +24 -0
  126. data/test/geos_ffi/misc_test.rb +63 -0
  127. data/test/geos_ffi/multi_line_string_test.rb +24 -0
  128. data/test/geos_ffi/multi_point_test.rb +24 -0
  129. data/test/geos_ffi/multi_polygon_test.rb +33 -0
  130. data/test/geos_ffi/parsing_unparsing_test.rb +41 -0
  131. data/test/geos_ffi/point_test.rb +77 -0
  132. data/test/geos_ffi/polygon_test.rb +46 -0
  133. data/test/geos_ffi/zmfactory_test.rb +58 -0
  134. data/test/mixins_test.rb +141 -0
  135. data/test/oneoff_test.rb +26 -0
  136. data/test/projected_geographic/factory_test.rb +25 -0
  137. data/test/projected_geographic/geometry_collection_test.rb +24 -0
  138. data/test/projected_geographic/line_string_test.rb +24 -0
  139. data/test/projected_geographic/multi_line_string_test.rb +26 -0
  140. data/test/projected_geographic/multi_point_test.rb +30 -0
  141. data/test/projected_geographic/multi_polygon_test.rb +25 -0
  142. data/test/projected_geographic/point_test.rb +51 -0
  143. data/test/projected_geographic/polygon_test.rb +24 -0
  144. data/test/simple_cartesian/calculations_test.rb +99 -0
  145. data/test/simple_cartesian/factory_test.rb +27 -0
  146. data/test/simple_cartesian/geometry_collection_test.rb +30 -0
  147. data/test/simple_cartesian/line_string_test.rb +31 -0
  148. data/test/simple_cartesian/multi_line_string_test.rb +28 -0
  149. data/test/simple_cartesian/multi_point_test.rb +31 -0
  150. data/test/simple_cartesian/multi_polygon_test.rb +31 -0
  151. data/test/simple_cartesian/point_test.rb +50 -0
  152. data/test/simple_cartesian/polygon_test.rb +28 -0
  153. data/test/simple_mercator/factory_test.rb +25 -0
  154. data/test/simple_mercator/geometry_collection_test.rb +24 -0
  155. data/test/simple_mercator/line_string_test.rb +24 -0
  156. data/test/simple_mercator/multi_line_string_test.rb +26 -0
  157. data/test/simple_mercator/multi_point_test.rb +29 -0
  158. data/test/simple_mercator/multi_polygon_test.rb +25 -0
  159. data/test/simple_mercator/point_test.rb +55 -0
  160. data/test/simple_mercator/polygon_test.rb +24 -0
  161. data/test/simple_mercator/window_test.rb +173 -0
  162. data/test/spherical_geographic/calculations_test.rb +167 -0
  163. data/test/spherical_geographic/factory_test.rb +27 -0
  164. data/test/spherical_geographic/geometry_collection_test.rb +31 -0
  165. data/test/spherical_geographic/line_string_test.rb +31 -0
  166. data/test/spherical_geographic/multi_line_string_test.rb +29 -0
  167. data/test/spherical_geographic/multi_point_test.rb +31 -0
  168. data/test/spherical_geographic/multi_polygon_test.rb +31 -0
  169. data/test/spherical_geographic/point_test.rb +78 -0
  170. data/test/spherical_geographic/polygon_test.rb +28 -0
  171. data/test/types_test.rb +42 -0
  172. data/test/wkrep/wkb_generator_test.rb +185 -0
  173. data/test/wkrep/wkb_parser_test.rb +293 -0
  174. data/test/wkrep/wkt_generator_test.rb +294 -0
  175. data/test/wkrep/wkt_parser_test.rb +412 -0
  176. metadata +386 -0
@@ -0,0 +1,95 @@
1
+ # -----------------------------------------------------------------------------
2
+ #
3
+ # GeometryCollection feature interface
4
+ #
5
+ # -----------------------------------------------------------------------------
6
+
7
+ module RGeo
8
+ module Feature
9
+ # == SFS 1.1 Description
10
+ #
11
+ # A GeometryCollection is a geometric object that is a collection of 1
12
+ # or more geometric objects.
13
+ #
14
+ # All the elements in a GeometryCollection shall be in the same Spatial
15
+ # Reference. This is also the Spatial Reference for the GeometryCollection.
16
+ #
17
+ # GeometryCollection places no other constraints on its elements.
18
+ # Subclasses of GeometryCollection may restrict membership based on
19
+ # dimension and may also place other constraints on the degree of spatial
20
+ # overlap between elements.
21
+ #
22
+ # == Notes
23
+ #
24
+ # GeometryCollection is defined as a module and is provided primarily
25
+ # for the sake of documentation. Implementations need not necessarily
26
+ # include this module itself. Therefore, you should not depend on the
27
+ # kind_of? method to check type. Instead, use the provided check_type
28
+ # class method (or === operator) defined in the Type module.
29
+
30
+ module GeometryCollection
31
+ include Geometry
32
+ extend Type
33
+
34
+ include ::Enumerable
35
+
36
+ # === SFS 1.1 Description
37
+ #
38
+ # Returns the number of geometries in this GeometryCollection.
39
+ #
40
+ # === Notes
41
+ #
42
+ # Returns an integer.
43
+
44
+ def num_geometries
45
+ raise Error::UnsupportedOperation, "Method GeometryCollection#num_geometries not defined."
46
+ end
47
+
48
+ # === SFS 1.1 Description
49
+ #
50
+ # Returns the Nth geometry in this GeometryCollection.
51
+ #
52
+ # === Notes
53
+ #
54
+ # Returns an object that supports the Geometry interface, or nil
55
+ # if the given N is out of range. N is zero-based.
56
+ # Also note that this method is different from GeometryCollection#[]
57
+ # in that it does not support negative indexes.
58
+
59
+ def geometry_n(_n_)
60
+ raise Error::UnsupportedOperation, "Method GeometryCollection#geometry_n not defined."
61
+ end
62
+
63
+ # Alias of the num_geometries method.
64
+
65
+ def size
66
+ num_geometries
67
+ end
68
+
69
+ # Returns the Nth geometry in this GeometryCollection, or nil if the
70
+ # given N is out of range. N is zero-based.
71
+ #
72
+ # This behaves slightly different from GeometryCollection#geometry_n.
73
+ # GeometryCollection#geometry_n accepts only nonnegative indexes,
74
+ # as specified by the SFS. However, GeometryCollection#[] also accepts
75
+ # negative indexes counting backwards from the end of the collection,
76
+ # the same way Ruby's array indexing works. Hence, geometry_n(-1)
77
+ # returns nil, where [-1] returns the last element of the collection.
78
+
79
+ def [](_n_)
80
+ raise Error::UnsupportedOperation, "Method GeometryCollection#[] not defined."
81
+ end
82
+
83
+ # Iterates over the geometries of this GeometryCollection.
84
+ #
85
+ # This is not a standard SFS method, but is provided so that a
86
+ # GeometryCollection can behave as a Ruby enumerable.
87
+ # Note that all GeometryCollection implementations must also
88
+ # include the Enumerable mixin.
89
+
90
+ def each(&_block_)
91
+ raise Error::UnsupportedOperation, "Method GeometryCollection#each not defined."
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,26 @@
1
+ # -----------------------------------------------------------------------------
2
+ #
3
+ # Line feature interface
4
+ #
5
+ # -----------------------------------------------------------------------------
6
+
7
+ module RGeo
8
+ module Feature
9
+ # == SFS 1.1 Description
10
+ #
11
+ # A Line is a LineString with exactly 2 Points.
12
+ #
13
+ # == Notes
14
+ #
15
+ # Line is defined as a module and is provided primarily
16
+ # for the sake of documentation. Implementations need not necessarily
17
+ # include this module itself. Therefore, you should not depend on the
18
+ # kind_of? method to check type. Instead, use the provided check_type
19
+ # class method (or === operator) defined in the Type module.
20
+
21
+ module Line
22
+ include LineString
23
+ extend Type
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,60 @@
1
+ # -----------------------------------------------------------------------------
2
+ #
3
+ # LineString feature interface
4
+ #
5
+ # -----------------------------------------------------------------------------
6
+
7
+ module RGeo
8
+ module Feature
9
+ # == SFS 1.1 Description
10
+ #
11
+ # A LineString is a Curve with linear interpolation between Points.
12
+ # Each consecutive pair of Points defines a Line segment.
13
+ #
14
+ # == Notes
15
+ #
16
+ # LineString is defined as a module and is provided primarily
17
+ # for the sake of documentation. Implementations need not necessarily
18
+ # include this module itself. Therefore, you should not depend on the
19
+ # kind_of? method to check type. Instead, use the provided check_type
20
+ # class method (or === operator) defined in the Type module.
21
+
22
+ module LineString
23
+ include Curve
24
+ extend Type
25
+
26
+ # === SFS 1.1 Description
27
+ #
28
+ # The number of Points in this LineString.
29
+ #
30
+ # === Notes
31
+ #
32
+ # Returns an integer.
33
+
34
+ def num_points
35
+ raise Error::UnsupportedOperation, "Method LineString#num_points not defined."
36
+ end
37
+
38
+ # === SFS 1.1 Description
39
+ #
40
+ # Returns the specified Point N in this LineString.
41
+ #
42
+ # === Notes
43
+ #
44
+ # Returns an object that supports the Point interface, or nil
45
+ # if the given N is out of range. N is zero-based.
46
+ # Does not support negative indexes.
47
+
48
+ def point_n(_n_)
49
+ raise Error::UnsupportedOperation, "Method LineString#point_n not defined."
50
+ end
51
+
52
+ # Returns the constituent points as an array of objects that
53
+ # support the Point interface.
54
+
55
+ def points
56
+ raise Error::UnsupportedOperation, "Method LineString#points not defined."
57
+ end
58
+ end
59
+ end
60
+ end
@@ -0,0 +1,26 @@
1
+ # -----------------------------------------------------------------------------
2
+ #
3
+ # LinearRing feature interface
4
+ #
5
+ # -----------------------------------------------------------------------------
6
+
7
+ module RGeo
8
+ module Feature
9
+ # == SFS 1.1 Description
10
+ #
11
+ # A LinearRing is a LineString that is both closed and simple.
12
+ #
13
+ # == Notes
14
+ #
15
+ # LinearRing is defined as a module and is provided primarily
16
+ # for the sake of documentation. Implementations need not necessarily
17
+ # include this module itself. Therefore, you should not depend on the
18
+ # kind_of? method to check type. Instead, use the provided check_type
19
+ # class method (or === operator) defined in the Type module.
20
+
21
+ module LinearRing
22
+ include LineString
23
+ extend Type
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,143 @@
1
+ # -----------------------------------------------------------------------------
2
+ #
3
+ # Mixin tracker
4
+ #
5
+ # -----------------------------------------------------------------------------
6
+
7
+ module RGeo
8
+ module Feature
9
+ # MixinCollection is a mechanism for adding arbitrary methods to
10
+ # geometry objects.
11
+ #
12
+ # Normally, geometry objects respond to the methods defined in the
13
+ # feature interface for that type of geometry; e.g.
14
+ # RGeo::Feature::Geometry, RGeo::Feature::Point, etc. Some
15
+ # implementations include additional methods specific to the
16
+ # implementation. However, occasionally it is desirable also to
17
+ # include custom methods allowing objects to function in different
18
+ # contexts. To do so, provide those methods in a mixin Module, and
19
+ # add it to an appropriate MixinCollection. A MixinCollection is
20
+ # simply a collection of mixin Modules, connected to geometry types,
21
+ # that are included in objects of that type.
22
+ #
23
+ # There is a global collection, MixinCollection::GLOBAL, which
24
+ # manages mixins to be added to all implementations. In addition,
25
+ # individual implementation factories may provide additional local
26
+ # MixinCollection objects for mixins specific to objects created
27
+ # by that factory.
28
+ #
29
+ # Each mixin module added to a MixinCollection is connected to a
30
+ # specific type, which controls to which objects that mixin is added.
31
+ # For example, a mixin connected to Point is added only to Point
32
+ # objects. A mixin connected to GeometryCollection is added to
33
+ # GeometryCollection objects as well as MultiPoint, MultiLineString,
34
+ # and MultiPolygon, since those are subtypes of GeometryCollection.
35
+ # To add a mixin to all objects, connect it to the Geometry base type.
36
+
37
+ class MixinCollection
38
+ # An API point controlling a particular type.
39
+
40
+ class TypeData
41
+ def initialize(collection_, type_) # :nodoc:
42
+ @collection = collection_
43
+ @type = type_
44
+ @mixins = []
45
+ @classes = []
46
+ @rmixins = []
47
+ @rclasses = []
48
+ end
49
+
50
+ # The feature type
51
+ attr_reader :type
52
+
53
+ # The MixinCollection owning this data
54
+ attr_reader :collection
55
+
56
+ # Add a mixin to be included in implementations of this type.
57
+
58
+ def add(module_)
59
+ @mixins << module_
60
+ @classes.each { |k_| k_.class_eval { include(module_) } }
61
+ _radd(module_)
62
+ end
63
+
64
+ # A class that implements this type should call this method to
65
+ # get the appropriate mixins.
66
+ # If include_ancestry_ is set to true, then mixins connected to
67
+ # subtypes of this type are also added to the class.
68
+
69
+ def include_in_class(klass_, include_ancestry_ = false)
70
+ (include_ancestry_ ? @rmixins : @mixins).each { |m_| klass_.class_eval { include(m_) } }
71
+ (include_ancestry_ ? @rclasses : @classes) << klass_
72
+ self
73
+ end
74
+
75
+ # An object that implements this type should call this method to
76
+ # get the appropriate mixins.
77
+ # If include_ancestry_ is set to true, then mixins connected to
78
+ # subtypes of this type are also added to the object.
79
+
80
+ def include_in_object(obj_, include_ancestry_ = false)
81
+ (include_ancestry_ ? @rmixins : @mixins).each { |m_| obj_.extend(m_) }
82
+ self
83
+ end
84
+
85
+ def _radd(module_) # :nodoc:
86
+ @rmixins << module_
87
+ @rclasses.each { |k_| k_.class_eval { include(module_) } }
88
+ @type.each_immediate_subtype { |t_| @collection.for_type(t_)._radd(module_) }
89
+ self
90
+ end
91
+ end
92
+
93
+ # Create a new empty MixinCollection
94
+
95
+ def initialize
96
+ @types = {}
97
+ end
98
+
99
+ # Returns a TypeData for the given type.
100
+ #
101
+ # e.g. to add a module for point types, you can call:
102
+ # for_type(::RGeo::Feature::Point).add(module)
103
+
104
+ def for_type(type_)
105
+ (@types[type_] ||= TypeData.new(self, type_))
106
+ end
107
+
108
+ # Add a module connected to the given type.
109
+ #
110
+ # Shorthand for:
111
+ # for_type(type_).add(module_)
112
+
113
+ def add(type_, module_)
114
+ for_type(type_).add(module_)
115
+ end
116
+
117
+ # A class that implements this type should call this method to
118
+ # get the appropriate mixins.
119
+ #
120
+ # Shorthand for:
121
+ # for_type(type_).include_in_class(klass_, include_ancestry_)
122
+
123
+ def include_in_class(type_, klass_, include_ancestry_ = false)
124
+ for_type(type_).include_in_class(klass_, include_ancestry_)
125
+ end
126
+
127
+ # An object that implements this type should call this method to
128
+ # get the appropriate mixins.
129
+ #
130
+ # Shorthand for:
131
+ # for_type(type_).include_in_object(obj_, include_ancestry_)
132
+
133
+ def include_in_object(type_, obj_, include_ancestry_ = false)
134
+ for_type(type_).include_in_object(obj_, include_ancestry_)
135
+ end
136
+
137
+ # The global MixinCollection. Mixins added to this collection are
138
+ # added to all geometry objects for all implementations.
139
+
140
+ GLOBAL = MixinCollection.new
141
+ end
142
+ end
143
+ end
@@ -0,0 +1,71 @@
1
+ # -----------------------------------------------------------------------------
2
+ #
3
+ # MultiCurve feature interface
4
+ #
5
+ # -----------------------------------------------------------------------------
6
+
7
+ module RGeo
8
+ module Feature
9
+ # == SFS 1.1 Description
10
+ #
11
+ # A MultiCurve is a 1-dimensional GeometryCollection whose elements are
12
+ # Curves.
13
+ #
14
+ # MultiCurve is a non-instantiable class in this specification; it
15
+ # defines a set of methods for its subclasses and is included for
16
+ # reasons of extensibility.
17
+ #
18
+ # A MultiCurve is simple if and only if all of its elements are simple
19
+ # and the only intersections between any two elements occur at Points
20
+ # that are on the boundaries of both elements.
21
+ #
22
+ # The boundary of a MultiCurve is obtained by applying the "mod 2"
23
+ # union rule: A Point is in the boundary of a MultiCurve if it is in
24
+ # the boundaries of an odd number of elements of the MultiCurve.
25
+ #
26
+ # A MultiCurve is closed if all of its elements are closed. The
27
+ # boundary of a closed MultiCurve is always empty.
28
+ #
29
+ # A MultiCurve is defined as topologically closed.
30
+ #
31
+ # == Notes
32
+ #
33
+ # MultiCurve is defined as a module and is provided primarily
34
+ # for the sake of documentation. Implementations need not necessarily
35
+ # include this module itself. Therefore, you should not depend on the
36
+ # kind_of? method to check type. Instead, use the provided check_type
37
+ # class method (or === operator) defined in the Type module.
38
+
39
+ module MultiCurve
40
+ include GeometryCollection
41
+ extend Type
42
+
43
+ # === SFS 1.1 Description
44
+ #
45
+ # The Length of this MultiCurve which is equal to the sum of the
46
+ # lengths of the element Curves.
47
+ #
48
+ # === Notes
49
+ #
50
+ # Returns a floating-point scalar value.
51
+
52
+ def length
53
+ raise Error::UnsupportedOperation, "Method MultiCurve#length not defined."
54
+ end
55
+
56
+ # === SFS 1.1 Description
57
+ #
58
+ # Returns true if this MultiCurve is closed [StartPoint() = EndPoint()
59
+ # for each Curve in this MultiCurve].
60
+ #
61
+ # === Notes
62
+ #
63
+ # Returns a boolean value. Note that this is different from the SFS
64
+ # specification, which stipulates an integer return value.
65
+
66
+ def is_closed?
67
+ raise Error::UnsupportedOperation, "Method MultiCurve#is_closed? not defined."
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,26 @@
1
+ # -----------------------------------------------------------------------------
2
+ #
3
+ # MultiLineString feature interface
4
+ #
5
+ # -----------------------------------------------------------------------------
6
+
7
+ module RGeo
8
+ module Feature
9
+ # == SFS 1.1 Description
10
+ #
11
+ # A MultiLineString is a MultiCurve whose elements are LineStrings.
12
+ #
13
+ # == Notes
14
+ #
15
+ # MultiLineString is defined as a module and is provided primarily
16
+ # for the sake of documentation. Implementations need not necessarily
17
+ # include this module itself. Therefore, you should not depend on the
18
+ # kind_of? method to check type. Instead, use the provided check_type
19
+ # class method (or === operator) defined in the Type module.
20
+
21
+ module MultiLineString
22
+ include MultiCurve
23
+ extend Type
24
+ end
25
+ end
26
+ end