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
ConstructorsConstructorDescriptionTLcdMultilevelGridLayer(ILcdMultilevelGrid aMultilevelGrid, ILcdModelReference aModelReference) Constructs aTLcdMultilevelGridLayerthat will render a multilevel grid in anILcdGXYView. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPropertyChangeListener(PropertyChangeListener aPropertyChangeListener) Adds a listener that will be notified of all property changes of this layer.voidaddSelectionListener(ILcdSelectionListener aSelectionListener) This layer does not support selection.intapplyOnInteract(ILcdFunction aFunction, Rectangle aRectangle, boolean aStrictInteract, ILcdGXYView aGXYView) This layer does not allow interaction.voidclearSelection(int aFireEventMode) This layer does not support selection.voidThis 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 ILcdGXYPainterStylegetLevelStyle(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 theILcdMultilevelGridon which this layer is based.Returns the format for labeling the grid element of this grid.This layer does not have a scale range.intThis layer does not support selection.booleanThis layer does not support editing.booleanThis layer does not support editing.booleanReturns whether labels should be rendered for this grid.booleanAlways true.booleanisLabelLevel(int aLevel, ILcdGXYContext aGXYContext) Indicates whether the labels should be rendered for the given level of the grid.booleanisPaintLevel(int aLevel, ILcdGXYContext aGXYContext) Indicates whether the given level should be rendered.booleanisPaintOutline(ILcdGXYContext aGXYContext) Whether the outline of the grid should be painted.booleanThis layer does not support selection.booleanThis layer does not support selection.booleanisSelected(Object aObject) This layer does not support selection.booleanReturns whether any part of this layer should be rendered.voidpaint(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 voidpaintLabel(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 voidpaintLabels(int aLevel, Graphics aGraphics, ILcdGXYContext aGXYContext) Called from paint to paint all labels.protected voidpaintLevel(int aLevel, Graphics aGraphics, ILcdGXYContext aGXYContext) Renders a level of the grid on the Graphics passed in the given context.protected voidpaintOutline(Graphics aGraphics, ILcdGXYContext aGXYContext) Renders the outline of the grid on the Graphics passed.voidremovePropertyChangeListener(PropertyChangeListener aPropertyChangeListener) Removes a listener from the list of property change listeners.voidremoveSelectionListener(ILcdSelectionListener aSelectionListener) This layer does not support selection.This layer does not support selection.voidselectObject(Object aObject, boolean aSelected, int aFireEventMode) This layer does not support selection.voidsetEditable(boolean aEditable) This layer does not support editing.voidsetGXYPen(ILcdGXYPen aPen) Sets the pen to use to render the grid lines.voidSets a graphical representation of this layer, which can be used in a GUI.voidSets a human readable textual representation of the layer.voidsetLabeled(boolean aLabeled) If false no labels are rendered for the grid.voidsetLevelStyle(int aLevel, ILcdGXYPainterStyle aLevelStyle) Sets the style with which the grid line at a given level should be rendered.voidsetLevelSwitchScales(double[] aLevelSwitchScales) Sets the scales at which the rendering of the grid switches level.voidsetMultilevelGridCoordinateFormat(ALcdMultilevelGridCoordinateFormat aMultilevelGridCoordinateFormat) Sets the format for labeling the grid element of this grid.voidsetOutlineStyle(ILcdGXYPainterStyle aOutlineStyle) Sets the style to use when rendering the outline of the multilevel grid.voidsetSelectable(boolean aSelectable) This layer does not support selection.voidsetVisible(boolean aVisible) Sets whether this layer should be rendered or not.voidEmpty implementation.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.luciad.view.gxy.ILcdGXYLayer
getLabelMapScaleRange, getMapScaleRangeMethods inherited from interface com.luciad.util.ILcdSelection
getSelectedObjects
-
Constructor Details
-
TLcdMultilevelGridLayer
public TLcdMultilevelGridLayer(ILcdMultilevelGrid aMultilevelGrid, ILcdModelReference aModelReference) Constructs aTLcdMultilevelGridLayerthat 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:
paintin 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:
applyOnInteractin 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:
getBoundsin 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:
stopPaintingin 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:
getScaleRangein 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:
getLabelScaleRangein 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:
getGXYPainterin 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:
getGXYEditorin 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:
getGXYLabelPainterin interfaceILcdGXYLayer- Parameters:
aObject- not taken into account.- Returns:
- always null.
-
getGXYPen
Returns the pen used to render the grid lines.- Specified by:
getGXYPenin 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:
getModelXYWorldTransfoClassin 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:
isLabeledSupportedin interfaceILcdGXYLayer- Returns:
- always true.
-
isLabeled
public boolean isLabeled()Returns whether labels should be rendered for this grid.- Specified by:
isLabeledin 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:
setLabeledin 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:
setVisiblein 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:
isSelectableSupportedin interfaceILcdLayer- Returns:
- always false.
- See Also:
-
isSelectable
public boolean isSelectable()This layer does not support selection.- Specified by:
isSelectablein interfaceILcdLayer- Returns:
- always false.
- See Also:
-
setSelectable
public void setSelectable(boolean aSelectable) This layer does not support selection.- Specified by:
setSelectablein interfaceILcdLayer- Parameters:
aSelectable- not taken into account.- See Also:
-
isEditableSupported
public boolean isEditableSupported()This layer does not support editing.- Specified by:
isEditableSupportedin interfaceILcdLayer- Returns:
- always false.
- See Also:
-
isEditable
public boolean isEditable()This layer does not support editing.- Specified by:
isEditablein interfaceILcdLayer- Returns:
- always false.
- See Also:
-
setEditable
public void setEditable(boolean aEditable) This layer does not support editing.- Specified by:
setEditablein interfaceILcdLayer- Parameters:
aEditable- not taken into account.- See Also:
-
selectObject
This layer does not support selection.- Specified by:
selectObjectin 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:
fireCollectedSelectionChangesin interfaceILcdLayer
-
clearSelection
public void clearSelection(int aFireEventMode) This layer does not support selection.- Specified by:
clearSelectionin 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:
addPropertyChangeListenerin 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:
removePropertyChangeListenerin 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:
getSelectionCountin interfaceILcdSelection<Object>- Returns:
- always 0.
-
selectedObjects
This layer does not support selection.- Specified by:
selectedObjectsin interfaceILcdSelection<Object>- Returns:
- an enumeration containing 0 elements.
-
isSelected
This layer does not support selection.- Specified by:
isSelectedin interfaceILcdSelection<Object>- Parameters:
aObject- not taken into account.- Returns:
- always false.
-
addSelectionListener
This layer does not support selection.- Specified by:
addSelectionListenerin interfaceILcdSelection<Object>- Parameters:
aSelectionListener- not taken into account.- See Also:
-
removeSelectionListener
This layer does not support selection.- Specified by:
removeSelectionListenerin 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 theILcdMultilevelGridon which this layer is based.- Returns:
- the
ILcdMultilevelGridon 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:
-