Class SubPairwiseRenderContext

  • All Implemented Interfaces:
    javax.swing.SwingConstants, PairwiseRenderContext, SequenceRenderContext

    public class SubPairwiseRenderContext
    extends java.lang.Object
    implements PairwiseRenderContext

    SubPairwiseRenderContext is a rendering context which wraps a delegate context and effectively hides some of the delegate's properties with its own. If any of the SymbolList, FeatureHolder or RangeLocation arguments are not null, their values are returned. Otherwise the delegate's method is called and its return value is returned instead.

    Since:
    1.2
    Author:
    Keith James, Matthew Pocock
    • Constructor Detail

      • SubPairwiseRenderContext

        public SubPairwiseRenderContext​(PairwiseRenderContext context,
                                        SymbolList symbols,
                                        SymbolList secondarySymbols,
                                        FeatureHolder features,
                                        FeatureHolder secondaryFeatures,
                                        RangeLocation range,
                                        RangeLocation secondaryRange)
        Creates a new SubPairwiseRenderContext.
        Parameters:
        context - a PairwiseRenderContext to wrap. This should not be null.
        symbols - a SymbolList to use instead of the delegate's. May be null.
        secondarySymbols - a SymbolList to use instead of the delegate's. May be null.
        features - a FeatureHolder to use instead of the delegate's. May be null.
        secondaryFeatures - a FeatureHolder to use instead of the delegate's. May be null.
        range - a RangeLocation to use instead of the delegate's. May be null.
        secondaryRange - a RangeLocation to use instead of the delegate's. May be null.
    • Method Detail

      • getDirection

        public int getDirection()
        Description copied from interface: SequenceRenderContext
        Gets the direction in which this context expects sequences to be rendered - HORIZONTAL or VERTICAL.
        Specified by:
        getDirection in interface SequenceRenderContext
        Returns:
        The Direction value
      • getSecondaryDirection

        public int getSecondaryDirection()
        Description copied from interface: PairwiseRenderContext
        getSecondaryDirection returns the direction in which the secondary sequence is rendered. This may be either HORIZONTAL or VERTICAL.
        Specified by:
        getSecondaryDirection in interface PairwiseRenderContext
        Returns:
        an int.
      • sequenceToGraphics

        public double sequenceToGraphics​(int sequencePos)
        Description copied from interface: SequenceRenderContext
        Converts a sequence index into a graphical coordinate. You will need to use this in conjunction with getDirection to correctly lay graphics out.
        Specified by:
        sequenceToGraphics in interface SequenceRenderContext
        Parameters:
        sequencePos - Index within the sequence
        Returns:
        Equivalent graphical position in pixels
      • secondarySequenceToGraphics

        public double secondarySequenceToGraphics​(int sequencePos)
        Description copied from interface: PairwiseRenderContext
        secondarySequenceToGraphics converts a sequence coordinate on the secondary sequence to a graphical position.
        Specified by:
        secondarySequenceToGraphics in interface PairwiseRenderContext
        Parameters:
        sequencePos - an int.
        Returns:
        a double.
      • graphicsToSequence

        public int graphicsToSequence​(double graphicsPos)
        Description copied from interface: SequenceRenderContext
        Converts a graphical position into a sequence coordinate. You will need to have used getDirection to decide whether to use the x or y coordinate.
        Specified by:
        graphicsToSequence in interface SequenceRenderContext
        Parameters:
        graphicsPos - A pixel position
        Returns:
        The corresponding sequence index
      • graphicsToSequence

        public int graphicsToSequence​(java.awt.geom.Point2D point)
        Description copied from interface: SequenceRenderContext
        Converts a graphical position into a sequence coordinate. This will use getDirection to decide whether to use the x or y coordinate.
        Specified by:
        graphicsToSequence in interface SequenceRenderContext
        Parameters:
        point - a point representing the position
        Returns:
        the corresponding sequence index
      • graphicsToSecondarySequence

        public int graphicsToSecondarySequence​(double graphicsPos)
        Description copied from interface: PairwiseRenderContext
        graphicsToSecondarySequence converts a graphical position to a sequence coordinate on the secondary sequence.
        Specified by:
        graphicsToSecondarySequence in interface PairwiseRenderContext
        Parameters:
        graphicsPos - a double.
        Returns:
        an int.
      • graphicsToSecondarySequence

        public int graphicsToSecondarySequence​(java.awt.Point point)
        Description copied from interface: PairwiseRenderContext
        graphicsToSecondarySequence converts a graphical position to a secondary sequence index.
        Specified by:
        graphicsToSecondarySequence in interface PairwiseRenderContext
        Parameters:
        point - a Point.
        Returns:
        an int.