added set_datasource method (TODO!!!)
fixed pointz in shapeindex
This commit is contained in:
parent
bc10495517
commit
8986108775
5 changed files with 50 additions and 24 deletions
|
@ -29,27 +29,27 @@
|
|||
namespace mapnik
|
||||
{
|
||||
template <typename T>
|
||||
class MAPNIK_DECL agg_renderer : public feature_style_processor<agg_renderer<T> >,
|
||||
private boost::noncopyable
|
||||
class MAPNIK_DECL agg_renderer : public feature_style_processor<agg_renderer<T> >,
|
||||
private boost::noncopyable
|
||||
{
|
||||
public:
|
||||
agg_renderer(Map const& m, T & pixmap);
|
||||
void start_map_processing(Map const& map);
|
||||
void end_map_processing(Map const& map);
|
||||
void start_layer_processing(Layer const& lay);
|
||||
void end_layer_processing(Layer const& lay);
|
||||
void process(point_symbolizer const& sym,Feature const& feature);
|
||||
void process(line_symbolizer const& sym,Feature const& feature);
|
||||
void process(line_pattern_symbolizer const& sym,Feature const& feature);
|
||||
void process(polygon_symbolizer const& sym,Feature const& feature);
|
||||
void process(polygon_pattern_symbolizer const& sym,Feature const& feature);
|
||||
void process(raster_symbolizer const& sym,Feature const& feature);
|
||||
void process(text_symbolizer const& sym,Feature const& feature);
|
||||
public:
|
||||
agg_renderer(Map const& m, T & pixmap);
|
||||
void start_map_processing(Map const& map);
|
||||
void end_map_processing(Map const& map);
|
||||
void start_layer_processing(Layer const& lay);
|
||||
void end_layer_processing(Layer const& lay);
|
||||
void process(point_symbolizer const& sym,Feature const& feature);
|
||||
void process(line_symbolizer const& sym,Feature const& feature);
|
||||
void process(line_pattern_symbolizer const& sym,Feature const& feature);
|
||||
void process(polygon_symbolizer const& sym,Feature const& feature);
|
||||
void process(polygon_pattern_symbolizer const& sym,Feature const& feature);
|
||||
void process(raster_symbolizer const& sym,Feature const& feature);
|
||||
void process(text_symbolizer const& sym,Feature const& feature);
|
||||
private:
|
||||
T & pixmap_;
|
||||
CoordTransform t_;
|
||||
face_manager<freetype_engine> font_manager_;
|
||||
label_collision_detector2 detector_;
|
||||
T & pixmap_;
|
||||
CoordTransform t_;
|
||||
face_manager<freetype_engine> font_manager_;
|
||||
label_collision_detector2 detector_;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -81,6 +81,7 @@ namespace mapnik
|
|||
void add_to_selection(boost::shared_ptr<Feature>& feature) const;
|
||||
std::vector<boost::shared_ptr<Feature> >& selection() const;
|
||||
void clear_selection() const;
|
||||
void set_datasource(datasource_p const& ds);
|
||||
datasource_p const& datasource() const;
|
||||
Envelope<double> envelope() const;
|
||||
virtual ~Layer();
|
||||
|
|
|
@ -106,6 +106,7 @@ namespace mapnik
|
|||
void agg_renderer<T>::start_layer_processing(Layer const& lay)
|
||||
{
|
||||
std::clog << "start layer processing : " << lay.name() << std::endl;
|
||||
std::clog << "datasource = " << lay.datasource().get() << std::endl;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -30,7 +30,16 @@
|
|||
namespace mapnik
|
||||
{
|
||||
using namespace std;
|
||||
Layer::Layer() {}
|
||||
Layer::Layer()
|
||||
: params_(),
|
||||
name_("uknown"),
|
||||
minZoom_(0),
|
||||
maxZoom_(std::numeric_limits<double>::max()),
|
||||
active_(true),
|
||||
selectable_(false),
|
||||
selection_style_("default_selection")
|
||||
{}
|
||||
|
||||
Layer::Layer(const parameters& params)
|
||||
:params_(params),
|
||||
name_(params_["name"]),
|
||||
|
@ -48,7 +57,7 @@ namespace mapnik
|
|||
maxZoom_(rhs.maxZoom_),
|
||||
active_(rhs.active_),
|
||||
selectable_(rhs.selectable_),
|
||||
//ds_(rhs.ds_),
|
||||
ds_(rhs.ds_),
|
||||
styles_(rhs.styles_),
|
||||
selection_style_(rhs.selection_style_) {}
|
||||
|
||||
|
@ -154,12 +163,17 @@ namespace mapnik
|
|||
}
|
||||
catch (...)
|
||||
{
|
||||
std::clog << "exception caught : can not create datasorce" << std::endl;
|
||||
std::clog << "exception caught : can not create datasource" << std::endl;
|
||||
}
|
||||
}
|
||||
return ds_;
|
||||
}
|
||||
|
||||
// TODO: !!!!
|
||||
void Layer::set_datasource(datasource_p const& ds)
|
||||
{
|
||||
ds_ = ds;
|
||||
}
|
||||
|
||||
Envelope<double> Layer::envelope() const
|
||||
{
|
||||
datasource_p const& ds = datasource();
|
||||
|
|
|
@ -149,13 +149,23 @@ int main (int argc,char** argv)
|
|||
shp.skip(2*content_length-2*8-4);
|
||||
item_ext=Envelope<double>(x,y,x,y);
|
||||
|
||||
}
|
||||
if (shape_type==shape_io::shape_pointm)
|
||||
{
|
||||
double x=shp.read_double();
|
||||
double y=shp.read_double();
|
||||
shp.read_double();
|
||||
shp.skip(2*content_length-3*8-4);
|
||||
item_ext=Envelope<double>(x,y,x,y);
|
||||
|
||||
}
|
||||
else if (shape_type==shape_io::shape_pointz)
|
||||
{
|
||||
double x=shp.read_double();
|
||||
double y=shp.read_double();
|
||||
shp.read_double();
|
||||
shp.skip(2*content_length-2*8-4);
|
||||
shp.read_double();
|
||||
shp.skip(2*content_length-4*8-4);
|
||||
item_ext=Envelope<double>(x,y,x,y);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue