Function to print pixel_position to stream.

This commit is contained in:
Hermann Kraus 2012-08-05 01:52:13 +02:00
parent 0b1c983d40
commit 5115658ecc

View file

@ -22,6 +22,9 @@
#ifndef MAPNIK_PIXEL_POSITION_HPP
#define MAPNIK_PIXEL_POSITION_HPP
// stl
#include <iomanip>
namespace mapnik
{
@ -65,6 +68,20 @@ inline pixel_position operator* (double factor, pixel_position const& pos)
return pixel_position(factor * pos.x, factor * pos.y);
}
template <class charT, class traits>
inline std::basic_ostream<charT,traits>&
operator << (std::basic_ostream<charT,traits>& out,
const pixel_position& e)
{
std::basic_ostringstream<charT,traits> s;
s.copyfmt(out);
s.width(0);
s << '(' << std::fixed << std::setprecision(16)
<< e.x << ", " << e.y << ')';
out << s.str();
return out;
}
}