public static PolygonWithHolesList2d buildingPartToPolygonWithHoles(BuildingPart bp) { PolygonList2d outerPolygon = wallToOuterPolygon(bp.getWall()); List<PolygonList2d> innerList = new ArrayList<PolygonList2d>(); if (bp.getInlineWalls() != null) { for (Wall innerWall : bp.getInlineWalls()) { PolygonList2d innerPolygon = wallToOuterPolygon(innerWall); innerList.add(innerPolygon); } } return new PolygonWithHolesList2d(outerPolygon, innerList); }
public static PolygonWithHolesList2d transformationPolygonWithHoles(PolygonWithHolesList2d polygonWithHoles, SimpleMatrix transformLocal) { PolygonList2d outer = transformPolygon(polygonWithHoles.getOuter(), transformLocal); List<PolygonList2d> inner = new ArrayList<PolygonList2d>(); if (polygonWithHoles.getInner() != null) { for (PolygonList2d pi : polygonWithHoles.getInner()) { inner.add(transformPolygon(pi, transformLocal)); } } return new PolygonWithHolesList2d(outer, inner); }
/** * @param pRelation * @param pPerspective * @param ret * @return */ public static List<PolygonWithHolesList2d> findPolygonsWithHoles(Relation pRelation, Perspective pPerspective) { List<PolygonWithHolesList2d> ret = new ArrayList<PolygonWithHolesList2d>(); List<AreaWithHoles> waysPolygon = PolygonWithHolesUtil.findAreaWithHoles(pRelation); for (AreaWithHoles waysPolygon2 : waysPolygon) { List<PolygonList2d> inner = new ArrayList<PolygonList2d>(); PolygonList2d outer = parse(waysPolygon2.getOuter(), pPerspective); if (waysPolygon2.getInner() != null) { for (List<ReversableWay> rwList : waysPolygon2.getInner()) { inner.add(parse(rwList, pPerspective)); } } ret.add(new PolygonWithHolesList2d(outer, inner)); } return ret; }
List<PolygonWithHolesList2d> getMultiPolygonWithHolesWay(Way way, Perspective perspective) { List<PolygonWithHolesList2d> ret = new ArrayList<PolygonWithHolesList2d>(); List<Point2d> poly = new ArrayList<Point2d>(); int size = way.getNodesCount(); if (size > 0) { if (way.getNode(0).equals(way.getNode(way.getNodesCount() - 1))) { size--; } for (int i = 0; i < size; i++) { Point2d p = perspective.calcPoint(way.getNode(i)); poly.add(p); } ret.add(new PolygonWithHolesList2d(new PolygonList2d(poly), null)); } return ret; }