Package elki.visualization
Class VisualizationTask
- java.lang.Object
-
- elki.visualization.VisualizationTask
-
- All Implemented Interfaces:
VisualizationItem
,java.lang.Comparable<VisualizationTask>
public class VisualizationTask extends java.lang.Object implements VisualizationItem, java.lang.Comparable<VisualizationTask>
Container class, with ugly casts to reduce generics crazyness.- Since:
- 0.4.0
- Author:
- Erich Schubert
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
VisualizationTask.RenderFlag
Rendering flags enum.static class
VisualizationTask.UpdateFlag
Update flags enum.
-
Field Summary
Fields Modifier and Type Field Description private VisFactory
factory
The factoryprivate int
flags
Render capabilitiesprivate int
level
Meta data key: Level for visualizer orderingstatic int
LEVEL_BACKGROUND
Background layerstatic int
LEVEL_DATA
Data layerstatic int
LEVEL_FOREGROUND
Passive foreground layerstatic int
LEVEL_INTERACTIVE
Active foreground layer (interactive elements)static int
LEVEL_STATIC
Static plot layerprivate java.lang.String
name
Nameprivate Relation<?>
relation
The main representationprivate double
reqheight
Height requestprivate double
reqwidth
Width requestprivate java.lang.Object
result
The result we are attached toprivate boolean
tool
Flag to mark the visualizer as tool.private int
updatemask
The update event mask.private boolean
visible
Flag to control visibility.
-
Constructor Summary
Constructors Constructor Description VisualizationTask(VisFactory factory, java.lang.String name, java.lang.Object result, Relation<?> relation)
Visualization task.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(VisualizationTask other)
boolean
equals(java.lang.Object o)
VisFactory
getFactory()
Get the visualizer factory.java.lang.String
getMenuName()
Name to display in the menu.<R extends Relation<?>>
RgetRelation()
double
getRequestedHeight()
Get the requested height.double
getRequestedWidth()
Get the requested width.<R> R
getResult()
boolean
has(VisualizationTask.RenderFlag f)
Update if any oft these flags is set.boolean
has(VisualizationTask.UpdateFlag f)
Update if any oft these bits is set.int
hashCode()
boolean
isTool()
Get the "tool" flag of the visualizer.boolean
isVisible()
Get the visibility flag.int
level()
Get the level (priority) of the visualization.VisualizationTask
level(int level)
Set the level (priority) of a visualization.VisualizationTask
requestSize(double w, double h)
Set the size request.VisualizationTask
tool(boolean t)
Flag as tool visualizer.java.lang.String
toString()
VisualizationTask
visibility(boolean vis)
Init the default visibility of a task.VisualizationTask
with(VisualizationTask.RenderFlag f)
Set a task flag.VisualizationTask
with(VisualizationTask.UpdateFlag f)
Set (OR) the update flags.
-
-
-
Field Detail
-
level
private int level
Meta data key: Level for visualizer orderingReturns an integer indicating the "height" of this Visualizer. It is intended to impose an ordering on the execution of Visualizers as a Visualizer may depend on another Visualizer running earlier.
Lower numbers should result in a earlier use of this Visualizer, while higher numbers should result in a later use. If more Visualizers have the same level, no ordering is guaranteed.
Note that this value is only a recommendation, as it is totally up to the framework to ignore it.
-
visible
private boolean visible
Flag to control visibility.
-
flags
private int flags
Render capabilities
-
updatemask
private int updatemask
-
tool
private boolean tool
Flag to mark the visualizer as tool.
-
LEVEL_BACKGROUND
public static final int LEVEL_BACKGROUND
Background layer- See Also:
- Constant Field Values
-
LEVEL_DATA
public static final int LEVEL_DATA
Data layer- See Also:
- Constant Field Values
-
LEVEL_STATIC
public static final int LEVEL_STATIC
Static plot layer- See Also:
- Constant Field Values
-
LEVEL_FOREGROUND
public static final int LEVEL_FOREGROUND
Passive foreground layer- See Also:
- Constant Field Values
-
LEVEL_INTERACTIVE
public static final int LEVEL_INTERACTIVE
Active foreground layer (interactive elements)- See Also:
- Constant Field Values
-
name
private java.lang.String name
Name
-
factory
private VisFactory factory
The factory
-
result
private java.lang.Object result
The result we are attached to
-
relation
private Relation<?> relation
The main representation
-
reqwidth
private double reqwidth
Width request
-
reqheight
private double reqheight
Height request
-
-
Constructor Detail
-
VisualizationTask
public VisualizationTask(VisFactory factory, java.lang.String name, java.lang.Object result, Relation<?> relation)
Visualization task.- Parameters:
factory
- Factoryname
- Nameresult
- Resultrelation
- Relation to use
-
-
Method Detail
-
with
public VisualizationTask with(VisualizationTask.UpdateFlag f)
Set (OR) the update flags.- Parameters:
f
- update flag- Returns:
this
, for method chaining.
-
has
public boolean has(VisualizationTask.UpdateFlag f)
Update if any oft these bits is set.- Parameters:
f
- update flag- Returns:
true
if any bit is set.
-
with
public VisualizationTask with(VisualizationTask.RenderFlag f)
Set a task flag.- Parameters:
f
- render flag- Returns:
this
, for method chaining.
-
has
public boolean has(VisualizationTask.RenderFlag f)
Update if any oft these flags is set.- Parameters:
f
- render flag- Returns:
true
if any bit is set.
-
level
public VisualizationTask level(int level)
Set the level (priority) of a visualization.- Parameters:
level
- Level- Returns:
this
, for method chaining.
-
level
public int level()
Get the level (priority) of the visualization.- Returns:
- Level
-
tool
public VisualizationTask tool(boolean t)
Flag as tool visualizer.TODO: don't use a separate boolean for this, but, e.g., interface?
- Parameters:
t
- Tool flag- Returns:
this
, for method chaining.
-
isTool
public boolean isTool()
Get the "tool" flag of the visualizer.- Returns:
- tool flag.
-
visibility
public VisualizationTask visibility(boolean vis)
Init the default visibility of a task.- Parameters:
vis
- Visibility.- Returns:
this
, for method chaining.
-
isVisible
public boolean isVisible()
Get the visibility flag.- Returns:
- Visibility
-
requestSize
public VisualizationTask requestSize(double w, double h)
Set the size request.- Parameters:
w
- Widthh
- Height- Returns:
this
, for method chaining.
-
getRequestedWidth
public double getRequestedWidth()
Get the requested width.- Returns:
- Width
-
getRequestedHeight
public double getRequestedHeight()
Get the requested height.- Returns:
- Height
-
getFactory
public VisFactory getFactory()
Get the visualizer factory.- Returns:
- Visualizer factory
-
getResult
public <R> R getResult()
-
getRelation
public <R extends Relation<?>> R getRelation()
-
getMenuName
public java.lang.String getMenuName()
Description copied from interface:VisualizationItem
Name to display in the menu. May benull
or empty string.- Specified by:
getMenuName
in interfaceVisualizationItem
- Returns:
- Menu name.
-
compareTo
public int compareTo(VisualizationTask other)
- Specified by:
compareTo
in interfacejava.lang.Comparable<VisualizationTask>
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
-