org.reprap.utilities
Class RrGraphics

java.lang.Object
  extended by org.reprap.utilities.RrGraphics

public class RrGraphics
extends java.lang.Object

Class to plot images of geometrical structures for debugging.

Author:
ensab

Nested Class Summary
(package private)  class RrGraphics.MyComponent
          Canvas to paint on
(package private)  class RrGraphics.myKB
           
(package private)  class RrGraphics.myMouse
          Clicking the mouse magnifies
 
Field Summary
(package private) static java.awt.Color background
           
private  BooleanGrid bg
           
(package private) static java.awt.Color boxes
           
private  boolean csgSolid
           
private  int frame
          Pixels
private  int frameHeight
           
private  int frameWidth
           
private static java.awt.Graphics2D g2d
           
(package private) static java.awt.Color hatch0
           
(package private) static java.awt.Color hatch1
           
private  java.util.List<RrHalfPlane> hp
           
(package private) static java.awt.Color infill
           
private  boolean initialised
           
private static javax.swing.JFrame jframe
           
private  RrRectangle originalBox
           
private  Rr2Point p_0
           
private  RrPolygonList p_list
           
private  boolean plot_box
           
(package private) static java.awt.Color polygon0
           
(package private) static java.awt.Color polygon1
           
private  Rr2Point pos
           
private  double scale
           
private  RrRectangle scaledBox
           
private  java.lang.String title
           
 
Constructor Summary
RrGraphics(RrRectangle b, java.lang.String t)
          Constructor for just a box - add stuff later
RrGraphics(java.lang.String t)
          Constructor for nothing - add stuff later
 
Method Summary
 void add(BooleanGrid b)
           
 void add(RrPolygonList pl)
           
 void cleanPolygons()
           
private  void fillBG(BooleanGrid b)
          Recursively fill a Boolean Grid where it's solid.
 void init(RrRectangle b, boolean waitTillDone)
           
 boolean isInitialised()
           
private  Rr2Point iTransform(int x, int y)
          Pixels to real-world coordinates
private  void move(Rr2Point p)
          Move invisibly to a point
private  void plot()
          Master plot function - draw everything
private  void plot(Rr2Point p)
          Draw a straight line to a point
private  void plot(RrLine a, RrInterval i)
          Plot a section of parametric line
private  void plot(RrPolygon p)
          Plot a polygon
private  void plot(RrRectangle b)
          Plot a box
private  void setColour(Attributes at)
          Set the colour from a RepRap attribute
private  void setScales(RrRectangle b)
           
private  Rr2Point transform(Rr2Point p)
          Real-world coordinates to pixels
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

background

static final java.awt.Color background

boxes

static final java.awt.Color boxes

polygon1

static final java.awt.Color polygon1

polygon0

static final java.awt.Color polygon0

infill

static final java.awt.Color infill

hatch1

static final java.awt.Color hatch1

hatch0

static final java.awt.Color hatch0

frame

private final int frame
Pixels

See Also:
Constant Field Values

frameWidth

private int frameWidth

frameHeight

private int frameHeight

p_list

private RrPolygonList p_list

bg

private BooleanGrid bg

csgSolid

private boolean csgSolid

hp

private java.util.List<RrHalfPlane> hp

scale

private double scale

p_0

private Rr2Point p_0

pos

private Rr2Point pos

scaledBox

private RrRectangle scaledBox

originalBox

private RrRectangle originalBox

g2d

private static java.awt.Graphics2D g2d

jframe

private static javax.swing.JFrame jframe

plot_box

private boolean plot_box

title

private java.lang.String title

initialised

private boolean initialised
Constructor Detail

RrGraphics

public RrGraphics(RrRectangle b,
                  java.lang.String t)
Constructor for just a box - add stuff later

Parameters:
b -
pb -

RrGraphics

public RrGraphics(java.lang.String t)
Constructor for nothing - add stuff later

Parameters:
b -
pb -
Method Detail

cleanPolygons

public void cleanPolygons()

setScales

private void setScales(RrRectangle b)

init

public void init(RrRectangle b,
                 boolean waitTillDone)
Parameters:
b -

isInitialised

public boolean isInitialised()

add

public void add(RrPolygonList pl)
Parameters:
pl -

add

public void add(BooleanGrid b)

transform

private Rr2Point transform(Rr2Point p)
Real-world coordinates to pixels

Parameters:
p -
Returns:

iTransform

private Rr2Point iTransform(int x,
                            int y)
Pixels to real-world coordinates

Parameters:
p -
Returns:

move

private void move(Rr2Point p)
Move invisibly to a point

Parameters:
p -

plot

private void plot(Rr2Point p)
Draw a straight line to a point

Parameters:
p -

plot

private void plot(RrRectangle b)
Plot a box

Parameters:
b -

setColour

private void setColour(Attributes at)
Set the colour from a RepRap attribute

Parameters:
at -

plot

private void plot(RrPolygon p)
Plot a polygon

Parameters:
p -

plot

private void plot(RrLine a,
                  RrInterval i)
Plot a section of parametric line

Parameters:
a -
i -

fillBG

private void fillBG(BooleanGrid b)
Recursively fill a Boolean Grid where it's solid.

Parameters:
q -

plot

private void plot()
Master plot function - draw everything