public class TLcdMultilevelGridLayer extends Object implements ILcdGXYLayer
ILcdGXYLayer
implementation that can be added to an ILcdGXYView
to render and label a
ILcdMultilevelGrid
. Note that the model does not contain the grid. The grid can be accessed using
getMultilevelGrid()
.Constructor and Description |
---|
TLcdMultilevelGridLayer(ILcdMultilevelGrid aMultilevelGrid,
ILcdModelReference aModelReference)
Constructs a
TLcdMultilevelGridLayer that will render a multilevel grid in an
ILcdGXYView . |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
Adds a listener that will be notified of all property changes of this layer.
|
void |
addSelectionListener(ILcdSelectionListener aSelectionListener)
This layer does not support selection.
|
int |
applyOnInteract(ILcdFunction aFunction,
Rectangle aRectangle,
boolean aStrictInteract,
ILcdGXYView aGXYView)
This layer does not allow interaction.
|
void |
clearSelection(int aFireEventMode)
This layer does not support selection.
|
void |
fireCollectedSelectionChanges()
This layer does not support selection.
|
ILcdBounds |
getBounds(int aLayerPaintMode,
ILcdGXYView aGXYView)
Returns the view bounds of the multilevel grid in the given context.
|
ILcdGXYEditor |
getGXYEditor(Object aObject)
Always returns null.
|
ILcdGXYLabelPainter |
getGXYLabelPainter(Object aObject)
Always returns null.
|
ILcdGXYPainter |
getGXYPainter(Object aObject)
Always returns null.
|
ILcdGXYPen |
getGXYPen()
Returns the pen used to render the grid lines.
|
ILcdIcon |
getIcon()
Returns a graphical representation of this layer, which can be used in a GUI.
|
String |
getLabel()
Gets a textual representation of this layer.
|
ILcdInterval |
getLabelScaleRange()
This layer does not have a label scale range.
|
protected ILcdGXYPainterStyle |
getLevelStyle(int aLevel)
The style with which the grid line at a given level will be rendered.
|
protected double[] |
getLevelSwitchScales()
Returns an array indicating at which view scales the rendering of the grid switches levels.
|
ILcdModel |
getModel()
Returns an empty vector model.
|
Class |
getModelXYWorldTransfoClass()
Returns the transformation class that to use to transform points and bounds from model space to world space and
back.
|
ILcdMultilevelGrid |
getMultilevelGrid()
Returns the
ILcdMultilevelGrid on which this layer is based. |
ALcdMultilevelGridCoordinateFormat |
getMultilevelGridCoordinateFormat()
Returns the format for labeling the grid element of this grid.
|
ILcdInterval |
getScaleRange()
This layer does not have a scale range.
|
int |
getSelectionCount()
This layer does not support selection.
|
boolean |
isEditable()
This layer does not support editing.
|
boolean |
isEditableSupported()
This layer does not support editing.
|
boolean |
isLabeled()
Returns whether labels should be rendered for this grid.
|
boolean |
isLabeledSupported()
Always true.
|
boolean |
isLabelLevel(int aLevel,
ILcdGXYContext aGXYContext)
Indicates whether the labels should be rendered for the given level of the grid.
|
boolean |
isPaintLevel(int aLevel,
ILcdGXYContext aGXYContext)
Indicates whether the given level should be rendered.
|
boolean |
isPaintOutline(ILcdGXYContext aGXYContext)
Whether the outline of the grid should be painted.
|
boolean |
isSelectable()
This layer does not support selection.
|
boolean |
isSelectableSupported()
This layer does not support selection.
|
boolean |
isSelected(Object aObject)
This layer does not support selection.
|
boolean |
isVisible()
Returns whether any part of this layer should be rendered.
|
void |
paint(Graphics aGraphics,
int aLayerPaintMode,
ILcdGXYView aGXYView)
Renders the grid lines and labels on the Graphics passed at levels for which
isPaintLevel(int, com.luciad.view.gxy.ILcdGXYContext) and/or
isLabelLevel(int, com.luciad.view.gxy.ILcdGXYContext) are true. |
protected void |
paintLabel(ILcdMultilevelGridCoordinate aMultilevelGridCoordinate,
ILcdGXYContext aGXYContext,
Graphics aGraphics)
Renders the label as formatted by the multilevel grid formatter for the given multilevel grid coordinate
in the center of the grid coordinate.
|
protected void |
paintLabels(int aLevel,
Graphics aGraphics,
ILcdGXYContext aGXYContext)
Called from paint to paint all labels.
|
protected void |
paintLevel(int aLevel,
Graphics aGraphics,
ILcdGXYContext aGXYContext)
Renders a level of the grid on the Graphics passed in the given context.
|
protected void |
paintOutline(Graphics aGraphics,
ILcdGXYContext aGXYContext)
Renders the outline of the grid on the Graphics passed.
|
void |
removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
Removes a listener from the list of property change listeners.
|
void |
removeSelectionListener(ILcdSelectionListener aSelectionListener)
This layer does not support selection.
|
Enumeration |
selectedObjects()
This layer does not support selection.
|
void |
selectObject(Object aObject,
boolean aSelected,
int aFireEventMode)
This layer does not support selection.
|
void |
setEditable(boolean aEditable)
This layer does not support editing.
|
void |
setGXYPen(ILcdGXYPen aPen)
Sets the pen to use to render the grid lines.
|
void |
setIcon(ILcdIcon aIcon)
Sets a graphical representation of this layer, which can be used in a GUI.
|
void |
setLabel(String aLabel)
Sets a human readable textual representation of the layer.
|
void |
setLabeled(boolean aLabeled)
If false no labels are rendered for the grid.
|
void |
setLevelStyle(int aLevel,
ILcdGXYPainterStyle aLevelStyle)
Sets the style with which the grid line at a given level should be rendered.
|
void |
setLevelSwitchScales(double[] aLevelSwitchScales)
Sets the scales at which the rendering of the grid switches level.
|
void |
setMultilevelGridCoordinateFormat(ALcdMultilevelGridCoordinateFormat aMultilevelGridCoordinateFormat)
Sets the format for labeling the grid element of this grid.
|
void |
setOutlineStyle(ILcdGXYPainterStyle aOutlineStyle)
Sets the style to use when rendering the outline of the multilevel grid.
|
void |
setSelectable(boolean aSelectable)
This layer does not support selection.
|
void |
setVisible(boolean aVisible)
Sets whether this layer should be rendered or not.
|
void |
stopPainting()
Empty implementation.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLabelMapScaleRange, getMapScaleRange
getSelectedObjects
public TLcdMultilevelGridLayer(ILcdMultilevelGrid aMultilevelGrid, ILcdModelReference aModelReference)
TLcdMultilevelGridLayer
that will render a multilevel grid in an
ILcdGXYView
.aMultilevelGrid
- the grid to display.aModelReference
- the model reference with regard to which the grid is defined.public void paint(Graphics aGraphics, int aLayerPaintMode, ILcdGXYView aGXYView)
isPaintLevel(int, com.luciad.view.gxy.ILcdGXYContext)
and/or
isLabelLevel(int, com.luciad.view.gxy.ILcdGXYContext)
are true.paint
in interface ILcdGXYLayer
aGraphics
- the Graphics to render the grid on.aLayerPaintMode
- depending on the value of this parameter the grid lines or the grid labels are rendered.aGXYView
- the view of which this layer is part.ILcdGXYLayer.getGXYPainter(Object)
,
ILcdGXYLayer.getGXYLabelPainter(Object)
,
ILcdGXYLayer.getScaleRange()
,
ILcdGXYLayer.getLabelScaleRange()
,
ILcdGXYLayer.stopPainting()
public boolean isPaintOutline(ILcdGXYContext aGXYContext)
getLevelSwitchScales()
.aGXYContext
- the context in which the grid is being rendered.getLevelSwitchScales()
.protected void paintOutline(Graphics aGraphics, ILcdGXYContext aGXYContext)
paint(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYView)
when isPaintOutline(com.luciad.view.gxy.ILcdGXYContext)
returns true.aGraphics
- the Graphics to render the grid outline on.aGXYContext
- the context in which to paint the outline.public void setOutlineStyle(ILcdGXYPainterStyle aOutlineStyle)
aOutlineStyle
- the style to use when rendering the outline of the multilevel grid.protected void paintLabels(int aLevel, Graphics aGraphics, ILcdGXYContext aGXYContext)
paintLabel(ILcdMultilevelGridCoordinate, com.luciad.view.gxy.ILcdGXYContext, java.awt.Graphics)
for all grid elements of the levels that are visible in the view.aLevel
- the level for which the labels will be rendered.aGraphics
- the Graphics on which to render the labels.aGXYContext
- the context in which the labels will be rendered.isPaintLevel(int, com.luciad.view.gxy.ILcdGXYContext)
protected void paintLabel(ILcdMultilevelGridCoordinate aMultilevelGridCoordinate, ILcdGXYContext aGXYContext, Graphics aGraphics)
paintLabels(int, java.awt.Graphics, com.luciad.view.gxy.ILcdGXYContext)
for all objects which
are visible in a view in the given context.aMultilevelGridCoordinate
- the multilevel grid coordinate to render the label for.aGXYContext
- the context in which the label is rendered.aGraphics
- the Graphics to render the label on.paintLabels(int, java.awt.Graphics, com.luciad.view.gxy.ILcdGXYContext)
,
setMultilevelGridCoordinateFormat(ALcdMultilevelGridCoordinateFormat)
public boolean isPaintLevel(int aLevel, ILcdGXYContext aGXYContext)
getLevelSwitchScales()
with index level.aLevel
- the level to check.aGXYContext
- the context in which the grid level will be rendered.public boolean isLabelLevel(int aLevel, ILcdGXYContext aGXYContext)
getLevelSwitchScales()
with index level and level +1.aLevel
- the level to check.aGXYContext
- the context in which the grid levels labels will be rendered.protected ILcdGXYPainterStyle getLevelStyle(int aLevel)
aLevel
- the level to return the style for.setLevelStyle(int, com.luciad.view.gxy.ILcdGXYPainterStyle)
public void setLevelStyle(int aLevel, ILcdGXYPainterStyle aLevelStyle)
aLevel
- the level at which the style should be applied.aLevelStyle
- the style to apply when rendering the grid level.getLevelStyle(int)
protected void paintLevel(int aLevel, Graphics aGraphics, ILcdGXYContext aGXYContext)
paint(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYView)
for levels for which
isPaintLevel(int, com.luciad.view.gxy.ILcdGXYContext)
returns true.aLevel
- the level to render.aGraphics
- the Graphics to render on.aGXYContext
- the context in which to render.public int applyOnInteract(ILcdFunction aFunction, Rectangle aRectangle, boolean aStrictInteract, ILcdGXYView aGXYView)
applyOnInteract
in interface ILcdGXYLayer
aFunction
- not taken into account.aRectangle
- not taken into account.aStrictInteract
- not taken into account.aGXYView
- not taken into account.public ILcdBounds getBounds(int aLayerPaintMode, ILcdGXYView aGXYView) throws TLcdNoBoundsException
getBounds
in interface ILcdGXYLayer
aLayerPaintMode
- not taken into account.aGXYView
- the view in which this layer is painted.TLcdNoBoundsException
- when the grid is not visible in the view passed.public void stopPainting()
stopPainting
in interface ILcdGXYLayer
paint
public ILcdInterval getScaleRange()
isPaintLevel(int, com.luciad.view.gxy.ILcdGXYContext)
.getScaleRange
in interface ILcdGXYLayer
isPaintLevel(int, com.luciad.view.gxy.ILcdGXYContext)
public ILcdInterval getLabelScaleRange()
paintLabels(int, java.awt.Graphics, com.luciad.view.gxy.ILcdGXYContext)
, and
paintLabel(ILcdMultilevelGridCoordinate, com.luciad.view.gxy.ILcdGXYContext, java.awt.Graphics)
.getLabelScaleRange
in interface ILcdGXYLayer
ILcdGXYLayer.getLabelMapScaleRange()
public ILcdGXYPainter getGXYPainter(Object aObject)
getGXYPainter
in interface ILcdGXYLayer
aObject
- not taken into account.public ILcdGXYEditor getGXYEditor(Object aObject)
getGXYEditor
in interface ILcdGXYLayer
aObject
- not taken into account.public ILcdGXYLabelPainter getGXYLabelPainter(Object aObject)
paintLabels(int, java.awt.Graphics, com.luciad.view.gxy.ILcdGXYContext)
and
paintLabel(ILcdMultilevelGridCoordinate, com.luciad.view.gxy.ILcdGXYContext, java.awt.Graphics)
.getGXYLabelPainter
in interface ILcdGXYLayer
aObject
- not taken into account.public ILcdGXYPen getGXYPen()
getGXYPen
in interface ILcdGXYLayer
setGXYPen(com.luciad.view.gxy.ILcdGXYPen)
public void setGXYPen(ILcdGXYPen aPen)
aPen
- the pen to use to render the grid lines.getGXYPen()
public ILcdIcon getIcon()
getIcon
in interface ILcdLayer
setIcon(com.luciad.gui.ILcdIcon)
public Class getModelXYWorldTransfoClass()
TLcdDefaultModelXYWorldTransformation
, which covers all built-in
transformations.getModelXYWorldTransfoClass
in interface ILcdGXYLayer
public boolean isLabeledSupported()
isLabeledSupported
in interface ILcdGXYLayer
public boolean isLabeled()
isLabeled
in interface ILcdGXYLayer
ILcdGXYLayer.isLabeledSupported()
public void setMultilevelGridCoordinateFormat(ALcdMultilevelGridCoordinateFormat aMultilevelGridCoordinateFormat)
aMultilevelGridCoordinateFormat
- a format to use to convert grid elements to human readable coordinates.getMultilevelGridCoordinateFormat()
public ALcdMultilevelGridCoordinateFormat getMultilevelGridCoordinateFormat()
setMultilevelGridCoordinateFormat(ALcdMultilevelGridCoordinateFormat)
public void setLabeled(boolean aLabeled)
paintLabels(int, java.awt.Graphics, com.luciad.view.gxy.ILcdGXYContext)
and
paintLabel(ILcdMultilevelGridCoordinate, com.luciad.view.gxy.ILcdGXYContext, java.awt.Graphics)
determine which labels are rendered.setLabeled
in interface ILcdGXYLayer
aLabeled
- false to turn of grid labeling completely.public void setIcon(ILcdIcon aIcon)
public ILcdModel getModel()
public String getLabel()
getLabel
in interface ILcdLayer
setLabel(String)
public void setLabel(String aLabel)
setLabel
in interface ILcdLayer
aLabel
- a human readable textual representation of the layer.getLabel()
public boolean isVisible()
isVisible
in interface ILcdLayer
setVisible(boolean)
public void setVisible(boolean aVisible)
isPaintLevel(int, com.luciad.view.gxy.ILcdGXYContext)
defines which levels of the grid will be painted.setVisible
in interface ILcdLayer
aVisible
- false not to render this layer at all.isVisible()
public boolean isSelectableSupported()
isSelectableSupported
in interface ILcdLayer
ILcdLayer.setSelectable(boolean)
,
ILcdLayer.selectObject(java.lang.Object, boolean, int)
public boolean isSelectable()
isSelectable
in interface ILcdLayer
ILcdSelection
,
ILcdLayer.setSelectable(boolean)
public void setSelectable(boolean aSelectable)
setSelectable
in interface ILcdLayer
aSelectable
- not taken into account.ILcdLayer.isSelectable()
,
ILcdLayer.isSelectableSupported()
public boolean isEditableSupported()
isEditableSupported
in interface ILcdLayer
ILcdLayer.setEditable(boolean)
public boolean isEditable()
isEditable
in interface ILcdLayer
ILcdLayer.setEditable(boolean)
public void setEditable(boolean aEditable)
setEditable
in interface ILcdLayer
aEditable
- not taken into account.ILcdLayer.isEditableSupported()
,
ILcdLayer.isEditable()
public void selectObject(Object aObject, boolean aSelected, int aFireEventMode)
selectObject
in interface ILcdLayer
aObject
- not taken into account.aSelected
- not taken into account.aFireEventMode
- not taken into account.ILcdFireEventMode
public void fireCollectedSelectionChanges()
fireCollectedSelectionChanges
in interface ILcdLayer
public void clearSelection(int aFireEventMode)
clearSelection
in interface ILcdLayer
aFireEventMode
- is not taken into account.ILcdFireEventMode
public void addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
addPropertyChangeListener
in interface ILcdPropertyChangeSource
aPropertyChangeListener
- the listener to be notified of all property changes of this layer.removePropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
removePropertyChangeListener
in interface ILcdPropertyChangeSource
aPropertyChangeListener
- the listener that no longer needs to be notified of property changes of this class.addPropertyChangeListener(java.beans.PropertyChangeListener)
public int getSelectionCount()
getSelectionCount
in interface ILcdSelection<Object>
public Enumeration selectedObjects()
selectedObjects
in interface ILcdSelection<Object>
public boolean isSelected(Object aObject)
isSelected
in interface ILcdSelection<Object>
aObject
- not taken into account.public void addSelectionListener(ILcdSelectionListener aSelectionListener)
addSelectionListener
in interface ILcdSelection<Object>
aSelectionListener
- not taken into account.removeSelectionListener(com.luciad.util.ILcdSelectionListener)
public void removeSelectionListener(ILcdSelectionListener aSelectionListener)
removeSelectionListener
in interface ILcdSelection<Object>
aSelectionListener
- not taken into account.addSelectionListener(com.luciad.util.ILcdSelectionListener)
protected double[] getLevelSwitchScales()
setLevelSwitchScales(double[])
public ILcdMultilevelGrid getMultilevelGrid()
ILcdMultilevelGrid
on which this layer is based.ILcdMultilevelGrid
on which this layer is based.public void setLevelSwitchScales(double[] aLevelSwitchScales)
aLevelSwitchScales
- an ascending array of view scales. The length of the array should be one more than the
number of levels in the multilevel grid.isPaintLevel(int, com.luciad.view.gxy.ILcdGXYContext)
,
getLevelSwitchScales()