Documentation of 'kcl.waterloo.annotation.GJAnnotation' Java class
GJAnnotation
kcl.waterloo.annotation

Class GJAnnotation

  • All Implemented Interfaces:
    GJAnnotationInterface<java.awt.geom.Path2D,GJGraphInterface,java.awt.Stroke,java.awt.Paint,java.awt.Font>
    Direct Known Subclasses:
    GJAnnotation.ArrowAnnotation, GJAnnotation.LineAnnotation, GJAnnotation.ShapeAnnotation, GJAnnotation.TextAnnotation


    public abstract class GJAnnotation
    extends java.lang.Object
    implements GJAnnotationInterface<java.awt.geom.Path2D,GJGraphInterface,java.awt.Stroke,java.awt.Paint,java.awt.Font>
    GJAnnotation is an abstract class that provides concrete internal classes to annotate parentGraph containers and static factory methods to construct them. Annotations can be added to parentGraph containers by calling the container's add method (in which case the position of the annotation will be set in the coordinate space of that container's View) or by calling the add method of a parentGraph layer in the View of a container (in which case the position of the annotation will be set in that layer's coordinate space).
    • Constructor Detail

      • GJAnnotation

        public GJAnnotation()
        Constructor.
    • Method Detail

      • getPath

        public java.awt.geom.Path2D getPath()
        Returns a clone of the Path2D object.
        Specified by:
        getPath in interface GJAnnotationInterface<java.awt.geom.Path2D,GJGraphInterface,java.awt.Stroke,java.awt.Paint,java.awt.Font>
        Returns:
        the marker
      • setPath

        public void setPath(java.awt.geom.Path2D p)
        Sets the Path2D object.
        Specified by:
        setPath in interface GJAnnotationInterface<java.awt.geom.Path2D,GJGraphInterface,java.awt.Stroke,java.awt.Paint,java.awt.Font>
        Parameters:
        p -
      • getExtra

        public GJMarker getExtra()
        Returns the parentGraph reference for setting the coordinate system for this annotation.
        Specified by:
        getExtra in interface GJAnnotationInterface<java.awt.geom.Path2D,GJGraphInterface,java.awt.Stroke,java.awt.Paint,java.awt.Font>
        Returns:
        the plot
      • setParentGraph

        public void setParentGraph(GJGraphInterface gr)
        setParentGraph method. This is called when an annotation is added using the add method of a parentGraph - which is recommended - so need not be called directly by the user.
        Specified by:
        setParentGraph in interface GJAnnotationInterface<java.awt.geom.Path2D,GJGraphInterface,java.awt.Stroke,java.awt.Paint,java.awt.Font>
        Parameters:
        gr -
      • setLineStroke

        public void setLineStroke(java.awt.Stroke LineStroke)
        Specified by:
        setLineStroke in interface GJAnnotationInterface<java.awt.geom.Path2D,GJGraphInterface,java.awt.Stroke,java.awt.Paint,java.awt.Font>
        Parameters:
        LineStroke - the LineStroke to set
      • setLineColor

        public void setLineColor(java.awt.Paint LineColor)
        Specified by:
        setLineColor in interface GJAnnotationInterface<java.awt.geom.Path2D,GJGraphInterface,java.awt.Stroke,java.awt.Paint,java.awt.Font>
        Parameters:
        LineColor - the LineColor to set
      • setFont

        public void setFont(java.awt.Font Font)
        Specified by:
        setFont in interface GJAnnotationInterface<java.awt.geom.Path2D,GJGraphInterface,java.awt.Stroke,java.awt.Paint,java.awt.Font>
        Parameters:
        Font - the Font to set
      • setFill

        public void setFill(java.awt.Paint Fill)
        Specified by:
        setFill in interface GJAnnotationInterface<java.awt.geom.Path2D,GJGraphInterface,java.awt.Stroke,java.awt.Paint,java.awt.Font>
        Parameters:
        Fill - the Fill to set
      • setName

        public void setName(java.lang.String Name)
        Specified by:
        setName in interface GJAnnotationInterface<java.awt.geom.Path2D,GJGraphInterface,java.awt.Stroke,java.awt.Paint,java.awt.Font>
        Parameters:
        Name - the Name to set
      • setText

        public void setText(java.lang.String Text)
        Specified by:
        setText in interface GJAnnotationInterface<java.awt.geom.Path2D,GJGraphInterface,java.awt.Stroke,java.awt.Paint,java.awt.Font>
        Parameters:
        Text - the Text to set
      • setTextColor

        public void setTextColor(java.awt.Paint TextColor)
        Sets the textColor
        Specified by:
        setTextColor in interface GJAnnotationInterface<java.awt.geom.Path2D,GJGraphInterface,java.awt.Stroke,java.awt.Paint,java.awt.Font>
        Parameters:
        TextColor - the TextColor to set
      • getLineTextPosition

        public int getLineTextPosition()
        Returns:
        the lineTextPosition
      • setLineTextPosition

        public void setLineTextPosition(int pos)
        Parameters:
        pos - the lineTextPosition to set
      • remove

        public void remove(java.lang.String name)
        Description copied from interface: GJAnnotationInterface
        Removes annotation(s) named by the string
        Specified by:
        remove in interface GJAnnotationInterface<java.awt.geom.Path2D,GJGraphInterface,java.awt.Stroke,java.awt.Paint,java.awt.Font>
        Parameters:
        name - the name of the annotation(s) to remove
      • paintAnnotation

        public void paintAnnotation(java.awt.Graphics2D g2,
                                    java.awt.geom.AffineTransform af)
        paintAnnotation method. This has public scope to allow it to be called from the parentGraph container's paint methods. When using a standard Project Waterloo parentGraph container where annotations have been added using the add method, this is done automatically.
        Specified by:
        paintAnnotation in interface GJAnnotationInterface<java.awt.geom.Path2D,GJGraphInterface,java.awt.Stroke,java.awt.Paint,java.awt.Font>
        Parameters:
        g2 - the graphics object to render to
        af - an AffineTransform instance with scale and translate set to position this annotation correctly in the container using the parentGraph's coordinate system.
      • createLine

        public static GJAnnotation.LineAnnotation createLine(double x1,
                                                             double y1,
                                                             double x2,
                                                             double y2)
        Static method to create a line between {x1,y1} and {x2,y2}.
        Parameters:
        x1 -
        y1 -
        x2 -
        y2 -
        Returns:
        the the annotation
      • createArrow

        public static GJAnnotation.ArrowAnnotation createArrow(double x1,
                                                               double y1,
                                                               double x2,
                                                               double y2,
                                                               double szx,
                                                               double szy)
        Static method to create a line between {x1,y1} and {x2,y2}.
        Parameters:
        x1 -
        y1 -
        x2 -
        y2 -
        szx -
        szy -
        Returns:
        the annotation
      • createArrow

        public static GJAnnotation.ArrowAnnotation createArrow(double x1,
                                                               double y1,
                                                               double x2,
                                                               double y2,
                                                               double x3,
                                                               double y3,
                                                               double szx,
                                                               double szy)
        Parameters:
        x1 -
        y1 -
        x2 -
        y2 -
        x3 -
        y3 -
        szx -
        szy -
        Returns:
        the annotation
      • createLine

        public static GJAnnotation.LineAnnotation createLine(double x1,
                                                             double y1,
                                                             double x2,
                                                             double y2,
                                                             double x3,
                                                             double y3)
        Static method to create a line between {x1,y1} and {x2,y2}.
        Parameters:
        x1 -
        y1 -
        x2 -
        y2 -
        x3 -
        y3 -
        Returns:
        the LineAnnotation
      • createBox

        public static GJAnnotation.ShapeAnnotation createBox(double x,
                                                             double y,
                                                             double w,
                                                             double h)
        Static method to create a rectangle where {X,Y} is the top left corner and w and h are the width and height.
        Parameters:
        x -
        y -
        w -
        h -
        Returns:
        a GJAnnotation$ShapeAnnotation
      • createEllipse

        public static GJAnnotation.ShapeAnnotation createEllipse(double x,
                                                                 double y,
                                                                 double w,
                                                                 double h)
        Static method to create an ellipse where {X,Y} is the top left corner and w and h are the width and height of the bounding rectangle.
        Parameters:
        x -
        y -
        w -
        h -
        Returns:
        a GJAnnotation$ShapeAnnotation
      • createShape

        public static GJAnnotation.ShapeAnnotation createShape(java.awt.Shape s)
        Creates an annotation using the specified object which should implement the {code Shape} interface.
        Parameters:
        s - a Shape.
        Returns:
        a GJAnnotation$ShapeAnnotation
      • getTextBackground

        public java.awt.Paint getTextBackground()
        Returns:
        the textBackground
      • setTextBackground

        public void setTextBackground(java.awt.Paint textBackground)
        Parameters:
        textBackground - the textBackground to set

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.