use of uk.me.parabola.imgfmt.app.trergn.Subdivision in project mkgmap by openstreetmap.
the class AbstractTestMap method makeMap.
protected void makeMap(String[] args) {
// Default to nowhere in particular.
double lat = 51.724;
double lng = 0.2487;
// Arguments allow you to place the map where ever you wish.
if (args.length > 1) {
lat = Double.valueOf(args[0]);
lng = Double.valueOf(args[1]);
}
log.debug("this is a test make map program. Start", lat, '/', lng);
FileSystemParam params = new FileSystemParam();
params.setBlockSize(512);
params.setMapDescription("OSM street map");
Map map;
try {
map = Map.createMap("32860003", ".", params, "32860003", SrtTextReader.sortForCodepage(1252));
} catch (FileExistsException e) {
throw new ExitException("File exists already", e);
} catch (FileNotWritableException e) {
throw new ExitException("Could not create or write file", e);
}
map.addInfo("Program released under the GPL");
map.addInfo("This map data is made available under the Open Database License:");
// There has to be (at least) two copyright messages or else the map
// does not show up. The second one will be displayed at startup,
// although the conditions where that happens are not known.
map.addCopyright("program licenced under GPL v2");
// This one gets shown when you switch on, so put the actual
// map copyright here. This is made up data, so no copyright applies.
map.addCopyright("No copyright");
Area area = new Area(lat, lng, lat + 1, lng + 1);
map.setBounds(area);
// There must always be an empty zoom level at the least detailed level.
log.info("area " + area);
log.info(" or " + lat + '/' + lng);
Zoom z1 = map.createZoom(1, 24);
Subdivision topdiv = map.topLevelSubdivision(area, z1);
// Create a most detailed view
Zoom z = map.createZoom(0, 24);
Subdivision div = map.createSubdivision(topdiv, area, z);
div.startDivision();
drawTestMap(map, div, lat, lng);
map.close();
}
use of uk.me.parabola.imgfmt.app.trergn.Subdivision in project mkgmap by openstreetmap.
the class MapReader method linesForLevel.
/**
* Get a list of all the lines for a given level.
* @param level The level, lower numbers are the most detailed.
*/
public List<Polyline> linesForLevel(int level) {
ArrayList<Polyline> lines = new ArrayList<Polyline>();
Subdivision[] subdivisions = treFile.subdivForLevel(level);
for (Subdivision div : subdivisions) {
List<Polyline> subdivLines = rgnFile.linesForSubdiv(div);
lines.addAll(subdivLines);
}
return lines;
}
use of uk.me.parabola.imgfmt.app.trergn.Subdivision 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.Subdivision in project mkgmap by openstreetmap.
the class MapBuilder method makeSubdivision.
/**
* Make an individual subdivision for the map. To do this we need a link
* to its parent and the zoom level that we are working at.
*
* @param map The map to add this subdivision into.
* @param parent The parent division.
* @param ma The area of the map that we are fitting into this division.
* @param z The zoom level.
* @return The new subdivsion.
*/
private Subdivision makeSubdivision(Map map, Subdivision parent, MapArea ma, Zoom z) {
List<MapPoint> points = ma.getPoints();
List<MapLine> lines = ma.getLines();
List<MapShape> shapes = ma.getShapes();
Subdivision div = map.createSubdivision(parent, ma.getFullBounds(), z);
if (ma.hasPoints())
div.setHasPoints(true);
if (ma.hasIndPoints())
div.setHasIndPoints(true);
if (ma.hasLines())
div.setHasPolylines(true);
if (ma.hasShapes())
div.setHasPolygons(true);
div.startDivision();
processPoints(map, div, points);
processLines(map, div, lines);
processShapes(map, div, shapes);
div.endDivision();
return div;
}
use of uk.me.parabola.imgfmt.app.trergn.Subdivision in project mkgmap by openstreetmap.
the class MapBuilder method makeTopArea.
/**
* Create the top level subdivision.
*
* There must be an empty zoom level at the least detailed level. As it
* covers the whole area in one it must be zoomed out enough so that
* this can be done.
*
* Note that the width is a 16 bit quantity, but the top bit is a
* flag and so that leaves only 15 bits into which the actual width
* can fit.
*
* @param src The source of map data.
* @param map The map being created.
* @param zoom The zoom level.
* @return The new top level subdivision.
*/
private static Subdivision makeTopArea(MapDataSource src, Map map, Zoom zoom) {
Subdivision topdiv = map.topLevelSubdivision(src.getBounds(), zoom);
topdiv.setLast(true);
return topdiv;
}
Aggregations