MapView standalone : initial viewport and locked Zoom
Added by Mathieu Leplatre 10 months ago
Hi dear Merkaartor developpers !
I am coming to beg for help after fours of struggle without result.
I could use the MapView component successfully in my standalone application !
By changing a couple of access levels and co, I could have an image layer showing up, with a basic interaction (inherited from FeatureSnapInteraction).
Great !
(my fork is here : https://gitorious.org/~leplatrem/merkaartor/leplatrem-main, tell me if I should pull request, you can also cherry pick)
However, I have some problems :
1) on initial viewport :
it works fine if I set it like this (using a point) :
m_view->setViewport(CoordBox(Coord(1.39,43.63),Coord(1.39,43.63)), m_view->rect());
but it does not work if I set it like this :
m_view->setViewport(WORLD_COORDBOX, m_view->rect());
Zoom looks like infinitely out. I can zoom in and pan though, to recover a world view.
2) on lock zoom :
if I set `RendererOptions::LockZoom`, it looks like I can only zoom out ! Without this, zooms works smoothly (but tiles are blur). Any idea why I could have this behaviour ?
I may have forgotten something, my layer is used like this :
m_streetlayer = new ImageMapLayer(tr("OSM"));
m_streetlayer->setMapAdapter(TMS_ADAPTER_UUID, "OSM Mapnik");
m_streetlayer->setVisible(true);
m_document->addImageLayer(m_streetlayer);
m_view->setDocument(m_document);
m_view->projection().setProjectionType(m_streetlayer->projection());
I have been reading code and could find anything. If you have some time, thank you for your help,
Thanks in advance!
Mathieu
Replies (3)
RE: MapView standalone : initial viewport and locked Zoom
-
Added by Mathieu Leplatre 9 months ago
Regarding 1)...
I set the viewport from within the main window constructor.
And it looks like the MapView'rect is not yet initialized, since it is only 100x30 pixels.
I wonder how I could initialize it at startup, only once the full window is drawn.
Thanks ;)
Mathieu
RE: MapView standalone : initial viewport and locked Zoom
-
Added by Mathieu Leplatre 9 months ago
Regarding 2)...
In MapView::zoom() :
http://merkaartor.be/projects/merkaartor/repository/revisions/master/entry/src/common/MapView.cpp#L1518
When I zoom in, layer's "pixels per coord" is always equal to view's "pixels per coord", ending up with a zoom factor of 1. Therefore, no zoom in in locked zoom.
qreal pixpercoord = width() / p->Viewport.lonDiff();
z = l->pixelPerCoord() / pixpercoord;
No idea so far...
RE: MapView standalone : initial viewport and locked Zoom
-
Added by Ryan Denny 3 months ago
I really loved reading your blog. It was very well authored and easy to realizeā¦. flower delivery in japan | japanese florists
(1-3/3)