mapnik 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- 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,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_LAYER
|
23
|
+
#define PIKA2_MAPNIK_LAYER
|
24
|
+
|
25
|
+
namespace Rice
|
26
|
+
{
|
27
|
+
class Module;
|
28
|
+
}
|
29
|
+
|
30
|
+
void register_layer(Rice::Module rb_mapnik);
|
31
|
+
|
32
|
+
#endif
|
@@ -0,0 +1,71 @@
|
|
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_line_pattern_symbolizer.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/parse_path.hpp>
|
31
|
+
#include <mapnik/line_pattern_symbolizer.hpp>
|
32
|
+
|
33
|
+
const std::string get_filename(mapnik::line_pattern_symbolizer const& t) {
|
34
|
+
return mapnik::path_processor_type::to_string(*t.get_filename());
|
35
|
+
}
|
36
|
+
|
37
|
+
void set_filename(mapnik::line_pattern_symbolizer & t, std::string const& file_expr) {
|
38
|
+
t.set_filename(mapnik::parse_path(file_expr));
|
39
|
+
}
|
40
|
+
|
41
|
+
void register_line_pattern_symbolizer(Rice::Module rb_mapnik){
|
42
|
+
/*
|
43
|
+
@@Module_var rb_mapnik = Mapnik
|
44
|
+
*/
|
45
|
+
Rice::Data_Type< mapnik::line_pattern_symbolizer > rb_cline_pattern_symbolizer = Rice::define_class_under< mapnik::line_pattern_symbolizer >(rb_mapnik, "LinePatternSymbolizer");
|
46
|
+
|
47
|
+
/*
|
48
|
+
* Document-method: new
|
49
|
+
* call-seq:
|
50
|
+
* new(expression)
|
51
|
+
* @param [Mapnik::Expression]
|
52
|
+
* @return [Mapnik::LinePatternSymbolizer] a new line symbolzier object
|
53
|
+
*/
|
54
|
+
rb_cline_pattern_symbolizer.define_constructor(Rice::Constructor< mapnik::line_pattern_symbolizer, mapnik::path_expression_ptr>());
|
55
|
+
|
56
|
+
/*
|
57
|
+
* Document-method: filename
|
58
|
+
* @return [Mapnik::PathExpression]
|
59
|
+
*/
|
60
|
+
rb_cline_pattern_symbolizer.define_method("filename", &get_filename);
|
61
|
+
|
62
|
+
/*
|
63
|
+
* Document-method: filename=
|
64
|
+
* call-seq:
|
65
|
+
* filename=(new_filename)
|
66
|
+
* @param [Mapnik::PathExpression]
|
67
|
+
* @return [nil]
|
68
|
+
*/
|
69
|
+
rb_cline_pattern_symbolizer.define_method("filename=", &set_filename);
|
70
|
+
|
71
|
+
}
|
@@ -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_LINE_PATTERN_SYMBOLIZER
|
23
|
+
#define PIKA2_MAPNIK_LINE_PATTERN_SYMBOLIZER
|
24
|
+
|
25
|
+
namespace Rice
|
26
|
+
{
|
27
|
+
class Module;
|
28
|
+
}
|
29
|
+
|
30
|
+
void register_line_pattern_symbolizer(Rice::Module rb_mapnik);
|
31
|
+
|
32
|
+
#endif
|
@@ -0,0 +1,43 @@
|
|
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_line_symbolizer.rb.h"
|
23
|
+
|
24
|
+
// Rice
|
25
|
+
#include <rice/Data_Type.hpp>
|
26
|
+
#include <rice/Constructor.hpp>
|
27
|
+
#include <rice/Class.hpp>
|
28
|
+
#include <rice/Enum.hpp>
|
29
|
+
|
30
|
+
// Mapnik
|
31
|
+
#include <mapnik/line_symbolizer.hpp>
|
32
|
+
|
33
|
+
void register_line_symbolizer(Rice::Module rb_mapnik){
|
34
|
+
/*
|
35
|
+
@@Module_var rb_mapnik = Mapnik
|
36
|
+
*/
|
37
|
+
Rice::Data_Type< mapnik::line_symbolizer > rb_cline_symbolizer = Rice::define_class_under< mapnik::line_symbolizer >(rb_mapnik, "LineSymbolizer");
|
38
|
+
rb_cline_symbolizer.define_constructor(Rice::Constructor< mapnik::line_symbolizer >());
|
39
|
+
|
40
|
+
rb_cline_symbolizer.define_method("stroke", &mapnik::line_symbolizer::get_stroke);
|
41
|
+
rb_cline_symbolizer.define_method("stroke=", &mapnik::line_symbolizer::set_stroke, Rice::Arg("new_stroke"));
|
42
|
+
|
43
|
+
}
|
@@ -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_LINE_SYMBOLIZER
|
23
|
+
#define PIKA2_MAPNIK_LINE_SYMBOLIZER
|
24
|
+
|
25
|
+
namespace Rice
|
26
|
+
{
|
27
|
+
class Module;
|
28
|
+
}
|
29
|
+
|
30
|
+
void register_line_symbolizer(Rice::Module rb_mapnik);
|
31
|
+
|
32
|
+
#endif
|
@@ -0,0 +1,489 @@
|
|
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_map.rb.h"
|
23
|
+
|
24
|
+
// Rice
|
25
|
+
#include <rice/Data_Type.hpp>
|
26
|
+
#include <rice/Constructor.hpp>
|
27
|
+
#include <rice/Class.hpp>
|
28
|
+
#include <rice/Hash.hpp>
|
29
|
+
#include <rice/Array.hpp>
|
30
|
+
|
31
|
+
// Mapnik
|
32
|
+
#include <mapnik/map.hpp>
|
33
|
+
#include <mapnik/version.hpp>
|
34
|
+
#include <mapnik/feature_type_style.hpp>
|
35
|
+
#include <mapnik/agg_renderer.hpp>
|
36
|
+
#include <mapnik/graphics.hpp>
|
37
|
+
#ifdef HAVE_CAIRO
|
38
|
+
#if MAPNIK_VERSION >= 200200
|
39
|
+
#include <mapnik/cairo_context.hpp>
|
40
|
+
#endif
|
41
|
+
#include <mapnik/cairo_renderer.hpp>
|
42
|
+
#endif
|
43
|
+
#include <mapnik/image_util.hpp>
|
44
|
+
#include <mapnik/load_map.hpp>
|
45
|
+
#include <mapnik/save_map.hpp>
|
46
|
+
|
47
|
+
#include <boost/optional.hpp>
|
48
|
+
|
49
|
+
// Seems like one could metaprogram these two away...
|
50
|
+
template<>
|
51
|
+
Rice::Object to_ruby<boost::optional<mapnik::color> >(boost::optional<mapnik::color> const & x){
|
52
|
+
if(x)
|
53
|
+
{
|
54
|
+
return to_ruby<mapnik::color>(x.get());
|
55
|
+
} else{
|
56
|
+
return Rice::Object();
|
57
|
+
}
|
58
|
+
}
|
59
|
+
|
60
|
+
template<>
|
61
|
+
Rice::Object to_ruby<boost::optional<mapnik::box2d<double> > >(boost::optional<mapnik::box2d<double> > const & x){
|
62
|
+
if(x)
|
63
|
+
{
|
64
|
+
return to_ruby<mapnik::box2d<double> >(x.get());
|
65
|
+
} else{
|
66
|
+
return Rice::Object();
|
67
|
+
}
|
68
|
+
}
|
69
|
+
|
70
|
+
template<>
|
71
|
+
Rice::Object to_ruby<std::map<std::string,mapnik::feature_type_style> >(std::map<std::string,mapnik::feature_type_style> const & x){
|
72
|
+
Rice::Hash h;
|
73
|
+
std::map<std::string,mapnik::feature_type_style>::const_iterator end = x.end();
|
74
|
+
for (std::map<std::string,mapnik::feature_type_style>::const_iterator it = x.begin(); it != end; ++it){
|
75
|
+
h[to_ruby<std::string>(it->first)] = to_ruby<mapnik::feature_type_style>(it->second);
|
76
|
+
}
|
77
|
+
return h;
|
78
|
+
}
|
79
|
+
|
80
|
+
template<>
|
81
|
+
Rice::Object to_ruby<std::vector<mapnik::layer> >(std::vector<mapnik::layer> const & x)
|
82
|
+
{
|
83
|
+
return Rice::Array(x.begin(), x.end());
|
84
|
+
}
|
85
|
+
|
86
|
+
std::map<std::string,mapnik::feature_type_style> & (mapnik::Map::*_map_styles_)() = &mapnik::Map::styles;
|
87
|
+
std::vector<mapnik::layer> & (mapnik::Map::*_map_layers_)() = &mapnik::Map::layers;
|
88
|
+
boost::optional<mapnik::box2d<double> > const& (mapnik::Map::*maximum_extent_const)() const = &mapnik::Map::maximum_extent;
|
89
|
+
|
90
|
+
namespace {
|
91
|
+
|
92
|
+
void render_map_to_file_with_format(const mapnik::Map& map, const std::string& filename, const std::string& format){
|
93
|
+
if (format == "pdf" || format == "svg" || format =="ps") {
|
94
|
+
#if defined(HAVE_CAIRO)
|
95
|
+
mapnik::save_to_cairo_file(map,filename,format);
|
96
|
+
#else
|
97
|
+
throw mapnik::ImageWriterException("Cairo backend not available, cannot write to format: " + format);
|
98
|
+
#endif
|
99
|
+
} else {
|
100
|
+
mapnik::image_32 image(map.width(),map.height());
|
101
|
+
mapnik::agg_renderer<mapnik::image_32> ren(map,image,1.0,0,0);
|
102
|
+
ren.apply();
|
103
|
+
mapnik::save_to_file(image,filename, format);
|
104
|
+
}
|
105
|
+
}
|
106
|
+
|
107
|
+
void render_map_to_file(const mapnik::Map& map, const std::string& filename){
|
108
|
+
render_map_to_file_with_format(map, filename, mapnik::guess_type(filename));
|
109
|
+
}
|
110
|
+
|
111
|
+
std::string render_map_to_string(const mapnik::Map& map, std::string const& format){
|
112
|
+
mapnik::image_32 image(map.width(),map.height());
|
113
|
+
mapnik::agg_renderer<mapnik::image_32> ren(map,image,1.0,0,0);
|
114
|
+
ren.apply();
|
115
|
+
return mapnik::save_to_string(image,format);
|
116
|
+
}
|
117
|
+
|
118
|
+
std::string map_to_string(const mapnik::Map& map){
|
119
|
+
return mapnik::save_map_to_string(map);
|
120
|
+
}
|
121
|
+
|
122
|
+
#if defined(HAVE_CAIRO)
|
123
|
+
|
124
|
+
// TODO: These are temporarily boosted from the ruby cairo gem...
|
125
|
+
cairo_surface_t * rb_cairo_surface_from_ruby_object (VALUE obj) {
|
126
|
+
cairo_surface_t *surface;
|
127
|
+
// if (!rb_cairo__is_kind_of (obj, rb_cCairo_Surface))
|
128
|
+
// {
|
129
|
+
// rb_raise (rb_eTypeError, "not a cairo surface");
|
130
|
+
// }
|
131
|
+
Data_Get_Struct (obj, cairo_surface_t, surface);
|
132
|
+
// if (!surface)
|
133
|
+
// rb_cairo_check_status (CAIRO_STATUS_NULL_POINTER);
|
134
|
+
return surface;
|
135
|
+
}
|
136
|
+
|
137
|
+
cairo_t * rb_cairo_context_from_ruby_object (VALUE obj) {
|
138
|
+
cairo_t *context;
|
139
|
+
// if (!rb_cairo__is_kind_of (obj, rb_cCairo_Surface))
|
140
|
+
// {
|
141
|
+
// rb_raise (rb_eTypeError, "not a cairo surface");
|
142
|
+
// }
|
143
|
+
Data_Get_Struct (obj, cairo_t, context);
|
144
|
+
// if (!surface)
|
145
|
+
// rb_cairo_check_status (CAIRO_STATUS_NULL_POINTER);
|
146
|
+
return context;
|
147
|
+
}
|
148
|
+
|
149
|
+
void render_to_cairo_surface(mapnik::Map const & map, Rice::Object rb_surface, unsigned offset_x = 0, unsigned offset_y = 0){
|
150
|
+
using namespace mapnik;
|
151
|
+
cairo_surface_t * surface = rb_cairo_surface_from_ruby_object(rb_surface);
|
152
|
+
#if MAPNIK_VERSION >= 200200
|
153
|
+
mapnik::cairo_surface_ptr surface_ref(cairo_surface_reference(surface), mapnik::cairo_surface_closer());
|
154
|
+
double scale_factor = 1.0;
|
155
|
+
mapnik::cairo_renderer<mapnik::cairo_surface_ptr> ren(map, surface_ref, scale_factor, offset_x, offset_y);
|
156
|
+
#else
|
157
|
+
Cairo::RefPtr<Cairo::Surface> s(new Cairo::Surface(surface));
|
158
|
+
mapnik::cairo_renderer<Cairo::Surface> ren(map,s,offset_x, offset_y);
|
159
|
+
#endif
|
160
|
+
ren.apply();
|
161
|
+
}
|
162
|
+
|
163
|
+
void render_to_cairo_context(mapnik::Map const & map, Rice::Object rb_context, unsigned offset_x = 0, unsigned offset_y = 0){
|
164
|
+
cairo_t * context = rb_cairo_context_from_ruby_object(rb_context);
|
165
|
+
#if MAPNIK_VERSION >= 200200
|
166
|
+
mapnik::cairo_ptr context_ref(context, mapnik::cairo_closer());
|
167
|
+
double scale_factor = 1.0;
|
168
|
+
mapnik::cairo_renderer<mapnik::cairo_ptr> ren(map, context_ref, scale_factor, offset_x, offset_y);
|
169
|
+
#else
|
170
|
+
Cairo::RefPtr<Cairo::Context> c(new Cairo::Context(context));
|
171
|
+
mapnik::cairo_renderer<Cairo::Context> ren(map, c, offset_x, offset_y);
|
172
|
+
ren.apply();
|
173
|
+
#endif
|
174
|
+
}
|
175
|
+
#endif
|
176
|
+
|
177
|
+
void initialize_map(Rice::Object self){
|
178
|
+
DATA_PTR(self.value()) = new mapnik::Map();
|
179
|
+
if(rb_block_given_p()) {
|
180
|
+
rb_yield(self);
|
181
|
+
}
|
182
|
+
}
|
183
|
+
|
184
|
+
}
|
185
|
+
|
186
|
+
void register_map(Rice::Module rb_mapnik){
|
187
|
+
/*
|
188
|
+
@@Module_var rb_mapnik = Mapnik
|
189
|
+
Document-class: Mapnik::Map
|
190
|
+
|
191
|
+
Maps are exactly what they sound like: the reason you are using mapnik. Maps
|
192
|
+
have layers, which wrap a datasource, and styles, which contain instructions
|
193
|
+
on how to render those layers.
|
194
|
+
|
195
|
+
Maps can be rendered to basic image formats (jpg, png), as well as to cairo
|
196
|
+
surfaces and contexts, if mapnik has been compiled with cairo support, and if
|
197
|
+
the rcairo gem is installed.
|
198
|
+
|
199
|
+
*/
|
200
|
+
Rice::Data_Type< mapnik::Map > rb_cmap = Rice::define_class_under< mapnik::Map >(rb_mapnik, "Map");
|
201
|
+
|
202
|
+
/*
|
203
|
+
* Document-method: new
|
204
|
+
* Instantiates a new map object. The map is yielded if a block is given.
|
205
|
+
* @return [Mapnik::Map] a new map object
|
206
|
+
* @yield [map] the new map object
|
207
|
+
|
208
|
+
*/
|
209
|
+
rb_cmap.define_constructor(Rice::Constructor< mapnik::Map >());
|
210
|
+
|
211
|
+
/*
|
212
|
+
* Dont-Document-method: __load_map_string__
|
213
|
+
*/
|
214
|
+
rb_cmap.define_singleton_method("__load_map_string__", &mapnik::load_map_string);
|
215
|
+
|
216
|
+
/*
|
217
|
+
* Dont-Document-method: __load_map__
|
218
|
+
*/
|
219
|
+
rb_cmap.define_singleton_method("__load_map__", &mapnik::load_map);
|
220
|
+
|
221
|
+
/*
|
222
|
+
* Dont-document-method: initialize
|
223
|
+
*/
|
224
|
+
rb_cmap.define_method("initialize", &initialize_map);
|
225
|
+
|
226
|
+
/*
|
227
|
+
* Document-method: background
|
228
|
+
* @return [Mapnik::Color]
|
229
|
+
*/
|
230
|
+
rb_cmap.define_method("background", &mapnik::Map::background);
|
231
|
+
|
232
|
+
/*
|
233
|
+
* Document-method: background=
|
234
|
+
* call-seq:
|
235
|
+
* background=(color)
|
236
|
+
* @param [Mapnik::Color]
|
237
|
+
* @return [nil]
|
238
|
+
*/
|
239
|
+
rb_cmap.define_method("background=", &mapnik::Map::set_background);
|
240
|
+
|
241
|
+
/*
|
242
|
+
* Document-method: base_path
|
243
|
+
* @return [String] The path all relative paths will be resolved with
|
244
|
+
*/
|
245
|
+
rb_cmap.define_method("base_path", &mapnik::Map::base_path);
|
246
|
+
|
247
|
+
/*
|
248
|
+
* Document-method: base_path=
|
249
|
+
* call-seq:
|
250
|
+
* base_path=(path)
|
251
|
+
* @param [String]
|
252
|
+
* @return [nil]
|
253
|
+
*/
|
254
|
+
rb_cmap.define_method("base_path=", &mapnik::Map::set_base_path);
|
255
|
+
|
256
|
+
/*
|
257
|
+
* Document-method: buffer_size
|
258
|
+
* @return [Integer]
|
259
|
+
*/
|
260
|
+
rb_cmap.define_method("buffer_size", &mapnik::Map::buffer_size);
|
261
|
+
|
262
|
+
/*
|
263
|
+
* Document-method: buffer_size=
|
264
|
+
* call-seq:
|
265
|
+
* buffer_size=(size)
|
266
|
+
* @param [Integer]
|
267
|
+
* @return [nil]
|
268
|
+
*/
|
269
|
+
rb_cmap.define_method("buffer_size=", &mapnik::Map::set_buffer_size);
|
270
|
+
|
271
|
+
/*
|
272
|
+
* Document-method: height
|
273
|
+
* The height of the rendered image in pixels.
|
274
|
+
* @return [Integer]
|
275
|
+
*/
|
276
|
+
rb_cmap.define_method("height", &mapnik::Map::height);
|
277
|
+
|
278
|
+
/*
|
279
|
+
* Document-method: height=
|
280
|
+
* call-seq:
|
281
|
+
* height=(height_in_pixels)
|
282
|
+
* Sets the height of the rendered image.
|
283
|
+
* @param [Integer] height_in_pixels
|
284
|
+
* @return [nil]
|
285
|
+
*/
|
286
|
+
rb_cmap.define_method("height=", &mapnik::Map::set_height);
|
287
|
+
|
288
|
+
/*
|
289
|
+
* Document-method: maximum_extent
|
290
|
+
* @return [Mapnik::Envelope]
|
291
|
+
*/
|
292
|
+
rb_cmap.define_method("maximum_extent", maximum_extent_const);
|
293
|
+
|
294
|
+
/*
|
295
|
+
* Document-method: maximum_extent=
|
296
|
+
* call-seq:
|
297
|
+
* maximum_extent=(new_extent)
|
298
|
+
* @param [Mapnik::Envelope] new_extent
|
299
|
+
* @return [nil]
|
300
|
+
*/
|
301
|
+
rb_cmap.define_method("maximum_extent=", &mapnik::Map::set_maximum_extent, Rice::Arg("new_extent"));
|
302
|
+
|
303
|
+
/*
|
304
|
+
* Document-method: srs
|
305
|
+
* The spatial reference system string for the map. It does not need to match
|
306
|
+
* the srs of any of the layers.
|
307
|
+
* @return [String]
|
308
|
+
*/
|
309
|
+
rb_cmap.define_method("srs", &mapnik::Map::srs);
|
310
|
+
|
311
|
+
/*
|
312
|
+
* Document-method: srs=
|
313
|
+
* call-seq:
|
314
|
+
* srs=(new_srs)
|
315
|
+
* Sets the spatial reference system that will be used to render the map. All
|
316
|
+
* layers will have thier data reprojected to this srs behind the scenes.
|
317
|
+
*
|
318
|
+
* @param [String]
|
319
|
+
* @return [nil]
|
320
|
+
*/
|
321
|
+
rb_cmap.define_method("srs=", &mapnik::Map::set_srs);
|
322
|
+
|
323
|
+
/*
|
324
|
+
* Document-method: width
|
325
|
+
* The width of the image in pixels.
|
326
|
+
* @return [Integer]
|
327
|
+
*/
|
328
|
+
rb_cmap.define_method("width", &mapnik::Map::width);
|
329
|
+
|
330
|
+
/*
|
331
|
+
* Document-method: width=
|
332
|
+
* call-seq:
|
333
|
+
* width=(new_width)
|
334
|
+
* Sets the width of the image.
|
335
|
+
* @param [Integer] new_width in pixels
|
336
|
+
* @return [nil]
|
337
|
+
*/
|
338
|
+
rb_cmap.define_method("width=", &mapnik::Map::set_width);
|
339
|
+
|
340
|
+
/*
|
341
|
+
* Document-method: envelope
|
342
|
+
* @return [Mapnik::Envelope]
|
343
|
+
*/
|
344
|
+
rb_cmap.define_method("envelope", &mapnik::Map::get_current_extent);
|
345
|
+
|
346
|
+
/*
|
347
|
+
* Document-method: buffered_envelope
|
348
|
+
* @return [Mapnik::Envelope]
|
349
|
+
* The envelope plus any buffer set in buffer_size
|
350
|
+
*/
|
351
|
+
rb_cmap.define_method("buffered_envelope", &mapnik::Map::get_buffered_extent);
|
352
|
+
|
353
|
+
/*
|
354
|
+
* Document-method: pan
|
355
|
+
* call-seq:
|
356
|
+
* pan(x, y)
|
357
|
+
* @param [Integer] x
|
358
|
+
* @param [Integer] y
|
359
|
+
* @return [nil]
|
360
|
+
*/
|
361
|
+
rb_cmap.define_method("pan", &mapnik::Map::pan);
|
362
|
+
|
363
|
+
/*
|
364
|
+
* Document-method: zoom
|
365
|
+
* call-seq:
|
366
|
+
* zoom(zoom_factor)
|
367
|
+
* @param [Integer] zoom_factor
|
368
|
+
* @return [nil]
|
369
|
+
*/
|
370
|
+
rb_cmap.define_method("zoom", &mapnik::Map::zoom);
|
371
|
+
|
372
|
+
/*
|
373
|
+
* Document-method: zoom_all
|
374
|
+
* Zooms the map so that all of the envelopes of the layers are visible.
|
375
|
+
* @return [nil]
|
376
|
+
*/
|
377
|
+
rb_cmap.define_method("zoom_all", &mapnik::Map::zoom_all);
|
378
|
+
|
379
|
+
/*
|
380
|
+
* Document-method: zoom_to_box
|
381
|
+
* call-seq:
|
382
|
+
* zoom_to_box(envelope)
|
383
|
+
* Zooms the map such that the envelope provided is all that will be rendered.
|
384
|
+
* The height and width of the map will stay the same, but the content will be
|
385
|
+
* zoomed.
|
386
|
+
* @param [Mapnik::Envelope] envelope
|
387
|
+
* @return [nil]
|
388
|
+
*/
|
389
|
+
rb_cmap.define_method("zoom_to_box", &mapnik::Map::zoom_to_box, Rice::Arg("envelope"));
|
390
|
+
|
391
|
+
/*
|
392
|
+
* Document-method: resize
|
393
|
+
* call-seq:
|
394
|
+
* resize(new_width, new_height)
|
395
|
+
* Resizes the height and width of the map in one step.
|
396
|
+
* @param [Integer] new_width in pixels
|
397
|
+
* @param [Integer] new_height in pixels
|
398
|
+
* @return [nil]
|
399
|
+
*/
|
400
|
+
rb_cmap.define_method("resize", &mapnik::Map::resize);
|
401
|
+
|
402
|
+
/*
|
403
|
+
* Document-method: scale
|
404
|
+
* @return [Float]
|
405
|
+
*/
|
406
|
+
rb_cmap.define_method("scale", &mapnik::Map::scale);
|
407
|
+
|
408
|
+
/*
|
409
|
+
* Dont-Document-method: __styles__
|
410
|
+
*/
|
411
|
+
rb_cmap.define_method("__styles__", _map_styles_);
|
412
|
+
|
413
|
+
/*
|
414
|
+
* Dont-Document-method: __insert_style__
|
415
|
+
*/
|
416
|
+
rb_cmap.define_method("__insert_style__", &mapnik::Map::insert_style);
|
417
|
+
|
418
|
+
/*
|
419
|
+
* Dont-Document-method: __remove_style__
|
420
|
+
*/
|
421
|
+
rb_cmap.define_method("__remove_style__", &mapnik::Map::remove_style);
|
422
|
+
|
423
|
+
/*
|
424
|
+
* Dont-Document-method: __layers__
|
425
|
+
*/
|
426
|
+
rb_cmap.define_method("__layers__", _map_layers_);
|
427
|
+
|
428
|
+
/*
|
429
|
+
* Dont-Document-method: __add_layer__
|
430
|
+
*/
|
431
|
+
rb_cmap.define_method("__add_layer__", &mapnik::Map::addLayer);
|
432
|
+
|
433
|
+
/*
|
434
|
+
* Dont-Document-method: __remove_layer__
|
435
|
+
*/
|
436
|
+
rb_cmap.define_method("__remove_layer__", &mapnik::Map::removeLayer);
|
437
|
+
|
438
|
+
/*
|
439
|
+
* Dont-Document-method: __render_to_file__
|
440
|
+
*/
|
441
|
+
rb_cmap.define_method("__render_to_file__", &render_map_to_file);
|
442
|
+
|
443
|
+
/*
|
444
|
+
* Dont-Document-method: __render_to_file_with_format__
|
445
|
+
*/
|
446
|
+
rb_cmap.define_method("__render_to_file_with_format__", &render_map_to_file_with_format);
|
447
|
+
|
448
|
+
/*
|
449
|
+
* Document-method: to_xml
|
450
|
+
* @return [String]
|
451
|
+
* An XML representation of the map that can be loaded via the from_xml method, or by other mapnik implementations
|
452
|
+
*/
|
453
|
+
rb_cmap.define_method("to_xml", &map_to_string);
|
454
|
+
|
455
|
+
/*
|
456
|
+
* Document-method: render_to_string
|
457
|
+
* call-seq:
|
458
|
+
* render_to_string(file_format)
|
459
|
+
* @param [String] file_format One of 'png', 'jpg' or 'tiff'
|
460
|
+
* @return [String] A string of the data for the image
|
461
|
+
*/
|
462
|
+
rb_cmap.define_method("render_to_string", &render_map_to_string);
|
463
|
+
|
464
|
+
#if defined(HAVE_CAIRO)
|
465
|
+
|
466
|
+
/*
|
467
|
+
* Document-method: render_to_cairo_surface
|
468
|
+
* call-seq:
|
469
|
+
* render_to_cairo_surface(cairo_surface)
|
470
|
+
* @param [Cairo::Surface]
|
471
|
+
* @return [nil]
|
472
|
+
* Only available if Ruby-Mapnik was compiled with Cairo support and the
|
473
|
+
* Ruby Cairo gem is available
|
474
|
+
*/
|
475
|
+
rb_cmap.define_method("render_to_cairo_surface", &render_to_cairo_surface);
|
476
|
+
|
477
|
+
/*
|
478
|
+
* Document-method: render_to_cairo_context
|
479
|
+
* call-seq:
|
480
|
+
* render_to_cairo_context(cairo_context)
|
481
|
+
* @param [Cairo::Context]
|
482
|
+
* @return [nil]
|
483
|
+
* Only available if Ruby-Mapnik was compiled with Cairo support and the
|
484
|
+
* Ruby Cairo gem is available
|
485
|
+
*/
|
486
|
+
rb_cmap.define_method("render_to_cairo_context", &render_to_cairo_context);
|
487
|
+
#endif
|
488
|
+
|
489
|
+
}
|