lwu (owner)

Revisions

  • 3bf9e9 Mon Aug 18 22:03:20 -0700 2008
gist: 6150 Download_button fork
public
Public Clone URL: git://gist.github.com/6150.git
point_datasource.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// This class implements a simple way of displaying point-based data in Mapnik
// (It has yet to be tested as Mapnik r729's memory_featureset is commented out now.)
//
class point_datasource : public mapnik::memory_datasource {
public:
point_datasource() : feat_id(0) {}
void add_point(double x, double y, const char* key, const char* value);
int type() const { return mapnik::datasource::Raster; }
 
private:
int feat_id;
};
 
void point_datasource::add_point(double x, double y,
const char* key, const char* value)
{
using namespace mapnik;
feature_ptr feature(feature_factory::create(feat_id++));
geometry2d * pt = new point_impl;
pt->move_to(x,y);
feature->add_geometry(pt);
transcoder tr("utf-8");
(*feature)[key] = tr.transcode(value);
this->push(feature);
}