proj4rb 2.2.1 → 2.2.2
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.
- checksums.yaml +4 -4
- data/ChangeLog +66 -61
- data/Gemfile +4 -4
- data/Rakefile +27 -27
- data/lib/api/api.rb +110 -83
- data/lib/api/api_4_9.rb +30 -30
- data/lib/api/api_5_0.rb +300 -300
- data/lib/api/api_5_1.rb +6 -6
- data/lib/api/api_5_2.rb +4 -4
- data/lib/api/api_6_0.rb +41 -42
- data/lib/api/api_6_1.rb +4 -4
- data/lib/api/api_6_2.rb +6 -5
- data/lib/area.rb +32 -32
- data/lib/config.rb +69 -69
- data/lib/context.rb +102 -102
- data/lib/coordinate.rb +197 -197
- data/lib/crs.rb +204 -204
- data/lib/ellipsoid.rb +41 -41
- data/lib/error.rb +17 -17
- data/lib/operation.rb +42 -42
- data/lib/pj_object.rb +80 -80
- data/lib/point.rb +72 -72
- data/lib/prime_meridian.rb +39 -39
- data/lib/proj.rb +30 -30
- data/lib/projection.rb +206 -206
- data/lib/transformation.rb +60 -60
- data/lib/unit.rb +53 -53
- data/proj4rb.gemspec +32 -32
- data/test/abstract_test.rb +7 -7
- data/test/context_test.rb +81 -81
- data/test/coordinate_test.rb +34 -34
- data/test/crs_test.rb +372 -372
- data/test/ellipsoid_test.rb +34 -34
- data/test/operation_test.rb +29 -29
- data/test/prime_meridians_test.rb +33 -33
- data/test/proj_test.rb +16 -16
- data/test/projection_test.rb +223 -223
- data/test/transformation_test.rb +67 -67
- data/test/unit_test.rb +47 -47
- metadata +2 -2
data/lib/prime_meridian.rb
CHANGED
@@ -1,40 +1,40 @@
|
|
1
|
-
module Proj
|
2
|
-
class PrimeMeridian
|
3
|
-
attr_reader :id, :defn
|
4
|
-
|
5
|
-
def self.list
|
6
|
-
pointer_to_array = FFI::Pointer.new(Api::PJ_PRIME_MERIDIANS, Api.proj_list_prime_meridians)
|
7
|
-
result = Array.new
|
8
|
-
0.step do |i|
|
9
|
-
prime_meridian_info = Api::PJ_PRIME_MERIDIANS.new(pointer_to_array[i])
|
10
|
-
break result if prime_meridian_info[:id].nil?
|
11
|
-
result << self.new(prime_meridian_info[:id], prime_meridian_info[:defn])
|
12
|
-
end
|
13
|
-
end
|
14
|
-
|
15
|
-
def self.get(id)
|
16
|
-
self.list.find {|ellipsoid| ellipsoid.id == id}
|
17
|
-
end
|
18
|
-
|
19
|
-
def initialize(id, defn)
|
20
|
-
@id = id
|
21
|
-
@defn = defn
|
22
|
-
end
|
23
|
-
|
24
|
-
def <=>(other)
|
25
|
-
self.id <=> other.id
|
26
|
-
end
|
27
|
-
|
28
|
-
def ==(other)
|
29
|
-
self.id == other.id
|
30
|
-
end
|
31
|
-
|
32
|
-
def to_s
|
33
|
-
self.id
|
34
|
-
end
|
35
|
-
|
36
|
-
def inspect
|
37
|
-
"#<#{self.class} id=\"#{id}\", defn=\"#{defn}\">"
|
38
|
-
end
|
39
|
-
end
|
1
|
+
module Proj
|
2
|
+
class PrimeMeridian
|
3
|
+
attr_reader :id, :defn
|
4
|
+
|
5
|
+
def self.list
|
6
|
+
pointer_to_array = FFI::Pointer.new(Api::PJ_PRIME_MERIDIANS, Api.proj_list_prime_meridians)
|
7
|
+
result = Array.new
|
8
|
+
0.step do |i|
|
9
|
+
prime_meridian_info = Api::PJ_PRIME_MERIDIANS.new(pointer_to_array[i])
|
10
|
+
break result if prime_meridian_info[:id].nil?
|
11
|
+
result << self.new(prime_meridian_info[:id], prime_meridian_info[:defn])
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.get(id)
|
16
|
+
self.list.find {|ellipsoid| ellipsoid.id == id}
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize(id, defn)
|
20
|
+
@id = id
|
21
|
+
@defn = defn
|
22
|
+
end
|
23
|
+
|
24
|
+
def <=>(other)
|
25
|
+
self.id <=> other.id
|
26
|
+
end
|
27
|
+
|
28
|
+
def ==(other)
|
29
|
+
self.id == other.id
|
30
|
+
end
|
31
|
+
|
32
|
+
def to_s
|
33
|
+
self.id
|
34
|
+
end
|
35
|
+
|
36
|
+
def inspect
|
37
|
+
"#<#{self.class} id=\"#{id}\", defn=\"#{defn}\">"
|
38
|
+
end
|
39
|
+
end
|
40
40
|
end
|
data/lib/proj.rb
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require_relative 'api/api'
|
4
|
-
require_relative './config'
|
5
|
-
|
6
|
-
require_relative './area'
|
7
|
-
require_relative './context'
|
8
|
-
require_relative './coordinate'
|
9
|
-
require_relative './ellipsoid'
|
10
|
-
require_relative './error'
|
11
|
-
require_relative './point'
|
12
|
-
require_relative './prime_meridian'
|
13
|
-
require_relative './unit'
|
14
|
-
|
15
|
-
require_relative './pj_object'
|
16
|
-
require_relative './operation'
|
17
|
-
require_relative './crs'
|
18
|
-
require_relative './projection'
|
19
|
-
require_relative './transformation'
|
20
|
-
|
21
|
-
module Proj
|
22
|
-
def self.info
|
23
|
-
Api.proj_info
|
24
|
-
end
|
25
|
-
|
26
|
-
def self.version
|
27
|
-
self.info[:version]
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require_relative 'api/api'
|
4
|
+
require_relative './config'
|
5
|
+
|
6
|
+
require_relative './area'
|
7
|
+
require_relative './context'
|
8
|
+
require_relative './coordinate'
|
9
|
+
require_relative './ellipsoid'
|
10
|
+
require_relative './error'
|
11
|
+
require_relative './point'
|
12
|
+
require_relative './prime_meridian'
|
13
|
+
require_relative './unit'
|
14
|
+
|
15
|
+
require_relative './pj_object'
|
16
|
+
require_relative './operation'
|
17
|
+
require_relative './crs'
|
18
|
+
require_relative './projection'
|
19
|
+
require_relative './transformation'
|
20
|
+
|
21
|
+
module Proj
|
22
|
+
def self.info
|
23
|
+
Api.proj_info
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.version
|
27
|
+
self.info[:version]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
31
|
Proj::Config.instance.set_search_paths
|
data/lib/projection.rb
CHANGED
@@ -1,207 +1,207 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
module Proj
|
4
|
-
# @deprecated This class is *DEPRECATED.* It will be removed when Proj 7 is released and removes the
|
5
|
-
# underlying API's this class uses. Code should be ported to use Crs and Transformation objects.
|
6
|
-
class Projection
|
7
|
-
def self.parse(value)
|
8
|
-
case value
|
9
|
-
when Array
|
10
|
-
value
|
11
|
-
when String
|
12
|
-
value.strip.split(' ')
|
13
|
-
when Hash
|
14
|
-
array = []
|
15
|
-
value.each_pair do |key, value|
|
16
|
-
key = "+#{key}"
|
17
|
-
array << (value.nil? ? key : "#{key}=#{value}")
|
18
|
-
end
|
19
|
-
array
|
20
|
-
when Projection
|
21
|
-
value.getDef.split(' ')
|
22
|
-
else
|
23
|
-
raise ArgumentError, "Unknown type #{value.class} for projection definition"
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def self.finalize(pointer)
|
28
|
-
proc do
|
29
|
-
Api.pj_free(pointer)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
# Projection classes are created using Proj4 strings which consist of a number of parameters.
|
34
|
-
# For more information please see the +opt arguments section at https://proj.org/apps/proj.html.
|
35
|
-
#
|
36
|
-
# @param value [string, array, hash] Parameters can be specified as strings, arrays or hashes.
|
37
|
-
#
|
38
|
-
# @example
|
39
|
-
# proj = Projection.new("+proj=utm +zone=21 +units=m")
|
40
|
-
# proj = Projection.new ["+proj=utm", "+zone=21", "+units=m"]
|
41
|
-
# proj = Projection.new("proj" => "utm", "zone" => "21", "units" => "m")
|
42
|
-
#
|
43
|
-
# With all variants the plus sign in front of the keys is optional.
|
44
|
-
def initialize(value)
|
45
|
-
params = self.class.parse(value)
|
46
|
-
p_params = FFI::MemoryPointer.new(:pointer, params.length)
|
47
|
-
params.each_with_index do |param, i|
|
48
|
-
p_param = FFI::MemoryPointer.from_string(param)
|
49
|
-
p_params[i].write_pointer(p_param)
|
50
|
-
end
|
51
|
-
|
52
|
-
@pointer = Api.pj_init(params.count, p_params)
|
53
|
-
self.check_error
|
54
|
-
|
55
|
-
ObjectSpace.define_finalizer(self, self.class.finalize(@pointer))
|
56
|
-
end
|
57
|
-
|
58
|
-
def check_error
|
59
|
-
ptr = Api.pj_get_errno_ref
|
60
|
-
errno = ptr.read_int
|
61
|
-
if errno != 0
|
62
|
-
# If we don't reset the error code it hangs around. This doesn't seem documented anyplace?
|
63
|
-
ptr.write_int(0)
|
64
|
-
Error.check(errno)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
|
69
|
-
def to_ptr
|
70
|
-
@pointer
|
71
|
-
end
|
72
|
-
|
73
|
-
# Returns projection definitions
|
74
|
-
#
|
75
|
-
# @return [String]
|
76
|
-
def getDef
|
77
|
-
Api.pj_get_def(self, 0)
|
78
|
-
end
|
79
|
-
|
80
|
-
# Returns if this is a geocentric projection
|
81
|
-
#
|
82
|
-
# @return [Boolean]
|
83
|
-
def isGeocent?
|
84
|
-
Api::pj_is_geocent(self)
|
85
|
-
end
|
86
|
-
alias :isGeocentric? :isGeocent?
|
87
|
-
|
88
|
-
# Returns if this is a lat/long projection
|
89
|
-
#
|
90
|
-
# @return [Boolean]
|
91
|
-
def isLatLong?
|
92
|
-
Api::pj_is_latlong(self)
|
93
|
-
end
|
94
|
-
|
95
|
-
# Get the ID of this projection.
|
96
|
-
#
|
97
|
-
# @return [String]
|
98
|
-
def projection
|
99
|
-
getDef =~ /\+proj=(.+?) / ? $1 : nil
|
100
|
-
end
|
101
|
-
|
102
|
-
# Get the ID of the datum used in this projection.
|
103
|
-
#
|
104
|
-
# @return [String]
|
105
|
-
def datum
|
106
|
-
getDef =~ /\+datum=(.+?) / ? $1 : nil
|
107
|
-
end
|
108
|
-
|
109
|
-
# Get definition of projection in typical inspect format (#<Proj::Projection +init=... +proj=... ...>).
|
110
|
-
#
|
111
|
-
# @return [String]
|
112
|
-
def to_s
|
113
|
-
"#<#{self.class.name}#{getDef}>"
|
114
|
-
end
|
115
|
-
|
116
|
-
# Forward projection of a point. Returns a copy of the point object with coordinates projected.
|
117
|
-
#
|
118
|
-
# @param point [Point] in radians
|
119
|
-
# @return [Point] in cartesian coordinates
|
120
|
-
def forward(point)
|
121
|
-
struct = Api.pj_fwd(point, self)
|
122
|
-
self.check_error
|
123
|
-
Point.from_pointer(struct)
|
124
|
-
end
|
125
|
-
|
126
|
-
# Convenience function for calculating a forward projection with degrees instead of radians.
|
127
|
-
#
|
128
|
-
# @param point [Point] in degrees
|
129
|
-
# @return [Point] in cartesian coordinates
|
130
|
-
def forwardDeg(point)
|
131
|
-
forward(point.to_radians)
|
132
|
-
end
|
133
|
-
|
134
|
-
# Projects all points in a collection.
|
135
|
-
#
|
136
|
-
# @param collection [Enumerable<Point>] Points specified in radians
|
137
|
-
# @return [Enumerable<Point>] Points specified in cartesian coordinates
|
138
|
-
def forward_all(collection)
|
139
|
-
collection.map do |point|
|
140
|
-
forward(point)
|
141
|
-
end
|
142
|
-
end
|
143
|
-
|
144
|
-
# Inverse projection of a point. Returns a copy of the point object with coordinates projected.
|
145
|
-
#
|
146
|
-
# @param point [Point] in cartesian coordinates
|
147
|
-
# @return [Point] in radians
|
148
|
-
def inverse(point)
|
149
|
-
struct = Api.pj_inv(point, self)
|
150
|
-
self.check_error
|
151
|
-
Point.from_pointer(struct)
|
152
|
-
end
|
153
|
-
|
154
|
-
# Convenience function for calculating an inverse projection with the result in degrees instead of radians.
|
155
|
-
#
|
156
|
-
# @param point [Point] in cartesian coordinates
|
157
|
-
# @return [Point] in degrees
|
158
|
-
def inverseDeg(point)
|
159
|
-
result = inverse(point)
|
160
|
-
result.to_degrees
|
161
|
-
end
|
162
|
-
|
163
|
-
# Inverse projection of all points in a collection.
|
164
|
-
#
|
165
|
-
# @param collection [Enumerable<Point>] Points specified in cartesian coordinates
|
166
|
-
# @return [Enumerable<Point>] Points specified in radians
|
167
|
-
def inverse_all(collection)
|
168
|
-
collection.map do |point|
|
169
|
-
inverse(point)
|
170
|
-
end
|
171
|
-
end
|
172
|
-
|
173
|
-
# Transforms a point from one projection to another.
|
174
|
-
#
|
175
|
-
# @param other [Projection]
|
176
|
-
# @param point [Point]
|
177
|
-
# @return [Point]
|
178
|
-
def transform(other, point)
|
179
|
-
p_x = FFI::MemoryPointer.new(:double, 1)
|
180
|
-
p_x.write_double(point.x)
|
181
|
-
|
182
|
-
p_y = FFI::MemoryPointer.new(:double, 1)
|
183
|
-
p_y.write_double(point.y)
|
184
|
-
|
185
|
-
p_z = FFI::MemoryPointer.new(:double, 1)
|
186
|
-
p_z.write_double(0)
|
187
|
-
|
188
|
-
Api.pj_transform(self, other, 1, 1, p_x, p_y, p_z)
|
189
|
-
self.check_error
|
190
|
-
|
191
|
-
Point.new(p_x.read_double, p_y.read_double)
|
192
|
-
end
|
193
|
-
|
194
|
-
# Transforms all points in a collection from one projection to
|
195
|
-
# another. The +collection+ object must implement the +each+,
|
196
|
-
# +clear+, and << methods (just like an Array) for this to work.
|
197
|
-
#
|
198
|
-
# @param other [Projection]
|
199
|
-
# @param collection [Enumerable, Point]
|
200
|
-
# @return [Enumerable, Point]
|
201
|
-
def transform_all(other, collection)
|
202
|
-
collection.map do |point|
|
203
|
-
transform(other, point)
|
204
|
-
end
|
205
|
-
end
|
206
|
-
end
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
module Proj
|
4
|
+
# @deprecated This class is *DEPRECATED.* It will be removed when Proj 7 is released and removes the
|
5
|
+
# underlying API's this class uses. Code should be ported to use Crs and Transformation objects.
|
6
|
+
class Projection
|
7
|
+
def self.parse(value)
|
8
|
+
case value
|
9
|
+
when Array
|
10
|
+
value
|
11
|
+
when String
|
12
|
+
value.strip.split(' ')
|
13
|
+
when Hash
|
14
|
+
array = []
|
15
|
+
value.each_pair do |key, value|
|
16
|
+
key = "+#{key}"
|
17
|
+
array << (value.nil? ? key : "#{key}=#{value}")
|
18
|
+
end
|
19
|
+
array
|
20
|
+
when Projection
|
21
|
+
value.getDef.split(' ')
|
22
|
+
else
|
23
|
+
raise ArgumentError, "Unknown type #{value.class} for projection definition"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.finalize(pointer)
|
28
|
+
proc do
|
29
|
+
Api.pj_free(pointer)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
# Projection classes are created using Proj4 strings which consist of a number of parameters.
|
34
|
+
# For more information please see the +opt arguments section at https://proj.org/apps/proj.html.
|
35
|
+
#
|
36
|
+
# @param value [string, array, hash] Parameters can be specified as strings, arrays or hashes.
|
37
|
+
#
|
38
|
+
# @example
|
39
|
+
# proj = Projection.new("+proj=utm +zone=21 +units=m")
|
40
|
+
# proj = Projection.new ["+proj=utm", "+zone=21", "+units=m"]
|
41
|
+
# proj = Projection.new("proj" => "utm", "zone" => "21", "units" => "m")
|
42
|
+
#
|
43
|
+
# With all variants the plus sign in front of the keys is optional.
|
44
|
+
def initialize(value)
|
45
|
+
params = self.class.parse(value)
|
46
|
+
p_params = FFI::MemoryPointer.new(:pointer, params.length)
|
47
|
+
params.each_with_index do |param, i|
|
48
|
+
p_param = FFI::MemoryPointer.from_string(param)
|
49
|
+
p_params[i].write_pointer(p_param)
|
50
|
+
end
|
51
|
+
|
52
|
+
@pointer = Api.pj_init(params.count, p_params)
|
53
|
+
self.check_error
|
54
|
+
|
55
|
+
ObjectSpace.define_finalizer(self, self.class.finalize(@pointer))
|
56
|
+
end
|
57
|
+
|
58
|
+
def check_error
|
59
|
+
ptr = Api.pj_get_errno_ref
|
60
|
+
errno = ptr.read_int
|
61
|
+
if errno != 0
|
62
|
+
# If we don't reset the error code it hangs around. This doesn't seem documented anyplace?
|
63
|
+
ptr.write_int(0)
|
64
|
+
Error.check(errno)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
def to_ptr
|
70
|
+
@pointer
|
71
|
+
end
|
72
|
+
|
73
|
+
# Returns projection definitions
|
74
|
+
#
|
75
|
+
# @return [String]
|
76
|
+
def getDef
|
77
|
+
Api.pj_get_def(self, 0)
|
78
|
+
end
|
79
|
+
|
80
|
+
# Returns if this is a geocentric projection
|
81
|
+
#
|
82
|
+
# @return [Boolean]
|
83
|
+
def isGeocent?
|
84
|
+
Api::pj_is_geocent(self)
|
85
|
+
end
|
86
|
+
alias :isGeocentric? :isGeocent?
|
87
|
+
|
88
|
+
# Returns if this is a lat/long projection
|
89
|
+
#
|
90
|
+
# @return [Boolean]
|
91
|
+
def isLatLong?
|
92
|
+
Api::pj_is_latlong(self)
|
93
|
+
end
|
94
|
+
|
95
|
+
# Get the ID of this projection.
|
96
|
+
#
|
97
|
+
# @return [String]
|
98
|
+
def projection
|
99
|
+
getDef =~ /\+proj=(.+?) / ? $1 : nil
|
100
|
+
end
|
101
|
+
|
102
|
+
# Get the ID of the datum used in this projection.
|
103
|
+
#
|
104
|
+
# @return [String]
|
105
|
+
def datum
|
106
|
+
getDef =~ /\+datum=(.+?) / ? $1 : nil
|
107
|
+
end
|
108
|
+
|
109
|
+
# Get definition of projection in typical inspect format (#<Proj::Projection +init=... +proj=... ...>).
|
110
|
+
#
|
111
|
+
# @return [String]
|
112
|
+
def to_s
|
113
|
+
"#<#{self.class.name}#{getDef}>"
|
114
|
+
end
|
115
|
+
|
116
|
+
# Forward projection of a point. Returns a copy of the point object with coordinates projected.
|
117
|
+
#
|
118
|
+
# @param point [Point] in radians
|
119
|
+
# @return [Point] in cartesian coordinates
|
120
|
+
def forward(point)
|
121
|
+
struct = Api.pj_fwd(point, self)
|
122
|
+
self.check_error
|
123
|
+
Point.from_pointer(struct)
|
124
|
+
end
|
125
|
+
|
126
|
+
# Convenience function for calculating a forward projection with degrees instead of radians.
|
127
|
+
#
|
128
|
+
# @param point [Point] in degrees
|
129
|
+
# @return [Point] in cartesian coordinates
|
130
|
+
def forwardDeg(point)
|
131
|
+
forward(point.to_radians)
|
132
|
+
end
|
133
|
+
|
134
|
+
# Projects all points in a collection.
|
135
|
+
#
|
136
|
+
# @param collection [Enumerable<Point>] Points specified in radians
|
137
|
+
# @return [Enumerable<Point>] Points specified in cartesian coordinates
|
138
|
+
def forward_all(collection)
|
139
|
+
collection.map do |point|
|
140
|
+
forward(point)
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
# Inverse projection of a point. Returns a copy of the point object with coordinates projected.
|
145
|
+
#
|
146
|
+
# @param point [Point] in cartesian coordinates
|
147
|
+
# @return [Point] in radians
|
148
|
+
def inverse(point)
|
149
|
+
struct = Api.pj_inv(point, self)
|
150
|
+
self.check_error
|
151
|
+
Point.from_pointer(struct)
|
152
|
+
end
|
153
|
+
|
154
|
+
# Convenience function for calculating an inverse projection with the result in degrees instead of radians.
|
155
|
+
#
|
156
|
+
# @param point [Point] in cartesian coordinates
|
157
|
+
# @return [Point] in degrees
|
158
|
+
def inverseDeg(point)
|
159
|
+
result = inverse(point)
|
160
|
+
result.to_degrees
|
161
|
+
end
|
162
|
+
|
163
|
+
# Inverse projection of all points in a collection.
|
164
|
+
#
|
165
|
+
# @param collection [Enumerable<Point>] Points specified in cartesian coordinates
|
166
|
+
# @return [Enumerable<Point>] Points specified in radians
|
167
|
+
def inverse_all(collection)
|
168
|
+
collection.map do |point|
|
169
|
+
inverse(point)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
# Transforms a point from one projection to another.
|
174
|
+
#
|
175
|
+
# @param other [Projection]
|
176
|
+
# @param point [Point]
|
177
|
+
# @return [Point]
|
178
|
+
def transform(other, point)
|
179
|
+
p_x = FFI::MemoryPointer.new(:double, 1)
|
180
|
+
p_x.write_double(point.x)
|
181
|
+
|
182
|
+
p_y = FFI::MemoryPointer.new(:double, 1)
|
183
|
+
p_y.write_double(point.y)
|
184
|
+
|
185
|
+
p_z = FFI::MemoryPointer.new(:double, 1)
|
186
|
+
p_z.write_double(0)
|
187
|
+
|
188
|
+
Api.pj_transform(self, other, 1, 1, p_x, p_y, p_z)
|
189
|
+
self.check_error
|
190
|
+
|
191
|
+
Point.new(p_x.read_double, p_y.read_double)
|
192
|
+
end
|
193
|
+
|
194
|
+
# Transforms all points in a collection from one projection to
|
195
|
+
# another. The +collection+ object must implement the +each+,
|
196
|
+
# +clear+, and << methods (just like an Array) for this to work.
|
197
|
+
#
|
198
|
+
# @param other [Projection]
|
199
|
+
# @param collection [Enumerable, Point]
|
200
|
+
# @return [Enumerable, Point]
|
201
|
+
def transform_all(other, collection)
|
202
|
+
collection.map do |point|
|
203
|
+
transform(other, point)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
207
|
end
|