NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hi Stuart- Stuart Maclean wrote:
I am trying to use the IDV classes to build navigated displays. I learnt the whole 'display side coordinate system' technique from MapProjectionDisplay.java in the visad/examples. In particular, how a call to MapProjection.setDefaultMapArea with a xy rectangle would result in the visad 'box' showing the xy area.
Do you do this before you set the projection? Essentially, you are changing the MapProjection when you change the default Map area. By definition, CoordinateSystems are immutable, so a call to change the default Map Area breaks that paradigm. MapProjection does not have a setDefaultMapArea for just that reason.
When moving to the higher level idv classes, I thought the corresponding call was in ucar.unidata.view.geoloc.MapProjectionDisplay.setMapArea ( ProjectionRect). This does not seem to do what I want. I did peek at the source code and noted that the comments for that method imply that the rectangle is in fact a lat/lon rectangle, not a cartesian one.Can anyone shed any light on the setMapArea (and setMapRegion) methods, and how to use them correctly?
setMapArea and setMapRegion are used to zoom and pan the display, not change the default area of coverage. And as you noted, setMapArea in particular only does this (incorrectly) by assuming that the ProjectionRect is in lat/lon space. In reality, there should be a setMapArea that takes a LatLonRect and the setMapArea(ProjectionRect) should just calculate the LatLonRect from the projection in the display and then call setMapRegion. If you change the MapProjection by calling a setDefaultMapArea method, then you need to call MapProjectionDisplay.setMapProjection with the new MapProjection to make the box correspond to the newly defined area. Hope that helps. Don ************************************************************* Don Murray UCAR Unidata Program dmurray@xxxxxxxxxxxxxxxx P.O. Box 3000 (303) 497-8628 Boulder, CO 80307 http://www.unidata.ucar.edu/staff/donm *************************************************************
idvusers
archives: