Class TLcdGXYEditControllerModel2
- All Implemented Interfaces:
ILcdUndoableSource
TLcdGXYEditControllerModel2
contains the input-independent logic for
editing objects on an ILcdGXYView
.
It encapsulates what is edited, how it is edited, how the editing is
visualized and how edits are applied.
The most important concepts of this class are the following:
- editHowMode
editWhatMode
editingCandidates
paintEditing
applyEdit
EDIT_HOW
for all possibilities.
This is typically input-dependent and should be determined by the controller.
The editWhatMode defines what should be edited: the objects themselves, or
their labels? Please refer to the constants that start with
EDIT_WHAT
for all possibilities.
The editingCandidates are those objects that are involved in the editing
process. The method takes into account the modes to define the involved
objects. If it is for example asked to return the editing candidates for a
EDIT_WHAT_LABELS
mode, it only returns objects that have labels
next to them.
While the edit process is ongoing (e.g., the user is performing a drag), the
objects are not edited all the time, they are just painted in their temporary
state. The method paintEditing takes care of this. This method is typically
invoked often (e.g., on mouse drag) while the edit process is ongoing.
Once the edit is complete, the method applyEdit performs the actual edit
operation to the editing candidates. It delegates the real work to the ILcdGXYEditor
s or the ILcdGXYLabelEditor
s of the editing
candidates, depending on the modes.
At all times - before an edit, during an edit or after an edit - the correct mouse
cursor is provided by the method mouseCursor
.
The edit operations, performed by applyEdit
, can be
undone, provided the ILcdGXYEditor
s and/or ILcdGXYLabelEditor
s to which the real work is delegated implement ILcdUndoableSource
as well, to indicate that they support undo. Please
refer to the developer guide for more information about undo.
The method snapTarget
returns the target to snap the
edited objects to. Please refer to the developer guide for an overview
of snapping.
This edit controller model supports body label editing, see TLcdLabelLocation.isBodyLabel()
.
When a body label is translated (EDIT_HOW_TRANSLATING
), its domain object is translated
instead. When a body label is reshaped (EDIT_HOW_RESHAPING
), it is translated instead.
This is done by calling the ILcdGXYLabelEditor
with the
ILcdGXYLabelEditor.TRANSLATED
mode instead of
ILcdGXYLabelEditor.RESHAPED
.
Subclasses can override these methods to alter their behavior. They can also
introduce new modes, but care should be taken to override all methods, so
that they all know how to handle this new mode (calling super
with an existing mode could be useful). Integer constants used for those new
modes should be greater than or equal to 1 << 25
.
Note: editing labels is only supported if:
- The label painter implements
ILcdGXYLabelPainter2
(not justILcdGXYLabelPainter
) - The layer implements
ILcdGXYEditableLabelsLayer
- An
ILcdGXYLabelEditor
is set to the layer.
- Since:
- 7.0
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Object representing all needed information about a snap target. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
Mode defining that no changes should be made.static final int
Mode defining that editing should reshape the editing candidates.static final int
Mode defining that editing should translate the editing candidates.static final int
Mode defining that editing (e.g., translating or reshaping) should act on the first touched label only.static final int
Mode defining that editing (e.g., translating or reshaping) should act on the labels.static final int
Mode defining that no changes should be made.static final int
Mode defining that editing (e.g., translating or reshaping) should act on the objects (e.g., the points, polylines, ...). -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addUndoableListener
(ILcdUndoableListener aListener) Adds a listener to this source, so this listener is notified when something undoable has happened.boolean
applyEdit
(ILcdGXYView aGXYView, ILcdGXYLayerSubsetList aSnappables, Point aFrom, Point aTo, MouseEvent aMouseEvent, int aEditHow, int aEditWhat, ILcdGXYLayerSubsetList aEditingCandidates) Applies the edit to every object of the given subset, by delegating the real work toILcdGXYEditor.edit
with the modeTRANSLATED
(orRESHAPED
if aEditHow isEDIT_HOW_RESHAPING
).boolean
applyEdit
(ILcdGXYView aGXYView, ILcdGXYLayerSubsetList aSnappables, List<Point> aFrom, List<Point> aTo, int aEditHow, int aEditWhat, ILcdGXYLayerSubsetList aEditingCandidates) Applies the edit to every object of the given subset, by delegating the real work toILcdGXYEditor.edit
with the modeTRANSLATED
(orRESHAPED
ifaEditHow
isEDIT_HOW_RESHAPING
).protected TLcdCompositeUndoable
Deprecated.protected TLcdCompositeUndoable
createSingleObjectUndoable
(Object aDomainObject, ILcdGXYLayer aLayer, ILcdGXYView aGXYView, Point aFrom, Point aTo, MouseEvent aMouseEvent, int aEditHow, int aEditWhat, ILcdGXYLayerSubsetList aEditingCandidates) Creates the composite undoable that will wrap all the undoables generated by a singleILcdGXYEditor
for a single domain object.protected TLcdCompositeUndoable
createTotalOperationUndoable
(ILcdGXYView aGXYView, Point aFrom, Point aTo, MouseEvent aMouseEvent, int aEditHow, int aEditWhat, ILcdGXYLayerSubsetList aEditingCandidates) Creates the composite undoable that will wrap all undoables generated by all the underlying editors for all the edited domain objects.static String
editHowAsString
(int aEditHow) Utility method that converts the given edit-how mode to a human readable string.int
editHowMode
(ILcdGXYView aGXYView, ILcdGXYLayerSubsetList aSnappables, Point aFrom, Point aTo, MouseEvent aMouseEvent) Deprecated.The controllers themselves should be responsible for specifying the edit how mode, mainly because it is very dependent on the kind of input device.editingCandidates
(ILcdGXYView aGXYView, ILcdGXYLayerSubsetList aSnappables, Point aFrom, Point aTo, MouseEvent aMouseEvent, int aEditHow, int aEditWhat) Returns the set of candidates for editing, respecting the given modes.static String
editWhatAsString
(int aEditWhat) Utility method that converts the given edit-what mode to a human readable string.int
editWhatMode
(ILcdGXYView aGXYView, ILcdGXYLayerSubsetList aSnappables, Point aFrom, Point aTo, MouseEvent aMouseEvent, int aEditHow) Deprecated.The controllers themselves should be responsible for any dependency on InputEvents of the edit-what modeprotected void
fireUndoableHappened
(ILcdUndoable aUndoable) Notify all undoable listeners thataUndoable
has happened.int
This method returns the sensitivity that will be used when editing objects or labels.boolean
Deprecated.This method has been deprecated.mouseCursor
(ILcdGXYView aGXYView, ILcdGXYLayerSubsetList aSnappables, Point aFrom, Point aTo, MouseEvent aMouseEvent, int aEditHow, int aEditWhat, ILcdGXYLayerSubsetList aEditingCandidates) Returns the desired cursor for the given parameters.void
paintEditing
(Graphics aGraphics, ILcdGXYView aGXYView, ILcdGXYLayerSubsetList aSnappables, Point aFrom, Point aTo, MouseEvent aMouseEvent, int aEditHow, int aEditWhat, ILcdGXYLayerSubsetList aEditingCandidates) Paints the given set of edit candidates in their temporary editing state.void
removeUndoableListener
(ILcdUndoableListener aListener) Removes the specified listener so it is no longer notified.static void
setClassTraceOn
(boolean aClassTraceOn) Deprecated.This method has been deprecated.void
setSensitivity
(int aSensitivity) This method sets the sensitivity that should be used by painters/editors to determine which object (or part of the object) is edited by the input device (usually the mouse).void
setStringTranslator
(ILcdStringTranslator aStringTranslator) Sets theILcdStringTranslator
that this controller model should use to translate theStrings
that will be visible in the user interface.void
setTraceOn
(boolean aTraceOn) Deprecated.This method has been deprecated.snapTarget
(ILcdGXYView aGXYView, ILcdGXYLayerSubsetList aSnappables, Point aFrom, Point aTo, MouseEvent aMouseEvent, int aEditHow, int aEditWhat, Object aObjectToSnap, ILcdGXYLayer aObjectToSnapGXYLayer) Tries to retrieve a snap target from the given aSnappables.
-
Field Details
-
EDIT_HOW_RESHAPING
public static final int EDIT_HOW_RESHAPINGMode defining that editing should reshape the editing candidates. What exactly reshaping means is up to the implementations ofILcdGXYEditor
andILcdGXYLabelEditor
. -
EDIT_HOW_TRANSLATING
public static final int EDIT_HOW_TRANSLATINGMode defining that editing should translate the editing candidates. What exactly translating means is up to the implementations ofILcdGXYEditor
andILcdGXYLabelEditor
. -
EDIT_HOW_NO_CHANGE
public static final int EDIT_HOW_NO_CHANGEMode defining that no changes should be made. -
EDIT_WHAT_OBJECTS
public static final int EDIT_WHAT_OBJECTSMode defining that editing (e.g., translating or reshaping) should act on the objects (e.g., the points, polylines, ...). -
EDIT_WHAT_LABELS
public static final int EDIT_WHAT_LABELSMode defining that editing (e.g., translating or reshaping) should act on the labels. -
EDIT_WHAT_FIRST_TOUCHED_LABEL
public static final int EDIT_WHAT_FIRST_TOUCHED_LABELMode defining that editing (e.g., translating or reshaping) should act on the first touched label only. This is especially useful when objects have multiple labels, that should be edited independently. -
EDIT_WHAT_NO_CHANGE
public static final int EDIT_WHAT_NO_CHANGEMode defining that no changes should be made.
-
-
Constructor Details
-
TLcdGXYEditControllerModel2
public TLcdGXYEditControllerModel2()Default constructor
-
-
Method Details
-
setClassTraceOn
public static void setClassTraceOn(boolean aClassTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for all instances of this class. If the argument istrue
then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.- Parameters:
aClassTraceOn
- if true then all log messages are recorded, otherwise only the informative, warning and error messages are recorded.
-
setTraceOn
public void setTraceOn(boolean aTraceOn) Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Enables tracing for this class instance. Calling this method with eithertrue
orfalse
as argument automatically turns off tracing for all other class instances for whichsetTraceOn
has not been called. If the argument isfalse
then only the informative, warning and error log messages are recorded.- Parameters:
aTraceOn
- if true then all log messages are recorded for this instance. If false, then only the informative, warning and error log messages are recorded.
-
isTraceOn
public boolean isTraceOn()Deprecated.This method has been deprecated. It is recommended to use the standard Java logging framework directly.Returnstrue
if tracing is enabled for this class.- Returns:
- true if tracing is enabled for this class, false otherwise.
-
createCompositeUndoable
Deprecated.OverridecreateTotalOperationUndoable(com.luciad.view.gxy.ILcdGXYView, java.awt.Point, java.awt.Point, java.awt.event.MouseEvent, int, int, com.luciad.view.gxy.ILcdGXYLayerSubsetList)
. That method provides more useful parameters.Creates the composite undoable that will wrap all undoables generated by the underlying editors. This default implementation returns a TLcdCompositeUndoable with the display name "Edit Objects", translated with the setILcdStringTranslator
.- Returns:
- The composite undoable that will be fired when the edit operation is complete.
-
editHowMode
public int editHowMode(ILcdGXYView aGXYView, ILcdGXYLayerSubsetList aSnappables, Point aFrom, Point aTo, MouseEvent aMouseEvent) Deprecated.The controllers themselves should be responsible for specifying the edit how mode, mainly because it is very dependent on the kind of input device.Returns the edit-how mode. This mode indicates how the edit should behave: should the editing candidates be translated or reshaped? It returnsEDIT_HOW_RESHAPING
if ctrl is pressed,EDIT_HOW_TRANSLATING
if no modifiers are pressed, andEDIT_HOW_NO_CHANGE
otherwise. Please note that the actual meaning of reshaping and translating is defined by the implementation ofILcdGXYPainter/ILcdGXYEditor
that is used.- Parameters:
aGXYView
- TheILcdGXYView
, provided as contextual information.aSnappables
- The list of potential snapping candidates, provided as contextual information.aFrom
- The point where the edit originated.aTo
- The point where the edit terminated (so far).aMouseEvent
- The last mouse event that was involved in the edit process.- Returns:
- One of the constants in this class that start with
EDIT_HOW
. - See Also:
-
editWhatMode
public int editWhatMode(ILcdGXYView aGXYView, ILcdGXYLayerSubsetList aSnappables, Point aFrom, Point aTo, MouseEvent aMouseEvent, int aEditHow) Deprecated.The controllers themselves should be responsible for any dependency on InputEvents of the edit-what modeReturns the edit-what mode. This mode indicates what the edit should do: should the labels be edited, or the objects themselves? If the left mouse button is used, returnsEDIT_WHAT_OBJECTS
if the objects are touched for aFrom, andEDIT_WHAT_LABELS
if the labels are touched for aFrom. If the mouse event is a mouse moved event, the test on the mouse button is skipped. So for that case, it returns what would happen if a button would be pressed. In all other cases,EDIT_WHAT_NO_CHANGE
is returned. Touched is defined asILcdGXYPainter.isTouched(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
orILcdGXYLabelPainter2.isLabelTouched(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
.- Parameters:
aGXYView
- TheILcdGXYView
, provided as contextual information.aSnappables
- The list of potential snapping candidates, provided as contextual information.aFrom
- The point where the edit originated.aTo
- The point where the edit terminated (so far).aMouseEvent
- The last mouse event that was involved in the edit process.aEditHow
- The edit-how mode: one of the constants in this class that start withEDIT_HOW
. For example the result of the methodeditHowMode
.- Returns:
- one of the constants in this class that start with
EDIT_WHAT
. - See Also:
-
paintEditing
public void paintEditing(Graphics aGraphics, ILcdGXYView aGXYView, ILcdGXYLayerSubsetList aSnappables, Point aFrom, Point aTo, MouseEvent aMouseEvent, int aEditHow, int aEditWhat, ILcdGXYLayerSubsetList aEditingCandidates) Paints the given set of edit candidates in their temporary editing state. The real painting work is delegated to
ILcdGXYPainter.paint
with the modeILcdGXYPainter.TRANSLATING
orILcdGXYPainter.RESHAPING
, depending on aEditHow. Similarly for labels, the work is delegated toILcdGXYLabelPainter2.paintLabel
with the modeILcdGXYLabelPainter2.TRANSLATING
orILcdGXYLabelPainter2.RESHAPING
.When either the
aEditHow
isEDIT_HOW_NO_CHANGE
oraEditWhat
isEDIT_WHAT_NO_CHANGE
, this method will do nothing.- Parameters:
aGraphics
- The graphics to draw on.aGXYView
- TheILcdGXYView
, provided as contextual information.aSnappables
- The list of potential snapping candidates, provided as contextual information.aFrom
- The point where the edit originated.aTo
- The point where the edit terminated (so far).aMouseEvent
- The last mouse event that was involved in the edit process. You can passnull
if another input device is used.aEditHow
- The edit-how mode: one of the constants in this class that start withEDIT_HOW
. For example the result of the methodeditHowMode
.aEditWhat
- The edit-what mode: one of the constants in this class that start withEDIT_WHAT
. For example the result of the methodeditWhatMode
.aEditingCandidates
- The objects (and their corresponding layers) that are being edited.
-
editingCandidates
public ILcdGXYLayerSubsetList editingCandidates(ILcdGXYView aGXYView, ILcdGXYLayerSubsetList aSnappables, Point aFrom, Point aTo, MouseEvent aMouseEvent, int aEditHow, int aEditWhat) Returns the set of candidates for editing, respecting the given modes. ForEDIT_HOW_TRANSLATING
, the candidates are those objects that are selected, visible and editable on the givenILcdGXYView
. If, for these candidates, an object handle is touched, only the object to which the touched handle belongs is returned, otherwise all candidates are returned. ForEDIT_HOW_RESHAPING
andEDIT_WHAT_FIRST_TOUCHED_LABEL
, it returns the first selected object that is visible, editable and touched. Touched is defined asILcdGXYPainter.isTouched(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
orILcdGXYLabelPainter2.isLabelTouched(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
, depending on aEditWhat.- Parameters:
aGXYView
- TheILcdGXYView
, provided as contextual information.aSnappables
- The list of potential snapping candidates, provided as contextual information.aFrom
- The point where the edit originated.aTo
- The point where the edit terminated (so far).aMouseEvent
- The last mouse event that was involved in the edit process. You can pass null if another input device is used.aEditHow
- The edit-how mode: one of the constants in this class that start withEDIT_HOW
. For example the result of the methodeditHowMode
.aEditWhat
- The edit-what mode: one of the constants in this class that start withEDIT_WHAT
. For example the result of the methodeditWhatMode
.- Returns:
- This list of editing candidates. This list can be empty, but
never
null
.
-
applyEdit
public boolean applyEdit(ILcdGXYView aGXYView, ILcdGXYLayerSubsetList aSnappables, Point aFrom, Point aTo, MouseEvent aMouseEvent, int aEditHow, int aEditWhat, ILcdGXYLayerSubsetList aEditingCandidates) Applies the edit to every object of the given subset, by delegating the real work toILcdGXYEditor.edit
with the modeTRANSLATED
(orRESHAPED
if aEditHow isEDIT_HOW_RESHAPING
). Note that the actual meaning of reshaping and translating is defined by the implementation ofILcdGXYPainter/ILcdGXYEditor
that is used. Similarly editing labels is delegated toILcdGXYLabelEditor.editLabel
with the modeILcdGXYLabelEditor.TRANSLATED
orILcdGXYLabelEditor.RESHAPED
. This method has no effect if aEditHow isEDIT_HOW_NO_CHANGE
or if aEditWhat isEDIT_WHAT_NO_CHANGE
. After all objects/labels are edited, the needed model changed events and label location changed events are fired. After the edit is completed, anTLcdUndoableEvent
is fired to the registeredlisteners
if any undo information was provided by theILcdGXYEditor
s orILcdGXYLabelEditor
s to which the real work is delegated. They can do so by implementing theILcdUndoableSource
interface and by firing anTLcdUndoableEvent
when theiredit
oreditLabel
method is invoked. The undoable event this class sends out to its listeners is acomposite undoable
composed of all the events send out by theILcdGXYEditor
s orILcdGXYLabelEditor
s.- Parameters:
aGXYView
- TheILcdGXYView
, provided as contextual information.aSnappables
- The list of potential snapping candidates.aFrom
- The point where the edit originated.aTo
- The point where the edit terminated.aMouseEvent
- The last mouse event that was involved in the edit process.aEditHow
- The edit-how mode: one of the constants in this class that start withEDIT_HOW
. For example the result of the methodeditHowMode
.aEditWhat
- The edit-what mode: one of the constants in this class that start withEDIT_WHAT
. For example the result of the methodeditWhatMode
.aEditingCandidates
- The objects (and their corresponding layers) that need to be edited.- Returns:
- True if at least one object/label was modified, false otherwise.
-
createTotalOperationUndoable
protected TLcdCompositeUndoable createTotalOperationUndoable(ILcdGXYView aGXYView, Point aFrom, Point aTo, MouseEvent aMouseEvent, int aEditHow, int aEditWhat, ILcdGXYLayerSubsetList aEditingCandidates) Creates the composite undoable that will wrap all undoables generated by all the underlying editors for all the edited domain objects. This method is called from theapplyEdit
method. This default implementation returns aTLcdCompositeUndoable
with the display name "Edit Objects". Override this method if you want another name.- Parameters:
aGXYView
- The view for which the edit operation is being performed for which the undoable is created.aFrom
- The point where the edit originated.aTo
- The point where the edit terminated.aMouseEvent
- The last mouse event that was involved in the edit process. You can pass null if another input device is used.aEditHow
- The edit-how mode: one of the constants in this class that start withEDIT_HOW
. For example the result of the methodeditHowMode
.aEditWhat
- The edit-what mode: one of the constants in this class that start withEDIT_WHAT
. For example the result of the methodeditWhatMode
.aEditingCandidates
- The objects (and their corresponding layers) that need to be edited.- Returns:
- The composite undoable that will be fired when the edit operation is complete. Must not
be
null
.
-
createSingleObjectUndoable
protected TLcdCompositeUndoable createSingleObjectUndoable(Object aDomainObject, ILcdGXYLayer aLayer, ILcdGXYView aGXYView, Point aFrom, Point aTo, MouseEvent aMouseEvent, int aEditHow, int aEditWhat, ILcdGXYLayerSubsetList aEditingCandidates) Creates the composite undoable that will wrap all the undoables generated by a singleILcdGXYEditor
for a single domain object. This method is called from theapplyEdit
method. The default implementation returns aTLcdCompositeUndoable
with the display name"Edit " + String.valueOf(aDomainObject)
.- Parameters:
aDomainObject
- The domain object from the model which is being edited.aLayer
- The layer of the domain object which is being edited.aGXYView
- The view for which the edit operation is being performed for which the undoable is created.aFrom
- The point where the edit originated.aTo
- The point where the edit terminated.aMouseEvent
- The last mouse event that was involved in the edit process. You can pass null if another input device is used.aEditHow
- The edit-how mode: one of the constants in this class that start withEDIT_HOW
. For example the result of the methodeditHowMode
.aEditWhat
- The edit-what mode: one of the constants in this class that start withEDIT_WHAT
. For example the result of the methodeditWhatMode
.aEditingCandidates
- The objects (and their corresponding layers) that need to be edited.- Returns:
- The composite undoable that will be fired when the edit operation is complete. Must not
be
null
.
-
snapTarget
public TLcdGXYEditControllerModel2.SnapTargetInfo snapTarget(ILcdGXYView aGXYView, ILcdGXYLayerSubsetList aSnappables, Point aFrom, Point aTo, MouseEvent aMouseEvent, int aEditHow, int aEditWhat, Object aObjectToSnap, ILcdGXYLayer aObjectToSnapGXYLayer) Tries to retrieve a snap target from the given aSnappables. It does so by invokingsnapTarget
(orlabelSnapTarget
, depending on aEditWhat) on theILcdGXYPainter
s (orILcdGXYLabelPainter2
s) of the objects in aSnappables. If the snap target returned by one of those painters isaccepted
by theILcdGXYEditor
of aObjectToSnap, it is returned. When no snap target can be found this method returnsnull
.- Parameters:
aGXYView
- TheILcdGXYView
, provided as contextual information.aSnappables
- The list of potential snapping candidates.aFrom
- The point where the edit originated.aTo
- The point where the edit terminated (so far).aMouseEvent
- The last mouse event that was involved in the edit process. You can pass null if another input device is used.aEditHow
- The edit-how mode: one of the constants in this class that start withEDIT_HOW
. For example the result of the methodeditHowMode
.aEditWhat
- The edit-what mode: one of the constants in this class that start withEDIT_WHAT
. For example the result of the methodeditWhatMode
.aObjectToSnap
- the object that would like to snap to one of the candidates in aSnappables, so basically the object that is being edited.aObjectToSnapGXYLayer
- the layer whose model contains aObjectToSnap.- Returns:
- The snap info, or null if no snap target was found.
-
mouseCursor
public Cursor mouseCursor(ILcdGXYView aGXYView, ILcdGXYLayerSubsetList aSnappables, Point aFrom, Point aTo, MouseEvent aMouseEvent, int aEditHow, int aEditWhat, ILcdGXYLayerSubsetList aEditingCandidates) Returns the desired cursor for the given parameters. The mouse cursor is retrieved from theILcdGXYPainter/ILcdGXYLabelPainter2
of the touched object usinggetCursor
orgetLabelCursor
, depending on aEditWhat. As a result, the cursor can benull
if no specific cursor is needed. Touched is defined asILcdGXYPainter.isTouched(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
orILcdGXYLabelPainter2.isLabelTouched(java.awt.Graphics, int, com.luciad.view.gxy.ILcdGXYContext)
.- Parameters:
aGXYView
- TheILcdGXYView
, provided as contextual information.aSnappables
- The list of potential snapping candidates, provided as contextual information.aFrom
- The point where the edit originated.aTo
- The point where the edit terminated (so far).aMouseEvent
- The last mouse event that was involved in the edit process.aEditHow
- The edit-how mode: one of the constants in this class that start withEDIT_HOW
. For example the result of the methodeditHowMode
.aEditWhat
- The edit-what mode: one of the constants in this class that start withEDIT_WHAT
. For example the result of the methodeditWhatMode
.aEditingCandidates
- The objects (and their corresponding layers) that are being edited.- Returns:
- The desired cursor for the given parameters, or
null
if no specific cursor is needed.
-
editHowAsString
Utility method that converts the given edit-how mode to a human readable string. This method is intended for debugging or logging purposes.- Parameters:
aEditHow
- The edit how mode, one of the constants in this class that start withEDIT_HOW
.- Returns:
- A human readable string representation for the given edit-how mode.
-
editWhatAsString
Utility method that converts the given edit-what mode to a human readable string. This method is intended for debugging or logging purposes.- Parameters:
aEditWhat
- The edit what mode, one of the constants in this class that start withEDIT_WHAT
.- Returns:
- A human readable string representation for the given edit-what mode.
-
setStringTranslator
Sets the
ILcdStringTranslator
that this controller model should use to translate theStrings
that will be visible in the user interface.This method should be called before this editor is used. Any
Strings
already created by this controller model will not be translated with the specified translator.The following list of
Strings
are translated by the given instance:- "Edit Objects"
- "Edit {0}". The translated
String
is used as the pattern for aMessageFormat
. - "Model was unreferenced due to memory constraints."
- "Domain object was unreferenced due to memory constraints."
- Parameters:
aStringTranslator
- TheILcdStringTranslator
that should be used. Must not benull
.
-
addUndoableListener
Description copied from interface:ILcdUndoableSource
Adds a listener to this source, so this listener is notified when something undoable has happened.- Specified by:
addUndoableListener
in interfaceILcdUndoableSource
- Parameters:
aListener
- The listener to be notified when something undoable has happened.
-
removeUndoableListener
Description copied from interface:ILcdUndoableSource
Removes the specified listener so it is no longer notified.- Specified by:
removeUndoableListener
in interfaceILcdUndoableSource
- Parameters:
aListener
- The listener to remove.
-
fireUndoableHappened
Notify all undoable listeners thataUndoable
has happened.- Parameters:
aUndoable
- The undoable of which the listeners should be notified.
-
applyEdit
public boolean applyEdit(ILcdGXYView aGXYView, ILcdGXYLayerSubsetList aSnappables, List<Point> aFrom, List<Point> aTo, int aEditHow, int aEditWhat, ILcdGXYLayerSubsetList aEditingCandidates) Applies the edit to every object of the given subset, by delegating the real work to
ILcdGXYEditor.edit
with the modeTRANSLATED
(orRESHAPED
ifaEditHow
isEDIT_HOW_RESHAPING
). All input points are passed to theedit
method. Note that the actual meaning of reshaping and translating is defined by the implementation ofILcdGXYPainter/ILcdGXYEditor
that is used.Similarly editing labels is delegated to
ILcdGXYLabelEditor.editLabel
with the modeILcdGXYLabelEditor.TRANSLATED
orILcdGXYLabelEditor.RESHAPED
.This method will do nothing if
aEditHow
isEDIT_HOW_NO_CHANGE
or ifaEditWhat
isEDIT_WHAT_NO_CHANGE
, and just returnfalse
.After all objects/labels are edited, the needed model changed events and label location changed events are fired.
After the edit is completed, an
TLcdUndoableEvent
is fired to the registeredlisteners
if any undo information was provided by theILcdGXYEditor
s orILcdGXYLabelEditor
s to which the real work is delegated. They can do so by implementing theILcdUndoableSource
interface and by firing anTLcdUndoableEvent
when theiredit
oreditLabel
method is invoked. The undoable event this class sends out to its listeners is a composite undoable composed of all the events send out by theILcdGXYEditor
s orILcdGXYLabelEditor
s.- Parameters:
aGXYView
- TheILcdGXYView
, provided as contextual information.aSnappables
- The list of potential snapping candidates.aFrom
- A list with point(s) where the edit originated. Should have the same length asaTo
, and the order of the points in both lists should be the same, e.g. the location of the first point ofaFrom
when the edit terminated should be passed as the first point inaTo
.aTo
- A list with point(s) where the edit terminated (so far). Should have the same length asaFrom
, and the order of the points in both list should be the same, e.g. the location of the first point ofaFrom
when the edit terminated should be passed as the first point inaTo
.aEditHow
- The edit-how mode: one of the constants in this class that start withEDIT_HOW
.aEditWhat
- The edit-what mode: one of the constants in this class that start withEDIT_WHAT
. For example the result of the methodeditWhatMode
.aEditingCandidates
- The objects (and their corresponding layers) that need to be edited.- Returns:
- True if at least one object/label was modified, false otherwise.
-
getSensitivity
public int getSensitivity()This method returns the sensitivity that will be used when editing objects or labels. It indicates how far (in screen coordinates) the input location (mouse cursor, etc...) can be from the visual representation of an object or handle on the screen and still interact with it. This value will be passed to all created instances ofTLcdGXYContext
passed to the painters/editors.- Returns:
- the sensitivity to be used for painting/editing purposes.
- See Also:
-
setSensitivity
public void setSensitivity(int aSensitivity) This method sets the sensitivity that should be used by painters/editors to determine which object (or part of the object) is edited by the input device (usually the mouse).- Parameters:
aSensitivity
- the sensitivity that will be used for painting/editing purposes.- See Also:
-
createTotalOperationUndoable(com.luciad.view.gxy.ILcdGXYView, java.awt.Point, java.awt.Point, java.awt.event.MouseEvent, int, int, com.luciad.view.gxy.ILcdGXYLayerSubsetList)
.