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_ENVELOPE
23
+ #define PIKA2_MAPNIK_ENVELOPE
24
+
25
+ namespace Rice
26
+ {
27
+ class Module;
28
+ }
29
+
30
+ void register_envelope(Rice::Module rb_mapnik);
31
+
32
+ #endif
@@ -0,0 +1,91 @@
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_expression.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.hpp>
32
+ #include <mapnik/expression.hpp>
33
+ #include <mapnik/expression_node.hpp>
34
+ #include <mapnik/expression_string.hpp>
35
+ #include <mapnik/expression_evaluator.hpp>
36
+ #include <mapnik/parse_path.hpp>
37
+
38
+ namespace {
39
+ boost::shared_ptr<mapnik::expr_node> parse_expression_(std::string const& wkt){
40
+ return mapnik::parse_expression(wkt,"utf8");
41
+ }
42
+
43
+ std::string expr_node_to_string_(boost::shared_ptr<mapnik::expr_node> node_ptr){
44
+ return mapnik::to_expression_string(*node_ptr);
45
+ }
46
+
47
+ // path expression
48
+ mapnik::path_expression_ptr parse_path_(std::string const& path){
49
+ return mapnik::parse_path(path);
50
+ }
51
+ }
52
+
53
+ void register_expression(Rice::Module rb_mapnik){
54
+ /*
55
+ @@Module_var rb_mapnik = Mapnik
56
+ */
57
+ Rice::Data_Type< boost::shared_ptr<mapnik::expr_node> > rb_cexpression = Rice::define_class_under< boost::shared_ptr<mapnik::expr_node> >(rb_mapnik, "Expression");
58
+
59
+ /*
60
+ * Document-method: parse
61
+ * call-seq:
62
+ * parse(expression_string)
63
+ *
64
+ * @param [String]
65
+ *
66
+ * @return [Mapnk::Expression] a new expression
67
+ */
68
+ rb_cexpression.define_singleton_method("parse", &parse_expression_);
69
+
70
+ /*
71
+ * Document-method: to_s
72
+ * @return [String] a string representation of the expression
73
+ */
74
+ rb_cexpression.define_method("to_s",&expr_node_to_string_);
75
+
76
+ Rice::Data_Type< mapnik::path_expression_ptr > rb_cpath_expression = Rice::define_class_under< mapnik::path_expression_ptr >(rb_mapnik, "PathExpression");
77
+ // rb_cpath_expression.define_singleton_method("evaluate", &path_evaluate_);
78
+ // rb_cpath_expression.define_method("to_s",&path_to_string_);
79
+
80
+ /*
81
+ * Document-method: parse
82
+ * call-seq:
83
+ * parse(path_expression_string)
84
+ *
85
+ * @param [String]
86
+ *
87
+ * @return [Mapnk::PathExpression] a new expression
88
+ */
89
+ rb_cpath_expression.define_singleton_method("parse", &parse_path_);
90
+
91
+ }
@@ -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_EXPRESSION
23
+ #define PIKA2_MAPNIK_EXPRESSION
24
+
25
+ namespace Rice
26
+ {
27
+ class Module;
28
+ }
29
+
30
+ void register_expression(Rice::Module rb_mapnik);
31
+
32
+ #endif
@@ -0,0 +1,93 @@
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_feature.rb.h"
23
+
24
+ #include <boost/make_shared.hpp>
25
+
26
+ // Rice
27
+ #include <rice/Data_Type.hpp>
28
+ #include <rice/Constructor.hpp>
29
+ #include <rice/Class.hpp>
30
+
31
+ // Mapnik
32
+ #include <mapnik/version.hpp>
33
+ #include <mapnik/wkt/wkt_factory.hpp>
34
+ #include <mapnik/feature.hpp>
35
+
36
+ #if MAPNIK_VERSION >= 200200
37
+ typedef mapnik::value_integer value_integer;
38
+ #else
39
+ typedef int value_integer;
40
+ #endif
41
+
42
+ namespace {
43
+
44
+ void add_geometries_from_wkt(mapnik::Feature * self, std::string wkt){
45
+ bool result = mapnik::from_wkt(wkt, self->paths());
46
+ if (!result) throw std::runtime_error("Failed to parse WKT");
47
+ }
48
+
49
+ class context_holder {
50
+ private:
51
+ mapnik::context_ptr ptr;
52
+ public:
53
+
54
+ context_holder()
55
+ : ptr (boost::make_shared<mapnik::context_type>())
56
+ {
57
+ return;
58
+ }
59
+
60
+ int push(std::string const& str){
61
+ return ptr->push(str);
62
+ }
63
+
64
+ mapnik::context_ptr get_ptr(){
65
+ return ptr;
66
+ }
67
+
68
+ };
69
+
70
+ }
71
+ template<>
72
+ mapnik::context_ptr from_ruby<mapnik::context_ptr>(Rice::Object ruby_obj){
73
+ context_holder ctx = from_ruby<context_holder>(ruby_obj);
74
+ return ctx.get_ptr();
75
+ }
76
+
77
+ void register_feature(Rice::Module rb_mapnik){
78
+ Rice::Data_Type< context_holder > rb_ccontext = Rice::define_class_under< context_holder >(rb_mapnik, "Context");
79
+ rb_ccontext.define_constructor(Rice::Constructor< context_holder >());
80
+ rb_ccontext.define_method("push", &context_holder::push);
81
+
82
+ /*
83
+ @@Module_var rb_mapnik = Mapnik
84
+ */
85
+ Rice::Data_Type< mapnik::Feature > rb_cfeature = Rice::define_class_under< mapnik::Feature >(rb_mapnik, "Feature");
86
+ rb_cfeature.define_constructor(Rice::Constructor< mapnik::Feature,mapnik::context_ptr,value_integer >());
87
+ rb_cfeature.define_method("id", &mapnik::Feature::id);
88
+ rb_cfeature.define_method("to_s", &mapnik::Feature::to_string);
89
+ rb_cfeature.define_method("number_of_geometries", &mapnik::Feature::num_geometries);
90
+ rb_cfeature.define_method("envelope", &mapnik::Feature::envelope);
91
+
92
+ rb_cfeature.define_method("add_geometries_from_wkt", &add_geometries_from_wkt, Rice::Arg("geom"));
93
+ }
@@ -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_FEATURE
23
+ #define PIKA2_MAPNIK_FEATURE
24
+
25
+ namespace Rice
26
+ {
27
+ class Module;
28
+ }
29
+
30
+ void register_feature(Rice::Module rb_mapnik);
31
+
32
+ #endif
@@ -0,0 +1,71 @@
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_font_engine.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/font_engine_freetype.hpp>
32
+
33
+ namespace {
34
+
35
+ Rice::Object get_font_face_names(){
36
+ Rice::Array out;
37
+ std::vector<std::string> const& names = mapnik::freetype_engine::face_names();
38
+ std::vector<std::string>::const_iterator end = names.end();
39
+ for (std::vector<std::string>::const_iterator it = names.begin(); it != end; ++it){
40
+ out.push(to_ruby<std::string>(*it));
41
+ }
42
+ return out;
43
+ }
44
+
45
+ void register_font_name(std::string font_name){
46
+ mapnik::freetype_engine::register_font(font_name);
47
+ }
48
+
49
+ }
50
+
51
+ void register_font_engine(Rice::Module rb_mapnik){
52
+ /*
53
+ @@Module_var rb_mapnik = Mapnik
54
+ */
55
+ Rice::Data_Type< mapnik::freetype_engine > rb_cfont_engine = Rice::define_class_under< mapnik::freetype_engine >(rb_mapnik, "FontEngine");
56
+
57
+ /*
58
+ * Document-method: register_font
59
+ * call-seq:
60
+ * register_font(font_name)
61
+ * Registers a font with the FontEngine
62
+ * @return [nil]
63
+ */
64
+ rb_cfont_engine.define_singleton_method("register_font", &register_font_name);
65
+
66
+ /*
67
+ * Document-method: face_names
68
+ * @return [Array] Names of the fonts that have been registered
69
+ */
70
+ rb_cfont_engine.define_singleton_method("face_names", &get_font_face_names);
71
+ }
@@ -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_FONT_ENGINE
23
+ #define PIKA2_MAPNIK_FONT_ENGINE
24
+
25
+ namespace Rice
26
+ {
27
+ class Module;
28
+ }
29
+
30
+ void register_font_engine(Rice::Module rb_mapnik);
31
+
32
+ #endif
@@ -0,0 +1,208 @@
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: srs
96
+ * @return [String] the layer's srs
97
+ */
98
+ rb_clayer.define_method("srs", &mapnik::layer::srs);
99
+
100
+ /*
101
+ * Document-method: srs=
102
+ * call-seq:
103
+ * srs=(new_srs)
104
+ * @param [String]
105
+ */
106
+ rb_clayer.define_method("srs=", &mapnik::layer::set_srs, Rice::Arg("new_srs"));
107
+
108
+ /*
109
+ * Document-method: min_zoom
110
+ * @return [Integer] the layer's minimum zoom factor
111
+ */
112
+ rb_clayer.define_method("min_zoom", &mapnik::layer::min_zoom);
113
+
114
+ /*
115
+ * Document-method: min_zoom=
116
+ * call-seq:
117
+ * min_zoom=(min_zoom)
118
+ * @return [nil]
119
+ */
120
+ rb_clayer.define_method("min_zoom=", &mapnik::layer::set_min_zoom, Rice::Arg("new_min_zoom"));
121
+
122
+ /*
123
+ * Document-method: max_zoom
124
+ * @return [Integer] the layer's maximum zoom factor
125
+ */
126
+ rb_clayer.define_method("max_zoom", &mapnik::layer::max_zoom);
127
+
128
+
129
+ /*
130
+ * Document-method: max_zoom=
131
+ * call-seq:
132
+ * min_zoom=(min_zoom)
133
+ * @return [nil]
134
+ */
135
+ rb_clayer.define_method("max_zoom=", &mapnik::layer::set_max_zoom, Rice::Arg("new_max_zoom"));
136
+
137
+ /*
138
+ * Document-method: visible_at_scale?
139
+ * @return [Boolean]
140
+ */
141
+ rb_clayer.define_method("visible_at_scale?", &mapnik::layer::visible, Rice::Arg("scale"));
142
+
143
+ /*
144
+ * Document-method: active?
145
+ * @return [Boolean]
146
+ */
147
+ rb_clayer.define_method("active?", &mapnik::layer::active);
148
+
149
+ /*
150
+ * Document-method: active=
151
+ * call-seq:
152
+ * active=(new_active_value)
153
+ * @return [nil]
154
+ */
155
+ rb_clayer.define_method("active=", &mapnik::layer::set_active, Rice::Arg("new_active_value"));
156
+
157
+ /*
158
+ * Document-method: queryable?
159
+ * @return [Boolean]
160
+ */
161
+ rb_clayer.define_method("queryable?", &mapnik::layer::queryable);
162
+
163
+ /*
164
+ * Document-method: queryable=
165
+ * call-seq:
166
+ * queryable=(new_queryable_value)
167
+ * @return [nil]
168
+ */
169
+ rb_clayer.define_method("queryable=", &mapnik::layer::set_queryable, Rice::Arg("new_queryable_value"));
170
+
171
+ /*
172
+ * Document-method: cache_features?
173
+ * @return [Boolean]
174
+ */
175
+ rb_clayer.define_method("cache_features?", &mapnik::layer::cache_features);
176
+
177
+ /*
178
+ * Document-method: cache_features=
179
+ * call-seq:
180
+ * cache_features=(new_cache_features_value)
181
+ * @return [nil]
182
+ */
183
+ rb_clayer.define_method("cache_features=", &mapnik::layer::set_cache_features, Rice::Arg("new_cache_features_value"));
184
+
185
+ /*
186
+ * Document-method: clear_label_cache?
187
+ * @return [Boolean]
188
+ */
189
+ rb_clayer.define_method("clear_label_cache?", &mapnik::layer::clear_label_cache);
190
+
191
+ /*
192
+ * Document-method: clear_label_cache=
193
+ * call-seq:
194
+ * clear_label_cache=(new_clear_label_cache_value)
195
+ * @return [nil]
196
+ */
197
+ rb_clayer.define_method("clear_label_cache=", &mapnik::layer::set_clear_label_cache, Rice::Arg("new_clear_label_cache_value"));
198
+
199
+ /*
200
+ * Dont-Document-method: __style_list__
201
+ */
202
+ rb_clayer.define_method("__style_list__", _styles_);
203
+
204
+ /*
205
+ * Dont-Document-method: __append_style__
206
+ */
207
+ rb_clayer.define_method("__append_style__", &mapnik::layer::add_style, Rice::Arg("new_style"));
208
+ }