super(area);
/* check whether a pin has been explicitly mapped */
VectorXZ explicitPinPosition = null;
for (MapOverlap<?, ?> overlap : area.getOverlaps()) {
MapElement other = overlap.getOther(area);
if (other.getTags().contains("golf","pin")
&& other instanceof MapNode) {
explicitPinPosition = ((MapNode)other).getPos();
break;
}
}
/* place an implicit pin if none has been mapped */
if (explicitPinPosition != null) {
pinPosition = explicitPinPosition;
} else {
pinPosition = area.getOuterPolygon().getCenter();
}
/* create circle around the hole */
List<VectorXZ> holeRing = new ArrayList<VectorXZ>(HOLE_CIRCLE_VERTICES);
for (int i = 0; i < HOLE_CIRCLE_VERTICES; i++) {
VectorXZ direction = fromAngle(2 * PI * ((double)i / HOLE_CIRCLE_VERTICES));
VectorXZ vertex = pinPosition.add(direction.mult(HOLE_RADIUS));
holeRing.add(vertex);
}
holeRing.add(holeRing.get(0));