Package PamView

Class PamSymbol

All Implemented Interfaces:
Serializable, Cloneable, Icon, ManagedParameters
Direct Known Subclasses:
CustomSymbol, Vessel

public class PamSymbol extends PamSymbolBase implements Serializable, Icon, Cloneable, ManagedParameters
Standard symbols for Pamguard graphics. A number of shapes are available, most of which can have a fill colour and a line colour. They may be created anywhere in Pamguard code using new PamSymbol(...) and can also be created and configured using a PamSymbolDialog to chose the symbol type, colours, line thicknesses, etc. A selection of drawing routines allow you to draw them on plots with varying sizes at any location.
Author:
Doug Gillespie
See Also:
  • Field Details

  • Constructor Details

    • PamSymbol

      public PamSymbol()
      Simplest constructor creates a PamSymbol with default attributes. You will probably only use this constructor if you plan to subsequently modify it with PamSymbolDialog
      See Also:
    • PamSymbol

      public PamSymbol(SymbolData symbolData)
    • PamSymbol

      public PamSymbol(PamSymbolType symbol, int width, int height, boolean fill, Color fillColor, Color lineColor)
      Creates a PamSymbol with a given shape, size, colour, etc.
      Parameters:
      symbol - Symbol type
      width - Width of symbol in pixels
      height - Height of symbol in pixels
      fill - true if the symbol is to be filled, false if the shape should be hollow
      fillColor - fill colour (required fill to be true)
      lineColor - line colour
  • Method Details

    • draw

      public Rectangle draw(Graphics g, Point pt, ProjectorDrawingOptions drawingOptions)
      Draw the shape with additional options.
      Parameters:
      g - graphics handle
      pt - point to centre shape at.
      drawingOptions - drawing options
      Returns:
      bounding rectangle of draw
    • draw

      public Rectangle draw(Graphics g, Point pt)
      Draw the symbol at a given point using it's preset size.
      Parameters:
      g - graphics component to draw on
      pt - x,y coordinate to draw centre of symbol at
    • draw

      public Rectangle draw(Graphics g, Point pt, int width, int height)
      Draw the symbol at a given point using a new width and height.
      Parameters:
      g - graphics component to draw on
      pt - x,y coordinate to draw centre of symbol at
      width - width for drawing symbol (overrides preset width)
      height - height for drawing symbol (overrides prest height)
    • draw

      public Rectangle draw(Graphics g, Point pt, int width, int height, ProjectorDrawingOptions drawingOptions)
      Draw the symbol at a given point using a new width and height.
      Parameters:
      g - graphics component to draw on
      pt - x,y coordinate to draw centre of symbol at
      width - width for drawing symbol (overrides preset width)
      height - height for drawing symbol (overrides preset height)
      drawingOptions - additional drawing options.
      Returns:
    • draw

      public Rectangle draw(Graphics g, Point pt, double w, double h, boolean fill, float lineThickness, int fillColorRGB, int lineColorRGB)
    • draw

      public Rectangle draw(Graphics g, Point pt, double w, double h, boolean fill, float lineThickness, Color fillColor, Color lineColor, ProjectorDrawingOptions drawingOptions)
    • draw

      public Rectangle draw(Graphics g, Point pt, double w, double h, boolean fill, float lineThickness, Color fillColor, Color lineColor)
      Draw the symbol using a complete new set of parameters.
      Parameters:
      g - graphics component to draw on
      pt - x,y coordinate to draw centre of symbol at
      w - width for drawing symbol (overrides preset width)
      h - height for drawing symbol (overrides prest height)
      fill - true if the symbol is to be filled, false for hollow
      lineThickness - outer line thickness
      fillColor - fill colour
      lineColor - line colour
      Returns:
      a rectangle giving an outer boud of the shape (can be used to invaldiate a graphic for redrawing).
    • getDrawnPolygon

      public Polygon getDrawnPolygon()
      Returns:
      the last drawn polygon
    • paintIcon

      public void paintIcon(Component c, Graphics g, int x, int y)
      Specified by:
      paintIcon in interface Icon
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isSolidShape

      public boolean isSolidShape()
      Returns:
      true if the symbol is a solid shape - e.g. is true for a circle, but false for a cross.
    • getIconWidth

      public int getIconWidth()
      Returns the icon's width.
      Specified by:
      getIconWidth in interface Icon
      Returns:
      an int specifying the fixed width of the icon.
    • getIconHeight

      public int getIconHeight()
      Returns the icon's height.
      Specified by:
      getIconHeight in interface Icon
      Returns:
      an int specifying the fixed height of the icon.
    • isFill

      public boolean isFill()
      Description copied from class: PamSymbolBase
      Is the symbol filled
      Overrides:
      isFill in class PamSymbolBase
      Returns:
      true if filled
    • setFill

      public void setFill(boolean fill)
      Description copied from class: PamSymbolBase
      Set the symbol fill
      Overrides:
      setFill in class PamSymbolBase
    • getFillColor

      public Color getFillColor()
    • setFillColor

      public void setFillColor(Color fillColor)
    • getLineColor

      public Color getLineColor()
    • setLineColor

      public void setLineColor(Color lineColor)
    • getSymbol

      public PamSymbolType getSymbol()
    • setSymbol

      public void setSymbol(PamSymbolType symbol)
    • getWidth

      public int getWidth()
      Get the symbol width as an integer
      Returns:
      symbol width in pixels
      See Also:
    • getHeight

      public int getHeight()
      Get the symbol height as an integer
      Returns:
      symbol height in pixels
      See Also:
    • makeKeyItem

      public PamKeyItem makeKeyItem(String text)
      Create a small JPanel to incorporate into a key. The component will contain a small panel on the left with a symbol drawn in it and a panel on the right with the text as a JLabel.
      Parameters:
      text -
      Returns:
      Java component to include in a key
    • clone

      public PamSymbol clone()
      Overrides:
      clone in class PamSymbolBase
    • drawArrow

      public static Rectangle drawArrow(Graphics g, int x1, int y1, int x2, int y2, int headSize)
    • drawArrow

      public static Rectangle drawArrow(Graphics g, double x1, double y1, double x2, double y2, double headSize, double headAngle, boolean doubleEnded)
    • getXPoints

      public double[] getXPoints()
    • getYPoints

      public double[] getYPoints()
    • getIconStyle

      public int getIconStyle()
      Returns:
      the iconStyle
    • setIconStyle

      public void setIconStyle(int iconStyle)
      Parameters:
      iconStyle - the iconStyle to set
    • setIconHorizontalAlignment

      public void setIconHorizontalAlignment(int hAlignment)
      Parameters:
      hAlignment - the icon horizontal alignment
    • getIconVerticalAlignment

      public int getIconVerticalAlignment()
      Returns:
      the iconVerticalAlignment
    • setIconVerticalAlignment

      public void setIconVerticalAlignment(int iconVerticalAlignment)
      Parameters:
      iconVerticalAlignment - the iconVerticalAlignment to set
    • getIconHorizontalAlignment

      public int getIconHorizontalAlignment()
      Returns:
      the iconHorizontalAlignment
    • getParameterSet

      public PamParameterSet getParameterSet()
      Description copied from interface: ManagedParameters
      Get a set of data that describes all of the parameters in a class
      Specified by:
      getParameterSet in interface ManagedParameters
      Returns:
      description of the parameters in a class.