de.lmu.ifi.dbs.elki.visualization.visualizers.vis2d
Class SelectionToolCubeVisualization<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.SelectionToolCubeVisualization<NV>
Type Parameters:
NV - Type of the NumberVector being visualized.
All Implemented Interfaces:
ResultListener, DragableArea.DragListener, ContextChangeListener, Visualization, EventListener

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

Tool-Visualization for the tool to select ranges


Nested Class Summary
static class SelectionToolCubeVisualization.Factory<NV extends NumberVector<NV,?>>
          Factory for tool visualizations for selecting ranges and the inclosed objects
 
Field Summary
private static String CSS_RANGEMARKER
          Generic tag to indicate the type of element.
private  int dim
          Dimension
private  Element etag
          Element for the rectangle to add listeners
protected static Logging logger
          The logger for this class.
private static String NAME
          A short name characterizing this Visualizer.
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
SelectionToolCubeVisualization(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.
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(Projection proj, org.w3c.dom.svg.SVGPoint p1, org.w3c.dom.svg.SVGPoint p2)
          Update the selection in the context.
private  void updateSelectionRectKoordinates(double x1, double x2, double y1, double y2, DoubleDoublePair[] ranges)
          Set the selected ranges and the mask for the actual dimensions 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

logger

protected static final Logging logger
The logger for this class.


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
Generic tag to indicate the type of element. Used in IDs, CSS-Classes etc.

See Also:
Constant Field Values

dim

private int dim
Dimension


rtag

private Element rtag
Element for selection rectangle


etag

private Element etag
Element for the rectangle to add listeners

Constructor Detail

SelectionToolCubeVisualization

public SelectionToolCubeVisualization(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

updateSelectionRectKoordinates

private void updateSelectionRectKoordinates(double x1,
                                            double x2,
                                            double y1,
                                            double y2,
                                            DoubleDoublePair[] ranges)
Set the selected ranges and the mask for the actual dimensions in the context

Parameters:
x1 - x-value of the first dimension
x2 - x-value of the second dimension
y1 - y-value of the first dimension
y2 - y-value of the second dimension

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

updateSelection

private void updateSelection(Projection proj,
                             org.w3c.dom.svg.SVGPoint p1,
                             org.w3c.dom.svg.SVGPoint p2)
Update the selection in the context.

Parameters:
proj - The projection
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)