Class RMShapePainterJ2D

java.lang.Object
com.inductiveautomation.rm.shape.RMShapePainterJ2D
All Implemented Interfaces:
RMPainter, RMShapePainter, Cloneable
Direct Known Subclasses:
RMEditorShapePainter

public class RMShapePainterJ2D extends Object implements RMShapePainter
This class manages the painting of shapes to a Java2D graphics object.
  • Constructor Details

    • RMShapePainterJ2D

      public RMShapePainterJ2D(Graphics2D aGr)
      Creates a new RMShapePainterJ2D.
  • Method Details

    • getBounds

      public Rectangle2D getBounds()
      Returns the painting bounds (can be null).
    • setBounds

      public void setBounds(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 interface RMPainter
    • 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 interface RMShapePainter
    • sendPaintShape

      public void sendPaintShape(RMShape aShape)
      Paints a child shape.
      Specified by:
      sendPaintShape in interface RMShapePainter
    • isEditing

      public boolean isEditing()
      Returns whether painting is for editor.
      Specified by:
      isEditing in interface RMShapePainter
    • isSelected

      public boolean isSelected(RMShape aShape)
      Returns whether given shape is selected.
      Specified by:
      isSelected in interface RMShapePainter
    • isSuperSelected

      public boolean isSuperSelected(RMShape aShape)
      Returns whether given shape is super selected.
      Specified by:
      isSuperSelected in interface RMShapePainter
    • isSuperSelectedShape

      public boolean isSuperSelectedShape(RMShape aShape)
      Returns whether given shape is THE super selected shape.
      Specified by:
      isSuperSelectedShape in interface RMShapePainter
    • getColor

      public Color getColor()
      Specified by:
      getColor in interface RMPainter
    • setColor

      public void setColor(Color c)
      Specified by:
      setColor in interface RMPainter
    • getFont

      public Font getFont()
      Specified by:
      getFont in interface RMPainter
    • setFont

      public void setFont(Font font)
      Specified by:
      setFont in interface RMPainter
    • getPaint

      public Paint getPaint()
      Specified by:
      getPaint in interface RMPainter
    • setPaint

      public void setPaint(Paint paint)
      Specified by:
      setPaint in interface RMPainter
    • getStroke

      public Stroke getStroke()
      Specified by:
      getStroke in interface RMPainter
    • setStroke

      public void setStroke(Stroke s)
      Specified by:
      setStroke in interface RMPainter
    • getOpacity

      public double getOpacity()
      Returns the opacity.
      Specified by:
      getOpacity in interface RMPainter
    • setOpacity

      public void setOpacity(double aValue)
      Sets the opacity.
      Specified by:
      setOpacity in interface RMPainter
    • draw

      public void draw(Shape s)
      Specified by:
      draw in interface RMPainter
    • fill

      public void fill(Shape s)
      Specified by:
      fill in interface RMPainter
    • drawLine

      public void drawLine(double x1, double y1, double x2, double y2)
      Specified by:
      drawLine in interface RMPainter
    • fillRect

      public void fillRect(double x, double y, double w, double h)
      Specified by:
      fillRect in interface RMPainter
    • drawRect

      public void drawRect(double x, double y, double w, double h)
      Specified by:
      drawRect in interface RMPainter
    • fill3DRect

      public void fill3DRect(double x, double y, double w, double h, boolean raised)
      Specified by:
      fill3DRect in interface RMPainter
    • drawButton

      public void drawButton(RMRect aRect, boolean isPressed)
      Draws a button for the given rect with an option for pressed.
      Specified by:
      drawButton in interface RMPainter
    • 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 interface RMPainter
    • drawImage

      public boolean drawImage(Image img, AffineTransform xform)
      Specified by:
      drawImage in interface RMPainter
    • drawImage

      public boolean drawImage(Image img, int x, int y, int w, int h)
      Specified by:
      drawImage in interface RMPainter
    • drawString

      public void drawString(String str, double x, double y)
      Specified by:
      drawString in interface RMPainter
    • drawGlyphVector

      public void drawGlyphVector(GlyphVector g, float x, float y)
      Specified by:
      drawGlyphVector in interface RMPainter
    • translate

      public void translate(double tx, double ty)
      Specified by:
      translate in interface RMPainter
    • rotate

      public void rotate(double theta)
      Specified by:
      rotate in interface RMPainter
    • scale

      public void scale(double sx, double sy)
      Specified by:
      scale in interface RMPainter
    • transform

      public void transform(AffineTransform Tx)
      Specified by:
      transform in interface RMPainter
    • getStringBounds

      public Rectangle2D getStringBounds(String aString)
      Returns the string bounds for current font.
      Specified by:
      getStringBounds in interface RMPainter
    • getFontAscent

      public double getFontAscent()
      Returns the ascender for the current font.
      Specified by:
      getFontAscent in interface RMPainter
    • getClipBounds

      public Rectangle getClipBounds()
      Specified by:
      getClipBounds in interface RMPainter
    • getClip

      public Shape getClip()
      Specified by:
      getClip in interface RMPainter
    • setClip

      public void setClip(Shape clip)
      Specified by:
      setClip in interface RMPainter
    • clip

      public void clip(Shape s)
      Specified by:
      clip in interface RMPainter
    • dispose

      public void dispose()
      Specified by:
      dispose in interface RMPainter
    • setAntialiasing

      public boolean setAntialiasing(boolean aValue)
      Sets whether antialiasing.
      Specified by:
      setAntialiasing in interface RMPainter
    • getGraphics

      public Graphics2D getGraphics()
      Returns the graphics.
      Specified by:
      getGraphics in interface RMPainter
    • clone

      public RMShapePainter clone()
      Standard clone implementation.
      Specified by:
      clone in interface RMPainter
      Specified by:
      clone in interface RMShapePainter
      Overrides:
      clone in class Object
    • toString

      public String toString()
      Standard toString implementation.
      Overrides:
      toString in class Object