public class ViewRenderer
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected java.awt.Color |
background |
protected JMapUnit |
displayUnit |
protected JMapUnit |
distanceUnit |
protected GraphicsManager |
graphicsManager |
protected OrientedRectangle |
initialViewBounds |
protected LayerManager |
layerMgr |
protected java.util.Vector<ViewRendererListener> |
listeners |
protected Projection |
mapProjection |
protected JMapUnit |
mapUnit |
protected double |
maximumScale
The maximum scale for rendering.
|
protected OrientedRectangle |
maxViewBounds |
protected Projection |
measurementProjection |
protected double |
minimumScale
The minimum scale for rendering.
|
protected OrientedRectangle |
pendingZoomRect |
protected java.util.Vector<ViewStaticElement> |
staticElements |
protected K2DTransform |
t |
protected boolean |
verbose |
| Modifier | Constructor and Description |
|---|---|
protected |
ViewRenderer()
Default View constructor setting the layer manager to null.
|
protected |
ViewRenderer(LayerManager layerMgr,
ViewSettings settings)
Constructs a new View object associated with the specified LayerManager.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addStaticElement(ViewStaticElement staticElem)
Adds the specified static element to the list of elements that will be
drawn in this view on top of geographic data.
|
void |
addViewRendererListener(ViewRendererListener l)
Adds a listener to the list of view renderer listeners.
|
void |
applySettings(ViewSettings settings)
Sets the settings for the view
|
void |
close()
Frees resources used by the view.
|
void |
draw(GraphicsRef gr)
Draws this view.
|
void |
draw(GraphicsRef gr,
K2DTransform t,
OrientedRectangle wcBounds)
Draws this view.
|
void |
draw(GraphicsRef gr,
K2DTransform t,
OrientedRectangle wcBounds,
Rectangle dcBounds,
int drawOptions)
Draws this view.
|
void |
drawStaticElements(GraphicsRef gr,
K2DTransform t,
Rectangle viewBounds)
Draws view static elements.
|
protected void |
fireStateChanged()
Fires a ViewRendererStateChangedEvent.
|
protected void |
fireStaticElementsChangedEvent()
Fires a ViewStaticElementEvent.
|
protected void |
fitToRect(OrientedRectangle rect)
Adjusts the transformation matrix so that the specified region of the view
bounds fits completely in the current view DC rectangle.
|
protected void |
fitToRect(OrientedRectangle rect,
boolean fireEvent)
Adjusts the transformation matrix so that the specified region of the view
bounds fits completely in the current view DC rectangle.
|
protected void |
fitToRect(OrientedRectangle rect,
boolean fitXyScales,
boolean fireEvent)
Adjusts the transformation matrix so that the specified region of the view
bounds fits completely in the current view DC rectangle.
|
java.awt.Color |
getBackground() |
java.awt.Rectangle |
getBounds() |
Point |
getCenterOfView()
Returns the coordinate of the center of the view in DC coordinates.
|
Rectangle |
getDcViewBounds()
Returns a Rectangle object representing the area of the view in DC.
|
JMapUnit |
getDisplayUnit()
This method returns the Display unit.
|
JMapUnit |
getDistanceUnit() |
GraphicsManager |
getGraphicsManager()
Returns the graphics manager of the current view.
|
int |
getHeight()
Returns the current height of this view.
|
OrientedRectangle |
getInitialViewBounds()
Gets the initial view bounds
|
OrientedRectangle |
getLastViewBounds() |
LayerManager |
getLayerManager()
Returns the LayerManager object associated with this view.
|
Projection |
getMapProjection()
Returns the current map data projection.
|
JMapUnit |
getMapUnit()
Returns the current map data unit.
|
OrientedRectangle |
getMaxViewBounds()
Returns the maximum bounds of this view
|
Projection |
getMeasurementProjection() |
OrientedRectangle |
getPendingZoomRect() |
double |
getResolution() |
double |
getRotation()
Returns the view rotation angle in degrees.
|
double |
getScaleFactor()
Computes the view current scale factor denominator.
|
double |
getScaleFactor(double dcScale)
Computes a scale factor denominator.
|
ScaleValidator |
getScaleValidator() |
java.awt.Dimension |
getSize() |
ViewState |
getState()
Returns the current state of the view, including a copy of all
properties needed to restore the current state.
|
ViewStaticElement[] |
getStaticElements()
Returns view static elements added to this view.
|
K2DTransform |
getTransform()
Returns the K2DTransform object associated with this view.
|
UndoManager |
getUndoManager() |
protected ViewGridSettings |
getViewGridSettings() |
ViewSettings |
getViewSettings()
Returns the current view settings.
|
OrientedRectangle |
getWcViewBounds()
Returns a Rectangle object representing the area of the view in WC.
|
int |
getWidth()
Returns the current width of this view.
|
double |
getZoomLevel()
Gets the zoom level expressed in the current map units
|
protected boolean |
isMaximumExtentLocked() |
boolean |
isRefreshable()
Returns whether or not the view is refreshable.
|
boolean |
isVerbose()
Returns the verbose mode for this view.
|
protected boolean |
isXyScaleLocked() |
boolean |
moveBackward()
Adjust the view in order to display the region that was displayed prior to
the previous change in the view (similar to undo).
|
boolean |
moveForward()
If moveBackward() was called, adjust the view in order to display the region that
was displayed before the call to moveBackward() (similar to redo).
|
void |
moveTo(Point coord)
Makes the specified WC coordinate the new center of the view and redraws
the view.
|
void |
pan(int xDC,
int yDC)
Adjusts the view in order to display a region that corresponds to the
current region translated by xDC in x and yDC in y (in DC).
|
void |
removeStaticElement(ViewStaticElement staticElem)
Removes the specified static element from the list.
|
void |
removeViewRendererListener(ViewRendererListener l)
Removes a listener from the list of view renderer listeners.
|
void |
setBackground(java.awt.Color color) |
protected void |
setDisplayLogo(boolean displayLogo) |
void |
setDisplayUnit(JMapUnit unit)
Sets the unit to use when displaying coordinates.
|
void |
setDistanceUnit(JMapUnit unit)
Sets the unit to use when displaying distances.
|
void |
setInitialViewBounds(OrientedRectangle initialViewBounds)
Sets the initial view bounds
|
void |
setLayerManager(LayerManager layerMgr)
Sets the layer manager
|
void |
setMapUnit(JMapUnit unit)
Sets the unit for this map.
|
protected void |
setMaximumExtentLocked(boolean maximumExtentLocked) |
void |
setMaximumScale(double scale)
Sets the View maximum scale.
|
void |
setMaxViewBounds(OrientedRectangle maxBounds)
Sets the maximum view bounds where the user will be able to zoom/pan
|
void |
setMeasurementProjection(Projection measurementProjection) |
protected void |
setPendingZoomRect(OrientedRectangle pendingZoomRect) |
void |
setRefreshable(boolean refreshable)
Sets whether or not the view is refreshable.
|
void |
setResolution(double resolution) |
void |
setRotation(double angle)
Rotates the map to the specified angle in degrees.
|
void |
setScaleValidator(ScaleValidator scaleValidator) |
void |
setSize(int width,
int height)
Sets the view bounds.
|
void |
setVerbose(boolean verbose)
Sets the verbose mode for this view.
|
protected void |
setXyScaleLocked(boolean xyScaleLocked) |
void |
zoom(double factor)
Zooms by the specified factor and around the center of the view and redraws
the view.
|
void |
zoom(double factor,
Point WCPt)
Zooms by the specified factor and around specified point pt and redraws the
view.
|
void |
zoom(OrientedRectangle rect)
Zooms to the specified WC region (rect) and redraws the view.
|
void |
zoom(Rectangle rect) |
protected void |
zoomDC(double factor,
Point DCPt) |
protected void |
zoomDC(double factor,
Point DCPt,
boolean fireEvent) |
void |
zoomExtent()
Adjusts the view in order to display every element of every visible layer
managed by the associated LayerManager object.
|
protected boolean verbose
protected LayerManager layerMgr
protected final K2DTransform t
protected final java.util.Vector<ViewRendererListener> listeners
protected final java.util.Vector<ViewStaticElement> staticElements
protected java.awt.Color background
protected double minimumScale
protected double maximumScale
protected JMapUnit mapUnit
protected JMapUnit distanceUnit
protected JMapUnit displayUnit
protected OrientedRectangle initialViewBounds
protected OrientedRectangle maxViewBounds
protected Projection mapProjection
protected Projection measurementProjection
protected OrientedRectangle pendingZoomRect
protected GraphicsManager graphicsManager
protected ViewRenderer()
protected ViewRenderer(LayerManager layerMgr, ViewSettings settings)
layerMgr - the associated LayerManagersettings - the settings to be applied to the viewLayerManagerpublic void applySettings(ViewSettings settings)
settings - the ViewSettings instance containing the settingsViewSettingspublic ViewSettings getViewSettings()
public void setMapUnit(JMapUnit unit)
unit - the corresponding JMapUnit instance.public JMapUnit getMapUnit()
public void addStaticElement(ViewStaticElement staticElem)
staticElem - the static element to be addedViewStaticImagepublic ViewStaticElement[] getStaticElements()
public void removeStaticElement(ViewStaticElement staticElem)
staticElem - the staic element to be removedViewStaticImagepublic void setLayerManager(LayerManager layerMgr)
layerMgr - public void setMaximumScale(double scale)
scale - the maximum scalepublic void zoom(double factor)
factor - the zooming factorprotected void zoomDC(double factor,
Point DCPt)
factor - DCPt - protected void zoomDC(double factor,
Point DCPt,
boolean fireEvent)
factor - DCPt - fireEvent - whether or not to fire a view changed event.public void zoom(double factor,
Point WCPt)
factor - the zooming factorWCPt - the center of the zoom operation in WCpublic void zoom(Rectangle rect)
public void zoom(OrientedRectangle rect)
rect - the WC region to zoom to.public void moveTo(Point coord)
coord - the new center WC coordinate of the viewpublic void zoomExtent()
public void pan(int xDC,
int yDC)
xDC - the translation in x expressed in DC coordinatesyDC - the translation in y expressed in DC coordinatespublic boolean moveBackward()
public boolean moveForward()
public Point getCenterOfView()
public Rectangle getDcViewBounds()
public Projection getMapProjection()
public ViewState getState()
public OrientedRectangle getWcViewBounds()
public K2DTransform getTransform()
public LayerManager getLayerManager()
public void addViewRendererListener(ViewRendererListener l)
l - the event listener to addpublic void removeViewRendererListener(ViewRendererListener l)
l - the event listener to removeprotected void fireStateChanged()
protected void fireStaticElementsChangedEvent()
protected void fitToRect(OrientedRectangle rect)
rect - the corresponding view bounds.fitToRect(OrientedRectangle, boolean)protected void fitToRect(OrientedRectangle rect, boolean fireEvent)
rect - the corresponding view bounds.fireEvent - whether or not to fire a view changed event.protected void fitToRect(OrientedRectangle rect, boolean fitXyScales, boolean fireEvent)
rect - the corresponding view bounds.fitXyScales - whether are not the renderer matrix should be rescaled to have even X and Y ratios.fireEvent - whether or not to fire a view changed event.public double getScaleFactor()
public double getScaleFactor(double dcScale)
dcScale - the ratio between DC and WC coordinates.public double getZoomLevel()
public OrientedRectangle getInitialViewBounds()
public void setInitialViewBounds(OrientedRectangle initialViewBounds)
initialViewBounds - The initial view bounds.protected ViewGridSettings getViewGridSettings()
public void close()
public void draw(GraphicsRef gr)
gr - the graphics instance wrapper to use.public void draw(GraphicsRef gr, K2DTransform t, OrientedRectangle wcBounds)
gr - the graphics instance wrapper to use.t - the view transformation matrix.wcBounds - the bounds to draw.public void draw(GraphicsRef gr, K2DTransform t, OrientedRectangle wcBounds, Rectangle dcBounds, int drawOptions)
gr - the graphics instance wrapper to use.t - the view transformation matrix.wcBounds - the WC bounds to draw.dcBounds - the DC bounds to draw.drawOptions - a bit field value that specifies what to draw.public void drawStaticElements(GraphicsRef gr, K2DTransform t, Rectangle viewBounds)
gr - the graphics instance wrapper to use.t - the view transformation matrix.viewBounds - the view bounds to draw.public void setSize(int width,
int height)
width - the new width of this view.height - the new height of this view.Component.setBounds(int, int, int, int)public java.awt.Rectangle getBounds()
public java.awt.Dimension getSize()
public void setRotation(double angle)
angle - the absolute angle in degrees (0 means north is straight up)public double getRotation()
public JMapUnit getDistanceUnit()
public void setDistanceUnit(JMapUnit unit)
unit - the distance unit to use on this viewpublic Projection getMeasurementProjection()
public void setMeasurementProjection(Projection measurementProjection)
public void setBackground(java.awt.Color color)
public java.awt.Color getBackground()
public JMapUnit getDisplayUnit()
public void setDisplayUnit(JMapUnit unit)
unit - the main display unit to use on this viewpublic GraphicsManager getGraphicsManager()
public void setMaxViewBounds(OrientedRectangle maxBounds)
maxBounds - public OrientedRectangle getMaxViewBounds()
public int getWidth()
public int getHeight()
public void setVerbose(boolean verbose)
verbose - The verbose modepublic boolean isVerbose()
public boolean isRefreshable()
public void setRefreshable(boolean refreshable)
refreshable - a boolean value that specifies whether or not the view is
refreshable.public double getResolution()
public void setResolution(double resolution)
public OrientedRectangle getPendingZoomRect()
protected void setPendingZoomRect(OrientedRectangle pendingZoomRect)
public OrientedRectangle getLastViewBounds()
public UndoManager getUndoManager()
protected void setDisplayLogo(boolean displayLogo)
public ScaleValidator getScaleValidator()
public void setScaleValidator(ScaleValidator scaleValidator)
protected boolean isXyScaleLocked()
protected void setXyScaleLocked(boolean xyScaleLocked)
protected boolean isMaximumExtentLocked()
protected void setMaximumExtentLocked(boolean maximumExtentLocked)