Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Programmatically change axis limits in GeoPlot

34 views
Skip to first unread message

Ryan Jones

unread,
Aug 18, 2018, 11:54:45 AM8/18/18
to Glimpse
I am trying to change the axis limits in a GeoPlot2D but it only seems to work the first time I set it in the constructor.  I set it using the following code


            Vector2d min = geoPlot2D.getGeoProjection().project(new LatLonGeo(latmin, lonmin ));
            Vector2d max =geoPlot2D.getGeoProjection().project(new LatLonGeo(latmax, lonmax));
            geoPlot2D.getAxis().set(min.getX(), max.getX(), min.getY(), max.getY());


I have tried a lot of options including invalidating and repainting and nothing seems to work. 

My goal is to be able to add waypoints to the map and auto adjust the zoom based on the added waypoints.

Any thoughts?

Thanks,

Ryan

Ryan Jones

unread,
Aug 18, 2018, 1:38:25 PM8/18/18
to Glimpse
I should mention that I am using 2.5 not 3.0.

Mike Hogye

unread,
Aug 20, 2018, 3:09:47 PM8/20/18
to Glimpse
This might be related to "retargeting," which is a feature that allows a Plot2D (or any GlimpseLayout) to have more than one on-screen realization. It is very slick in certain cases -- but it's a fundamentally tricky concept, so it introduces a lot of complexity, and weird problems (like this one).

Try calling geoPlot2D.clearCache() after you do set(xMin,xMax,yMin,yMax). That's more of a workaround than an actual solution -- but if it works, it will confirm where the issue lies.

Ryan Jones

unread,
Aug 20, 2018, 3:50:23 PM8/20/18
to Glimpse
Yes, that did the trick.

Thanks,

Ryan

Mike Hogye

unread,
Aug 21, 2018, 9:03:33 AM8/21/18
to Glimpse
Good!

If you have a smallish example you can post that reproduces the problem you're seeing, we can try to figure out the underlying issue. Or you can stick with the clearCache workaround.
Reply all
Reply to author
Forward
0 new messages