Skip to content
This repository
Browse code

+ move 'smooth' property to symbolizer_base level

+ remove 'SYMBOLIZER_FAST' completely
  • Loading branch information...
commit 7e49a6f44ebe2cb09157b82fa5554a10a5068ffb 1 parent 3a8d3c5
Artem Pavlenko artemp authored
9 bindings/python/mapnik_line_symbolizer.cpp
@@ -43,20 +43,11 @@ void export_line_symbolizer()
43 43 {
44 44 using namespace boost::python;
45 45
46   - enumeration_<line_rasterizer_e>("line_rasterizer")
47   - .value("FULL",RASTERIZER_FULL)
48   - .value("FAST",RASTERIZER_FAST)
49   - ;
50   -
51 46 class_<line_symbolizer>("LineSymbolizer",
52 47 init<>("Default LineSymbolizer - 1px solid black"))
53 48 .def(init<stroke const&>("TODO"))
54 49 .def(init<color const& ,float>())
55 50 .def_pickle(line_symbolizer_pickle_suite())
56   - .add_property("rasterizer",
57   - &line_symbolizer::get_rasterizer,
58   - &line_symbolizer::set_rasterizer,
59   - "Set/get the rasterization method of the line of the point")
60 51 .add_property("stroke",make_function
61 52 (&line_symbolizer::get_stroke,
62 53 return_value_policy<copy_const_reference>()),
40 include/mapnik/line_symbolizer.hpp
@@ -31,37 +31,23 @@
31 31 namespace mapnik
32 32 {
33 33
34   -enum line_rasterizer_enum {
35   - RASTERIZER_FULL, // agg::renderer_scanline_aa_solid
36   - RASTERIZER_FAST, // agg::rasterizer_outline_aa, twice as fast but only good for thin lines
37   - line_rasterizer_enum_MAX
38   -};
39   -
40   -DEFINE_ENUM( line_rasterizer_e, line_rasterizer_enum );
41   -
42 34 struct MAPNIK_DECL line_symbolizer : public symbolizer_base
43 35 {
44 36 explicit line_symbolizer()
45 37 : symbolizer_base(),
46 38 stroke_(),
47   - rasterizer_p_(RASTERIZER_FULL),
48   - smooth_(0.0),
49 39 offset_(0.0)
50 40 {}
51   -
  41 +
52 42 line_symbolizer(stroke const& stroke)
53 43 : symbolizer_base(),
54 44 stroke_(stroke),
55   - rasterizer_p_(RASTERIZER_FULL),
56   - smooth_(0.0),
57 45 offset_(0.0)
58 46 {}
59 47
60 48 line_symbolizer(color const& pen,float width=1.0)
61 49 : symbolizer_base(),
62 50 stroke_(pen,width),
63   - rasterizer_p_(RASTERIZER_FULL),
64   - smooth_(0.0),
65 51 offset_(0.0)
66 52 {}
67 53
@@ -74,27 +60,7 @@ struct MAPNIK_DECL line_symbolizer : public symbolizer_base
74 60 {
75 61 stroke_ = stk;
76 62 }
77   -
78   - void set_rasterizer(line_rasterizer_e rasterizer_p)
79   - {
80   - rasterizer_p_ = rasterizer_p;
81   - }
82   -
83   - line_rasterizer_e get_rasterizer() const
84   - {
85   - return rasterizer_p_;
86   - }
87   -
88   - void set_smooth(double smooth)
89   - {
90   - smooth_ = smooth;
91   - }
92   -
93   - double smooth() const
94   - {
95   - return smooth_;
96   - }
97   -
  63 +
98 64 void set_offset(double val)
99 65 {
100 66 offset_ = val;
@@ -107,8 +73,6 @@ struct MAPNIK_DECL line_symbolizer : public symbolizer_base
107 73
108 74 private:
109 75 stroke stroke_;
110   - line_rasterizer_e rasterizer_p_;
111   - double smooth_;
112 76 double offset_;
113 77 };
114 78 }
3  include/mapnik/polygon_pattern_symbolizer.hpp
@@ -50,13 +50,10 @@ struct MAPNIK_DECL polygon_pattern_symbolizer :
50 50 double get_gamma() const;
51 51 void set_gamma_method(gamma_method_e gamma_method);
52 52 gamma_method_e get_gamma_method() const;
53   - void set_smooth(double smooth);
54   - double smooth() const;
55 53 private:
56 54 pattern_alignment_e alignment_;
57 55 double gamma_;
58 56 gamma_method_e gamma_method_;
59   - double smooth_;
60 57 };
61 58 }
62 59
3  include/mapnik/polygon_symbolizer.hpp
@@ -44,14 +44,11 @@ struct MAPNIK_DECL polygon_symbolizer : public symbolizer_base
44 44 double get_gamma() const;
45 45 void set_gamma_method(gamma_method_e gamma_method);
46 46 gamma_method_e get_gamma_method() const;
47   - void set_smooth(double smooth);
48   - double smooth() const;
49 47 private:
50 48 color fill_;
51 49 double opacity_;
52 50 double gamma_;
53 51 gamma_method_e gamma_method_;
54   - double smooth_;
55 52 bool clip_;
56 53 };
57 54
3  include/mapnik/symbolizer.hpp
@@ -103,6 +103,8 @@ class MAPNIK_DECL symbolizer_base
103 103 std::string get_transform_string() const;
104 104 void set_clip(bool clip);
105 105 bool clip() const;
  106 + void set_smooth(double smooth);
  107 + double smooth() const;
106 108 private:
107 109 metawriter_properties properties_;
108 110 metawriter_properties properties_complete_;
@@ -111,6 +113,7 @@ class MAPNIK_DECL symbolizer_base
111 113 boost::optional<composite_mode_e> comp_op_;
112 114 transform_type affine_transform_;
113 115 bool clip_;
  116 + double smooth_value_;
114 117 };
115 118
116 119
7 src/agg/process_line_symbolizer.cpp
@@ -59,13 +59,10 @@ void agg_renderer<T>::process(line_symbolizer const& sym,
59 59 unsigned g=col.green();
60 60 unsigned b=col.blue();
61 61 unsigned a=col.alpha();
62   -
63   -
64   - agg::rendering_buffer buf(current_buffer_->raw_data(),width_,height_, width_ * 4);
65   -
  62 +
66 63 ras_ptr->reset();
67 64 set_gamma_method(stroke_, ras_ptr);
68   - //metawriter_with_properties writer = sym.get_metawriter();
  65 +
69 66 typedef boost::mpl::vector<clip_line_tag,transform_tag, offset_transform_tag, affine_transform_tag, smooth_tag, dash_tag, stroke_tag> conv_types;
70 67 vertex_converter<box2d<double>,rasterizer,line_symbolizer, proj_transform, CoordTransform,conv_types>
71 68 converter(query_extent_,*ras_ptr,sym,t_,prj_trans,scale_factor_);
11 src/line_symbolizer.cpp
@@ -26,15 +26,6 @@
26 26
27 27 namespace mapnik
28 28 {
29   -
30   -static const char * line_rasterizer_strings[] = {
31   - "full",
32   - "fast",
33   - ""
34   -};
35   -
36   -
37   -IMPLEMENT_ENUM( line_rasterizer_e, line_rasterizer_strings )
38   -
  29 +//
39 30 }
40 31
41 src/load_map.cpp
@@ -96,7 +96,7 @@ class map_parser : boost::noncopyable {
96 96 void parse_style(Map & map, xml_node const& sty);
97 97 void parse_layer(Map & map, xml_node const& lay);
98 98 void parse_metawriter(Map & map, xml_node const& lay);
99   - void parse_metawriter_in_symbolizer(symbolizer_base &sym, xml_node const& pt);
  99 + void parse_symbolizer_base(symbolizer_base &sym, xml_node const& pt);
100 100
101 101 void parse_fontset(Map & map, xml_node const & fset);
102 102 bool parse_font(font_set & fset, xml_node const& f);
@@ -819,7 +819,7 @@ void map_parser::parse_rule(feature_type_style & style, xml_node const& r)
819 819 }
820 820 }
821 821
822   -void map_parser::parse_metawriter_in_symbolizer(symbolizer_base &sym, xml_node const &pt)
  822 +void map_parser::parse_symbolizer_base(symbolizer_base &sym, xml_node const &pt)
823 823 {
824 824 optional<std::string> comp_op_name = pt.get_opt_attr<std::string>("comp-op");
825 825 if (comp_op_name)
@@ -856,6 +856,10 @@ void map_parser::parse_metawriter_in_symbolizer(symbolizer_base &sym, xml_node c
856 856 optional<boolean> clip = pt.get_opt_attr<boolean>("clip");
857 857 if (clip) sym.set_clip(*clip);
858 858
  859 + // smooth value
  860 + optional<double> smooth = pt.get_opt_attr<double>("smooth");
  861 + if (smooth) sym.set_smooth(*smooth);
  862 +
859 863 optional<std::string> writer = pt.get_opt_attr<std::string>("meta-writer");
860 864 if (!writer) return;
861 865 optional<std::string> output = pt.get_opt_attr<std::string>("meta-output");
@@ -949,7 +953,7 @@ void map_parser::parse_point_symbolizer(rule & rule, xml_node const & sym)
949 953 }
950 954 }
951 955 }
952   - parse_metawriter_in_symbolizer(symbol, sym);
  956 + parse_symbolizer_base(symbol, sym);
953 957 rule.append(symbol);
954 958 }
955 959 catch (const config_error & ex)
@@ -1075,7 +1079,7 @@ void map_parser::parse_markers_symbolizer(rule & rule, xml_node const& sym)
1075 1079 marker_type_e marker_type = sym.get_attr<marker_type_e>("marker-type", dfl_marker_type);
1076 1080 symbol.set_marker_type(marker_type);
1077 1081
1078   - parse_metawriter_in_symbolizer(symbol, sym);
  1082 + parse_symbolizer_base(symbol, sym);
1079 1083 rule.append(symbol);
1080 1084 }
1081 1085 catch (const config_error & ex)
@@ -1111,7 +1115,7 @@ void map_parser::parse_line_pattern_symbolizer(rule & rule, xml_node const & sym
1111 1115 }
1112 1116 line_pattern_symbolizer symbol(expr);
1113 1117
1114   - parse_metawriter_in_symbolizer(symbol, sym);
  1118 + parse_symbolizer_base(symbol, sym);
1115 1119 rule.append(symbol);
1116 1120 }
1117 1121 catch (image_reader_exception const & ex)
@@ -1175,11 +1179,7 @@ void map_parser::parse_polygon_pattern_symbolizer(rule & rule,
1175 1179 optional<gamma_method_e> gamma_method = sym.get_opt_attr<gamma_method_e>("gamma-method");
1176 1180 if (gamma_method) symbol.set_gamma_method(*gamma_method);
1177 1181
1178   - // smooth value
1179   - optional<double> smooth = sym.get_opt_attr<double>("smooth");
1180   - if (smooth) symbol.set_smooth(*smooth);
1181   -
1182   - parse_metawriter_in_symbolizer(symbol, sym);
  1182 + parse_symbolizer_base(symbol, sym);
1183 1183 rule.append(symbol);
1184 1184 }
1185 1185 catch (image_reader_exception const & ex)
@@ -1222,7 +1222,7 @@ void map_parser::parse_text_symbolizer(rule & rule, xml_node const& sym)
1222 1222 }
1223 1223
1224 1224 text_symbolizer text_symbol = text_symbolizer(placement_finder);
1225   - parse_metawriter_in_symbolizer(text_symbol, sym);
  1225 + parse_symbolizer_base(text_symbol, sym);
1226 1226 rule.append(text_symbol);
1227 1227 }
1228 1228 catch (const config_error & ex)
@@ -1304,7 +1304,7 @@ void map_parser::parse_shield_symbolizer(rule & rule, xml_node const& sym)
1304 1304 shield_symbol.set_unlock_image(* unlock_image);
1305 1305 }
1306 1306
1307   - parse_metawriter_in_symbolizer(shield_symbol, sym);
  1307 + parse_symbolizer_base(shield_symbol, sym);
1308 1308
1309 1309 std::string image_file = sym.get_attr<std::string>("file");
1310 1310 optional<std::string> base = sym.get_opt_attr<std::string>("base");
@@ -1426,21 +1426,13 @@ void map_parser::parse_line_symbolizer(rule & rule, xml_node const & sym)
1426 1426 stroke strk;
1427 1427 parse_stroke(strk,sym);
1428 1428 line_symbolizer symbol = line_symbolizer(strk);
1429   -
1430   - // rasterizer method
1431   - line_rasterizer_e rasterizer = sym.get_attr<line_rasterizer_e>("rasterizer", RASTERIZER_FULL);
1432   - //optional<line_rasterizer_e> rasterizer_method = sym.get_opt_attr<line_rasterizer_e>("full");
1433   - symbol.set_rasterizer(rasterizer);
1434   - // smooth value
1435   - optional<double> smooth = sym.get_opt_attr<double>("smooth");
1436   - if (smooth) symbol.set_smooth(*smooth);
1437 1429
1438 1430 // offset value
1439 1431 optional<double> offset = sym.get_opt_attr<double>("offset");
1440 1432 if (offset) symbol.set_offset(*offset);
1441 1433
1442 1434 // meta-writer
1443   - parse_metawriter_in_symbolizer(symbol, sym);
  1435 + parse_symbolizer_base(symbol, sym);
1444 1436 rule.append(symbol);
1445 1437 }
1446 1438 catch (const config_error & ex)
@@ -1468,11 +1460,8 @@ void map_parser::parse_polygon_symbolizer(rule & rule, xml_node const & sym)
1468 1460 // gamma method
1469 1461 optional<gamma_method_e> gamma_method = sym.get_opt_attr<gamma_method_e>("gamma-method");
1470 1462 if (gamma_method) poly_sym.set_gamma_method(*gamma_method);
1471   - // smooth value
1472   - optional<double> smooth = sym.get_opt_attr<double>("smooth");
1473   - if (smooth) poly_sym.set_smooth(*smooth);
1474 1463
1475   - parse_metawriter_in_symbolizer(poly_sym, sym);
  1464 + parse_symbolizer_base(poly_sym, sym);
1476 1465 rule.append(poly_sym);
1477 1466 }
1478 1467 catch (const config_error & ex)
@@ -1498,7 +1487,7 @@ void map_parser::parse_building_symbolizer(rule & rule, xml_node const & sym)
1498 1487 optional<expression_ptr> height = sym.get_opt_attr<expression_ptr>("height");
1499 1488 if (height) building_sym.set_height(*height);
1500 1489
1501   - parse_metawriter_in_symbolizer(building_sym, sym);
  1490 + parse_symbolizer_base(building_sym, sym);
1502 1491 rule.append(building_sym);
1503 1492 }
1504 1493 catch (const config_error & ex)
16 src/polygon_pattern_symbolizer.cpp
@@ -38,15 +38,13 @@ polygon_pattern_symbolizer::polygon_pattern_symbolizer(path_expression_ptr file)
38 38 : symbolizer_with_image(file), symbolizer_base(),
39 39 alignment_(LOCAL_ALIGNMENT),
40 40 gamma_(1.0),
41   - gamma_method_(GAMMA_POWER),
42   - smooth_(0.0) {}
  41 + gamma_method_(GAMMA_POWER) {}
43 42
44 43 polygon_pattern_symbolizer::polygon_pattern_symbolizer(polygon_pattern_symbolizer const& rhs)
45 44 : symbolizer_with_image(rhs), symbolizer_base(rhs),
46 45 alignment_(rhs.alignment_),
47 46 gamma_(rhs.gamma_),
48   - gamma_method_(rhs.gamma_method_),
49   - smooth_(rhs.smooth_) {}
  47 + gamma_method_(rhs.gamma_method_) {}
50 48
51 49 pattern_alignment_e polygon_pattern_symbolizer::get_alignment() const
52 50 {
@@ -78,15 +76,5 @@ gamma_method_e polygon_pattern_symbolizer::get_gamma_method() const
78 76 return gamma_method_;
79 77 }
80 78
81   -void polygon_pattern_symbolizer::set_smooth(double smooth)
82   -{
83   - smooth_ = smooth;
84   -}
85   -
86   -double polygon_pattern_symbolizer::smooth() const
87   -{
88   - return smooth_;
89   -}
90   -
91 79 }
92 80
13 src/polygon_symbolizer.cpp
@@ -39,8 +39,7 @@ polygon_symbolizer::polygon_symbolizer(color const& fill)
39 39 fill_(fill),
40 40 opacity_(1.0),
41 41 gamma_(1.0),
42   - gamma_method_(GAMMA_POWER),
43   - smooth_(0.0)
  42 + gamma_method_(GAMMA_POWER)
44 43 {}
45 44
46 45 color const& polygon_symbolizer::get_fill() const
@@ -83,14 +82,4 @@ gamma_method_e polygon_symbolizer::get_gamma_method() const
83 82 return gamma_method_;
84 83 }
85 84
86   -void polygon_symbolizer::set_smooth(double smooth)
87   -{
88   - smooth_ = smooth;
89   -}
90   -
91   -double polygon_symbolizer::smooth() const
92   -{
93   - return smooth_;
94   -}
95   -
96 85 }
14 src/save_map.cpp
@@ -84,16 +84,6 @@ class serialize_symbolizer : public boost::static_visitor<>
84 84 const stroke & strk = sym.get_stroke();
85 85 add_stroke_attributes(sym_node, strk);
86 86 add_metawriter_attributes(sym_node, sym);
87   -
88   - line_symbolizer dfl;
89   - if ( sym.get_rasterizer() != dfl.get_rasterizer() || explicit_defaults_ )
90   - {
91   - set_attr( sym_node, "rasterizer", sym.get_rasterizer() );
92   - }
93   - if ( sym.smooth() != dfl.smooth() || explicit_defaults_ )
94   - {
95   - set_attr( sym_node, "smooth", sym.smooth() );
96   - }
97 87 }
98 88
99 89 void operator () ( line_pattern_symbolizer const& sym )
@@ -128,10 +118,6 @@ class serialize_symbolizer : public boost::static_visitor<>
128 118 {
129 119 set_attr( sym_node, "gamma-method", sym.get_gamma_method() );
130 120 }
131   - if ( sym.smooth() != dfl.smooth() || explicit_defaults_ )
132   - {
133   - set_attr( sym_node, "smooth", sym.smooth() );
134   - }
135 121 add_metawriter_attributes(sym_node, sym);
136 122 }
137 123
9 src/symbolizer.cpp
@@ -108,6 +108,15 @@ bool symbolizer_base::clip() const
108 108 return clip_;
109 109 }
110 110
  111 +void symbolizer_base::set_smooth(double smooth)
  112 +{
  113 + smooth_value_ = smooth;
  114 +}
  115 +
  116 +double symbolizer_base::smooth() const
  117 +{
  118 + return smooth_value_;
  119 +}
111 120
112 121 ///////////////////////////////////////////////////////////////////////////////////////
113 122
2  src/xml_tree.cpp
@@ -461,7 +461,6 @@ compile_get_opt_attr(float);
461 461 compile_get_opt_attr(double);
462 462 compile_get_opt_attr(color);
463 463 compile_get_opt_attr(gamma_method_e);
464   -compile_get_opt_attr(line_rasterizer_e);
465 464 compile_get_opt_attr(line_join_e);
466 465 compile_get_opt_attr(line_cap_e);
467 466 compile_get_opt_attr(text_transform_e);
@@ -476,7 +475,6 @@ compile_get_attr(point_placement_e);
476 475 compile_get_attr(marker_placement_e);
477 476 compile_get_attr(marker_type_e);
478 477 compile_get_attr(pattern_alignment_e);
479   -compile_get_attr(line_rasterizer_e);
480 478 compile_get_attr(colorizer_mode);
481 479 compile_get_attr(double);
482 480 compile_get_value(int);

0 comments on commit 7e49a6f

Please sign in to comment.
Something went wrong with that request. Please try again.