ruby_mapnik 0.1.4 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +1 -0
- data/README.rdoc +7 -1
- data/ext/ruby_mapnik/_mapnik_map.rb.cpp +3 -1
- data/ext/ruby_mapnik/_mapnik_raster_symbolizer.rb.cpp +37 -3
- data/lib/mapnik.rb +1 -0
- data/lib/ruby_mapnik.rb +1 -1
- data/test/test_mapnik_raster_symbolizer.rb +10 -5
- metadata +11 -10
data/Manifest.txt
CHANGED
@@ -125,6 +125,7 @@ ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp
|
|
125
125
|
ext/ruby_mapnik/_mapnik_text_symbolizer.rb.h
|
126
126
|
ext/ruby_mapnik/extconf.rb
|
127
127
|
ext/ruby_mapnik/ruby_mapnik.cpp
|
128
|
+
lib/mapnik.rb
|
128
129
|
lib/ruby_mapnik.rb
|
129
130
|
lib/ruby_mapnik/mapnik/font_engine.rb
|
130
131
|
lib/ruby_mapnik/mapnik/layer.rb
|
data/README.rdoc
CHANGED
@@ -4,11 +4,17 @@ https://github.com/mapnik/Ruby-Mapnik
|
|
4
4
|
|
5
5
|
== Requirements
|
6
6
|
|
7
|
-
* Rake
|
7
|
+
* Rake (and extentiontask)
|
8
8
|
* Mapnik 2.x (Currently available at https://github.com/mapnik/mapnik)
|
9
9
|
* Rice >= 1.4.2
|
10
10
|
* rcairo (https://github.com/rcairo/rcairo) (Optional)
|
11
11
|
|
12
|
+
On OS X install ruby deps like:
|
13
|
+
|
14
|
+
sudo gem install rake-compiler
|
15
|
+
export ARCHFLAGS="-arch x86_64"
|
16
|
+
sudo bash -c 'ARCHFLAGS="-arch x86_64" gem install rice cairo'
|
17
|
+
|
12
18
|
== Description
|
13
19
|
|
14
20
|
A set of bindings between Ruby and Mapnik. Supports many of the common uses for
|
@@ -39,6 +39,7 @@ SOFTWARE.
|
|
39
39
|
#include <mapnik/load_map.hpp>
|
40
40
|
#include <mapnik/save_map.hpp>
|
41
41
|
|
42
|
+
#include <boost/optional.hpp>
|
42
43
|
|
43
44
|
// Seems like one could metaprogram these two away...
|
44
45
|
template<>
|
@@ -79,6 +80,7 @@ Rice::Object to_ruby<std::vector<mapnik::layer> >(std::vector<mapnik::layer> con
|
|
79
80
|
|
80
81
|
std::map<std::string,mapnik::feature_type_style> & (mapnik::Map::*_map_styles_)() = &mapnik::Map::styles;
|
81
82
|
std::vector<mapnik::layer> & (mapnik::Map::*_map_layers_)() = &mapnik::Map::layers;
|
83
|
+
boost::optional<mapnik::box2d<double> > const& (mapnik::Map::*maximum_extent_const)() const = &mapnik::Map::maximum_extent;
|
82
84
|
|
83
85
|
namespace {
|
84
86
|
|
@@ -269,7 +271,7 @@ void register_map(Rice::Module rb_mapnik){
|
|
269
271
|
* Document-method: maximum_extent
|
270
272
|
* @return [Mapnik::Envelope]
|
271
273
|
*/
|
272
|
-
rb_cmap.define_method("maximum_extent",
|
274
|
+
rb_cmap.define_method("maximum_extent", maximum_extent_const);
|
273
275
|
|
274
276
|
/*
|
275
277
|
* Document-method: maximum_extent=
|
@@ -28,10 +28,39 @@ SOFTWARE.
|
|
28
28
|
#include <rice/Enum.hpp>
|
29
29
|
|
30
30
|
// Mapnik
|
31
|
+
#include <mapnik/version.hpp>
|
31
32
|
#include <mapnik/raster_symbolizer.hpp>
|
32
33
|
|
34
|
+
#if MAPNIK_VERSION >= 200100
|
35
|
+
#include <mapnik/image_scaling.hpp>
|
36
|
+
#endif
|
37
|
+
|
33
38
|
void register_raster_symbolizer(Rice::Module rb_mapnik){
|
34
|
-
|
39
|
+
|
40
|
+
#if MAPNIK_VERSION >= 200100
|
41
|
+
Rice::Enum<mapnik::scaling_method_e> scaling_enum = Rice::define_enum<mapnik::scaling_method_e>("ScalingMethod", rb_mapnik);
|
42
|
+
|
43
|
+
scaling_enum.define_value("NEAR",mapnik::SCALING_NEAR);
|
44
|
+
scaling_enum.define_value("BILINEAR",mapnik::SCALING_BILINEAR);
|
45
|
+
scaling_enum.define_value("BICUBIC", mapnik::SCALING_BICUBIC);
|
46
|
+
scaling_enum.define_value("SPLINE16", mapnik::SCALING_SPLINE16);
|
47
|
+
scaling_enum.define_value("SPLINE36", mapnik::SCALING_SPLINE36);
|
48
|
+
scaling_enum.define_value("HANNING", mapnik::SCALING_HANNING);
|
49
|
+
scaling_enum.define_value("HAMMING", mapnik::SCALING_HAMMING);
|
50
|
+
scaling_enum.define_value("HERMITE", mapnik::SCALING_HERMITE);
|
51
|
+
scaling_enum.define_value("KAISER", mapnik::SCALING_KAISER);
|
52
|
+
scaling_enum.define_value("QUADRIC", mapnik::SCALING_QUADRIC);
|
53
|
+
scaling_enum.define_value("CATROM", mapnik::SCALING_CATROM);
|
54
|
+
scaling_enum.define_value("GAUSSIAN", mapnik::SCALING_GAUSSIAN);
|
55
|
+
scaling_enum.define_value("BESSEL", mapnik::SCALING_BESSEL);
|
56
|
+
scaling_enum.define_value("MITCHELL", mapnik::SCALING_MITCHELL);
|
57
|
+
scaling_enum.define_value("SINC", mapnik::SCALING_SINC);
|
58
|
+
scaling_enum.define_value("LANCZOS", mapnik::SCALING_LANCZOS);
|
59
|
+
scaling_enum.define_value("BLACKMAN", mapnik::SCALING_BLACKMAN);
|
60
|
+
scaling_enum.define_value("BILINEAR8", mapnik::SCALING_BILINEAR8);
|
61
|
+
#endif
|
62
|
+
|
63
|
+
/*
|
35
64
|
@@Module_var rb_mapnik = Mapnik
|
36
65
|
*/
|
37
66
|
Rice::Data_Type< mapnik::raster_symbolizer > rb_craster_symbolizer = Rice::define_class_under< mapnik::raster_symbolizer >(rb_mapnik, "RasterSymbolizer");
|
@@ -39,10 +68,15 @@ void register_raster_symbolizer(Rice::Module rb_mapnik){
|
|
39
68
|
|
40
69
|
rb_craster_symbolizer.define_method("mode", &mapnik::raster_symbolizer::get_mode);
|
41
70
|
rb_craster_symbolizer.define_method("mode=", &mapnik::raster_symbolizer::set_mode);
|
42
|
-
|
71
|
+
|
72
|
+
#if MAPNIK_VERSION >= 200100
|
73
|
+
rb_craster_symbolizer.define_method("scaling", &mapnik::raster_symbolizer::get_scaling_method);
|
74
|
+
rb_craster_symbolizer.define_method("scaling=", &mapnik::raster_symbolizer::set_scaling_method);
|
75
|
+
#else
|
43
76
|
rb_craster_symbolizer.define_method("scaling", &mapnik::raster_symbolizer::get_scaling);
|
44
77
|
rb_craster_symbolizer.define_method("scaling=", &mapnik::raster_symbolizer::set_scaling);
|
45
|
-
|
78
|
+
#endif
|
79
|
+
|
46
80
|
rb_craster_symbolizer.define_method("opacity", &mapnik::raster_symbolizer::get_opacity);
|
47
81
|
rb_craster_symbolizer.define_method("opacity=", &mapnik::raster_symbolizer::set_opacity);
|
48
82
|
|
data/lib/mapnik.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require File.join(path = File.expand_path(File.dirname(__FILE__)), 'ruby_mapnik')
|
data/lib/ruby_mapnik.rb
CHANGED
@@ -6,10 +6,15 @@ class TestMapnikRasterSymbolizer < Test::Unit::TestCase
|
|
6
6
|
@sym = Mapnik::RasterSymbolizer.new
|
7
7
|
end
|
8
8
|
|
9
|
-
def
|
10
|
-
|
9
|
+
def test_should_have_scaling_method
|
10
|
+
scaling_methods = [:NEAR, :BILINEAR, :BICUBIC,
|
11
|
+
:SPLINE16, :SPLINE36, :HANNING,
|
12
|
+
:HAMMING, :HERMITE, :KAISER, :QUADRIC,
|
13
|
+
:CATROM, :GAUSSIAN, :BESSEL, :MITCHELL,
|
14
|
+
:SINC, :LANCZOS, :BLACKMAN, :BILINEAR8]
|
15
|
+
assert_equal scaling_methods, Mapnik::ScalingMethod.constants
|
11
16
|
end
|
12
|
-
|
17
|
+
|
13
18
|
def test_should_get_and_set_mode
|
14
19
|
possible_values = ["normal", "grain_merge", "grain_merge2", "multiply",
|
15
20
|
"multiply2", "divide", "divide2", "screen", "hard_light"]
|
@@ -20,8 +25,8 @@ class TestMapnikRasterSymbolizer < Test::Unit::TestCase
|
|
20
25
|
end
|
21
26
|
|
22
27
|
def test_should_get_and_set_scaling
|
23
|
-
|
24
|
-
|
28
|
+
Mapnik::ScalingMethod.constants.each do |const_sym|
|
29
|
+
value = Mapnik::ScalingMethod.const_get(const_sym)
|
25
30
|
@sym.scaling = value
|
26
31
|
assert_equal value, @sym.scaling
|
27
32
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_mapnik
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-10 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rice
|
16
|
-
requirement: &
|
16
|
+
requirement: &2165892980 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.4.2
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2165892980
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: rake-compiler
|
27
|
-
requirement: &
|
27
|
+
requirement: &2165892440 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :development
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2165892440
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: chunky_png
|
38
|
-
requirement: &
|
38
|
+
requirement: &2165891900 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2165891900
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: hoe
|
49
|
-
requirement: &
|
49
|
+
requirement: &2165891360 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: '2.12'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2165891360
|
58
58
|
description: ! "A set of bindings between Ruby and Mapnik. Supports many of the common
|
59
59
|
uses for \nMapnik, and one day, might support all of them. Rendering is available
|
60
60
|
using\nthe standard AGG library, or additionally via Cairo, if the rcairo gem is
|
@@ -196,6 +196,7 @@ files:
|
|
196
196
|
- ext/ruby_mapnik/_mapnik_text_symbolizer.rb.h
|
197
197
|
- ext/ruby_mapnik/extconf.rb
|
198
198
|
- ext/ruby_mapnik/ruby_mapnik.cpp
|
199
|
+
- lib/mapnik.rb
|
199
200
|
- lib/ruby_mapnik.rb
|
200
201
|
- lib/ruby_mapnik/mapnik/font_engine.rb
|
201
202
|
- lib/ruby_mapnik/mapnik/layer.rb
|