jfig.objects
Class FillWrapper

java.lang.Object
  extended byjfig.objects.FillWrapper

public class FillWrapper
extends java.lang.Object

draw filled polygons via AWT 1.1 or Java2D (if available).

FillWrapper provides a wrapper for drawing of filled polygons for use by other FigObject objects.

Additionally, FillWrapper uses the timestamp information from the current viewport transformation and the last internal modification to decide whether a new world-coordinate -> screen-coordinate transformation is necessary.

If the FillWrapper constructor is called with 2 points only, then a rectangle with (left top) and (right bottom) coords is assumed. Otherwise a standard polygon is constructed.


Field Summary
(package private)  boolean debug
           
(package private)  java.awt.Color extraColor
           
(package private)  int np
           
(package private)  FigObject parent
           
(package private)  int radius
           
(package private)  java.awt.Point[] scp
           
(package private)  long timestamp
           
(package private)  FigTrafo2D trafo
           
(package private)  java.awt.Point[] wcp
           
(package private)  int[] xp
           
(package private)  int[] yp
           
 
Constructor Summary
FillWrapper(FigObject parent, FigTrafo2D trafo, java.awt.Point[] wcp)
          basic FillWrapper constructor.
FillWrapper(FigObject parent, FigTrafo2D trafo, java.awt.Point[] wcp, java.awt.Color extraColor)
          special FillWrapper constructor used by FigArrow.
 
Method Summary
 void buildSCP()
          the transformation has changed.
 java.awt.Point[] get_scp()
          return the (up to date) screen coordinates.
 long getTimestamp()
           
 void paint(java.awt.Graphics g)
          paint(): Check whether we the viewport transformation has changed.
 void paintAWT11(java.awt.Graphics g)
           
 void set_debug()
          activate debug output
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

wcp

java.awt.Point[] wcp

scp

java.awt.Point[] scp

xp

int[] xp

yp

int[] yp

np

int np

radius

int radius

parent

FigObject parent

trafo

FigTrafo2D trafo

timestamp

long timestamp

debug

boolean debug

extraColor

java.awt.Color extraColor
Constructor Detail

FillWrapper

public FillWrapper(FigObject parent,
                   FigTrafo2D trafo,
                   java.awt.Point[] wcp)
basic FillWrapper constructor. This allocates the internal array with the screen-coordinates of the line points.

Parameters:
parent - The FigObject that uses this FillWrapper rectangle
trafo - The current editor viewport transformation, needed for the wc->sc coordinate transformation
wcp - The Point array with the (top left) and the (bottom right) corner for this rectangle in world coordinates

FillWrapper

public FillWrapper(FigObject parent,
                   FigTrafo2D trafo,
                   java.awt.Point[] wcp,
                   java.awt.Color extraColor)
special FillWrapper constructor used by FigArrow. This build the standard FillWrapper object but additionally sets extraColor to override the fillColor from the parent.attribs object.

This allows us to draw the arrowheads in the lineColor without need for an extra FigAttribs object.

Method Detail

getTimestamp

public long getTimestamp()

set_debug

public void set_debug()
activate debug output


get_scp

public java.awt.Point[] get_scp()
return the (up to date) screen coordinates.

Returns:
scp The Point[] array with the corners of this polygon in screen-coords.

buildSCP

public void buildSCP()
the transformation has changed. Recalculate the screen coords scp[]


paint

public void paint(java.awt.Graphics g)
paint(): Check whether we the viewport transformation has changed. If so, recalculate the wc -> wc transformation. Fill the polygon.


paintAWT11

public void paintAWT11(java.awt.Graphics g)