mapnik 0.2.0
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.
- data/.autotest +35 -0
- data/.yardopts +1 -0
- data/Gemfile +14 -0
- data/LICENSE +19 -0
- data/Manifest.txt +172 -0
- data/README.rdoc +107 -0
- data/Rakefile +43 -0
- data/demo/data/COPYRIGHT.txt +3 -0
- data/demo/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.dbf +0 -0
- data/demo/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.prj +1 -0
- data/demo/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.shp +0 -0
- data/demo/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.shx +0 -0
- data/demo/data/boundaries.dbf +0 -0
- data/demo/data/boundaries.prj +1 -0
- data/demo/data/boundaries.sbx +0 -0
- data/demo/data/boundaries.shp +0 -0
- data/demo/data/boundaries.shx +0 -0
- data/demo/data/boundaries_l.dbf +0 -0
- data/demo/data/boundaries_l.prj +1 -0
- data/demo/data/boundaries_l.sbx +0 -0
- data/demo/data/boundaries_l.shp +0 -0
- data/demo/data/boundaries_l.shx +0 -0
- data/demo/data/ontdrainage.dbf +0 -0
- data/demo/data/ontdrainage.prj +1 -0
- data/demo/data/ontdrainage.sbx +0 -0
- data/demo/data/ontdrainage.shp +0 -0
- data/demo/data/ontdrainage.shx +0 -0
- data/demo/data/popplaces.dbf +0 -0
- data/demo/data/popplaces.prj +1 -0
- data/demo/data/popplaces.sbx +0 -0
- data/demo/data/popplaces.shp +0 -0
- data/demo/data/popplaces.shx +0 -0
- data/demo/data/qcdrainage.dbf +0 -0
- data/demo/data/qcdrainage.prj +1 -0
- data/demo/data/qcdrainage.sbx +0 -0
- data/demo/data/qcdrainage.shp +0 -0
- data/demo/data/qcdrainage.shx +0 -0
- data/demo/data/roads.dbf +0 -0
- data/demo/data/roads.prj +1 -0
- data/demo/data/roads.sbx +0 -0
- data/demo/data/roads.shp +0 -0
- data/demo/data/roads.shx +0 -0
- data/demo/data/test/charplacement.dbf +0 -0
- data/demo/data/test/charplacement.shp +0 -0
- data/demo/data/test/charplacement.shx +0 -0
- data/demo/data/test/displacement.dbf +0 -0
- data/demo/data/test/displacement.shp +0 -0
- data/demo/data/test/displacement.shx +0 -0
- data/demo/data/test/overlap.dbf +0 -0
- data/demo/data/test/overlap.shp +0 -0
- data/demo/data/test/overlap.shx +0 -0
- data/demo/data/test/raw/charplacement.gfs +25 -0
- data/demo/data/test/raw/charplacement.gml +99 -0
- data/demo/data/test/raw/charplacement.xsd +36 -0
- data/demo/data/test/raw/displacement.gfs +25 -0
- data/demo/data/test/raw/displacement.gml +173 -0
- data/demo/data/test/raw/displacement.xsd +36 -0
- data/demo/data/test/raw/overlap.gfs +25 -0
- data/demo/data/test/raw/overlap.gml +127 -0
- data/demo/data/test/raw/overlap.xsd +36 -0
- data/demo/data/test/raw/textspacing.gfs +25 -0
- data/demo/data/test/raw/textspacing.gml +117 -0
- data/demo/data/test/raw/textspacing.xsd +36 -0
- data/demo/data/test/readme.txt +3 -0
- data/demo/data/test/regenerate.sh +20 -0
- data/demo/data/test/textspacing.dbf +0 -0
- data/demo/data/test/textspacing.shp +0 -0
- data/demo/data/test/textspacing.shx +0 -0
- data/demo/rundemo.rb +145 -0
- data/demo/sinatra/demo.rb +31 -0
- data/demo/sinatra/public/css/demo_map.css +7 -0
- data/demo/sinatra/public/index.html +13 -0
- data/demo/sinatra/public/javascripts/demo_map.js +42 -0
- data/ext/ruby_mapnik/_mapnik.cpp +52 -0
- data/ext/ruby_mapnik/_mapnik.h +65 -0
- data/ext/ruby_mapnik/_mapnik_color.rb.cpp +179 -0
- data/ext/ruby_mapnik/_mapnik_color.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_coord.rb.cpp +145 -0
- data/ext/ruby_mapnik/_mapnik_coord.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_datasource.rb.cpp +170 -0
- data/ext/ruby_mapnik/_mapnik_datasource.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_datasource_cache.rb.cpp +87 -0
- data/ext/ruby_mapnik/_mapnik_datasource_cache.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_envelope.rb.cpp +220 -0
- data/ext/ruby_mapnik/_mapnik_envelope.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_expression.rb.cpp +91 -0
- data/ext/ruby_mapnik/_mapnik_expression.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_feature.rb.cpp +93 -0
- data/ext/ruby_mapnik/_mapnik_feature.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_font_engine.rb.cpp +71 -0
- data/ext/ruby_mapnik/_mapnik_font_engine.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_layer.rb.cpp +208 -0
- data/ext/ruby_mapnik/_mapnik_layer.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_line_pattern_symbolizer.rb.cpp +71 -0
- data/ext/ruby_mapnik/_mapnik_line_pattern_symbolizer.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_line_symbolizer.rb.cpp +43 -0
- data/ext/ruby_mapnik/_mapnik_line_symbolizer.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_map.rb.cpp +489 -0
- data/ext/ruby_mapnik/_mapnik_map.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.cpp +140 -0
- data/ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_point_symbolizer.rb.cpp +150 -0
- data/ext/ruby_mapnik/_mapnik_point_symbolizer.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_polygon_pattern_symbolizer.rb.cpp +93 -0
- data/ext/ruby_mapnik/_mapnik_polygon_pattern_symbolizer.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_polygon_symbolizer.rb.cpp +89 -0
- data/ext/ruby_mapnik/_mapnik_polygon_symbolizer.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_projection.rb.cpp +100 -0
- data/ext/ruby_mapnik/_mapnik_projection.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_raster_colorizer.rb.cpp +162 -0
- data/ext/ruby_mapnik/_mapnik_raster_colorizer.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_raster_symbolizer.rb.cpp +87 -0
- data/ext/ruby_mapnik/_mapnik_raster_symbolizer.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_rule.rb.cpp +69 -0
- data/ext/ruby_mapnik/_mapnik_rule.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_shield_symbolizer.rb.cpp +86 -0
- data/ext/ruby_mapnik/_mapnik_shield_symbolizer.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_stroke.rb.cpp +188 -0
- data/ext/ruby_mapnik/_mapnik_stroke.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_style.rb.cpp +76 -0
- data/ext/ruby_mapnik/_mapnik_style.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_symbolizer.rb.cpp +75 -0
- data/ext/ruby_mapnik/_mapnik_symbolizer.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp +471 -0
- data/ext/ruby_mapnik/_mapnik_text_symbolizer.rb.h +32 -0
- data/ext/ruby_mapnik/extconf.rb +80 -0
- data/ext/ruby_mapnik/ruby_mapnik.cpp +32 -0
- data/lib/mapnik.rb +1 -0
- data/lib/ruby_mapnik.rb +48 -0
- data/lib/ruby_mapnik/mapnik/font_engine.rb +35 -0
- data/lib/ruby_mapnik/mapnik/layer.rb +68 -0
- data/lib/ruby_mapnik/mapnik/map.rb +166 -0
- data/lib/ruby_mapnik/mapnik/projection.rb +44 -0
- data/lib/ruby_mapnik/mapnik/raster_colorizer.rb +55 -0
- data/lib/ruby_mapnik/mapnik/rule.rb +104 -0
- data/lib/ruby_mapnik/mapnik/stroke.rb +56 -0
- data/lib/ruby_mapnik/mapnik/style.rb +64 -0
- data/lib/ruby_mapnik/mapnik/tile.rb +93 -0
- data/script/console +2 -0
- data/test/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.dbf +0 -0
- data/test/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.prj +1 -0
- data/test/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.shp +0 -0
- data/test/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.shx +0 -0
- data/test/data/test_map.xml +15 -0
- data/test/test_helper.rb +29 -0
- data/test/test_line_pattern_symbolizer.rb +26 -0
- data/test/test_mapnik_color.rb +66 -0
- data/test/test_mapnik_coord.rb +92 -0
- data/test/test_mapnik_datasource.rb +49 -0
- data/test/test_mapnik_envelope.rb +232 -0
- data/test/test_mapnik_expression.rb +19 -0
- data/test/test_mapnik_feature.rb +29 -0
- data/test/test_mapnik_font_engine.rb +13 -0
- data/test/test_mapnik_layer.rb +121 -0
- data/test/test_mapnik_line_symbolizer.rb +25 -0
- data/test/test_mapnik_map.rb +211 -0
- data/test/test_mapnik_markers_symbolizer.rb +46 -0
- data/test/test_mapnik_point_symbolizer.rb +53 -0
- data/test/test_mapnik_polygon_symbolizer.rb +44 -0
- data/test/test_mapnik_projection.rb +46 -0
- data/test/test_mapnik_raster_colorizer.rb +56 -0
- data/test/test_mapnik_raster_symbolizer.rb +45 -0
- data/test/test_mapnik_rule.rb +45 -0
- data/test/test_mapnik_shield_symbolizer.rb +156 -0
- data/test/test_mapnik_stroke.rb +94 -0
- data/test/test_mapnik_style.rb +28 -0
- data/test/test_mapnik_symbolizer.rb +9 -0
- data/test/test_mapnik_text_symbolizer.rb +208 -0
- data/test/test_polygon_pattern_symbolizer.rb +34 -0
- data/test/test_ruby_mapnik.rb +34 -0
- data/yard/lib/yard/parser/generic_parser.rb +72 -0
- data/yard/lib/yard_generic.rb +18 -0
- metadata +333 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
CURRENT_PATH = File.expand_path(File.dirname(__FILE__))
|
|
2
|
+
require 'rubygems'
|
|
3
|
+
require 'sinatra'
|
|
4
|
+
require File.join(CURRENT_PATH, '..', '..', 'lib', 'ruby_mapnik')
|
|
5
|
+
|
|
6
|
+
PATH = File.expand_path(File.dirname(__FILE__))
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
map = Mapnik::Map.new do |m|
|
|
10
|
+
|
|
11
|
+
m.background = Mapnik::Color.new('#777')
|
|
12
|
+
|
|
13
|
+
m.srs = Mapnik::Tile::DEFAULT_OUTPUT_PROJECTION
|
|
14
|
+
|
|
15
|
+
m.layer 'countries' do |l|
|
|
16
|
+
l.style do |s|
|
|
17
|
+
s.rule do |default|
|
|
18
|
+
default.fill = Mapnik::Color.new('#880000')
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
l.srs = "+proj=latlong +datum=WGS84"
|
|
22
|
+
l.datasource = Mapnik::Datasource.create :type => 'shape', :file => "#{PATH}/../data/TM_WORLD_BORDERS_SIMPL_0.3_MOD"
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
get '/tiles/:zoom/:x/:y.png' do
|
|
28
|
+
tile = Mapnik::Tile.new(params[:zoom], params[:x], params[:y])
|
|
29
|
+
content_type 'image/png', :disposition => 'inline'
|
|
30
|
+
tile.render_to_string(map)
|
|
31
|
+
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
3
|
+
<html>
|
|
4
|
+
<head>
|
|
5
|
+
<link rel="stylesheet" href="/css/demo_map.css" type="text/css" media="screen" charset="utf-8" />
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
<div id="map_canvas"></div>
|
|
9
|
+
<script src="http://maps.google.com/maps/api/js?sensor=false" type="text/javascript" charset="utf-8"></script>
|
|
10
|
+
<script src="javascripts/demo_map.js" type="text/javascript" charset="utf-8"></script>
|
|
11
|
+
</body>
|
|
12
|
+
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
function CoordMapType() {
|
|
2
|
+
}
|
|
3
|
+
|
|
4
|
+
CoordMapType.prototype.tileSize = new google.maps.Size(256,256);
|
|
5
|
+
CoordMapType.prototype.maxZoom = 19;
|
|
6
|
+
|
|
7
|
+
CoordMapType.prototype.getTile = function(coord, zoom, ownerDocument) {
|
|
8
|
+
var div = ownerDocument.createElement('DIV');
|
|
9
|
+
div.style.width = this.tileSize.width + 'px';
|
|
10
|
+
div.style.height = this.tileSize.height + 'px';
|
|
11
|
+
div.style.opacity = '1';
|
|
12
|
+
div.style.backgroundImage = 'url(http://localhost:4567/tiles/' + zoom + '/' + coord.x + '/' + coord.y + '.png)';
|
|
13
|
+
return div;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
CoordMapType.prototype.name = "Tile #s";
|
|
17
|
+
CoordMapType.prototype.alt = "Tile Coordinate Map Type";
|
|
18
|
+
|
|
19
|
+
var map;
|
|
20
|
+
var chicago = new google.maps.LatLng(41.850033,-87.6500523);
|
|
21
|
+
var coordinateMapType = new CoordMapType();
|
|
22
|
+
|
|
23
|
+
function initialize() {
|
|
24
|
+
var mapOptions = {
|
|
25
|
+
zoom: 10,
|
|
26
|
+
center: chicago// ,
|
|
27
|
+
// mapTypeId: google.maps.MapTypeId.ROADMAP
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
map = new google.maps.Map(document.getElementById("map_canvas"),
|
|
31
|
+
mapOptions);
|
|
32
|
+
|
|
33
|
+
// Now attach the coordinate map type to the map's registry
|
|
34
|
+
map.mapTypes.set('coordinate', coordinateMapType);
|
|
35
|
+
|
|
36
|
+
map.setMapTypeId('coordinate');
|
|
37
|
+
|
|
38
|
+
// We can now set the map to use the 'coordinate' map type
|
|
39
|
+
// map.overlayMapTypes.insertAt(0, new CoordMapType());
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
initialize();
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/*****************************************************************************
|
|
2
|
+
Copyright (C) 2011 Elliot Laster
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
+
this software and associated documentation files (the ‘Software’), to deal in
|
|
6
|
+
the Software without restriction, including without limitation the rights to
|
|
7
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
8
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
9
|
+
so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
|
21
|
+
*****************************************************************************/
|
|
22
|
+
#include "_mapnik.h"
|
|
23
|
+
|
|
24
|
+
void register_mapnik(){
|
|
25
|
+
Rice::Module rb_mapnik = Rice::define_module("Mapnik");
|
|
26
|
+
|
|
27
|
+
register_color(rb_mapnik);
|
|
28
|
+
register_coord(rb_mapnik);
|
|
29
|
+
register_datasource(rb_mapnik);
|
|
30
|
+
register_datasource_cache(rb_mapnik);
|
|
31
|
+
register_envelope(rb_mapnik);
|
|
32
|
+
register_feature(rb_mapnik);
|
|
33
|
+
register_polygon_symbolizer(rb_mapnik);
|
|
34
|
+
register_line_symbolizer(rb_mapnik);
|
|
35
|
+
register_stroke(rb_mapnik);
|
|
36
|
+
register_rule(rb_mapnik);
|
|
37
|
+
register_expression(rb_mapnik);
|
|
38
|
+
register_symbolizer(rb_mapnik);
|
|
39
|
+
register_style(rb_mapnik);
|
|
40
|
+
register_layer(rb_mapnik);
|
|
41
|
+
register_map(rb_mapnik);
|
|
42
|
+
register_projection(rb_mapnik);
|
|
43
|
+
register_text_symbolizer(rb_mapnik);
|
|
44
|
+
register_font_engine(rb_mapnik);
|
|
45
|
+
register_raster_symbolizer(rb_mapnik);
|
|
46
|
+
register_raster_colorizer(rb_mapnik);
|
|
47
|
+
register_point_symbolizer(rb_mapnik);
|
|
48
|
+
register_polygon_pattern_symbolizer(rb_mapnik);
|
|
49
|
+
register_line_pattern_symbolizer(rb_mapnik);
|
|
50
|
+
register_markers_symbolizer(rb_mapnik);
|
|
51
|
+
register_shield_symbolizer(rb_mapnik);
|
|
52
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/*****************************************************************************
|
|
2
|
+
Copyright (C) 2011 Elliot Laster
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
+
this software and associated documentation files (the ‘Software’), to deal in
|
|
6
|
+
the Software without restriction, including without limitation the rights to
|
|
7
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
8
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
9
|
+
so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
|
21
|
+
*****************************************************************************/
|
|
22
|
+
#ifndef mapnik_HPP
|
|
23
|
+
#define mapnik_HPP
|
|
24
|
+
|
|
25
|
+
// Rice
|
|
26
|
+
#include <rice/Enum.hpp>
|
|
27
|
+
#include <rice/Object.hpp>
|
|
28
|
+
#include <rice/Data_Type.hpp>
|
|
29
|
+
#include <rice/Data_Object.hpp>
|
|
30
|
+
#include <rice/Module.hpp>
|
|
31
|
+
#include <rice/Enum.hpp>
|
|
32
|
+
|
|
33
|
+
// Ruby Mapnik
|
|
34
|
+
#include "_mapnik_color.rb.h"
|
|
35
|
+
#include "_mapnik_coord.rb.h"
|
|
36
|
+
#include "_mapnik_datasource.rb.h"
|
|
37
|
+
#include "_mapnik_datasource_cache.rb.h"
|
|
38
|
+
#include "_mapnik_envelope.rb.h"
|
|
39
|
+
#include "_mapnik_feature.rb.h"
|
|
40
|
+
|
|
41
|
+
#include "_mapnik_polygon_symbolizer.rb.h"
|
|
42
|
+
#include "_mapnik_line_symbolizer.rb.h"
|
|
43
|
+
#include "_mapnik_stroke.rb.h"
|
|
44
|
+
#include "_mapnik_rule.rb.h"
|
|
45
|
+
|
|
46
|
+
#include "_mapnik_expression.rb.h"
|
|
47
|
+
#include "_mapnik_symbolizer.rb.h"
|
|
48
|
+
#include "_mapnik_style.rb.h"
|
|
49
|
+
#include "_mapnik_layer.rb.h"
|
|
50
|
+
#include "_mapnik_map.rb.h"
|
|
51
|
+
|
|
52
|
+
#include "_mapnik_projection.rb.h"
|
|
53
|
+
#include "_mapnik_text_symbolizer.rb.h"
|
|
54
|
+
#include "_mapnik_font_engine.rb.h"
|
|
55
|
+
#include "_mapnik_raster_symbolizer.rb.h"
|
|
56
|
+
#include "_mapnik_raster_colorizer.rb.h"
|
|
57
|
+
#include "_mapnik_point_symbolizer.rb.h"
|
|
58
|
+
#include "_mapnik_polygon_pattern_symbolizer.rb.h"
|
|
59
|
+
#include "_mapnik_line_pattern_symbolizer.rb.h"
|
|
60
|
+
#include "_mapnik_markers_symbolizer.rb.h"
|
|
61
|
+
#include "_mapnik_shield_symbolizer.rb.h"
|
|
62
|
+
|
|
63
|
+
void register_mapnik();
|
|
64
|
+
|
|
65
|
+
#endif
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
/*****************************************************************************
|
|
2
|
+
Copyright (C) 2011 Elliot Laster
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
+
this software and associated documentation files (the ‘Software’), to deal in
|
|
6
|
+
the Software without restriction, including without limitation the rights to
|
|
7
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
8
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
9
|
+
so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
|
21
|
+
*****************************************************************************/
|
|
22
|
+
|
|
23
|
+
#include "_mapnik_color.rb.h"
|
|
24
|
+
|
|
25
|
+
// Rice
|
|
26
|
+
#include <rice/Data_Type.hpp>
|
|
27
|
+
#include <rice/Constructor.hpp>
|
|
28
|
+
#include <rice/Class.hpp>
|
|
29
|
+
|
|
30
|
+
// Mapnik
|
|
31
|
+
#include <mapnik/color.hpp>
|
|
32
|
+
|
|
33
|
+
namespace {
|
|
34
|
+
bool check_color_equality(mapnik::color const & self, mapnik::color const & rhs){
|
|
35
|
+
return self == rhs;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// All this for optional constructor arguments. There must be a better way...
|
|
39
|
+
void initialize_color(Rice::Object self, Rice::Object arg1 = Rice::Object(), Rice::Object arg2 = Rice::Object(), Rice::Object arg3 = Rice::Object(), Rice::Object arg4 = Rice::Object()){
|
|
40
|
+
if(arg1.rb_type() == T_STRING && arg2.is_nil() && arg3.is_nil() && arg4.is_nil())
|
|
41
|
+
{
|
|
42
|
+
std::string hex = from_ruby<std::string>(arg1);
|
|
43
|
+
DATA_PTR(self.value()) = new mapnik::color(hex);
|
|
44
|
+
} else if(arg1.is_nil() && arg2.is_nil() && arg3.is_nil() && arg4.is_nil())
|
|
45
|
+
{
|
|
46
|
+
DATA_PTR(self.value()) = new mapnik::color();
|
|
47
|
+
} else if(arg1.rb_type() == T_FIXNUM && arg2.rb_type() == T_FIXNUM && arg3.rb_type() == T_FIXNUM && arg4.rb_type() == T_FIXNUM)
|
|
48
|
+
{
|
|
49
|
+
DATA_PTR(self.value()) = new mapnik::color((int)NUM2INT(arg1.value()), (int)NUM2INT(arg2.value()), (int)NUM2INT(arg3.value()), (int)NUM2INT(arg4.value()));
|
|
50
|
+
} else if(arg1.rb_type() == T_FIXNUM && arg2.rb_type() == T_FIXNUM && arg3.rb_type() == T_FIXNUM && arg4.is_nil())
|
|
51
|
+
{
|
|
52
|
+
DATA_PTR(self.value()) = new mapnik::color((int)NUM2INT(arg1.value()), (int)NUM2INT(arg2.value()), (int)NUM2INT(arg3.value()));
|
|
53
|
+
} else
|
|
54
|
+
{
|
|
55
|
+
rb_raise(rb_eRuntimeError, "Could not instantiate color");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
void register_color(Rice::Module rb_mapnik){
|
|
60
|
+
/*
|
|
61
|
+
@@Module_var rb_mapnik = Mapnik
|
|
62
|
+
*/
|
|
63
|
+
|
|
64
|
+
/*
|
|
65
|
+
* Document-class: Mapnik::Color
|
|
66
|
+
* A RGBA color.
|
|
67
|
+
*/
|
|
68
|
+
Rice::Data_Type< mapnik::color > rb_ccolor = Rice::define_class_under< mapnik::color >(rb_mapnik, "Color");
|
|
69
|
+
|
|
70
|
+
/*
|
|
71
|
+
* Document-method: new
|
|
72
|
+
* call-seq:
|
|
73
|
+
* new()
|
|
74
|
+
* new(red, green, blue)
|
|
75
|
+
* new(red, green, blues, alpha)
|
|
76
|
+
* new(css_string)
|
|
77
|
+
* @return [Mapnik::Color]
|
|
78
|
+
* Returns a new Color object. The first form returns a value of white
|
|
79
|
+
* (255, 255, 255, 255), the others set the values properly.
|
|
80
|
+
*
|
|
81
|
+
* The CSS String form
|
|
82
|
+
* should be of the format "#FF0000" (leading '#').
|
|
83
|
+
*/
|
|
84
|
+
rb_ccolor.define_constructor(Rice::Constructor< mapnik::color >());
|
|
85
|
+
|
|
86
|
+
rb_ccolor.define_method("initialize", &initialize_color, (Rice::Arg("arg1") = Rice::Object(), Rice::Arg("arg2") = Rice::Object(), Rice::Arg("arg3") = Rice::Object(), Rice::Arg("arg4") = Rice::Object()));
|
|
87
|
+
|
|
88
|
+
/*
|
|
89
|
+
* Document-method: red
|
|
90
|
+
* Returns the red value of the color as an integer value between 0 and 255
|
|
91
|
+
* @return [Integer]
|
|
92
|
+
*/
|
|
93
|
+
rb_ccolor.define_method("red", &mapnik::color::red);
|
|
94
|
+
|
|
95
|
+
/*
|
|
96
|
+
* Document-method: green
|
|
97
|
+
* Returns the green value of the color as an integer value between 0 and 255
|
|
98
|
+
* @return [Integer]
|
|
99
|
+
*/
|
|
100
|
+
rb_ccolor.define_method("green", &mapnik::color::green);
|
|
101
|
+
|
|
102
|
+
/*
|
|
103
|
+
* Document-method: blue
|
|
104
|
+
* Returns the blue value of the color as an integer value between 0 and 255
|
|
105
|
+
* @return [Integer]
|
|
106
|
+
*/
|
|
107
|
+
rb_ccolor.define_method("blue", &mapnik::color::blue);
|
|
108
|
+
|
|
109
|
+
/*
|
|
110
|
+
* Document-method: alpha
|
|
111
|
+
* Returns the alpha value of the color as an integer value between 0 and 255
|
|
112
|
+
* @return [Integer]
|
|
113
|
+
*/
|
|
114
|
+
rb_ccolor.define_method("alpha", &mapnik::color::alpha);
|
|
115
|
+
|
|
116
|
+
/*
|
|
117
|
+
* Document-method: red=
|
|
118
|
+
* call-seq:
|
|
119
|
+
* red=(value)
|
|
120
|
+
* @param [Integer] value between 0 and 255
|
|
121
|
+
* @return [nil]
|
|
122
|
+
* Sets the red value of the color
|
|
123
|
+
*/
|
|
124
|
+
rb_ccolor.define_method("red=", &mapnik::color::set_red, (Rice::Arg("value")));
|
|
125
|
+
|
|
126
|
+
/*
|
|
127
|
+
* Document-method: green=
|
|
128
|
+
* call-seq:
|
|
129
|
+
* green=(value)
|
|
130
|
+
* @param [Integer] value between 0 and 255
|
|
131
|
+
* @return [nil]
|
|
132
|
+
* Sets the green value of the color
|
|
133
|
+
*/
|
|
134
|
+
rb_ccolor.define_method("green=", &mapnik::color::set_green, (Rice::Arg("value")));
|
|
135
|
+
|
|
136
|
+
/*
|
|
137
|
+
* Document-method: blue=
|
|
138
|
+
* call-seq:
|
|
139
|
+
* blue=(value)
|
|
140
|
+
* @param [Integer] value between 0 and 255
|
|
141
|
+
* @return [nil]
|
|
142
|
+
* Sets the blue value of the color
|
|
143
|
+
*/
|
|
144
|
+
rb_ccolor.define_method("blue=", &mapnik::color::set_blue, (Rice::Arg("value")));
|
|
145
|
+
|
|
146
|
+
/*
|
|
147
|
+
* Document-method: alpha=
|
|
148
|
+
* call-seq:
|
|
149
|
+
* alpha=(value)
|
|
150
|
+
* @param [Integer] value between 0 and 255
|
|
151
|
+
* @return [nil]
|
|
152
|
+
* Sets the alpha value of the color
|
|
153
|
+
*/
|
|
154
|
+
rb_ccolor.define_method("alpha=", &mapnik::color::set_alpha, (Rice::Arg("value")));
|
|
155
|
+
|
|
156
|
+
/*
|
|
157
|
+
* Document-method: to_hex
|
|
158
|
+
* Returns a string with a CSS hex value representing the color
|
|
159
|
+
* @return [String] the CSS hex color string
|
|
160
|
+
*/
|
|
161
|
+
rb_ccolor.define_method("to_hex", &mapnik::color::to_hex_string);
|
|
162
|
+
|
|
163
|
+
/*
|
|
164
|
+
* Document-method: to_s
|
|
165
|
+
* Returns a string with rgb(a) values representing the color
|
|
166
|
+
* @return [String] RGBA values like so: "rgb(0,0,0)"
|
|
167
|
+
*/
|
|
168
|
+
rb_ccolor.define_method("to_s", &mapnik::color::to_string);
|
|
169
|
+
|
|
170
|
+
/*
|
|
171
|
+
* Document-method: ==
|
|
172
|
+
* call-seq:
|
|
173
|
+
* == another_color
|
|
174
|
+
* Returns true if the red, blue, green, and alpha values are equal for both colors
|
|
175
|
+
* @return [boolean]
|
|
176
|
+
*/
|
|
177
|
+
rb_ccolor.define_method("==", &check_color_equality);
|
|
178
|
+
|
|
179
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*****************************************************************************
|
|
2
|
+
Copyright (C) 2011 Elliot Laster
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
+
this software and associated documentation files (the ‘Software’), to deal in
|
|
6
|
+
the Software without restriction, including without limitation the rights to
|
|
7
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
8
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
9
|
+
so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
|
21
|
+
*****************************************************************************/
|
|
22
|
+
#ifndef PIKA2_MAPNIK_COLOR
|
|
23
|
+
#define PIKA2_MAPNIK_COLOR
|
|
24
|
+
|
|
25
|
+
namespace Rice
|
|
26
|
+
{
|
|
27
|
+
class Module;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
void register_color(Rice::Module rb_mapnik);
|
|
31
|
+
|
|
32
|
+
#endif
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
/*****************************************************************************
|
|
2
|
+
Copyright (C) 2011 Elliot Laster
|
|
3
|
+
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
5
|
+
this software and associated documentation files (the ‘Software’), to deal in
|
|
6
|
+
the Software without restriction, including without limitation the rights to
|
|
7
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
8
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
9
|
+
so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
|
21
|
+
*****************************************************************************/
|
|
22
|
+
#include "_mapnik_coord.rb.h"
|
|
23
|
+
|
|
24
|
+
// Rice
|
|
25
|
+
#include <rice/Data_Type.hpp>
|
|
26
|
+
#include <rice/Constructor.hpp>
|
|
27
|
+
#include <rice/Class.hpp>
|
|
28
|
+
|
|
29
|
+
// Mapnik
|
|
30
|
+
#include <mapnik/coord.hpp>
|
|
31
|
+
|
|
32
|
+
namespace {
|
|
33
|
+
void wrap_mapnik_coord_double__2__x_set(mapnik::coord2d* self, double val) {
|
|
34
|
+
self->x = val;
|
|
35
|
+
}
|
|
36
|
+
double wrap_mapnik_coord_double__2__x_get(mapnik::coord2d* self) {
|
|
37
|
+
return self->x;
|
|
38
|
+
}
|
|
39
|
+
void wrap_mapnik_coord_double__2__y_set(mapnik::coord2d* self, double val) {
|
|
40
|
+
self->y = val;
|
|
41
|
+
}
|
|
42
|
+
double wrap_mapnik_coord_double__2__y_get(mapnik::coord2d* self) {
|
|
43
|
+
return self->y;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
mapnik::coord2d wrap_mapnik_coord_double__2__times_equals(mapnik::coord2d self, float value){
|
|
47
|
+
return self *= value;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
mapnik::coord2d wrap_mapnik_coord_double__2__addition(mapnik::coord2d self, float value){
|
|
51
|
+
return self += value;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
mapnik::coord2d wrap_mapnik_coord_double__2__subtraction(mapnik::coord2d self, float value){
|
|
55
|
+
return self -= value;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
mapnik::coord2d wrap_mapnik_coord_double__2__division(mapnik::coord2d self, float value){
|
|
59
|
+
return self /= value;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
bool wrap_mapnik_coord_double__2__equality(mapnik::coord2d self, mapnik::coord2d rhs){
|
|
63
|
+
return self == rhs;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
void register_coord(Rice::Module rb_mapnik) {
|
|
67
|
+
/*
|
|
68
|
+
* @@Module_var rb_mapnik = Mapnik
|
|
69
|
+
*
|
|
70
|
+
* Document-class: Mapnik::Coord2d
|
|
71
|
+
* A two dimensional coordinate
|
|
72
|
+
*/
|
|
73
|
+
Rice::Data_Type< mapnik::coord2d > rb_ccoord2d = Rice::define_class_under< mapnik::coord2d >(rb_mapnik, "Coord2d");
|
|
74
|
+
|
|
75
|
+
/*
|
|
76
|
+
* Document-method: new
|
|
77
|
+
* call-seq:
|
|
78
|
+
* new(x,y)
|
|
79
|
+
* Returns a new Coord2d object
|
|
80
|
+
*/
|
|
81
|
+
rb_ccoord2d.define_constructor(Rice::Constructor< mapnik::coord2d,double,double >());
|
|
82
|
+
|
|
83
|
+
/*
|
|
84
|
+
* Document-method: x=
|
|
85
|
+
* @param [Float]
|
|
86
|
+
* Sets the x value of the coord
|
|
87
|
+
*/
|
|
88
|
+
rb_ccoord2d.define_method("x=", &wrap_mapnik_coord_double__2__x_set);
|
|
89
|
+
rb_ccoord2d.define_method("x", &wrap_mapnik_coord_double__2__x_get);
|
|
90
|
+
|
|
91
|
+
/*
|
|
92
|
+
* Document-method: y=
|
|
93
|
+
* @param [Float]
|
|
94
|
+
* Sets the y value of the coord
|
|
95
|
+
*/
|
|
96
|
+
rb_ccoord2d.define_method("y=", &wrap_mapnik_coord_double__2__y_set);
|
|
97
|
+
rb_ccoord2d.define_method("y", &wrap_mapnik_coord_double__2__y_get);
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
/*
|
|
101
|
+
* Document-method: *
|
|
102
|
+
* call-seq:
|
|
103
|
+
* * value
|
|
104
|
+
* @param [Float]
|
|
105
|
+
* Multiplies the x and y coordinates of the receiver by the value provided
|
|
106
|
+
*/
|
|
107
|
+
rb_ccoord2d.define_method("*", &wrap_mapnik_coord_double__2__times_equals, (Rice::Arg("value")));
|
|
108
|
+
|
|
109
|
+
/*
|
|
110
|
+
* Document-method: ==
|
|
111
|
+
* call-seq:
|
|
112
|
+
* ==(other_coord)
|
|
113
|
+
* @param [Mapnik::Coord2d]
|
|
114
|
+
* Returns true if the x and y values of other_coord equal those of the reciever
|
|
115
|
+
*/
|
|
116
|
+
rb_ccoord2d.define_method("==", &wrap_mapnik_coord_double__2__equality, (Rice::Arg("rhs")));
|
|
117
|
+
|
|
118
|
+
/*
|
|
119
|
+
* Document-method: +=
|
|
120
|
+
* call-seq:
|
|
121
|
+
* + value
|
|
122
|
+
* @param [Float]
|
|
123
|
+
* Adds the x and y coordinates of the receiver by the value provided
|
|
124
|
+
*/
|
|
125
|
+
rb_ccoord2d.define_method("+", &wrap_mapnik_coord_double__2__addition, (Rice::Arg("value")));
|
|
126
|
+
|
|
127
|
+
/*
|
|
128
|
+
* Document-method: -=
|
|
129
|
+
* call-seq:
|
|
130
|
+
* - value
|
|
131
|
+
* @param [Float]
|
|
132
|
+
* Subtracts the x and y coordinates of the receiver by the value provided
|
|
133
|
+
*/
|
|
134
|
+
rb_ccoord2d.define_method("-", &wrap_mapnik_coord_double__2__subtraction, (Rice::Arg("value")));
|
|
135
|
+
|
|
136
|
+
/*
|
|
137
|
+
* Document-method: /=
|
|
138
|
+
* call-seq:
|
|
139
|
+
* /=(value)
|
|
140
|
+
* @param [Float]
|
|
141
|
+
* Divides the x and y coordinates of the receiver by the value provided
|
|
142
|
+
*/
|
|
143
|
+
rb_ccoord2d.define_method("/", &wrap_mapnik_coord_double__2__division, (Rice::Arg("value")));
|
|
144
|
+
|
|
145
|
+
}
|