Class TLcdGXYContext
- All Implemented Interfaces:
ILcdCloneable,ILcdGXYContext,Serializable,Cloneable
ILcdGXYContext. This class contains
the information to enable a painter (editor) to perform its drawing (editing)
on an ILcdGXYView.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor, which creates anTLcdGXYContextwithout any information.TLcdGXYContext(ILcdGXYContext aGXYContext) Constructs aTLcdGXYContextfrom anotherILcdGXYContext.TLcdGXYContext(ILcdGXYView aGXYView, ILcdGXYLayer aGXYLayer) Create a newTLcdGXYContextobject.TLcdGXYContext(ILcdGXYView aGXYView, ILcdGXYLayer aGXYLayer, List<Point> aOriginalLocations, List<Point> aCurrentLocations) Create a newTLcdGXYContextobject.TLcdGXYContext(ILcdGXYView aGXYView, ILcdGXYPen aGXYPen, int aX, int aY, int aDeltaX, int aDeltaY) Create a newTLcdGXYContextobject -
Method Summary
Modifier and TypeMethodDescriptionclone()MakesObject.clone()public.final intReturns the delta x for the first input point.intgetDeltaX(int aIndex) Returns the delta x for the input point at indexaIndex.final intReturns the delta y for the first input point.intgetDeltaY(int aIndex) Returns the delta y for the input point at indexaIndex.doubleReturns the DPI scaling factor for the view that is being rendered.final ILcdGXYLayerfinal ILcdGXYPenfinal ILcdGXYViewintReturns the number of input pointsReturns a modifiable map to store and retrieve implementation specific context information.final intThis method returns 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) final 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.final 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.final voidresetFor(ILcdGXYLayer aGXYLayer, ILcdGXYView aGXYView) Initializes thisTLcdGXYContextwith default values to paint/edit onaGXYViewanObjectthat belongs toaGXYLayer.final voidsetDeltaX(int aDeltaX) Short forsetDeltaX( aDeltaX, 0 )voidsetDeltaX(int aDeltaX, int aIndex) Sets the delta of the x coordinate of the input point at indexaIndex.final voidsetDeltaY(int aDeltaY) Short forsetDeltaY( aDeltaY, 0 )voidsetDeltaY(int aDeltaY, int aIndex) Sets the delta of the y coordinate of the input point at indexaIndex.voidsetGXYLayer(ILcdGXYLayer aGXYLayer) Sets anILcdGXYLayerto thisTLcdGXYContext.final voidsetGXYPen(ILcdGXYPen aPen) Sets anILcdGXYPento thisTLcdGXYContext.voidsetGXYView(ILcdGXYView aGXYView) Sets anILcdGXYViewto thisTLcdGXYContext.voidsetGXYViewXYWorldTransformation(ILcdGXYViewXYWorldTransformation aGXYViewXYWorldTransformation) Set a valid ILcdGXYViewXYWorldTransformation that can be used as support for painting or editing.voidsetModelXYWorldTransformation(ILcdModelXYWorldTransformation aModelXYWorldTransformation) Set a valid ILcdModelXYWorldTransformation that can be used as support for painting or editingfinal voidsetSensitivity(int aSensitivity) This method sets the sensitivity that should be used for painting and editing purposes.voidsetSnapTarget(Object aSnapTarget) Short forsetSnapTarget( aSnapTarget, 0 )voidsetSnapTarget(Object aSnapTarget, int aIndex) Sets the snap target at indexaIndex.voidsetSnapTargetLayer(ILcdGXYLayer aSnapTargetLayer) Short forsetSnapTargetLayer( aSnapTargetLayer, 0 )voidsetSnapTargetLayer(ILcdGXYLayer aSnapTargetLayer, int aIndex) final voidsetX(int aX) Sets the current x coordinate of the first input point.voidsetX(int aX, int aIndex) Sets the current x coordinate of the input point at indexaIndex.final voidsetY(int aY) Sets the current y coordinate of the first input point.voidsetY(int aY, int aIndex) Sets the current y coordinate of the input point at indexaIndex.toString()
-
Constructor Details
-
TLcdGXYContext
public TLcdGXYContext()Default constructor, which creates anTLcdGXYContextwithout any information. Use the available setters to store information in thisTLcdGXYContextobject. -
TLcdGXYContext
public TLcdGXYContext(ILcdGXYView aGXYView, ILcdGXYPen aGXYPen, int aX, int aY, int aDeltaX, int aDeltaY) Create a newTLcdGXYContextobject- Parameters:
aGXYView- the view. SeegetGXYView()aGXYPen- the pen. SeegetGXYPen()aX- the x coordinate of the ( mouse ) location, expressed in view coordinates. SeegetX()aY- the y coordinate of the ( mouse ) location, expressed in view coordinates. SeegetY()aDeltaX- the delta x to consider when painting or editing. SeegetDeltaX()aDeltaY- the delta y to consider when painting or editing. SeegetDeltaY()
-
TLcdGXYContext
public TLcdGXYContext(ILcdGXYView aGXYView, ILcdGXYLayer aGXYLayer, List<Point> aOriginalLocations, List<Point> aCurrentLocations) Create a new
TLcdGXYContextobject.It allows to store multiple input points. The
aOriginalLocationslists contains the location of all the input points.aCurrentLocationscontains the current locations of the points. Both lists should have the same length, and the first point inaOriginalLocationsshould be the original location of the first point inaCurrentLocations. The same applies for the other points in both lists.- Parameters:
aGXYView- the view. SeegetGXYView()aGXYLayer- the layer. SeegetGXYLayer()aOriginalLocations- a list containing the original locations of all input points. The points should be expressed in view coordinates. Must not benull. Use an empty list when no input points should be considered.aCurrentLocations- a list containing the current locations of all input points. The points should be expressed in view coordinates. Must not benull. Use an empty list when no input points should be considered.
-
TLcdGXYContext
Create a new
TLcdGXYContextobject. It is initialized with default values to paint/edit anObjectthat belongs toaGXYLayeronaGXYView.- Parameters:
aGXYView- the view. SeegetGXYView()aGXYLayer- the layer. SeegetGXYLayer()
-
TLcdGXYContext
Constructs aTLcdGXYContextfrom anotherILcdGXYContext.- Parameters:
aGXYContext- the context on which the createdTLcdGXYContextwill be based. Must not benull
-
-
Method Details
-
getProperties
Description copied from interface:ILcdGXYContextReturns 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:
getPropertiesin interfaceILcdGXYContext- Returns:
- a modifiable map to store and retrieve implementation specific context information
-
getGXYViewXYWorldTransformation
When no
ILcdGXYViewXYWorldTransformationis set but aILcdGXYViewis available, the transformation of the view will be returned.- Specified by:
getGXYViewXYWorldTransformationin interfaceILcdGXYContext- Returns:
- a valid
ILcdGXYViewXYWorldTransformationthat can be used as support for painting or editing. - See Also:
-
setGXYViewXYWorldTransformation
public void setGXYViewXYWorldTransformation(ILcdGXYViewXYWorldTransformation aGXYViewXYWorldTransformation) Set a valid ILcdGXYViewXYWorldTransformation that can be used as support for painting or editing.- Parameters:
aGXYViewXYWorldTransformation- the transformation- See Also:
-
getModelXYWorldTransformation
Returns the set
ILcdModelXYWorldTransformation.- Specified by:
getModelXYWorldTransformationin interfaceILcdGXYContext- Returns:
- a valid
ILcdModelXYWorldTransformationthat can be used as support for painting or editing. - See Also:
-
setModelXYWorldTransformation
public void setModelXYWorldTransformation(ILcdModelXYWorldTransformation aModelXYWorldTransformation) Set a valid ILcdModelXYWorldTransformation that can be used as support for painting or editing- Parameters:
aModelXYWorldTransformation- the transformation- See Also:
-
getGXYView
- Specified by:
getGXYViewin interfaceILcdGXYContext- Returns:
- the
ILcdGXYViewwhere the drawing or editing occurs. - See Also:
-
setGXYView
Sets anILcdGXYViewto thisTLcdGXYContext.- Parameters:
aGXYView- the view.
-
getGXYLayer
- Specified by:
getGXYLayerin interfaceILcdGXYContext- Returns:
- the
ILcdGXYLayer(and therefor theILcdModel) theObjectto paint or edit belongs to. - See Also:
-
setGXYLayer
Sets anILcdGXYLayerto thisTLcdGXYContext.- Parameters:
aGXYLayer- the layer
-
resetFor
Initializes thisTLcdGXYContextwith default values to paint/edit onaGXYViewanObjectthat belongs toaGXYLayer.- Parameters:
aGXYLayer- the layer. Must not benullaGXYView- the view. Must not benull
-
getGXYPen
- Specified by:
getGXYPenin interfaceILcdGXYContext- Returns:
- a valid
ILcdGXYPenthat can be used as support for painting or editing. - See Also:
-
setGXYPen
Sets anILcdGXYPento thisTLcdGXYContext.- Parameters:
aPen- the pen
-
getInputPointCount
public int getInputPointCount()Returns the number of input points- Specified by:
getInputPointCountin interfaceILcdGXYContext- Returns:
- the number of input points
-
setX
public final void setX(int aX) Sets the current x coordinate of the first input point.- Parameters:
aX- the x coordinate of the current location of the input point at index 0 expressed in view coordinates- See Also:
-
setX
public void setX(int aX, int aIndex) Sets the current x coordinate of the input point at index
aIndex.The number of input points will automatically be increased when
aIndex>=getInputPointCount()- Parameters:
aX- the x coordinate of the current location of the input point at indexaIndex. Should be expressed in view coordinates.aIndex- the index of the input point- See Also:
-
setY
public final void setY(int aY) Sets the current y coordinate of the first input point.- Parameters:
aY- the y coordinate of the current location of the input point at index 0 expressed in view coordinates- See Also:
-
setY
public void setY(int aY, int aIndex) Sets the current y coordinate of the input point at index
aIndex.The number of input points will automatically be increased when
aIndex>=getInputPointCount()- Parameters:
aY- the y coordinate of the current location of the input point at indexaIndex. Should be expressed in view coordinates.aIndex- the index of the input point- See Also:
-
getX
public final int getX()Description copied from interface:ILcdGXYContextReturns the current x coordinate of the first input point.- Specified by:
getXin 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:ILcdGXYContextReturns the current x coordinate of the input point at the given index.- Specified by:
getXin 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 final int getY()Description copied from interface:ILcdGXYContextReturns the current y coordinate of the first input point.- Specified by:
getYin 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:ILcdGXYContextReturns the current y coordinate of the input point at the given index.- Specified by:
getYin 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:
-
setDeltaX
public final void setDeltaX(int aDeltaX) Short forsetDeltaX( aDeltaX, 0 )- Parameters:
aDeltaX- the delta x- See Also:
-
setDeltaX
public void setDeltaX(int aDeltaX, int aIndex) Sets the delta of the x coordinate of the input point at index
aIndex.If for example this context describes a drag of the input point at index
aIndex,getX( aIndex )andgetY( aIndex )describe the current location of that input point. This method allows to specify the difference with the original x location that triggered the drag operation. The original location can then be retrieved by subtracting thegetDeltaX( aIndex )andgetDeltaY( aIndex )from the current location.The number of input points will automatically be increased when
aIndex>=getInputPointCount()- Parameters:
aDeltaX- the delta x, expressed in view coordinatesaIndex- the index of the input point
-
setDeltaY
public final void setDeltaY(int aDeltaY) Short forsetDeltaY( aDeltaY, 0 )- Parameters:
aDeltaY- the delta y
-
setDeltaY
public void setDeltaY(int aDeltaY, int aIndex) Sets the delta of the y coordinate of the input point at index
aIndex.If for example this context describes a drag of the input point at index
aIndex,getX( aIndex )andgetY( aIndex )describe the current location of that input point. This method allows to specify the difference with the original x location that triggered the drag operation. The original location can then be retrieved by subtracting thegetDeltaX( aIndex )andgetDeltaY( aIndex )from the current location.The number of input points will automatically be increased when
aIndex>=getInputPointCount()- Parameters:
aDeltaY- the delta y, expressed in view coordinatesaIndex- the index of the input point
-
getDeltaX
public final int getDeltaX()Description copied from interface:ILcdGXYContextReturns 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:
getDeltaXin interfaceILcdGXYContext- Returns:
- the delta x value of the first input point, or 0 when
ILcdGXYContext.getInputPointCount()== 0. - See Also:
-
getDeltaX
Description copied from interface:ILcdGXYContextReturns 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:
getDeltaXin 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 final int getDeltaY()Description copied from interface:ILcdGXYContextReturns 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:
getDeltaYin interfaceILcdGXYContext- Returns:
- the delta y value of the first input point, or 0 when
ILcdGXYContext.getInputPointCount()== 0. - See Also:
-
getDeltaY
Description copied from interface:ILcdGXYContextReturns 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:
getDeltaYin 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:
-
toString
-
getSnapTarget
Short for
getSnapTarget( 0 )When
getInputPointCount()== 0, this method will returnnull, whilegetSnapTarget( 0 )will throw anIndexOutOfBoundsException.- Specified by:
getSnapTargetin interfaceILcdGXYContext- 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.- Specified by:
getSnapTargetin 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())
-
setSnapTarget
Short forsetSnapTarget( aSnapTarget, 0 )- Parameters:
aSnapTarget- the snap target
-
setSnapTarget
Sets the snap target at index
aIndex. Do not forget to set the ILcdGXYLayer containing the object.The number of snap targets will automatically be increased when
aIndex>=getInputPointCount().- Parameters:
aSnapTarget- the snap targetaIndex- the index- See Also:
-
getSnapTargetLayer
Short for
getSnapTargetLayer( 0 )When
getInputPointCount()== 0, this method will returnnull, whilegetSnapTarget( 0 )will throw anIndexOutOfBoundsException.- Specified by:
getSnapTargetLayerin interfaceILcdGXYContext- Returns:
- the layer of the first snap target, or
nullwhen no snap target is available
-
getSnapTargetLayer
Returns the
ILcdGXYLayerof the snap target at indexaIndex.- Specified by:
getSnapTargetLayerin interfaceILcdGXYContext- 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())
-
setSnapTargetLayer
Short forsetSnapTargetLayer( aSnapTargetLayer, 0 )- Parameters:
aSnapTargetLayer- the layer of the first snap target
-
setSnapTargetLayer
Sets the
ILcdGXYLayerof the snap target at indexaIndex. Do not forget to set the correspondingsnap target.- Parameters:
aSnapTargetLayer- the layeraIndex- the index- See Also:
-
getSensitivity
public final int getSensitivity()This method returns the sensitivity that should be used for painting and editing purposes. If this method returns a value smaller than zero, the painter/editor can choose the sensitivity to use.Note: by default this method will return -1. If you want to define your own sensitivity, you should call
setSensitivity(int).- Specified by:
getSensitivityin interfaceILcdGXYContext- Returns:
- the sensitivity for painting/editing purposes or a value smaller than zero if the sensitivity should be chosen by the painter/editor.
- See Also:
-
setSensitivity
public final void setSensitivity(int aSensitivity) This method sets the sensitivity that should be used for painting and editing purposes. A value smaller than zero means the painters/editors are responsible for choosing a sensitivity.- Parameters:
aSensitivity- the sensitivity for painting/editing purposes or a value smaller than zero if the sensitivity should be chosen by the painter/editor.- See Also:
-
getDPIScale
public double getDPIScale()Returns the DPI scaling factor for the view that is being rendered. The return value is typically greater than or equal to 1.0, with 1.0 indicating that no scaling is performed. Please refer toILcdGXYViewfor additional information about high DPI rendering support in GXY views.- Returns:
- the DPI scaling factor for the view that is being rendered
- Throws:
IllegalStateException- when there is no view configured on this context- Since:
- 2019.0
-
clone
Description copied from interface:ILcdCloneableMakes
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:
clonein interfaceILcdCloneable- Overrides:
clonein classObject- See Also:
-