de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d
Class SelectionToolDotVisualization<NV extends NumberVector<NV,?>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisualization
      extended by de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d.P2DVisualization<NV>
          extended by de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d.SelectionToolDotVisualization<NV>
Type Parameters:
NV - vector type
All Implemented Interfaces:
ResultListener, DragableArea.DragListener, ContextChangeListener, Visualization, EventListener

public class SelectionToolDotVisualization<NV extends NumberVector<NV,?>>
extends P2DVisualization<NV>
implements DragableArea.DragListener

Tool-Visualization for the tool to select objects


Nested Class Summary
static class SelectionToolDotVisualization.Factory<NV extends NumberVector<NV,?>>
          Factory for tool visualizations for selecting objects
private static class SelectionToolDotVisualization.Mode
          Input modes
 
Field Summary
private static String CSS_RANGEMARKER
          CSS class of the selection rectangle while selecting.
(package private)  Element etag
          Element for the rectangle to add listeners
private static String NAME
          A short name characterizing this Visualizer.
(package private)  Element rtag
          Element for selection rectangle
 
Fields inherited from class de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d.P2DVisualization
proj, rel
 
Fields inherited from class de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisualization
context, layer, pendingRedraw, svgp, task
 
Constructor Summary
SelectionToolDotVisualization(VisualizationTask task)
          Constructor.
 
Method Summary
protected  void addCSSClasses(SVGPlot svgp)
          Adds the required CSS-Classes
 void contextChanged(ContextChangedEvent e)
          Method called on context changes (e.g. projection changes).
private  void deleteChildren(Element container)
          Delete the children of the element
 void destroy()
          Destroy the visualization.
 boolean duringDrag(org.w3c.dom.svg.SVGPoint startPoint, org.w3c.dom.svg.SVGPoint dragPoint, Event evt, boolean inside)
          Method called during drags.
 boolean endDrag(org.w3c.dom.svg.SVGPoint startPoint, org.w3c.dom.svg.SVGPoint dragPoint, Event evt, boolean inside)
          Method called when a drag was ended.
private  SelectionToolDotVisualization.Mode getInputMode(Event evt)
          Get the current input mode, on each mouse event.
protected  void redraw()
          Perform a full redraw.
 boolean startDrag(org.w3c.dom.svg.SVGPoint startPoint, Event evt)
          Action to do on drag start.
private  void updateSelection(SelectionToolDotVisualization.Mode mode, Projection2D proj, org.w3c.dom.svg.SVGPoint p1, org.w3c.dom.svg.SVGPoint p2)
          Updates the selection in the context.
 
Methods inherited from class de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d.P2DVisualization
setupCanvas
 
Methods inherited from class de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisualization
getHeight, getLayer, getWidth, incrementalRedraw, resultAdded, resultChanged, resultRemoved, synchronizedRedraw, testRedraw
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

private static final String NAME
A short name characterizing this Visualizer.

See Also:
Constant Field Values

CSS_RANGEMARKER

private static final String CSS_RANGEMARKER
CSS class of the selection rectangle while selecting.

See Also:
Constant Field Values

rtag

Element rtag
Element for selection rectangle


etag

Element etag
Element for the rectangle to add listeners

Constructor Detail

SelectionToolDotVisualization

public SelectionToolDotVisualization(VisualizationTask task)
Constructor.

Parameters:
task - Task
Method Detail

destroy

public void destroy()
Description copied from interface: Visualization
Destroy the visualization. Called after the elements have been removed from the document. Implementations should remove their listeners etc.

Specified by:
destroy in interface Visualization
Overrides:
destroy in class AbstractVisualization

contextChanged

public void contextChanged(ContextChangedEvent e)
Description copied from interface: ContextChangeListener
Method called on context changes (e.g. projection changes). Usually, this should trigger a redraw!

Specified by:
contextChanged in interface ContextChangeListener
Overrides:
contextChanged in class AbstractVisualization
Parameters:
e - Change event

redraw

protected void redraw()
Description copied from class: AbstractVisualization
Perform a full redraw.

Specified by:
redraw in class AbstractVisualization

deleteChildren

private void deleteChildren(Element container)
Delete the children of the element

Parameters:
container - SVG-Element

startDrag

public boolean startDrag(org.w3c.dom.svg.SVGPoint startPoint,
                         Event evt)
Description copied from interface: DragableArea.DragListener
Action to do on drag start.

Specified by:
startDrag in interface DragableArea.DragListener
Parameters:
startPoint - Point where the drag was started.
evt - The event object
Returns:
true to start the drag operation

duringDrag

public boolean duringDrag(org.w3c.dom.svg.SVGPoint startPoint,
                          org.w3c.dom.svg.SVGPoint dragPoint,
                          Event evt,
                          boolean inside)
Description copied from interface: DragableArea.DragListener
Method called during drags.

Specified by:
duringDrag in interface DragableArea.DragListener
Parameters:
startPoint - Drag starting point
dragPoint - Drag end point
evt - The event object
inside - Inside the tracked element
Returns:
true to continue the drag

endDrag

public boolean endDrag(org.w3c.dom.svg.SVGPoint startPoint,
                       org.w3c.dom.svg.SVGPoint dragPoint,
                       Event evt,
                       boolean inside)
Description copied from interface: DragableArea.DragListener
Method called when a drag was ended.

Specified by:
endDrag in interface DragableArea.DragListener
Parameters:
startPoint - Drag starting point
dragPoint - Drag end point
evt - The event object
inside - Whether the end point was inside the area
Returns:
true to complete the drag

getInputMode

private SelectionToolDotVisualization.Mode getInputMode(Event evt)
Get the current input mode, on each mouse event.

Parameters:
evt - Mouse event.
Returns:
current input mode

updateSelection

private void updateSelection(SelectionToolDotVisualization.Mode mode,
                             Projection2D proj,
                             org.w3c.dom.svg.SVGPoint p1,
                             org.w3c.dom.svg.SVGPoint p2)
Updates the selection in the context.

Parameters:
mode - Input mode
proj -
p1 - first point of the selected rectangle
p2 - second point of the selected rectangle

addCSSClasses

protected void addCSSClasses(SVGPlot svgp)
Adds the required CSS-Classes

Parameters:
svgp - SVG-Plot

Release 0.4.0 (2011-09-20_1324)