ruby_mapnik 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +35 -0
- data/.gemtest +0 -0
- data/.yardopts +1 -0
- data/Gemfile +12 -0
- data/LICENSE +19 -0
- data/Manifest.txt +177 -0
- data/README.rdoc +84 -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 +139 -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 +54 -0
- data/ext/ruby_mapnik/_mapnik.h +69 -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 +150 -0
- data/ext/ruby_mapnik/_mapnik_datasource.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_datasource_cache.rb.cpp +79 -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 +56 -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_geometry.rb.cpp +73 -0
- data/ext/ruby_mapnik/_mapnik_geometry.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_glyph_symbolizer.rb.cpp +250 -0
- data/ext/ruby_mapnik/_mapnik_glyph_symbolizer.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_layer.rb.cpp +237 -0
- data/ext/ruby_mapnik/_mapnik_layer.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_line_pattern_symbolizer.rb.cpp +70 -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 +435 -0
- data/ext/ruby_mapnik/_mapnik_map.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.cpp +139 -0
- data/ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_point_symbolizer.rb.cpp +147 -0
- data/ext/ruby_mapnik/_mapnik_point_symbolizer.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_polygon_pattern_symbolizer.rb.cpp +92 -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 +98 -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 +53 -0
- data/ext/ruby_mapnik/_mapnik_raster_symbolizer.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_rule.rb.cpp +99 -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 +77 -0
- data/ext/ruby_mapnik/_mapnik_symbolizer.rb.h +32 -0
- data/ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp +521 -0
- data/ext/ruby_mapnik/_mapnik_text_symbolizer.rb.h +32 -0
- data/ext/ruby_mapnik/extconf.rb +78 -0
- data/ext/ruby_mapnik/ruby_mapnik.cpp +31 -0
- data/lib/ruby_mapnik/mapnik/font_engine.rb +35 -0
- data/lib/ruby_mapnik/mapnik/layer.rb +69 -0
- data/lib/ruby_mapnik/mapnik/map.rb +144 -0
- data/lib/ruby_mapnik/mapnik/projection.rb +46 -0
- data/lib/ruby_mapnik/mapnik/raster_colorizer.rb +55 -0
- data/lib/ruby_mapnik/mapnik/rule.rb +107 -0
- data/lib/ruby_mapnik/mapnik/stroke.rb +58 -0
- data/lib/ruby_mapnik/mapnik/style.rb +66 -0
- data/lib/ruby_mapnik/mapnik/tile.rb +93 -0
- data/lib/ruby_mapnik.rb +48 -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 +27 -0
- data/test/test_line_pattern_symbolizer.rb +26 -0
- data/test/test_mapnik_color.rb +66 -0
- data/test/test_mapnik_coord.rb +112 -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 +33 -0
- data/test/test_mapnik_font_engine.rb +13 -0
- data/test/test_mapnik_geometry.rb +72 -0
- data/test/test_mapnik_glyph_symbolizer.rb +96 -0
- data/test/test_mapnik_layer.rb +137 -0
- data/test/test_mapnik_line_symbolizer.rb +25 -0
- data/test/test_mapnik_map.rb +191 -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 +40 -0
- data/test/test_mapnik_rule.rb +63 -0
- data/test/test_mapnik_shield_symbolizer.rb +193 -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 +232 -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 +322 -0
@@ -0,0 +1,147 @@
|
|
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_point_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/point_symbolizer.hpp>
|
32
|
+
|
33
|
+
namespace {
|
34
|
+
|
35
|
+
const std::string get_filename(mapnik::point_symbolizer const& t) {
|
36
|
+
return mapnik::path_processor_type::to_string(*t.get_filename());
|
37
|
+
}
|
38
|
+
|
39
|
+
void set_filename(mapnik::point_symbolizer & t, std::string const& file_expr) {
|
40
|
+
t.set_filename(mapnik::parse_path(file_expr));
|
41
|
+
}
|
42
|
+
|
43
|
+
const double get_point_opacity(mapnik::point_symbolizer const& t){
|
44
|
+
return t.get_opacity();
|
45
|
+
}
|
46
|
+
|
47
|
+
void set_point_opacity(mapnik::point_symbolizer & t, double value){
|
48
|
+
t.set_opacity(value);
|
49
|
+
}
|
50
|
+
|
51
|
+
mapnik::point_placement_enum get_placement(mapnik::point_symbolizer const& t){
|
52
|
+
return t.get_point_placement();
|
53
|
+
}
|
54
|
+
|
55
|
+
void set_placement(mapnik::point_symbolizer & t, mapnik::point_placement_enum value){
|
56
|
+
t.set_point_placement(value);
|
57
|
+
}
|
58
|
+
|
59
|
+
std::string get_point_transform_string(mapnik::point_symbolizer const& t){
|
60
|
+
return t.get_transform_string();
|
61
|
+
}
|
62
|
+
|
63
|
+
}
|
64
|
+
|
65
|
+
void register_point_symbolizer(Rice::Module rb_mapnik){
|
66
|
+
/*
|
67
|
+
@@Module_var rb_mapnik = Mapnik
|
68
|
+
*/
|
69
|
+
Rice::Enum<mapnik::point_placement_enum> placement_enum = Rice::define_enum<mapnik::point_placement_enum>("PointPlacement", rb_mapnik);
|
70
|
+
|
71
|
+
placement_enum.define_value("CENTROID",mapnik::CENTROID_POINT_PLACEMENT);
|
72
|
+
placement_enum.define_value("INTERIOR",mapnik::INTERIOR_POINT_PLACEMENT);
|
73
|
+
|
74
|
+
Rice::Data_Type< mapnik::point_symbolizer > rb_cpoint_symbolizer = Rice::define_class_under< mapnik::point_symbolizer >(rb_mapnik, "PointSymbolizer");
|
75
|
+
|
76
|
+
/*
|
77
|
+
* Document-method: new
|
78
|
+
* @return [Mapnik::PointSymbolizer]
|
79
|
+
*/
|
80
|
+
rb_cpoint_symbolizer.define_constructor(Rice::Constructor< mapnik::point_symbolizer >());
|
81
|
+
|
82
|
+
/*
|
83
|
+
* Document-method: filename
|
84
|
+
* @return [String]
|
85
|
+
*/
|
86
|
+
rb_cpoint_symbolizer.define_method("filename", &get_filename);
|
87
|
+
|
88
|
+
/* Document-method: filename=
|
89
|
+
* call-seq:
|
90
|
+
* filename=(new_filename)
|
91
|
+
* @param [String] filename
|
92
|
+
* @return [nil]
|
93
|
+
*/
|
94
|
+
rb_cpoint_symbolizer.define_method("filename=", &set_filename);
|
95
|
+
|
96
|
+
/*
|
97
|
+
* Document-method: allow_overlap?
|
98
|
+
* @return [Boolean]
|
99
|
+
*/
|
100
|
+
rb_cpoint_symbolizer.define_method("allows_overlap?", &mapnik::point_symbolizer::get_allow_overlap);
|
101
|
+
|
102
|
+
/*
|
103
|
+
* Document-method: allow_overlap=
|
104
|
+
* call-seq:
|
105
|
+
* allow_overlap=(new_value)
|
106
|
+
* @param [Boolean] new_value
|
107
|
+
* @return [nil]
|
108
|
+
*/
|
109
|
+
rb_cpoint_symbolizer.define_method("allows_overlap=", &mapnik::point_symbolizer::set_allow_overlap);
|
110
|
+
|
111
|
+
/*
|
112
|
+
* Document-method: opacity
|
113
|
+
* @return [Float]
|
114
|
+
*/
|
115
|
+
rb_cpoint_symbolizer.define_method("opacity", &get_point_opacity);
|
116
|
+
|
117
|
+
/*
|
118
|
+
* Document-method: opacity=
|
119
|
+
* call-seq:
|
120
|
+
* opacity=(new_value)
|
121
|
+
* @param [Float]
|
122
|
+
* @return [nil]
|
123
|
+
*/
|
124
|
+
rb_cpoint_symbolizer.define_method("opacity=", &set_point_opacity);
|
125
|
+
|
126
|
+
/*
|
127
|
+
* Document-method: ignores_placement?
|
128
|
+
* @return [Boolean]
|
129
|
+
*/
|
130
|
+
rb_cpoint_symbolizer.define_method("ignores_placement?", &mapnik::point_symbolizer::get_ignore_placement);
|
131
|
+
|
132
|
+
/*
|
133
|
+
* Document-method: ignores_placement=
|
134
|
+
* call-seq:
|
135
|
+
* ignores_placement=(new_value)
|
136
|
+
* @param [Boolean] new_value
|
137
|
+
*/
|
138
|
+
rb_cpoint_symbolizer.define_method("ignores_placement=", &mapnik::point_symbolizer::set_ignore_placement);
|
139
|
+
|
140
|
+
rb_cpoint_symbolizer.define_method("placement", &get_placement);
|
141
|
+
rb_cpoint_symbolizer.define_method("placement=", &set_placement);
|
142
|
+
|
143
|
+
// TODO:
|
144
|
+
// rb_cpoint_symbolizer.define_method("transform", &get_point_transform_string);
|
145
|
+
// // rb_cpoint_symbolizer.define_method("transform=", &set_point_transform_string);
|
146
|
+
|
147
|
+
}
|
@@ -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_POINT_SYMBOLIZER
|
23
|
+
#define PIKA2_MAPNIK_POINT_SYMBOLIZER
|
24
|
+
|
25
|
+
namespace Rice
|
26
|
+
{
|
27
|
+
class Module;
|
28
|
+
}
|
29
|
+
|
30
|
+
void register_point_symbolizer(Rice::Module rb_mapnik);
|
31
|
+
|
32
|
+
#endif
|
@@ -0,0 +1,92 @@
|
|
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_polygon_pattern_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/polygon_pattern_symbolizer.hpp>
|
32
|
+
|
33
|
+
namespace {
|
34
|
+
|
35
|
+
const std::string get_filename(mapnik::polygon_pattern_symbolizer const& t) {
|
36
|
+
return mapnik::path_processor_type::to_string(*t.get_filename());
|
37
|
+
}
|
38
|
+
|
39
|
+
void set_filename(mapnik::polygon_pattern_symbolizer & t, std::string const& file_expr) {
|
40
|
+
t.set_filename(mapnik::parse_path(file_expr));
|
41
|
+
}
|
42
|
+
|
43
|
+
mapnik::pattern_alignment_enum get_alignment(mapnik::polygon_pattern_symbolizer const& t){
|
44
|
+
return t.get_alignment();
|
45
|
+
}
|
46
|
+
|
47
|
+
void set_alignment(mapnik::polygon_pattern_symbolizer & t, mapnik::pattern_alignment_enum value){
|
48
|
+
t.set_alignment(value);
|
49
|
+
}
|
50
|
+
|
51
|
+
}
|
52
|
+
|
53
|
+
void register_polygon_pattern_symbolizer(Rice::Module rb_mapnik){
|
54
|
+
/*
|
55
|
+
@@Module_var rb_mapnik = Mapnik
|
56
|
+
*/
|
57
|
+
Rice::Enum<mapnik::pattern_alignment_enum> alignment_enum = Rice::define_enum<mapnik::pattern_alignment_enum>("PatternAlignment", rb_mapnik);
|
58
|
+
|
59
|
+
alignment_enum.define_value("LOCAL",mapnik::LOCAL_ALIGNMENT);
|
60
|
+
alignment_enum.define_value("GLOBAL",mapnik::GLOBAL_ALIGNMENT);
|
61
|
+
|
62
|
+
|
63
|
+
Rice::Data_Type< mapnik::polygon_pattern_symbolizer > rb_cpolygon_pattern_symbolizer = Rice::define_class_under< mapnik::polygon_pattern_symbolizer >(rb_mapnik, "PolygonPatternSymbolizer");
|
64
|
+
|
65
|
+
/*
|
66
|
+
* Document-method: new
|
67
|
+
* call-seq:
|
68
|
+
* new(path_expression)
|
69
|
+
* @param [Mapnik::PathExpression] path_expression file to pattern
|
70
|
+
* @return [Mapnik::PolygonPatternSymbolizer]
|
71
|
+
*/
|
72
|
+
rb_cpolygon_pattern_symbolizer.define_constructor(Rice::Constructor< mapnik::polygon_pattern_symbolizer, mapnik::path_expression_ptr>());
|
73
|
+
|
74
|
+
/*
|
75
|
+
* Document-method: filename
|
76
|
+
* @return [String]
|
77
|
+
*/
|
78
|
+
rb_cpolygon_pattern_symbolizer.define_method("filename", &get_filename);
|
79
|
+
|
80
|
+
/*
|
81
|
+
* Document-method: filename=
|
82
|
+
* call-seq:
|
83
|
+
* filename=(new_filename)
|
84
|
+
* @param [String] new_filename
|
85
|
+
* @return [nil]
|
86
|
+
*/
|
87
|
+
rb_cpolygon_pattern_symbolizer.define_method("filename=", &set_filename);
|
88
|
+
|
89
|
+
rb_cpolygon_pattern_symbolizer.define_method("alignment", &get_alignment);
|
90
|
+
rb_cpolygon_pattern_symbolizer.define_method("alignment=", &set_alignment);
|
91
|
+
|
92
|
+
}
|
@@ -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_POLYGON_PATTERN_SYMBOLIZER
|
23
|
+
#define PIKA2_MAPNIK_POLYGON_PATTERN_SYMBOLIZER
|
24
|
+
|
25
|
+
namespace Rice
|
26
|
+
{
|
27
|
+
class Module;
|
28
|
+
}
|
29
|
+
|
30
|
+
void register_polygon_pattern_symbolizer(Rice::Module rb_mapnik);
|
31
|
+
|
32
|
+
#endif
|
@@ -0,0 +1,89 @@
|
|
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_polygon_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/polygon_symbolizer.hpp>
|
32
|
+
#include <mapnik/rule.hpp>
|
33
|
+
|
34
|
+
void register_polygon_symbolizer(Rice::Module rb_mapnik){
|
35
|
+
/*
|
36
|
+
@@Module_var rb_mapnik = Mapnik
|
37
|
+
*/
|
38
|
+
Rice::Data_Type< mapnik::polygon_symbolizer > rb_cpolygon_symbolizer = Rice::define_class_under< mapnik::polygon_symbolizer >(rb_mapnik, "PolygonSymbolizer");
|
39
|
+
|
40
|
+
/*
|
41
|
+
* Document-method: new
|
42
|
+
* @return [Mapnik::PolygonSymbolzer]
|
43
|
+
*/
|
44
|
+
rb_cpolygon_symbolizer.define_constructor(Rice::Constructor< mapnik::polygon_symbolizer >());
|
45
|
+
|
46
|
+
/*
|
47
|
+
* Document-method: fill
|
48
|
+
* @return [Mapnik::Color]
|
49
|
+
*/
|
50
|
+
rb_cpolygon_symbolizer.define_method("fill", &mapnik::polygon_symbolizer::get_fill);
|
51
|
+
|
52
|
+
/*
|
53
|
+
* Document-method: fill=
|
54
|
+
* call-seq:
|
55
|
+
* fill=(color)
|
56
|
+
* @param [Mapnik::Color] color
|
57
|
+
* @return [nil]
|
58
|
+
*/
|
59
|
+
rb_cpolygon_symbolizer.define_method("fill=", &mapnik::polygon_symbolizer::set_fill, Rice::Arg("new_color"));
|
60
|
+
|
61
|
+
/*
|
62
|
+
* Document-method: opacity
|
63
|
+
* @return [Float]
|
64
|
+
*/
|
65
|
+
rb_cpolygon_symbolizer.define_method("opacity", &mapnik::polygon_symbolizer::get_opacity);
|
66
|
+
|
67
|
+
/* Document-method: opacity=
|
68
|
+
* call-seq:
|
69
|
+
* opacity=(new_value)
|
70
|
+
* @param [Float]
|
71
|
+
* @return [nil]
|
72
|
+
*/
|
73
|
+
rb_cpolygon_symbolizer.define_method("opacity=", &mapnik::polygon_symbolizer::set_opacity, Rice::Arg("new_opacity"));
|
74
|
+
|
75
|
+
/*
|
76
|
+
* Document-method: gamma
|
77
|
+
* @return [Float]
|
78
|
+
*/
|
79
|
+
rb_cpolygon_symbolizer.define_method("gamma", &mapnik::polygon_symbolizer::get_gamma);
|
80
|
+
|
81
|
+
/* Document-method: gamma=
|
82
|
+
* call-seq:
|
83
|
+
* gamma=(new_value)
|
84
|
+
* @param [Float]
|
85
|
+
* @return [nil]
|
86
|
+
*/
|
87
|
+
rb_cpolygon_symbolizer.define_method("gamma=", &mapnik::polygon_symbolizer::set_gamma, Rice::Arg("new_gamma"));
|
88
|
+
|
89
|
+
};
|
@@ -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_POLYGON_SYMBOLIZER
|
23
|
+
#define PIKA2_MAPNIK_POLYGON_SYMBOLIZER
|
24
|
+
|
25
|
+
namespace Rice
|
26
|
+
{
|
27
|
+
class Module;
|
28
|
+
}
|
29
|
+
|
30
|
+
void register_polygon_symbolizer(Rice::Module rb_mapnik);
|
31
|
+
|
32
|
+
#endif
|
@@ -0,0 +1,98 @@
|
|
1
|
+
#include "_mapnik_projection.rb.h"
|
2
|
+
|
3
|
+
// Rice
|
4
|
+
#include <rice/Data_Type.hpp>
|
5
|
+
#include <rice/Constructor.hpp>
|
6
|
+
#include <rice/Class.hpp>
|
7
|
+
|
8
|
+
// Mapnik
|
9
|
+
#include <mapnik/projection.hpp>
|
10
|
+
|
11
|
+
namespace {
|
12
|
+
|
13
|
+
mapnik::coord2d forward_pt(mapnik::projection const& prj, mapnik::coord2d const& pt)
|
14
|
+
{
|
15
|
+
double x = pt.x;
|
16
|
+
double y = pt.y;
|
17
|
+
prj.forward(x,y);
|
18
|
+
return mapnik::coord2d(x,y);
|
19
|
+
}
|
20
|
+
|
21
|
+
mapnik::coord2d inverse_pt(mapnik::projection const& prj, mapnik::coord2d const& pt)
|
22
|
+
{
|
23
|
+
double x = pt.x;
|
24
|
+
double y = pt.y;
|
25
|
+
prj.inverse(x,y);
|
26
|
+
return mapnik::coord2d(x,y);
|
27
|
+
}
|
28
|
+
|
29
|
+
mapnik::box2d<double> forward_env(mapnik::projection const& prj, mapnik::box2d<double> const & box)
|
30
|
+
{
|
31
|
+
double minx = box.minx();
|
32
|
+
double miny = box.miny();
|
33
|
+
double maxx = box.maxx();
|
34
|
+
double maxy = box.maxy();
|
35
|
+
prj.forward(minx,miny);
|
36
|
+
prj.forward(maxx,maxy);
|
37
|
+
return mapnik::box2d<double>(minx,miny,maxx,maxy);
|
38
|
+
}
|
39
|
+
|
40
|
+
mapnik::box2d<double> inverse_env(mapnik::projection const& prj, mapnik::box2d<double> const & box)
|
41
|
+
{
|
42
|
+
double minx = box.minx();
|
43
|
+
double miny = box.miny();
|
44
|
+
double maxx = box.maxx();
|
45
|
+
double maxy = box.maxy();
|
46
|
+
prj.inverse(minx,miny);
|
47
|
+
prj.inverse(maxx,maxy);
|
48
|
+
return mapnik::box2d<double>(minx,miny,maxx,maxy);
|
49
|
+
}
|
50
|
+
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
void register_projection(Rice::Module rb_mapnik){
|
55
|
+
/*
|
56
|
+
@@Module_var rb_mapnik = Mapnik
|
57
|
+
*/
|
58
|
+
Rice::Data_Type< mapnik::projection > rb_cproj = Rice::define_class_under< mapnik::projection >(rb_mapnik, "Projection");
|
59
|
+
|
60
|
+
/*
|
61
|
+
* Document-method: new
|
62
|
+
* call-seq:
|
63
|
+
* new(srs)
|
64
|
+
* @param [String] srs
|
65
|
+
* @return [Mapnik::Projection]
|
66
|
+
*/
|
67
|
+
rb_cproj.define_constructor(Rice::Constructor< mapnik::projection, std::string >());
|
68
|
+
|
69
|
+
/*
|
70
|
+
* Document-method: params
|
71
|
+
* @return [String] The srs params
|
72
|
+
*/
|
73
|
+
rb_cproj.define_method("params", &mapnik::projection::params);
|
74
|
+
|
75
|
+
/*
|
76
|
+
* Document-method: geographic?
|
77
|
+
* @return [Boolean]
|
78
|
+
*/
|
79
|
+
rb_cproj.define_method("geographic?", &mapnik::projection::is_geographic);
|
80
|
+
|
81
|
+
/* Document-method: expanded_params
|
82
|
+
* @return [String] expanded set of srs params
|
83
|
+
*/
|
84
|
+
rb_cproj.define_method("expanded_params", &mapnik::projection::expanded);
|
85
|
+
|
86
|
+
// Dont-Document-method: __forward_pt__
|
87
|
+
rb_cproj.define_method("__forward_pt__",&forward_pt);
|
88
|
+
|
89
|
+
// Dont-Document-method: __inverse_pt__
|
90
|
+
rb_cproj.define_method("__inverse_pt__",&inverse_pt);
|
91
|
+
|
92
|
+
// Dont-Document-method: __forward_env__
|
93
|
+
rb_cproj.define_method("__forward_env__",&forward_env);
|
94
|
+
|
95
|
+
// Dont-Document-method: __inverse_env__
|
96
|
+
rb_cproj.define_method("__inverse_env__",&inverse_env);
|
97
|
+
|
98
|
+
}
|
@@ -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_PROJECTION
|
23
|
+
#define PIKA2_MAPNIK_PROJECTION
|
24
|
+
|
25
|
+
namespace Rice
|
26
|
+
{
|
27
|
+
class Module;
|
28
|
+
}
|
29
|
+
|
30
|
+
void register_projection(Rice::Module rb_mapnik);
|
31
|
+
|
32
|
+
#endif
|