public class TLcdCompassGridPainter extends ALcdGXYPainter implements ILcdGXYPainter
maximum range
, and can draw a
heading line
.Modifier and Type | Field and Description |
---|---|
static int |
KM
Constant for kilometers as unit of measure.
|
static int |
MTR
Constant for meters as unit of measure.
|
static int |
NM
Constant for nautical miles as unit of measure.
|
static int |
YD
Constant for yards as unit of measure.
|
defaultCreationFillStyle, defaultCreationLineStyle, defaultFillStyle, defaultLineStyle, fWorkBounds
BODY, CREATING, DEFAULT, HANDLES, RESHAPING, SELECTED, SNAPS, TRANSLATING
Constructor and Description |
---|
TLcdCompassGridPainter()
Creates a default painter instance with the following settings:
nautical miles
ray line every 10 degrees
maximum of 16 circles covering 100 nautical miles
|
Modifier and Type | Method and Description |
---|---|
void |
boundsSFCT(Graphics aGraphics,
int aMode,
ILcdGXYContext aGXYContext,
ILcd2DEditableBounds aBoundsSFCT)
Sets the supplied bounds (in view coordinates, pixels) so that it encompasses the representation of the object
in the given mode taking into account the given context.
|
Object |
clone()
Makes
Object.clone() public. |
double |
getBearingDelta()
The property bearingDelta determines the angle between two consecutive
rays of the compass.
|
Color |
getCircleColor()
Returns the value of the property circleColor which determines the color of the
concentric circles of the compass.
|
int |
getCircleMax()
The property circleMax determines the maximal number of circles in the compass.
|
ALcdDataObjectExpressionLanguage |
getExpressionLanguage()
Returns the expression language that is used to evaluate the
heading expression.
|
Color |
getHeadingColor()
headingColor is the property that holds the color of the heading line that
is drawn.
|
String |
getHeadingExpression()
headingExpression determines the expression of the
ILcdDataObject
that when evaluated yields the azimuth of the heading to be painted. |
int |
getHeadingFeatureIndex()
headingFeatureIndex determines the index of the
ILcdFeatured
that contains the azimuth of the heading to be painted |
int |
getHeadingLineWidth()
headingLineWidth is the property that holds the width of the heading line that
is drawn.
|
Object |
getObject()
Gets the Object this ILcdGXYPainter represents
|
double |
getRangeDelta()
The property rangeDelta determines the distance between two consecutive
concentric circles in the compass.
|
double |
getRangeMax()
The property rangeMax determines the maximal range of the compass.
|
Color |
getRayColor()
Returns the value of the property rayColor which determines the color of the
rays of the compass.
|
int |
getUnitOfMeasure()
The unit of measure can be meters, kilometers, yards or nautical miles.
|
boolean |
isAntiAliasing()
Returns whether to use anti-aliasing when painting.
|
boolean |
isDrawHeadingLine()
drawHeadingLine is the boolean property that determines whether
to draw the heading line or not.
|
boolean |
isLabeled() |
boolean |
isTouched(Graphics aGraphics,
int aState,
ILcdGXYContext aGXYContext)
Checks if the representation of the object in the given mode is touched at the location as defined in the
supplied context.
|
void |
paint(Graphics aGraphics,
int aState,
ILcdGXYContext aGXYContext)
Paints a compass grid centered at the given domain object.
|
void |
setAntiAliasing(boolean aAntiAliasing)
Sets whether to use anti-aliasing when painting.
|
void |
setBearingDelta(double aBearingDelta)
The property bearingDelta determines the angle between two consecutive
rays of the compass.
|
void |
setCircleColor(Color aColor)
Sets the property circleColor which determines the color of the
concentric circles of the compass to aColor.
|
void |
setCircleMax(int aCircleMax)
The property circleMax determines the maximal number of circles in the compass.
|
void |
setDrawHeadingLine(boolean aDrawHeadingLine)
Sets whether to draw a heading line with a certain azimuth.
|
void |
setExpressionLanguage(ALcdDataObjectExpressionLanguage aLanguage)
Sets the expression language that is used to evaluate the
heading expression.
|
void |
setHeadingColor(Color aHeadingColor)
Sets headingColor which is the color of the heading line that
is drawn.
|
void |
setHeadingExpression(String aExpression)
headingExpression determines the expression
that when evaluated yields the azimuth of the heading to be painted.
|
void |
setHeadingFeatureIndex(int aHeadingFeatureIndex)
headingFeatureIndex determines the index of the
ILcdFeatured
that contains the azimuth of the heading to be painted
This index should be set to handle objects that implement
ILcdFeatured . |
void |
setHeadingLineWidth(int aHeadingLineWidth)
headingLineWidth is the property that holds the width of the heading line that
is drawn.
|
void |
setLabeled(boolean aLabeled)
The property labeled determines whether the compass labels should be painted.
|
void |
setObject(Object aObject)
Sets the Object to be represented by this ILcdGXYPainter.
|
void |
setRangeDelta(double aRangeDelta)
The property rangeDelta determines the distance between two consecutive
concentric circles in the compass.
|
void |
setRangeMax(double aRangeMax)
The property rangeMax determines the maximal range of the compass.
|
void |
setRayColor(Color aColor)
Sets the property rayColor which determines the color of the
rays of the compass to aColor.
|
void |
setUnitOfMeasure(int aUnitOfMeasure)
The unit of measure can be meters, kilometers, yards or nautical miles.
|
String |
toString() |
addPropertyChangeListener, anchorPointSFCT, firePropertyChangeEvent, firePropertyChangeEvent, getCursor, getDisplayName, getGXYPainter, isTraceOn, removePropertyChangeListener, setClassTraceOn, setDisplayName, setTraceOn, snapTarget, supportSnap
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
anchorPointSFCT, getCursor, getDisplayName, snapTarget, supportSnap
addPropertyChangeListener, removePropertyChangeListener
public static final int MTR
public static final int KM
public static final int YD
public static final int NM
public TLcdCompassGridPainter()
public void setObject(Object aObject)
setObject
in interface ILcdGXYPainter
aObject
- the object for which the representation shall be handled by this painter.ILcdGXYPainter.getObject()
public Object getObject()
getObject
in interface ILcdGXYPainter
ILcdGXYPainter.setObject(Object)
public boolean isAntiAliasing()
setAntiAliasing(boolean)
public void setAntiAliasing(boolean aAntiAliasing)
aAntiAliasing
- if true
, uses anti-aliasing when paintingisAntiAliasing()
public Color getCircleColor()
public void setCircleColor(Color aColor)
public Color getRayColor()
public void setRayColor(Color aColor)
public boolean isDrawHeadingLine()
public void setDrawHeadingLine(boolean aDrawHeadingLine)
ILcdFeatured
or using ILcdDataObject
.
The feature must be of type Number.public void setHeadingColor(Color aHeadingColor)
public Color getHeadingColor()
public void setHeadingLineWidth(int aHeadingLineWidth)
aHeadingLineWidth
- the line width to set.public int getHeadingLineWidth()
public void setHeadingExpression(String aExpression)
ILcdDataObject
.public String getHeadingExpression()
ILcdDataObject
that when evaluated yields the azimuth of the heading to be painted.ALcdDataObjectExpressionLanguage
public void setHeadingFeatureIndex(int aHeadingFeatureIndex)
ILcdFeatured
that contains the azimuth of the heading to be painted
This index should be set to handle objects that implement
ILcdFeatured
.public int getHeadingFeatureIndex()
ILcdFeatured
that contains the azimuth of the heading to be paintedpublic boolean isLabeled()
true
if the compass grid includes labelspublic void setLabeled(boolean aLabeled)
public double getRangeDelta()
public void setRangeDelta(double aRangeDelta)
public double getBearingDelta()
public void setBearingDelta(double aBearingDelta)
public void setRangeMax(double aRangeMax)
public double getRangeMax()
public int getCircleMax()
public void setCircleMax(int aCircleMax)
public int getUnitOfMeasure()
TLcdCompassGridPainter.MTR
, TLcdCompassGridPainter.KM
,
TLcdCompassGridPainter.YD
or TLcdCompassGridPainter.NM
.public void setUnitOfMeasure(int aUnitOfMeasure)
public void paint(Graphics aGraphics, int aState, ILcdGXYContext aGXYContext)
ILcdAssoc
key-value pair, where
the key is an object in another layer and the value is the layer containing the object.
In this case, the layer's painter is used to calculate an anchor point for the object.paint
in interface ILcdGXYPainter
aGraphics
- the Graphics on which the representation of the object is paintedaState
- the mode the object is represented in (see class documentation).aGXYContext
- the ILcdGXYContext
the drawing depends on.public ALcdDataObjectExpressionLanguage getExpressionLanguage()
getHeadingExpression()
,
setExpressionLanguage(ALcdDataObjectExpressionLanguage)
public void setExpressionLanguage(ALcdDataObjectExpressionLanguage aLanguage)
TLcdDataObjectExpressionLanguage
.getHeadingExpression()
,
getExpressionLanguage()
public boolean isTouched(Graphics aGraphics, int aState, ILcdGXYContext aGXYContext)
ILcdGXYPainter
The location that must be taken into account to check whether the representation is touched can be retrieved from
the context passed with the methods
ILcdGXYContext.getX()
and ILcdGXYContext.getY()
.
If the check is part of an ongoing operation of
user interaction, for example, when the mouse is being dragged, the location of the start of the operation can also
be taken into account using the methods
ILcdGXYContext.getDeltaX()
and ILcdGXYContext.getDeltaY()
.
The context contains the transformations required to convert this location into the equivalent location in
model space. Implementations of this interface usually follow either of the following patterns:
As the mode influences the way an object is represented, it must also be taken into account when checking whether that representation is being touched. When the mode contains CREATING, RESHAPING or TRANSLATING which indicate that the object must be represented in a state for an ongoing operation, the location of the start of the operation may be taken into account as mentioned above. The painting result can take into account multiple locations, to respond to, for example, multi-touch input. When the mode contains SELECTED, the painter should also check if the non-selected representation is touched, since these are always painted on top of each other.
The boundsSFCT
is often used to speed up the performance of this method as a location outside these bounds can never
touch the representation of the object.
Note that this method does not give an indication of what part of the object is touched. It is up to the painter implementations to provide methods to make this distinction. The method does also not indicate what sensitivity must be applied when checking if an object is touched. It is up to the implementation to decide what should be the maximum distance between the location given in the context and the closest relevant point or area of the representation of the object.
isTouched
in interface ILcdGXYPainter
aGraphics
- the Graphics on which the representation of the object is paintedaState
- the mode the object is represented inaGXYContext
- contains the location of the interaction and the transformations to convert this location into
model coordinatesboundsSFCT
public void boundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds aBoundsSFCT) throws TLcdNoBoundsException
ILcdGXYPainter
If this method returns without exception the bounds argument must encompass the representation of the object. A point outside the bounds will not be contained within the painted object.
The bounds returned in this method can be seen as the equivalent in the view space of the bounds in the model
space for ILcdBounded
objects.
boundsSFCT
in interface ILcdGXYPainter
aGraphics
- the Graphics on which the representation of the object is paintedaMode
- the mode the object is represented in (see class documentation). For example, an object may be
represented differently in SELECTED mode compared to DEFAULT mode. The returned bounds of the representation
must take this different representation into account.aGXYContext
- the context for which the representation of the object is painted. It contains amongst others
the transformations from model to world and world to view.aBoundsSFCT
- the bounds that must be adapted to encompass the representation of the object in the given
mode and context. These bounds must not be taken into account when the method has thrown an exception.TLcdNoBoundsException
- if no bounds can be determined for the representation of the object.
This can happen when the object does not have a representation in the given context, for example when it is located
in a part of the world which is not visible in the current view.isTouched
public Object clone()
ILcdCloneable
Makes Object.clone()
public.
java.lang.Object
, it can be implemented like this:
public Object clone() {
try {
return super.clone();
} catch ( CloneNotSupportedException e ) {
// Cannot happen: extends from Object and implements Cloneable (see also Object.clone)
throw new RuntimeException( e );
}
}
clone
in interface ILcdCloneable
clone
in interface ILcdGXYPainterProvider
clone
in class ALcdGXYPainter
Object.clone()