Class TLspPointSetHandle


public class TLspPointSetHandle extends ALspEditHandle
Base implementation of a handle that allows a point to be set with a single click. The handle will set one single point and will deactivate itself after the mouse has been released, or the touch device no longer registers the tracked finger.

When using mouse events, this handle consumes a series of MOUSE_PRESSED, MOUSE_DRAGGED, MOUSE_RELEASED and MOUSE_CLICKED events.

When using touch events, this handle is consumes as series of DOWN, MOVED and UP events.

This handle produces move operations where the target position is set to the model coordinates of the position where the handle was dragged. The start position is set to null.

This handle is useful for creation. It can for example be used to place the first control point of an arc.

Since:
2012.0
  • Constructor Details

    • TLspPointSetHandle

      public TLspPointSetHandle(Object aGeometry, ILcdPoint aPoint, ILcdModelReference aPointReference)
      Creates a new handle for the given geometry
      Parameters:
      aGeometry - the geometry that is edited by this handle. This value is not used directly by this handle, other than in the ALspEditHandle.getGeometry() method. Null is an acceptable value.
      aPoint - the point associated with this handle. This point is always re-evaluated, so changing this point internally also modifies this handle. This makes it easy to tie this handle to a point in a pointlist for example.
      aPointReference - the reference of the given point, or null if this point is interpreted in view coordinates.
  • Method Details

    • getPoint

      public ILcdPoint getPoint()
      Returns the point that is set using this handle. This point is always re-evaluated, so changing this point internally also modifies this handle. This makes it easy to tie this handle to a point in a pointlist for example.
      Returns:
      the point that is set using this handle.
    • getPointReference

      public ILcdModelReference getPointReference()
      Returns the reference in which the handle point is defined.
      Returns:
      the reference in which the handle point is defined
    • createEditHandleResult

      protected TLspEditHandleResult createEditHandleResult(ILcdPoint aViewPoint, AWTEvent aProcessedEvent, ELspInteractionStatus aInteractionStatus, TLspEditContext aEditContext)
      Deprecated.
      This method has been deprecated in favor of createEditHandleResult, which performs the same work but offers additional context information on the original event used to generate the view point.
      This method is called when a new point has been calculated correctly. It can be overridden to customize the edit handle result. By default it creates a result of type MOVE with move descriptor that contains the given new point as the target point and null as the start point.
      Parameters:
      aViewPoint - the view point from the event which triggered the call to this method.
      aProcessedEvent - the awt event that is the result of having handled the original awt event. This is null if the event was fully consumed, the original event if the event was not consumed, or a new AWTEvent containing a partially consumed state.
      aInteractionStatus - the interaction status.
      aEditContext - the edit context.
      Returns:
      an edit handle result
    • createEditHandleResult

      protected TLspEditHandleResult createEditHandleResult(ILcdPoint aViewPoint, AWTEvent aOriginalEvent, AWTEvent aProcessedEvent, ELspInteractionStatus aInteractionStatus, TLspEditContext aEditContext)
      This method is called when a new point has been calculated correctly. It can be overridden to customize the edit handle result. By default it creates a result of type MOVE with move descriptor that contains the given new point as the target point and null as the start point.
      Parameters:
      aViewPoint - the view point from the event which triggered the call to this method.
      aOriginalEvent - the original event
      aProcessedEvent - the awt event that is the result of having handled the original awt event. This is null if the event was fully consumed, the original event if the event was not consumed, or a new AWTEvent containing a partially consumed state.
      aInteractionStatus - the interaction status.
      aEditContext - the edit context.
      Returns:
      an edit handle result
    • createEditHandleResultFX

      protected TLspEditHandleResultFX createEditHandleResultFX(ILcdPoint aViewPoint, Event aOriginalEvent, Event aProcessedEvent, ELspInteractionStatus aInteractionStatus, TLspEditContext aEditContext)
      Parameters:
      aViewPoint - the view point from the event which triggered the call to this method.
      aOriginalEvent - the original event
      aProcessedEvent - the event that is the result of having handled the original event. This is null if the event was fully consumed, the original event if the event was not consumed, or a new Event containing a partially consumed state.
      aInteractionStatus - the interaction status.
      aEditContext - the edit context.
      Returns:
      an edit handle result
      Since:
      2020.0
    • isActive

      public boolean isActive()
      Checks whether this handle is active. When a handle is active, it will be the first candidate to receive events. If a handle is inactive, it might still receive events (possibly making it active) if all other active handles didn't process an event.

      By default, this method returns true when constructed, and returns false after a MOUSE_RELEASED event (UP event for touch).

      Specified by:
      isActive in class ALspHandle
      Returns:
      true if active, false otherwise
    • handleAWTEvent

      public TLspEditHandleResult handleAWTEvent(AWTEvent aEvent, TLspEditContext aEditContext)
      Handle the given input event for the given edit context. The edit handle can choose the operation to perform based on the type and state of the input event.

      When the edit handle has processed the input event, this method will return a edit handle result containing a null event to indicate that the event has been consumed. Note that sometimes an event might be partially consumed (which is often the case with touch events), in which case this method will return an edit handle result with an altered version of the given input event.

      If incoming event should be ignored, this method should return a TLspEditHandleResult without any edit operations, and an unconsumed AWTEvent. An unconsumed AWTEvent means that it should contain the original, unmodified aEvent parameter passed to this method. This result indicates that the event was not consumed, and that some other object needs to consume the event instead.

      As a side effect, a handle is allowed to activate or deactivate itself as a result of processing an input event.

      By default, this method returns a handle result without operations for MOUSE_PRESSED, MOUSE_DRAGGED and MOUSE_CLICKED events (DOWN and MOVED events for touch). For MOUSE_RELEASED events (of UP events in case of touch), it returns a MOVE operation, with the target point of the move descriptor set to the model position where the mouse was dragged.

      Specified by:
      handleAWTEvent in class ALspEditHandle
      Parameters:
      aEvent - the input event
      aEditContext - the edit context, containing, amongst others, information about the layer for which this handle is operating, the view, the object for which this handle was created, the geometry that this handle was created for, the paint representation in which geometry exists, and the sensitivity with which the event should be handled
      Returns:
      an edit handle result containing a collection of operations to perform, and the (partially) consumed event object. The handle result itself should not be null.
      See Also:
    • handleFXEvent

      public TLspEditHandleResultFX handleFXEvent(Event aEvent, TLspEditContext aEditContext)
      Overrides:
      handleFXEvent in class ALspEditHandle
      Parameters:
      aEvent - the input event
      aEditContext - the edit context, containing, amongst others, information about the layer for which this handle is operating, the view, the object for which this handle was created, the geometry that this handle was created for, the paint representation in which geometry exists, and the sensitivity with which the event should be handled
      Returns:
      an edit handle result containing a collection of operations to perform, and the (partially) consumed event object. The handle result itself should not be null.
      Since:
      2020.0
    • getStyleTargetProviders

      public List<ALspStyleTargetProvider> getStyleTargetProviders(TLspHandleGeometryType aType)
      Returns a style target provider that can generate geometry for the given visual editing component type, or an empty list if no geometry can be generated for the given type. TLspEditHandleStyler allows you to register different styles for each visual component type.

      By default, this method returns a style target provider for POINT types, returning the point associated with this handle.

      Specified by:
      getStyleTargetProviders in class ALspHandle
      Parameters:
      aType - a visual editing component type
      Returns:
      a list of style target providers, or an empty list if no style targets can be created for the given visual editing component type