Package adams.flow.transformer.draw
Class Rectangle
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,AntiAliasingDrawOperation
,Serializable
public class Rectangle extends AbstractColorStrokeDrawOperation
Draws a rectangle with the specified color and dimensions at the given location. If the arc width/height are greater than 0, a rounded rectangle is drawn. The rectangle can be filled as well.
Valid options are:
-D <int> (property: debugLevel) The greater the number the more additional info the scheme may output to the console (0 = off). default: 0 minimum: 0
-color <java.awt.Color> (property: color) The color of the pixel. default: #000000
-stroke-thickness <float> (property: strokeThickness) The thickness of the stroke. default: 1.0 minimum: 0.01
-anti-aliasing-enabled (property: antiAliasingEnabled) If enabled, uses anti-aliasing for drawing.
-x <int> (property: X) The X position of the top-left corner of the rectangle (1-based). default: 1 minimum: 1
-y <int> (property: Y) The Y position of the top-left corner of the rectangle (1-based). default: 1 minimum: 1
-width <int> (property: width) The width of the rectangle. default: 10 minimum: 1
-height <int> (property: height) The height of the rectangle. default: 10 minimum: 1
-arc-width <int> (property: arcWidth) The width of the arc for a rounded rectangle. default: 0 minimum: 0
-arc-height <int> (property: arcHeight) The height of the arc for a rounded rectangle. default: 0 minimum: 0
-fill (property: fill) If enabled, the rectangle gets filled with the specified color.
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected int
m_ArcHeight
the height of the arc.protected int
m_ArcWidth
the width of the arc.protected boolean
m_Fill
whether to fill the rectangle.protected int
m_Height
the height of the rectangle.protected int
m_Width
the width of the rectangle.protected int
m_X
the X position of the rectangle (1-based).protected int
m_Y
the Y position of the rectangle (1-based).-
Fields inherited from class adams.flow.transformer.draw.AbstractColorStrokeDrawOperation
m_AntiAliasingEnabled, m_StrokeThickness
-
Fields inherited from class adams.flow.transformer.draw.AbstractColorDrawOperation
m_Color
-
Fields inherited from class adams.flow.transformer.draw.AbstractDrawOperation
m_Owner
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description Rectangle()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
arcHeightTipText()
Returns the tip text for this property.String
arcWidthTipText()
Returns the tip text for this property.protected String
check(BufferedImageContainer image)
Checks the image.void
defineOptions()
Adds options to the internal list of options.protected String
doDraw(BufferedImageContainer image)
Performs the actual draw operation.String
fillTipText()
Returns the tip text for this property.int
getArcHeight()
Returns the height of the arc.int
getArcWidth()
Returns the width of the arc.boolean
getFill()
Returns whether to fill the rectangle.int
getHeight()
Returns the height of the rectangle.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.int
getWidth()
Returns the width of the rectangle.int
getX()
Returns the X position of the rectangle (top-left corner).int
getY()
Returns the Y position of the rectangle (top-left corner).String
globalInfo()
Returns a string describing the object.String
heightTipText()
Returns the tip text for this property.void
setArcHeight(int value)
Sets the height of the arc.void
setArcWidth(int value)
Sets the width of the arc.void
setFill(boolean value)
Sets whether to fill the rectangle.void
setHeight(int value)
Sets the height of the rectangle.void
setWidth(int value)
Sets the width of the rectangle.void
setX(int value)
Sets the X position of the rectangle (top-left corner).void
setY(int value)
Sets the Y position of the rectangle (top-left corner).String
widthTipText()
Returns the tip text for this property.String
XTipText()
Returns the tip text for this property.String
YTipText()
Returns the tip text for this property.-
Methods inherited from class adams.flow.transformer.draw.AbstractColorStrokeDrawOperation
antiAliasingEnabledTipText, getStrokeThickness, isAntiAliasingEnabled, setAntiAliasingEnabled, setStrokeThickness, strokeThicknessTipText
-
Methods inherited from class adams.flow.transformer.draw.AbstractColorDrawOperation
colorTipText, getColor, setColor
-
Methods inherited from class adams.flow.transformer.draw.AbstractDrawOperation
draw, getOwner, setOwner
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_X
protected int m_X
the X position of the rectangle (1-based).
-
m_Y
protected int m_Y
the Y position of the rectangle (1-based).
-
m_Width
protected int m_Width
the width of the rectangle.
-
m_Height
protected int m_Height
the height of the rectangle.
-
m_ArcWidth
protected int m_ArcWidth
the width of the arc.
-
m_ArcHeight
protected int m_ArcHeight
the height of the arc.
-
m_Fill
protected boolean m_Fill
whether to fill the rectangle.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractColorStrokeDrawOperation
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractDrawOperation
- Returns:
- null if no info available, otherwise short string
-
setX
public void setX(int value)
Sets the X position of the rectangle (top-left corner).- Parameters:
value
- the position, 1-based
-
getX
public int getX()
Returns the X position of the rectangle (top-left corner).- Returns:
- the position, 1-based
-
XTipText
public String XTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setY
public void setY(int value)
Sets the Y position of the rectangle (top-left corner).- Parameters:
value
- the position, 1-based
-
getY
public int getY()
Returns the Y position of the rectangle (top-left corner).- Returns:
- the position, 1-based
-
YTipText
public String YTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setWidth
public void setWidth(int value)
Sets the width of the rectangle.- Parameters:
value
- the width
-
getWidth
public int getWidth()
Returns the width of the rectangle.- Returns:
- the width
-
widthTipText
public String widthTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setHeight
public void setHeight(int value)
Sets the height of the rectangle.- Parameters:
value
- the height
-
getHeight
public int getHeight()
Returns the height of the rectangle.- Returns:
- the height
-
heightTipText
public String heightTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setArcWidth
public void setArcWidth(int value)
Sets the width of the arc.- Parameters:
value
- the width
-
getArcWidth
public int getArcWidth()
Returns the width of the arc.- Returns:
- the width
-
arcWidthTipText
public String arcWidthTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setArcHeight
public void setArcHeight(int value)
Sets the height of the arc.- Parameters:
value
- the height
-
getArcHeight
public int getArcHeight()
Returns the height of the arc.- Returns:
- the height
-
arcHeightTipText
public String arcHeightTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFill
public void setFill(boolean value)
Sets whether to fill the rectangle.- Parameters:
value
- true if to fill
-
getFill
public boolean getFill()
Returns whether to fill the rectangle.- Returns:
- true if to fill
-
fillTipText
public String fillTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
check
protected String check(BufferedImageContainer image)
Checks the image.- Overrides:
check
in classAbstractDrawOperation
- Parameters:
image
- the image to check- Returns:
- null if OK, otherwise error message
-
doDraw
protected String doDraw(BufferedImageContainer image)
Performs the actual draw operation.- Specified by:
doDraw
in classAbstractDrawOperation
- Parameters:
image
- the image to draw on- Returns:
- null if OK, otherwise error message
-
-