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,521 @@
|
|
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_text_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/text_placements.hpp>
|
32
|
+
#include <mapnik/text_symbolizer.hpp>
|
33
|
+
|
34
|
+
namespace {
|
35
|
+
|
36
|
+
Rice::Object get_anchor(const mapnik::text_symbolizer& t){
|
37
|
+
mapnik::position pos = t.get_anchor();
|
38
|
+
Rice::Array out;
|
39
|
+
out.push(boost::get<0>(pos));
|
40
|
+
out.push(boost::get<1>(pos));
|
41
|
+
return out;
|
42
|
+
}
|
43
|
+
|
44
|
+
void set_anchor(mapnik::text_symbolizer & t, Rice::Array ary) {
|
45
|
+
double x = from_ruby<double>(ary[0]);
|
46
|
+
double y = from_ruby<double>(ary[1]);
|
47
|
+
|
48
|
+
t.set_anchor(x, y);
|
49
|
+
}
|
50
|
+
|
51
|
+
Rice::Object get_text_displacement(const mapnik::text_symbolizer& t){
|
52
|
+
mapnik::position pos = t.get_displacement();
|
53
|
+
Rice::Array out;
|
54
|
+
out.push(boost::get<0>(pos));
|
55
|
+
out.push(boost::get<1>(pos));
|
56
|
+
return out;
|
57
|
+
}
|
58
|
+
|
59
|
+
void set_text_displacement(mapnik::text_symbolizer & t, Rice::Array ary){
|
60
|
+
double x = from_ruby<double>(ary[0]);
|
61
|
+
double y = from_ruby<double>(ary[1]);
|
62
|
+
|
63
|
+
t.set_displacement(x,y);
|
64
|
+
}
|
65
|
+
|
66
|
+
mapnik::horizontal_alignment get_text_horizontal_alignment(mapnik::text_symbolizer const & self){
|
67
|
+
mapnik::horizontal_alignment alignment = self.get_horizontal_alignment();
|
68
|
+
return alignment;
|
69
|
+
}
|
70
|
+
|
71
|
+
void set_text_horizontal_alignment(mapnik::text_symbolizer & self, mapnik::horizontal_alignment val){
|
72
|
+
self.set_horizontal_alignment(val);
|
73
|
+
}
|
74
|
+
|
75
|
+
mapnik::justify_alignment get_text_justify_alignment(mapnik::text_symbolizer const & self){
|
76
|
+
mapnik::justify_alignment alignment = self.get_justify_alignment();
|
77
|
+
return alignment;
|
78
|
+
}
|
79
|
+
|
80
|
+
void set_text_justify_alignment(mapnik::text_symbolizer & self, mapnik::justify_alignment val){
|
81
|
+
self.set_justify_alignment(val);
|
82
|
+
}
|
83
|
+
|
84
|
+
mapnik::label_placement_enum get_text_label_placement(mapnik::text_symbolizer const & self){
|
85
|
+
mapnik::label_placement_enum alignment = self.get_label_placement();
|
86
|
+
return alignment;
|
87
|
+
}
|
88
|
+
|
89
|
+
void set_text_label_placement(mapnik::text_symbolizer & self, mapnik::label_placement_enum val){
|
90
|
+
self.set_label_placement(val);
|
91
|
+
}
|
92
|
+
|
93
|
+
mapnik::text_transform get_text_transform(mapnik::text_symbolizer const & self){
|
94
|
+
mapnik::text_transform transform = self.get_text_transform();
|
95
|
+
return transform;
|
96
|
+
}
|
97
|
+
|
98
|
+
void set_text_transform(mapnik::text_symbolizer & self, mapnik::text_transform val){
|
99
|
+
self.set_text_transform(val);
|
100
|
+
}
|
101
|
+
|
102
|
+
mapnik::vertical_alignment get_vertical_alignment(mapnik::text_symbolizer const & self){
|
103
|
+
mapnik::vertical_alignment transform = self.get_vertical_alignment();
|
104
|
+
return transform;
|
105
|
+
}
|
106
|
+
|
107
|
+
void set_vertical_alignment(mapnik::text_symbolizer & self, mapnik::vertical_alignment val){
|
108
|
+
self.set_vertical_alignment(val);
|
109
|
+
}
|
110
|
+
|
111
|
+
}
|
112
|
+
|
113
|
+
void register_text_symbolizer(Rice::Module rb_mapnik){
|
114
|
+
/*
|
115
|
+
@@Module_var rb_mapnik = Mapnik
|
116
|
+
*/
|
117
|
+
Rice::Enum<mapnik::label_placement_enum> label_placement = Rice::define_enum<mapnik::label_placement_enum>("LABEL_PLACEMENT", rb_mapnik);
|
118
|
+
label_placement.define_value("LINE_PLACEMENT", mapnik::LINE_PLACEMENT);
|
119
|
+
label_placement.define_value("POINT_PLACEMENT", mapnik::POINT_PLACEMENT);
|
120
|
+
label_placement.define_value("VERTEX_PLACEMENT", mapnik::VERTEX_PLACEMENT);
|
121
|
+
label_placement.define_value("INTERIOR_PLACEMENT", mapnik::INTERIOR_PLACEMENT);
|
122
|
+
|
123
|
+
Rice::Enum<mapnik::vertical_alignment> vertical_alignment = Rice::define_enum<mapnik::vertical_alignment>("VERTICAL_ALIGNMENT", rb_mapnik);
|
124
|
+
vertical_alignment.define_value("TOP", mapnik::V_TOP);
|
125
|
+
vertical_alignment.define_value("MIDDLE", mapnik::V_MIDDLE);
|
126
|
+
vertical_alignment.define_value("BOTTOM", mapnik::V_BOTTOM);
|
127
|
+
vertical_alignment.define_value("AUTO", mapnik::V_AUTO);
|
128
|
+
|
129
|
+
Rice::Enum<mapnik::horizontal_alignment> horizontal_alignment = Rice::define_enum<mapnik::horizontal_alignment>("HORIZONTAL_ALIGNMENT", rb_mapnik);
|
130
|
+
horizontal_alignment.define_value("LEFT", mapnik::H_LEFT);
|
131
|
+
horizontal_alignment.define_value("MIDDLE", mapnik::H_MIDDLE);
|
132
|
+
horizontal_alignment.define_value("RIGHT", mapnik::H_RIGHT);
|
133
|
+
|
134
|
+
Rice::Enum<mapnik::justify_alignment> justify_alignment_rice = Rice::define_enum<mapnik::justify_alignment>("JUSTIFY_ALIGNMENT", rb_mapnik);
|
135
|
+
justify_alignment_rice.define_value("LEFT", mapnik::J_LEFT);
|
136
|
+
justify_alignment_rice.define_value("MIDDLE", mapnik::J_MIDDLE);
|
137
|
+
justify_alignment_rice.define_value("RIGHT", mapnik::J_RIGHT);
|
138
|
+
|
139
|
+
Rice::Enum<mapnik::text_transform> text_transform = Rice::define_enum<mapnik::text_transform>("TEXT_TRANSFORM", rb_mapnik);
|
140
|
+
text_transform.define_value("NONE", mapnik::NONE);
|
141
|
+
text_transform.define_value("UPPERCASE", mapnik::UPPERCASE);
|
142
|
+
text_transform.define_value("LOWERCASE", mapnik::LOWERCASE);
|
143
|
+
text_transform.define_value("CAPITALIZE", mapnik::CAPITALIZE);
|
144
|
+
|
145
|
+
Rice::Data_Type< mapnik::text_symbolizer > rb_ctext_symbolizer = Rice::define_class_under< mapnik::text_symbolizer >(rb_mapnik, "TextSymbolizer");
|
146
|
+
|
147
|
+
/*
|
148
|
+
* Document-method: new
|
149
|
+
* call-seq:
|
150
|
+
* new(expression, font_name, size, color)
|
151
|
+
* @param [Mapnik::Expression] expression
|
152
|
+
* @param [String] font_name
|
153
|
+
* @param [Integer] size
|
154
|
+
* @param [Mapnik::Color] color
|
155
|
+
*/
|
156
|
+
rb_ctext_symbolizer.define_constructor(Rice::Constructor< mapnik::text_symbolizer, mapnik::expression_ptr, std::string, int, mapnik::color >());
|
157
|
+
|
158
|
+
/*
|
159
|
+
* Document-method: anchor
|
160
|
+
* @return [Array] Two element array [x,y]
|
161
|
+
*/
|
162
|
+
rb_ctext_symbolizer.define_method("anchor", &get_anchor);
|
163
|
+
|
164
|
+
/*
|
165
|
+
* Document-method: anchor=
|
166
|
+
* call-seq:
|
167
|
+
* anchor=(new_anchor)
|
168
|
+
* @param [Array] new_anchor Two element array [x,y]
|
169
|
+
*/
|
170
|
+
rb_ctext_symbolizer.define_method("anchor=", &set_anchor);
|
171
|
+
|
172
|
+
/*
|
173
|
+
* Document-method: allow_overlap?
|
174
|
+
* @return [Boolean]
|
175
|
+
*/
|
176
|
+
rb_ctext_symbolizer.define_method("allow_overlap?", &mapnik::text_symbolizer::get_allow_overlap);
|
177
|
+
|
178
|
+
/*
|
179
|
+
* Document-method: allow_overlap=
|
180
|
+
* call-seq:
|
181
|
+
* allow_overlap=(new_value)
|
182
|
+
* @param [Boolean] new_value
|
183
|
+
* @return [Boolean]
|
184
|
+
*/
|
185
|
+
rb_ctext_symbolizer.define_method("allow_overlap=", &mapnik::text_symbolizer::set_allow_overlap);
|
186
|
+
|
187
|
+
/*
|
188
|
+
* Document-method: displacement
|
189
|
+
* @return [Array] Two element array in the form [x, y]
|
190
|
+
*/
|
191
|
+
rb_ctext_symbolizer.define_method("displacement", &get_text_displacement);
|
192
|
+
|
193
|
+
/* Document-method: displacement=
|
194
|
+
* call-seq:
|
195
|
+
* displacement=(new_displacement)
|
196
|
+
* @param [Array] new_displacement array in the form [x, y]
|
197
|
+
* @return [Array]
|
198
|
+
*/
|
199
|
+
rb_ctext_symbolizer.define_method("displacement=", &set_text_displacement);
|
200
|
+
|
201
|
+
/*
|
202
|
+
* Document-method: avoid_edges?
|
203
|
+
* @return [Boolean]
|
204
|
+
*/
|
205
|
+
rb_ctext_symbolizer.define_method("avoid_edges?", &mapnik::text_symbolizer::get_avoid_edges);
|
206
|
+
|
207
|
+
/*
|
208
|
+
* Document-method: avoid_edges=
|
209
|
+
* call-seq:
|
210
|
+
* avoid_edges=(new_value)
|
211
|
+
* @param [Boolean] new_value
|
212
|
+
* @return [Boolean]
|
213
|
+
*/
|
214
|
+
rb_ctext_symbolizer.define_method("avoid_edges=", &mapnik::text_symbolizer::set_avoid_edges);
|
215
|
+
|
216
|
+
/*
|
217
|
+
* Document-method: character_spacing
|
218
|
+
* @return [Float]
|
219
|
+
*/
|
220
|
+
rb_ctext_symbolizer.define_method("character_spacing", &mapnik::text_symbolizer::get_character_spacing);
|
221
|
+
|
222
|
+
/*
|
223
|
+
* Document-method: character_spacing=
|
224
|
+
* call-seq:
|
225
|
+
* character_spacing=(new_value)
|
226
|
+
* @param [Float]
|
227
|
+
* @return [Float]
|
228
|
+
*/
|
229
|
+
rb_ctext_symbolizer.define_method("character_spacing=", &mapnik::text_symbolizer::set_character_spacing);
|
230
|
+
|
231
|
+
/*
|
232
|
+
* Document-method: face_name
|
233
|
+
* @return [String]
|
234
|
+
*/
|
235
|
+
rb_ctext_symbolizer.define_method("face_name", &mapnik::text_symbolizer::get_face_name);
|
236
|
+
|
237
|
+
/*
|
238
|
+
* Document-method: face_name=
|
239
|
+
* call-seq:
|
240
|
+
* face_name=(new_value)
|
241
|
+
* @param [String] face_name a font face name that is registered with the FontEngine
|
242
|
+
* @return [String]
|
243
|
+
*/
|
244
|
+
rb_ctext_symbolizer.define_method("face_name=", &mapnik::text_symbolizer::set_face_name);
|
245
|
+
|
246
|
+
/*
|
247
|
+
* Document-method: fill
|
248
|
+
* @return [Mapnik::Color]
|
249
|
+
*/
|
250
|
+
rb_ctext_symbolizer.define_method("fill", &mapnik::text_symbolizer::get_fill);
|
251
|
+
|
252
|
+
/*
|
253
|
+
* Document-method: fill=
|
254
|
+
* call-seq:
|
255
|
+
* fill=(color)
|
256
|
+
* @param [Mapnik::Color] color
|
257
|
+
* @return [Mapnik::Color]
|
258
|
+
*/
|
259
|
+
rb_ctext_symbolizer.define_method("fill=", &mapnik::text_symbolizer::set_fill);
|
260
|
+
|
261
|
+
// TODO: Need fontset
|
262
|
+
// rb_ctext_symbolizer.define_method("fontset", &mapnik::text_symbolizer::get_fontset);
|
263
|
+
// rb_ctext_symbolizer.define_method("fontset=", &mapnik::text_symbolizer::set_fontset);
|
264
|
+
|
265
|
+
/*
|
266
|
+
* Document-method: force_odd_labels?
|
267
|
+
* @return [Boolean]
|
268
|
+
*/
|
269
|
+
rb_ctext_symbolizer.define_method("force_odd_labels?", &mapnik::text_symbolizer::get_force_odd_labels);
|
270
|
+
|
271
|
+
/*
|
272
|
+
* Document-method: force_odd_labels=
|
273
|
+
* call-seq:
|
274
|
+
* force_odd_labels=(new_value)
|
275
|
+
* @param [Boolean] new_value
|
276
|
+
* @return [Boolean]
|
277
|
+
*/
|
278
|
+
rb_ctext_symbolizer.define_method("force_odd_labels=", &mapnik::text_symbolizer::set_force_odd_labels);
|
279
|
+
|
280
|
+
/*
|
281
|
+
* Document-method: halo_fill
|
282
|
+
* @return [Mapnik::Color]
|
283
|
+
*/
|
284
|
+
rb_ctext_symbolizer.define_method("halo_fill", &mapnik::text_symbolizer::get_halo_fill);
|
285
|
+
|
286
|
+
/*
|
287
|
+
* Document-method: halo_fill=
|
288
|
+
* call-seq:
|
289
|
+
* halo_fill=(color)
|
290
|
+
* @param [Mapnik::Color]
|
291
|
+
* @return [Mapnik::Color]
|
292
|
+
*/
|
293
|
+
rb_ctext_symbolizer.define_method("halo_fill=", &mapnik::text_symbolizer::set_halo_fill);
|
294
|
+
|
295
|
+
/*
|
296
|
+
* Document-method: halo_radius
|
297
|
+
* @return [Float]
|
298
|
+
*/
|
299
|
+
rb_ctext_symbolizer.define_method("halo_radius", &mapnik::text_symbolizer::get_halo_radius);
|
300
|
+
|
301
|
+
/*
|
302
|
+
* Document-method: halo_radius=
|
303
|
+
* call-seq:
|
304
|
+
* halo_radius=(radius)
|
305
|
+
* @param [Float] radius
|
306
|
+
* @return [Float]
|
307
|
+
*/
|
308
|
+
rb_ctext_symbolizer.define_method("halo_radius=", &mapnik::text_symbolizer::set_halo_radius);
|
309
|
+
|
310
|
+
rb_ctext_symbolizer.define_method("horizontal_alignment", &get_text_horizontal_alignment);
|
311
|
+
rb_ctext_symbolizer.define_method("horizontal_alignment=", &set_text_horizontal_alignment);
|
312
|
+
|
313
|
+
rb_ctext_symbolizer.define_method("justify_alignment", &get_text_justify_alignment);
|
314
|
+
rb_ctext_symbolizer.define_method("justify_alignment=", &set_text_justify_alignment);
|
315
|
+
|
316
|
+
rb_ctext_symbolizer.define_method("label_placement", &get_text_label_placement);
|
317
|
+
rb_ctext_symbolizer.define_method("label_placement=", &set_text_label_placement);
|
318
|
+
|
319
|
+
/*
|
320
|
+
* Document-method: label_position_tolerance
|
321
|
+
* @return [Integer]
|
322
|
+
*/
|
323
|
+
rb_ctext_symbolizer.define_method("label_position_tolerance", &mapnik::text_symbolizer::get_label_position_tolerance);
|
324
|
+
|
325
|
+
/*
|
326
|
+
* Document-method: label_position_tolerance=
|
327
|
+
* call-seq:
|
328
|
+
* label_position_tolerance=(tolerance)
|
329
|
+
* @param [Integer] tolerance
|
330
|
+
* @return [Integer]
|
331
|
+
*/
|
332
|
+
rb_ctext_symbolizer.define_method("label_position_tolerance=", &mapnik::text_symbolizer::set_label_position_tolerance);
|
333
|
+
|
334
|
+
/*
|
335
|
+
* Document-method: label_spacing
|
336
|
+
* @return [Integer]
|
337
|
+
*/
|
338
|
+
rb_ctext_symbolizer.define_method("label_spacing", &mapnik::text_symbolizer::get_label_spacing);
|
339
|
+
|
340
|
+
/*
|
341
|
+
* Document-method: label_spacing=
|
342
|
+
* call-seq:
|
343
|
+
* label_spacing=(spacing)
|
344
|
+
* @param [Integer]
|
345
|
+
* @return [Integer]
|
346
|
+
*/
|
347
|
+
rb_ctext_symbolizer.define_method("label_spacing=", &mapnik::text_symbolizer::set_label_spacing);
|
348
|
+
|
349
|
+
/*
|
350
|
+
* Document-method: line_spacing
|
351
|
+
* @return [Integer]
|
352
|
+
*/
|
353
|
+
rb_ctext_symbolizer.define_method("line_spacing", &mapnik::text_symbolizer::get_line_spacing);
|
354
|
+
|
355
|
+
/*
|
356
|
+
* Document-method: line_spacing=
|
357
|
+
* call-seq:
|
358
|
+
* line_spacing=(spacing)
|
359
|
+
* @param [Integer]
|
360
|
+
* @return [Integer]
|
361
|
+
*/
|
362
|
+
rb_ctext_symbolizer.define_method("line_spacing=", &mapnik::text_symbolizer::set_line_spacing);
|
363
|
+
|
364
|
+
/*
|
365
|
+
* Document-method: max_char_angle_delta
|
366
|
+
* @return [Float]
|
367
|
+
*/
|
368
|
+
rb_ctext_symbolizer.define_method("max_char_angle_delta", &mapnik::text_symbolizer::get_max_char_angle_delta);
|
369
|
+
|
370
|
+
/*
|
371
|
+
* Document-method: max_char_angle_delta=
|
372
|
+
* call-seq:
|
373
|
+
* max_char_angle_delta=(delta)
|
374
|
+
* @param [Float]
|
375
|
+
* @return [Float]
|
376
|
+
*/
|
377
|
+
rb_ctext_symbolizer.define_method("max_char_angle_delta=", &mapnik::text_symbolizer::set_max_char_angle_delta);
|
378
|
+
|
379
|
+
/*
|
380
|
+
* Document-method: minimum_distance
|
381
|
+
* @return [Float]
|
382
|
+
*/
|
383
|
+
rb_ctext_symbolizer.define_method("minimum_distance", &mapnik::text_symbolizer::get_minimum_distance);
|
384
|
+
|
385
|
+
/*
|
386
|
+
* Document-method: minimum_distance=
|
387
|
+
* call-seq:
|
388
|
+
* minimum_distance=(distance)
|
389
|
+
* @param [Float]
|
390
|
+
* @return [Float]
|
391
|
+
*/
|
392
|
+
rb_ctext_symbolizer.define_method("minimum_distance=", &mapnik::text_symbolizer::set_minimum_distance);
|
393
|
+
|
394
|
+
/*
|
395
|
+
* Document-method: minimum_padding
|
396
|
+
* @return [Float]
|
397
|
+
*/
|
398
|
+
rb_ctext_symbolizer.define_method("minimum_padding", &mapnik::text_symbolizer::get_minimum_padding);
|
399
|
+
|
400
|
+
/*
|
401
|
+
* Document-method: minimum_padding=
|
402
|
+
* call-seq:
|
403
|
+
* minimum_padding=(padding)
|
404
|
+
* @param [Float]
|
405
|
+
* @return [Float]
|
406
|
+
*/
|
407
|
+
rb_ctext_symbolizer.define_method("minimum_padding=", &mapnik::text_symbolizer::set_minimum_padding);
|
408
|
+
|
409
|
+
/*
|
410
|
+
* Document-method: name
|
411
|
+
* @return [Mapnik::Expression]
|
412
|
+
*/
|
413
|
+
rb_ctext_symbolizer.define_method("name", &mapnik::text_symbolizer::get_name);
|
414
|
+
|
415
|
+
/*
|
416
|
+
* Document-method: name=
|
417
|
+
* call-seq:
|
418
|
+
* name=(new_name)
|
419
|
+
* @param [Mapnik::Expression] new_name
|
420
|
+
* @return [Mapnik::Expression]
|
421
|
+
*/
|
422
|
+
rb_ctext_symbolizer.define_method("name=", &mapnik::text_symbolizer::set_name);
|
423
|
+
|
424
|
+
/*
|
425
|
+
* Document-method: opacity
|
426
|
+
* @return [Float]
|
427
|
+
*/
|
428
|
+
rb_ctext_symbolizer.define_method("opacity", &mapnik::text_symbolizer::get_text_opacity);
|
429
|
+
|
430
|
+
/*
|
431
|
+
* Document-method: opacity=
|
432
|
+
* call-seq:
|
433
|
+
* opacity=(new_value)
|
434
|
+
* @param [Float] new_value
|
435
|
+
* @return [Float]
|
436
|
+
*/
|
437
|
+
rb_ctext_symbolizer.define_method("opacity=", &mapnik::text_symbolizer::set_text_opacity);
|
438
|
+
|
439
|
+
rb_ctext_symbolizer.define_method("text_transform", &get_text_transform);
|
440
|
+
rb_ctext_symbolizer.define_method("text_transform=", &set_text_transform);
|
441
|
+
|
442
|
+
/*
|
443
|
+
* Document-method: ratio
|
444
|
+
* @return [Integer]
|
445
|
+
*/
|
446
|
+
rb_ctext_symbolizer.define_method("ratio", &mapnik::text_symbolizer::get_text_ratio);
|
447
|
+
|
448
|
+
/*
|
449
|
+
* Document-method: ratio=
|
450
|
+
* call-seq:
|
451
|
+
* ratio=(new_ratio)
|
452
|
+
* @param [Integer] new_ratio
|
453
|
+
* @return [Integer]
|
454
|
+
*/
|
455
|
+
rb_ctext_symbolizer.define_method("ratio=", &mapnik::text_symbolizer::set_text_ratio);
|
456
|
+
|
457
|
+
/*
|
458
|
+
* Document-method: size
|
459
|
+
* @return [Integer]
|
460
|
+
*/
|
461
|
+
rb_ctext_symbolizer.define_method("size", &mapnik::text_symbolizer::get_text_size);
|
462
|
+
|
463
|
+
/*
|
464
|
+
* Document-method: size=
|
465
|
+
* call-seq:
|
466
|
+
* size=(new_size)
|
467
|
+
* @param [Integer] new_size
|
468
|
+
* @return [Integer]
|
469
|
+
*/
|
470
|
+
rb_ctext_symbolizer.define_method("size=", &mapnik::text_symbolizer::set_text_size);
|
471
|
+
|
472
|
+
rb_ctext_symbolizer.define_method("vertical_alignment", &get_vertical_alignment);
|
473
|
+
rb_ctext_symbolizer.define_method("vertical_alignment=", &set_vertical_alignment);
|
474
|
+
|
475
|
+
/*
|
476
|
+
* Document-method: wrap_width
|
477
|
+
* @return [Integer]
|
478
|
+
*/
|
479
|
+
rb_ctext_symbolizer.define_method("wrap_width", &mapnik::text_symbolizer::get_wrap_width);
|
480
|
+
|
481
|
+
/*
|
482
|
+
* Document-method: wrap_width=
|
483
|
+
* call-seq:
|
484
|
+
* wrap_width=(new_wrap_width)
|
485
|
+
* @param [Integer] new_wrap_width
|
486
|
+
* @return [Integer]
|
487
|
+
*/
|
488
|
+
rb_ctext_symbolizer.define_method("wrap_width=", &mapnik::text_symbolizer::set_wrap_width);
|
489
|
+
|
490
|
+
/*
|
491
|
+
* Document-method: wrap_character
|
492
|
+
* @return [String]
|
493
|
+
*/
|
494
|
+
rb_ctext_symbolizer.define_method("wrap_character", &mapnik::text_symbolizer::get_wrap_char_string);
|
495
|
+
|
496
|
+
/*
|
497
|
+
* Document-method: wrap_character=
|
498
|
+
* call-seq:
|
499
|
+
* wrap_character=(character)
|
500
|
+
* @param [String] character
|
501
|
+
* @return [String]
|
502
|
+
*/
|
503
|
+
rb_ctext_symbolizer.define_method("wrap_character=", &mapnik::text_symbolizer::set_wrap_char_from_string);
|
504
|
+
|
505
|
+
/*
|
506
|
+
* Document-method: wrap_before
|
507
|
+
* @return [Boolean]
|
508
|
+
*/
|
509
|
+
rb_ctext_symbolizer.define_method("wrap_before", &mapnik::text_symbolizer::get_wrap_before);
|
510
|
+
|
511
|
+
/*
|
512
|
+
* Document-method: wrap_before=
|
513
|
+
* call-seq:
|
514
|
+
* wrap_before=(new_value)
|
515
|
+
* @param [Boolean] new_value
|
516
|
+
* @return [Boolean]
|
517
|
+
*/
|
518
|
+
rb_ctext_symbolizer.define_method("wrap_before=", &mapnik::text_symbolizer::set_wrap_before);
|
519
|
+
|
520
|
+
};
|
521
|
+
|
@@ -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_TEXT_SYMBOLIZER
|
23
|
+
#define PIKA2_MAPNIK_TEXT_SYMBOLIZER
|
24
|
+
|
25
|
+
namespace Rice
|
26
|
+
{
|
27
|
+
class Module;
|
28
|
+
}
|
29
|
+
|
30
|
+
void register_text_symbolizer(Rice::Module rb_mapnik);
|
31
|
+
|
32
|
+
#endif
|
@@ -0,0 +1,78 @@
|
|
1
|
+
=begin
|
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
|
+
=end
|
22
|
+
|
23
|
+
# Compile with Rice rather than straight mkmf
|
24
|
+
require 'rubygems'
|
25
|
+
require 'mkmf-rice'
|
26
|
+
|
27
|
+
# Add the arguments to the linker flags.
|
28
|
+
def append_ld_flags(flags)
|
29
|
+
flags = [flags] unless flags.is_a?(Array)
|
30
|
+
with_ldflags("#{$LDFLAGS} #{flags.join(' ')}") { true }
|
31
|
+
end
|
32
|
+
|
33
|
+
# Check for mapnik-config
|
34
|
+
if %x{which mapnik-config}.length == 0
|
35
|
+
abort("\n***\n mapnik-config is missing!\n Is mapnik2 installed?\n Is mapnik-config in your $PATH?\n***\n\n")
|
36
|
+
end
|
37
|
+
|
38
|
+
LIBDIR = Config::CONFIG['libdir']
|
39
|
+
INCLUDEDIR = Config::CONFIG['includedir']
|
40
|
+
|
41
|
+
$LDFLAGS += " -lmapnik2 "
|
42
|
+
$CFLAGS += %x{mapnik-config --cflags}
|
43
|
+
|
44
|
+
#------------------------------------------------------------------------------#
|
45
|
+
# Ruby-Mapnik configuration
|
46
|
+
#
|
47
|
+
# Creates a ruby file with the constants for the input and font paths.
|
48
|
+
#------------------------------------------------------------------------------#
|
49
|
+
input_plugin_path = %x{mapnik-config --input-plugins}.chomp
|
50
|
+
font_path = %x{mapnik-config --fonts}.chomp
|
51
|
+
ruby_mapnik_config = <<-EOF
|
52
|
+
# This file is generated by extconf.rb DO NOT MODIFY!
|
53
|
+
module Mapnik
|
54
|
+
INPUT_PLUGIN_PATH = '#{input_plugin_path}'
|
55
|
+
FONT_PATH = '#{font_path}'
|
56
|
+
end
|
57
|
+
EOF
|
58
|
+
|
59
|
+
mapnik_config_file_path = File.join(File.expand_path(File.dirname(__FILE__)), '..', '..', 'lib', 'ruby_mapnik_config.rb')
|
60
|
+
FileUtils.rm(mapnik_config_file_path) if File.exists?(mapnik_config_file_path)
|
61
|
+
File.open(mapnik_config_file_path, 'w+') do |file|
|
62
|
+
file.write(ruby_mapnik_config)
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
if RUBY_PLATFORM =~ /darwin/
|
67
|
+
# In order to link the shared library into our bundle with GCC 4.x on OSX, we have to work around a bug:
|
68
|
+
# GCC redefines symbols - which the -fno-common prohibits. In order to keep the -fno-common, we
|
69
|
+
# remove the flat_namespace (we now have two namespaces, which fixes the GCC clash). Also, we now lookup
|
70
|
+
# symbols in both the namespaces (dynamic_lookup).
|
71
|
+
|
72
|
+
$LDSHARED_CXX.gsub!('suppress', 'dynamic_lookup')
|
73
|
+
$LDSHARED_CXX.gsub!('-flat_namespace', '')
|
74
|
+
|
75
|
+
append_ld_flags '-all_load'
|
76
|
+
end
|
77
|
+
|
78
|
+
create_makefile("ruby_mapnik")
|
@@ -0,0 +1,31 @@
|
|
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 <rice/Module.hpp>
|
23
|
+
#include "_mapnik.h"
|
24
|
+
|
25
|
+
extern "C"
|
26
|
+
|
27
|
+
void Init_ruby_mapnik() {
|
28
|
+
RUBY_TRY {
|
29
|
+
register_mapnik();
|
30
|
+
} RUBY_CATCH
|
31
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
=begin
|
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
|
+
=end
|
22
|
+
module Mapnik
|
23
|
+
|
24
|
+
class FontEngine
|
25
|
+
|
26
|
+
DEFAULT_VALID_EXTENSIONS = ['ttf','otf','ttc','pfa','pfb','ttc','dfont']
|
27
|
+
|
28
|
+
def self.register_fonts(path, valid_extensions = DEFAULT_VALID_EXTENSIONS)
|
29
|
+
file_names = Dir.glob(File.join("#{path}", "*.{#{valid_extensions.join(',')}}"))
|
30
|
+
file_names.each{|filename| register_font(filename)}
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|