Class MapRegion
- java.lang.Object
-
- oracle.spatial.network.nfe.vis.maps.core.MapRegion
-
public class MapRegion extends java.lang.ObjectMapRegion defines the current map display region, including the image (device) area and the data window. The device window is expressed in pixel, while the data window is expressed in the native (geographic) coordinate system of the data. It provides various convenience methods for zoom/pan operations. An affine viewport transformation is also maintained by this class to reflect the current map display characteristics.
-
-
Field Summary
Fields Modifier and Type Field Description protected MapCanvascanvasprotected java.awt.geom.Rectangle2DdataWindowprotected intdataWindowSridprotected javax.swing.event.EventListenerListlistenerListprotected intmapSridprotected oracle.sdovis.SRSmapSRSprotected intuserSridprotected oracle.sdovis.XFViewPortxfm
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddChangeListener(javax.swing.event.ChangeListener l)Adds a change listener to listen for queryWindow changes.protected voidfireStateChanged(javax.swing.event.ChangeEvent evt)doublegetCurrentRatioScale()Returns the current ratio scale.java.awt.geom.Rectangle2DgetDataWindow()Gets the data window rectangleintgetDataWindowSrid()Gets the data window SRIDdoublegetMapScale()Gets the current map scale denominator in the ratio scale.intgetMapSrid()Gets the current map SRIDoracle.sdovis.SRSgetSRS()Returns the map region SRS object.java.awt.geom.AffineTransformgetTransformDifference(java.awt.geom.AffineTransform oldXFM)intgetUserSrid()java.awt.geom.AffineTransformgetViewportTransform()voidpan(int tx, int ty)Moves the map display by 'tx' pixels on the X axis, and 'ty' pixels on the Y axis in the device coordinate system.voidremoveChangeListener(javax.swing.event.ChangeListener l)Removes the give change listenervoidsetDataWindow(java.awt.geom.Rectangle2D dataWindow)Sets the data window rectanglevoidsetDataWindow(java.awt.geom.Rectangle2D dataWindow, int zoomLevelDif)Sets the data window rectangle and zoom levelvoidsetDataWindowByScale(double centerX, double centerY, double scale)Sets the data window size using the given scalevoidsetDataWindowSrid(int dataWindowSrid)Sets the data window sridvoidsetMapSrid(int mapSrid)Sets the current map SRIDvoidsetSRS(oracle.sdovis.SRS srs)Sets the map region SRS information.voidsetUserSrid(int userSrid)Sometimes when a map is displayed in a projected coordinate system, the coordinates do not make much sense to a user, who expects to see coordinates such as those displayed when moving mouse around the map to be in longitude/latitude.voidzoom(java.awt.geom.Point2D deviceAnchor, double factor, int level)voidzoomBox(java.awt.geom.Rectangle2D window)Zooms to the provided boxvoidzoomIn()Performs a zoom invoidzoomIn(java.awt.geom.Point2D deviceAnchor)Performs a zoom in at the given pointvoidzoomOut()Performs a zoom outvoidzoomOut(java.awt.geom.Point2D deviceAnchor)Performs a zoom out at the given pont
-
-
-
Field Detail
-
canvas
protected MapCanvas canvas
-
dataWindow
protected java.awt.geom.Rectangle2D dataWindow
-
xfm
protected oracle.sdovis.XFViewPort xfm
-
mapSrid
protected int mapSrid
-
mapSRS
protected oracle.sdovis.SRS mapSRS
-
dataWindowSrid
protected int dataWindowSrid
-
userSrid
protected int userSrid
-
listenerList
protected javax.swing.event.EventListenerList listenerList
-
-
Constructor Detail
-
MapRegion
public MapRegion(MapCanvas canvas)
-
-
Method Detail
-
setDataWindowByScale
public void setDataWindowByScale(double centerX, double centerY, double scale) throws java.lang.ExceptionSets the data window size using the given scale- Parameters:
centerX-centerY-scale-- Throws:
java.lang.Exception
-
getMapSrid
public int getMapSrid()
Gets the current map SRID- Returns:
-
setMapSrid
public void setMapSrid(int mapSrid)
Sets the current map SRID- Parameters:
mapSrid-
-
getDataWindow
public java.awt.geom.Rectangle2D getDataWindow()
Gets the data window rectangle- Returns:
-
setDataWindow
public void setDataWindow(java.awt.geom.Rectangle2D dataWindow)
Sets the data window rectangle- Parameters:
dataWindow-
-
setDataWindow
public void setDataWindow(java.awt.geom.Rectangle2D dataWindow, int zoomLevelDif)Sets the data window rectangle and zoom level- Parameters:
dataWindow-zoomLevelDif-
-
getDataWindowSrid
public int getDataWindowSrid()
Gets the data window SRID- Returns:
-
setDataWindowSrid
public void setDataWindowSrid(int dataWindowSrid)
Sets the data window srid- Parameters:
dataWindowSrid-
-
getMapScale
public double getMapScale()
Gets the current map scale denominator in the ratio scale.- Returns:
-
getViewportTransform
public java.awt.geom.AffineTransform getViewportTransform()
-
getTransformDifference
public java.awt.geom.AffineTransform getTransformDifference(java.awt.geom.AffineTransform oldXFM)
-
addChangeListener
public void addChangeListener(javax.swing.event.ChangeListener l)
Adds a change listener to listen for queryWindow changes.- Parameters:
l-
-
removeChangeListener
public void removeChangeListener(javax.swing.event.ChangeListener l)
Removes the give change listener- Parameters:
l-
-
fireStateChanged
protected void fireStateChanged(javax.swing.event.ChangeEvent evt)
-
zoomBox
public void zoomBox(java.awt.geom.Rectangle2D window)
Zooms to the provided box- Parameters:
window-
-
zoomIn
public void zoomIn()
Performs a zoom in
-
zoomIn
public void zoomIn(java.awt.geom.Point2D deviceAnchor)
Performs a zoom in at the given point- Parameters:
deviceAnchor-
-
zoomOut
public void zoomOut()
Performs a zoom out
-
zoomOut
public void zoomOut(java.awt.geom.Point2D deviceAnchor)
Performs a zoom out at the given pont- Parameters:
deviceAnchor-
-
zoom
public void zoom(java.awt.geom.Point2D deviceAnchor, double factor, int level)
-
pan
public void pan(int tx, int ty)Moves the map display by 'tx' pixels on the X axis, and 'ty' pixels on the Y axis in the device coordinate system.- Parameters:
tx- the distance by which coordinates are translated in the X axis directionty- the distance by which coordinates are translated in the Y axis direction
-
setSRS
public void setSRS(oracle.sdovis.SRS srs)
Sets the map region SRS information.- Parameters:
srs-
-
getSRS
public oracle.sdovis.SRS getSRS()
Returns the map region SRS object.- Returns:
-
getCurrentRatioScale
public double getCurrentRatioScale()
Returns the current ratio scale. Map region SRS must be defined.- Returns:
- ratio scale value of Double.NaN if can not be computed
-
getUserSrid
public int getUserSrid()
-
setUserSrid
public void setUserSrid(int userSrid)
Sometimes when a map is displayed in a projected coordinate system, the coordinates do not make much sense to a user, who expects to see coordinates such as those displayed when moving mouse around the map to be in longitude/latitude. In such cases, the user SRID can be set to 8307, which is purely for end user convenience.
-
-