* trim leading and trailing whitespace from all strings before

rendering them as labels when using the text or shield symbolisers
  (blame my horrible datasets)
* correctly recognise the Postgis "text" data type (it was in
  postgisfs.cpp just not postgis.cpp) - my initial workaround to the
  above was "SELECT trim(from label) AS label ..." which failed
  miserably because it returned a text data type. 

Thanks to Robert Coup for the patch!
This commit is contained in:
Artem Pavlenko 2006-10-19 09:24:26 +00:00
parent ac155e89ba
commit 7cae55f73f
2 changed files with 4 additions and 0 deletions

View file

@ -148,6 +148,7 @@ postgis_datasource::postgis_datasource(const parameters& params)
desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::Double,false,length));
case 1042: // bpchar
case 1043: // varchar
case 25: // text
desc_.add_descriptor(attribute_descriptor(fld_name,mapnik::String));
break;
default: // shouldn't get here

View file

@ -25,6 +25,7 @@
#include <iostream>
// boost
#include <boost/utility.hpp>
#include <boost/algorithm/string.hpp>
// agg
#include "agg_basics.h"
#include "agg_rendering_buffer.h"
@ -325,6 +326,7 @@ namespace mapnik
if (geom)
{
std::string text = feature[sym.get_name()].to_string();
boost::trim(text);
boost::shared_ptr<ImageData32> const& data = sym.get_data();
if (text.length() > 0 && data)
@ -481,6 +483,7 @@ namespace mapnik
if (geom)
{
std::string text = feature[sym.get_name()].to_string();
boost::trim(text);
if (text.length() > 0)
{
Color const& fill = sym.get_fill();