proj4rb 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/ChangeLog +46 -0
- data/Gemfile +4 -0
- data/README.rdoc +158 -148
- data/Rakefile +26 -41
- data/lib/area.rb +32 -0
- data/lib/config.rb +70 -0
- data/lib/context.rb +103 -0
- data/lib/coordinate.rb +197 -0
- data/lib/crs.rb +206 -0
- data/lib/ellipsoid.rb +42 -0
- data/lib/error.rb +18 -0
- data/lib/operation.rb +43 -0
- data/lib/pj_object.rb +82 -0
- data/lib/point.rb +72 -0
- data/lib/prime_meridian.rb +40 -0
- data/lib/proj.rb +31 -0
- data/lib/proj4.rb +3 -469
- data/lib/projection.rb +207 -0
- data/lib/transformation.rb +61 -0
- data/lib/unit.rb +54 -0
- data/proj4rb.gemspec +31 -0
- data/test/abstract_test.rb +7 -0
- data/test/context_test.rb +82 -0
- data/test/coordinate_test.rb +35 -0
- data/test/crs_test.rb +373 -0
- data/test/ellipsoid_test.rb +34 -0
- data/test/operation_test.rb +29 -0
- data/test/prime_meridians_test.rb +33 -0
- data/test/proj_test.rb +17 -0
- data/test/projection_test.rb +224 -0
- data/test/transformation_test.rb +68 -0
- data/test/unit_test.rb +47 -0
- metadata +82 -77
- data/data/GL27 +0 -22
- data/data/MD +0 -0
- data/data/TN +0 -0
- data/data/WI +0 -0
- data/data/WO +0 -0
- data/data/conus +0 -0
- data/data/epsg +0 -5443
- data/data/epsg-deprecated +0 -2
- data/data/esri +0 -5937
- data/data/esri.extra +0 -948
- data/data/hawaii +0 -0
- data/data/nad.lst +0 -142
- data/data/nad27 +0 -809
- data/data/nad83 +0 -744
- data/data/ntv1_can.dat +0 -0
- data/data/null +0 -0
- data/data/other.extra +0 -49
- data/data/proj_def.dat +0 -17
- data/data/prvi +0 -0
- data/data/stgeorge +0 -0
- data/data/stlrnc +0 -0
- data/data/stpaul +0 -0
- data/data/world +0 -212
- data/example/basic.rb +0 -18
- data/example/list-datums.rb +0 -17
- data/example/list-ellipsoids.rb +0 -17
- data/example/list-errors.rb +0 -11
- data/example/list-prime-meridians.rb +0 -17
- data/example/list-projection-types.rb +0 -17
- data/example/list-units.rb +0 -17
- data/example/version.rb +0 -8
- data/ext/Makefile +0 -238
- data/ext/extconf.rb +0 -16
- data/ext/mkmf.log +0 -103
- data/ext/out.log +0 -0
- data/ext/proj4_ruby-x64-mingw32.def +0 -2
- data/ext/proj4_ruby.so +0 -0
- data/ext/projrb.c +0 -566
- data/ext/projrb.o +0 -0
- data/ext/vc/proj4_ruby.sln +0 -19
- data/ext/vc/proj4_ruby.vcproj +0 -208
- data/test/test_constants.rb +0 -18
- data/test/test_create_projection.rb +0 -63
- data/test/test_datums.rb +0 -45
- data/test/test_ellipsoids.rb +0 -46
- data/test/test_errors.rb +0 -66
- data/test/test_init_projection.rb +0 -109
- data/test/test_prime_meridians.rb +0 -45
- data/test/test_projection_type.rb +0 -44
- data/test/test_simple_projection.rb +0 -58
- data/test/test_suite.rb +0 -14
- data/test/test_transform.rb +0 -115
- data/test/test_units.rb +0 -46
data/ext/projrb.o
DELETED
Binary file
|
data/ext/vc/proj4_ruby.sln
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
Microsoft Visual Studio Solution File, Format Version 10.00
|
2
|
-
# Visual Studio 2008
|
3
|
-
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "proj4_ruby", "proj4_ruby.vcproj", "{DDB3E992-BF4B-4413-B061-288E40AECAD3}"
|
4
|
-
EndProject
|
5
|
-
Global
|
6
|
-
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
7
|
-
Debug|Win32 = Debug|Win32
|
8
|
-
Release|Win32 = Release|Win32
|
9
|
-
EndGlobalSection
|
10
|
-
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
11
|
-
{DDB3E992-BF4B-4413-B061-288E40AECAD3}.Debug|Win32.ActiveCfg = Debug|Win32
|
12
|
-
{DDB3E992-BF4B-4413-B061-288E40AECAD3}.Debug|Win32.Build.0 = Debug|Win32
|
13
|
-
{DDB3E992-BF4B-4413-B061-288E40AECAD3}.Release|Win32.ActiveCfg = Release|Win32
|
14
|
-
{DDB3E992-BF4B-4413-B061-288E40AECAD3}.Release|Win32.Build.0 = Release|Win32
|
15
|
-
EndGlobalSection
|
16
|
-
GlobalSection(SolutionProperties) = preSolution
|
17
|
-
HideSolutionNode = FALSE
|
18
|
-
EndGlobalSection
|
19
|
-
EndGlobal
|
data/ext/vc/proj4_ruby.vcproj
DELETED
@@ -1,208 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="Windows-1252"?>
|
2
|
-
<VisualStudioProject
|
3
|
-
ProjectType="Visual C++"
|
4
|
-
Version="9.00"
|
5
|
-
Name="proj4_ruby"
|
6
|
-
ProjectGUID="{DDB3E992-BF4B-4413-B061-288E40AECAD3}"
|
7
|
-
RootNamespace="proj4rb"
|
8
|
-
Keyword="Win32Proj"
|
9
|
-
TargetFrameworkVersion="131072"
|
10
|
-
>
|
11
|
-
<Platforms>
|
12
|
-
<Platform
|
13
|
-
Name="Win32"
|
14
|
-
/>
|
15
|
-
</Platforms>
|
16
|
-
<ToolFiles>
|
17
|
-
</ToolFiles>
|
18
|
-
<Configurations>
|
19
|
-
<Configuration
|
20
|
-
Name="Debug|Win32"
|
21
|
-
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
22
|
-
IntermediateDirectory="$(ConfigurationName)"
|
23
|
-
ConfigurationType="2"
|
24
|
-
CharacterSet="1"
|
25
|
-
>
|
26
|
-
<Tool
|
27
|
-
Name="VCPreBuildEventTool"
|
28
|
-
/>
|
29
|
-
<Tool
|
30
|
-
Name="VCCustomBuildTool"
|
31
|
-
/>
|
32
|
-
<Tool
|
33
|
-
Name="VCXMLDataGeneratorTool"
|
34
|
-
/>
|
35
|
-
<Tool
|
36
|
-
Name="VCWebServiceProxyGeneratorTool"
|
37
|
-
/>
|
38
|
-
<Tool
|
39
|
-
Name="VCMIDLTool"
|
40
|
-
/>
|
41
|
-
<Tool
|
42
|
-
Name="VCCLCompilerTool"
|
43
|
-
Optimization="0"
|
44
|
-
AdditionalIncludeDirectories=""C:\Development\ruby\lib\ruby\1.8\i386-mswin32";C:\Development\msys\local\include"
|
45
|
-
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;RUBYPROF_EXPORTS"
|
46
|
-
MinimalRebuild="true"
|
47
|
-
BasicRuntimeChecks="3"
|
48
|
-
RuntimeLibrary="3"
|
49
|
-
StructMemberAlignment="0"
|
50
|
-
UsePrecompiledHeader="0"
|
51
|
-
BrowseInformation="0"
|
52
|
-
WarningLevel="3"
|
53
|
-
Detect64BitPortabilityProblems="true"
|
54
|
-
DebugInformationFormat="4"
|
55
|
-
CallingConvention="0"
|
56
|
-
/>
|
57
|
-
<Tool
|
58
|
-
Name="VCManagedResourceCompilerTool"
|
59
|
-
/>
|
60
|
-
<Tool
|
61
|
-
Name="VCResourceCompilerTool"
|
62
|
-
/>
|
63
|
-
<Tool
|
64
|
-
Name="VCPreLinkEventTool"
|
65
|
-
/>
|
66
|
-
<Tool
|
67
|
-
Name="VCLinkerTool"
|
68
|
-
AdditionalDependencies="msvcrt-ruby18.lib libproj.lib"
|
69
|
-
OutputFile="C:\Development\ruby\lib\ruby\gems\1.8\gems\proj4rb-0.3.0-x86-mswin32-60\lib\$(ProjectName).so"
|
70
|
-
LinkIncremental="2"
|
71
|
-
AdditionalLibraryDirectories="C:\Development\msys\local\lib;C:\Development\ruby\lib"
|
72
|
-
ModuleDefinitionFile=""
|
73
|
-
GenerateDebugInformation="true"
|
74
|
-
SubSystem="2"
|
75
|
-
RandomizedBaseAddress="1"
|
76
|
-
DataExecutionPrevention="0"
|
77
|
-
TargetMachine="1"
|
78
|
-
/>
|
79
|
-
<Tool
|
80
|
-
Name="VCALinkTool"
|
81
|
-
/>
|
82
|
-
<Tool
|
83
|
-
Name="VCManifestTool"
|
84
|
-
/>
|
85
|
-
<Tool
|
86
|
-
Name="VCXDCMakeTool"
|
87
|
-
/>
|
88
|
-
<Tool
|
89
|
-
Name="VCBscMakeTool"
|
90
|
-
/>
|
91
|
-
<Tool
|
92
|
-
Name="VCFxCopTool"
|
93
|
-
/>
|
94
|
-
<Tool
|
95
|
-
Name="VCAppVerifierTool"
|
96
|
-
/>
|
97
|
-
<Tool
|
98
|
-
Name="VCPostBuildEventTool"
|
99
|
-
/>
|
100
|
-
</Configuration>
|
101
|
-
<Configuration
|
102
|
-
Name="Release|Win32"
|
103
|
-
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
|
104
|
-
IntermediateDirectory="$(ConfigurationName)"
|
105
|
-
ConfigurationType="2"
|
106
|
-
CharacterSet="1"
|
107
|
-
WholeProgramOptimization="1"
|
108
|
-
>
|
109
|
-
<Tool
|
110
|
-
Name="VCPreBuildEventTool"
|
111
|
-
/>
|
112
|
-
<Tool
|
113
|
-
Name="VCCustomBuildTool"
|
114
|
-
/>
|
115
|
-
<Tool
|
116
|
-
Name="VCXMLDataGeneratorTool"
|
117
|
-
/>
|
118
|
-
<Tool
|
119
|
-
Name="VCWebServiceProxyGeneratorTool"
|
120
|
-
/>
|
121
|
-
<Tool
|
122
|
-
Name="VCMIDLTool"
|
123
|
-
/>
|
124
|
-
<Tool
|
125
|
-
Name="VCCLCompilerTool"
|
126
|
-
AdditionalIncludeDirectories="C:\Development\ruby\lib\ruby\1.8\i386-mswin32"
|
127
|
-
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;RUBYPROF_EXPORTS"
|
128
|
-
RuntimeLibrary="2"
|
129
|
-
UsePrecompiledHeader="0"
|
130
|
-
WarningLevel="3"
|
131
|
-
Detect64BitPortabilityProblems="true"
|
132
|
-
DebugInformationFormat="3"
|
133
|
-
/>
|
134
|
-
<Tool
|
135
|
-
Name="VCManagedResourceCompilerTool"
|
136
|
-
/>
|
137
|
-
<Tool
|
138
|
-
Name="VCResourceCompilerTool"
|
139
|
-
/>
|
140
|
-
<Tool
|
141
|
-
Name="VCPreLinkEventTool"
|
142
|
-
/>
|
143
|
-
<Tool
|
144
|
-
Name="VCLinkerTool"
|
145
|
-
AdditionalDependencies="msvcrt-ruby18.lib"
|
146
|
-
OutputFile="$(OutDir)\$(ProjectName).so"
|
147
|
-
LinkIncremental="1"
|
148
|
-
AdditionalLibraryDirectories="C:\Development\ruby\lib"
|
149
|
-
GenerateDebugInformation="true"
|
150
|
-
SubSystem="2"
|
151
|
-
OptimizeReferences="2"
|
152
|
-
EnableCOMDATFolding="2"
|
153
|
-
RandomizedBaseAddress="1"
|
154
|
-
DataExecutionPrevention="0"
|
155
|
-
TargetMachine="1"
|
156
|
-
/>
|
157
|
-
<Tool
|
158
|
-
Name="VCALinkTool"
|
159
|
-
/>
|
160
|
-
<Tool
|
161
|
-
Name="VCManifestTool"
|
162
|
-
/>
|
163
|
-
<Tool
|
164
|
-
Name="VCXDCMakeTool"
|
165
|
-
/>
|
166
|
-
<Tool
|
167
|
-
Name="VCBscMakeTool"
|
168
|
-
/>
|
169
|
-
<Tool
|
170
|
-
Name="VCFxCopTool"
|
171
|
-
/>
|
172
|
-
<Tool
|
173
|
-
Name="VCAppVerifierTool"
|
174
|
-
/>
|
175
|
-
<Tool
|
176
|
-
Name="VCPostBuildEventTool"
|
177
|
-
/>
|
178
|
-
</Configuration>
|
179
|
-
</Configurations>
|
180
|
-
<References>
|
181
|
-
</References>
|
182
|
-
<Files>
|
183
|
-
<Filter
|
184
|
-
Name="Source Files"
|
185
|
-
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
186
|
-
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
|
187
|
-
>
|
188
|
-
<File
|
189
|
-
RelativePath="..\projrb.c"
|
190
|
-
>
|
191
|
-
</File>
|
192
|
-
</Filter>
|
193
|
-
<Filter
|
194
|
-
Name="Header Files"
|
195
|
-
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
196
|
-
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
|
197
|
-
>
|
198
|
-
</Filter>
|
199
|
-
<Filter
|
200
|
-
Name="Resource Files"
|
201
|
-
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
|
202
|
-
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
|
203
|
-
>
|
204
|
-
</Filter>
|
205
|
-
</Files>
|
206
|
-
<Globals>
|
207
|
-
</Globals>
|
208
|
-
</VisualStudioProject>
|
data/test/test_constants.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'proj4')
|
4
|
-
require 'minitest/autorun'
|
5
|
-
|
6
|
-
class ConstantsTest < Minitest::Test
|
7
|
-
def test_version
|
8
|
-
assert 440 < Proj4::LIBVERSION
|
9
|
-
end
|
10
|
-
|
11
|
-
def test_deg
|
12
|
-
assert_equal Math::PI/180, Proj4::DEG_TO_RAD
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_rad
|
16
|
-
assert_equal 180/Math::PI, Proj4::RAD_TO_DEG
|
17
|
-
end
|
18
|
-
end
|
@@ -1,63 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'proj4')
|
4
|
-
require 'minitest/autorun'
|
5
|
-
|
6
|
-
class CreateProjectionTest < Minitest::Test
|
7
|
-
def setup
|
8
|
-
@proj_wgs84 = Proj4::Projection.new(["init=epsg:4326"]) # WGS84
|
9
|
-
@proj_gk = Proj4::Projection.new(["init=epsg:31467"]) # Gauss-Kruger Zone 3
|
10
|
-
@proj_conakry = Proj4::Projection.new(["init=epsg:31528"]) # Conakry 1905 / UTM zone 28N
|
11
|
-
@proj_ortel = Proj4::Projection.new(["proj=ortel", "lon_0=90w"]) # Ortelius Oval Projection
|
12
|
-
end
|
13
|
-
|
14
|
-
def test_has_inverse
|
15
|
-
assert @proj_wgs84.hasInverse?
|
16
|
-
assert @proj_gk.hasInverse?
|
17
|
-
assert @proj_conakry.hasInverse?
|
18
|
-
assert ! @proj_ortel.hasInverse?
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_is_latlong
|
22
|
-
assert @proj_wgs84.isLatLong?
|
23
|
-
assert ! @proj_gk.isLatLong?
|
24
|
-
assert ! @proj_conakry.isLatLong?
|
25
|
-
assert ! @proj_ortel.isLatLong?
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_is_geocent
|
29
|
-
assert_equal @proj_gk.isGeocent?, @proj_gk.isGeocentric? # two names for same method
|
30
|
-
assert ! @proj_wgs84.isGeocent?
|
31
|
-
assert ! @proj_gk.isGeocent?
|
32
|
-
assert ! @proj_conakry.isGeocent?
|
33
|
-
assert ! @proj_ortel.isGeocent?
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_get_def
|
37
|
-
assert_equal '+init=epsg:4326 +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0', @proj_wgs84.getDef.strip
|
38
|
-
d = @proj_gk.getDef.strip
|
39
|
-
assert ('+init=epsg:31467 +proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0 +ellps=bessel +datum=potsdam +units=m +no_defs +towgs84=606.0,23.0,413.0' == d || '+init=epsg:31467 +proj=tmerc +lat_0=0 +lon_0=9 +k=1.000000 +x_0=3500000 +y_0=0 +ellps=bessel +datum=potsdam +units=m +no_defs +towgs84=606.0,23.0,413.0' == d)
|
40
|
-
assert_equal '+init=epsg:31528 +proj=utm +zone=28 +a=6378249.2 +b=6356515 +towgs84=-23,259,-9,0,0,0,0 +units=m +no_defs', @proj_conakry.getDef.strip
|
41
|
-
assert_equal '+proj=ortel +lon_0=90w +ellps=WGS84', @proj_ortel.getDef.strip
|
42
|
-
end
|
43
|
-
|
44
|
-
def test_inspect
|
45
|
-
assert_equal '#<Proj4::Projection +init=epsg:4326 +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0>', @proj_wgs84.to_s
|
46
|
-
assert_equal '#<Proj4::Projection +init=epsg:4326 +proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs +towgs84=0,0,0>', @proj_wgs84.inspect
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_projection
|
50
|
-
assert_equal 'longlat', @proj_wgs84.projection
|
51
|
-
assert_equal 'tmerc', @proj_gk.projection
|
52
|
-
assert_equal 'utm', @proj_conakry.projection
|
53
|
-
assert_equal 'ortel', @proj_ortel.projection
|
54
|
-
end
|
55
|
-
|
56
|
-
def test_datum
|
57
|
-
assert_equal 'WGS84', @proj_wgs84.datum
|
58
|
-
assert_equal 'potsdam', @proj_gk.datum
|
59
|
-
assert_nil @proj_conakry.datum
|
60
|
-
assert_nil @proj_ortel.datum
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
data/test/test_datums.rb
DELETED
@@ -1,45 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'proj4')
|
4
|
-
require 'minitest/autorun'
|
5
|
-
|
6
|
-
if Proj4::LIBVERSION >= 449
|
7
|
-
class DatumsTest < Minitest::Test
|
8
|
-
|
9
|
-
def test_get_all
|
10
|
-
datums = Proj4::Datum.list.sort.collect{ |u| u.id }
|
11
|
-
assert datums.index('WGS84')
|
12
|
-
assert datums.index('potsdam')
|
13
|
-
assert datums.index('ire65')
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_one
|
17
|
-
datum = Proj4::Datum.get('potsdam')
|
18
|
-
assert_kind_of Proj4::Datum, datum
|
19
|
-
assert_equal 'potsdam', datum.id
|
20
|
-
assert_equal 'potsdam', datum.to_s
|
21
|
-
assert_equal 'bessel', datum.ellipse_id
|
22
|
-
assert_equal 'towgs84=606.0,23.0,413.0', datum.defn
|
23
|
-
assert_equal 'Potsdam Rauenberg 1950 DHDN', datum.comments
|
24
|
-
assert_equal '#<Proj4::Datum id="potsdam", ellipse_id="bessel", defn="towgs84=606.0,23.0,413.0", comments="Potsdam Rauenberg 1950 DHDN">', datum.inspect
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_compare
|
28
|
-
u1 = Proj4::Datum.get('potsdam')
|
29
|
-
u2 = Proj4::Datum.get('potsdam')
|
30
|
-
assert u1 == u2
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_failed_get
|
34
|
-
datum = Proj4::Datum.get('foo')
|
35
|
-
assert_nil datum
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_new
|
39
|
-
assert_raise TypeError do
|
40
|
-
Proj4::Datum.new
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
end
|
data/test/test_ellipsoids.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'proj4')
|
4
|
-
require 'minitest/autorun'
|
5
|
-
|
6
|
-
if Proj4::LIBVERSION >= 449
|
7
|
-
class EllipsoidsTest < Minitest::Test
|
8
|
-
|
9
|
-
def test_get_all
|
10
|
-
ellipsoids = Proj4::Ellipsoid.list.sort.collect{ |u| u.id }
|
11
|
-
assert ellipsoids.index('WGS84')
|
12
|
-
assert ellipsoids.index('bessel')
|
13
|
-
assert ellipsoids.index('lerch')
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_one
|
17
|
-
ellipsoid = Proj4::Ellipsoid.get('bessel')
|
18
|
-
assert_kind_of Proj4::Ellipsoid, ellipsoid
|
19
|
-
assert_equal 'bessel', ellipsoid.id
|
20
|
-
assert_equal 'a=6377397.155', ellipsoid.major
|
21
|
-
assert_equal 'rf=299.1528128', ellipsoid.ell
|
22
|
-
assert_equal 'Bessel 1841', ellipsoid.name
|
23
|
-
assert_equal 'bessel', ellipsoid.to_s
|
24
|
-
assert_equal '#<Proj4::Ellipsoid id="bessel", major="a=6377397.155", ell="rf=299.1528128", name="Bessel 1841">', ellipsoid.inspect
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_compare
|
28
|
-
e1 = Proj4::Ellipsoid.get('bessel')
|
29
|
-
e2 = Proj4::Ellipsoid.get('bessel')
|
30
|
-
assert e1 == e2
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_failed_get
|
34
|
-
ellipsoid = Proj4::Ellipsoid.get('foo')
|
35
|
-
assert_nil ellipsoid
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_new
|
39
|
-
assert_raise TypeError do
|
40
|
-
Proj4::Ellipsoid.new
|
41
|
-
end
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|
45
|
-
end
|
46
|
-
|
data/test/test_errors.rb
DELETED
@@ -1,66 +0,0 @@
|
|
1
|
-
# encoding: UTF-8
|
2
|
-
|
3
|
-
require File.join(File.dirname(__FILE__), '..', 'lib', 'proj4')
|
4
|
-
require 'minitest/autorun'
|
5
|
-
|
6
|
-
class ErrorsTest < Minitest::Test
|
7
|
-
|
8
|
-
def test_list
|
9
|
-
assert_equal "Unknown", Proj4::Error.error(0)
|
10
|
-
assert_equal "NoOptionsInInitFile", Proj4::Error.error(2)
|
11
|
-
assert_equal "NoOptionsInInitFile", Proj4::Error.error(-2)
|
12
|
-
assert_equal "Unknown", Proj4::Error.error(-2000)
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_parenting
|
16
|
-
assert_kind_of Proj4::Error, Proj4::UnknownError.new
|
17
|
-
assert_kind_of Proj4::Error, Proj4::ToleranceConditionError.new
|
18
|
-
assert_kind_of StandardError, Proj4::UnknownError.new
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_num
|
22
|
-
assert 0, Proj4::UnknownError.errnum
|
23
|
-
assert 1, Proj4::NoArgsInInitListError.errnum
|
24
|
-
end
|
25
|
-
|
26
|
-
def test_raise
|
27
|
-
assert_raise Proj4::UnknownError do
|
28
|
-
Proj4::Error.raise_error(0)
|
29
|
-
end
|
30
|
-
assert_raise Proj4::NoOptionsInInitFileError do
|
31
|
-
Proj4::Error.raise_error(2)
|
32
|
-
end
|
33
|
-
assert_raise Proj4::ProjectionNotNamedError do
|
34
|
-
Proj4::Error.raise_error(-4)
|
35
|
-
end
|
36
|
-
assert_raise Proj4::UnknownError do
|
37
|
-
Proj4::Error.raise_error(2000)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_strerrno
|
42
|
-
assert_equal 'no arguments in initialization list', Proj4::Error.message(-1)
|
43
|
-
assert_equal 'reciprocal flattening (1/f) = 0', Proj4::Error.message(-10)
|
44
|
-
assert_equal 'unknown error', Proj4::Error.message(0)
|
45
|
-
assert_match /^invalid projection system error/, Proj4::Error.message(-2000)
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_raise_err0
|
49
|
-
exception = assert_raise(Proj4::UnknownError) do
|
50
|
-
Proj4::Error.raise_error(0)
|
51
|
-
end
|
52
|
-
assert_equal "unknown error", exception.message
|
53
|
-
assert_equal 0, exception.errnum
|
54
|
-
assert_match %r{test/test_errors.rb:[0-9]+:in .test_raise_err0.$} , exception.backtrace[0]
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_raise_err1
|
58
|
-
exception = assert_raise(Proj4::NoArgsInInitListError) do
|
59
|
-
Proj4::Error.raise_error(1)
|
60
|
-
end
|
61
|
-
assert_equal 'no arguments in initialization list', exception.message
|
62
|
-
assert_equal 1, exception.errnum
|
63
|
-
assert_match %r{test/test_errors.rb:[0-9]+:in .test_raise_err1.$} , exception.backtrace[0]
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|