void build_ellipse(T const& sym, mapnik::feature_impl & feature, attributes const& vars, svg_storage_type & marker_ellipse, svg::svg_path_adapter & svg_path) { double width = 0.0; double height = 0.0; if (has_key<double>(sym,keys::width) && has_key<double>(sym,keys::height)) { width = get<double>(sym, keys::width, feature, vars, 0.0); height = get<double>(sym, keys::height, feature, vars, 0.0); } else if (has_key<double>(sym,keys::width)) { width = height = get<double>(sym, keys::width, feature, vars, 0.0); } else if (has_key<double>(sym,keys::height)) { width = height = get<double>(sym, keys::height, feature, vars, 0.0); } svg::svg_converter_type styled_svg(svg_path, marker_ellipse.attributes()); styled_svg.push_attr(); styled_svg.begin_path(); agg::ellipse c(0, 0, width/2.0, height/2.0); styled_svg.storage().concat_path(c); styled_svg.end_path(); styled_svg.pop_attr(); double lox,loy,hix,hiy; styled_svg.bounding_rect(&lox, &loy, &hix, &hiy); styled_svg.set_dimensions(width,height); marker_ellipse.set_dimensions(width,height); marker_ellipse.set_bounding_box(lox,loy,hix,hiy); }
void build_ellipse(T const& sym, mapnik::feature_impl const& feature, svg_storage_type & marker_ellipse, svg::svg_path_adapter & svg_path) { expression_ptr const& width_expr = sym.get_width(); expression_ptr const& height_expr = sym.get_height(); double width = 0; double height = 0; if (width_expr && height_expr) { width = boost::apply_visitor(evaluate<Feature,value_type>(feature), *width_expr).to_double(); height = boost::apply_visitor(evaluate<Feature,value_type>(feature), *height_expr).to_double(); } else if (width_expr) { width = boost::apply_visitor(evaluate<Feature,value_type>(feature), *width_expr).to_double(); height = width; } else if (height_expr) { height = boost::apply_visitor(evaluate<Feature,value_type>(feature), *height_expr).to_double(); width = height; } svg::svg_converter_type styled_svg(svg_path, marker_ellipse.attributes()); styled_svg.push_attr(); styled_svg.begin_path(); agg::ellipse c(0, 0, width/2.0, height/2.0); styled_svg.storage().concat_path(c); styled_svg.end_path(); styled_svg.pop_attr(); double lox,loy,hix,hiy; styled_svg.bounding_rect(&lox, &loy, &hix, &hiy); marker_ellipse.set_bounding_box(lox,loy,hix,hiy); }