Interface ILcdGXYContext
- All Superinterfaces:
Serializable
- All Known Implementing Classes:
ALcdGXYContextWrapper,TLcdGXYContext
ILcdGXYContext defines the context to be used by
an ILcdGXYPainter (respectively an ILcdGXYEditor)
for drawing (editing) on an ILcdGXYView an Object
belonging to an ILcdModel.
It contains information such as:
- the
ILcdGXYViewwhere the drawing or editing occurs, - the
ILcdGXYLayerand therefor theILcdModeltheObjectbelongs to, - the
Graphicswhere to perform the drawing, - the
ILcdModelXYWorldTransformationto transform model coordinates into world coordinates and vice versa. - the
ILcdGXYViewXYWorldTransformationto transform world coordinates into view coordinates and vice versa. - the current location of a number of input points (mouse, touch etc...) and their translations (e.g. mouse drag) when this information is required.
- snapping information when available
- an
ILcdGXYPenfor supporting drawing and editing on aGraphics.
.
Note:
As of 10.0 implementing or wrapping ILcdGXYContext from scratch is strongly discouraged.
Please extend from TLcdGXYContext for your own implementations. If you want to wrap an
ILcdGXYContext, extend ALcdGXYContextWrapper.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionintReturns the delta x for the first input point.intgetDeltaX(int aIndex) Returns the delta x for the input point at indexaIndex.intReturns the delta y for the first input point.intgetDeltaY(int aIndex) Returns the delta y for the input point at indexaIndex.intReturns the number of input points.Returns a modifiable map to store and retrieve implementation specific context information.intReturns the sensitivity that should be used for painting and editing purposes.Short forgetSnapTarget( 0 )getSnapTarget(int aIndex) The snap target at indexaIndexif the painting or editing action requires one.Short forgetSnapTargetLayer( 0 )getSnapTargetLayer(int aIndex) intgetX()Returns the current x coordinate of the first input point.intgetX(int aIndex) Returns the current x coordinate of the input point at the given index.intgetY()Returns the current y coordinate of the first input point.intgetY(int aIndex) Returns the current y coordinate of the input point at the given index.
-
Method Details
-
getGXYView
ILcdGXYView getGXYView()- Returns:
- the
ILcdGXYViewwhere the drawing or editing occurs. - See Also:
-
getGXYLayer
ILcdGXYLayer getGXYLayer()- Returns:
- the
ILcdGXYLayer(and therefor theILcdModel) theObjectto paint or edit belongs to. - See Also:
-
getGXYViewXYWorldTransformation
ILcdGXYViewXYWorldTransformation getGXYViewXYWorldTransformation()- Returns:
- a valid
ILcdGXYViewXYWorldTransformationthat can be used as support for painting or editing. - See Also:
-
getModelXYWorldTransformation
ILcdModelXYWorldTransformation getModelXYWorldTransformation()- Returns:
- a valid
ILcdModelXYWorldTransformationthat can be used as support for painting or editing. - See Also:
-
getGXYPen
ILcdGXYPen getGXYPen()- Returns:
- a valid
ILcdGXYPenthat can be used as support for painting or editing. - See Also:
-
getInputPointCount
int getInputPointCount()Returns the number of input points. For mouse-based interaction, this will usually be 1, for touch-based interaction it can be more.- Returns:
- the number of input points
-
getX
int getX()Returns the current x coordinate of the first input point.- Returns:
- the x coordinate of the current location of the input point at index
0 expressed in view coordinates. If
getInputPointCount()== 0, 0 will be returned. - See Also:
-
getX
Returns the current x coordinate of the input point at the given index.- 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
int getY()Returns the current y coordinate of the first input point.- Returns:
- the y coordinate of the current location of the input point at index
0, expressed in view coordinates. If
getInputPointCount()== 0, 0 will be returned. - See Also:
-
getY
Returns the current y coordinate of the input point at the given index.- 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
int getDeltaX()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.
- Returns:
- the delta x value of the first input point, or 0 when
getInputPointCount()== 0. - See Also:
-
getDeltaX
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.- 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
int getDeltaY()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.
- Returns:
- the delta y value of the first input point, or 0 when
getInputPointCount()== 0. - See Also:
-
getDeltaY
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.- 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
Object getSnapTarget()Short for
getSnapTarget( 0 )When
getInputPointCount()()} == 0, this method will returnnull, whilegetSnapTarget( 0 )will throw anIndexOutOfBoundsException.- Returns:
- the first snap target, or
nullwhen no snap target is available - See Also:
-
getSnapTarget
The snap target at indexaIndexif the painting or editing action requires one. This snap target should correspond to the input point at indexaIndex.- 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
ILcdGXYLayer getSnapTargetLayer()Short for
getSnapTargetLayer( 0 )When
getInputPointCount()()} == 0, this method will returnnull, whilegetSnapTarget( 0 )will throw anIndexOutOfBoundsException.- Returns:
- the layer of the first snap target, or
nullwhen no snap target is available
-
getSnapTargetLayer
Returns the
ILcdGXYLayerof the snap target at indexaIndex.- Parameters:
aIndex- the index- Returns:
- the
ILcdGXYLayerof the snap target at indexaIndex - Throws:
IndexOutOfBoundsException- if the index is out of range (index < 0 || index >= getInputPointCount())
-
getSensitivity
int getSensitivity()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.- Returns:
- the sensitivity for painting/editing purposes or a value smaller than zero if the sensitivity should be chosen by the painter/editor.
-
getProperties
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.- Returns:
- a modifiable map to store and retrieve implementation specific context information
-