mapfish 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
Binary file
@@ -0,0 +1,76 @@
1
+ require 'test/unit'
2
+ require 'rubygems'
3
+ require 'lib/geojson'
4
+ require 'active_support'
5
+
6
+ class GeojsonTest < Test::Unit::TestCase
7
+ include GeoRuby::SimpleFeatures
8
+ include ActiveSupport
9
+
10
+ def check_geom(geojson, expected)
11
+ geom=Geometry.from_geojson(geojson)
12
+ assert_equal(expected, geom)
13
+ assert_equal(JSON::decode(geojson),
14
+ JSON::decode(geom.to_json))
15
+ end
16
+
17
+ def test_point_from_hash
18
+ geom=Geometry.from_geojson(JSON::decode('{ "type": "Point", "coordinates": [100.0, 0.0] }'))
19
+ assert_equal(Point.from_coordinates([100.0, 0.0]), geom)
20
+ end
21
+
22
+ def test_point
23
+ check_geom('{ "type": "Point", "coordinates": [100.0, 0.0] }',
24
+ Point.from_coordinates([100.0, 0.0]))
25
+ end
26
+
27
+ def test_linestring
28
+ check_geom('{ "type": "LineString", "coordinates": [ [100.0, 0.0], [101.0, 1.0] ] }',
29
+ LineString.from_coordinates([ [100.0, 0.0], [101.0, 1.0] ]))
30
+ end
31
+
32
+ def test_polygon_no_hole
33
+ check_geom('{ "type": "Polygon", "coordinates": [ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] ] }',
34
+ Polygon.from_coordinates([ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ] ]))
35
+ end
36
+
37
+ def test_polygon_with_hole
38
+ check_geom('{ "type": "Polygon", "coordinates": [ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ], [ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2] ] ] }',
39
+ Polygon.from_coordinates([ [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0] ], [ [100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2] ] ]))
40
+ end
41
+
42
+ def test_multi_point
43
+ check_geom('{ "type": "MultiPoint", "coordinates": [ [100.0, 0.0], [101.0, 1.0] ] }',
44
+ MultiPoint.from_coordinates([ [100.0, 0.0], [101.0, 1.0] ]))
45
+ end
46
+
47
+ def test_multi_linestring
48
+ check_geom('{ "type": "MultiLineString", "coordinates": [ [ [100.0, 0.0], [101.0, 1.0] ], [ [102.0, 2.0], [103.0, 3.0] ] ] }',
49
+ MultiLineString.from_coordinates([ [ [100.0, 0.0], [101.0, 1.0] ], [ [102.0, 2.0], [103.0, 3.0] ] ]))
50
+ end
51
+
52
+ def test_multi_polygon_no_hole
53
+ check_geom('{ "type": "MultiPolygon", "coordinates": [ [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]], [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]] ] }',
54
+ MultiPolygon.from_coordinates([ [[[102.0, 2.0], [103.0, 2.0], [103.0, 3.0], [102.0, 3.0], [102.0, 2.0]]], [[[100.0, 0.0], [101.0, 0.0], [101.0, 1.0], [100.0, 1.0], [100.0, 0.0]], [[100.2, 0.2], [100.8, 0.2], [100.8, 0.8], [100.2, 0.8], [100.2, 0.2]]] ]))
55
+ end
56
+
57
+ def test_geometry_collection
58
+ check_geom('{ "type": "GeometryCollection", "geometries": [ { "type": "Point", "coordinates": [100.0, 0.0] }, { "type": "LineString", "coordinates": [ [101.0, 0.0], [102.0, 1.0] ] } ] }', GeometryCollection.from_geometries([Point.from_coordinates([100.0, 0.0]),
59
+ LineString.from_coordinates([ [101.0, 0.0], [102.0, 1.0] ])]))
60
+ end
61
+
62
+ def test_feature
63
+ check_geom('{ "type": "Feature", "geometry": {"type": "Point", "coordinates": [102.0, 0.5]}, "properties": {"prop0": "value0"} }',
64
+ Feature.new(Point.from_coordinates([102.0, 0.5]), {"prop0"=>"value0"}))
65
+ end
66
+
67
+ def test_feature_collection
68
+ check_geom('{"features": [{"type": "Feature", "geometry": {"type": "Point", "coordinates":[102.0, 0.5]}, "id": "toto", "properties": {"prop0": "value0"}}, {"type": "Feature", "geometry": {"type": "LineString", "coordinates": [[102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0]]}, "properties": {"prop0": "value0", "prop1": 0.0}}], "type": "FeatureCollection"}',
69
+ FeatureCollection.new([
70
+ Feature.new(Point.from_coordinates([102.0, 0.5]), {"prop0"=>"value0"}, "toto"),
71
+ Feature.new(LineString.from_coordinates([ [102.0, 0.0], [103.0, 1.0], [104.0, 0.0], [105.0, 1.0] ]), {"prop0"=>"value0", "prop1"=>0.0})
72
+ ])
73
+ )
74
+ end
75
+
76
+ end
data/uninstall.rb ADDED
@@ -0,0 +1 @@
1
+ # Uninstall hook code here
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: mapfish
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 1
7
+ - 3
8
+ - 0
9
+ version: 1.3.0
10
+ platform: ruby
11
+ authors:
12
+ - Pirmin Kalberer
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-06-18 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: spatial_adapter
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :runtime
31
+ version_requirements: *id001
32
+ - !ruby/object:Gem::Dependency
33
+ name: POpen4
34
+ prerelease: false
35
+ requirement: &id002 !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ segments:
40
+ - 0
41
+ - 1
42
+ - 5
43
+ version: 0.1.5
44
+ type: :runtime
45
+ version_requirements: *id002
46
+ description: "MapFish is a flexible and complete framework for building rich web-mapping applications. Homepage: mapfish.org"
47
+ email: pka@sourcepole.ch
48
+ executables: []
49
+
50
+ extensions: []
51
+
52
+ extra_rdoc_files: []
53
+
54
+ files:
55
+ - COPYING.LESSER
56
+ - README
57
+ - Rakefile
58
+ - VERSION
59
+ - generators/mapfish_resource/USAGE
60
+ - generators/mapfish_resource/mapfish_resource_generator.rb
61
+ - generators/mapfish_resource/templates/controller.rb
62
+ - generators/mapfish_resource/templates/functional_test.rb
63
+ - generators/mapfish_resource/templates/helper.rb
64
+ - generators/print_controller/USAGE
65
+ - generators/print_controller/print_controller_generator.rb
66
+ - generators/print_controller/templates/config.yaml
67
+ - generators/print_controller/templates/controller.rb
68
+ - generators/print_controller/templates/functional_test.rb
69
+ - generators/print_controller/templates/helper.rb
70
+ - generators/print_controller/templates/helper_test.rb
71
+ - init.rb
72
+ - install.rb
73
+ - lib/geojson.rb
74
+ - lib/mapfish.rb
75
+ - lib/mapfish_core_extensions/active_record/base.rb
76
+ - lib/mapfish_core_extensions/array.rb
77
+ - lib/print.rb
78
+ - lib/tasks/mapfish_tasks.rake
79
+ - mapfish.gemspec
80
+ - print/print-standalone.jar
81
+ - test/geojson_test.rb
82
+ - uninstall.rb
83
+ has_rdoc: true
84
+ homepage: http://mapfish.org/doc/implementations/rails.html
85
+ licenses: []
86
+
87
+ post_install_message:
88
+ rdoc_options:
89
+ - --charset=UTF-8
90
+ require_paths:
91
+ - lib
92
+ required_ruby_version: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ segments:
97
+ - 0
98
+ version: "0"
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ segments:
104
+ - 0
105
+ version: "0"
106
+ requirements: []
107
+
108
+ rubyforge_project:
109
+ rubygems_version: 1.3.6
110
+ signing_key:
111
+ specification_version: 3
112
+ summary: Mapfish server plugin for Ruby on Rails
113
+ test_files: []
114
+