Class SegmentsStylingPolicy

    • 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
      • 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 interface StylingPolicy
        Parameters:
        id - Object ID
        Returns:
        Color value
      • iterateClass

        public DBIDIter iterateClass​(int cnum)
        Description copied from interface: ClassStylingPolicy
        Iterate over all objects from a given class.
        Specified by:
        iterateClass in interface ClassStylingPolicy
        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 interface ClassStylingPolicy
        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 be null or empty string.
        Specified by:
        getMenuName in interface VisualizationItem
        Returns:
        Menu name.