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
-
children
-
-
color
-
-
div
-
-
maxrand
-
-
ownlayt
-
-
parent
-
-
random
-
-
randseed
-
-
MapElement()
-
-
addChild(ParseElement)
-
-
areaToPolygon(Rectangle, Stack, Vector)
- Scale every point in a given polygon.
-
draw(Graphics, MapDrawer, Stack, int)
- Draw this element.
-
drawChildren(Graphics, MapDrawer, Stack, int)
- Draw this element's children.
-
getChildAt(RelPoint)
- Find child element at the specified position.
-
getParent()
-
-
getProperty(MapDProp)
-
-
rand()
- Create pseudorandom numbers.
-
scalePoint(RelPoint, Stack)
-
Do a complete scaling on a point.
-
setParent(ParseElement)
-
-
setProperty(MapDProp)
-
Supported properties:
name, place, color
parent
protected MapElement parent
children
protected Vector children
ownlayt
protected LayoutObject ownlayt
div
protected CombinedLayout div
randseed
protected int randseed
random
protected int random
color
protected Color color
maxrand
public static final int maxrand
MapElement
public MapElement()
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.
rand
protected int rand()
- Create pseudorandom numbers. The value is bounded by maxrand.
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.
drawChildren
protected void drawChildren(Graphics g,
MapDrawer contr,
Stack layout,
int level)
- Draw this element's children.
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.
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
setParent
public void setParent(ParseElement p)
getParent
public ParseElement getParent()
addChild
public void addChild(ParseElement p)
setProperty
public int setProperty(MapDProp p)
- Supported properties:
name, place, color
getProperty
public int getProperty(MapDProp p)
All Packages Class Hierarchy This Package Previous Next Index