Package elki.visualization
Class VisualizerContext
- java.lang.Object
-
- elki.visualization.VisualizerContext
-
- All Implemented Interfaces:
DataStoreListener
public class VisualizerContext extends java.lang.Object implements DataStoreListener
Map to store context information for the visualizer. This can be any data that should to be shared among plots, such as line colors, styles etc.- Since:
- 0.3
- Author:
- Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description private java.lang.Object
baseResult
Starting point of the result tree, may benull
.private java.util.Collection<VisualizationProcessor>
factories
Factories to useprivate java.util.ArrayList<DataStoreListener>
listenerList
The event listeners for this context.private static Logging
LOG
Logger.private SelectionResult
selection
Selection result(package private) StyleLibrary
stylelibrary
Style library(package private) StylingPolicy
stylepolicy
Styling policyprivate VisualizationTree
vistree
Tree of visualizations.
-
Constructor Summary
Constructors Constructor Description VisualizerContext(java.lang.Object start, StyleLibrary stylelib, java.util.Collection<VisualizationProcessor> factories)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDataStoreListener(DataStoreListener l)
Adds a listener for theDataStoreEvent
posted after the content changes.void
addResultListener(ResultListener listener)
Register a result listener.void
addVis(java.lang.Object parent, VisualizationItem vis)
Add (register) a visualization.void
addVisualizationListener(VisualizationListener listener)
Add a listener.void
contentChanged(DataStoreEvent e)
Proxy datastore event to child listeners.private Clustering<Model>
generateDefaultClustering()
Generate a default (fallback) clustering.java.lang.Object
getBaseResult()
Starting point for visualization, may benull
.java.lang.String
getLongName()
DBIDSelection
getSelection()
Get the current selection.SelectionResult
getSelectionResult()
Get the current selection result.java.lang.String
getShortName()
StyleLibrary
getStyleLibrary()
Get the style libraryStylingPolicy
getStylingPolicy()
Get the active styling policyVisualizationTree
getVisHierarchy()
java.util.List<VisualizationTask>
getVisTasks(VisualizationItem item)
protected void
makeStyleResult(StyleLibrary stylelib)
Generate a new style result for the given style library.private void
notifyFactories(java.lang.Object item)
Notify factories of a change.void
removeDataStoreListener(DataStoreListener l)
Removes a listener previously added withaddDataStoreListener
.void
removeResultListener(ResultListener listener)
Remove a result listener.void
removeVisualizationListener(VisualizationListener listener)
Add a listener.void
setSelection(DBIDSelection sel)
Set a new selection.void
setStyleLibrary(StyleLibrary library)
Get the style libraryvoid
setStylingPolicy(StylingPolicy policy)
Set the active styling policyvoid
visChanged(VisualizationItem item)
A visualization item has changed.
-
-
-
Field Detail
-
LOG
private static final Logging LOG
Logger.
-
vistree
private VisualizationTree vistree
Tree of visualizations.
-
listenerList
private java.util.ArrayList<DataStoreListener> listenerList
The event listeners for this context.
-
factories
private java.util.Collection<VisualizationProcessor> factories
Factories to use
-
selection
private SelectionResult selection
Selection result
-
stylepolicy
StylingPolicy stylepolicy
Styling policy
-
stylelibrary
StyleLibrary stylelibrary
Style library
-
baseResult
private java.lang.Object baseResult
Starting point of the result tree, may benull
.
-
-
Constructor Detail
-
VisualizerContext
public VisualizerContext(java.lang.Object start, StyleLibrary stylelib, java.util.Collection<VisualizationProcessor> factories)
Constructor. We currently require a Database and a Result.- Parameters:
start
- Starting resultstylelib
- Style libraryfactories
- Visualizer Factories to use
-
-
Method Detail
-
makeStyleResult
protected void makeStyleResult(StyleLibrary stylelib)
Generate a new style result for the given style library.- Parameters:
stylelib
- Style library
-
getStylingPolicy
public StylingPolicy getStylingPolicy()
Get the active styling policy- Returns:
- Styling policy
-
setStylingPolicy
public void setStylingPolicy(StylingPolicy policy)
Set the active styling policy- Parameters:
policy
- new Styling policy
-
getStyleLibrary
public StyleLibrary getStyleLibrary()
Get the style library- Returns:
- Style library
-
setStyleLibrary
public void setStyleLibrary(StyleLibrary library)
Get the style library- Parameters:
library
- Style library
-
generateDefaultClustering
private Clustering<Model> generateDefaultClustering()
Generate a default (fallback) clustering.- Returns:
- generated clustering
-
getSelectionResult
public SelectionResult getSelectionResult()
Get the current selection result.- Returns:
- selection result
-
getSelection
public DBIDSelection getSelection()
Get the current selection.- Returns:
- selection
-
setSelection
public void setSelection(DBIDSelection sel)
Set a new selection.- Parameters:
sel
- Selection
-
addDataStoreListener
public void addDataStoreListener(DataStoreListener l)
Adds a listener for theDataStoreEvent
posted after the content changes.- Parameters:
l
- the listener to add- See Also:
removeDataStoreListener(elki.database.datastore.DataStoreListener)
-
removeDataStoreListener
public void removeDataStoreListener(DataStoreListener l)
Removes a listener previously added withaddDataStoreListener
.- Parameters:
l
- the listener to remove- See Also:
addDataStoreListener(elki.database.datastore.DataStoreListener)
-
contentChanged
public void contentChanged(DataStoreEvent e)
Proxy datastore event to child listeners.- Specified by:
contentChanged
in interfaceDataStoreListener
- Parameters:
e
- the update event
-
addResultListener
public void addResultListener(ResultListener listener)
Register a result listener.- Parameters:
listener
- Result listener.
-
removeResultListener
public void removeResultListener(ResultListener listener)
Remove a result listener.- Parameters:
listener
- Result listener.
-
addVisualizationListener
public void addVisualizationListener(VisualizationListener listener)
Add a listener.- Parameters:
listener
- Listener to add
-
removeVisualizationListener
public void removeVisualizationListener(VisualizationListener listener)
Add a listener.- Parameters:
listener
- Listener to remove
-
getLongName
public java.lang.String getLongName()
-
getShortName
public java.lang.String getShortName()
-
getBaseResult
public java.lang.Object getBaseResult()
Starting point for visualization, may benull
.- Returns:
- Starting point in the result tree, may be
null
.
-
addVis
public void addVis(java.lang.Object parent, VisualizationItem vis)
Add (register) a visualization.- Parameters:
parent
- Parent objectvis
- Visualization
-
visChanged
public void visChanged(VisualizationItem item)
A visualization item has changed.- Parameters:
item
- Item that has changed
-
notifyFactories
private void notifyFactories(java.lang.Object item)
Notify factories of a change.- Parameters:
item
- Item that has changed.
-
getVisTasks
public java.util.List<VisualizationTask> getVisTasks(VisualizationItem item)
-
getVisHierarchy
public VisualizationTree getVisHierarchy()
-
-