ch.sahits.game.graphic.display.util
Class ClickablePolygons
java.lang.Object
ch.sahits.game.graphic.display.util.ClickablePolygons
public class ClickablePolygons
- extends Object
This class represents an ordered list of poligons. With each polygon is an action
associated that is executed if clicked inside the polygon.
- Author:
- Andi Hotz, (c) Sahits GmbH, 2011
Created on Nov 23, 2011
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
polygons
private List<ClickablePolygon> polygons
area
private Rectangle area
ClickablePolygons
public ClickablePolygons()
add
public void add(NamedPolygon polygon,
Runnable action)
- Add a new polygon to the list
- Parameters:
polygon - action -
updateArea
private void updateArea(Polygon polygon)
testAndExecute
public void testAndExecute(Point p)
- Find the polygon that contains the point and if such a polygon
exists execute its action
- Parameters:
p -
findPolygon
private ClickablePolygon findPolygon(Point p)
- Find the first polygon that has the point inside it.
- Parameters:
p -
- Returns:
Copyright © 2011 Sahits GmbH. All Rights Reserved.