I have two questions:
1. I wish to display a map of logical size, say, 5000x3000, but with
the whole map scaled to my display (say 1024x768). Initially, however,
following this scaling, I do not wish to display the entire map in a
1024x768 window, but just a central area in a 500x500 pixel component
(though at the scale of the whole map squeezed into 1024x768).
2. My map has no 'formal' real-world coordinate system (WGS84, NAD27
etc.). Once it's displayed, however, I wish to listen for mouse
coordinates in the window and transform them to the CS of the map
space, so as to allow feature-based queries. Further, this transform
should accommodate panning and zooming. For example, with the mouse
cursor stationary in the window, panning the map should cause its
underlying map coordinates to change.
Despite many hours looking for clues in ZoomPane and the code snippets,
I remain perplexed...
Can anyone offer outline guidance on how these two goals can be
From: Martin Desruisseaux <martin.desruisseaux@no...> - 2005-08-29 22:43:57
If a map dosn't use a coordinate reference system (CRS) related to the
"real world" (like WGS84), then it is probably an EngineeringCRS. Such
CRS are allowed (or should be). Maybe the following could work:
1) Define an EngineeringCRS which describes the coordinate space.
Maybe the convenience constants in DefaultEngineeringCRS can fit.
2) Create a Rectangle2D which contains the map area in the above-cited
3) Create a ZoomPane subclass (or use MapPane, or StyledMapPane, or an
other renderer like lite-renderer). Override 'getArea()' in order to
returns the above-cited rectangle. Or if your data fit in a Feature,
make sure the the envelope or the geometry's envelope match the
4) For zooming with ZoomPane, if you know the coordinates of yours
500x500 pixels area in yours EngineeringCRS coordinate space,
invoke ZoomPane.setVisibleArea(...) with this rectangle.
It is hard to said more without some tips about what kind of data are to
be displayed, how they are stored (Feature, raster, custom backstore, etc.).