Class ALcdGXYContextWrapper
- All Implemented Interfaces:
ILcdGXYContext
,Serializable
Convenience class to wrap an ILcdGXYContext
: one only has to overwrite those
methods that are required. This is also known as the decorator design pattern.
This wrapper is provided because methods might be added to the interface in a newer version of
the API. The advantage of extending from this ALcdGXYContextWrapper
is that if methods
are ever added to ILcdGXYContext
, they will also be added here. So when writing a
wrapper for a ILcdGXYContext
, always extend this class.
- Since:
- 10.0
- See Also:
-
Constructor Summary
ConstructorDescriptionALcdGXYContextWrapper
(ILcdGXYContext aGXYContext) Creates a wrapper for the specifiedILcdGXYContext
. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the delta x for the first input point.int
getDeltaX
(int aIndex) Returns the delta x for the input point at indexaIndex
.int
Returns the delta y for the first input point.int
getDeltaY
(int aIndex) Returns the delta y for the input point at indexaIndex
.Returns the wrappedILcdGXYContext
.int
Returns the number of input points.Returns a modifiable map to store and retrieve implementation specific context information.int
Returns the sensitivity that should be used for painting and editing purposes.Short forgetSnapTarget( 0 )
getSnapTarget
(int aIndex) The snap target at indexaIndex
if the painting or editing action requires one.Short forgetSnapTargetLayer( 0 )
getSnapTargetLayer
(int aIndex) int
getX()
Returns the current x coordinate of the first input point.int
getX
(int aIndex) Returns the current x coordinate of the input point at the given index.int
getY()
Returns the current y coordinate of the first input point.int
getY
(int aIndex) Returns the current y coordinate of the input point at the given index.
-
Constructor Details
-
ALcdGXYContextWrapper
Creates a wrapper for the specified
ILcdGXYContext
.- Parameters:
aGXYContext
- TheILcdGXYContext
to wrap. Must not benull
.
-
-
Method Details
-
getGXYContext
Returns the wrapped
ILcdGXYContext
.- Returns:
- The wrapped
ILcdGXYContext
. Nevernull
.
-
getGXYView
- Specified by:
getGXYView
in interfaceILcdGXYContext
- Returns:
- the
ILcdGXYView
where the drawing or editing occurs. - See Also:
-
getGXYLayer
- Specified by:
getGXYLayer
in interfaceILcdGXYContext
- Returns:
- the
ILcdGXYLayer
(and therefor theILcdModel
) theObject
to paint or edit belongs to. - See Also:
-
getGXYViewXYWorldTransformation
- Specified by:
getGXYViewXYWorldTransformation
in interfaceILcdGXYContext
- Returns:
- a valid
ILcdGXYViewXYWorldTransformation
that can be used as support for painting or editing. - See Also:
-
getModelXYWorldTransformation
- Specified by:
getModelXYWorldTransformation
in interfaceILcdGXYContext
- Returns:
- a valid
ILcdModelXYWorldTransformation
that can be used as support for painting or editing. - See Also:
-
getGXYPen
- Specified by:
getGXYPen
in interfaceILcdGXYContext
- Returns:
- a valid
ILcdGXYPen
that can be used as support for painting or editing. - See Also:
-
getInputPointCount
public int getInputPointCount()Description copied from interface:ILcdGXYContext
Returns the number of input points. For mouse-based interaction, this will usually be 1, for touch-based interaction it can be more.- Specified by:
getInputPointCount
in interfaceILcdGXYContext
- Returns:
- the number of input points
-
getX
public int getX()Description copied from interface:ILcdGXYContext
Returns the current x coordinate of the first input point.- Specified by:
getX
in interfaceILcdGXYContext
- Returns:
- the x coordinate of the current location of the input point at index
0 expressed in view coordinates. If
ILcdGXYContext.getInputPointCount()
== 0, 0 will be returned. - See Also:
-
getX
Description copied from interface:ILcdGXYContext
Returns the current x coordinate of the input point at the given index.- Specified by:
getX
in interfaceILcdGXYContext
- Parameters:
aIndex
- the index of the input point- Returns:
- the x coordinate of the current location of the input point at index
aIndex
, expressed in view coordinates - Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= getInputPointCount())- See Also:
-
getY
public int getY()Description copied from interface:ILcdGXYContext
Returns the current y coordinate of the first input point.- Specified by:
getY
in interfaceILcdGXYContext
- Returns:
- the y coordinate of the current location of the input point at index
0, expressed in view coordinates. If
ILcdGXYContext.getInputPointCount()
== 0, 0 will be returned. - See Also:
-
getY
Description copied from interface:ILcdGXYContext
Returns the current y coordinate of the input point at the given index.- Specified by:
getY
in interfaceILcdGXYContext
- Parameters:
aIndex
- the index of the input point- Returns:
- the y coordinate of the current location of the input point at index
aIndex
, expressed in view coordinates - Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= getInputPointCount())- See Also:
-
getDeltaX
public int getDeltaX()Description copied from interface:ILcdGXYContext
Returns the delta x for the first input point. This is typically the difference between the current x value and the original x value triggering an interaction.
- Specified by:
getDeltaX
in interfaceILcdGXYContext
- Returns:
- the delta x value of the first input point, or 0 when
ILcdGXYContext.getInputPointCount()
== 0. - See Also:
-
getDeltaX
Description copied from interface:ILcdGXYContext
Returns the delta x for the input point at index
aIndex
. This is typically the difference between the current x value and the original x value triggering an interaction.- Specified by:
getDeltaX
in interfaceILcdGXYContext
- Parameters:
aIndex
- the index- Returns:
- the delta x for the input point at index
aIndex
, expressed in view coordinates - Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= getInputPointCount())- See Also:
-
getDeltaY
public int getDeltaY()Description copied from interface:ILcdGXYContext
Returns the delta y for the first input point. This is typically the difference between the current y value and the original y value triggering the interaction.
- Specified by:
getDeltaY
in interfaceILcdGXYContext
- Returns:
- the delta y value of the first input point, or 0 when
ILcdGXYContext.getInputPointCount()
== 0. - See Also:
-
getDeltaY
Description copied from interface:ILcdGXYContext
Returns the delta y for the input point at index
aIndex
. This is typically the difference between the current x value and the original y value triggering an interaction.- Specified by:
getDeltaY
in interfaceILcdGXYContext
- Parameters:
aIndex
- the index- Returns:
- the delta y for the input point at index
aIndex
, expressed in view coordinates - Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= getInputPointCount())- See Also:
-
getSnapTarget
Description copied from interface:ILcdGXYContext
Short for
getSnapTarget( 0 )
When
ILcdGXYContext.getInputPointCount()
()} == 0, this method will returnnull
, whilegetSnapTarget( 0 )
will throw anIndexOutOfBoundsException
.- Specified by:
getSnapTarget
in interfaceILcdGXYContext
- Returns:
- the first snap target, or
null
when no snap target is available - See Also:
-
getSnapTarget
Description copied from interface:ILcdGXYContext
The snap target at indexaIndex
if the painting or editing action requires one. This snap target should correspond to the input point at indexaIndex
.- Specified by:
getSnapTarget
in interfaceILcdGXYContext
- Parameters:
aIndex
- the index- Returns:
- the snap target at index
aIndex
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= getInputPointCount())
-
getSnapTargetLayer
Description copied from interface:ILcdGXYContext
Short for
getSnapTargetLayer( 0 )
When
ILcdGXYContext.getInputPointCount()
()} == 0, this method will returnnull
, whilegetSnapTarget( 0 )
will throw anIndexOutOfBoundsException
.- Specified by:
getSnapTargetLayer
in interfaceILcdGXYContext
- Returns:
- the layer of the first snap target, or
null
when no snap target is available
-
getSnapTargetLayer
Description copied from interface:ILcdGXYContext
Returns the
ILcdGXYLayer
of the snap target at indexaIndex
.- Specified by:
getSnapTargetLayer
in interfaceILcdGXYContext
- Parameters:
aIndex
- the index- Returns:
- the
ILcdGXYLayer
of the snap target at indexaIndex
- Throws:
IndexOutOfBoundsException
- if the index is out of range (index < 0 || index >= getInputPointCount())
-
getSensitivity
public int getSensitivity()Description copied from interface:ILcdGXYContext
Returns the sensitivity that should be used for painting and editing purposes. This is for instance the distance between an input point and a handle that still allows the input to interact with the handle. Returning a value smaller than zero indicates that the painter/editor can choose the sensitivity to use.- Specified by:
getSensitivity
in interfaceILcdGXYContext
- Returns:
- the sensitivity for painting/editing purposes or a value smaller than zero if the sensitivity should be chosen by the painter/editor.
-
getProperties
Description copied from interface:ILcdGXYContext
Returns a modifiable map to store and retrieve implementation specific context information. For example, an editor can use it to store information on an ongoing creation or editing process across multiple invocations, e.g. the handle that is currently being edited.- Specified by:
getProperties
in interfaceILcdGXYContext
- Returns:
- a modifiable map to store and retrieve implementation specific context information
-