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) ColorLibrarycolorsetColor library (only used in compatibility mode)protected java.util.TreeMap<Segment,Segment>indirectSelectionsSegments indirectly selectedprotected SegmentssegmentsThe segments we use for visualizationprotected java.util.ArrayList<Segment>selectedSegmentsSelected segmentsprotected ModifiableDBIDsunselectedObjectsNot 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 intclassSize(int cnum)Get the number of elements in the styling class.voiddeselectAllSegments()Deselect all currently selected segmentsprotected voiddeselectSegment(Segment segment)Deselect a segmentintgetColorForDBID(DBIDRef id)Get the color for an individual object.intgetMaxStyle()Get the maximum style in use.java.lang.StringgetMenuName()Name to display in the menu.intgetMinStyle()Get the minimum style in use.intgetStyleForDBID(DBIDRef id)Get the style number for a particular objectintindexOfSegment(Segment segment)Get the index of a selected segment.booleanisSelected(Segment segment)Test whether a segment is selected.DBIDIteriterateClass(int cnum)Iterate over all objects from a given class.voidselect(Segment segment, boolean addToSelection)Adds or removes the given segment to the selection.protected voidselectSegment(Segment segment)Select a segmentvoidsetStyleLibrary(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:ClassStylingPolicyGet the style number for a particular object- Specified by:
getStyleForDBIDin interfaceClassStylingPolicy- Parameters:
id- Object ID- Returns:
- Style number
-
getColorForDBID
public int getColorForDBID(DBIDRef id)
Description copied from interface:StylingPolicyGet the color for an individual object.Note: if possible, use a class styling policy which can optimize better.
- Specified by:
getColorForDBIDin interfaceStylingPolicy- Parameters:
id- Object ID- Returns:
- Color value
-
getMinStyle
public int getMinStyle()
Description copied from interface:ClassStylingPolicyGet the minimum style in use.- Specified by:
getMinStylein interfaceClassStylingPolicy- Returns:
- Style number
-
getMaxStyle
public int getMaxStyle()
Description copied from interface:ClassStylingPolicyGet the maximum style in use.- Specified by:
getMaxStylein interfaceClassStylingPolicy- Returns:
- Style number
-
iterateClass
public DBIDIter iterateClass(int cnum)
Description copied from interface:ClassStylingPolicyIterate over all objects from a given class.- Specified by:
iterateClassin interfaceClassStylingPolicy- Parameters:
cnum- Class number- Returns:
- Iterator over object IDs
-
classSize
public int classSize(int cnum)
Description copied from interface:ClassStylingPolicyGet the number of elements in the styling class.- Specified by:
classSizein 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:VisualizationItemName to display in the menu. May benullor empty string.- Specified by:
getMenuNamein interfaceVisualizationItem- Returns:
- Menu name.
-
-