ruby_mapnik 0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. data/.autotest +35 -0
  2. data/.gemtest +0 -0
  3. data/.yardopts +1 -0
  4. data/Gemfile +12 -0
  5. data/LICENSE +19 -0
  6. data/Manifest.txt +177 -0
  7. data/README.rdoc +84 -0
  8. data/Rakefile +43 -0
  9. data/demo/data/COPYRIGHT.txt +3 -0
  10. data/demo/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.dbf +0 -0
  11. data/demo/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.prj +1 -0
  12. data/demo/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.shp +0 -0
  13. data/demo/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.shx +0 -0
  14. data/demo/data/boundaries.dbf +0 -0
  15. data/demo/data/boundaries.prj +1 -0
  16. data/demo/data/boundaries.sbx +0 -0
  17. data/demo/data/boundaries.shp +0 -0
  18. data/demo/data/boundaries.shx +0 -0
  19. data/demo/data/boundaries_l.dbf +0 -0
  20. data/demo/data/boundaries_l.prj +1 -0
  21. data/demo/data/boundaries_l.sbx +0 -0
  22. data/demo/data/boundaries_l.shp +0 -0
  23. data/demo/data/boundaries_l.shx +0 -0
  24. data/demo/data/ontdrainage.dbf +0 -0
  25. data/demo/data/ontdrainage.prj +1 -0
  26. data/demo/data/ontdrainage.sbx +0 -0
  27. data/demo/data/ontdrainage.shp +0 -0
  28. data/demo/data/ontdrainage.shx +0 -0
  29. data/demo/data/popplaces.dbf +0 -0
  30. data/demo/data/popplaces.prj +1 -0
  31. data/demo/data/popplaces.sbx +0 -0
  32. data/demo/data/popplaces.shp +0 -0
  33. data/demo/data/popplaces.shx +0 -0
  34. data/demo/data/qcdrainage.dbf +0 -0
  35. data/demo/data/qcdrainage.prj +1 -0
  36. data/demo/data/qcdrainage.sbx +0 -0
  37. data/demo/data/qcdrainage.shp +0 -0
  38. data/demo/data/qcdrainage.shx +0 -0
  39. data/demo/data/roads.dbf +0 -0
  40. data/demo/data/roads.prj +1 -0
  41. data/demo/data/roads.sbx +0 -0
  42. data/demo/data/roads.shp +0 -0
  43. data/demo/data/roads.shx +0 -0
  44. data/demo/data/test/charplacement.dbf +0 -0
  45. data/demo/data/test/charplacement.shp +0 -0
  46. data/demo/data/test/charplacement.shx +0 -0
  47. data/demo/data/test/displacement.dbf +0 -0
  48. data/demo/data/test/displacement.shp +0 -0
  49. data/demo/data/test/displacement.shx +0 -0
  50. data/demo/data/test/overlap.dbf +0 -0
  51. data/demo/data/test/overlap.shp +0 -0
  52. data/demo/data/test/overlap.shx +0 -0
  53. data/demo/data/test/raw/charplacement.gfs +25 -0
  54. data/demo/data/test/raw/charplacement.gml +99 -0
  55. data/demo/data/test/raw/charplacement.xsd +36 -0
  56. data/demo/data/test/raw/displacement.gfs +25 -0
  57. data/demo/data/test/raw/displacement.gml +173 -0
  58. data/demo/data/test/raw/displacement.xsd +36 -0
  59. data/demo/data/test/raw/overlap.gfs +25 -0
  60. data/demo/data/test/raw/overlap.gml +127 -0
  61. data/demo/data/test/raw/overlap.xsd +36 -0
  62. data/demo/data/test/raw/textspacing.gfs +25 -0
  63. data/demo/data/test/raw/textspacing.gml +117 -0
  64. data/demo/data/test/raw/textspacing.xsd +36 -0
  65. data/demo/data/test/readme.txt +3 -0
  66. data/demo/data/test/regenerate.sh +20 -0
  67. data/demo/data/test/textspacing.dbf +0 -0
  68. data/demo/data/test/textspacing.shp +0 -0
  69. data/demo/data/test/textspacing.shx +0 -0
  70. data/demo/rundemo.rb +139 -0
  71. data/demo/sinatra/demo.rb +31 -0
  72. data/demo/sinatra/public/css/demo_map.css +7 -0
  73. data/demo/sinatra/public/index.html +13 -0
  74. data/demo/sinatra/public/javascripts/demo_map.js +42 -0
  75. data/ext/ruby_mapnik/_mapnik.cpp +54 -0
  76. data/ext/ruby_mapnik/_mapnik.h +69 -0
  77. data/ext/ruby_mapnik/_mapnik_color.rb.cpp +179 -0
  78. data/ext/ruby_mapnik/_mapnik_color.rb.h +32 -0
  79. data/ext/ruby_mapnik/_mapnik_coord.rb.cpp +145 -0
  80. data/ext/ruby_mapnik/_mapnik_coord.rb.h +32 -0
  81. data/ext/ruby_mapnik/_mapnik_datasource.rb.cpp +150 -0
  82. data/ext/ruby_mapnik/_mapnik_datasource.rb.h +32 -0
  83. data/ext/ruby_mapnik/_mapnik_datasource_cache.rb.cpp +79 -0
  84. data/ext/ruby_mapnik/_mapnik_datasource_cache.rb.h +32 -0
  85. data/ext/ruby_mapnik/_mapnik_envelope.rb.cpp +220 -0
  86. data/ext/ruby_mapnik/_mapnik_envelope.rb.h +32 -0
  87. data/ext/ruby_mapnik/_mapnik_expression.rb.cpp +91 -0
  88. data/ext/ruby_mapnik/_mapnik_expression.rb.h +32 -0
  89. data/ext/ruby_mapnik/_mapnik_feature.rb.cpp +56 -0
  90. data/ext/ruby_mapnik/_mapnik_feature.rb.h +32 -0
  91. data/ext/ruby_mapnik/_mapnik_font_engine.rb.cpp +71 -0
  92. data/ext/ruby_mapnik/_mapnik_font_engine.rb.h +32 -0
  93. data/ext/ruby_mapnik/_mapnik_geometry.rb.cpp +73 -0
  94. data/ext/ruby_mapnik/_mapnik_geometry.rb.h +32 -0
  95. data/ext/ruby_mapnik/_mapnik_glyph_symbolizer.rb.cpp +250 -0
  96. data/ext/ruby_mapnik/_mapnik_glyph_symbolizer.rb.h +32 -0
  97. data/ext/ruby_mapnik/_mapnik_layer.rb.cpp +237 -0
  98. data/ext/ruby_mapnik/_mapnik_layer.rb.h +32 -0
  99. data/ext/ruby_mapnik/_mapnik_line_pattern_symbolizer.rb.cpp +70 -0
  100. data/ext/ruby_mapnik/_mapnik_line_pattern_symbolizer.rb.h +32 -0
  101. data/ext/ruby_mapnik/_mapnik_line_symbolizer.rb.cpp +43 -0
  102. data/ext/ruby_mapnik/_mapnik_line_symbolizer.rb.h +32 -0
  103. data/ext/ruby_mapnik/_mapnik_map.rb.cpp +435 -0
  104. data/ext/ruby_mapnik/_mapnik_map.rb.h +32 -0
  105. data/ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.cpp +139 -0
  106. data/ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.h +32 -0
  107. data/ext/ruby_mapnik/_mapnik_point_symbolizer.rb.cpp +147 -0
  108. data/ext/ruby_mapnik/_mapnik_point_symbolizer.rb.h +32 -0
  109. data/ext/ruby_mapnik/_mapnik_polygon_pattern_symbolizer.rb.cpp +92 -0
  110. data/ext/ruby_mapnik/_mapnik_polygon_pattern_symbolizer.rb.h +32 -0
  111. data/ext/ruby_mapnik/_mapnik_polygon_symbolizer.rb.cpp +89 -0
  112. data/ext/ruby_mapnik/_mapnik_polygon_symbolizer.rb.h +32 -0
  113. data/ext/ruby_mapnik/_mapnik_projection.rb.cpp +98 -0
  114. data/ext/ruby_mapnik/_mapnik_projection.rb.h +32 -0
  115. data/ext/ruby_mapnik/_mapnik_raster_colorizer.rb.cpp +162 -0
  116. data/ext/ruby_mapnik/_mapnik_raster_colorizer.rb.h +32 -0
  117. data/ext/ruby_mapnik/_mapnik_raster_symbolizer.rb.cpp +53 -0
  118. data/ext/ruby_mapnik/_mapnik_raster_symbolizer.rb.h +32 -0
  119. data/ext/ruby_mapnik/_mapnik_rule.rb.cpp +99 -0
  120. data/ext/ruby_mapnik/_mapnik_rule.rb.h +32 -0
  121. data/ext/ruby_mapnik/_mapnik_shield_symbolizer.rb.cpp +86 -0
  122. data/ext/ruby_mapnik/_mapnik_shield_symbolizer.rb.h +32 -0
  123. data/ext/ruby_mapnik/_mapnik_stroke.rb.cpp +188 -0
  124. data/ext/ruby_mapnik/_mapnik_stroke.rb.h +32 -0
  125. data/ext/ruby_mapnik/_mapnik_style.rb.cpp +76 -0
  126. data/ext/ruby_mapnik/_mapnik_style.rb.h +32 -0
  127. data/ext/ruby_mapnik/_mapnik_symbolizer.rb.cpp +77 -0
  128. data/ext/ruby_mapnik/_mapnik_symbolizer.rb.h +32 -0
  129. data/ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp +521 -0
  130. data/ext/ruby_mapnik/_mapnik_text_symbolizer.rb.h +32 -0
  131. data/ext/ruby_mapnik/extconf.rb +78 -0
  132. data/ext/ruby_mapnik/ruby_mapnik.cpp +31 -0
  133. data/lib/ruby_mapnik/mapnik/font_engine.rb +35 -0
  134. data/lib/ruby_mapnik/mapnik/layer.rb +69 -0
  135. data/lib/ruby_mapnik/mapnik/map.rb +144 -0
  136. data/lib/ruby_mapnik/mapnik/projection.rb +46 -0
  137. data/lib/ruby_mapnik/mapnik/raster_colorizer.rb +55 -0
  138. data/lib/ruby_mapnik/mapnik/rule.rb +107 -0
  139. data/lib/ruby_mapnik/mapnik/stroke.rb +58 -0
  140. data/lib/ruby_mapnik/mapnik/style.rb +66 -0
  141. data/lib/ruby_mapnik/mapnik/tile.rb +93 -0
  142. data/lib/ruby_mapnik.rb +48 -0
  143. data/script/console +2 -0
  144. data/test/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.dbf +0 -0
  145. data/test/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.prj +1 -0
  146. data/test/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.shp +0 -0
  147. data/test/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.shx +0 -0
  148. data/test/data/test_map.xml +15 -0
  149. data/test/test_helper.rb +27 -0
  150. data/test/test_line_pattern_symbolizer.rb +26 -0
  151. data/test/test_mapnik_color.rb +66 -0
  152. data/test/test_mapnik_coord.rb +112 -0
  153. data/test/test_mapnik_datasource.rb +49 -0
  154. data/test/test_mapnik_envelope.rb +232 -0
  155. data/test/test_mapnik_expression.rb +19 -0
  156. data/test/test_mapnik_feature.rb +33 -0
  157. data/test/test_mapnik_font_engine.rb +13 -0
  158. data/test/test_mapnik_geometry.rb +72 -0
  159. data/test/test_mapnik_glyph_symbolizer.rb +96 -0
  160. data/test/test_mapnik_layer.rb +137 -0
  161. data/test/test_mapnik_line_symbolizer.rb +25 -0
  162. data/test/test_mapnik_map.rb +191 -0
  163. data/test/test_mapnik_markers_symbolizer.rb +46 -0
  164. data/test/test_mapnik_point_symbolizer.rb +53 -0
  165. data/test/test_mapnik_polygon_symbolizer.rb +44 -0
  166. data/test/test_mapnik_projection.rb +46 -0
  167. data/test/test_mapnik_raster_colorizer.rb +56 -0
  168. data/test/test_mapnik_raster_symbolizer.rb +40 -0
  169. data/test/test_mapnik_rule.rb +63 -0
  170. data/test/test_mapnik_shield_symbolizer.rb +193 -0
  171. data/test/test_mapnik_stroke.rb +94 -0
  172. data/test/test_mapnik_style.rb +28 -0
  173. data/test/test_mapnik_symbolizer.rb +9 -0
  174. data/test/test_mapnik_text_symbolizer.rb +232 -0
  175. data/test/test_polygon_pattern_symbolizer.rb +34 -0
  176. data/test/test_ruby_mapnik.rb +34 -0
  177. data/yard/lib/yard/parser/generic_parser.rb +72 -0
  178. data/yard/lib/yard_generic.rb +18 -0
  179. metadata +322 -0
@@ -0,0 +1,250 @@
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_glyph_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/glyph_symbolizer.hpp>
32
+
33
+ namespace {
34
+ Rice::Object get_displacement(const mapnik::glyph_symbolizer& t){
35
+ mapnik::position pos = t.get_displacement();
36
+ Rice::Array out;
37
+ out.push(boost::get<0>(pos));
38
+ out.push(boost::get<1>(pos));
39
+ return out;
40
+ }
41
+
42
+ void set_displacement(mapnik::glyph_symbolizer & t, Rice::Array ary){
43
+ double x = from_ruby<double>(ary[0]);
44
+ double y = from_ruby<double>(ary[1]);
45
+
46
+ t.set_displacement(x,y);
47
+ }
48
+
49
+ mapnik::angle_mode_enum get_angle_mode(mapnik::glyph_symbolizer const & self){
50
+ return self.get_angle_mode();
51
+ }
52
+
53
+ void set_angle_mode(mapnik::glyph_symbolizer & self, mapnik::angle_mode_enum val){
54
+ self.set_angle_mode(val);
55
+ }
56
+ }
57
+
58
+ void register_glyph_symbolizer(Rice::Module rb_mapnik){
59
+ /*
60
+ @@Module_var rb_mapnik = Mapnik
61
+ */
62
+ Rice::Enum<mapnik::angle_mode_enum> angle_enum = Rice::define_enum<mapnik::angle_mode_enum>("AngleMode", rb_mapnik);
63
+ angle_enum.define_value("AZIMUTH", mapnik::AZIMUTH);
64
+ angle_enum.define_value("TRIGONOMETRIC", mapnik::TRIGONOMETRIC);
65
+
66
+
67
+ Rice::Data_Type< mapnik::glyph_symbolizer > rb_cglyph_symbolizer = Rice::define_class_under< mapnik::glyph_symbolizer >(rb_mapnik, "GlyphSymbolizer");
68
+
69
+ /*
70
+ * Document-method: new
71
+ * call-seq:
72
+ * new(font_name, expression)
73
+ *
74
+ * @param [String] font_name Name of a font registered with the FontEngine
75
+ * @param [Mapnik::Expression] expression The value expression
76
+ *
77
+ * Returns a new Mapnik::GlyphSymbolizer
78
+ */
79
+ rb_cglyph_symbolizer.define_constructor(Rice::Constructor< mapnik::glyph_symbolizer, std::string, mapnik::expression_ptr >());
80
+
81
+ /*
82
+ * Document-method: face_name
83
+ * @return [String] the font face name
84
+ */
85
+ rb_cglyph_symbolizer.define_method("face_name", &mapnik::glyph_symbolizer::get_face_name);
86
+
87
+ /*
88
+ * Document-method: face_name=
89
+ * call-seq:
90
+ * face_name=(new_face_name)
91
+ * @param [String] The new font face name
92
+ * @return [nil]
93
+ */
94
+ rb_cglyph_symbolizer.define_method("face_name=", &mapnik::glyph_symbolizer::set_face_name);
95
+
96
+ /*
97
+ * Document-method: char
98
+ * @return [String]
99
+ */
100
+ rb_cglyph_symbolizer.define_method("char", &mapnik::glyph_symbolizer::get_char);
101
+
102
+ /*
103
+ * Document-method: char=
104
+ * call-seq:
105
+ * char=(new_char)
106
+ * @param [String]
107
+ * @return [nil]
108
+ */
109
+ rb_cglyph_symbolizer.define_method("char=", &mapnik::glyph_symbolizer::set_char);
110
+
111
+ /*
112
+ * Document-method: allow_overlap?
113
+ * @return [Boolean] Whether or not glyphs should overlap
114
+ */
115
+ rb_cglyph_symbolizer.define_method("allow_overlap?", &mapnik::glyph_symbolizer::get_allow_overlap);
116
+
117
+ /*
118
+ * Document-method: allow_overlap=
119
+ * call-seq:
120
+ * allow_overlap=(new_overlap_value)
121
+ * @param [Boolean]
122
+ * @return [nil]
123
+ */
124
+ rb_cglyph_symbolizer.define_method("allow_overlap=", &mapnik::glyph_symbolizer::set_allow_overlap);
125
+
126
+ /*
127
+ * Document-method: displacement?
128
+ * @return [Array] Two element array of the x-y displacement
129
+ */
130
+ rb_cglyph_symbolizer.define_method("displacement", &get_displacement);
131
+
132
+ /*
133
+ * Document-method: displacement=
134
+ * call-seq:
135
+ * displacement=(new_displacement_values)
136
+ * @param [Array] array in the format [x,y]
137
+ * @return [nil]
138
+ */
139
+ rb_cglyph_symbolizer.define_method("displacement=", &set_displacement);
140
+
141
+ /*
142
+ * Document-method: avoid_edges?
143
+ * @return [Boolean] Whether or not glyphs should avoid edges
144
+ */
145
+ rb_cglyph_symbolizer.define_method("avoid_edges?", &mapnik::glyph_symbolizer::get_avoid_edges);
146
+
147
+ /*
148
+ * Document-method: avoid_edges=
149
+ * call-seq:
150
+ * avoid_edges=(new_value)
151
+ * @param [Boolean]
152
+ * @return [nil]
153
+ */
154
+ rb_cglyph_symbolizer.define_method("avoid_edges=", &mapnik::glyph_symbolizer::set_avoid_edges);
155
+
156
+ /*
157
+ * Document-method: halo_fill
158
+ * @return [Mapnik::Color] Color of the halo around the text
159
+ */
160
+ rb_cglyph_symbolizer.define_method("halo_fill", &mapnik::glyph_symbolizer::get_halo_fill);
161
+
162
+ /*
163
+ * Document-method: halo_fill=
164
+ * call-seq:
165
+ * halo_fill=(color)
166
+ * @param [Mapnik::Color] The color of the halo around the text.
167
+ * @return [nil]
168
+ */
169
+ rb_cglyph_symbolizer.define_method("halo_fill=", &mapnik::glyph_symbolizer::set_halo_fill);
170
+
171
+ /*
172
+ * Document-method: halo_radius
173
+ * @return [Integer] Thickness of the text halo
174
+ */
175
+ rb_cglyph_symbolizer.define_method("halo_radius", &mapnik::glyph_symbolizer::get_halo_radius);
176
+
177
+ /*
178
+ * Document-method: halo_radius=
179
+ * call-seq:
180
+ * halo_fill=(color)
181
+ * @param [Integer] The thickness of the text halo
182
+ * @return [nil]
183
+ */
184
+ rb_cglyph_symbolizer.define_method("halo_radius=", &mapnik::glyph_symbolizer::set_halo_radius);
185
+
186
+ /*
187
+ * Document-method: size
188
+ * @return [Mapnik::Expression] Font size of the glyph
189
+ */
190
+ rb_cglyph_symbolizer.define_method("size", &mapnik::glyph_symbolizer::get_size);
191
+
192
+ /*
193
+ * Document-method: size=
194
+ * call-seq:
195
+ * size=(size_expression)
196
+ * @param [Mapnik::Expression] The new size expression
197
+ * @return [nil]
198
+ */
199
+ rb_cglyph_symbolizer.define_method("size=", &mapnik::glyph_symbolizer::set_size);
200
+
201
+ /*
202
+ * Document-method: angle
203
+ * @return [Mapnik::Expression]
204
+ */
205
+ rb_cglyph_symbolizer.define_method("angle", &mapnik::glyph_symbolizer::get_angle);
206
+
207
+ /*
208
+ * Document-method: angle=
209
+ * call-seq:
210
+ * angle=(angle_expression)
211
+ * @param [Mapnik::Expression]
212
+ * @return [nil]
213
+ */
214
+ rb_cglyph_symbolizer.define_method("angle=", &mapnik::glyph_symbolizer::set_angle);
215
+
216
+ /*
217
+ * Document-method: value
218
+ * @return [Mapnik::Expression]
219
+ */
220
+ rb_cglyph_symbolizer.define_method("value", &mapnik::glyph_symbolizer::get_value);
221
+
222
+ /*
223
+ * Document-method: value=
224
+ * call-seq:
225
+ * value=(value_expression)
226
+ * @param [Mapnik::Expression]
227
+ * @return [nil]
228
+ */
229
+ rb_cglyph_symbolizer.define_method("value=", &mapnik::glyph_symbolizer::set_value);
230
+
231
+
232
+ rb_cglyph_symbolizer.define_method("angle_mode", &get_angle_mode);
233
+ rb_cglyph_symbolizer.define_method("angle_mode=", &set_angle_mode);
234
+
235
+ /*
236
+ * Document-method: color
237
+ * @return [Mapnik::Color] Color of the text
238
+ */
239
+ rb_cglyph_symbolizer.define_method("color", &mapnik::glyph_symbolizer::get_color);
240
+
241
+ /*
242
+ * Document-method: color=
243
+ * call-seq:
244
+ * color=(color)
245
+ * @param [Mapnik::Color] The color of the text.
246
+ * @return [nil]
247
+ */
248
+ rb_cglyph_symbolizer.define_method("color=", &mapnik::glyph_symbolizer::set_color);
249
+
250
+ }
@@ -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_GLYPH_SYMBOLIZER
23
+ #define PIKA2_MAPNIK_GLYPH_SYMBOLIZER
24
+
25
+ namespace Rice
26
+ {
27
+ class Module;
28
+ }
29
+
30
+ void register_glyph_symbolizer(Rice::Module rb_mapnik);
31
+
32
+ #endif
@@ -0,0 +1,237 @@
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_layer.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/layer.hpp>
32
+
33
+ template<>
34
+ Rice::Object to_ruby<std::vector<std::string> >(std::vector<std::string> const & x)
35
+ {
36
+ return Rice::Array(x.begin(), x.end());
37
+ }
38
+
39
+ std::vector<std::string> & (mapnik::layer::*_styles_)() = &mapnik::layer::styles;
40
+
41
+ void register_layer(Rice::Module rb_mapnik){
42
+ /*
43
+ @@Module_var rb_mapnik = Mapnik
44
+ */
45
+ Rice::Data_Type< mapnik::layer > rb_clayer = Rice::define_class_under< mapnik::layer >(rb_mapnik, "Layer");
46
+
47
+ /*
48
+ * Document-method: new
49
+ * call-seq:
50
+ * new(name, srs)
51
+ * @param [String] name
52
+ * @param [String] srs
53
+ * @return [Mapnik::Layer] a new layer object
54
+ */
55
+ rb_clayer.define_constructor(Rice::Constructor< mapnik::layer, std::string, std::string >(), (Rice::Arg("name"), Rice::Arg("srs") = (std::string)"+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs"));
56
+
57
+ /*
58
+ * Document-method: datasource
59
+ * @return [Mapnik::Datasource] the layer's datasource
60
+ */
61
+ rb_clayer.define_method("datasource", &mapnik::layer::datasource);
62
+
63
+ /*
64
+ * Document-method: datasource=
65
+ * call-seq:
66
+ * datasource=(new_datasource)
67
+ * @param [Mapnik::Datasource]
68
+ * @return [nil]
69
+ */
70
+ rb_clayer.define_method("datasource=", &mapnik::layer::set_datasource, Rice::Arg("new_datasource"));
71
+
72
+ /*
73
+ * Document-method: envelope
74
+ * @return [Mapnik::Envelope] The layer's envelope
75
+ * Should correspond to the layer's datasource envelope.
76
+ */
77
+ rb_clayer.define_method("envelope", &mapnik::layer::envelope);
78
+
79
+ /*
80
+ * Document-method: name
81
+ * @return [String] The layer's name
82
+ */
83
+ rb_clayer.define_method("name", &mapnik::layer::name);
84
+
85
+ /*
86
+ * Document-method: name=
87
+ * call-seq:
88
+ * name=(new_name)
89
+ * @param [String]
90
+ * @return [nil]
91
+ */
92
+ rb_clayer.define_method("name=", &mapnik::layer::set_name, Rice::Arg("new_name"));
93
+
94
+ /*
95
+ * Document-method: title
96
+ * @return [String] The layer's title
97
+ */
98
+ rb_clayer.define_method("title", &mapnik::layer::title);
99
+
100
+ /*
101
+ * Document-method: title=
102
+ * call-seq:
103
+ * title=(new_name)
104
+ * @param [String]
105
+ * @return [nil]
106
+ */
107
+ rb_clayer.define_method("title=", &mapnik::layer::set_title, Rice::Arg("new_title"));
108
+
109
+ /*
110
+ * Document-method: abstract
111
+ * @return [String] the layer's abstract
112
+ */
113
+ rb_clayer.define_method("abstract", &mapnik::layer::abstract);
114
+
115
+ /*
116
+ * Document-method: abstract=
117
+ * call-seq:
118
+ * abstract=(new_abstract)
119
+ * @param [String]
120
+ */
121
+ rb_clayer.define_method("abstract=", &mapnik::layer::set_abstract, Rice::Arg("new_abstract"));
122
+
123
+ /*
124
+ * Document-method: srs
125
+ * @return [String] the layer's srs
126
+ */
127
+ rb_clayer.define_method("srs", &mapnik::layer::srs);
128
+
129
+ /*
130
+ * Document-method: srs=
131
+ * call-seq:
132
+ * srs=(new_srs)
133
+ * @param [String]
134
+ */
135
+ rb_clayer.define_method("srs=", &mapnik::layer::set_srs, Rice::Arg("new_srs"));
136
+
137
+ /*
138
+ * Document-method: min_zoom
139
+ * @return [Integer] the layer's minimum zoom factor
140
+ */
141
+ rb_clayer.define_method("min_zoom", &mapnik::layer::getMinZoom);
142
+
143
+ /*
144
+ * Document-method: min_zoom=
145
+ * call-seq:
146
+ * min_zoom=(min_zoom)
147
+ * @return [nil]
148
+ */
149
+ rb_clayer.define_method("min_zoom=", &mapnik::layer::setMinZoom, Rice::Arg("new_min_zoom"));
150
+
151
+ /*
152
+ * Document-method: max_zoom
153
+ * @return [Integer] the layer's maximum zoom factor
154
+ */
155
+ rb_clayer.define_method("max_zoom", &mapnik::layer::getMaxZoom);
156
+
157
+
158
+ /*
159
+ * Document-method: max_zoom=
160
+ * call-seq:
161
+ * min_zoom=(min_zoom)
162
+ * @return [nil]
163
+ */
164
+ rb_clayer.define_method("max_zoom=", &mapnik::layer::setMaxZoom, Rice::Arg("new_max_zoom"));
165
+
166
+ /*
167
+ * Document-method: visible_at_scale?
168
+ * @return [Boolean]
169
+ */
170
+ rb_clayer.define_method("visible_at_scale?", &mapnik::layer::isVisible, Rice::Arg("scale"));
171
+
172
+ /*
173
+ * Document-method: active?
174
+ * @return [Boolean]
175
+ */
176
+ rb_clayer.define_method("active?", &mapnik::layer::isActive);
177
+
178
+ /*
179
+ * Document-method: active=
180
+ * call-seq:
181
+ * active=(new_active_value)
182
+ * @return [nil]
183
+ */
184
+ rb_clayer.define_method("active=", &mapnik::layer::setActive, Rice::Arg("new_active_value"));
185
+
186
+ /*
187
+ * Document-method: queryable?
188
+ * @return [Boolean]
189
+ */
190
+ rb_clayer.define_method("queryable?", &mapnik::layer::isQueryable);
191
+
192
+ /*
193
+ * Document-method: queryable=
194
+ * call-seq:
195
+ * queryable=(new_queryable_value)
196
+ * @return [nil]
197
+ */
198
+ rb_clayer.define_method("queryable=", &mapnik::layer::setQueryable, Rice::Arg("new_queryable_value"));
199
+
200
+ /*
201
+ * Document-method: cache_features?
202
+ * @return [Boolean]
203
+ */
204
+ rb_clayer.define_method("cache_features?", &mapnik::layer::cache_features);
205
+
206
+ /*
207
+ * Document-method: cache_features=
208
+ * call-seq:
209
+ * cache_features=(new_cache_features_value)
210
+ * @return [nil]
211
+ */
212
+ rb_clayer.define_method("cache_features=", &mapnik::layer::set_cache_features, Rice::Arg("new_cache_features_value"));
213
+
214
+ /*
215
+ * Document-method: clear_label_cache?
216
+ * @return [Boolean]
217
+ */
218
+ rb_clayer.define_method("clear_label_cache?", &mapnik::layer::clear_label_cache);
219
+
220
+ /*
221
+ * Document-method: clear_label_cache=
222
+ * call-seq:
223
+ * clear_label_cache=(new_clear_label_cache_value)
224
+ * @return [nil]
225
+ */
226
+ rb_clayer.define_method("clear_label_cache=", &mapnik::layer::set_clear_label_cache, Rice::Arg("new_clear_label_cache_value"));
227
+
228
+ /*
229
+ * Dont-Document-method: __style_list__
230
+ */
231
+ rb_clayer.define_method("__style_list__", _styles_);
232
+
233
+ /*
234
+ * Dont-Document-method: __append_style__
235
+ */
236
+ rb_clayer.define_method("__append_style__", &mapnik::layer::add_style, Rice::Arg("new_style"));
237
+ }
@@ -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,70 @@
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/line_pattern_symbolizer.hpp>
31
+
32
+ const std::string get_filename(mapnik::line_pattern_symbolizer const& t) {
33
+ return mapnik::path_processor_type::to_string(*t.get_filename());
34
+ }
35
+
36
+ void set_filename(mapnik::line_pattern_symbolizer & t, std::string const& file_expr) {
37
+ t.set_filename(mapnik::parse_path(file_expr));
38
+ }
39
+
40
+ void register_line_pattern_symbolizer(Rice::Module rb_mapnik){
41
+ /*
42
+ @@Module_var rb_mapnik = Mapnik
43
+ */
44
+ Rice::Data_Type< mapnik::line_pattern_symbolizer > rb_cline_pattern_symbolizer = Rice::define_class_under< mapnik::line_pattern_symbolizer >(rb_mapnik, "LinePatternSymbolizer");
45
+
46
+ /*
47
+ * Document-method: new
48
+ * call-seq:
49
+ * new(expression)
50
+ * @param [Mapnik::Expression]
51
+ * @return [Mapnik::LinePatternSymbolizer] a new line symbolzier object
52
+ */
53
+ rb_cline_pattern_symbolizer.define_constructor(Rice::Constructor< mapnik::line_pattern_symbolizer, mapnik::path_expression_ptr>());
54
+
55
+ /*
56
+ * Document-method: filename
57
+ * @return [Mapnik::PathExpression]
58
+ */
59
+ rb_cline_pattern_symbolizer.define_method("filename", &get_filename);
60
+
61
+ /*
62
+ * Document-method: filename=
63
+ * call-seq:
64
+ * filename=(new_filename)
65
+ * @param [Mapnik::PathExpression]
66
+ * @return [nil]
67
+ */
68
+ rb_cline_pattern_symbolizer.define_method("filename=", &set_filename);
69
+
70
+ }
@@ -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
+ }