|
From: Trevor S. <ts...@ty...> - 2005-07-10 08:26:23
|
On Sat, 2005-07-09 at 18:26 +0000, Zekeng liang wrote:
> I have a problem to detect the map coordiante when moving the map . I load
> part of the sptial map data initially, and I want to detect the map
> coordiante show that I can know when the map will move out of the map pane
> and load the new part of the map from the database.
> I know that we can use GeoMouseEvent to get the map coordiante by click on
> the map pane; but how to get the map coordiante when using key event?
>
What you should do is listen to events fired by the SyledMapPane
whenever the bounds are changed. In the listener, load your new
features into your existing layer (e.g. a MemoryDataStore) and the
StyledMapPane will automatically update.
zoomListener = new ZoomChangeListener() {
public void zoomChanged(ZoomChangeEvent arg0) {
Rectangle2D rect = mapPane.getVisibleArea();
Envelope area = new Envelope(rect.getMinX(),
rect.getMaxX(), rect.getMinY(), rect.getMaxY());
loadFeatures(area);
}
};
mapPane.addZoomListener(zoomListener);
You must define loadFeatures(area), natch.
--
Trevor Stone | Software Engineer | tel 800-554-4434 ext 208 | fax 303-271-1930 | email ts...@ty...
Tyler Technologies | Eagle Division | 14142 Denver West Pkwy Suite 155 | Lakewood, CO 80401 | www.tyler-eagle.com
|