private static void debugAcre( Acre a, String label, Set<Long> visitedAcreIds, Set<String> show, OutputGraph out) { if (visitedAcreIds != null) { visitedAcreIds.add(a.id); } double x = 0, y = 0; int l = a.points.length; double[] coords = new double[l * 2 + 2]; for (int j = 0; j <= l; j++) { Point p = a.points[j % l].toPoint(1000.0); coords[j * 2] = p.x; coords[j * 2 + 1] = p.z; if (j < l) { x += p.x; y += p.z; } } x /= l; y /= l; for (int j = 0; j <= l; j++) { coords[j * 2] = coords[j * 2] * 0.85 + x * 0.15; coords[j * 2 + 1] = coords[j * 2 + 1] * 0.85 + y * 0.15; } if (label == null) { out.addLine(Color.white, coords); } else { Color polyColor, textColor = Color.black; AbstractCartographicElement parent = a.getParent(); boolean inverted = parent instanceof Sector && ((Sector) parent).isInverted(); int neighbors = 0; for (long id : a.neighbors) { if (id != 0) { neighbors++; } } switch (a.flavor) { case INNER1: polyColor = inverted ? Color.green : Color.red; break; case INNER2: polyColor = inverted ? Color.red : Color.green; break; case INNER3: // polyColor = Color.blue; // break; case DUAL_SECTOR: polyColor = new Color(51, 51, 255); break; case MULTI_SECTOR: polyColor = Color.gray.brighter(); textColor = Color.black; break; default: polyColor = Color.black; textColor = Color.red; break; } if (neighbors < 6) { polyColor = polyColor.darker().darker(); if (textColor == Color.black) { textColor = Color.white; } out.addPoly(polyColor, coords); double[] closed = new double[coords.length + 2]; System.arraycopy(coords, 0, closed, 0, coords.length); System.arraycopy(coords, 0, closed, coords.length, 2); out.addLine(polyColor, closed); } else { out.addPoly(polyColor, coords); } if (show.contains("labels")) { if (label.contains("~")) { Matcher matcher = Pattern.compile("^(.*):\\[(.*)~(.*)]$").matcher(label); matcher.find(); out.addLabel( textColor, matcher.group(1) + "\n" + matcher.group(2) + "\n" + matcher.group(3), x, y); } else { Matcher matcher = Pattern.compile("^(.*?):(.*)$").matcher(label); matcher.find(); out.addLabel(textColor, matcher.group(1) + "\n" + matcher.group(2), x, y); } } } }