Class SegmentsStylingPolicy
- java.lang.Object
-
- elki.visualization.visualizers.pairsegments.SegmentsStylingPolicy
-
- All Implemented Interfaces:
ClassStylingPolicy
,StylingPolicy
,VisualizationItem
public class SegmentsStylingPolicy extends java.lang.Object implements ClassStylingPolicy
Styling policy to communicate the segment selection to other visualizers.- Since:
- 0.5.0
- Author:
- Sascha Goldhofer, Erich Schubert
-
-
Field Summary
Fields Modifier and Type Field Description (package private) ColorLibrary
colorset
Color library (only used in compatibility mode)protected java.util.TreeMap<Segment,Segment>
indirectSelections
Segments indirectly selectedprotected Segments
segments
The segments we use for visualizationprotected java.util.ArrayList<Segment>
selectedSegments
Selected segmentsprotected ModifiableDBIDs
unselectedObjects
Not selected IDs that will be drawn in default colors.
-
Constructor Summary
Constructors Constructor Description SegmentsStylingPolicy(Segments segments)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
classSize(int cnum)
Get the number of elements in the styling class.void
deselectAllSegments()
Deselect all currently selected segmentsprotected void
deselectSegment(Segment segment)
Deselect a segmentint
getColorForDBID(DBIDRef id)
Get the color for an individual object.int
getMaxStyle()
Get the maximum style in use.java.lang.String
getMenuName()
Name to display in the menu.int
getMinStyle()
Get the minimum style in use.int
getStyleForDBID(DBIDRef id)
Get the style number for a particular objectint
indexOfSegment(Segment segment)
Get the index of a selected segment.boolean
isSelected(Segment segment)
Test whether a segment is selected.DBIDIter
iterateClass(int cnum)
Iterate over all objects from a given class.void
select(Segment segment, boolean addToSelection)
Adds or removes the given segment to the selection.protected void
selectSegment(Segment segment)
Select a segmentvoid
setStyleLibrary(StyleLibrary style)
Assign the style library, for compatibility color styling.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface elki.visualization.style.StylingPolicy
getIntensityForDBID
-
-
-
-
Field Detail
-
segments
protected final Segments segments
The segments we use for visualization
-
selectedSegments
protected java.util.ArrayList<Segment> selectedSegments
Selected segments
-
indirectSelections
protected java.util.TreeMap<Segment,Segment> indirectSelections
Segments indirectly selected
-
unselectedObjects
protected ModifiableDBIDs unselectedObjects
Not selected IDs that will be drawn in default colors.
-
colorset
ColorLibrary colorset
Color library (only used in compatibility mode)
-
-
Constructor Detail
-
SegmentsStylingPolicy
public SegmentsStylingPolicy(Segments segments)
Constructor.- Parameters:
segments
- Segments
-
-
Method Detail
-
setStyleLibrary
public void setStyleLibrary(StyleLibrary style)
Assign the style library, for compatibility color styling.- Parameters:
style
- Style library
-
isSelected
public boolean isSelected(Segment segment)
Test whether a segment is selected.- Parameters:
segment
- Segment to test- Returns:
- true when selected
-
getStyleForDBID
public int getStyleForDBID(DBIDRef id)
Description copied from interface:ClassStylingPolicy
Get the style number for a particular object- Specified by:
getStyleForDBID
in interfaceClassStylingPolicy
- Parameters:
id
- Object ID- Returns:
- Style number
-
getColorForDBID
public int getColorForDBID(DBIDRef id)
Description copied from interface:StylingPolicy
Get the color for an individual object.Note: if possible, use a class styling policy which can optimize better.
- Specified by:
getColorForDBID
in interfaceStylingPolicy
- Parameters:
id
- Object ID- Returns:
- Color value
-
getMinStyle
public int getMinStyle()
Description copied from interface:ClassStylingPolicy
Get the minimum style in use.- Specified by:
getMinStyle
in interfaceClassStylingPolicy
- Returns:
- Style number
-
getMaxStyle
public int getMaxStyle()
Description copied from interface:ClassStylingPolicy
Get the maximum style in use.- Specified by:
getMaxStyle
in interfaceClassStylingPolicy
- Returns:
- Style number
-
iterateClass
public DBIDIter iterateClass(int cnum)
Description copied from interface:ClassStylingPolicy
Iterate over all objects from a given class.- Specified by:
iterateClass
in interfaceClassStylingPolicy
- Parameters:
cnum
- Class number- Returns:
- Iterator over object IDs
-
classSize
public int classSize(int cnum)
Description copied from interface:ClassStylingPolicy
Get the number of elements in the styling class.- Specified by:
classSize
in interfaceClassStylingPolicy
- Parameters:
cnum
- Class number- Returns:
- Size of class.
-
select
public void select(Segment segment, boolean addToSelection)
Adds or removes the given segment to the selection. Depending on the clustering and cluster selected and the addToSelection option given, the current selection will be modified. This method is called by clicking on a segment and ring and the CTRL-button status.Adding selections does only work on the same clustering and cluster, else a new selection will be added.
- Parameters:
segment
- the selected element representing a segment ring (specific clustering)addToSelection
- flag for adding segment to current selection
-
deselectAllSegments
public void deselectAllSegments()
Deselect all currently selected segments
-
deselectSegment
protected void deselectSegment(Segment segment)
Deselect a segment- Parameters:
segment
- Segment to deselect
-
selectSegment
protected void selectSegment(Segment segment)
Select a segment- Parameters:
segment
- Segment to select
-
indexOfSegment
public int indexOfSegment(Segment segment)
Get the index of a selected segment.- Parameters:
segment
- Segment to find- Returns:
- Index, or -1
-
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.
-
-