mirror of
https://github.com/mapnik/mapnik.git
synced 2025-12-08 20:13:09 +00:00
+ put labeling routines into its owm 'label' namespace
This commit is contained in:
parent
40d1e5c57e
commit
fd209b2958
@ -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
|
||||
|
||||
@ -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&);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
|
||||
@ -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&);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -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
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user