proj4rb 3.0.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +26 -15
- data/README.rdoc +82 -44
- data/Rakefile +27 -27
- data/lib/api/api.rb +96 -118
- data/lib/api/api_5_0.rb +331 -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 +116 -14
- data/lib/api/api_6_1.rb +4 -4
- data/lib/api/api_6_2.rb +9 -6
- data/lib/api/api_6_3.rb +6 -0
- data/lib/api/api_7_0.rb +68 -0
- data/lib/api/api_7_1.rb +73 -0
- data/lib/api/api_7_2.rb +14 -0
- data/lib/api/api_8_0.rb +6 -0
- data/lib/api/api_8_1.rb +24 -0
- data/lib/api/api_8_2.rb +6 -0
- data/lib/api/api_9_1.rb +7 -0
- data/lib/api/api_9_2.rb +9 -0
- data/lib/api/api_experimental.rb +196 -0
- data/lib/proj/area.rb +73 -32
- data/lib/proj/axis_info.rb +44 -0
- data/lib/proj/bounds.rb +13 -0
- data/lib/proj/context.rb +174 -28
- data/lib/proj/conversion.rb +92 -0
- data/lib/proj/coordinate.rb +281 -197
- data/lib/proj/coordinate_operation_mixin.rb +381 -0
- data/lib/proj/coordinate_system.rb +137 -0
- data/lib/proj/crs.rb +672 -204
- data/lib/proj/crs_info.rb +47 -0
- data/lib/proj/database.rb +305 -0
- data/lib/proj/datum.rb +32 -0
- data/lib/proj/datum_ensemble.rb +34 -0
- data/lib/proj/ellipsoid.rb +77 -41
- data/lib/proj/error.rb +62 -9
- data/lib/proj/file_api.rb +166 -0
- data/lib/proj/grid.rb +121 -0
- data/lib/proj/grid_cache.rb +64 -0
- data/lib/proj/grid_info.rb +19 -0
- data/lib/proj/network_api.rb +92 -0
- data/lib/proj/operation.rb +42 -42
- data/lib/proj/operation_factory_context.rb +136 -0
- data/lib/proj/parameter.rb +38 -0
- data/lib/proj/parameters.rb +106 -0
- data/lib/proj/pj_object.rb +670 -80
- data/lib/proj/pj_objects.rb +44 -0
- data/lib/proj/prime_meridian.rb +65 -39
- data/lib/proj/projection.rb +698 -207
- data/lib/proj/session.rb +46 -0
- data/lib/proj/strings.rb +32 -0
- data/lib/proj/transformation.rb +101 -60
- data/lib/proj/unit.rb +108 -53
- data/lib/proj.rb +110 -9
- data/proj4rb.gemspec +5 -5
- data/test/abstract_test.rb +23 -1
- data/test/context_test.rb +172 -82
- data/test/conversion_test.rb +368 -0
- data/test/coordinate_system_test.rb +144 -0
- data/test/crs_test.rb +770 -71
- data/test/database_test.rb +360 -0
- data/test/datum_ensemble_test.rb +65 -0
- data/test/datum_test.rb +55 -0
- data/test/ellipsoid_test.rb +64 -18
- data/test/file_api_test.rb +66 -0
- data/test/grid_cache_test.rb +72 -0
- data/test/grid_test.rb +141 -0
- data/test/network_api_test.rb +45 -0
- data/test/operation_factory_context_test.rb +201 -0
- data/test/parameters_test.rb +40 -0
- data/test/pj_object_test.rb +179 -0
- data/test/prime_meridian_test.rb +76 -0
- data/test/proj_test.rb +46 -4
- data/test/projection_test.rb +646 -222
- data/test/session_test.rb +78 -0
- data/test/transformation_test.rb +149 -7
- data/test/unit_test.rb +57 -28
- metadata +51 -13
- data/lib/api/api_4_9.rb +0 -31
- data/lib/proj/config.rb +0 -70
- data/lib/proj/point.rb +0 -72
- data/test/prime_meridians_test.rb +0 -33
@@ -0,0 +1,38 @@
|
|
1
|
+
module Proj
|
2
|
+
class Parameter
|
3
|
+
# @!attribute [r] name
|
4
|
+
# @return [String] Param name
|
5
|
+
# @!attribute [r] auth_name
|
6
|
+
# @return [String] Authority name
|
7
|
+
# @!attribute [r] code
|
8
|
+
# @return [String] Authority code
|
9
|
+
# @!attribute [r] value
|
10
|
+
# @return [String] Param value
|
11
|
+
# @!attribute [r] unit_conv_factor
|
12
|
+
# @return [String] Param unit_conv_factor
|
13
|
+
# @!attribute [r] unit_name
|
14
|
+
# @return [String] Param unit_name
|
15
|
+
# @!attribute [r] unit_type
|
16
|
+
# @return [PJ_UNIT_TYPE] Unit type
|
17
|
+
attr_reader :name, :auth_name, :code, :value,
|
18
|
+
:unit_conv_factor, :unit_name, :unit_type
|
19
|
+
|
20
|
+
def initialize(name:, auth_name: nil, code: nil, value:, unit_conv_factor:, unit_name: nil, unit_type:)
|
21
|
+
@name = name
|
22
|
+
@auth_name = auth_name
|
23
|
+
@code = code
|
24
|
+
@value = value
|
25
|
+
@unit_conv_factor = unit_conv_factor
|
26
|
+
@unit_name = unit_name
|
27
|
+
@unit_type = unit_type
|
28
|
+
end
|
29
|
+
|
30
|
+
# Returns param information in PJ_PARAM_DESCRIPTION structure
|
31
|
+
#
|
32
|
+
# @return [PJ_PARAM_DESCRIPTION]
|
33
|
+
def to_description
|
34
|
+
Api::PJ_PARAM_DESCRIPTION.create(name: name, auth_name: auth_name, code: code, value: value,
|
35
|
+
unit_conv_factor: unit_conv_factor, unit_name: name, unit_type: unit_type)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,106 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
module Proj
|
3
|
+
class Parameters
|
4
|
+
def self.finalize(pointer)
|
5
|
+
proc do
|
6
|
+
Api.proj_get_crs_list_parameters_destroy(pointer)
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
pointer = Api.proj_get_crs_list_parameters_create
|
12
|
+
@params = Api::PROJ_CRS_LIST_PARAMETERS.new(pointer)
|
13
|
+
ObjectSpace.define_finalizer(self, self.class.finalize(pointer))
|
14
|
+
end
|
15
|
+
|
16
|
+
def to_ptr
|
17
|
+
@params.to_ptr
|
18
|
+
end
|
19
|
+
|
20
|
+
def types
|
21
|
+
result = Array.new
|
22
|
+
|
23
|
+
unless @params[:types].null?
|
24
|
+
ints = @params[:types].read_array_of_int(@params[:types_count])
|
25
|
+
ints.each do |int|
|
26
|
+
result << Api::PJ_TYPE[int]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
result
|
30
|
+
end
|
31
|
+
|
32
|
+
def types=(values)
|
33
|
+
ptr = FFI::MemoryPointer.new(:int, values.size)
|
34
|
+
ints = values.map {|symbol| Api::PJ_TYPE[symbol]}
|
35
|
+
ptr.write_array_of_int(ints)
|
36
|
+
|
37
|
+
@params[:types] = ptr
|
38
|
+
@params[:types_count] = values.size
|
39
|
+
end
|
40
|
+
|
41
|
+
def crs_area_of_use_contains_bbox
|
42
|
+
@params[:crs_area_of_use_contains_bbox]
|
43
|
+
end
|
44
|
+
|
45
|
+
def crs_area_of_use_contains_bbox=(value)
|
46
|
+
@params[:crs_area_of_use_contains_bbox] = value
|
47
|
+
end
|
48
|
+
|
49
|
+
def bbox_valid
|
50
|
+
@params[:bbox_valid] == 1 ? true : false
|
51
|
+
end
|
52
|
+
|
53
|
+
def bbox_valid=(value)
|
54
|
+
@params[:bbox_valid] = value ? 1 : 0
|
55
|
+
end
|
56
|
+
|
57
|
+
def west_lon_degree
|
58
|
+
@params[:west_lon_degree]
|
59
|
+
end
|
60
|
+
|
61
|
+
def west_lon_degree=(value)
|
62
|
+
@params[:west_lon_degree] = value
|
63
|
+
end
|
64
|
+
|
65
|
+
def south_lat_degree
|
66
|
+
@params[:south_lat_degree]
|
67
|
+
end
|
68
|
+
|
69
|
+
def south_lat_degree=(value)
|
70
|
+
@params[:south_lat_degree] = value
|
71
|
+
end
|
72
|
+
|
73
|
+
def east_lon_degree
|
74
|
+
@params[:east_lon_degree]
|
75
|
+
end
|
76
|
+
|
77
|
+
def east_lon_degree=(value)
|
78
|
+
@params[:east_lon_degree] = value
|
79
|
+
end
|
80
|
+
|
81
|
+
def north_lat_degree
|
82
|
+
@params[:north_lat_degree]
|
83
|
+
end
|
84
|
+
|
85
|
+
def north_lat_degree=(value)
|
86
|
+
@params[:north_lat_degree] = value
|
87
|
+
end
|
88
|
+
|
89
|
+
def allow_deprecated
|
90
|
+
@params[:allow_deprecated] == 1 ? true : false
|
91
|
+
end
|
92
|
+
|
93
|
+
def allow_deprecated=(value)
|
94
|
+
@params[:allow_deprecated] = value ? 1 : 0
|
95
|
+
end
|
96
|
+
|
97
|
+
def celestial_body_name
|
98
|
+
@params[:celestial_body_name].read_string_to_null
|
99
|
+
end
|
100
|
+
|
101
|
+
def celestial_body_name=(value)
|
102
|
+
ptr = FFI::MemoryPointer.from_string(value)
|
103
|
+
@params[:celestial_body_name] = ptr
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|