public void select ( Segment segment , boolean addToSelection ) { // abort if segment represents pairs inNone. Would select all segments... if ( segment . isNone ( ) ) { return ; } if ( ! addToSelection ) { deselectAllSegments ( ) ; } // get selected segments if ( segment . isUnpaired ( ) ) { // check if all segments are selected if ( addToSelection ) { boolean allSegmentsSelected = true ; for ( Segment other : segments . getPairedSegments ( segment ) ) { if ( ! isSelected ( other ) ) { allSegmentsSelected = false ; break ; } } // if all are selected, deselect all if ( allSegmentsSelected ) { deselectSegment ( segment ) ; return ; } } if ( isSelected ( segment ) ) { deselectSegment ( segment ) ; } else { selectSegment ( segment ) ; } } else { // an object segment was selected if ( isSelected ( segment ) ) { deselectSegment ( segment ) ; } else { selectSegment ( segment ) ; } } }
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 .