Module Simula

Class RTS_ShapeElement

All Implemented Interfaces:
Runnable, RTS_Drawing.Animable

public class RTS_ShapeElement extends RTS_Link implements RTS_Drawing.Animable
Additional System class ShapeElement.
 Link class ShapeElement;
 begin Integer COLOR,STROKE;
       ref(Shape) SHAPE; ! Java Class Shape is not visible in Simula ;
 
       Procedure setColor(rgb); Integer rgb; ... ... ;
       Procedure setStroke(size); Real size; ... ... ;
 
       Procedure drawLine(x1,y1,x2,y2); Long Real x1,y1,x2,y2; ... ... ;
       Procedure drawEllipse(x,y,width,height); Long Real x,y,width,height; ... ... ;
       Procedure drawRectangle(x,y,width,height); Long Real x,y,width,height; ... ... ;
       Procedure drawRoundRectangle(x,y,width,height,arcw,arch); Long Real x,y,width,height,arcw,arch; ... ... ;
       Procedure fillEllipse(x,y,width,height); Long Real x,y,width,height; ... ... ;
       Procedure fillRectangle(x,y,width,height); Long Real x,y,width,height; ... ... ;
       Procedure fillRoundRectangle(x,y,width,height,arcw,arch); Long Real x,y,width,height,arcw,arch; ... ... ;
    
       Procedure instantMoveTo(x,y); Long Real x,y; ... ... ;
       Procedure moveTo(x,y,speed); Long Real x,y,speed; ... ... ;
    
       STROKE := CURRENT_STROKE_WIDTH;
       into(RENDERING_SET);
 end;
 
Link to GitHub: Source File.
Author:
Øystein Myhre Andersen
  • Field Details

    • drawing

      final RTS_Drawing drawing
      The current drawing.
    • drawColor

      Color drawColor
      The current draw color. If null: no drawing
    • fillColor

      Color fillColor
      The current fill color. If null: no filling
    • stroke

      Stroke stroke
      The current stroke.
    • shape

      Shape shape
      The current shape.
  • Constructor Details

    • RTS_ShapeElement

      public RTS_ShapeElement(RTS_RTObject SL)
      Create a new _ShapeElement.
      Parameters:
      SL - staticLink
  • Method Details

    • _STM

      public RTS_ShapeElement _STM()
      Description copied from class: RTS_RTObject
      Method representing the Statements in this Block
      This method is virtual and must be redefined in blocks.
      Overrides:
      _STM in class RTS_Link
      Returns:
      a pointer to this _RTObject
    • drawLine

      public void drawLine(double x1, double y1, double x2, double y2)
      Draw Line
      Parameters:
      x1 - the X coordinate of the start point
      y1 - the Y coordinate of the start point
      x2 - the X coordinate of the end point
      y2 - the Y coordinate of the end point
    • drawEllipse

      public void drawEllipse(double x, double y, double w, double h)
      Draw Ellipse.
      Parameters:
      x - the X coordinate
      y - the Y coordinate
      w - the width of the ellipse
      h - the height of the ellipse
    • drawRectangle

      public void drawRectangle(double x, double y, double w, double h)
      Draw Rectangle.
      Parameters:
      x - the X coordinate
      y - the Y coordinate
      w - the width of the rectangle
      h - the height of the rectangle
    • drawRoundRectangle

      public void drawRoundRectangle(double x, double y, double w, double h, double arcw, double arch)
      Draw Rounded Rectangle.
      Parameters:
      x - the X coordinate
      y - the Y coordinate
      w - the width of the rectangle
      h - the height of the rectangle
      arcw - the width of the arc to use to round off the corners
      arch - the height of the arc to use to round off the corners
    • fillEllipse

      public void fillEllipse(double x, double y, double w, double h)
      Fill Ellipse.
      Parameters:
      x - the X coordinate
      y - the Y coordinate
      w - the width of the ellipse
      h - the height of the ellipse
    • fillRectangle

      public void fillRectangle(double x, double y, double w, double h)
      Fill Rectangle.
      Parameters:
      x - the X coordinate
      y - the Y coordinate
      w - the width of the rectangle
      h - the height of the rectangle
    • fillRoundRectangle

      public void fillRoundRectangle(double x, double y, double w, double h, double arcw, double arch)
      Fill Rounded Rectangle.
      Parameters:
      x - the X coordinate
      y - the Y coordinate
      w - the width of the rectangle
      h - the height of the rectangle
      arcw - the width of the arc to use to round off the corners
      arch - the height of the arc to use to round off the corners
    • setColor

      public void setColor(int rgb)
      Set fill and draw color.
      Parameters:
      rgb - the new fill and draw color.
    • setStroke

      public void setStroke(float size)
      Set stroke size.
      Parameters:
      size - the new stroke size.
    • instantMoveTo

      public void instantMoveTo(double x, double y)
      Instant move.
      Parameters:
      x - the X coordinate
      y - the Y coordinate
    • moveTo

      public void moveTo(double x, double y, double speed)
      Rolling motion to a new position.
      Parameters:
      x - the X coordinate
      y - the Y coordinate
      speed - pixels per milli-second
    • paint

      public void paint(Graphics2D g)
      Description copied from interface: RTS_Drawing.Animable
      Paint this Animable
      Specified by:
      paint in interface RTS_Drawing.Animable
      Parameters:
      g - the graphic context