Package elki.visualization.gui.overview
Class OverviewPlot
- java.lang.Object
-
- elki.visualization.gui.overview.OverviewPlot
-
- All Implemented Interfaces:
ResultListener
,VisualizationListener
,java.util.EventListener
public class OverviewPlot extends java.lang.Object implements ResultListener, VisualizationListener
Generate an overview plot for a set of visualizations.- Since:
- 0.3
- Author:
- Erich Schubert, Remigius Wojdanowski
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.ArrayList<java.awt.event.ActionListener>
actionListeners
Action listeners for this plot.private VisualizerContext
context
Visualizer contextprivate static boolean
DEBUG_LAYOUT
Draw red borders around items.private org.w3c.dom.events.EventListener
hoverer
React to mouse hover eventsprivate org.w3c.dom.Element
hoverlayer
Layer for hover elementsprivate static Logging
LOG
Our logging classstatic java.lang.String
OVERVIEW_REFRESHED
Event when the overview plot was refreshed.static java.lang.String
OVERVIEW_REFRESHING
Event when the overview plot started refreshing.(package private) java.util.concurrent.atomic.AtomicReference<java.lang.Runnable>
pendingRefresh
Pending refresh, for lazy refreshingprivate VisualizationPlot
plot
The SVG plot object.private org.w3c.dom.Element
plotlayer
Layer for plot thumbnailprotected RectangleArranger<PlotItem>
plotmap
Map of coordinates to plots.private double
ratio
Screen ratioprivate boolean
reinitOnRefresh
Reinitialize on refreshint
screenheight
Screen size (used for thumbnail sizing)int
screenwidth
Screen size (used for thumbnail sizing)private CSSClass
selcss
The CSS class used on "selectable" rectangles.private boolean
single
Single view modeprivate LayerMap
vistoelem
Lookup
-
Constructor Summary
Constructors Constructor Description OverviewPlot(VisualizerContext context, boolean single)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addActionListener(java.awt.event.ActionListener actionListener)
Adds anActionListener
to the plot.private RectangleArranger<PlotItem>
arrangeVisualizations(double width, double height)
Recompute the layout of visualizations.void
destroy()
Destroy this overview plot.private Visualization
embedOrThumbnail(int thumbsize, PlotItem it, VisualizationTask task, org.w3c.dom.Element parent)
Produce thumbnail for a visualizer.SVGPlot
getPlot()
Get the SVGPlot object.double
getRatio()
void
initialize(double ratio)
Initialize the plot.private void
initializePlot()
Initialize the SVG plot.void
lazyRefresh()
Trigger a redraw, but avoid excessive redraws.DetailView
makeDetailView(PlotItem it)
Event triggered when a plot was selected.private void
recalcViewbox()
Recompute the view box of the plot.(package private) void
refresh()
Do a refresh (when visibilities have changed).private void
reinitialize()
Refresh the overview plot.void
resultAdded(java.lang.Object child, java.lang.Object parent)
A new derived result was added.void
resultChanged(java.lang.Object current)
Notify that the current result has changed substantially.void
resultRemoved(java.lang.Object child, java.lang.Object parent)
A result was removed.void
setRatio(double ratio)
protected void
triggerSubplotSelectEvent(PlotItem it)
When a subplot was selected, forward the event to listeners.protected boolean
visibleInOverview(VisualizationTask task)
Test whether a task should be displayed in the overview plot.void
visualizationChanged(VisualizationItem child)
Visualization has changed.
-
-
-
Field Detail
-
LOG
private static final Logging LOG
Our logging class
-
OVERVIEW_REFRESHING
public static final java.lang.String OVERVIEW_REFRESHING
Event when the overview plot started refreshing.- See Also:
- Constant Field Values
-
OVERVIEW_REFRESHED
public static final java.lang.String OVERVIEW_REFRESHED
Event when the overview plot was refreshed.- See Also:
- Constant Field Values
-
DEBUG_LAYOUT
private static final boolean DEBUG_LAYOUT
Draw red borders around items.- See Also:
- Constant Field Values
-
context
private VisualizerContext context
Visualizer context
-
plot
private VisualizationPlot plot
The SVG plot object.
-
plotmap
protected RectangleArranger<PlotItem> plotmap
Map of coordinates to plots.
-
actionListeners
private java.util.ArrayList<java.awt.event.ActionListener> actionListeners
Action listeners for this plot.
-
single
private boolean single
Single view mode
-
screenwidth
public int screenwidth
Screen size (used for thumbnail sizing)
-
screenheight
public int screenheight
Screen size (used for thumbnail sizing)
-
hoverer
private org.w3c.dom.events.EventListener hoverer
React to mouse hover events
-
vistoelem
private LayerMap vistoelem
Lookup
-
plotlayer
private org.w3c.dom.Element plotlayer
Layer for plot thumbnail
-
hoverlayer
private org.w3c.dom.Element hoverlayer
Layer for hover elements
-
selcss
private CSSClass selcss
The CSS class used on "selectable" rectangles.
-
ratio
private double ratio
Screen ratio
-
pendingRefresh
java.util.concurrent.atomic.AtomicReference<java.lang.Runnable> pendingRefresh
Pending refresh, for lazy refreshing
-
reinitOnRefresh
private boolean reinitOnRefresh
Reinitialize on refresh
-
-
Constructor Detail
-
OverviewPlot
public OverviewPlot(VisualizerContext context, boolean single)
Constructor.- Parameters:
context
- Visualizer contextsingle
- Single view mode
-
-
Method Detail
-
arrangeVisualizations
private RectangleArranger<PlotItem> arrangeVisualizations(double width, double height)
Recompute the layout of visualizations.- Parameters:
width
- Initial widthheight
- Initial height- Returns:
- Arrangement
-
initialize
public void initialize(double ratio)
Initialize the plot.- Parameters:
ratio
- Initial ratio
-
reinitialize
private void reinitialize()
Refresh the overview plot.
-
initializePlot
private void initializePlot()
Initialize the SVG plot.
-
embedOrThumbnail
private Visualization embedOrThumbnail(int thumbsize, PlotItem it, VisualizationTask task, org.w3c.dom.Element parent)
Produce thumbnail for a visualizer.- Parameters:
thumbsize
- Thumbnail sizeit
- Plot itemtask
- Taskparent
- Parent element to draw to
-
refresh
void refresh()
Do a refresh (when visibilities have changed).
-
visibleInOverview
protected boolean visibleInOverview(VisualizationTask task)
Test whether a task should be displayed in the overview plot.- Parameters:
task
- Task to display- Returns:
- visibility
-
recalcViewbox
private void recalcViewbox()
Recompute the view box of the plot.
-
makeDetailView
public DetailView makeDetailView(PlotItem it)
Event triggered when a plot was selected.- Parameters:
it
- Plot item selected- Returns:
- sub plot
-
addActionListener
public void addActionListener(java.awt.event.ActionListener actionListener)
Adds anActionListener
to the plot.- Parameters:
actionListener
- theActionListener
to be added
-
triggerSubplotSelectEvent
protected void triggerSubplotSelectEvent(PlotItem it)
When a subplot was selected, forward the event to listeners.- Parameters:
it
- PlotItem selected
-
destroy
public void destroy()
Destroy this overview plot.
-
getPlot
public SVGPlot getPlot()
Get the SVGPlot object.- Returns:
- SVG plot
-
getRatio
public double getRatio()
- Returns:
- the ratio
-
setRatio
public void setRatio(double ratio)
- Parameters:
ratio
- the ratio to set
-
lazyRefresh
public final void lazyRefresh()
Trigger a redraw, but avoid excessive redraws.
-
resultAdded
public void resultAdded(java.lang.Object child, java.lang.Object parent)
Description copied from interface:ResultListener
A new derived result was added.- Specified by:
resultAdded
in interfaceResultListener
- Parameters:
child
- New child result addedparent
- Parent result that was added to
-
resultChanged
public void resultChanged(java.lang.Object current)
Description copied from interface:ResultListener
Notify that the current result has changed substantially.- Specified by:
resultChanged
in interfaceResultListener
- Parameters:
current
- Result that has changed.
-
resultRemoved
public void resultRemoved(java.lang.Object child, java.lang.Object parent)
Description copied from interface:ResultListener
A result was removed.- Specified by:
resultRemoved
in interfaceResultListener
- Parameters:
child
- result that was removedparent
- Parent result that was removed from
-
visualizationChanged
public void visualizationChanged(VisualizationItem child)
Description copied from interface:VisualizationListener
Visualization has changed.- Specified by:
visualizationChanged
in interfaceVisualizationListener
- Parameters:
child
- Changed visualization
-
-