Defer projection init
This commit is contained in:
parent
6099804559
commit
387d54fe9d
2 changed files with 30 additions and 30 deletions
|
@ -421,11 +421,11 @@ void MainWindow::set_default_extent(double x0,double y0, double x1, double y1)
|
||||||
if (map_ptr)
|
if (map_ptr)
|
||||||
{
|
{
|
||||||
mapnik::projection prj(map_ptr->srs());
|
mapnik::projection prj(map_ptr->srs());
|
||||||
prj.forward(x0,y0);
|
prj.forward(x0, y0);
|
||||||
prj.forward(x1,y1);
|
prj.forward(x1, y1);
|
||||||
default_extent_=mapnik::box2d<double>(x0,y0,x1,y1);
|
default_extent_=mapnik::box2d<double>(x0, y0, x1, y1);
|
||||||
mapWidget_->zoomToBox(default_extent_);
|
mapWidget_->zoomToBox(default_extent_);
|
||||||
std::cout << "SET DEFAULT EXT\n";
|
std::cout << "SET DEFAULT EXT:" << default_extent_ << std::endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (...) {}
|
catch (...) {}
|
||||||
|
|
|
@ -156,7 +156,7 @@ void MapWidget::mousePressEvent(QMouseEvent* e)
|
||||||
{
|
{
|
||||||
QVector<QPair<QString,QString> > info;
|
QVector<QPair<QString,QString> > info;
|
||||||
|
|
||||||
projection map_proj(map_->srs()); // map projection
|
projection map_proj(map_->srs(), true); // map projection
|
||||||
double scale_denom = scale_denominator(map_->scale(),map_proj.is_geographic());
|
double scale_denom = scale_denominator(map_->scale(),map_proj.is_geographic());
|
||||||
view_transform t(map_->width(),map_->height(),map_->get_current_extent());
|
view_transform t(map_->width(),map_->height(),map_->get_current_extent());
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@ void MapWidget::mousePressEvent(QMouseEvent* e)
|
||||||
double x = e->x();
|
double x = e->x();
|
||||||
double y = e->y();
|
double y = e->y();
|
||||||
std::cout << "query at " << x << "," << y << "\n";
|
std::cout << "query at " << x << "," << y << "\n";
|
||||||
projection layer_proj(layer.srs());
|
projection layer_proj(layer.srs(), true);
|
||||||
mapnik::proj_transform prj_trans(map_proj,layer_proj);
|
mapnik::proj_transform prj_trans(map_proj,layer_proj);
|
||||||
//std::auto_ptr<mapnik::memory_datasource> data(new mapnik::memory_datasource);
|
//std::auto_ptr<mapnik::memory_datasource> data(new mapnik::memory_datasource);
|
||||||
mapnik::featureset_ptr fs = map_->query_map_point(index,x,y);
|
mapnik::featureset_ptr fs = map_->query_map_point(index,x,y);
|
||||||
|
@ -586,7 +586,7 @@ void MapWidget::updateMap()
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
projection prj(map_->srs()); // map projection
|
projection prj(map_->srs(), true); // map projection
|
||||||
box2d<double> ext = map_->get_current_extent();
|
box2d<double> ext = map_->get_current_extent();
|
||||||
double x0 = ext.minx();
|
double x0 = ext.minx();
|
||||||
double y0 = ext.miny();
|
double y0 = ext.miny();
|
||||||
|
|
Loading…
Add table
Reference in a new issue