de.lmu.ifi.dbs.elki.visualization.visualizers.optics
Class OPTICSPlotSelectionVisualization<D extends Distance<D>>

java.lang.Object
  extended by de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisualization
      extended by de.lmu.ifi.dbs.elki.visualization.visualizers.optics.AbstractOPTICSVisualization<D>
          extended by de.lmu.ifi.dbs.elki.visualization.visualizers.optics.OPTICSPlotSelectionVisualization<D>
Type Parameters:
D - distance type
All Implemented Interfaces:
ResultListener, DragableArea.DragListener, ContextChangeListener, Visualization, EventListener

public class OPTICSPlotSelectionVisualization<D extends Distance<D>>
extends AbstractOPTICSVisualization<D>
implements DragableArea.DragListener

Handle the marker in an OPTICS plot.


Nested Class Summary
static class OPTICSPlotSelectionVisualization.Factory
          Factory class for OPTICS plot selections.
private static class OPTICSPlotSelectionVisualization.Mode
          Input modes
 
Field Summary
protected static String CSS_MARKER
          CSS class for markers
protected static String CSS_RANGEMARKER
          CSS class for markers
private  Element etag
          Element for the events
private static Logging logger
          The logger for this class.
private  Element mtag
          Element for the marker
private static String NAME
          A short name characterizing this Visualizer.
 
Fields inherited from class de.lmu.ifi.dbs.elki.visualization.visualizers.optics.AbstractOPTICSVisualization
optics, plotheight, plotwidth
 
Fields inherited from class de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisualization
context, layer, pendingRedraw, svgp, task
 
Constructor Summary
OPTICSPlotSelectionVisualization(VisualizationTask task)
          Constructor.
 
Method Summary
private  void addCSSClasses()
          Adds the required CSS-Classes
 void addMarker()
          Add marker for the selected IDs to mtag
 Element addMarkerRect(double x1, double width)
          Create a rectangle as marker (Marker higher than plot!)
 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  OPTICSPlotSelectionVisualization.Mode getInputMode(Event evt)
          Get the current input mode, on each mouse event.
private  int getSelectedIndex(List<ClusterOrderEntry<D>> order, org.w3c.dom.svg.SVGPoint cPt)
          Gets the Index of the ClusterOrderEntry where the event occurred
protected  void redraw()
          Perform a full redraw.
 void resultChanged(Result current)
          Notify that the current result has changed substantially.
 boolean startDrag(org.w3c.dom.svg.SVGPoint startPoint, Event evt)
          Action to do on drag start.
protected  void updateSelection(OPTICSPlotSelectionVisualization.Mode mode, int begin, int end)
          Updates the selection for the given ClusterOrderEntry.
 
Methods inherited from class de.lmu.ifi.dbs.elki.visualization.visualizers.optics.AbstractOPTICSVisualization
getClusterOrder, makeLayerElement
 
Methods inherited from class de.lmu.ifi.dbs.elki.visualization.visualizers.AbstractVisualization
contextChanged, destroy, getHeight, getLayer, getWidth, incrementalRedraw, resultAdded, resultRemoved, synchronizedRedraw, testRedraw
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private 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_MARKER

protected static final String CSS_MARKER
CSS class for markers

See Also:
Constant Field Values

CSS_RANGEMARKER

protected static final String CSS_RANGEMARKER
CSS class for markers

See Also:
Constant Field Values

etag

private Element etag
Element for the events


mtag

private Element mtag
Element for the marker

Constructor Detail

OPTICSPlotSelectionVisualization

public OPTICSPlotSelectionVisualization(VisualizationTask task)
Constructor.

Parameters:
task - Visualization task
Method Detail

redraw

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

Specified by:
redraw in class AbstractVisualization

addMarker

public void addMarker()
Add marker for the selected IDs to mtag


addMarkerRect

public Element addMarkerRect(double x1,
                             double width)
Create a rectangle as marker (Marker higher than plot!)

Parameters:
x1 - X-Value for the marker
width - Width of an entry
Returns:
SVG-Element svg-rectangle

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 OPTICSPlotSelectionVisualization.Mode getInputMode(Event evt)
Get the current input mode, on each mouse event.

Parameters:
evt - Mouse event.
Returns:
Input mode

getSelectedIndex

private int getSelectedIndex(List<ClusterOrderEntry<D>> order,
                             org.w3c.dom.svg.SVGPoint cPt)
Gets the Index of the ClusterOrderEntry where the event occurred

Parameters:
order - List of ClusterOrderEntries
cPt - clicked point
Returns:
Index of the object

updateSelection

protected void updateSelection(OPTICSPlotSelectionVisualization.Mode mode,
                               int begin,
                               int end)
Updates the selection for the given ClusterOrderEntry.

Parameters:
mode - Input mode
begin - first index to select
end - last index to select

addCSSClasses

private void addCSSClasses()
Adds the required CSS-Classes


resultChanged

public void resultChanged(Result current)
Description copied from interface: ResultListener
Notify that the current result has changed substantially.

Specified by:
resultChanged in interface ResultListener
Overrides:
resultChanged in class AbstractVisualization
Parameters:
current - Result that has changed.

Release 0.4.0 (2011-09-20_1324)