public class TLcdUPSGridLayer extends Object implements ILcdGXYLayer, ILcdNotLabelDeconflictableLayer
TLcdUPSGridLayer
is an ILcdGXYLayer
that can be
added in an ILcdGXYView
to display a Universal Polar Stereographic MGRS grid.
This grid consists of two polar zones.
It is recommended to use TLcdMGRSGridLayer
instead: it combines
a UPS and UTM grid with better performance and more fine-grained customization options.
Constructor and Description |
---|
TLcdUPSGridLayer() |
TLcdUPSGridLayer(String aLabel) |
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
Associate a
PropertyChangeListener to this ILcdLayer . |
void |
addSelectionListener(ILcdSelectionListener aSelectionListener)
This layer does not support selection.
|
int |
applyOnInteract(ILcdFunction aFunction,
Rectangle aBounds,
boolean aStrictInteract,
ILcdGXYView aGXYView)
Applies the function to (at the least) all objects that are contained (partially or completely) in the bounds of the view.
|
void |
clearSelection(int aDispatchEventMode)
This layer does not support selection.
|
void |
fireCollectedSelectionChanges()
This layer does not support selection.
|
ILcdBounds |
getBounds(int aMode,
ILcdGXYView aGXYView)
Always throws a TLcdNoBoundsException.
|
Color |
getColor()
Returns the outline color of the 100.000m squares
|
Color |
getColorScales()
Returns the
Color to paint the scales within the 100.000m squares. |
Color |
getGridZoneColor()
Returns the outline color of the grid zones
|
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 to use when performing basic painting operations for objects in this layers model.
|
ILcdIcon |
getIcon()
Returns null.
|
String |
getLabel()
A short textual representation of this
ILcdLayer . |
Color |
getLabelColor()
Returns the
Color for the labels. |
Font |
getLabelFont()
Gets the
Font for the labels. |
Color |
getLabelHaloColor()
Returns the color of the halo effect.
|
int |
getLabelHaloThickness()
Returns the thickness of the halo effect for the grid labels.
|
ILcdInterval |
getLabelScaleRange()
Always returns null.
|
ILcdModel |
getModel() |
Class |
getModelXYWorldTransfoClass()
Returns
TLcdGrid2Grid class. |
ILcdInterval |
getScaleRange()
Always returns null.
|
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 objects should be represented as text.
|
boolean |
isLabeledSupported()
Returns whether this layer supports representing objects as text.
|
boolean |
isLabelHaloEnabled()
Returns whether the painter will add a halo effect around the grid labels.
|
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 |
isTraceOn()
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
boolean |
isVisible()
Returns whether or not the layer's content is painted.
|
void |
paint(Graphics aGraphics,
int aMode,
ILcdGXYView aGXYView)
Paints the combined representation of the layer's objects for a view, taking into account the mode.
|
void |
removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
If the
PropertyChangeListener aPropertyChangeListener is associated to this
ILcdLayer , it will not be associated to this ILcdLayer after-wards. |
void |
removeSelectionListener(ILcdSelectionListener aSelectionListener)
This layer does not support selection.
|
Enumeration |
selectedObjects()
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. It is recommended to use the
standard Java logging framework directly.
|
void |
setColor(Color aColor)
Sets the outline color of the 100.000m squares.
|
void |
setColorScales(Color aColorScales)
Sets the
Color to be used by this painter to paint the scales within the 100.000m squares. |
void |
setEditable(boolean aEditable)
This layer does not support editing.
|
void |
setGridZoneColor(Color aColor)
Sets the outline color of the grid zones
|
void |
setIcon(ILcdIcon aIcon)
Empty implementation.
|
void |
setLabel(String aLabel)
Sets the textual representation of this
ILcdLayer . |
void |
setLabelColor(Color aLabelColor)
Sets the
Color for the labels. |
void |
setLabeled(boolean aLabeled)
Sets whether objects should be represented as text.
|
void |
setLabelFont(Font aLabelFont)
Sets the
Font for the labels. |
void |
setLabelHaloColor(Color aHaloColor)
Sets the color of the halo effect for the grid labels.
|
void |
setLabelHaloEnabled(boolean aHaloEnabled)
Determines whether the painter will add a halo effect around the grid labels.
|
void |
setLabelHaloThickness(int aHaloThickness)
Sets the thickness defined in pixels of the halo effect for the grid labels.
|
void |
setSelectable(boolean aSelectable)
This layer does not support selection.
|
void |
setTraceOn(boolean aTraceOn)
Deprecated.
This method has been deprecated. It is recommended to use the
standard Java logging framework directly.
|
void |
setVisible(boolean aVisible)
Sets whether or not the layer's content is painted.
|
void |
stopPainting()
Inform the layer that it should terminate the current paint operation.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getLabelMapScaleRange, getMapScaleRange
getSelectedObjects
public TLcdUPSGridLayer()
public TLcdUPSGridLayer(String aLabel)
public static void setClassTraceOn(boolean aClassTraceOn)
true
then all log messages are recorded, otherwise only
the informative, warning and error messages are recorded.aClassTraceOn
- if true then all log messages are recorded,
otherwise only the informative, warning and error messages are recorded.public void setTraceOn(boolean aTraceOn)
true
or false
as argument automatically turns
off tracing for all other class instances for which
setTraceOn
has not been called.
If the argument is false
then only the informative, warning
and error log messages are recorded.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.public boolean isTraceOn()
true
if tracing is enabled for this class.public void paint(Graphics aGraphics, int aMode, ILcdGXYView aGXYView)
ILcdGXYLayer
The mode indicates what objects of the model should be taken into account and what representation should be provided. The objects to be taken into account shall be one of:
Note that the combined representation may contain less than the representation of all objects that were taken into account, as some objects may be disregarded for various reasons (filters, scale, ... ). When the views scale is outside the scale range (BODIES or HANDLES mode) or the label scale range (LABELS mode) nothing shall be painted.
The representations provided shall be one or more of:
The mode supplied shall be a bitwise or combination of a constant of the first group and one or more of the
second group. When painting in BODIES or HANDLES mode, painting of an object shall be delegated to the
painter
for that object, when the LABELS mode is passed, painting shall be delegated
to the labelpainter
for that object.
The view is passed to provide contextual information: some of the objects may have a different representation depending on the view, or depending on a property of the view, for example, the scale of the view.
The combined representation of the objects has to be painted on the Graphics supplied, as these may be different from the Graphics provided by the view (due to double buffering, for example).
When stopPainting
is called, the current painting operation should be aborted.
paint
in interface ILcdGXYLayer
aGraphics
- the Graphics to paint on.aMode
- indicates what should be painted and how it should be painted.aGXYView
- the view to paint for.ILcdGXYLayer.getGXYPainter(Object)
,
ILcdGXYLayer.getGXYLabelPainter(Object)
,
ILcdGXYLayer.getScaleRange()
,
ILcdGXYLayer.getLabelScaleRange()
,
ILcdGXYLayer.stopPainting()
public Color getGridZoneColor()
public void setGridZoneColor(Color aColor)
aColor
- the outline color of the grid zonespublic Color getColor()
public void setColor(Color aColor)
aColor
- the outline color of the 100.000m squarespublic Color getColorScales()
Color
to paint the scales within the 100.000m squares.public void setColorScales(Color aColorScales)
Color
to be used by this painter to paint the scales within the 100.000m squares.public Color getLabelColor()
Color
for the labels.public void setLabelColor(Color aLabelColor)
Color
for the labels.public boolean isLabelHaloEnabled()
setLabelHaloEnabled(boolean)
public void setLabelHaloEnabled(boolean aHaloEnabled)
false
.aHaloEnabled
- a flag indicating whether to add a halo effect around the grid labels.isLabelHaloEnabled()
public int getLabelHaloThickness()
setLabelHaloThickness(int)
public void setLabelHaloThickness(int aHaloThickness)
1
.aHaloThickness
- the thickness defined in pixels of the halo effect for the grid labels.getLabelHaloThickness()
,
TLcdGXYHaloLabelPainter.setHaloThickness(int)
public Color getLabelHaloColor()
setLabelHaloColor(java.awt.Color)
public void setLabelHaloColor(Color aHaloColor)
Color.white
.aHaloColor
- the color of the halo effect for the grid labels.getLabelHaloColor()
,
TLcdGXYHaloLabelPainter.setHaloColor(java.awt.Color)
public Font getLabelFont()
Font
for the labels.public void setLabelFont(Font aLabelFont)
Font
for the labels.public int applyOnInteract(ILcdFunction aFunction, Rectangle aBounds, boolean aStrictInteract, ILcdGXYView aGXYView)
ILcdGXYLayer
The function shall be applied successively to all objects in the bounds as long as the function returns
true
for an object. This allows developers to indicate a stop condition. Note that the order in
which the objects are passed to the function is not specified.
When strict interaction is required, only objects whose representation lies within the given bounds, completely or partially, are candidates to be passed to the function. An object whose representation does not interact with the bounds should not be passed to the function. Applying non strict interaction can be useful to avoid heavy computations to determine whether an objects representation lies within the bounds.
This method behaves similar to the paint method, and as such is allowed to omit small or invisible objects for performance reasons.
applyOnInteract
in interface ILcdGXYLayer
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
- if true
, the ILcdFunction
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.public ILcdBounds getBounds(int aMode, ILcdGXYView aGXYView) throws TLcdNoBoundsException
getBounds
in interface ILcdGXYLayer
aMode
- the mode to calculate the bounds in.aGXYView
- the view to calculate the bounds in.TLcdNoBoundsException
- is always thrownpublic void stopPainting()
ILcdGXYLayer
Thread
and needs to be
stopped in a safe state from another Thread.stopPainting
in interface ILcdGXYLayer
paint
public ILcdInterval getScaleRange()
getScaleRange
in interface ILcdGXYLayer
ILcdGXYLayer.getMapScaleRange()
public ILcdInterval getLabelScaleRange()
getLabelScaleRange
in interface ILcdGXYLayer
ILcdGXYLayer.getLabelMapScaleRange()
public ILcdGXYPainter getGXYPainter(Object aObject)
getGXYPainter
in interface ILcdGXYLayer
aObject
- the object to retrieve a painter for.public ILcdGXYEditor getGXYEditor(Object aObject)
getGXYEditor
in interface ILcdGXYLayer
aObject
- the object to retrieve an editor for.public ILcdGXYLabelPainter getGXYLabelPainter(Object aObject)
getGXYLabelPainter
in interface ILcdGXYLayer
aObject
- not taken into account.public ILcdGXYPen getGXYPen()
ILcdGXYLayer
getGXYPen
in interface ILcdGXYLayer
public ILcdIcon getIcon()
public Class getModelXYWorldTransfoClass()
TLcdGrid2Grid
class.getModelXYWorldTransfoClass
in interface ILcdGXYLayer
public boolean isLabeledSupported()
ILcdGXYLayer
isLabeledSupported
in interface ILcdGXYLayer
public boolean isLabeled()
ILcdGXYLayer
ILcdGXYLayer.isLabeledSupported()
returns false.isLabeled
in interface ILcdGXYLayer
ILcdGXYLayer.isLabeledSupported()
public void setLabeled(boolean aLabeled)
ILcdGXYLayer
ILcdGXYLayer.isLabeledSupported()
returns false.setLabeled
in interface ILcdGXYLayer
aLabeled
- true to have a textual representation of the objects in the model, false to have no such
representation.public void setIcon(ILcdIcon aIcon)
setIcon
in interface ILcdLayer
aIcon
- useless.ILcdLayer.getIcon()
public ILcdModel getModel()
public String getLabel()
ILcdLayer
ILcdLayer
.public void setLabel(String aLabel)
ILcdLayer
ILcdLayer
.public boolean isVisible()
ILcdLayer
isVisible
in interface ILcdLayer
true
if the layer is visible, false
otherwise.ILcdLayer.setVisible(boolean)
public void setVisible(boolean aVisible)
ILcdLayer
setVisible
in interface ILcdLayer
aVisible
- true
if the layer should be visible, false
otherwise.ILcdLayer.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
- has no influence.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
- of no influence.ILcdLayer.isEditableSupported()
,
ILcdLayer.isEditable()
public void selectObject(Object aObject, boolean aSelection, int aDispatchEventMode)
selectObject
in interface ILcdLayer
aObject
- the object to (de)select.aSelection
- the new selection state of the object in the layer.aDispatchEventMode
- whether notification of the selection should be immediate, later or never.ILcdFireEventMode
public void fireCollectedSelectionChanges()
fireCollectedSelectionChanges
in interface ILcdLayer
public void clearSelection(int aDispatchEventMode)
clearSelection
in interface ILcdLayer
aDispatchEventMode
- shall be one among ILcdFireEventMode.FIRE_NOW
,
ILcdFireEventMode.FIRE_LATER
, ILcdFireEventMode.NO_EVENT
ILcdFireEventMode
public void addPropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
PropertyChangeListener
to this ILcdLayer
.addPropertyChangeListener
in interface ILcdPropertyChangeSource
aPropertyChangeListener
- a listener to be notified of changes of properties of this layer.ALcdWeakPropertyChangeListener
,
ILcdPropertyChangeSource.removePropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener aPropertyChangeListener)
PropertyChangeListener
aPropertyChangeListener is associated to this
ILcdLayer
, it will not be associated to this ILcdLayer
after-wards.removePropertyChangeListener
in interface ILcdPropertyChangeSource
aPropertyChangeListener
- a listener no longer to be notified of changes of properties of this layer.ILcdPropertyChangeSource.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
- the object to check the selection state of.public void addSelectionListener(ILcdSelectionListener aSelectionListener)
addSelectionListener
in interface ILcdSelection<Object>
aSelectionListener
- not of influence.public void removeSelectionListener(ILcdSelectionListener aSelectionListener)
removeSelectionListener
in interface ILcdSelection<Object>
aSelectionListener
- not of influence.