use of uk.me.parabola.imgfmt.app.trergn.Polygon in project mkgmap by openstreetmap.
the class MapReader method shapesForLevel.
public List<Polygon> shapesForLevel(int level, boolean witExtTypeData) {
ArrayList<Polygon> shapes = new ArrayList<Polygon>();
Subdivision[] subdivisions = treFile.subdivForLevel(level);
for (Subdivision div : subdivisions) {
List<Polygon> subdivShapes = rgnFile.shapesForSubdiv(div, witExtTypeData);
shapes.addAll(subdivShapes);
}
return shapes;
}
use of uk.me.parabola.imgfmt.app.trergn.Polygon in project mkgmap by openstreetmap.
the class OverviewBuilder method readShapes.
/**
* Read the polygons from the .img file and add them to the overview map.
* We read from the least detailed level (apart from the empty one).
*
* @param mapReader Map reader on the detailed .img file.
*/
private void readShapes(MapReader mapReader) {
Zoom[] levels = mapReader.getLevels();
for (int l = 1; l < levels.length; l++) {
int min = levels[l].getLevel();
int res = levels[l].getResolution();
List<Polygon> list = mapReader.shapesForLevel(min, MapReader.WITH_EXT_TYPE_DATA);
for (Polygon shape : list) {
if (log.isDebugEnabled())
log.debug("got polygon", shape);
if (shape.getType() == 0x4b) {
hasBackground = true;
}
MapShape ms = new MapShape();
List<Coord> points = shape.getPoints();
if (log.isDebugEnabled())
log.debug("polygon point list", points);
if (points.size() < 3)
continue;
ms.setType(shape.getType());
if (shape.getLabel() != null)
ms.setName(shape.getLabel().getText());
ms.setMaxResolution(res);
ms.setMinResolution(res);
ms.setPoints(points);
overviewSource.addShape(ms);
}
}
}
Aggregations