rgeo 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENSE.txt +29 -0
- data/ext/geos_c_impl/Makefile_2.2.3 +260 -0
- data/ext/geos_c_impl/coordinates.c +65 -0
- data/ext/geos_c_impl/coordinates.h +2 -0
- data/ext/geos_c_impl/extconf.rb +19 -43
- data/ext/geos_c_impl/geometry.c +24 -0
- data/ext/geos_c_impl/geometry_collection.c +99 -1
- data/ext/geos_c_impl/geos_c_impl_2.2.3.bundle +0 -0
- data/ext/geos_c_impl/line_string.c +38 -0
- data/ext/geos_c_impl/mkmf.log +123 -0
- data/ext/geos_c_impl/point.c +27 -0
- data/ext/geos_c_impl/polygon.c +26 -0
- data/ext/proj4_c_impl/Makefile_2.2.3 +260 -0
- data/ext/proj4_c_impl/extconf.rb +32 -32
- data/ext/proj4_c_impl/mkmf.log +47 -0
- data/ext/proj4_c_impl/proj4_c_impl_2.2.3.bundle +0 -0
- data/lib/rgeo.rb +10 -11
- data/lib/rgeo/cartesian.rb +7 -12
- data/lib/rgeo/cartesian/analysis.rb +13 -26
- data/lib/rgeo/cartesian/bounding_box.rb +45 -114
- data/lib/rgeo/cartesian/calculations.rb +3 -21
- data/lib/rgeo/cartesian/factory.rb +101 -122
- data/lib/rgeo/cartesian/feature_classes.rb +9 -59
- data/lib/rgeo/cartesian/feature_methods.rb +15 -45
- data/lib/rgeo/cartesian/interface.rb +6 -17
- data/lib/rgeo/coord_sys.rb +9 -15
- data/lib/rgeo/coord_sys/cs/entities.rb +84 -330
- data/lib/rgeo/coord_sys/cs/factories.rb +2 -32
- data/lib/rgeo/coord_sys/cs/wkt_parser.rb +52 -80
- data/lib/rgeo/coord_sys/proj4.rb +28 -67
- data/lib/rgeo/coord_sys/proj4_c_impl.bundle +0 -0
- data/lib/rgeo/coord_sys/srs_database/interface.rb +4 -24
- data/lib/rgeo/coord_sys/srs_database/proj4_data.rb +20 -38
- data/lib/rgeo/coord_sys/srs_database/sr_org.rb +6 -22
- data/lib/rgeo/coord_sys/srs_database/url_reader.rb +6 -21
- data/lib/rgeo/error.rb +0 -6
- data/lib/rgeo/feature.rb +18 -23
- data/lib/rgeo/feature/curve.rb +0 -14
- data/lib/rgeo/feature/factory.rb +13 -38
- data/lib/rgeo/feature/factory_generator.rb +4 -16
- data/lib/rgeo/feature/geometry.rb +18 -60
- data/lib/rgeo/feature/geometry_collection.rb +3 -17
- data/lib/rgeo/feature/line.rb +0 -10
- data/lib/rgeo/feature/line_string.rb +1 -13
- data/lib/rgeo/feature/linear_ring.rb +0 -9
- data/lib/rgeo/feature/mixins.rb +11 -36
- data/lib/rgeo/feature/multi_curve.rb +0 -11
- data/lib/rgeo/feature/multi_line_string.rb +0 -9
- data/lib/rgeo/feature/multi_point.rb +0 -9
- data/lib/rgeo/feature/multi_polygon.rb +0 -9
- data/lib/rgeo/feature/multi_surface.rb +0 -12
- data/lib/rgeo/feature/point.rb +0 -13
- data/lib/rgeo/feature/polygon.rb +1 -14
- data/lib/rgeo/feature/surface.rb +0 -12
- data/lib/rgeo/feature/types.rb +19 -61
- data/lib/rgeo/geographic.rb +10 -15
- data/lib/rgeo/geographic/factory.rb +126 -147
- data/lib/rgeo/geographic/interface.rb +67 -81
- data/lib/rgeo/geographic/proj4_projector.rb +13 -37
- data/lib/rgeo/geographic/projected_feature_classes.rb +7 -66
- data/lib/rgeo/geographic/projected_feature_methods.rb +15 -80
- data/lib/rgeo/geographic/projected_window.rb +15 -67
- data/lib/rgeo/geographic/simple_mercator_projector.rb +32 -56
- data/lib/rgeo/geographic/spherical_feature_classes.rb +9 -68
- data/lib/rgeo/geographic/spherical_feature_methods.rb +18 -51
- data/lib/rgeo/geographic/spherical_math.rb +26 -51
- data/lib/rgeo/geos.rb +23 -20
- data/lib/rgeo/geos/capi_factory.rb +125 -131
- data/lib/rgeo/geos/capi_feature_classes.rb +21 -88
- data/lib/rgeo/geos/ffi_factory.rb +90 -143
- data/lib/rgeo/geos/ffi_feature_classes.rb +8 -63
- data/lib/rgeo/geos/ffi_feature_methods.rb +46 -162
- data/lib/rgeo/geos/geos_c_impl.bundle +0 -0
- data/lib/rgeo/geos/interface.rb +4 -23
- data/lib/rgeo/geos/utils.rb +4 -19
- data/lib/rgeo/geos/zm_factory.rb +82 -131
- data/lib/rgeo/geos/zm_feature_classes.rb +8 -63
- data/lib/rgeo/geos/zm_feature_methods.rb +34 -107
- data/lib/rgeo/impl_helper.rb +8 -13
- data/lib/rgeo/impl_helper/basic_geometry_collection_methods.rb +27 -71
- data/lib/rgeo/impl_helper/basic_geometry_methods.rb +10 -28
- data/lib/rgeo/impl_helper/basic_line_string_methods.rb +21 -57
- data/lib/rgeo/impl_helper/basic_point_methods.rb +12 -30
- data/lib/rgeo/impl_helper/basic_polygon_methods.rb +9 -28
- data/lib/rgeo/impl_helper/math.rb +4 -10
- data/lib/rgeo/impl_helper/utils.rb +2 -10
- data/lib/rgeo/version.rb +1 -1
- data/lib/rgeo/wkrep.rb +4 -9
- data/lib/rgeo/wkrep/wkb_generator.rb +22 -46
- data/lib/rgeo/wkrep/wkb_parser.rb +25 -52
- data/lib/rgeo/wkrep/wkt_generator.rb +39 -69
- data/lib/rgeo/wkrep/wkt_parser.rb +52 -89
- data/lib/rgeo/yaml.rb +1 -7
- data/test/common/factory_tests.rb +4 -19
- data/test/common/geometry_collection_tests.rb +6 -39
- data/test/common/line_string_tests.rb +10 -39
- data/test/common/multi_line_string_tests.rb +10 -30
- data/test/common/multi_point_tests.rb +15 -34
- data/test/common/multi_polygon_tests.rb +26 -28
- data/test/common/point_tests.rb +37 -59
- data/test/common/polygon_tests.rb +16 -25
- data/test/coord_sys/tc_ogc_cs.rb +151 -186
- data/test/coord_sys/tc_proj4.rb +35 -60
- data/test/coord_sys/tc_proj4_srs_data.rb +15 -24
- data/test/coord_sys/tc_sr_org.rb +11 -19
- data/test/coord_sys/tc_url_reader.rb +13 -23
- data/test/geos_capi/tc_factory.rb +7 -16
- data/test/geos_capi/tc_geometry_collection.rb +6 -14
- data/test/geos_capi/tc_line_string.rb +7 -15
- data/test/geos_capi/tc_misc.rb +26 -41
- data/test/geos_capi/tc_multi_line_string.rb +6 -14
- data/test/geos_capi/tc_multi_point.rb +7 -15
- data/test/geos_capi/tc_multi_polygon.rb +8 -18
- data/test/geos_capi/tc_parsing_unparsing.rb +11 -21
- data/test/geos_capi/tc_point.rb +12 -26
- data/test/geos_capi/tc_polygon.rb +52 -17
- data/test/geos_capi/tc_zmfactory.rb +7 -18
- data/test/geos_ffi/tc_factory.rb +7 -16
- data/test/geos_ffi/tc_geometry_collection.rb +7 -15
- data/test/geos_ffi/tc_line_string.rb +7 -15
- data/test/geos_ffi/tc_misc.rb +8 -18
- data/test/geos_ffi/tc_multi_line_string.rb +7 -15
- data/test/geos_ffi/tc_multi_point.rb +8 -16
- data/test/geos_ffi/tc_multi_polygon.rb +9 -18
- data/test/geos_ffi/tc_parsing_unparsing.rb +14 -24
- data/test/geos_ffi/tc_point.rb +13 -28
- data/test/geos_ffi/tc_polygon.rb +7 -17
- data/test/geos_ffi/tc_zmfactory.rb +8 -19
- data/test/projected_geographic/tc_factory.rb +7 -15
- data/test/projected_geographic/tc_geometry_collection.rb +7 -15
- data/test/projected_geographic/tc_line_string.rb +7 -15
- data/test/projected_geographic/tc_multi_line_string.rb +7 -16
- data/test/projected_geographic/tc_multi_point.rb +8 -17
- data/test/projected_geographic/tc_multi_polygon.rb +8 -16
- data/test/projected_geographic/tc_point.rb +11 -23
- data/test/projected_geographic/tc_polygon.rb +7 -15
- data/test/simple_cartesian/tc_calculations.rb +6 -22
- data/test/simple_cartesian/tc_factory.rb +7 -16
- data/test/simple_cartesian/tc_geometry_collection.rb +6 -15
- data/test/simple_cartesian/tc_line_string.rb +6 -15
- data/test/simple_cartesian/tc_multi_line_string.rb +6 -15
- data/test/simple_cartesian/tc_multi_point.rb +7 -16
- data/test/simple_cartesian/tc_multi_polygon.rb +7 -16
- data/test/simple_cartesian/tc_point.rb +10 -21
- data/test/simple_cartesian/tc_polygon.rb +6 -15
- data/test/simple_mercator/tc_factory.rb +6 -14
- data/test/simple_mercator/tc_geometry_collection.rb +6 -14
- data/test/simple_mercator/tc_line_string.rb +6 -14
- data/test/simple_mercator/tc_multi_line_string.rb +6 -15
- data/test/simple_mercator/tc_multi_point.rb +7 -16
- data/test/simple_mercator/tc_multi_polygon.rb +7 -15
- data/test/simple_mercator/tc_point.rb +11 -24
- data/test/simple_mercator/tc_polygon.rb +6 -14
- data/test/simple_mercator/tc_window.rb +10 -34
- data/test/spherical_geographic/tc_calculations.rb +5 -32
- data/test/spherical_geographic/tc_factory.rb +6 -15
- data/test/spherical_geographic/tc_geometry_collection.rb +6 -15
- data/test/spherical_geographic/tc_line_string.rb +6 -15
- data/test/spherical_geographic/tc_multi_line_string.rb +6 -15
- data/test/spherical_geographic/tc_multi_point.rb +7 -16
- data/test/spherical_geographic/tc_multi_polygon.rb +7 -16
- data/test/spherical_geographic/tc_point.rb +10 -22
- data/test/spherical_geographic/tc_polygon.rb +6 -15
- data/test/tc_cartesian_analysis.rb +4 -16
- data/test/tc_cartesian_bbox.rb +7 -21
- data/test/tc_mixins.rb +8 -25
- data/test/tc_oneoff.rb +5 -13
- data/test/tc_types.rb +7 -16
- data/test/wkrep/tc_wkb_generator.rb +63 -97
- data/test/wkrep/tc_wkb_parser.rb +63 -100
- data/test/wkrep/tc_wkt_generator.rb +54 -92
- data/test/wkrep/tc_wkt_parser.rb +84 -133
- metadata +39 -9
- data/lib/rgeo/coord_sys/srs_database/active_record_table.rb +0 -166
- data/test/coord_sys/tc_active_record_table.rb +0 -79
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f107cb048f69993a4599f85f76470ea2d5492eeb
|
4
|
+
data.tar.gz: 89b9e3483a7a556030ab8977b3c243d89048cb63
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a860309dc4140e31a78d6cf4b138a0fc2cdcf7f267c05875bf651aab03a5a17a400622c1d935ecfca8d3af00ed5d14bae02e46f48f039ed33bc6175fb0592a72
|
7
|
+
data.tar.gz: 28a5fc931b6b50b34409e07dc8bfdcd53b2b5064c3a28d4cee39d5ff9ddd165c75e55983bc98f9de668c76e31e56388030d7399969b5e4d9fe5a47acf54ba365
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# -----------------------------------------------------------------------------
|
2
|
+
# Copyright 2012 Daniel Azuma
|
3
|
+
#
|
4
|
+
# All rights reserved.
|
5
|
+
#
|
6
|
+
# Redistribution and use in source and binary forms, with or without
|
7
|
+
# modification, are permitted provided that the following conditions are met:
|
8
|
+
#
|
9
|
+
# * Redistributions of source code must retain the above copyright notice,
|
10
|
+
# this list of conditions and the following disclaimer.
|
11
|
+
# * Redistributions in binary form must reproduce the above copyright notice,
|
12
|
+
# this list of conditions and the following disclaimer in the documentation
|
13
|
+
# and/or other materials provided with the distribution.
|
14
|
+
# * Neither the name of the copyright holder, nor the names of any other
|
15
|
+
# contributors to this software, may be used to endorse or promote products
|
16
|
+
# derived from this software without specific prior written permission.
|
17
|
+
#
|
18
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
19
|
+
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
20
|
+
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
21
|
+
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
22
|
+
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
23
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
24
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
25
|
+
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
26
|
+
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
27
|
+
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
28
|
+
# POSSIBILITY OF SUCH DAMAGE.
|
29
|
+
# -----------------------------------------------------------------------------
|
@@ -0,0 +1,260 @@
|
|
1
|
+
|
2
|
+
SHELL = /bin/sh
|
3
|
+
|
4
|
+
# V=0 quiet, V=1 verbose. other values don't work.
|
5
|
+
V = 0
|
6
|
+
Q1 = $(V:1=)
|
7
|
+
Q = $(Q1:0=@)
|
8
|
+
ECHO1 = $(V:1=@:)
|
9
|
+
ECHO = $(ECHO1:0=@echo)
|
10
|
+
NULLCMD = :
|
11
|
+
|
12
|
+
#### Start of system configuration section. ####
|
13
|
+
|
14
|
+
srcdir = .
|
15
|
+
topdir = /Users/tee/.rubies/ruby-2.2.3/include/ruby-2.2.0
|
16
|
+
hdrdir = $(topdir)
|
17
|
+
arch_hdrdir = /Users/tee/.rubies/ruby-2.2.3/include/ruby-2.2.0/x86_64-darwin14
|
18
|
+
PATH_SEPARATOR = :
|
19
|
+
VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
|
20
|
+
prefix = $(DESTDIR)/Users/tee/.rubies/ruby-2.2.3
|
21
|
+
rubysitearchprefix = $(rubylibprefix)/$(sitearch)
|
22
|
+
rubyarchprefix = $(rubylibprefix)/$(arch)
|
23
|
+
rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
|
24
|
+
exec_prefix = $(prefix)
|
25
|
+
vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
|
26
|
+
sitearchhdrdir = $(sitehdrdir)/$(sitearch)
|
27
|
+
rubyarchhdrdir = $(rubyhdrdir)/$(arch)
|
28
|
+
vendorhdrdir = $(rubyhdrdir)/vendor_ruby
|
29
|
+
sitehdrdir = $(rubyhdrdir)/site_ruby
|
30
|
+
rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
|
31
|
+
vendorarchdir = $(vendorlibdir)/$(sitearch)
|
32
|
+
vendorlibdir = $(vendordir)/$(ruby_version)
|
33
|
+
vendordir = $(rubylibprefix)/vendor_ruby
|
34
|
+
sitearchdir = $(sitelibdir)/$(sitearch)
|
35
|
+
sitelibdir = $(sitedir)/$(ruby_version)
|
36
|
+
sitedir = $(rubylibprefix)/site_ruby
|
37
|
+
rubyarchdir = $(rubylibdir)/$(arch)
|
38
|
+
rubylibdir = $(rubylibprefix)/$(ruby_version)
|
39
|
+
sitearchincludedir = $(includedir)/$(sitearch)
|
40
|
+
archincludedir = $(includedir)/$(arch)
|
41
|
+
sitearchlibdir = $(libdir)/$(sitearch)
|
42
|
+
archlibdir = $(libdir)/$(arch)
|
43
|
+
ridir = $(datarootdir)/$(RI_BASE_NAME)
|
44
|
+
mandir = $(datarootdir)/man
|
45
|
+
localedir = $(datarootdir)/locale
|
46
|
+
libdir = $(exec_prefix)/lib
|
47
|
+
psdir = $(docdir)
|
48
|
+
pdfdir = $(docdir)
|
49
|
+
dvidir = $(docdir)
|
50
|
+
htmldir = $(docdir)
|
51
|
+
infodir = $(datarootdir)/info
|
52
|
+
docdir = $(datarootdir)/doc/$(PACKAGE)
|
53
|
+
oldincludedir = $(DESTDIR)/usr/include
|
54
|
+
includedir = $(prefix)/include
|
55
|
+
localstatedir = $(prefix)/var
|
56
|
+
sharedstatedir = $(prefix)/com
|
57
|
+
sysconfdir = $(prefix)/etc
|
58
|
+
datadir = $(datarootdir)
|
59
|
+
datarootdir = $(prefix)/share
|
60
|
+
libexecdir = $(exec_prefix)/libexec
|
61
|
+
sbindir = $(exec_prefix)/sbin
|
62
|
+
bindir = $(exec_prefix)/bin
|
63
|
+
archdir = $(rubyarchdir)
|
64
|
+
|
65
|
+
|
66
|
+
CC = clang
|
67
|
+
CXX = clang++
|
68
|
+
LIBRUBY = $(LIBRUBY_A)
|
69
|
+
LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
|
70
|
+
LIBRUBYARG_SHARED =
|
71
|
+
LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static -framework CoreFoundation
|
72
|
+
empty =
|
73
|
+
OUTFLAG = -o $(empty)
|
74
|
+
COUTFLAG = -o $(empty)
|
75
|
+
|
76
|
+
RUBY_EXTCONF_H =
|
77
|
+
cflags = $(optflags) $(debugflags) $(warnflags)
|
78
|
+
optflags = -O3 -fno-fast-math
|
79
|
+
debugflags = -ggdb3
|
80
|
+
warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wshorten-64-to-32 -Wimplicit-function-declaration -Wdivision-by-zero -Wdeprecated-declarations -Wextra-tokens
|
81
|
+
CCDLFLAGS = -fno-common
|
82
|
+
CFLAGS = $(CCDLFLAGS) -O3 -Wno-error=shorten-64-to-32 -pipe $(ARCH_FLAG)
|
83
|
+
INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir) -I/usr/local/Cellar/geos/3.5.0/include
|
84
|
+
DEFS =
|
85
|
+
CPPFLAGS = -DHAVE_GEOS_C_H -DHAVE_GEOSSETSRID_R -DHAVE_GEOSPREPAREDCONTAINS_R -DHAVE_GEOSPREPAREDDISJOINT_R -DHAVE_RB_MEMHASH -I/Users/tee/.rubies/ruby-2.2.3/include -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -D_DARWIN_UNLIMITED_SELECT -D_REENTRANT $(DEFS) $(cppflags)
|
86
|
+
CXXFLAGS = $(CCDLFLAGS) $(cxxflags) $(ARCH_FLAG)
|
87
|
+
ldflags = -L. -L/Users/tee/.rubies/ruby-2.2.3/lib -fstack-protector -L/usr/local/lib
|
88
|
+
dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress
|
89
|
+
ARCH_FLAG =
|
90
|
+
DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
|
91
|
+
LDSHARED = $(CC) -dynamic -bundle
|
92
|
+
LDSHAREDXX = $(CXX) -dynamic -bundle
|
93
|
+
AR = ar
|
94
|
+
EXEEXT =
|
95
|
+
|
96
|
+
RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
|
97
|
+
RUBY_SO_NAME = ruby
|
98
|
+
RUBYW_INSTALL_NAME =
|
99
|
+
RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
|
100
|
+
RUBYW_BASE_NAME = rubyw
|
101
|
+
RUBY_BASE_NAME = ruby
|
102
|
+
|
103
|
+
arch = x86_64-darwin14
|
104
|
+
sitearch = $(arch)
|
105
|
+
ruby_version = 2.2.0
|
106
|
+
ruby = $(bindir)/$(RUBY_BASE_NAME)
|
107
|
+
RUBY = $(ruby)
|
108
|
+
ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h
|
109
|
+
|
110
|
+
RM = rm -f
|
111
|
+
RM_RF = $(RUBY) -run -e rm -- -rf
|
112
|
+
RMDIRS = rmdir -p
|
113
|
+
MAKEDIRS = mkdir -p
|
114
|
+
INSTALL = /usr/bin/install -c
|
115
|
+
INSTALL_PROG = $(INSTALL) -m 0755
|
116
|
+
INSTALL_DATA = $(INSTALL) -m 644
|
117
|
+
COPY = cp
|
118
|
+
TOUCH = exit >
|
119
|
+
|
120
|
+
#### End of system configuration section. ####
|
121
|
+
|
122
|
+
preload =
|
123
|
+
|
124
|
+
libpath = . $(libdir)
|
125
|
+
LIBPATH = -L. -L$(libdir)
|
126
|
+
DEFFILE =
|
127
|
+
|
128
|
+
CLEANFILES = mkmf.log
|
129
|
+
DISTCLEANFILES =
|
130
|
+
DISTCLEANDIRS =
|
131
|
+
|
132
|
+
extout =
|
133
|
+
extout_prefix =
|
134
|
+
target_prefix = /rgeo/geos
|
135
|
+
LOCAL_LIBS =
|
136
|
+
LIBS = -L/usr/local/Cellar/geos/3.5.0/lib -lgeos_c -lpthread -lgmp -ldl -lobjc
|
137
|
+
ORIG_SRCS = coordinates.c factory.c geometry.c geometry_collection.c line_string.c main.c point.c polygon.c
|
138
|
+
SRCS = $(ORIG_SRCS)
|
139
|
+
OBJS = coordinates.o factory.o geometry.o geometry_collection.o line_string.o main.o point.o polygon.o
|
140
|
+
HDRS = $(srcdir)/coordinates.h $(srcdir)/factory.h $(srcdir)/geometry.h $(srcdir)/geometry_collection.h $(srcdir)/line_string.h $(srcdir)/point.h $(srcdir)/polygon.h $(srcdir)/preface.h
|
141
|
+
TARGET = geos_c_impl
|
142
|
+
TARGET_NAME = geos_c_impl
|
143
|
+
TARGET_ENTRY = Init_$(TARGET_NAME)
|
144
|
+
DLLIB = $(TARGET).bundle
|
145
|
+
EXTSTATIC =
|
146
|
+
STATIC_LIB =
|
147
|
+
|
148
|
+
TIMESTAMP_DIR = .
|
149
|
+
BINDIR = $(bindir)
|
150
|
+
RUBYCOMMONDIR = $(sitedir)$(target_prefix)
|
151
|
+
RUBYLIBDIR = $(sitelibdir)$(target_prefix)
|
152
|
+
RUBYARCHDIR = $(sitearchdir)$(target_prefix)
|
153
|
+
HDRDIR = $(rubyhdrdir)/ruby$(target_prefix)
|
154
|
+
ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix)
|
155
|
+
|
156
|
+
TARGET_SO = $(DLLIB)
|
157
|
+
CLEANLIBS = $(TARGET).bundle
|
158
|
+
CLEANOBJS = *.o *.bak
|
159
|
+
|
160
|
+
all: $(DLLIB)
|
161
|
+
static: $(STATIC_LIB)
|
162
|
+
.PHONY: all install static install-so install-rb
|
163
|
+
.PHONY: clean clean-so clean-static clean-rb
|
164
|
+
|
165
|
+
clean-static::
|
166
|
+
clean-rb-default::
|
167
|
+
clean-rb::
|
168
|
+
clean-so::
|
169
|
+
clean: clean-so clean-static clean-rb-default clean-rb
|
170
|
+
-$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
|
171
|
+
|
172
|
+
distclean-rb-default::
|
173
|
+
distclean-rb::
|
174
|
+
distclean-so::
|
175
|
+
distclean-static::
|
176
|
+
distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
|
177
|
+
-$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
|
178
|
+
-$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
|
179
|
+
-$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
|
180
|
+
|
181
|
+
realclean: distclean
|
182
|
+
install: install-so install-rb
|
183
|
+
|
184
|
+
install-so: $(DLLIB) $(TIMESTAMP_DIR)/.RUBYARCHDIR.-.rgeo.-.geos.time
|
185
|
+
$(INSTALL_PROG) $(DLLIB) $(RUBYARCHDIR)
|
186
|
+
clean-static::
|
187
|
+
-$(Q)$(RM) $(STATIC_LIB)
|
188
|
+
install-rb: pre-install-rb install-rb-default
|
189
|
+
install-rb-default: pre-install-rb-default
|
190
|
+
pre-install-rb: Makefile
|
191
|
+
pre-install-rb-default: Makefile
|
192
|
+
pre-install-rb-default:
|
193
|
+
@$(NULLCMD)
|
194
|
+
$(TIMESTAMP_DIR)/.RUBYARCHDIR.-.rgeo.-.geos.time:
|
195
|
+
$(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
|
196
|
+
$(Q) $(TOUCH) $@
|
197
|
+
|
198
|
+
site-install: site-install-so site-install-rb
|
199
|
+
site-install-so: install-so
|
200
|
+
site-install-rb: install-rb
|
201
|
+
|
202
|
+
.SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
|
203
|
+
|
204
|
+
.cc.o:
|
205
|
+
$(ECHO) compiling $(<)
|
206
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
207
|
+
|
208
|
+
.cc.S:
|
209
|
+
$(ECHO) translating $(<)
|
210
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $<
|
211
|
+
|
212
|
+
.mm.o:
|
213
|
+
$(ECHO) compiling $(<)
|
214
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
215
|
+
|
216
|
+
.mm.S:
|
217
|
+
$(ECHO) translating $(<)
|
218
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $<
|
219
|
+
|
220
|
+
.cxx.o:
|
221
|
+
$(ECHO) compiling $(<)
|
222
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
223
|
+
|
224
|
+
.cxx.S:
|
225
|
+
$(ECHO) translating $(<)
|
226
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $<
|
227
|
+
|
228
|
+
.cpp.o:
|
229
|
+
$(ECHO) compiling $(<)
|
230
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
|
231
|
+
|
232
|
+
.cpp.S:
|
233
|
+
$(ECHO) translating $(<)
|
234
|
+
$(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $<
|
235
|
+
|
236
|
+
.c.o:
|
237
|
+
$(ECHO) compiling $(<)
|
238
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
|
239
|
+
|
240
|
+
.c.S:
|
241
|
+
$(ECHO) translating $(<)
|
242
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $<
|
243
|
+
|
244
|
+
.m.o:
|
245
|
+
$(ECHO) compiling $(<)
|
246
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
|
247
|
+
|
248
|
+
.m.S:
|
249
|
+
$(ECHO) translating $(<)
|
250
|
+
$(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $<
|
251
|
+
|
252
|
+
$(DLLIB): $(OBJS) Makefile
|
253
|
+
$(ECHO) linking shared-object rgeo/geos/$(DLLIB)
|
254
|
+
-$(Q)$(RM) $(@)
|
255
|
+
$(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
|
256
|
+
$(Q) $(POSTLINK)
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
$(OBJS): $(HDRS) $(ruby_headers)
|
@@ -0,0 +1,65 @@
|
|
1
|
+
#include <ruby.h>
|
2
|
+
#include <geos_c.h>
|
3
|
+
|
4
|
+
|
5
|
+
VALUE extract_points_from_coordinate_sequence(GEOSContextHandle_t context, const GEOSCoordSequence* coord_sequence, int zCoordinate)
|
6
|
+
{
|
7
|
+
VALUE result = Qnil;
|
8
|
+
VALUE point;
|
9
|
+
unsigned int count;
|
10
|
+
unsigned int i;
|
11
|
+
double val;
|
12
|
+
|
13
|
+
if(GEOSCoordSeq_getSize_r(context, coord_sequence, &count)) {
|
14
|
+
result = rb_ary_new2(count);
|
15
|
+
for(i = 0; i < count; ++i) {
|
16
|
+
if(zCoordinate) {
|
17
|
+
point = rb_ary_new2(3);
|
18
|
+
} else {
|
19
|
+
point = rb_ary_new2(2);
|
20
|
+
}
|
21
|
+
GEOSCoordSeq_getX_r(context, coord_sequence, i, &val);
|
22
|
+
rb_ary_push(point, rb_float_new(val));
|
23
|
+
GEOSCoordSeq_getY_r(context, coord_sequence, i, &val);
|
24
|
+
rb_ary_push(point, rb_float_new(val));
|
25
|
+
if(zCoordinate) {
|
26
|
+
GEOSCoordSeq_getZ_r(context, coord_sequence, i, &val);
|
27
|
+
rb_ary_push(point, rb_float_new(val));
|
28
|
+
}
|
29
|
+
rb_ary_push(result, point);
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
return result;
|
34
|
+
}
|
35
|
+
|
36
|
+
VALUE extract_points_from_polygon(GEOSContextHandle_t context, const GEOSGeometry* polygon, int zCoordinate)
|
37
|
+
{
|
38
|
+
VALUE result = Qnil;
|
39
|
+
|
40
|
+
const GEOSGeometry* ring;
|
41
|
+
const GEOSCoordSequence* coord_sequence;
|
42
|
+
unsigned int interior_ring_count;
|
43
|
+
unsigned int i;
|
44
|
+
|
45
|
+
if (polygon) {
|
46
|
+
ring = GEOSGetExteriorRing_r(context, polygon);
|
47
|
+
coord_sequence = GEOSGeom_getCoordSeq_r(context, ring);
|
48
|
+
|
49
|
+
if(coord_sequence) {
|
50
|
+
interior_ring_count = GEOSGetNumInteriorRings_r(context, polygon);
|
51
|
+
result = rb_ary_new2(interior_ring_count + 1); // exterior + inner rings
|
52
|
+
|
53
|
+
rb_ary_push(result, extract_points_from_coordinate_sequence(context, coord_sequence, zCoordinate));
|
54
|
+
|
55
|
+
for(i = 0; i < interior_ring_count; ++i) {
|
56
|
+
ring = GEOSGetInteriorRingN_r(context, polygon, i);
|
57
|
+
coord_sequence = GEOSGeom_getCoordSeq_r(context, ring);
|
58
|
+
if(coord_sequence) {
|
59
|
+
rb_ary_push(result, extract_points_from_coordinate_sequence(context, coord_sequence, zCoordinate));
|
60
|
+
}
|
61
|
+
}
|
62
|
+
}
|
63
|
+
}
|
64
|
+
return result;
|
65
|
+
}
|
data/ext/geos_c_impl/extconf.rb
CHANGED
@@ -6,57 +6,33 @@
|
|
6
6
|
|
7
7
|
if ::RUBY_DESCRIPTION =~ /^jruby\s/
|
8
8
|
|
9
|
-
::File.open(
|
9
|
+
::File.open("Makefile", "w") { |f_| f_.write(".PHONY: install\ninstall:\n") }
|
10
10
|
|
11
11
|
else
|
12
|
+
require "mkmf"
|
12
13
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
'/opt/include',
|
22
|
-
'/Library/Frameworks/GEOS.framework/unix/include',
|
23
|
-
::RbConfig::CONFIG['includedir'],
|
24
|
-
'/usr/include',
|
25
|
-
]
|
26
|
-
lib_dirs_ =
|
27
|
-
[
|
28
|
-
'/usr/local/lib64',
|
29
|
-
'/usr/local/lib',
|
30
|
-
'/usr/local/geos/lib',
|
31
|
-
'/opt/local/lib',
|
32
|
-
'/opt/geos/lib',
|
33
|
-
'/opt/lib',
|
34
|
-
'/Library/Frameworks/GEOS.framework/unix/lib',
|
35
|
-
::RbConfig::CONFIG['libdir'],
|
36
|
-
'/usr/lib64',
|
37
|
-
'/usr/lib',
|
38
|
-
]
|
39
|
-
header_dirs_.delete_if{ |path_| !::File.directory?(path_) }
|
40
|
-
lib_dirs_.delete_if{ |path_| !::File.directory?(path_) }
|
14
|
+
if geosconfig = (with_config("geos-config") || find_executable("geos-config"))
|
15
|
+
puts "Using GEOS compile configuration from %s" [geosconfig]
|
16
|
+
$INCFLAGS << " " << `#{geosconfig} --cflags`.strip
|
17
|
+
geos_libs = `#{geosconfig} --clibs`.tr("\n", " ")
|
18
|
+
geos_libs.split(/\s+/).each do |flag|
|
19
|
+
$libs << " " + flag unless $libs.include?(flag)
|
20
|
+
end
|
21
|
+
end
|
41
22
|
|
42
23
|
found_geos_ = false
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
else
|
49
|
-
$libs.gsub!(' -lgeos -lgeos_c', '')
|
50
|
-
end
|
51
|
-
have_func('GEOSPreparedContains_r', 'geos_c.h')
|
52
|
-
have_func('GEOSPreparedDisjoint_r', 'geos_c.h')
|
53
|
-
have_func('GEOSWKTWriter_setOutputDimension_r', 'geos_c.h')
|
54
|
-
have_func('rb_memhash', 'ruby.h')
|
24
|
+
if have_header("geos_c.h")
|
25
|
+
found_geos_ = true if have_func("GEOSSetSRID_r", "geos_c.h")
|
26
|
+
have_func("GEOSPreparedContains_r", "geos_c.h")
|
27
|
+
have_func("GEOSPreparedDisjoint_r", "geos_c.h")
|
28
|
+
have_func("rb_memhash", "ruby.h")
|
55
29
|
end
|
30
|
+
|
56
31
|
unless found_geos_
|
57
|
-
puts "**** WARNING: Unable to find GEOS headers or
|
32
|
+
puts "**** WARNING: Unable to find GEOS headers or libraries."
|
33
|
+
puts "**** Ensure that 'geos-config' is in your PATH or provide that full path via --with-geos-config"
|
58
34
|
puts "**** Compiling without GEOS support."
|
59
35
|
end
|
60
|
-
create_makefile('rgeo/geos/geos_c_impl')
|
61
36
|
|
37
|
+
create_makefile("rgeo/geos/geos_c_impl")
|
62
38
|
end
|