Class TLcdCompassGridPainter
- All Implemented Interfaces:
ILcdCloneable
,ILcdPropertyChangeSource
,ILcdGXYPainter
,ILcdGXYPainterProvider
,Serializable
,Cloneable
maximum range
, and can draw a
heading line
.- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Constant for kilometers as unit of measure.static final int
Constant for meters as unit of measure.static final int
Constant for nautical miles as unit of measure.static final int
Constant for yards as unit of measure.Fields inherited from class com.luciad.view.gxy.ALcdGXYPainter
defaultCreationFillStyle, defaultCreationLineStyle, defaultFillStyle, defaultLineStyle, fWorkBounds
Fields inherited from interface com.luciad.view.gxy.ILcdGXYPainter
BODY, CREATING, DEFAULT, HANDLES, RESHAPING, SELECTED, SNAPS, TRANSLATING
-
Constructor Summary
ConstructorDescriptionCreates a default painter instance with the following settings: nautical miles ray line every 10 degrees maximum of 16 circles covering 100 nautical miles -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.clone()
MakesObject.clone()
public.double
The property bearingDelta determines the angle between two consecutive rays of the compass.Returns the value of the property circleColor which determines the color of the concentric circles of the compass.int
The property circleMax determines the maximal number of circles in the compass.Returns the expression language that is used to evaluate the heading expression.headingColor is the property that holds the color of the heading line that is drawn.headingExpression determines the expression of theILcdDataObject
that when evaluated yields the azimuth of the heading to be painted.int
headingFeatureIndex determines the index of theILcdFeatured
that contains the azimuth of the heading to be paintedint
headingLineWidth is the property that holds the width of the heading line that is drawn.Gets the Object this ILcdGXYPainter representsdouble
The property rangeDelta determines the distance between two consecutive concentric circles in the compass.double
The property rangeMax determines the maximal range of the compass.Returns the value of the property rayColor which determines the color of the rays of the compass.int
The unit of measure can be meters, kilometers, yards or nautical miles.boolean
Returns whether to use anti-aliasing when painting.boolean
drawHeadingLine is the boolean property that determines whether to draw the heading line or not.boolean
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
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 theILcdFeatured
that contains the azimuth of the heading to be painted This index should be set to handle objects that implementILcdFeatured
.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
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.toString()
Methods inherited from class com.luciad.view.gxy.ALcdGXYPainter
addPropertyChangeListener, anchorPointSFCT, firePropertyChangeEvent, firePropertyChangeEvent, getCursor, getDisplayName, getGXYPainter, isTraceOn, removePropertyChangeListener, setClassTraceOn, setDisplayName, setTraceOn, snapTarget, supportSnap
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.luciad.view.gxy.ILcdGXYPainter
anchorPointSFCT, getCursor, getDisplayName, snapTarget, supportSnap
Methods inherited from interface com.luciad.util.ILcdPropertyChangeSource
addPropertyChangeListener, removePropertyChangeListener
-
Field Details
-
MTR
public static final int MTRConstant for meters as unit of measure.- See Also:
-
KM
public static final int KMConstant for kilometers as unit of measure.- See Also:
-
YD
public static final int YDConstant for yards as unit of measure.- See Also:
-
NM
public static final int NMConstant for nautical miles as unit of measure.- See Also:
-
-
Constructor Details
-
TLcdCompassGridPainter
public 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
-
-
Method Details
-
setObject
Sets the Object to be represented by this ILcdGXYPainter.- Specified by:
setObject
in interfaceILcdGXYPainter
- Parameters:
aObject
- the object for which the representation shall be handled by this painter.- See Also:
-
getObject
Gets the Object this ILcdGXYPainter represents- Specified by:
getObject
in interfaceILcdGXYPainter
- Returns:
- the Object for which the representation is currently being handled by this painter.
- See Also:
-
isAntiAliasing
public boolean isAntiAliasing()Returns whether to use anti-aliasing when painting.- Returns:
- whether to use anti-aliasing when painting
- See Also:
-
setAntiAliasing
public void setAntiAliasing(boolean aAntiAliasing) Sets whether to use anti-aliasing when painting.- Parameters:
aAntiAliasing
- iftrue
, uses anti-aliasing when painting- See Also:
-
getCircleColor
Returns the value of the property circleColor which determines the color of the concentric circles of the compass. -
setCircleColor
Sets the property circleColor which determines the color of the concentric circles of the compass to aColor. -
getRayColor
Returns the value of the property rayColor which determines the color of the rays of the compass. -
setRayColor
Sets the property rayColor which determines the color of the rays of the compass to aColor. -
isDrawHeadingLine
public boolean isDrawHeadingLine()drawHeadingLine is the boolean property that determines whether to draw the heading line or not. -
setDrawHeadingLine
public void setDrawHeadingLine(boolean aDrawHeadingLine) Sets whether to draw a heading line with a certain azimuth. The azimuth is determined from the object (either the ILcdPoint itself or ILcdAssoc's key value) usingILcdFeatured
or usingILcdDataObject
. The feature must be of type Number. -
setHeadingColor
Sets headingColor which is the color of the heading line that is drawn. -
getHeadingColor
headingColor is the property that holds the color of the heading line that is drawn.- Returns:
- headingColor
-
setHeadingLineWidth
public void setHeadingLineWidth(int aHeadingLineWidth) headingLineWidth is the property that holds the width of the heading line that is drawn. This property has an effect for Java2 and up. For lower versions, the line width will be always 1.- Parameters:
aHeadingLineWidth
- the line width to set.
-
getHeadingLineWidth
public int getHeadingLineWidth()headingLineWidth is the property that holds the width of the heading line that is drawn. This property has an effect for Java2 and up. For lower versions, the line width will be always 1.- Returns:
- the current line width.
-
setHeadingExpression
headingExpression determines the expression that when evaluated yields the azimuth of the heading to be painted. This expression should be set to handle objects that implementILcdDataObject
. -
getHeadingExpression
headingExpression determines the expression of theILcdDataObject
that when evaluated yields the azimuth of the heading to be painted.- Returns:
- the expression of the ILcdDataObject that contains the azimuth of the heading to be painted
- See Also:
-
setHeadingFeatureIndex
public void setHeadingFeatureIndex(int aHeadingFeatureIndex) headingFeatureIndex determines the index of theILcdFeatured
that contains the azimuth of the heading to be painted This index should be set to handle objects that implementILcdFeatured
. -
getHeadingFeatureIndex
public int getHeadingFeatureIndex()headingFeatureIndex determines the index of theILcdFeatured
that contains the azimuth of the heading to be painted- Returns:
- the index of the ILcdFeatured that contains the azimuth of the heading to be painted
-
isLabeled
public boolean isLabeled()- Returns:
true
if the compass grid includes labels
-
setLabeled
public void setLabeled(boolean aLabeled) The property labeled determines whether the compass labels should be painted. Sets the property labeled to aLabeled. -
getRangeDelta
public double getRangeDelta()The property rangeDelta determines the distance between two consecutive concentric circles in the compass. Returns the value of the property rangeDelta in the unit of measure. -
setRangeDelta
public void setRangeDelta(double aRangeDelta) The property rangeDelta determines the distance between two consecutive concentric circles in the compass. Sets the value of the property rangeDelta to aRangeDelta (in the unit of measure). -
getBearingDelta
public double getBearingDelta()The property bearingDelta determines the angle between two consecutive rays of the compass. Returns the value of the property bearingDelta. -
setBearingDelta
public void setBearingDelta(double aBearingDelta) The property bearingDelta determines the angle between two consecutive rays of the compass. Sets the value of the property bearingDelta to aBearingDelta. -
setRangeMax
public void setRangeMax(double aRangeMax) The property rangeMax determines the maximal range of the compass. Sets the value of the property rangeMax to aRangeMax (in the unit of measure). -
getRangeMax
public double getRangeMax()The property rangeMax determines the maximal range of the compass. Returns the value of the property rangeMax in the unit of measure. -
getCircleMax
public int getCircleMax()The property circleMax determines the maximal number of circles in the compass. Returns the value of the property circleMax. -
setCircleMax
public void setCircleMax(int aCircleMax) The property circleMax determines the maximal number of circles in the compass. Sets the value of the property circleMax to aCircleMax. -
getUnitOfMeasure
public int getUnitOfMeasure()The unit of measure can be meters, kilometers, yards or nautical miles.- Returns:
- the unitOfMeasure, which is one of the following:
TLcdCompassGridPainter.MTR
,TLcdCompassGridPainter.KM
,TLcdCompassGridPainter.YD
orTLcdCompassGridPainter.NM
.
-
setUnitOfMeasure
public void setUnitOfMeasure(int aUnitOfMeasure) The unit of measure can be meters, kilometers, yards or nautical miles. Sets the property unitOfMeasure to aUnitOfMeasure. -
paint
Paints a compass grid centered at the given domain object. If the object is an ILcdPoint, that location is used. Else, the object is expected to be anILcdAssoc
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.- Specified by:
paint
in interfaceILcdGXYPainter
- Parameters:
aGraphics
- the Graphics on which the representation of the object is paintedaState
- the mode the object is represented in (see class documentation).aGXYContext
- theILcdGXYContext
the drawing depends on.
-
getExpressionLanguage
Returns the expression language that is used to evaluate the heading expression.- Returns:
- the expression language that is used to evaluate the heading expression
- See Also:
-
setExpressionLanguage
Sets the expression language that is used to evaluate the heading expression. By default, this object is initialized with an instance ofTLcdDataObjectExpressionLanguage
.- See Also:
-
isTouched
Description copied from interface:ILcdGXYPainter
Checks if the representation of the object in the given mode is touched at the location as defined in the supplied context.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()
andILcdGXYContext.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 methodsILcdGXYContext.getDeltaX()
andILcdGXYContext.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:- transform the location of the interaction back to model space and compare the coordinates with the object in model space.
- transform the location to world space and compare with a world representation of the object. This forces the painter into caching a world representation of the object. Caching a view representation of an object is not very practical as it would have to change whenever the view's scale changes or when it is panned. A world representation of an object only changes when the view's XYWorldReference changes, which happens less frequently.
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.
- Specified by:
isTouched
in interfaceILcdGXYPainter
- Parameters:
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 coordinates- Returns:
- true if the representation of the object in the given mode is touched by the location as defined in the context passed, false otherwise
- See Also:
-
boundsSFCT
public void boundsSFCT(Graphics aGraphics, int aMode, ILcdGXYContext aGXYContext, ILcd2DEditableBounds aBoundsSFCT) throws TLcdNoBoundsException Description copied from interface:ILcdGXYPainter
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.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.- Specified by:
boundsSFCT
in interfaceILcdGXYPainter
- Parameters:
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.- Throws:
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.- See Also:
-
toString
-
clone
Description copied from interface:ILcdCloneable
Makes
When for example extending fromObject.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 ); } }
- Specified by:
clone
in interfaceILcdCloneable
- Specified by:
clone
in interfaceILcdGXYPainterProvider
- Overrides:
clone
in classALcdGXYPainter
- Returns:
- a clone of this painter provider.
- See Also:
-