Package PamView
Class PamSymbol
java.lang.Object
PamView.PamSymbolBase
PamView.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 Summary
Modifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final long
static final int
static final int
static final int
-
Constructor Summary
ConstructorDescriptionSimplest constructor creates a PamSymbol with default attributes.PamSymbol
(PamSymbolType symbol, int width, int height, boolean fill, Color fillColor, Color lineColor) Creates a PamSymbol with a given shape, size, colour, etc.PamSymbol
(SymbolData symbolData) -
Method Summary
Modifier and TypeMethodDescriptionclone()
Draw the symbol at a given point using it's preset size.draw
(Graphics g, Point pt, double w, double h, boolean fill, float lineThickness, int fillColorRGB, int lineColorRGB) 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.draw
(Graphics g, Point pt, double w, double h, boolean fill, float lineThickness, Color fillColor, Color lineColor, ProjectorDrawingOptions drawingOptions) Draw the symbol at a given point using a new width and height.draw
(Graphics g, Point pt, int width, int height, ProjectorDrawingOptions drawingOptions) Draw the symbol at a given point using a new width and height.draw
(Graphics g, Point pt, ProjectorDrawingOptions drawingOptions) Draw the shape with additional options.static Rectangle
drawArrow
(Graphics g, double x1, double y1, double x2, double y2, double headSize, double headAngle, boolean doubleEnded) static Rectangle
int
Get the symbol height as an integerint
Returns the icon's height.int
int
int
int
Returns the icon's width.Get a set of data that describes all of the parameters in a classint
getWidth()
Get the symbol width as an integerdouble[]
double[]
boolean
isFill()
Is the symbol filledboolean
makeKeyItem
(String text) Create a small JPanel to incorporate into a key.void
void
setFill
(boolean fill) Set the symbol fillvoid
setFillColor
(Color fillColor) void
setIconHorizontalAlignment
(int hAlignment) void
setIconStyle
(int iconStyle) void
setIconVerticalAlignment
(int iconVerticalAlignment) void
setLineColor
(Color lineColor) void
setSymbol
(PamSymbolType symbol) toString()
Methods inherited from class PamView.PamSymbolBase
getDHeight, getDWidth, getLineThickness, getSymbolData, getTextCode, getTextCode, interpretTextCode, setHeight, setLineThickness, setSymbolData, setWidth
-
Field Details
-
serialVersionUID
public static final long serialVersionUID- See Also:
-
SYMBOL_NONE
public static final int SYMBOL_NONE- See Also:
-
SYMBOL_REGIONSTART
public static final int SYMBOL_REGIONSTART- See Also:
-
SYMBOL_LINESTART
public static final int SYMBOL_LINESTART- See Also:
-
ICON_STYLE_SYMBOL
public static final int ICON_STYLE_SYMBOL- See Also:
-
ICON_STYLE_LINE
public static final int ICON_STYLE_LINE- See Also:
-
ICON_HORIZONTAL_LEFT
public static final int ICON_HORIZONTAL_LEFT- See Also:
-
ICON_HORIZONTAL_CENTRE
public static final int ICON_HORIZONTAL_CENTRE- See Also:
-
ICON_HORIZONTAL_RIGHT
public static final int ICON_HORIZONTAL_RIGHT- See Also:
-
ICON_HORIZONTAL_FILL
public static final int ICON_HORIZONTAL_FILL- See Also:
-
ICON_VERTICAL_TOP
public static final int ICON_VERTICAL_TOP- See Also:
-
ICON_VERTICAL_MIDDLE
public static final int ICON_VERTICAL_MIDDLE- See Also:
-
ICON_VERTICAL_BOTTOM
public static final int ICON_VERTICAL_BOTTOM- See Also:
-
ICON_VERTICAL_FILL
public static final int ICON_VERTICAL_FILL- See Also:
-
-
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
-
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 typewidth
- Width of symbol in pixelsheight
- Height of symbol in pixelsfill
- true if the symbol is to be filled, false if the shape should be hollowfillColor
- fill colour (required fill to be true)lineColor
- line colour
-
-
Method Details
-
draw
Draw the shape with additional options.- Parameters:
g
- graphics handlept
- point to centre shape at.drawingOptions
- drawing options- Returns:
- bounding rectangle of draw
-
draw
Draw the symbol at a given point using it's preset size.- Parameters:
g
- graphics component to draw onpt
- x,y coordinate to draw centre of symbol at
-
draw
Draw the symbol at a given point using a new width and height.- Parameters:
g
- graphics component to draw onpt
- x,y coordinate to draw centre of symbol atwidth
- 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 onpt
- x,y coordinate to draw centre of symbol atwidth
- width for drawing symbol (overrides preset width)height
- height for drawing symbol (overrides preset height)drawingOptions
- additional drawing options.- Returns:
-
draw
-
draw
-
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 onpt
- x,y coordinate to draw centre of symbol atw
- 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 hollowlineThickness
- outer line thicknessfillColor
- fill colourlineColor
- line colour- Returns:
- a rectangle giving an outer boud of the shape (can be used to invaldiate a graphic for redrawing).
-
getDrawnPolygon
- Returns:
- the last drawn polygon
-
paintIcon
-
toString
-
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 interfaceIcon
- Returns:
- an int specifying the fixed width of the icon.
-
getIconHeight
public int getIconHeight()Returns the icon's height.- Specified by:
getIconHeight
in interfaceIcon
- 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 classPamSymbolBase
- Returns:
- true if filled
-
setFill
public void setFill(boolean fill) Description copied from class:PamSymbolBase
Set the symbol fill- Overrides:
setFill
in classPamSymbolBase
-
getFillColor
-
setFillColor
-
getLineColor
-
setLineColor
-
getSymbol
-
setSymbol
-
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
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
- Overrides:
clone
in classPamSymbolBase
-
drawArrow
-
drawArrow
-
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
Description copied from interface:ManagedParameters
Get a set of data that describes all of the parameters in a class- Specified by:
getParameterSet
in interfaceManagedParameters
- Returns:
- description of the parameters in a class.
-