mapnik 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. data/.autotest +35 -0
  2. data/.yardopts +1 -0
  3. data/Gemfile +14 -0
  4. data/LICENSE +19 -0
  5. data/Manifest.txt +172 -0
  6. data/README.rdoc +107 -0
  7. data/Rakefile +43 -0
  8. data/demo/data/COPYRIGHT.txt +3 -0
  9. data/demo/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.dbf +0 -0
  10. data/demo/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.prj +1 -0
  11. data/demo/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.shp +0 -0
  12. data/demo/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.shx +0 -0
  13. data/demo/data/boundaries.dbf +0 -0
  14. data/demo/data/boundaries.prj +1 -0
  15. data/demo/data/boundaries.sbx +0 -0
  16. data/demo/data/boundaries.shp +0 -0
  17. data/demo/data/boundaries.shx +0 -0
  18. data/demo/data/boundaries_l.dbf +0 -0
  19. data/demo/data/boundaries_l.prj +1 -0
  20. data/demo/data/boundaries_l.sbx +0 -0
  21. data/demo/data/boundaries_l.shp +0 -0
  22. data/demo/data/boundaries_l.shx +0 -0
  23. data/demo/data/ontdrainage.dbf +0 -0
  24. data/demo/data/ontdrainage.prj +1 -0
  25. data/demo/data/ontdrainage.sbx +0 -0
  26. data/demo/data/ontdrainage.shp +0 -0
  27. data/demo/data/ontdrainage.shx +0 -0
  28. data/demo/data/popplaces.dbf +0 -0
  29. data/demo/data/popplaces.prj +1 -0
  30. data/demo/data/popplaces.sbx +0 -0
  31. data/demo/data/popplaces.shp +0 -0
  32. data/demo/data/popplaces.shx +0 -0
  33. data/demo/data/qcdrainage.dbf +0 -0
  34. data/demo/data/qcdrainage.prj +1 -0
  35. data/demo/data/qcdrainage.sbx +0 -0
  36. data/demo/data/qcdrainage.shp +0 -0
  37. data/demo/data/qcdrainage.shx +0 -0
  38. data/demo/data/roads.dbf +0 -0
  39. data/demo/data/roads.prj +1 -0
  40. data/demo/data/roads.sbx +0 -0
  41. data/demo/data/roads.shp +0 -0
  42. data/demo/data/roads.shx +0 -0
  43. data/demo/data/test/charplacement.dbf +0 -0
  44. data/demo/data/test/charplacement.shp +0 -0
  45. data/demo/data/test/charplacement.shx +0 -0
  46. data/demo/data/test/displacement.dbf +0 -0
  47. data/demo/data/test/displacement.shp +0 -0
  48. data/demo/data/test/displacement.shx +0 -0
  49. data/demo/data/test/overlap.dbf +0 -0
  50. data/demo/data/test/overlap.shp +0 -0
  51. data/demo/data/test/overlap.shx +0 -0
  52. data/demo/data/test/raw/charplacement.gfs +25 -0
  53. data/demo/data/test/raw/charplacement.gml +99 -0
  54. data/demo/data/test/raw/charplacement.xsd +36 -0
  55. data/demo/data/test/raw/displacement.gfs +25 -0
  56. data/demo/data/test/raw/displacement.gml +173 -0
  57. data/demo/data/test/raw/displacement.xsd +36 -0
  58. data/demo/data/test/raw/overlap.gfs +25 -0
  59. data/demo/data/test/raw/overlap.gml +127 -0
  60. data/demo/data/test/raw/overlap.xsd +36 -0
  61. data/demo/data/test/raw/textspacing.gfs +25 -0
  62. data/demo/data/test/raw/textspacing.gml +117 -0
  63. data/demo/data/test/raw/textspacing.xsd +36 -0
  64. data/demo/data/test/readme.txt +3 -0
  65. data/demo/data/test/regenerate.sh +20 -0
  66. data/demo/data/test/textspacing.dbf +0 -0
  67. data/demo/data/test/textspacing.shp +0 -0
  68. data/demo/data/test/textspacing.shx +0 -0
  69. data/demo/rundemo.rb +145 -0
  70. data/demo/sinatra/demo.rb +31 -0
  71. data/demo/sinatra/public/css/demo_map.css +7 -0
  72. data/demo/sinatra/public/index.html +13 -0
  73. data/demo/sinatra/public/javascripts/demo_map.js +42 -0
  74. data/ext/ruby_mapnik/_mapnik.cpp +52 -0
  75. data/ext/ruby_mapnik/_mapnik.h +65 -0
  76. data/ext/ruby_mapnik/_mapnik_color.rb.cpp +179 -0
  77. data/ext/ruby_mapnik/_mapnik_color.rb.h +32 -0
  78. data/ext/ruby_mapnik/_mapnik_coord.rb.cpp +145 -0
  79. data/ext/ruby_mapnik/_mapnik_coord.rb.h +32 -0
  80. data/ext/ruby_mapnik/_mapnik_datasource.rb.cpp +170 -0
  81. data/ext/ruby_mapnik/_mapnik_datasource.rb.h +32 -0
  82. data/ext/ruby_mapnik/_mapnik_datasource_cache.rb.cpp +87 -0
  83. data/ext/ruby_mapnik/_mapnik_datasource_cache.rb.h +32 -0
  84. data/ext/ruby_mapnik/_mapnik_envelope.rb.cpp +220 -0
  85. data/ext/ruby_mapnik/_mapnik_envelope.rb.h +32 -0
  86. data/ext/ruby_mapnik/_mapnik_expression.rb.cpp +91 -0
  87. data/ext/ruby_mapnik/_mapnik_expression.rb.h +32 -0
  88. data/ext/ruby_mapnik/_mapnik_feature.rb.cpp +93 -0
  89. data/ext/ruby_mapnik/_mapnik_feature.rb.h +32 -0
  90. data/ext/ruby_mapnik/_mapnik_font_engine.rb.cpp +71 -0
  91. data/ext/ruby_mapnik/_mapnik_font_engine.rb.h +32 -0
  92. data/ext/ruby_mapnik/_mapnik_layer.rb.cpp +208 -0
  93. data/ext/ruby_mapnik/_mapnik_layer.rb.h +32 -0
  94. data/ext/ruby_mapnik/_mapnik_line_pattern_symbolizer.rb.cpp +71 -0
  95. data/ext/ruby_mapnik/_mapnik_line_pattern_symbolizer.rb.h +32 -0
  96. data/ext/ruby_mapnik/_mapnik_line_symbolizer.rb.cpp +43 -0
  97. data/ext/ruby_mapnik/_mapnik_line_symbolizer.rb.h +32 -0
  98. data/ext/ruby_mapnik/_mapnik_map.rb.cpp +489 -0
  99. data/ext/ruby_mapnik/_mapnik_map.rb.h +32 -0
  100. data/ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.cpp +140 -0
  101. data/ext/ruby_mapnik/_mapnik_markers_symbolizer.rb.h +32 -0
  102. data/ext/ruby_mapnik/_mapnik_point_symbolizer.rb.cpp +150 -0
  103. data/ext/ruby_mapnik/_mapnik_point_symbolizer.rb.h +32 -0
  104. data/ext/ruby_mapnik/_mapnik_polygon_pattern_symbolizer.rb.cpp +93 -0
  105. data/ext/ruby_mapnik/_mapnik_polygon_pattern_symbolizer.rb.h +32 -0
  106. data/ext/ruby_mapnik/_mapnik_polygon_symbolizer.rb.cpp +89 -0
  107. data/ext/ruby_mapnik/_mapnik_polygon_symbolizer.rb.h +32 -0
  108. data/ext/ruby_mapnik/_mapnik_projection.rb.cpp +100 -0
  109. data/ext/ruby_mapnik/_mapnik_projection.rb.h +32 -0
  110. data/ext/ruby_mapnik/_mapnik_raster_colorizer.rb.cpp +162 -0
  111. data/ext/ruby_mapnik/_mapnik_raster_colorizer.rb.h +32 -0
  112. data/ext/ruby_mapnik/_mapnik_raster_symbolizer.rb.cpp +87 -0
  113. data/ext/ruby_mapnik/_mapnik_raster_symbolizer.rb.h +32 -0
  114. data/ext/ruby_mapnik/_mapnik_rule.rb.cpp +69 -0
  115. data/ext/ruby_mapnik/_mapnik_rule.rb.h +32 -0
  116. data/ext/ruby_mapnik/_mapnik_shield_symbolizer.rb.cpp +86 -0
  117. data/ext/ruby_mapnik/_mapnik_shield_symbolizer.rb.h +32 -0
  118. data/ext/ruby_mapnik/_mapnik_stroke.rb.cpp +188 -0
  119. data/ext/ruby_mapnik/_mapnik_stroke.rb.h +32 -0
  120. data/ext/ruby_mapnik/_mapnik_style.rb.cpp +76 -0
  121. data/ext/ruby_mapnik/_mapnik_style.rb.h +32 -0
  122. data/ext/ruby_mapnik/_mapnik_symbolizer.rb.cpp +75 -0
  123. data/ext/ruby_mapnik/_mapnik_symbolizer.rb.h +32 -0
  124. data/ext/ruby_mapnik/_mapnik_text_symbolizer.rb.cpp +471 -0
  125. data/ext/ruby_mapnik/_mapnik_text_symbolizer.rb.h +32 -0
  126. data/ext/ruby_mapnik/extconf.rb +80 -0
  127. data/ext/ruby_mapnik/ruby_mapnik.cpp +32 -0
  128. data/lib/mapnik.rb +1 -0
  129. data/lib/ruby_mapnik.rb +48 -0
  130. data/lib/ruby_mapnik/mapnik/font_engine.rb +35 -0
  131. data/lib/ruby_mapnik/mapnik/layer.rb +68 -0
  132. data/lib/ruby_mapnik/mapnik/map.rb +166 -0
  133. data/lib/ruby_mapnik/mapnik/projection.rb +44 -0
  134. data/lib/ruby_mapnik/mapnik/raster_colorizer.rb +55 -0
  135. data/lib/ruby_mapnik/mapnik/rule.rb +104 -0
  136. data/lib/ruby_mapnik/mapnik/stroke.rb +56 -0
  137. data/lib/ruby_mapnik/mapnik/style.rb +64 -0
  138. data/lib/ruby_mapnik/mapnik/tile.rb +93 -0
  139. data/script/console +2 -0
  140. data/test/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.dbf +0 -0
  141. data/test/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.prj +1 -0
  142. data/test/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.shp +0 -0
  143. data/test/data/TM_WORLD_BORDERS_SIMPL_0.3_MOD.shx +0 -0
  144. data/test/data/test_map.xml +15 -0
  145. data/test/test_helper.rb +29 -0
  146. data/test/test_line_pattern_symbolizer.rb +26 -0
  147. data/test/test_mapnik_color.rb +66 -0
  148. data/test/test_mapnik_coord.rb +92 -0
  149. data/test/test_mapnik_datasource.rb +49 -0
  150. data/test/test_mapnik_envelope.rb +232 -0
  151. data/test/test_mapnik_expression.rb +19 -0
  152. data/test/test_mapnik_feature.rb +29 -0
  153. data/test/test_mapnik_font_engine.rb +13 -0
  154. data/test/test_mapnik_layer.rb +121 -0
  155. data/test/test_mapnik_line_symbolizer.rb +25 -0
  156. data/test/test_mapnik_map.rb +211 -0
  157. data/test/test_mapnik_markers_symbolizer.rb +46 -0
  158. data/test/test_mapnik_point_symbolizer.rb +53 -0
  159. data/test/test_mapnik_polygon_symbolizer.rb +44 -0
  160. data/test/test_mapnik_projection.rb +46 -0
  161. data/test/test_mapnik_raster_colorizer.rb +56 -0
  162. data/test/test_mapnik_raster_symbolizer.rb +45 -0
  163. data/test/test_mapnik_rule.rb +45 -0
  164. data/test/test_mapnik_shield_symbolizer.rb +156 -0
  165. data/test/test_mapnik_stroke.rb +94 -0
  166. data/test/test_mapnik_style.rb +28 -0
  167. data/test/test_mapnik_symbolizer.rb +9 -0
  168. data/test/test_mapnik_text_symbolizer.rb +208 -0
  169. data/test/test_polygon_pattern_symbolizer.rb +34 -0
  170. data/test/test_ruby_mapnik.rb +34 -0
  171. data/yard/lib/yard/parser/generic_parser.rb +72 -0
  172. data/yard/lib/yard_generic.rb +18 -0
  173. metadata +333 -0
@@ -0,0 +1,32 @@
1
+ /*****************************************************************************
2
+ Copyright (C) 2011 Elliot Laster
3
+
4
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
5
+ this software and associated documentation files (the ‘Software’), to deal in
6
+ the Software without restriction, including without limitation the rights to
7
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
8
+ of the Software, and to permit persons to whom the Software is furnished to do
9
+ so, subject to the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all
12
+ copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20
+ SOFTWARE.
21
+ *****************************************************************************/
22
+ #ifndef PIKA2_MAPNIK_STROKE
23
+ #define PIKA2_MAPNIK_STROKE
24
+
25
+ namespace Rice
26
+ {
27
+ class Module;
28
+ }
29
+
30
+ void register_stroke(Rice::Module rb_mapnik);
31
+
32
+ #endif
@@ -0,0 +1,76 @@
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_style.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/feature_type_style.hpp>
32
+
33
+
34
+ template<>
35
+ Rice::Object to_ruby<std::vector<mapnik::rule> >(std::vector<mapnik::rule> const & x)
36
+ {
37
+ return Rice::Array(x.begin(), x.end());
38
+ }
39
+
40
+ namespace {
41
+
42
+ void set_style_filter(mapnik::feature_type_style& self, mapnik::filter_mode_enum value){
43
+ mapnik::filter_mode_e v(value);
44
+ self.set_filter_mode(v);
45
+ }
46
+
47
+ mapnik::filter_mode_enum get_style_filter(const mapnik::feature_type_style& self){
48
+ return self.get_filter_mode();
49
+ }
50
+
51
+ }
52
+ void register_style(Rice::Module rb_mapnik){
53
+ /*
54
+ @@Module_var rb_mapnik = Mapnik
55
+ */
56
+ Rice::Data_Type< mapnik::feature_type_style > rb_cstyle = Rice::define_class_under< mapnik::feature_type_style >(rb_mapnik, "Style");
57
+
58
+ /*
59
+ * Document-method: new
60
+ * @return [Mapnik::Style]
61
+ */
62
+ rb_cstyle.define_constructor(Rice::Constructor< mapnik::feature_type_style >());
63
+
64
+ // Dont-Document-method: __rules__
65
+ rb_cstyle.define_method("__rules__", &mapnik::feature_type_style::get_rules);
66
+
67
+ // Dont-Document-method: __add_rule__
68
+ rb_cstyle.define_method("__add_rule__", &mapnik::feature_type_style::add_rule);
69
+
70
+ rb_cstyle.define_method("filter_mode=", &set_style_filter);
71
+ rb_cstyle.define_method("filter_mode", &get_style_filter);
72
+
73
+ Rice::Enum<mapnik::filter_mode_enum> rb_cfilter_mode_enum = Rice::define_enum<mapnik::filter_mode_enum>("FilterMode", rb_mapnik);
74
+ rb_cfilter_mode_enum.define_value("ALL",mapnik::FILTER_ALL);
75
+ rb_cfilter_mode_enum.define_value("FIRST",mapnik::FILTER_FIRST);
76
+ }
@@ -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_STYLE
23
+ #define PIKA2_MAPNIK_STYLE
24
+
25
+ namespace Rice
26
+ {
27
+ class Module;
28
+ }
29
+
30
+ void register_style(Rice::Module rb_mapnik);
31
+
32
+ #endif
@@ -0,0 +1,75 @@
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_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/rule.hpp>
32
+
33
+ namespace {
34
+
35
+ // TODO: This is just terrible...
36
+ mapnik::symbolizer from_subtype(Rice::Object obj){
37
+ mapnik::symbolizer out;
38
+ std::string class_name = obj.class_of().to_s().str();
39
+ if(class_name == "Mapnik::PolygonSymbolizer") {
40
+ out = mapnik::symbolizer(from_ruby<mapnik::polygon_symbolizer>(obj));
41
+ } else if(class_name == "Mapnik::LineSymbolizer") {
42
+ out = mapnik::symbolizer(from_ruby<mapnik::line_symbolizer>(obj));
43
+ } else if(class_name == "Mapnik::TextSymbolizer"){
44
+ out = mapnik::symbolizer(from_ruby<mapnik::text_symbolizer>(obj));
45
+ } else if(class_name == "Mapnik::LinePatternSymbolizer"){
46
+ out = mapnik::symbolizer(from_ruby<mapnik::line_pattern_symbolizer>(obj));
47
+ } else if(class_name == "Mapnik::MarkersSymbolizer"){
48
+ out = mapnik::symbolizer(from_ruby<mapnik::markers_symbolizer>(obj));
49
+ } else if(class_name == "Mapnik::PointSymbolizer") {
50
+ out = mapnik::symbolizer(from_ruby<mapnik::point_symbolizer>(obj));
51
+ } else if(class_name == "Mapnik::PolygonPatternSymbolizer"){
52
+ out = mapnik::symbolizer(from_ruby<mapnik::polygon_pattern_symbolizer>(obj));
53
+ } else if(class_name == "Mapnik::RasterSymbolizer"){
54
+ out = mapnik::symbolizer(from_ruby<mapnik::raster_symbolizer>(obj));
55
+ } else if(class_name == "Mapnik::ShieldSymbolizer"){
56
+ out = mapnik::symbolizer(from_ruby<mapnik::shield_symbolizer>(obj));
57
+ }
58
+ return out;
59
+ }
60
+
61
+ }
62
+ void register_symbolizer(Rice::Module rb_mapnik){
63
+ /*
64
+ @@Module_var rb_mapnik = Mapnik
65
+ */
66
+ Rice::Data_Type< mapnik::symbolizer > rb_csymbolizer = Rice::define_class_under< mapnik::symbolizer >(rb_mapnik, "Symbolizer");
67
+
68
+ /*
69
+ * Document-method: from_subtype
70
+ * call-seq:
71
+ * from_subtype(symbolizer)
72
+ * @return [Mapnik::Symbolizer]
73
+ */
74
+ rb_csymbolizer.define_singleton_method("from_subtype", &from_subtype, Rice::Arg("obj"));
75
+ }
@@ -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_SYMBOLIZER
23
+ #define PIKA2_MAPNIK_SYMBOLIZER
24
+
25
+ namespace Rice
26
+ {
27
+ class Module;
28
+ }
29
+
30
+ void register_symbolizer(Rice::Module rb_mapnik);
31
+
32
+ #endif
@@ -0,0 +1,471 @@
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_text_displacement(const mapnik::text_symbolizer& t){
37
+ mapnik::position pos = t.get_displacement();
38
+ Rice::Array out;
39
+ out.push(pos.first);
40
+ out.push(pos.second);
41
+ return out;
42
+ }
43
+
44
+ void set_text_displacement(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_displacement(x,y);
49
+ }
50
+
51
+ mapnik::horizontal_alignment get_text_horizontal_alignment(mapnik::text_symbolizer const & self){
52
+ mapnik::horizontal_alignment alignment = self.get_horizontal_alignment();
53
+ return alignment;
54
+ }
55
+
56
+ void set_text_horizontal_alignment(mapnik::text_symbolizer & self, mapnik::horizontal_alignment val){
57
+ self.set_horizontal_alignment(val);
58
+ }
59
+
60
+ mapnik::justify_alignment get_text_justify_alignment(mapnik::text_symbolizer const & self){
61
+ mapnik::justify_alignment alignment = self.get_justify_alignment();
62
+ return alignment;
63
+ }
64
+
65
+ void set_text_justify_alignment(mapnik::text_symbolizer & self, mapnik::justify_alignment val){
66
+ self.set_justify_alignment(val);
67
+ }
68
+
69
+ mapnik::label_placement_enum get_text_label_placement(mapnik::text_symbolizer const & self){
70
+ mapnik::label_placement_enum alignment = self.get_label_placement();
71
+ return alignment;
72
+ }
73
+
74
+ void set_text_label_placement(mapnik::text_symbolizer & self, mapnik::label_placement_enum val){
75
+ self.set_label_placement(val);
76
+ }
77
+
78
+ mapnik::text_transform get_text_transform(mapnik::text_symbolizer const & self){
79
+ mapnik::text_transform transform = self.get_text_transform();
80
+ return transform;
81
+ }
82
+
83
+ void set_text_transform(mapnik::text_symbolizer & self, mapnik::text_transform val){
84
+ self.set_text_transform(val);
85
+ }
86
+
87
+ mapnik::vertical_alignment get_vertical_alignment(mapnik::text_symbolizer const & self){
88
+ mapnik::vertical_alignment transform = self.get_vertical_alignment();
89
+ return transform;
90
+ }
91
+
92
+ void set_vertical_alignment(mapnik::text_symbolizer & self, mapnik::vertical_alignment val){
93
+ self.set_vertical_alignment(val);
94
+ }
95
+
96
+ }
97
+
98
+ void register_text_symbolizer(Rice::Module rb_mapnik){
99
+ /*
100
+ @@Module_var rb_mapnik = Mapnik
101
+ */
102
+ Rice::Enum<mapnik::label_placement_enum> label_placement = Rice::define_enum<mapnik::label_placement_enum>("LABEL_PLACEMENT", rb_mapnik);
103
+ label_placement.define_value("LINE_PLACEMENT", mapnik::LINE_PLACEMENT);
104
+ label_placement.define_value("POINT_PLACEMENT", mapnik::POINT_PLACEMENT);
105
+ label_placement.define_value("VERTEX_PLACEMENT", mapnik::VERTEX_PLACEMENT);
106
+ label_placement.define_value("INTERIOR_PLACEMENT", mapnik::INTERIOR_PLACEMENT);
107
+
108
+ Rice::Enum<mapnik::vertical_alignment> vertical_alignment = Rice::define_enum<mapnik::vertical_alignment>("VERTICAL_ALIGNMENT", rb_mapnik);
109
+ vertical_alignment.define_value("TOP", mapnik::V_TOP);
110
+ vertical_alignment.define_value("MIDDLE", mapnik::V_MIDDLE);
111
+ vertical_alignment.define_value("BOTTOM", mapnik::V_BOTTOM);
112
+ vertical_alignment.define_value("AUTO", mapnik::V_AUTO);
113
+
114
+ Rice::Enum<mapnik::horizontal_alignment> horizontal_alignment = Rice::define_enum<mapnik::horizontal_alignment>("HORIZONTAL_ALIGNMENT", rb_mapnik);
115
+ horizontal_alignment.define_value("LEFT", mapnik::H_LEFT);
116
+ horizontal_alignment.define_value("MIDDLE", mapnik::H_MIDDLE);
117
+ horizontal_alignment.define_value("RIGHT", mapnik::H_RIGHT);
118
+
119
+ Rice::Enum<mapnik::justify_alignment> justify_alignment_rice = Rice::define_enum<mapnik::justify_alignment>("JUSTIFY_ALIGNMENT", rb_mapnik);
120
+ justify_alignment_rice.define_value("LEFT", mapnik::J_LEFT);
121
+ justify_alignment_rice.define_value("MIDDLE", mapnik::J_MIDDLE);
122
+ justify_alignment_rice.define_value("RIGHT", mapnik::J_RIGHT);
123
+
124
+ Rice::Enum<mapnik::text_transform> text_transform = Rice::define_enum<mapnik::text_transform>("TEXT_TRANSFORM", rb_mapnik);
125
+ text_transform.define_value("NONE", mapnik::NONE);
126
+ text_transform.define_value("UPPERCASE", mapnik::UPPERCASE);
127
+ text_transform.define_value("LOWERCASE", mapnik::LOWERCASE);
128
+ text_transform.define_value("CAPITALIZE", mapnik::CAPITALIZE);
129
+
130
+ Rice::Data_Type< mapnik::text_symbolizer > rb_ctext_symbolizer = Rice::define_class_under< mapnik::text_symbolizer >(rb_mapnik, "TextSymbolizer");
131
+
132
+ /*
133
+ * Document-method: new
134
+ * call-seq:
135
+ * new(expression, font_name, size, color)
136
+ * @param [Mapnik::Expression] expression
137
+ * @param [String] font_name
138
+ * @param [Integer] size
139
+ * @param [Mapnik::Color] color
140
+ */
141
+ rb_ctext_symbolizer.define_constructor(Rice::Constructor< mapnik::text_symbolizer, mapnik::expression_ptr, std::string, int, mapnik::color >());
142
+
143
+ /*
144
+ * Document-method: allow_overlap?
145
+ * @return [Boolean]
146
+ */
147
+ rb_ctext_symbolizer.define_method("allow_overlap?", &mapnik::text_symbolizer::get_allow_overlap);
148
+
149
+ /*
150
+ * Document-method: allow_overlap=
151
+ * call-seq:
152
+ * allow_overlap=(new_value)
153
+ * @param [Boolean] new_value
154
+ * @return [Boolean]
155
+ */
156
+ rb_ctext_symbolizer.define_method("allow_overlap=", &mapnik::text_symbolizer::set_allow_overlap);
157
+
158
+ /*
159
+ * Document-method: displacement
160
+ * @return [Array] Two element array in the form [x, y]
161
+ */
162
+ rb_ctext_symbolizer.define_method("displacement", &get_text_displacement);
163
+
164
+ /* Document-method: displacement=
165
+ * call-seq:
166
+ * displacement=(new_displacement)
167
+ * @param [Array] new_displacement array in the form [x, y]
168
+ * @return [Array]
169
+ */
170
+ rb_ctext_symbolizer.define_method("displacement=", &set_text_displacement);
171
+
172
+ /*
173
+ * Document-method: avoid_edges?
174
+ * @return [Boolean]
175
+ */
176
+ rb_ctext_symbolizer.define_method("avoid_edges?", &mapnik::text_symbolizer::get_avoid_edges);
177
+
178
+ /*
179
+ * Document-method: avoid_edges=
180
+ * call-seq:
181
+ * avoid_edges=(new_value)
182
+ * @param [Boolean] new_value
183
+ * @return [Boolean]
184
+ */
185
+ rb_ctext_symbolizer.define_method("avoid_edges=", &mapnik::text_symbolizer::set_avoid_edges);
186
+
187
+ /*
188
+ * Document-method: character_spacing
189
+ * @return [Float]
190
+ */
191
+ rb_ctext_symbolizer.define_method("character_spacing", &mapnik::text_symbolizer::get_character_spacing);
192
+
193
+ /*
194
+ * Document-method: character_spacing=
195
+ * call-seq:
196
+ * character_spacing=(new_value)
197
+ * @param [Float]
198
+ * @return [Float]
199
+ */
200
+ rb_ctext_symbolizer.define_method("character_spacing=", &mapnik::text_symbolizer::set_character_spacing);
201
+
202
+ /*
203
+ * Document-method: face_name
204
+ * @return [String]
205
+ */
206
+ rb_ctext_symbolizer.define_method("face_name", &mapnik::text_symbolizer::get_face_name);
207
+
208
+ /*
209
+ * Document-method: face_name=
210
+ * call-seq:
211
+ * face_name=(new_value)
212
+ * @param [String] face_name a font face name that is registered with the FontEngine
213
+ * @return [String]
214
+ */
215
+ rb_ctext_symbolizer.define_method("face_name=", &mapnik::text_symbolizer::set_face_name);
216
+
217
+ /*
218
+ * Document-method: fill
219
+ * @return [Mapnik::Color]
220
+ */
221
+ rb_ctext_symbolizer.define_method("fill", &mapnik::text_symbolizer::get_fill);
222
+
223
+ /*
224
+ * Document-method: fill=
225
+ * call-seq:
226
+ * fill=(color)
227
+ * @param [Mapnik::Color] color
228
+ * @return [Mapnik::Color]
229
+ */
230
+ rb_ctext_symbolizer.define_method("fill=", &mapnik::text_symbolizer::set_fill);
231
+
232
+ // TODO: Need fontset
233
+ // rb_ctext_symbolizer.define_method("fontset", &mapnik::text_symbolizer::get_fontset);
234
+ // rb_ctext_symbolizer.define_method("fontset=", &mapnik::text_symbolizer::set_fontset);
235
+
236
+ /*
237
+ * Document-method: halo_fill
238
+ * @return [Mapnik::Color]
239
+ */
240
+ rb_ctext_symbolizer.define_method("halo_fill", &mapnik::text_symbolizer::get_halo_fill);
241
+
242
+ /*
243
+ * Document-method: halo_fill=
244
+ * call-seq:
245
+ * halo_fill=(color)
246
+ * @param [Mapnik::Color]
247
+ * @return [Mapnik::Color]
248
+ */
249
+ rb_ctext_symbolizer.define_method("halo_fill=", &mapnik::text_symbolizer::set_halo_fill);
250
+
251
+ /*
252
+ * Document-method: halo_radius
253
+ * @return [Float]
254
+ */
255
+ rb_ctext_symbolizer.define_method("halo_radius", &mapnik::text_symbolizer::get_halo_radius);
256
+
257
+ /*
258
+ * Document-method: halo_radius=
259
+ * call-seq:
260
+ * halo_radius=(radius)
261
+ * @param [Float] radius
262
+ * @return [Float]
263
+ */
264
+ rb_ctext_symbolizer.define_method("halo_radius=", &mapnik::text_symbolizer::set_halo_radius);
265
+
266
+ rb_ctext_symbolizer.define_method("horizontal_alignment", &get_text_horizontal_alignment);
267
+ rb_ctext_symbolizer.define_method("horizontal_alignment=", &set_text_horizontal_alignment);
268
+
269
+ rb_ctext_symbolizer.define_method("justify_alignment", &get_text_justify_alignment);
270
+ rb_ctext_symbolizer.define_method("justify_alignment=", &set_text_justify_alignment);
271
+
272
+ rb_ctext_symbolizer.define_method("label_placement", &get_text_label_placement);
273
+ rb_ctext_symbolizer.define_method("label_placement=", &set_text_label_placement);
274
+
275
+ /*
276
+ * Document-method: label_position_tolerance
277
+ * @return [Integer]
278
+ */
279
+ rb_ctext_symbolizer.define_method("label_position_tolerance", &mapnik::text_symbolizer::get_label_position_tolerance);
280
+
281
+ /*
282
+ * Document-method: label_position_tolerance=
283
+ * call-seq:
284
+ * label_position_tolerance=(tolerance)
285
+ * @param [Integer] tolerance
286
+ * @return [Integer]
287
+ */
288
+ rb_ctext_symbolizer.define_method("label_position_tolerance=", &mapnik::text_symbolizer::set_label_position_tolerance);
289
+
290
+ /*
291
+ * Document-method: label_spacing
292
+ * @return [Integer]
293
+ */
294
+ rb_ctext_symbolizer.define_method("label_spacing", &mapnik::text_symbolizer::get_label_spacing);
295
+
296
+ /*
297
+ * Document-method: label_spacing=
298
+ * call-seq:
299
+ * label_spacing=(spacing)
300
+ * @param [Integer]
301
+ * @return [Integer]
302
+ */
303
+ rb_ctext_symbolizer.define_method("label_spacing=", &mapnik::text_symbolizer::set_label_spacing);
304
+
305
+ /*
306
+ * Document-method: line_spacing
307
+ * @return [Integer]
308
+ */
309
+ rb_ctext_symbolizer.define_method("line_spacing", &mapnik::text_symbolizer::get_line_spacing);
310
+
311
+ /*
312
+ * Document-method: line_spacing=
313
+ * call-seq:
314
+ * line_spacing=(spacing)
315
+ * @param [Integer]
316
+ * @return [Integer]
317
+ */
318
+ rb_ctext_symbolizer.define_method("line_spacing=", &mapnik::text_symbolizer::set_line_spacing);
319
+
320
+ /*
321
+ * Document-method: max_char_angle_delta
322
+ * @return [Float]
323
+ */
324
+ rb_ctext_symbolizer.define_method("max_char_angle_delta", &mapnik::text_symbolizer::get_max_char_angle_delta);
325
+
326
+ /*
327
+ * Document-method: max_char_angle_delta=
328
+ * call-seq:
329
+ * max_char_angle_delta=(delta)
330
+ * @param [Float]
331
+ * @return [Float]
332
+ */
333
+ rb_ctext_symbolizer.define_method("max_char_angle_delta=", &mapnik::text_symbolizer::set_max_char_angle_delta);
334
+
335
+ /*
336
+ * Document-method: minimum_distance
337
+ * @return [Float]
338
+ */
339
+ rb_ctext_symbolizer.define_method("minimum_distance", &mapnik::text_symbolizer::get_minimum_distance);
340
+
341
+ /*
342
+ * Document-method: minimum_distance=
343
+ * call-seq:
344
+ * minimum_distance=(distance)
345
+ * @param [Float]
346
+ * @return [Float]
347
+ */
348
+ rb_ctext_symbolizer.define_method("minimum_distance=", &mapnik::text_symbolizer::set_minimum_distance);
349
+
350
+ /*
351
+ * Document-method: minimum_padding
352
+ * @return [Float]
353
+ */
354
+ rb_ctext_symbolizer.define_method("minimum_padding", &mapnik::text_symbolizer::get_minimum_padding);
355
+
356
+ /*
357
+ * Document-method: minimum_padding=
358
+ * call-seq:
359
+ * minimum_padding=(padding)
360
+ * @param [Float]
361
+ * @return [Float]
362
+ */
363
+ rb_ctext_symbolizer.define_method("minimum_padding=", &mapnik::text_symbolizer::set_minimum_padding);
364
+
365
+ /*
366
+ * Document-method: name=
367
+ * call-seq:
368
+ * name=(new_name)
369
+ * @param [Mapnik::Expression] new_name
370
+ * @return [Mapnik::Expression]
371
+ */
372
+ rb_ctext_symbolizer.define_method("name=", &mapnik::text_symbolizer::set_name);
373
+
374
+ /*
375
+ * Document-method: opacity
376
+ * @return [Float]
377
+ */
378
+ rb_ctext_symbolizer.define_method("opacity", &mapnik::text_symbolizer::get_text_opacity);
379
+
380
+ /*
381
+ * Document-method: opacity=
382
+ * call-seq:
383
+ * opacity=(new_value)
384
+ * @param [Float] new_value
385
+ * @return [Float]
386
+ */
387
+ rb_ctext_symbolizer.define_method("opacity=", &mapnik::text_symbolizer::set_text_opacity);
388
+
389
+ rb_ctext_symbolizer.define_method("text_transform", &get_text_transform);
390
+ rb_ctext_symbolizer.define_method("text_transform=", &set_text_transform);
391
+
392
+ /*
393
+ * Document-method: ratio
394
+ * @return [Integer]
395
+ */
396
+ rb_ctext_symbolizer.define_method("ratio", &mapnik::text_symbolizer::get_text_ratio);
397
+
398
+ /*
399
+ * Document-method: ratio=
400
+ * call-seq:
401
+ * ratio=(new_ratio)
402
+ * @param [Integer] new_ratio
403
+ * @return [Integer]
404
+ */
405
+ rb_ctext_symbolizer.define_method("ratio=", &mapnik::text_symbolizer::set_text_ratio);
406
+
407
+ /*
408
+ * Document-method: size
409
+ * @return [Integer]
410
+ */
411
+ rb_ctext_symbolizer.define_method("size", &mapnik::text_symbolizer::get_text_size);
412
+
413
+ /*
414
+ * Document-method: size=
415
+ * call-seq:
416
+ * size=(new_size)
417
+ * @param [Integer] new_size
418
+ * @return [Integer]
419
+ */
420
+ rb_ctext_symbolizer.define_method("size=", &mapnik::text_symbolizer::set_text_size);
421
+
422
+ rb_ctext_symbolizer.define_method("vertical_alignment", &get_vertical_alignment);
423
+ rb_ctext_symbolizer.define_method("vertical_alignment=", &set_vertical_alignment);
424
+
425
+ /*
426
+ * Document-method: wrap_width
427
+ * @return [Integer]
428
+ */
429
+ rb_ctext_symbolizer.define_method("wrap_width", &mapnik::text_symbolizer::get_wrap_width);
430
+
431
+ /*
432
+ * Document-method: wrap_width=
433
+ * call-seq:
434
+ * wrap_width=(new_wrap_width)
435
+ * @param [Integer] new_wrap_width
436
+ * @return [Integer]
437
+ */
438
+ rb_ctext_symbolizer.define_method("wrap_width=", &mapnik::text_symbolizer::set_wrap_width);
439
+
440
+ /*
441
+ * Document-method: wrap_character
442
+ * @return [String]
443
+ */
444
+ rb_ctext_symbolizer.define_method("wrap_character", &mapnik::text_symbolizer::get_wrap_char_string);
445
+
446
+ /*
447
+ * Document-method: wrap_character=
448
+ * call-seq:
449
+ * wrap_character=(character)
450
+ * @param [String] character
451
+ * @return [String]
452
+ */
453
+ rb_ctext_symbolizer.define_method("wrap_character=", &mapnik::text_symbolizer::set_wrap_char_from_string);
454
+
455
+ /*
456
+ * Document-method: wrap_before
457
+ * @return [Boolean]
458
+ */
459
+ rb_ctext_symbolizer.define_method("wrap_before", &mapnik::text_symbolizer::get_wrap_before);
460
+
461
+ /*
462
+ * Document-method: wrap_before=
463
+ * call-seq:
464
+ * wrap_before=(new_value)
465
+ * @param [Boolean] new_value
466
+ * @return [Boolean]
467
+ */
468
+ rb_ctext_symbolizer.define_method("wrap_before=", &mapnik::text_symbolizer::set_wrap_before);
469
+
470
+ };
471
+