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 voidclip(java.awt.Shape s)RMShapePainterclone()Standard clone implementation.voiddispose()voiddraw(java.awt.Shape s)voiddrawButton(double x, double y, double w, double h, boolean isPressed)Draws a button for the given rect with an option for pressed.voiddrawButton(RMRect aRect, boolean isPressed)Draws a button for the given rect with an option for pressed.voiddrawGlyphVector(java.awt.font.GlyphVector g, float x, float y)booleandrawImage(java.awt.Image img, int x, int y, int w, int h)booleandrawImage(java.awt.Image img, java.awt.geom.AffineTransform xform)voiddrawLine(double x1, double y1, double x2, double y2)voiddrawRect(double x, double y, double w, double h)voiddrawString(java.lang.String str, double x, double y)voidfill(java.awt.Shape s)voidfill3DRect(double x, double y, double w, double h, boolean raised)voidfillRect(double x, double y, double w, double h)floatgetAlignmentX()Returns the horizontal alignment.floatgetAlignmentY()Returns the vertical alignment.java.awt.geom.Rectangle2DgetBounds()Returns the painting bounds (can be null).java.awt.ShapegetClip()java.awt.RectanglegetClipBounds()java.awt.ColorgetColor()java.awt.FontgetFont()doublegetFontAscent()Returns the ascender for the current font.java.awt.Graphics2DgetGraphics()Returns the graphics.doublegetOpacity()Returns the opacity.java.awt.PaintgetPaint()floatgetScale()Returns the default scale.java.awt.geom.Rectangle2DgetStringBounds(java.lang.String aString)Returns the string bounds for current font.java.awt.StrokegetStroke()booleanisEditing()Returns whether painting is for editor.booleanisGrowToFit()Returns whether painter should scale painting of shape up to fit boundsbooleanisPrinting()Returns whether shape painting is really printing.booleanisSelected(RMShape aShape)Returns whether given shape is selected.booleanisShrinkToFit()Returns whether painter should scale painting of shape down to fit boundsbooleanisSuperSelected(RMShape aShape)Returns whether given shape is super selected.booleanisSuperSelectedShape(RMShape aShape)Returns whether given shape is THE super selected shape.voidpaintShape(RMShape aShape)Paints a simple shape.voidrotate(double theta)voidscale(double sx, double sy)voidsendPaintShape(RMShape aShape)Paints a child shape.voidsetAlignmentX(float aValue)Sets the horizontal alignment.voidsetAlignmentY(float aValue)Sets the vertical alignment.booleansetAntialiasing(boolean aValue)Sets whether antialiasing.voidsetBounds(double x, double y, double w, double h)Sets the painting bounds.voidsetBounds(java.awt.geom.Rectangle2D aRect)Sets the painting bounds (can be null).voidsetClip(java.awt.Shape clip)voidsetColor(java.awt.Color c)voidsetFont(java.awt.Font font)voidsetGrowToFit(boolean aValue)Returns whether painter should scale painting of shape up to fit boundsvoidsetOpacity(double aValue)Sets the opacity.voidsetPaint(java.awt.Paint paint)voidsetPrinting(boolean aValue)Sets whether shape painting is really printing.voidsetScale(float aValue)Sets the default scale.voidsetShrinkToFit(boolean aValue)Returns whether painter should scale painting of shape down to fit boundsvoidsetStroke(java.awt.Stroke s)java.lang.StringtoString()Standard toString implementation.voidtransform(java.awt.geom.AffineTransform Tx)voidtranslate(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:
isPrintingin 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:
paintShapein interfaceRMShapePainter
-
sendPaintShape
public void sendPaintShape(RMShape aShape)
Paints a child shape.- Specified by:
sendPaintShapein interfaceRMShapePainter
-
isEditing
public boolean isEditing()
Returns whether painting is for editor.- Specified by:
isEditingin interfaceRMShapePainter
-
isSelected
public boolean isSelected(RMShape aShape)
Returns whether given shape is selected.- Specified by:
isSelectedin interfaceRMShapePainter
-
isSuperSelected
public boolean isSuperSelected(RMShape aShape)
Returns whether given shape is super selected.- Specified by:
isSuperSelectedin interfaceRMShapePainter
-
isSuperSelectedShape
public boolean isSuperSelectedShape(RMShape aShape)
Returns whether given shape is THE super selected shape.- Specified by:
isSuperSelectedShapein interfaceRMShapePainter
-
getOpacity
public double getOpacity()
Returns the opacity.- Specified by:
getOpacityin interfaceRMPainter
-
setOpacity
public void setOpacity(double aValue)
Sets the opacity.- Specified by:
setOpacityin 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:
fill3DRectin interfaceRMPainter
-
drawButton
public void drawButton(RMRect aRect, boolean isPressed)
Draws a button for the given rect with an option for pressed.- Specified by:
drawButtonin 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:
drawButtonin 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:
drawStringin interfaceRMPainter
-
drawGlyphVector
public void drawGlyphVector(java.awt.font.GlyphVector g, float x, float y)- Specified by:
drawGlyphVectorin 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:
getStringBoundsin interfaceRMPainter
-
getFontAscent
public double getFontAscent()
Returns the ascender for the current font.- Specified by:
getFontAscentin interfaceRMPainter
-
getClipBounds
public java.awt.Rectangle getClipBounds()
- Specified by:
getClipBoundsin interfaceRMPainter
-
setAntialiasing
public boolean setAntialiasing(boolean aValue)
Sets whether antialiasing.- Specified by:
setAntialiasingin interfaceRMPainter
-
getGraphics
public java.awt.Graphics2D getGraphics()
Returns the graphics.- Specified by:
getGraphicsin interfaceRMPainter
-
clone
public RMShapePainter clone()
Standard clone implementation.- Specified by:
clonein interfaceRMPainter- Specified by:
clonein interfaceRMShapePainter- Overrides:
clonein classjava.lang.Object
-
toString
public java.lang.String toString()
Standard toString implementation.- Overrides:
toStringin classjava.lang.Object
-
-