Class TLcdMultilevelGridLayer
java.lang.Object
com.luciad.view.map.multilevelgrid.TLcdMultilevelGridLayer
- All Implemented Interfaces:
ILcdPropertyChangeSource
,ILcdSelection<Object>
,ILcdGXYLayer
,ILcdLayer
,Serializable
An
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()
.- Since:
- 7.0
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionTLcdMultilevelGridLayer
(ILcdMultilevelGrid aMultilevelGrid, ILcdModelReference aModelReference) Constructs aTLcdMultilevelGridLayer
that will render a multilevel grid in anILcdGXYView
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
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
This layer does not support selection.getBounds
(int aLayerPaintMode, ILcdGXYView aGXYView) Returns the view bounds of the multilevel grid in the given context.getGXYEditor
(Object aObject) Always returns null.getGXYLabelPainter
(Object aObject) Always returns null.getGXYPainter
(Object aObject) Always returns null.Returns the pen used to render the grid lines.getIcon()
Returns a graphical representation of this layer, which can be used in a GUI.getLabel()
Gets a textual representation of this layer.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[]
Returns an array indicating at which view scales the rendering of the grid switches levels.getModel()
Returns an empty vector model.Returns the transformation class that to use to transform points and bounds from model space to world space and back.Returns theILcdMultilevelGrid
on which this layer is based.Returns the format for labeling the grid element of this grid.This layer does not have a scale range.int
This layer does not support selection.boolean
This layer does not support editing.boolean
This layer does not support editing.boolean
Returns whether labels should be rendered for this grid.boolean
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
This layer does not support selection.boolean
This layer does not support selection.boolean
isSelected
(Object aObject) This layer does not support selection.boolean
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 whichisPaintLevel(int, com.luciad.view.gxy.ILcdGXYContext)
and/orisLabelLevel(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.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
Sets a graphical representation of this layer, which can be used in a GUI.void
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
Empty implementation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.luciad.view.gxy.ILcdGXYLayer
getLabelMapScaleRange, getMapScaleRange
Methods inherited from interface com.luciad.util.ILcdSelection
getSelectedObjects
-
Constructor Details
-
TLcdMultilevelGridLayer
public TLcdMultilevelGridLayer(ILcdMultilevelGrid aMultilevelGrid, ILcdModelReference aModelReference) Constructs aTLcdMultilevelGridLayer
that will render a multilevel grid in anILcdGXYView
.- Parameters:
aMultilevelGrid
- the grid to display.aModelReference
- the model reference with regard to which the grid is defined.
-
-
Method Details
-
paint
Renders the grid lines and labels on the Graphics passed at levels for whichisPaintLevel(int, com.luciad.view.gxy.ILcdGXYContext)
and/orisLabelLevel(int, com.luciad.view.gxy.ILcdGXYContext)
are true.- Specified by:
paint
in interfaceILcdGXYLayer
- Parameters:
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.- See Also:
-
isPaintOutline
Whether the outline of the grid should be painted. This implementation renders the outline when the scale of the view the grid is rendered in is smaller than the smallest scale ingetLevelSwitchScales()
.- Parameters:
aGXYContext
- the context in which the grid is being rendered.- Returns:
- true if the scale of the view is smaller than the smallest scale in
getLevelSwitchScales()
.
-
paintOutline
Renders the outline of the grid on the Graphics passed. This method is called frompaint(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYView)
whenisPaintOutline(com.luciad.view.gxy.ILcdGXYContext)
returns true.- Parameters:
aGraphics
- the Graphics to render the grid outline on.aGXYContext
- the context in which to paint the outline.
-
setOutlineStyle
Sets the style to use when rendering the outline of the multilevel grid.- Parameters:
aOutlineStyle
- the style to use when rendering the outline of the multilevel grid.
-
paintLabels
Called from paint to paint all labels. This implementation callspaintLabel(ILcdMultilevelGridCoordinate, com.luciad.view.gxy.ILcdGXYContext, java.awt.Graphics)
for all grid elements of the levels that are visible in the view.- Parameters:
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.- See Also:
-
paintLabel
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. This method is called frompaintLabels(int, java.awt.Graphics, com.luciad.view.gxy.ILcdGXYContext)
for all objects which are visible in a view in the given context.- Parameters:
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.- See Also:
-
isPaintLevel
Indicates whether the given level should be rendered. This implementation returns true when the views scale is above the value ofgetLevelSwitchScales()
with index level.- Parameters:
aLevel
- the level to check.aGXYContext
- the context in which the grid level will be rendered.- Returns:
- true if the views scale is bigger than the level index of the level switch scales.
-
isLabelLevel
Indicates whether the labels should be rendered for the given level of the grid. This implementation returns true when the views scale is between the values ofgetLevelSwitchScales()
with index level and level +1.- Parameters:
aLevel
- the level to check.aGXYContext
- the context in which the grid levels labels will be rendered.- Returns:
- true if the views scale is bigger than the level index of the level switch scales and smaller than that of the next level.
-
getLevelStyle
The style with which the grid line at a given level will be rendered.- Parameters:
aLevel
- the level to return the style for.- Returns:
- the style to be applied when rendering the grid at the given level.
- See Also:
-
setLevelStyle
Sets the style with which the grid line at a given level should be rendered.- Parameters:
aLevel
- the level at which the style should be applied.aLevelStyle
- the style to apply when rendering the grid level.- See Also:
-
paintLevel
Renders a level of the grid on the Graphics passed in the given context. This method is called frompaint(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYView)
for levels for whichisPaintLevel(int, com.luciad.view.gxy.ILcdGXYContext)
returns true.- Parameters:
aLevel
- the level to render.aGraphics
- the Graphics to render on.aGXYContext
- the context in which to render.
-
applyOnInteract
public int applyOnInteract(ILcdFunction aFunction, Rectangle aRectangle, boolean aStrictInteract, ILcdGXYView aGXYView) This layer does not allow interaction.- Specified by:
applyOnInteract
in interfaceILcdGXYLayer
- Parameters:
aFunction
- not taken into account.aRectangle
- not taken into account.aStrictInteract
- not taken into account.aGXYView
- not taken into account.- Returns:
- always 0.
-
getBounds
Returns the view bounds of the multilevel grid in the given context.- Specified by:
getBounds
in interfaceILcdGXYLayer
- Parameters:
aLayerPaintMode
- not taken into account.aGXYView
- the view in which this layer is painted.- Returns:
- the view bounds of the grid in the given view.
- Throws:
TLcdNoBoundsException
- when the grid is not visible in the view passed.
-
stopPainting
public void stopPainting()Empty implementation. Painting of this layer cannot be stopped once it has started.- Specified by:
stopPainting
in interfaceILcdGXYLayer
- See Also:
-
getScaleRange
This layer does not have a scale range. Whether or not a grid level is painted is governed byisPaintLevel(int, com.luciad.view.gxy.ILcdGXYContext)
.- Specified by:
getScaleRange
in interfaceILcdGXYLayer
- Returns:
- always null.
- See Also:
-
getLabelScaleRange
This layer does not have a label scale range. Whether or not labels are painted is governed bypaintLabels(int, java.awt.Graphics, com.luciad.view.gxy.ILcdGXYContext)
, andpaintLabel(ILcdMultilevelGridCoordinate, com.luciad.view.gxy.ILcdGXYContext, java.awt.Graphics)
.- Specified by:
getLabelScaleRange
in interfaceILcdGXYLayer
- Returns:
- always null.
- See Also:
-
getGXYPainter
Always returns null. This layer does not contain objects in a model that should be rendered.- Specified by:
getGXYPainter
in interfaceILcdGXYLayer
- Parameters:
aObject
- not taken into account.- Returns:
- always null.
-
getGXYEditor
Always returns null. This layer does not contain objects in a model that should be edited.- Specified by:
getGXYEditor
in interfaceILcdGXYLayer
- Parameters:
aObject
- not taken into account.- Returns:
- always null.
-
getGXYLabelPainter
Always returns null. Label painting is handled in the methodspaintLabels(int, java.awt.Graphics, com.luciad.view.gxy.ILcdGXYContext)
andpaintLabel(ILcdMultilevelGridCoordinate, com.luciad.view.gxy.ILcdGXYContext, java.awt.Graphics)
.- Specified by:
getGXYLabelPainter
in interfaceILcdGXYLayer
- Parameters:
aObject
- not taken into account.- Returns:
- always null.
-
getGXYPen
Returns the pen used to render the grid lines.- Specified by:
getGXYPen
in interfaceILcdGXYLayer
- Returns:
- the pen used to render the grid lines.
- See Also:
-
setGXYPen
Sets the pen to use to render the grid lines.- Parameters:
aPen
- the pen to use to render the grid lines.- See Also:
-
getIcon
Returns a graphical representation of this layer, which can be used in a GUI. -
getModelXYWorldTransfoClass
Returns the transformation class that to use to transform points and bounds from model space to world space and back. This class has to be conform with the reference of the model of this layer and the reference of the view this layer is part of. This method returnsTLcdDefaultModelXYWorldTransformation
, which covers all built-in transformations.- Specified by:
getModelXYWorldTransfoClass
in interfaceILcdGXYLayer
- Returns:
- the transformation class that to use to transform points and bounds from model space to world space and back.
-
isLabeledSupported
public boolean isLabeledSupported()Always true.- Specified by:
isLabeledSupported
in interfaceILcdGXYLayer
- Returns:
- always true.
-
isLabeled
public boolean isLabeled()Returns whether labels should be rendered for this grid.- Specified by:
isLabeled
in interfaceILcdGXYLayer
- Returns:
- false if no labels should be rendered for this grid, true otherwise.
- See Also:
-
setMultilevelGridCoordinateFormat
public void setMultilevelGridCoordinateFormat(ALcdMultilevelGridCoordinateFormat aMultilevelGridCoordinateFormat) Sets the format for labeling the grid element of this grid.- Parameters:
aMultilevelGridCoordinateFormat
- a format to use to convert grid elements to human readable coordinates.- See Also:
-
getMultilevelGridCoordinateFormat
Returns the format for labeling the grid element of this grid.- Returns:
- the format used to convert grid elements to human readable coordinates.
- See Also:
-
setLabeled
public void setLabeled(boolean aLabeled) If false no labels are rendered for the grid. If set to true, the methodspaintLabels(int, java.awt.Graphics, com.luciad.view.gxy.ILcdGXYContext)
andpaintLabel(ILcdMultilevelGridCoordinate, com.luciad.view.gxy.ILcdGXYContext, java.awt.Graphics)
determine which labels are rendered.- Specified by:
setLabeled
in interfaceILcdGXYLayer
- Parameters:
aLabeled
- false to turn of grid labeling completely.
-
setIcon
Sets a graphical representation of this layer, which can be used in a GUI. -
getModel
Returns an empty vector model. Only the models reference should be taken into account. -
getLabel
Gets a textual representation of this layer. -
setLabel
Sets a human readable textual representation of the layer. -
isVisible
public boolean isVisible()Returns whether any part of this layer should be rendered. -
setVisible
public void setVisible(boolean aVisible) Sets whether this layer should be rendered or not. If the value is set to true, the methodisPaintLevel(int, com.luciad.view.gxy.ILcdGXYContext)
defines which levels of the grid will be painted.- Specified by:
setVisible
in interfaceILcdLayer
- Parameters:
aVisible
- false not to render this layer at all.- See Also:
-
isSelectableSupported
public boolean isSelectableSupported()This layer does not support selection.- Specified by:
isSelectableSupported
in interfaceILcdLayer
- Returns:
- always false.
- See Also:
-
isSelectable
public boolean isSelectable()This layer does not support selection.- Specified by:
isSelectable
in interfaceILcdLayer
- Returns:
- always false.
- See Also:
-
setSelectable
public void setSelectable(boolean aSelectable) This layer does not support selection.- Specified by:
setSelectable
in interfaceILcdLayer
- Parameters:
aSelectable
- not taken into account.- See Also:
-
isEditableSupported
public boolean isEditableSupported()This layer does not support editing.- Specified by:
isEditableSupported
in interfaceILcdLayer
- Returns:
- always false.
- See Also:
-
isEditable
public boolean isEditable()This layer does not support editing.- Specified by:
isEditable
in interfaceILcdLayer
- Returns:
- always false.
- See Also:
-
setEditable
public void setEditable(boolean aEditable) This layer does not support editing.- Specified by:
setEditable
in interfaceILcdLayer
- Parameters:
aEditable
- not taken into account.- See Also:
-
selectObject
This layer does not support selection.- Specified by:
selectObject
in interfaceILcdLayer
- Parameters:
aObject
- not taken into account.aSelected
- not taken into account.aFireEventMode
- not taken into account.- See Also:
-
fireCollectedSelectionChanges
public void fireCollectedSelectionChanges()This layer does not support selection.- Specified by:
fireCollectedSelectionChanges
in interfaceILcdLayer
-
clearSelection
public void clearSelection(int aFireEventMode) This layer does not support selection.- Specified by:
clearSelection
in interfaceILcdLayer
- Parameters:
aFireEventMode
- is not taken into account.- See Also:
-
addPropertyChangeListener
Adds a listener that will be notified of all property changes of this layer.- Specified by:
addPropertyChangeListener
in interfaceILcdPropertyChangeSource
- Parameters:
aPropertyChangeListener
- the listener to be notified of all property changes of this layer.- See Also:
-
removePropertyChangeListener
Removes a listener from the list of property change listeners. The listener will no longer be notified of property changes of this object.- Specified by:
removePropertyChangeListener
in interfaceILcdPropertyChangeSource
- Parameters:
aPropertyChangeListener
- the listener that no longer needs to be notified of property changes of this class.- See Also:
-
getSelectionCount
public int getSelectionCount()This layer does not support selection.- Specified by:
getSelectionCount
in interfaceILcdSelection<Object>
- Returns:
- always 0.
-
selectedObjects
This layer does not support selection.- Specified by:
selectedObjects
in interfaceILcdSelection<Object>
- Returns:
- an enumeration containing 0 elements.
-
isSelected
This layer does not support selection.- Specified by:
isSelected
in interfaceILcdSelection<Object>
- Parameters:
aObject
- not taken into account.- Returns:
- always false.
-
addSelectionListener
This layer does not support selection.- Specified by:
addSelectionListener
in interfaceILcdSelection<Object>
- Parameters:
aSelectionListener
- not taken into account.- See Also:
-
removeSelectionListener
This layer does not support selection.- Specified by:
removeSelectionListener
in interfaceILcdSelection<Object>
- Parameters:
aSelectionListener
- not taken into account.- See Also:
-
getLevelSwitchScales
protected double[] getLevelSwitchScales()Returns an array indicating at which view scales the rendering of the grid switches levels.- Returns:
- an array indicating at which view scales the rendering of the grid switches levels.
- See Also:
-
getMultilevelGrid
Returns theILcdMultilevelGrid
on which this layer is based.- Returns:
- the
ILcdMultilevelGrid
on which this layer is based.
-
setLevelSwitchScales
public void setLevelSwitchScales(double[] aLevelSwitchScales) Sets the scales at which the rendering of the grid switches level.- Parameters:
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.- See Also:
-