rgeo 0.1.10
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.
- 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,76 @@
|
|
1
|
+
/*
|
2
|
+
-----------------------------------------------------------------------------
|
3
|
+
|
4
|
+
Polygon methods for GEOS wrapper
|
5
|
+
|
6
|
+
-----------------------------------------------------------------------------
|
7
|
+
Copyright 2010 Daniel Azuma
|
8
|
+
|
9
|
+
All rights reserved.
|
10
|
+
|
11
|
+
Redistribution and use in source and binary forms, with or without
|
12
|
+
modification, are permitted provided that the following conditions are met:
|
13
|
+
|
14
|
+
* Redistributions of source code must retain the above copyright notice,
|
15
|
+
this list of conditions and the following disclaimer.
|
16
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
17
|
+
this list of conditions and the following disclaimer in the documentation
|
18
|
+
and/or other materials provided with the distribution.
|
19
|
+
* Neither the name of the copyright holder, nor the names of any other
|
20
|
+
contributors to this software, may be used to endorse or promote products
|
21
|
+
derived from this software without specific prior written permission.
|
22
|
+
|
23
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
24
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
25
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
26
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
27
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
28
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
29
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
30
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
31
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
32
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
33
|
+
POSSIBILITY OF SUCH DAMAGE.
|
34
|
+
-----------------------------------------------------------------------------
|
35
|
+
*/
|
36
|
+
|
37
|
+
|
38
|
+
#ifndef RGEO_GEOS_POLYGON_INCLUDED
|
39
|
+
#define RGEO_GEOS_POLYGON_INCLUDED
|
40
|
+
|
41
|
+
#include <ruby.h>
|
42
|
+
#include <geos_c.h>
|
43
|
+
|
44
|
+
#include "factory.h"
|
45
|
+
|
46
|
+
#ifdef __cplusplus
|
47
|
+
extern "C" {
|
48
|
+
#if 0
|
49
|
+
}
|
50
|
+
#endif
|
51
|
+
#endif
|
52
|
+
|
53
|
+
|
54
|
+
/*
|
55
|
+
Initializes the polygon module. This should be called after
|
56
|
+
the geometry module is initialized.
|
57
|
+
*/
|
58
|
+
void rgeo_init_geos_polygon(RGeo_Globals* globals);
|
59
|
+
|
60
|
+
/*
|
61
|
+
Comopares the values of two GEOS polygons. The two given geometries MUST
|
62
|
+
be polygon types.
|
63
|
+
Returns Qtrue if the polygons are equal, Qfalse if they are inequal, or
|
64
|
+
Qnil if an error occurs.
|
65
|
+
*/
|
66
|
+
VALUE rgeo_geos_polygons_eql(GEOSContextHandle_t context, const GEOSGeometry* geom1, const GEOSGeometry* geom2);
|
67
|
+
|
68
|
+
|
69
|
+
#ifdef __cplusplus
|
70
|
+
#if 0
|
71
|
+
{
|
72
|
+
#endif
|
73
|
+
}
|
74
|
+
#endif
|
75
|
+
|
76
|
+
#endif
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/*
|
2
|
+
-----------------------------------------------------------------------------
|
3
|
+
|
4
|
+
Preface header for GEOS wrapper
|
5
|
+
|
6
|
+
-----------------------------------------------------------------------------
|
7
|
+
Copyright 2010 Daniel Azuma
|
8
|
+
|
9
|
+
All rights reserved.
|
10
|
+
|
11
|
+
Redistribution and use in source and binary forms, with or without
|
12
|
+
modification, are permitted provided that the following conditions are met:
|
13
|
+
|
14
|
+
* Redistributions of source code must retain the above copyright notice,
|
15
|
+
this list of conditions and the following disclaimer.
|
16
|
+
* Redistributions in binary form must reproduce the above copyright notice,
|
17
|
+
this list of conditions and the following disclaimer in the documentation
|
18
|
+
and/or other materials provided with the distribution.
|
19
|
+
* Neither the name of the copyright holder, nor the names of any other
|
20
|
+
contributors to this software, may be used to endorse or promote products
|
21
|
+
derived from this software without specific prior written permission.
|
22
|
+
|
23
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
24
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
25
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
26
|
+
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
27
|
+
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
28
|
+
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
29
|
+
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
30
|
+
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
31
|
+
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
32
|
+
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
33
|
+
POSSIBILITY OF SUCH DAMAGE.
|
34
|
+
-----------------------------------------------------------------------------
|
35
|
+
*/
|
36
|
+
|
37
|
+
|
38
|
+
#ifdef HAVE_GEOS_C_H
|
39
|
+
#ifdef HAVE_INITGEOS_R
|
40
|
+
#define RGEO_GEOS_SUPPORTED
|
41
|
+
#endif
|
42
|
+
#endif
|
data/lib/rgeo.rb
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# -----------------------------------------------------------------------------
|
2
|
+
#
|
3
|
+
# RGeo Rakefile
|
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
|
+
# The source files that should be required by default.
|
38
|
+
paths_ = [
|
39
|
+
'version',
|
40
|
+
'errors',
|
41
|
+
'features',
|
42
|
+
'geos',
|
43
|
+
'geography',
|
44
|
+
'geo_json',
|
45
|
+
]
|
46
|
+
paths_.each{ |path_| require "rgeo/#{path_}" }
|
47
|
+
|
48
|
+
|
49
|
+
# RGeo is a spatial data library for Ruby.
|
50
|
+
#
|
51
|
+
# The RGeo::Features module contains interface specifications for spatial
|
52
|
+
# objects implemented by RGeo. These interfaces closely follow the OGC
|
53
|
+
# Simple Features Specifiation.
|
54
|
+
#
|
55
|
+
# The RGeo::Geos module contains a spatial implementation that wraps
|
56
|
+
# the GEOS library. This is a full implementation that operates on
|
57
|
+
# cartesian coordinates.
|
58
|
+
#
|
59
|
+
# The RGeo::Geography module contains spatial implementations that
|
60
|
+
# operate in latitude-longitude coordinates. Several different
|
61
|
+
# implementations are provided, including one designed for map
|
62
|
+
# visualization applications that use Google or Bing maps.
|
63
|
+
#
|
64
|
+
# The RGeo::GeoJSON module contains tools for GeoJSON serialization of
|
65
|
+
# spatial objects.
|
66
|
+
|
67
|
+
module RGeo
|
68
|
+
end
|
data/lib/rgeo/errors.rb
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# -----------------------------------------------------------------------------
|
2
|
+
#
|
3
|
+
# Error classes for RGeo
|
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
|
+
|
40
|
+
# All RGeo errors are members of this namespace.
|
41
|
+
|
42
|
+
module Errors
|
43
|
+
|
44
|
+
# Base class for all RGeo-related exceptions
|
45
|
+
class RGeoError < ::RuntimeError
|
46
|
+
end
|
47
|
+
|
48
|
+
# The method is unimplemented
|
49
|
+
class MethodUnimplemented < RGeoError
|
50
|
+
end
|
51
|
+
|
52
|
+
# The specified geometry is invalid
|
53
|
+
class InvalidGeometry < RGeoError
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
|
58
|
+
|
59
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# -----------------------------------------------------------------------------
|
2
|
+
#
|
3
|
+
# Features namespace for RGeo
|
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
|
+
|
40
|
+
# The Features namespace contains interfaces and general tools for
|
41
|
+
# implementations of the Open Geospatial Consortium Simple Features
|
42
|
+
# Specification (SFS), version 1.1.0.
|
43
|
+
#
|
44
|
+
# Each interface is defined as a module, and is provided primarily for
|
45
|
+
# the sake of documentation. Implementations do not necessarily include
|
46
|
+
# the modules themselves. Therefore, you should not depend on the
|
47
|
+
# kind_of? method to check type. Instead, each interface module will
|
48
|
+
# provide a check_type class method (and a corresponding === operator
|
49
|
+
# to support case-when constructs).
|
50
|
+
#
|
51
|
+
# In addition, a Factory interface is defined here. A factory is an
|
52
|
+
# object that knows how to construct geometry instances for a given
|
53
|
+
# implementation. Each implementation's front-end consists of a way to
|
54
|
+
# create factories. Those factories, in turn, provide the api for
|
55
|
+
# building the features themselves. Note that, like the geometry
|
56
|
+
# modules, the Factory module itself may not actually be included in a
|
57
|
+
# factory implementation.
|
58
|
+
#
|
59
|
+
# Any particular implementation may extend these interfaces to provide
|
60
|
+
# implementation-specific features beyond what is stated in the SFS
|
61
|
+
# itself. The implementation should separately document any such
|
62
|
+
# extensions that it may provide.
|
63
|
+
|
64
|
+
module Features
|
65
|
+
end
|
66
|
+
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
|
71
|
+
# Dependency source files.
|
72
|
+
paths_ = [
|
73
|
+
'features/factory',
|
74
|
+
'features/geometry',
|
75
|
+
'features/point',
|
76
|
+
'features/curve',
|
77
|
+
'features/line_string',
|
78
|
+
'features/linear_ring',
|
79
|
+
'features/line',
|
80
|
+
'features/surface',
|
81
|
+
'features/polygon',
|
82
|
+
'features/geometry_collection',
|
83
|
+
'features/multi_point',
|
84
|
+
'features/multi_curve',
|
85
|
+
'features/multi_line_string',
|
86
|
+
'features/multi_surface',
|
87
|
+
'features/multi_polygon',
|
88
|
+
]
|
89
|
+
paths_.each{ |path_| require "rgeo/#{path_}" }
|
@@ -0,0 +1,155 @@
|
|
1
|
+
# -----------------------------------------------------------------------------
|
2
|
+
#
|
3
|
+
# Curve 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
|
+
# A Curve is a 1-dimensional geometric object usually stored as a
|
45
|
+
# sequence of Points, with the subtype of Curve specifying the form of
|
46
|
+
# the interpolation between Points. This part of ISO 19125 defines only
|
47
|
+
# one subclass of Curve, LineString, which uses linear interpolation
|
48
|
+
# between Points.
|
49
|
+
#
|
50
|
+
# A Curve is a 1-dimensional geometric object that is the homeomorphic
|
51
|
+
# image of a real, closed interval D=[a,b] under a mapping f:[a,b]->R2.
|
52
|
+
#
|
53
|
+
# A Curve is simple if it does not pass through the same Point twice.
|
54
|
+
#
|
55
|
+
# A Curve is closed if its start Point is equal to its end Point.
|
56
|
+
#
|
57
|
+
# The boundary of a closed Curve is empty.
|
58
|
+
#
|
59
|
+
# A Curve that is simple and closed is a Ring.
|
60
|
+
#
|
61
|
+
# The boundary of a non-closed Curve consists of its two end Points.
|
62
|
+
#
|
63
|
+
# A Curve is defined as topologically closed.
|
64
|
+
#
|
65
|
+
# == Notes
|
66
|
+
#
|
67
|
+
# Curve is defined as a module and is provided primarily
|
68
|
+
# for the sake of documentation. Implementations need not necessarily
|
69
|
+
# include this module itself. Therefore, you should not depend on the
|
70
|
+
# kind_of? method to check type. Instead, use the provided check_type
|
71
|
+
# class method. A corresponding === operator is also provided to
|
72
|
+
# to support case-when constructs.
|
73
|
+
#
|
74
|
+
# Some implementations may support higher dimensional points.
|
75
|
+
|
76
|
+
module Curve
|
77
|
+
|
78
|
+
include Geometry
|
79
|
+
|
80
|
+
|
81
|
+
# === SFS 1.1 Description
|
82
|
+
#
|
83
|
+
# The length of this Curve in its associated spatial reference.
|
84
|
+
#
|
85
|
+
# === Notes
|
86
|
+
#
|
87
|
+
# Returns a floating-point scalar value.
|
88
|
+
|
89
|
+
def length
|
90
|
+
raise Errors::MethodUnimplemented
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
# === SFS 1.1 Description
|
95
|
+
#
|
96
|
+
# The start Point of this Curve.
|
97
|
+
#
|
98
|
+
# === Notes
|
99
|
+
#
|
100
|
+
# Returns an object that supports the Point interface.
|
101
|
+
|
102
|
+
def start_point
|
103
|
+
raise Errors::MethodUnimplemented
|
104
|
+
end
|
105
|
+
|
106
|
+
|
107
|
+
# === SFS 1.1 Description
|
108
|
+
#
|
109
|
+
# The end Point of this Curve.
|
110
|
+
#
|
111
|
+
# === Notes
|
112
|
+
#
|
113
|
+
# Returns an object that supports the Point interface.
|
114
|
+
|
115
|
+
def end_point
|
116
|
+
raise Errors::MethodUnimplemented
|
117
|
+
end
|
118
|
+
|
119
|
+
|
120
|
+
# === SFS 1.1 Description
|
121
|
+
#
|
122
|
+
# Returns true if this Curve is closed [StartPoint() = EndPoint()].
|
123
|
+
#
|
124
|
+
# === Notes
|
125
|
+
#
|
126
|
+
# Returns a boolean value. Note that this is different from the SFS
|
127
|
+
# specification, which stipulates an integer return value.
|
128
|
+
|
129
|
+
def is_closed?
|
130
|
+
raise Errors::MethodUnimplemented
|
131
|
+
end
|
132
|
+
|
133
|
+
|
134
|
+
# === SFS 1.1 Description
|
135
|
+
#
|
136
|
+
# Returns true if this Curve is closed [StartPoint() = EndPoint()]
|
137
|
+
# and this Curve is simple (does not pass through the same Point
|
138
|
+
# more than once).
|
139
|
+
#
|
140
|
+
# === Notes
|
141
|
+
#
|
142
|
+
# Returns a boolean value. Note that this is different from the SFS
|
143
|
+
# specification, which stipulates an integer return value.
|
144
|
+
|
145
|
+
def is_ring?
|
146
|
+
raise Errors::MethodUnimplemented
|
147
|
+
end
|
148
|
+
|
149
|
+
|
150
|
+
end
|
151
|
+
|
152
|
+
|
153
|
+
end
|
154
|
+
|
155
|
+
end
|