Package com.luciad.view.map
Class TLcdUTMGridLayer
java.lang.Object
com.luciad.view.map.TLcdUTMGridLayer
- All Implemented Interfaces:
ILcdPropertyChangeSource
,ILcdSelection<Object>
,ILcdGXYLayer
,ILcdNotLabelDeconflictableLayer
,ILcdLayer
,Serializable
public class TLcdUTMGridLayer
extends Object
implements ILcdGXYLayer, ILcdNotLabelDeconflictableLayer
TLcdUTMGridLayer
is an ILcdGXYLayer
that can be
added in an ILcdGXYView
to display a UTM MGRS grid.
This grid consists of 60 UTM-MGRS zones.
To paint the different UTM-MGRS zones a dedicated ILcdGXYPainter
,
TLcdUTMZonePainter
, is used.
It is recommended to use TLcdMGRSGridLayer
instead: it combines
a UPS and UTM grid with better performance and more fine-grained customization options.
- See Also:
-
Field Summary
-
Constructor Summary
ConstructorDescriptionConstructs a layer depicting a WGS-84 UTM grid, with "UTMGrid" as label.TLcdUTMGridLayer
(String aLabel) Constructs a layer depicting a WGS-84 UTM grid, with the given label.TLcdUTMGridLayer
(String aLabel, ILcdGeodeticDatum aGeodeticDatum) Constructs a layer depicting a UTM grid based on the given geodetic datum, with the given label. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addPropertyChangeListener
(PropertyChangeListener aPropertyChangeListener) Notify the listener passed of any changes to properties of this instance.void
addSelectionListener
(ILcdSelectionListener aSelectionListener) This layer does not support selection.int
applyOnInteract
(ILcdFunction aFunction, Rectangle aBounds, boolean aStrictInteract, ILcdGXYView aGXYView) No interaction is possible with this type of layer.void
clearSelection
(int aDispatchEventMode) This layer does not support selection.void
This layer does not support selection.void
firePropertyChangeEvent
(PropertyChangeEvent aPropertyChangeEvent) Notifies all property change listeners of a change to a property of this instance.getBounds
(int aMode, ILcdGXYView aGXYView) This method returns the view bounds of thisTLcdUTMGridLayer
, taking into account the XYWorldReference of the givenILcdGXYView
aGXYView.getGXYEditor
(Object aObject) This layer does not support editing.getGXYLabelPainter
(Object aObject) Labeling is handled in the UTM zone painter used to paint the zones.getGXYPainter
(Object aObject) Painting of this layer is handled by the UTM zone painter set.Returns the pen used to render the grid lines.getIcon()
Returns the icon to represent this layer.getLabel()
Returns the textual representation of this layer.The label scale range is the same as the scale range.getModel()
The model of this layer does not contain any elements.Returns the transformation class that to use to transform points and bounds from model space to world space and back.Returns the toolkit scale range for which to display elements of the model.int
This layer does not support selection.Returns the painter used to render a zone of a UTM grid.boolean
Deprecated.This method is used nowhere in this class and may be removed in the future.boolean
This layer does not support editing.boolean
This layer does not support editing.boolean
Returns whether the grids labels will be painted when the grid is painted.boolean
This layer supports labels.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
Deprecated.This method has been deprecated.boolean
Whether or not this layer should be rendered.void
paint
(Graphics aGraphics, int aMode, ILcdGXYView aGXYView) The paint will rely on the UTMZonePainter to paint each of the UTM-MGRS zones, held by thisTLcdUTMGridLayer
.painterMode
(int aPainterMode) Deprecated.this is a debug method that will be removed in the future.void
removePropertyChangeListener
(PropertyChangeListener aPropertyChangeListener) No longer notify the listener passed of any changes to properties of this instance.void
removeSelectionListener
(ILcdSelectionListener aSelectionListener) This layer does not support selection.This layer does not support selection.void
selectObject
(Object aObject, boolean aSelection, int aDispatchEventMode) This layer does not support selection.static void
setClassTraceOn
(boolean aClassTraceOn) Deprecated.This method has been deprecated.void
setEditable
(boolean aEditable) This layer does not support editing.void
Sets the icon to represent this layer.void
Sets the textual representation of this layer.void
setLabeled
(boolean aLabeled) Sets whether labels should be painted for the grid or not.void
setScaleRange
(ILcdInterval aScaleRange) Sets the range of scales outside of which nothing of this layer should be rendered.void
setSelectable
(boolean aSelectable) This layer does not support selection.void
setTraceOn
(boolean aTraceOn) Deprecated.This method has been deprecated.void
setUTMZonePainter
(TLcdUTMZonePainter aUTMZonePainter) Sets the painter that will be used to render a zone of a UTM grid.void
setVisible
(boolean aVisible) Sets whether or not the layer's content is painted.void
Inform the layer that it should terminate the current paint operation.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
-
TLcdUTMGridLayer
public TLcdUTMGridLayer()Constructs a layer depicting a WGS-84 UTM grid, with "UTMGrid" as label. -
TLcdUTMGridLayer
Constructs a layer depicting a WGS-84 UTM grid, with the given label.- Parameters:
aLabel
- the textual representation of this layer.
-
TLcdUTMGridLayer
Constructs a layer depicting a UTM grid based on the given geodetic datum, with the given label.- Parameters:
aLabel
- the textual representation of this layer.aGeodeticDatum
- the datum on which the UTM grid is located.
-
-
Method Details
-
setClassTraceOn
public static void setClassTraceOn(boolean aClassTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for all instances of this class. If the argument istrue
then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.- Parameters:
aClassTraceOn
- if true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
-
setTraceOn
public void setTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for this class instance. Calling this method with eithertrue
orfalse
as argument automatically turns off tracing for all other class instances for whichsetTraceOn
has not been called. If the argument isfalse
then only the informative, warning and error log messages are recorded.- Parameters:
aTraceOn
- if true then all log messages are recorded for this instance. If false, then only the informative, warning and error log messages are recorded.
-
isTraceOn
public boolean isTraceOn()Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Returnstrue
if tracing is enabled for this class.- Returns:
- true if tracing is enabled for this class, false otherwise.
-
getGXYPainter
Painting of this layer is handled by the UTM zone painter set. This method will always return null.- Specified by:
getGXYPainter
in interfaceILcdGXYLayer
- Parameters:
aObject
- the object to find a painter for.- Returns:
- always null.
- See Also:
-
getGXYLabelPainter
Labeling is handled in the UTM zone painter used to paint the zones. This implementation always returns null.- Specified by:
getGXYLabelPainter
in interfaceILcdGXYLayer
- Parameters:
aObject
- the object to find a label painter for.- Returns:
- Always null.
-
getGXYEditor
This layer does not support editing. No editors will be returned.- Specified by:
getGXYEditor
in interfaceILcdGXYLayer
- Parameters:
aObject
- the object to find an editor for.- Returns:
- Always returns null.
-
applyOnInteract
public int applyOnInteract(ILcdFunction aFunction, Rectangle aBounds, boolean aStrictInteract, ILcdGXYView aGXYView) No interaction is possible with this type of layer.- Specified by:
applyOnInteract
in interfaceILcdGXYLayer
- Parameters:
aFunction
- the function to apply. When the function returns false, no more objects should be passed to the function.aBounds
- all objects who lie partially or completely in this area in the view are candidates to be passed to the function.aStrictInteract
- iftrue
, theILcdFunction
shall be applied only to the objects interacting with the given bounds. When false is passed, other objects may be taken into account too. When applying the function to an object consumes less time than checking whether an objects representation interacts with the bounds, non-strict interaction is generally faster.aGXYView
- the view in whose bounds the objects representations should be in order to be passed to the function.- Returns:
- Always returns 0.
-
getIcon
Returns the icon to represent this layer. By default the icon is null. -
setIcon
Sets the icon to represent this layer. -
getGXYPen
Returns the pen used to render the grid lines.- Specified by:
getGXYPen
in interfaceILcdGXYLayer
- Returns:
- the pen to use when performing basic painting operations for objects in this layers model.
-
hasUserPen
public boolean hasUserPen()Deprecated.This method is used nowhere in this class and may be removed in the future.- Returns:
false
-
setUTMZonePainter
Sets the painter that will be used to render a zone of a UTM grid.- Parameters:
aUTMZonePainter
- the painter to use to render one zone of a UTM grid. The painter contains defines, amongst others, the color of the grid.- See Also:
-
getUTMZonePainter
Returns the painter used to render a zone of a UTM grid.- Returns:
- the UTMZonePainter of type
TLcdUTMZonePainter
.
-
setScaleRange
Sets the range of scales outside of which nothing of this layer should be rendered. Note that if the layers visibility is set to false, this value will not even be taken into account as the layer will not be rendered at all.- Parameters:
aScaleRange
- the range of scales outside of which nothing of this layer should be rendered.- See Also:
-
getScaleRange
Description copied from interface:ILcdGXYLayer
Returns the toolkit scale range for which to display elements of the model. In other words, the paint method will not render any objects in a view when:
view.getScale()
<getScaleRange().getMin()
orview.getScale()
>=getScaleRange().getMax()
. This does not imply that all objects in the model should be painted when the scale is inside this range as other restrictions may apply. For example, a layer may have a filter which defines which objects should be painted. For most use cases, we recommended using theunitless map scale range
instead. This property is mutually exclusive with the map scale range: only one of them has a non-null
value.- Specified by:
getScaleRange
in interfaceILcdGXYLayer
- Returns:
- an
ILcdInterval
containing the minimum and maximum value of view scales for which objects should be rendered, excluding the maximum.null
if the scale constraints are determined byILcdGXYLayer.getMapScaleRange()
. The scales are expressed in toolkit pixels/world unit. - See Also:
-
getLabelScaleRange
The label scale range is the same as the scale range.- Specified by:
getLabelScaleRange
in interfaceILcdGXYLayer
- Returns:
- an
ILcdInterval
containing the minimum and maximum value of view scales for which labels should be rendered, excluding the maximum.null
if the scale constraints are determined byILcdGXYLayer.getLabelMapScaleRange()
The scales are expressed in toolkit pixels/world unit. - See Also:
-
getBounds
This method returns the view bounds of thisTLcdUTMGridLayer
, taking into account the XYWorldReference of the givenILcdGXYView
aGXYView.- Specified by:
getBounds
in interfaceILcdGXYLayer
- Parameters:
aMode
- a bitwise combination of ALL or SELECTION and one or more of BODIES and HANDLES. TheILcdGXYLayer.LABELS
mode is not supported.aGXYView
- the view in which the layer could be placed. This enables taking into account the views settings, for example the scale.- Returns:
- a bounds (in view coordinates, pixels) that encompasses the representation of all objects that are rendered in a view.
-
paint
The paint will rely on the UTMZonePainter to paint each of the UTM-MGRS zones, held by thisTLcdUTMGridLayer
.- Specified by:
paint
in interfaceILcdGXYLayer
- Parameters:
aGraphics
- the Graphics to paint on.aMode
- indicates what should be painted and how it should be painted.aGXYView
- the view to paint for.- See Also:
-
painterMode
Deprecated.this is a debug method that will be removed in the future. Do not use this method.Debug method that returns a textual representation of a painter mode. This method should not be used, as it will be removed in the future.- Parameters:
aPainterMode
- a mode passed to the paint method.- Returns:
- a textual representation of a painter mode.
-
stopPainting
public void stopPainting()Description copied from interface:ILcdGXYLayer
Inform the layer that it should terminate the current paint operation. This method can be useful when the paint method is executed in a specificThread
and needs to be stopped in a safe state from another Thread.- Specified by:
stopPainting
in interfaceILcdGXYLayer
- See Also:
-
addPropertyChangeListener
Notify the listener passed of any changes to properties of this instance.- Specified by:
addPropertyChangeListener
in interfaceILcdPropertyChangeSource
- Parameters:
aPropertyChangeListener
- the listener to notify of any changes to properties of this UTM grid layer.- See Also:
-
removePropertyChangeListener
No longer notify the listener passed of any changes to properties of this instance.- Specified by:
removePropertyChangeListener
in interfaceILcdPropertyChangeSource
- Parameters:
aPropertyChangeListener
- the listener that should no longer be notified of any changes to properties of this UTM grid layer.- See Also:
-
firePropertyChangeEvent
Notifies all property change listeners of a change to a property of this instance.- Parameters:
aPropertyChangeEvent
- contains information on the change of the property- See Also:
-
getModel
The model of this layer does not contain any elements. The model reference associated with this model should not be used. -
setVisible
public void setVisible(boolean aVisible) Description copied from interface:ILcdLayer
Sets whether or not the layer's content is painted.- Specified by:
setVisible
in interfaceILcdLayer
- Parameters:
aVisible
-true
if the layer should be visible,false
otherwise.- See Also:
-
isVisible
public boolean isVisible()Whether or not this layer should be rendered. Default value is true. -
isEditableSupported
public boolean isEditableSupported()This layer does not support editing. This method always returns false.- Specified by:
isEditableSupported
in interfaceILcdLayer
- Returns:
- Always false.
- See Also:
-
isEditable
public boolean isEditable()This layer does not support editing. This method always returns false.- Specified by:
isEditable
in interfaceILcdLayer
- Returns:
- Always false.
- See Also:
-
setEditable
public void setEditable(boolean aEditable) This layer does not support editing. This method has an empty implementation.- Specified by:
setEditable
in interfaceILcdLayer
- Parameters:
aEditable
- true if the layer content can be edited- See Also:
-
isSelectableSupported
public boolean isSelectableSupported()This layer does not support selection. This method always returns false.- Specified by:
isSelectableSupported
in interfaceILcdLayer
- Returns:
- Always false.
- See Also:
-
isSelectable
public boolean isSelectable()This layer does not support selection. This method always returns false.- Specified by:
isSelectable
in interfaceILcdLayer
- Returns:
- Always false.
- See Also:
-
setSelectable
public void setSelectable(boolean aSelectable) This layer does not support selection. This method has an empty implementation.- Specified by:
setSelectable
in interfaceILcdLayer
- Parameters:
aSelectable
-true
if the layer allows selection,false
otherwise.- See Also:
-
isLabeledSupported
public boolean isLabeledSupported()This layer supports labels.- Specified by:
isLabeledSupported
in interfaceILcdGXYLayer
- Returns:
- Always true.
-
isLabeled
public boolean isLabeled()Returns whether the grids labels will be painted when the grid is painted. This implementation retrieves the value from the UTM zone painter set.- Specified by:
isLabeled
in interfaceILcdGXYLayer
- Returns:
- whether objects should be represented as text.
- See Also:
-
setLabeled
public void setLabeled(boolean aLabeled) Sets whether labels should be painted for the grid or not. The value is delegated to the UTM zone painter set.- Specified by:
setLabeled
in interfaceILcdGXYLayer
- Parameters:
aLabeled
- true to have a textual representation of the objects in the model, false to have no such representation.- See Also:
-
getLabel
Returns the textual representation of this layer. -
setLabel
Sets the textual representation of this layer. -
getSelectionCount
public int getSelectionCount()This layer does not support selection. This method always returns 0.- Specified by:
getSelectionCount
in interfaceILcdSelection<Object>
- Returns:
- Always 0.
-
selectedObjects
This layer does not support selection. This method always returns an empty enumeration.- Specified by:
selectedObjects
in interfaceILcdSelection<Object>
- Returns:
TLcdEmptyEnumeration.getInstance
().
-
isSelected
This layer does not support selection. This method always returns false.- Specified by:
isSelected
in interfaceILcdSelection<Object>
- Parameters:
aObject
- theObject
to be checked.- Returns:
false
.
-
selectObject
This layer does not support selection. This method has an empty implementation.- Specified by:
selectObject
in interfaceILcdLayer
- Parameters:
aObject
- theObject
to select or deselect. The object should be in the model of this layer. The implementation of this method is not responsible for checking this.aSelection
- the selection state,true
to select,false
to deselect.aDispatchEventMode
- shall be one amongILcdFireEventMode.FIRE_NOW
,ILcdFireEventMode.FIRE_LATER
,ILcdFireEventMode.NO_EVENT
- See Also:
-
fireCollectedSelectionChanges
public void fireCollectedSelectionChanges()This layer does not support selection. This method has an empty implementation.- Specified by:
fireCollectedSelectionChanges
in interfaceILcdLayer
-
clearSelection
public void clearSelection(int aDispatchEventMode) This layer does not support selection. This method has an empty implementation.- Specified by:
clearSelection
in interfaceILcdLayer
- Parameters:
aDispatchEventMode
- shall be one amongILcdFireEventMode.FIRE_NOW
,ILcdFireEventMode.FIRE_LATER
,ILcdFireEventMode.NO_EVENT
- See Also:
-
addSelectionListener
This layer does not support selection. This method has an empty implementation.- Specified by:
addSelectionListener
in interfaceILcdSelection<Object>
- Parameters:
aSelectionListener
- theILcdSelectionListener
to be added.
-
removeSelectionListener
This layer does not support selection. This method has an empty implementation.- Specified by:
removeSelectionListener
in interfaceILcdSelection<Object>
- Parameters:
aSelectionListener
- theILcdSelectionListener
to be removed.
-
getModelXYWorldTransfoClass
Description copied from interface:ILcdGXYLayer
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.- 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.
-