Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## sema
Class Drawing

    java.lang.Object
      sema.Drawing

public class Drawing
extends java.lang.Object

Graphics and parameters. This class is in charge of all the drawing within the simulation. An element of the world must use this class to draw itself, because Drawing is the only class in Sema which knows the graphics context. The main advantage is that the elements don't have to convert dimensions between simulated units and pixels.

Field Summary
`float` | `boxFactor` Default boxfactor to use for the simulation.
`float` | `centerX` X-coordinate to center the map by default.
`float` | `centerY` Y-coordinate to center the map by default.
`float` | `maxTfactor` Max value of the time factor slider in the interface.
`float` | `maxZoom` Max value of the zoom slider in the interface.
`float` | `minTfactor` Max value of the time factor slider in the interface.
`float` | `minZoom` Min value of the zoom slider in the interface.
`float` | `pixelsByBoxZoom1x` Pixels by square box side, when zoom=1.
`float` | `pixelsByUnitZoom1x` Pixels by simulated unit, when zoom=1.
`int` | `realDelay` Default virtual delay (in ms) between to displays of the world in the graphical interface.
`float` | `tFactor` Default temporal factor.
`float` | `virtualDelay` Default virtual delay (in ms) between to displays of the world in the graphical interface.

Constructor Summary
`Drawing(float pixelsByUnitZoom1x, float boxLength, float minZoom, float maxZoom, float minTfactor, float maxTfactor, float tFactor, float zoomFactor, int virtualD, int realD, float centerX, float centerY, int boxFactor)` New graphical interface for the simulation.

Method Summary
`void` | `draw(java.awt.Graphics2D g, java.util.Vector boxToRefresh)` Draws the world.
`void` | `drawCircle(float x, float y, float radius)` Draws a circle.
`void` | `drawImage(java.awt.Image image, float x, float y, float xLength, float yLength)` Draws a picture.
`void` | `drawImage(java.awt.Image image, float x0, float y0, float xLength, float yLength, float angle, float x, float y)` Draws a picture, provided an angle and a center of rotation.
`void` | `drawLine(float x1, float y1, float x2, float y2)` Draws a line.
`void` | `drawRect(float x, float y, float xLength, float yLength)` Draws a rectangle.
`void` | `drawRect(float x0, float y0, float xLength, float yLength, float angle, float x, float y)` Draws a rectangle, provided its angle and a center of rotation.
`void` | `drawRoundRect(float x, float y, float xLength, float yLength)` Draws a round rectangle.
`void` | `drawString(java.lang.String s, float x, float y)`
`void` | `fillCircle(float x, float y, float radius)` Fills a circle.
`void` | `fillRect(float x, float y, float xLength, float yLength)` Fills a rectangle.
`void` | `fillRect(float x0, float y0, float xLength, float yLength, float angle, float x, float y)` Fills a rectangle, provided its angle and a center of rotation.
`void` | `fillRoundRect(float x, float y, float xLength, float yLength)` Fills a round rectangle.
`float` | `getPixelsByBox()` Pixels by square box side (with current zoom).
`float` | `getPixelsByUnit()` Pixels by simulated unit (with current zoom).
`float` | `getZoom()` Current zoom.
`void` | `setColor(java.awt.Color c)` Sets the color of drawing.
`void` | `setZoom(float z)` Sets the current zoom.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### boxFactor

    public final float boxFactor

  Default boxfactor to use for the simulation. The box factor allows to have a more accurate simulation by increasing the number of boxes on the map, with the same dimensions of the map (so, xBoxes and yBoxes and boxLength parameters of the map are linked to this one).

### pixelsByUnitZoom1x

    public final float pixelsByUnitZoom1x

  Pixels by simulated unit, when zoom=1.

### pixelsByBoxZoom1x

    public final float pixelsByBoxZoom1x

  Pixels by square box side, when zoom=1.

### centerX

    public final float centerX

  X-coordinate to center the map by default.

### centerY

    public final float centerY

  Y-coordinate to center the map by default.

### minZoom

    public final float minZoom

  Min value of the zoom slider in the interface.

### maxZoom

    public final float maxZoom

  Max value of the zoom slider in the interface.

### minTfactor

    public final float minTfactor

  Max value of the time factor slider in the interface.

### maxTfactor

    public final float maxTfactor

  Max value of the time factor slider in the interface.

### tFactor

    public final float tFactor

  Default temporal factor.

### virtualDelay

    public final float virtualDelay

  Default virtual delay (in ms) between to displays of the world in the graphical interface.

### realDelay

    public final int realDelay

  Default virtual delay (in ms) between to displays of the world in the graphical interface. As the system time returned by `System.currentTimeMillis()` is an integer (a long), it doesn't need to be a float.

Constructor Detail

### Drawing

    public Drawing(float pixelsByUnitZoom1x,
                   float boxLength,
                   float minZoom,
                   float maxZoom,
                   float minTfactor,
                   float maxTfactor,
                   float tFactor,
                   float zoomFactor,
                   int virtualD,
                   int realD,
                   float centerX,
                   float centerY,
                   int boxFactor)

  New graphical interface for the simulation.

Method Detail

### draw

    public void draw(java.awt.Graphics2D g,
                     java.util.Vector boxToRefresh)

  Draws the world. Takes in arguments the graphics context and the boxes to refresh.

### setZoom

    public void setZoom(float z)

  Sets the current zoom.

### getZoom

    public float getZoom()

  Current zoom.

### getPixelsByBox

    public float getPixelsByBox()

  Pixels by square box side (with current zoom).

### getPixelsByUnit

    public float getPixelsByUnit()

  Pixels by simulated unit (with current zoom).

### setColor

    public void setColor(java.awt.Color c)

  Sets the color of drawing.

### drawLine

    public void drawLine(float x1,
                         float y1,
                         float x2,
                         float y2)

  Draws a line. The arguments are in simulated unit.

### drawRect

    public void drawRect(float x,
                         float y,
                         float xLength,
                         float yLength)

  Draws a rectangle. The arguments are in simulated unit.

### drawRoundRect

    public void drawRoundRect(float x,
                              float y,
                              float xLength,
                              float yLength)

  Draws a round rectangle. The arguments are in simulated unit.

### fillRoundRect

    public void fillRoundRect(float x,
                              float y,
                              float xLength,
                              float yLength)

  Fills a round rectangle. The arguments are in simulated unit.

### drawRect

    public void drawRect(float x0,
                         float y0,
                         float xLength,
                         float yLength,
                         float angle,
                         float x,
                         float y)

  Draws a rectangle, provided its angle and a center of rotation. The arguments are in simulated unit.

### fillRect

    public void fillRect(float x,
                         float y,
                         float xLength,
                         float yLength)

  Fills a rectangle. The arguments are in simulated unit.

### fillRect

    public void fillRect(float x0,
                         float y0,
                         float xLength,
                         float yLength,
                         float angle,
                         float x,
                         float y)

  Fills a rectangle, provided its angle and a center of rotation. The arguments are in simulated unit.

### drawCircle

    public void drawCircle(float x,
                           float y,
                           float radius)

  Draws a circle. The arguments are in simulated unit.

### fillCircle

    public void fillCircle(float x,
                           float y,
                           float radius)

  Fills a circle. The arguments are in simulated unit.

### drawImage

    public void drawImage(java.awt.Image image,
                          float x,
                          float y,
                          float xLength,
                          float yLength)

  Draws a picture. The arguments are in simulated unit.

### drawImage

    public void drawImage(java.awt.Image image,
                          float x0,
                          float y0,
                          float xLength,
                          float yLength,
                          float angle,
                          float x,
                          float y)

  Draws a picture, provided an angle and a center of rotation. The arguments are in simulated unit.

### drawString

    public void drawString(java.lang.String s,
                           float x,
                           float y)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD