Make ShieldSymbolizer variables doubles.

Refs #1078.
This commit is contained in:
Hermann Kraus 2012-02-17 00:03:46 +01:00
parent 63735982ee
commit 44beaf1bdf
4 changed files with 18 additions and 13 deletions

View file

@ -70,7 +70,7 @@ public:
void end_map_processing(Map const& map);
void start_layer_processing(layer const& lay);
void end_layer_processing(layer const& lay);
void render_marker(int x, int y, marker & marker, agg::trans_affine const& tr, double opacity);
void render_marker(double x, double y, marker & marker, agg::trans_affine const& tr, double opacity);
void process(point_symbolizer const& sym,
mapnik::feature_ptr const& feature,

View file

@ -141,10 +141,10 @@ protected:
box2d<double> marker_ext_;
boost::optional<marker_ptr> marker_;
agg::trans_affine transform_;
int marker_w_;
int marker_h_;
int marker_x_;
int marker_y_;
double marker_w_;
double marker_h_;
double marker_x_;
double marker_y_;
// F***ing templates...
// http://womble.decadent.org.uk/c++/template-faq.html#base-lookup
using text_symbolizer_helper<FaceManagerT, DetectorT>::geometries_to_process_;

View file

@ -75,6 +75,7 @@
// boost
#include <boost/utility.hpp>
#include <boost/make_shared.hpp>
#include <boost/math/special_functions/round.hpp>
// stl
#ifdef MAPNIK_DEBUG
@ -223,7 +224,7 @@ void agg_renderer<T>::end_layer_processing(layer const&)
}
template <typename T>
void agg_renderer<T>::render_marker(int x, int y, marker & marker, agg::trans_affine const& tr, double opacity)
void agg_renderer<T>::render_marker(double x, double y, marker & marker, agg::trans_affine const& tr, double opacity)
{
if (marker.is_vector())
{
@ -262,7 +263,11 @@ void agg_renderer<T>::render_marker(int x, int y, marker & marker, agg::trans_af
}
else
{
pixmap_.set_rectangle_alpha2(**marker.get_bitmap_data(), x, y, opacity);
//TODO: Add subpixel support
pixmap_.set_rectangle_alpha2(**marker.get_bitmap_data(),
boost::math::iround(x),
boost::math::iround(y),
opacity);
}
}

View file

@ -255,14 +255,14 @@ text_placement_info_ptr shield_symbolizer_helper<FaceManagerT, DetectorT>::get_p
// remove displacement from image label
double lx = x - pos.first;
double ly = y - pos.second;
marker_x_ = int(floor(lx - (0.5 * marker_w_))) + 1;
marker_y_ = int(floor(ly - (0.5 * marker_h_))) + 1;
marker_x_ = lx - 0.5 * marker_w_;
marker_y_ = ly - 0.5 * marker_h_;
marker_ext_.re_center(lx, ly);
}
else
{ // center image at reference location
marker_x_ = int(floor(label_x - 0.5 * marker_w_));
marker_y_ = int(floor(label_y - 0.5 * marker_h_));
marker_x_ = label_x - 0.5 * marker_w_;
marker_y_ = label_y - 0.5 * marker_h_;
marker_ext_.re_center(label_x, label_y);
}
@ -345,8 +345,8 @@ std::pair<int, int> shield_symbolizer_helper<FaceManagerT, DetectorT>::get_marke
double lx = x - pos.first;
double ly = y - pos.second;
int px = int(floor(lx - (0.5*marker_w_))) + 1;
int py = int(floor(ly - (0.5*marker_h_))) + 1;
int px = lx - 0.5*marker_w_;
int py = ly - 0.5*marker_h_;
marker_ext_.re_center(lx, ly);
// detector_->insert(label_ext); //TODO: Is this done by placement_finder?