All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class fi.helsinki.cs.MapDrawer.MapElement

java.lang.Object
   |
   +----fi.helsinki.cs.MapDrawer.MapElement

public class MapElement
extends Object
implements ParseElement

Variable Index

 o children
 o color
 o div
 o maxrand
 o ownlayt
 o parent
 o random
 o randseed

Constructor Index

 o MapElement()

Method Index

 o addChild(ParseElement)
 o areaToPolygon(Rectangle, Stack, Vector)
Scale every point in a given polygon.
 o draw(Graphics, MapDrawer, Stack, int)
Draw this element.
 o drawChildren(Graphics, MapDrawer, Stack, int)
Draw this element's children.
 o getChildAt(RelPoint)
Find child element at the specified position.
 o getParent()
 o getProperty(MapDProp)
 o rand()
Create pseudorandom numbers.
 o scalePoint(RelPoint, Stack)
Do a complete scaling on a point.
 o setParent(ParseElement)
 o setProperty(MapDProp)
Supported properties: name, place, color

Variables

 o parent
 protected MapElement parent
 o children
 protected Vector children
 o ownlayt
 protected LayoutObject ownlayt
 o div
 protected CombinedLayout div
 o randseed
 protected int randseed
 o random
 protected int random
 o color
 protected Color color
 o maxrand
 public static final int maxrand

Constructors

 o MapElement
 public MapElement()

Methods

 o getChildAt
 public MapElement getChildAt(RelPoint pl)
Find child element at the specified position.

Parameters:
pl - The position within this element's area.
Returns:
a reference to the child element if found, a reference to this element otherwise.
 o rand
 protected int rand()
Create pseudorandom numbers. The value is bounded by maxrand.

 o scalePoint
 protected RelPoint scalePoint(RelPoint pt,
                               Stack layout)
Do a complete scaling on a point.

Parameters:
pt - the point to scale.
layout - stack of all layouts in effect.
Returns:
scaled point.
 o drawChildren
 protected void drawChildren(Graphics g,
                             MapDrawer contr,
                             Stack layout,
                             int level)
Draw this element's children.

 o areaToPolygon
 protected Polygon areaToPolygon(Rectangle bounds,
                                 Stack layout,
                                 Vector v)
Scale every point in a given polygon.

Parameters:
bounds - the Rectangle into which the polygon should be scaled.
layout - stack of all layouts in effect.
v - the original polygon, as a vector of RelPoints
Returns:
the scaled polygon.
 o draw
 public void draw(Graphics g,
                  MapDrawer contr,
                  Stack layout,
                  int level)
Draw this element.

Parameters:
g - Graphics context
contr - the MapDrawer who wants to draw this element
layout - a stack of applying layouts.
level - tells whether we should draw deeper elements
 o setParent
 public void setParent(ParseElement p)
 o getParent
 public ParseElement getParent()
 o addChild
 public void addChild(ParseElement p)
 o setProperty
 public int setProperty(MapDProp p)
Supported properties: name, place, color

 o getProperty
 public int getProperty(MapDProp p)

All Packages  Class Hierarchy  This Package  Previous  Next  Index