Package com.inductiveautomation.rm.shape
Class RMShapePainterJ2D
- java.lang.Object
-
- com.inductiveautomation.rm.shape.RMShapePainterJ2D
-
- All Implemented Interfaces:
RMPainter
,RMShapePainter
,java.lang.Cloneable
- Direct Known Subclasses:
RMEditorShapePainter
public class RMShapePainterJ2D extends java.lang.Object implements RMShapePainter
This class manages the painting of shapes to a Java2D graphics object.
-
-
Constructor Summary
Constructors Constructor Description RMShapePainterJ2D(java.awt.Graphics2D aGr)
Creates a new RMShapePainterJ2D.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clip(java.awt.Shape s)
RMShapePainter
clone()
Standard clone implementation.void
dispose()
void
draw(java.awt.Shape s)
void
drawButton(double x, double y, double w, double h, boolean isPressed)
Draws a button for the given rect with an option for pressed.void
drawButton(RMRect aRect, boolean isPressed)
Draws a button for the given rect with an option for pressed.void
drawGlyphVector(java.awt.font.GlyphVector g, float x, float y)
boolean
drawImage(java.awt.Image img, int x, int y, int w, int h)
boolean
drawImage(java.awt.Image img, java.awt.geom.AffineTransform xform)
void
drawLine(double x1, double y1, double x2, double y2)
void
drawRect(double x, double y, double w, double h)
void
drawString(java.lang.String str, double x, double y)
void
fill(java.awt.Shape s)
void
fill3DRect(double x, double y, double w, double h, boolean raised)
void
fillRect(double x, double y, double w, double h)
float
getAlignmentX()
Returns the horizontal alignment.float
getAlignmentY()
Returns the vertical alignment.java.awt.geom.Rectangle2D
getBounds()
Returns the painting bounds (can be null).java.awt.Shape
getClip()
java.awt.Rectangle
getClipBounds()
java.awt.Color
getColor()
java.awt.Font
getFont()
double
getFontAscent()
Returns the ascender for the current font.java.awt.Graphics2D
getGraphics()
Returns the graphics.double
getOpacity()
Returns the opacity.java.awt.Paint
getPaint()
float
getScale()
Returns the default scale.java.awt.geom.Rectangle2D
getStringBounds(java.lang.String aString)
Returns the string bounds for current font.java.awt.Stroke
getStroke()
boolean
isEditing()
Returns whether painting is for editor.boolean
isGrowToFit()
Returns whether painter should scale painting of shape up to fit boundsboolean
isPrinting()
Returns whether shape painting is really printing.boolean
isSelected(RMShape aShape)
Returns whether given shape is selected.boolean
isShrinkToFit()
Returns whether painter should scale painting of shape down to fit boundsboolean
isSuperSelected(RMShape aShape)
Returns whether given shape is super selected.boolean
isSuperSelectedShape(RMShape aShape)
Returns whether given shape is THE super selected shape.void
paintShape(RMShape aShape)
Paints a simple shape.void
rotate(double theta)
void
scale(double sx, double sy)
void
sendPaintShape(RMShape aShape)
Paints a child shape.void
setAlignmentX(float aValue)
Sets the horizontal alignment.void
setAlignmentY(float aValue)
Sets the vertical alignment.boolean
setAntialiasing(boolean aValue)
Sets whether antialiasing.void
setBounds(double x, double y, double w, double h)
Sets the painting bounds.void
setBounds(java.awt.geom.Rectangle2D aRect)
Sets the painting bounds (can be null).void
setClip(java.awt.Shape clip)
void
setColor(java.awt.Color c)
void
setFont(java.awt.Font font)
void
setGrowToFit(boolean aValue)
Returns whether painter should scale painting of shape up to fit boundsvoid
setOpacity(double aValue)
Sets the opacity.void
setPaint(java.awt.Paint paint)
void
setPrinting(boolean aValue)
Sets whether shape painting is really printing.void
setScale(float aValue)
Sets the default scale.void
setShrinkToFit(boolean aValue)
Returns whether painter should scale painting of shape down to fit boundsvoid
setStroke(java.awt.Stroke s)
java.lang.String
toString()
Standard toString implementation.void
transform(java.awt.geom.AffineTransform Tx)
void
translate(double tx, double ty)
-
-
-
Method Detail
-
getBounds
public java.awt.geom.Rectangle2D getBounds()
Returns the painting bounds (can be null).
-
setBounds
public void setBounds(java.awt.geom.Rectangle2D aRect)
Sets the painting bounds (can be null).
-
setBounds
public void setBounds(double x, double y, double w, double h)
Sets the painting bounds.
-
getAlignmentX
public float getAlignmentX()
Returns the horizontal alignment.
-
setAlignmentX
public void setAlignmentX(float aValue)
Sets the horizontal alignment.
-
getAlignmentY
public float getAlignmentY()
Returns the vertical alignment.
-
setAlignmentY
public void setAlignmentY(float aValue)
Sets the vertical alignment.
-
getScale
public float getScale()
Returns the default scale.
-
setScale
public void setScale(float aValue)
Sets the default scale.
-
isGrowToFit
public boolean isGrowToFit()
Returns whether painter should scale painting of shape up to fit bounds
-
setGrowToFit
public void setGrowToFit(boolean aValue)
Returns whether painter should scale painting of shape up to fit bounds
-
isShrinkToFit
public boolean isShrinkToFit()
Returns whether painter should scale painting of shape down to fit bounds
-
setShrinkToFit
public void setShrinkToFit(boolean aValue)
Returns whether painter should scale painting of shape down to fit bounds
-
isPrinting
public boolean isPrinting()
Returns whether shape painting is really printing.- Specified by:
isPrinting
in interfaceRMPainter
-
setPrinting
public void setPrinting(boolean aValue)
Sets whether shape painting is really printing.
-
paintShape
public void paintShape(RMShape aShape)
Paints a simple shape.- Specified by:
paintShape
in interfaceRMShapePainter
-
sendPaintShape
public void sendPaintShape(RMShape aShape)
Paints a child shape.- Specified by:
sendPaintShape
in interfaceRMShapePainter
-
isEditing
public boolean isEditing()
Returns whether painting is for editor.- Specified by:
isEditing
in interfaceRMShapePainter
-
isSelected
public boolean isSelected(RMShape aShape)
Returns whether given shape is selected.- Specified by:
isSelected
in interfaceRMShapePainter
-
isSuperSelected
public boolean isSuperSelected(RMShape aShape)
Returns whether given shape is super selected.- Specified by:
isSuperSelected
in interfaceRMShapePainter
-
isSuperSelectedShape
public boolean isSuperSelectedShape(RMShape aShape)
Returns whether given shape is THE super selected shape.- Specified by:
isSuperSelectedShape
in interfaceRMShapePainter
-
getOpacity
public double getOpacity()
Returns the opacity.- Specified by:
getOpacity
in interfaceRMPainter
-
setOpacity
public void setOpacity(double aValue)
Sets the opacity.- Specified by:
setOpacity
in interfaceRMPainter
-
drawLine
public void drawLine(double x1, double y1, double x2, double y2)
-
fillRect
public void fillRect(double x, double y, double w, double h)
-
drawRect
public void drawRect(double x, double y, double w, double h)
-
fill3DRect
public void fill3DRect(double x, double y, double w, double h, boolean raised)
- Specified by:
fill3DRect
in interfaceRMPainter
-
drawButton
public void drawButton(RMRect aRect, boolean isPressed)
Draws a button for the given rect with an option for pressed.- Specified by:
drawButton
in interfaceRMPainter
-
drawButton
public void drawButton(double x, double y, double w, double h, boolean isPressed)
Draws a button for the given rect with an option for pressed.- Specified by:
drawButton
in interfaceRMPainter
-
drawImage
public boolean drawImage(java.awt.Image img, java.awt.geom.AffineTransform xform)
-
drawImage
public boolean drawImage(java.awt.Image img, int x, int y, int w, int h)
-
drawString
public void drawString(java.lang.String str, double x, double y)
- Specified by:
drawString
in interfaceRMPainter
-
drawGlyphVector
public void drawGlyphVector(java.awt.font.GlyphVector g, float x, float y)
- Specified by:
drawGlyphVector
in interfaceRMPainter
-
translate
public void translate(double tx, double ty)
-
transform
public void transform(java.awt.geom.AffineTransform Tx)
-
getStringBounds
public java.awt.geom.Rectangle2D getStringBounds(java.lang.String aString)
Returns the string bounds for current font.- Specified by:
getStringBounds
in interfaceRMPainter
-
getFontAscent
public double getFontAscent()
Returns the ascender for the current font.- Specified by:
getFontAscent
in interfaceRMPainter
-
getClipBounds
public java.awt.Rectangle getClipBounds()
- Specified by:
getClipBounds
in interfaceRMPainter
-
setAntialiasing
public boolean setAntialiasing(boolean aValue)
Sets whether antialiasing.- Specified by:
setAntialiasing
in interfaceRMPainter
-
getGraphics
public java.awt.Graphics2D getGraphics()
Returns the graphics.- Specified by:
getGraphics
in interfaceRMPainter
-
clone
public RMShapePainter clone()
Standard clone implementation.- Specified by:
clone
in interfaceRMPainter
- Specified by:
clone
in interfaceRMShapePainter
- Overrides:
clone
in classjava.lang.Object
-
toString
public java.lang.String toString()
Standard toString implementation.- Overrides:
toString
in classjava.lang.Object
-
-