Metawriter: Only write features that are actually rendered.
This commit is contained in:
parent
8f8903baa5
commit
0ae110015b
3 changed files with 7 additions and 0 deletions
|
@ -94,6 +94,7 @@ public:
|
|||
for (;metaItr!=metaItrEnd; ++metaItr)
|
||||
{
|
||||
metaItr->second->start(m_.metawriter_output_properties);
|
||||
metaItr->second->set_size(m_.width(), m_.height());
|
||||
}
|
||||
|
||||
try
|
||||
|
|
|
@ -80,10 +80,13 @@ class metawriter
|
|||
CoordTransform const &t,
|
||||
metawriter_properties const& properties = metawriter_properties())=0;
|
||||
virtual void start(metawriter_property_map const& properties) {};
|
||||
void set_size(int width, int height) { width_ = width; height_ = height; }
|
||||
virtual void stop() {};
|
||||
metawriter_properties const& get_default_properties() const { return dflt_properties_;}
|
||||
protected:
|
||||
metawriter_properties dflt_properties_;
|
||||
int width_;
|
||||
int height_;
|
||||
};
|
||||
|
||||
typedef boost::shared_ptr<metawriter> metawriter_ptr;
|
||||
|
|
|
@ -105,6 +105,9 @@ void metawriter_json_stream::add_box(box2d<double> box, Feature const &feature,
|
|||
output: WGS84
|
||||
*/
|
||||
|
||||
/* Check if feature is in bounds. */
|
||||
if (box.maxx() < 0 || box.maxy() < 0 || box.minx() > width_ || box.miny() > height_) return;
|
||||
|
||||
proj_transform trans(prj_trans.source(), projection("+proj=latlong +datum=WGS84"));
|
||||
//t_ coord transform has transform for box2d combined with prj_trans
|
||||
box = t.backward(box, trans);
|
||||
|
|
Loading…
Reference in a new issue