+ put labeling routines into its owm 'label' namespace

This commit is contained in:
artemp 2012-07-20 17:32:38 +01:00
parent 40d1e5c57e
commit fd209b2958
5 changed files with 10 additions and 10 deletions

View File

@ -263,6 +263,8 @@ bool middle_point(PathType & path, double & x, double & y)
return true;
}
namespace label {
template <typename PathType>
bool centroid(PathType & path, double & x, double & y)
{
@ -347,10 +349,10 @@ bool hit_test(PathType & path, double x, double y, double tol)
}
template <typename PathType>
void label_interior_position(PathType & path, double & x, double & y)
void interior_position(PathType & path, double & x, double & y)
{
// start with the centroid
centroid(path, x,y);
label::centroid(path, x,y);
// if we are not a polygon, or the default is within the polygon we are done
if (hit_test(path,x,y,0.001))
@ -417,6 +419,6 @@ void label_interior_position(PathType & path, double & x, double & y)
}
}
}
}}
#endif // MAPNIK_GEOM_UTIL_HPP

View File

@ -82,7 +82,7 @@ void agg_renderer<T>::process(point_symbolizer const& sym,
double y;
double z=0;
if (sym.get_point_placement() == CENTROID_POINT_PLACEMENT)
centroid(geom, x, y);
label::centroid(geom, x, y);
else
label_interior_position(geom ,x, y);
@ -119,4 +119,3 @@ template void agg_renderer<image_32>::process(point_symbolizer const&,
proj_transform const&);
}

View File

@ -1158,7 +1158,7 @@ void cairo_renderer_base::process(point_symbolizer const& sym,
double z = 0;
if (sym.get_point_placement() == CENTROID_POINT_PLACEMENT)
centroid(geom, x, y);
label::centroid(geom, x, y);
else
label_interior_position(geom, x, y);

View File

@ -74,7 +74,7 @@ void grid_renderer<T>::process(point_symbolizer const& sym,
double y;
double z=0;
if (sym.get_point_placement() == CENTROID_POINT_PLACEMENT)
centroid(geom, x, y);
label::centroid(geom, x, y);
else
label_interior_position(geom, x, y);
@ -105,4 +105,3 @@ template void grid_renderer<grid>::process(point_symbolizer const&,
proj_transform const&);
}

View File

@ -244,11 +244,11 @@ void text_symbolizer_helper<FaceManagerT, DetectorT>::initialize_points()
{
if (how_placed == POINT_PLACEMENT)
{
centroid(geom, label_x, label_y);
label::centroid(geom, label_x, label_y);
}
else if (how_placed == INTERIOR_PLACEMENT)
{
label_interior_position(geom, label_x, label_y);
label::interior_position(geom, label_x, label_y);
}
else
{