Class CrosshairRenderer

  • All Implemented Interfaces:
    PairwiseSequenceRenderer, Changeable

    public class CrosshairRenderer
    extends AbstractChangeable
    implements PairwiseSequenceRenderer

    CrosshairRenderer draws a crosshair, optionally with coordinates. The crosshair is set to a sequence position by a click and then stays there through scrolls/rescales until the next click. See the processMouseEvent documentation for details of responses to various mouse actions.

    Keith James
    • Field Detail

      • OUTLINE

        public static final ChangeType OUTLINE
        Constant OUTLINE indicating a change to the crosshair paint.
      • xHair

        protected Line2D xHair
        xHair is the vertical line positioned along the X-axis.
      • yHair

        protected Line2D yHair
        yHair is the horizontal line positioned along the Y-axis.
      • point

        protected Point point
        point is the current location (in sequence coordinates) of the crosshair in the X and Y sequences.
    • Constructor Detail

      • CrosshairRenderer

        public CrosshairRenderer()
        Creates a new CrosshairRenderer in light grey with coordinates displayed.
      • CrosshairRenderer

        public CrosshairRenderer​(Paint outline)
        Creates a new CrosshairRenderer of the specified colour, with coordinates displayed.
        outline - a Paint.
    • Method Detail

      • coordinateDisplayOn

        public void coordinateDisplayOn​(boolean display)
        coordinateDisplayOn toggles the display of sequence coordinates.
        display - a boolean.
      • getOutline

        public Paint getOutline()
        getOutline returns the colour used to draw the lines.
        a Paint.
      • processMouseEvent

        public SequenceViewerEvent processMouseEvent​(PairwiseRenderContext context,
                                                     MouseEvent me,
                                                     List path)

        processMouseEvent processes any MouseEvents directed to the renderer.

        Mouse actions are as follows (all are button-1 only):

        • Click sets the crosshair position and returns an event whose target object is the Point in sequence coordinates. The X coordinate is in the primary sequence, the Y coordinate is in the secondary sequence.
        • Press same as Click
        • Drag same as Click, except that the Point is not set
        • Release same as Click, except that the Point is not set
        • Move same as Click, except that the Point is not set and the target is null

        Specified by:
        processMouseEvent in interface PairwiseSequenceRenderer
        context - a PairwiseRenderContext.
        me - a MouseEvent.
        path - a List.
        a SequenceViewerEvent.