civquest.swing.quadmap
Class Painter

java.lang.Object
  extended bycivquest.swing.quadmap.Painter

public class Painter
extends java.lang.Object

This class provides some painting-functions for use with QuadMap. They paint into the viewport-view of the QuadMap-object assigned to this Painter-instance. If nothing else is mentioned, they get absolute paint-coords (definition see abstract class Properties). They then paint all necessary objects (multiple are possible because some absolute paint coords exist multiple times in the viewport-view) into the viewport-view.


Constructor Summary
Painter(QuadMap quadMap)
           
 
Method Summary
 void drawDashedLine(Coordinate c1, Coordinate c2, java.awt.Graphics g, int dashLength)
          Draws a line from c1 to c2 using the given Graphics g.
 void drawFullCircle(java.awt.Graphics g, Coordinate m, int radius, boolean filled)
           
 void drawGeoPrimitive(java.awt.Graphics g, civquest.util.swing.geoprim.GeoPrimitive geoPrim)
           
 void drawLine(Coordinate c1, Coordinate c2, java.awt.Graphics g)
          Draws a line from c1 to c2 using the given Graphics g.
 void drawShortestLine(Coordinate c1, Coordinate c2, java.awt.Graphics g)
          Wrapper-function for drawing a non-dashed line using drawShortestLine.
 void drawShortestLine(Coordinate c1, Coordinate c2, java.awt.Graphics g, boolean dashed, int dashLength)
          Draws a line from c1 to c2 using the given Graphics g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Painter

public Painter(QuadMap quadMap)
Method Detail

drawGeoPrimitive

public void drawGeoPrimitive(java.awt.Graphics g,
                             civquest.util.swing.geoprim.GeoPrimitive geoPrim)

drawLine

public void drawLine(Coordinate c1,
                     Coordinate c2,
                     java.awt.Graphics g)
Draws a line from c1 to c2 using the given Graphics g. g must be a Graphics that paints on the JComponent quadMap

Parameters:
c1 - any abs. paint-coord
c2 - any abs. paint-coord
g - graphics that paints on the JComponent quadMap

drawDashedLine

public void drawDashedLine(Coordinate c1,
                           Coordinate c2,
                           java.awt.Graphics g,
                           int dashLength)
Draws a line from c1 to c2 using the given Graphics g. g must be a Graphics that paints on the JComponent quadMap

Parameters:
c1 - any abs. paint-coord
c2 - any abs. paint-coord
g - graphics that paints on the JComponent quadMap
dashLength - length of one dash

drawFullCircle

public void drawFullCircle(java.awt.Graphics g,
                           Coordinate m,
                           int radius,
                           boolean filled)

drawShortestLine

public void drawShortestLine(Coordinate c1,
                             Coordinate c2,
                             java.awt.Graphics g)
Wrapper-function for drawing a non-dashed line using drawShortestLine. For more information, see drawShortestLine(Coordinate, Coordinate, Graphics, boolean, int).

Parameters:
c1 - any abs. paint-coord
c2 - any abs. paint-coord
g - graphics painting on quadMap

drawShortestLine

public void drawShortestLine(Coordinate c1,
                             Coordinate c2,
                             java.awt.Graphics g,
                             boolean dashed,
                             int dashLength)
Draws a line from c1 to c2 using the given Graphics g. g must paint on quadMap. There exist two cases: (1) flatearth == true : The function works exactly as drawLine/drawDashedLine (2) flatearth == false: The function works as if the east edge of the map is attached to its west side. If the length of a line over the map-edge is shorter than the length of a line over the map, the function draws it over the map-edge.

Parameters:
c1 - any abs. paint-coord
c2 - any abs. paint-coord
g - graphics painting on quadMap
dashed - should the line be dashed?
dashLength - if dashed == true, length of the dashes (approximately, for more information see DashedLine); if dashed == false, this will be ignored.