ruby_mapnik 0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,162 @@
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_raster_colorizer.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/raster_colorizer.hpp>
32
+
33
+ namespace {
34
+
35
+ mapnik::colorizer_mode_enum get_default_colorizer_mode(mapnik::raster_colorizer & self){
36
+ mapnik::colorizer_mode_enum out = self.get_default_mode();
37
+ return out;
38
+ }
39
+
40
+ void set_default_colorizer_mode(mapnik::raster_colorizer & self, mapnik::colorizer_mode_enum value){
41
+ self.set_default_mode(value);
42
+ }
43
+
44
+ mapnik::colorizer_mode_enum get_colorizer_stop_mode(mapnik::colorizer_stop & self){
45
+ mapnik::colorizer_mode_enum out = self.get_mode_enum();
46
+ return out;
47
+ }
48
+
49
+ void set_colorizer_stop_mode(mapnik::colorizer_stop & self, mapnik::colorizer_mode_enum value){
50
+ self.set_mode_enum(value);
51
+ }
52
+
53
+ Rice::Array get_raster_colorizer_stops(mapnik::raster_colorizer & self){
54
+ mapnik::colorizer_stops stops = self.get_stops();
55
+ return Rice::Array(stops.begin(), stops.end());
56
+ }
57
+
58
+ void add_raster_colorizer_stop(mapnik::raster_colorizer & self, mapnik::colorizer_stop stop){
59
+ self.add_stop(stop);
60
+ }
61
+
62
+ bool check_colorizer_stop_equality(mapnik::colorizer_stop stop_l, mapnik::colorizer_stop stop_r){
63
+ return stop_l == stop_r;
64
+ }
65
+
66
+ }
67
+
68
+ void register_raster_colorizer(Rice::Module rb_mapnik){
69
+ /*
70
+ @@Module_var rb_mapnik = Mapnik
71
+ */
72
+ Rice::Data_Type< mapnik::raster_colorizer > rb_craster_colorizer = Rice::define_class_under< mapnik::raster_colorizer >(rb_mapnik, "RasterColorizer");
73
+
74
+ /*
75
+ * Document-method: new
76
+ * @return [Mapnik::RasterColorizer]
77
+ */
78
+ rb_craster_colorizer.define_constructor(Rice::Constructor< mapnik::raster_colorizer >());
79
+
80
+ /*
81
+ * Document-method: default_color
82
+ * @return [Mapnik::Color]
83
+ */
84
+ rb_craster_colorizer.define_method("default_color", &mapnik::raster_colorizer::get_default_color);
85
+
86
+ /*
87
+ * Document-method: default_color=
88
+ * call-seq:
89
+ * default_color=(color)
90
+ * @param [Mapnik::Color]
91
+ * @return [nil]
92
+ */
93
+ rb_craster_colorizer.define_method("default_color=", &mapnik::raster_colorizer::set_default_color);
94
+
95
+ rb_craster_colorizer.define_method("default_mode", &get_default_colorizer_mode);
96
+ rb_craster_colorizer.define_method("default_mode=", &set_default_colorizer_mode);
97
+
98
+ rb_craster_colorizer.define_method("epsilon", &mapnik::raster_colorizer::get_epsilon);
99
+ rb_craster_colorizer.define_method("epsilon=", &mapnik::raster_colorizer::set_epsilon);
100
+
101
+ // Dont-Document-method: __stops__
102
+ rb_craster_colorizer.define_method("__stops__", &get_raster_colorizer_stops);
103
+
104
+ // Dont-Document-method: __add_stop__
105
+ rb_craster_colorizer.define_method("__add_stop__", &add_raster_colorizer_stop);
106
+
107
+ Rice::Enum<mapnik::colorizer_mode_enum> cm_colorizer_mode = Rice::define_enum<mapnik::colorizer_mode_enum>("ColorizerMode", rb_mapnik);
108
+ cm_colorizer_mode.define_value("INHERIT", mapnik::COLORIZER_INHERIT);
109
+ cm_colorizer_mode.define_value("LINEAR", mapnik::COLORIZER_LINEAR);
110
+ cm_colorizer_mode.define_value("DISCRETE", mapnik::COLORIZER_DISCRETE);
111
+ cm_colorizer_mode.define_value("EXACT", mapnik::COLORIZER_EXACT);
112
+
113
+
114
+ Rice::Data_Type< mapnik::colorizer_stop > rb_ccolorizer_stop = Rice::define_class_under< mapnik::colorizer_stop >(rb_mapnik, "ColorizerStop");
115
+
116
+ /*
117
+ * Document-method: new
118
+ * call-seq:
119
+ * new(value, mode, color)
120
+ * @param [Float] value
121
+ * @param [Mapnik::ColorizerMode] mode
122
+ * @param [Mapnik::Color] color
123
+ */
124
+ rb_ccolorizer_stop.define_constructor(Rice::Constructor< mapnik::colorizer_stop, float, mapnik::colorizer_mode_enum, mapnik::color >());
125
+
126
+ /*
127
+ * Document-method: color
128
+ * @return [Mapnik::Color]
129
+ */
130
+ rb_ccolorizer_stop.define_method("color", &mapnik::colorizer_stop::get_color);
131
+
132
+ /*
133
+ * Document-method: color=
134
+ * call-seq:
135
+ * color=(color)
136
+ * @param [Mapnik::Color] color
137
+ * @return [nil]
138
+ */
139
+ rb_ccolorizer_stop.define_method("color=", &mapnik::colorizer_stop::set_color);
140
+
141
+ /*
142
+ * Document-method: value
143
+ * @return [Float]
144
+ */
145
+ rb_ccolorizer_stop.define_method("value", &mapnik::colorizer_stop::get_value);
146
+
147
+ /*
148
+ * Document-method: value=
149
+ * call-seq:
150
+ * value=(new_value)
151
+ * @param [Float] new_value
152
+ * @return [nil]
153
+ */
154
+ rb_ccolorizer_stop.define_method("value=", &mapnik::colorizer_stop::set_value);
155
+
156
+ rb_ccolorizer_stop.define_method("mode", &get_colorizer_stop_mode);
157
+ rb_ccolorizer_stop.define_method("mode=", &set_colorizer_stop_mode);
158
+
159
+ // Dont-Document-method ==
160
+ rb_ccolorizer_stop.define_method("==", &check_colorizer_stop_equality);
161
+
162
+ }
@@ -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_RASTER_COLORIZER
23
+ #define PIKA2_MAPNIK_RASTER_COLORIZER
24
+
25
+ namespace Rice
26
+ {
27
+ class Module;
28
+ }
29
+
30
+ void register_raster_colorizer(Rice::Module rb_mapnik);
31
+
32
+ #endif
@@ -0,0 +1,53 @@
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_raster_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/raster_symbolizer.hpp>
32
+
33
+ void register_raster_symbolizer(Rice::Module rb_mapnik){
34
+ /*
35
+ @@Module_var rb_mapnik = Mapnik
36
+ */
37
+ Rice::Data_Type< mapnik::raster_symbolizer > rb_craster_symbolizer = Rice::define_class_under< mapnik::raster_symbolizer >(rb_mapnik, "RasterSymbolizer");
38
+ rb_craster_symbolizer.define_constructor(Rice::Constructor< mapnik::raster_symbolizer >());
39
+
40
+ rb_craster_symbolizer.define_method("mode", &mapnik::raster_symbolizer::get_mode);
41
+ rb_craster_symbolizer.define_method("mode=", &mapnik::raster_symbolizer::set_mode);
42
+
43
+ rb_craster_symbolizer.define_method("scaling", &mapnik::raster_symbolizer::get_scaling);
44
+ rb_craster_symbolizer.define_method("scaling=", &mapnik::raster_symbolizer::set_scaling);
45
+
46
+ rb_craster_symbolizer.define_method("opacity", &mapnik::raster_symbolizer::get_opacity);
47
+ rb_craster_symbolizer.define_method("opacity=", &mapnik::raster_symbolizer::set_opacity);
48
+
49
+
50
+ rb_craster_symbolizer.define_method("filter_factor", &mapnik::raster_symbolizer::get_filter_factor);
51
+ rb_craster_symbolizer.define_method("filter_factor=", &mapnik::raster_symbolizer::set_filter_factor);
52
+
53
+ }
@@ -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_RASTER_SYMBOLIZER
23
+ #define PIKA2_MAPNIK_RASTER_SYMBOLIZER
24
+
25
+ namespace Rice
26
+ {
27
+ class Module;
28
+ }
29
+
30
+ void register_raster_symbolizer(Rice::Module rb_mapnik);
31
+
32
+ #endif
@@ -0,0 +1,99 @@
1
+ #include "_mapnik_rule.rb.h"
2
+
3
+ // Rice
4
+ #include <rice/Data_Type.hpp>
5
+ #include <rice/Constructor.hpp>
6
+ #include <rice/Class.hpp>
7
+ #include <rice/Array.hpp>
8
+
9
+ // Mapnik
10
+ #include <mapnik/rule.hpp>
11
+
12
+ template<>
13
+ Rice::Object to_ruby<std::vector<mapnik::symbolizer> >(std::vector<mapnik::symbolizer> const & x)
14
+ {
15
+ return Rice::Array(x.begin(), x.end());
16
+ }
17
+
18
+ void register_rule(Rice::Module rb_mapnik){
19
+ /*
20
+ @@Module_var rb_mapnik = Mapnik
21
+ */
22
+ Rice::Data_Type< mapnik::rule > rb_crule = Rice::define_class_under< mapnik::rule >(rb_mapnik, "Rule");
23
+
24
+ /*
25
+ * Document-method: new
26
+ * @return [Mapnik::Rule]
27
+ */
28
+ rb_crule.define_constructor(Rice::Constructor< mapnik::rule >());
29
+
30
+ /*
31
+ * Document-method: name
32
+ * @return [String]
33
+ */
34
+ rb_crule.define_method("name", &mapnik::rule::get_name);
35
+
36
+ /*
37
+ * Document-method: name=
38
+ * call-seq:
39
+ * name=(new_name)
40
+ * @param [String]
41
+ * @return [nil]
42
+ */
43
+ rb_crule.define_method("name=", &mapnik::rule::set_name, Rice::Arg("new_name"));
44
+
45
+ /*
46
+ * Document-method: title
47
+ * @return [String]
48
+ */
49
+ rb_crule.define_method("title", &mapnik::rule::get_title);
50
+
51
+ /*
52
+ * Document-method: title=
53
+ * call-seq:
54
+ * title=(new_title)
55
+ * @param [String]
56
+ * @return [nil]
57
+ */
58
+ rb_crule.define_method("title=", &mapnik::rule::set_title, Rice::Arg("new_title"));
59
+
60
+ /*
61
+ * Document-method: abstract
62
+ * @return [String]
63
+ */
64
+ rb_crule.define_method("abstract", &mapnik::rule::get_abstract);
65
+
66
+ /*
67
+ * Document-method: abstract=
68
+ * call-seq:
69
+ * abstract=(new_abstract)
70
+ * @param [String]
71
+ * @return [nil]
72
+ */
73
+ rb_crule.define_method("abstract=", &mapnik::rule::set_abstract, Rice::Arg("new_abstract"));
74
+
75
+ /*
76
+ * Document-method: filter
77
+ * @return [Mapnik::Expression]
78
+ */
79
+ rb_crule.define_method("filter", &mapnik::rule::get_filter);
80
+
81
+ /*
82
+ * Document-method: filter=
83
+ * call-seq:
84
+ * filter=(new_filter)
85
+ * @param [Mapnik::Expression]
86
+ * @return [nil]
87
+ */
88
+ rb_crule.define_method("filter=", &mapnik::rule::set_filter, Rice::Arg("new_filter"));
89
+
90
+ // Dont-Document-method: __symbols__
91
+ rb_crule.define_method("__symbols__", &mapnik::rule::get_symbolizers);
92
+
93
+ // Dont-Document-method: __append_symbol__
94
+ rb_crule.define_method("__append_symbol__", &mapnik::rule::append, Rice::Arg("new_symbol"));
95
+
96
+ // Dont-Document-method: __remove_symbol__
97
+ rb_crule.define_method("__remove_symbol__", &mapnik::rule::remove_at, Rice::Arg("index"));
98
+
99
+ }
@@ -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_RULE
23
+ #define PIKA2_MAPNIK_RULE
24
+
25
+ namespace Rice
26
+ {
27
+ class Module;
28
+ }
29
+
30
+ void register_rule(Rice::Module rb_mapnik);
31
+
32
+ #endif
@@ -0,0 +1,86 @@
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_shield_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_symbolizer.hpp>
32
+ #include <mapnik/shield_symbolizer.hpp>
33
+
34
+ namespace{
35
+
36
+ Rice::Object get_shield_displacement(const mapnik::shield_symbolizer& t){
37
+ mapnik::position pos = t.get_shield_displacement();
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_shield_displacement(mapnik::shield_symbolizer & t, Rice::Array ary){
45
+ double x = from_ruby<double>(ary[0]);
46
+ double y = from_ruby<double>(ary[1]);
47
+ t.set_shield_displacement(x,y);
48
+ }
49
+
50
+ }
51
+ void register_shield_symbolizer(Rice::Module rb_mapnik){
52
+ /*
53
+ @@Module_var rb_mapnik = Mapnik
54
+ */
55
+ Rice::Data_Type< mapnik::shield_symbolizer > rb_cshield_symbolizer = Rice::define_class_under< mapnik::shield_symbolizer, mapnik::text_symbolizer >(rb_mapnik, "ShieldSymbolizer");
56
+
57
+ /*
58
+ * Document-method: new
59
+ * call-seq:
60
+ * new(expression, face_name, size, color, file)
61
+ *
62
+ * @param [Mapnik::Expression] expression
63
+ * @param [String] face_name
64
+ * @param [Integer] size
65
+ * @param [Mapnik::Color] color
66
+ * @param [Mapnik::PathExpression] file
67
+ *
68
+ * @return [Mapnik::ShieldSymbolizer]
69
+ */
70
+ rb_cshield_symbolizer.define_constructor(Rice::Constructor< mapnik::shield_symbolizer, mapnik::expression_ptr, std::string, unsigned, mapnik::color, mapnik::path_expression_ptr >());
71
+
72
+ /*
73
+ * Document-method: shield_displacement
74
+ * @return [Array] Two element array [x,y]
75
+ */
76
+ rb_cshield_symbolizer.define_method("shield_displacement", &get_shield_displacement);
77
+
78
+ /*
79
+ * Document-method: shield_displacement=
80
+ * call-seq:
81
+ * shield_displacement=(new_displacement)
82
+ * @param [Array] new_displacement Two element array [x,y]
83
+ */
84
+ rb_cshield_symbolizer.define_method("shield_displacement=", &set_shield_displacement);
85
+
86
+ }
@@ -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_SHIELD_SYMBOLIZER
23
+ #define PIKA2_MAPNIK_SHIELD_SYMBOLIZER
24
+
25
+ namespace Rice
26
+ {
27
+ class Module;
28
+ }
29
+
30
+ void register_shield_symbolizer(Rice::Module rb_mapnik);
31
+
32
+ #endif