Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

+ put labeling routines into its owm 'label' namespace

  • Loading branch information...
commit fd209b2958af837a4cb002fcb862c141f78b52d3 1 parent 40d1e5c
Artem Pavlenko artemp authored
8 include/mapnik/geom_util.hpp
View
@@ -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
3  src/agg/process_point_symbolizer.cpp
View
@@ -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&);
}
-
2  src/cairo_renderer.cpp
View
@@ -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);
3  src/grid/process_point_symbolizer.cpp
View
@@ -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&);
}
-
4 src/symbolizer_helpers.cpp
View
@@ -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
{
Please sign in to comment.
Something went wrong with that request. Please try again.