Search in sources :

Example 1 with Highway

use of uk.me.parabola.imgfmt.app.lbl.Highway in project mkgmap by openstreetmap.

the class MapBuilder method processExit.

private void processExit(Map map, MapExitPoint mep) {
    LBLFile lbl = map.getLblFile();
    String ref = mep.getMotorwayRef();
    String OSMId = mep.getOSMId();
    if (ref != null) {
        Highway hw = highways.get(ref);
        if (hw == null)
            hw = makeHighway(map, ref);
        if (hw == null) {
            log.warn("Can't create exit", mep.getName(), "(OSM id", OSMId, ") on unknown highway", ref);
            return;
        }
        String exitName = mep.getName();
        String exitTo = mep.getTo();
        Exit exit = new Exit(hw);
        String facilityDescription = mep.getFacilityDescription();
        log.info("Creating", ref, "exit", exitName, "(OSM id", OSMId + ") to", exitTo, "with facility", ((facilityDescription == null) ? "(none)" : facilityDescription));
        if (facilityDescription != null) {
            // description is TYPE,DIR,FACILITIES,LABEL
            // (same as Polish Format)
            String[] atts = facilityDescription.split(",");
            int type = 0;
            if (atts.length > 0)
                type = Integer.decode(atts[0]);
            char direction = ' ';
            if (atts.length > 1) {
                direction = atts[1].charAt(0);
                if (direction == '\'' && atts[1].length() > 1)
                    direction = atts[1].charAt(1);
            }
            int facilities = 0x0;
            if (atts.length > 2)
                facilities = Integer.decode(atts[2]);
            String description = "";
            if (atts.length > 3)
                description = atts[3];
            // FIXME - handle multiple facilities?
            boolean last = true;
            ExitFacility ef = lbl.createExitFacility(type, direction, facilities, description, last);
            exit.addFacility(ef);
        }
        mep.setExit(exit);
        POIRecord r = lbl.createExitPOI(exitName, exit);
        if (exitTo != null) {
            Label ed = lbl.newLabel(exitTo);
            exit.setDescription(ed);
        }
        poimap.put(mep, r);
    // FIXME - set bottom bits of
    // type to reflect facilities available?
    }
}
Also used : Highway(uk.me.parabola.imgfmt.app.lbl.Highway) Label(uk.me.parabola.imgfmt.app.Label) POIRecord(uk.me.parabola.imgfmt.app.lbl.POIRecord) LBLFile(uk.me.parabola.imgfmt.app.lbl.LBLFile) MapPoint(uk.me.parabola.mkgmap.general.MapPoint) MapExitPoint(uk.me.parabola.mkgmap.general.MapExitPoint) Point(uk.me.parabola.imgfmt.app.trergn.Point) ExitFacility(uk.me.parabola.imgfmt.app.lbl.ExitFacility) Exit(uk.me.parabola.imgfmt.app.Exit)

Example 2 with Highway

use of uk.me.parabola.imgfmt.app.lbl.Highway in project mkgmap by openstreetmap.

the class MapBuilder method makeHighway.

Highway makeHighway(Map map, String ref) {
    if (getDefaultRegion(null) == null) {
        log.warn("Highway " + ref + " has no region (define a default region to zap this warning)");
    }
    Highway hw = highways.get(ref);
    if (hw == null) {
        LBLFile lblFile = map.getLblFile();
        log.info("creating highway " + ref);
        hw = lblFile.createHighway(getDefaultRegion(null), ref);
        highways.put(ref, hw);
    }
    return hw;
}
Also used : Highway(uk.me.parabola.imgfmt.app.lbl.Highway) LBLFile(uk.me.parabola.imgfmt.app.lbl.LBLFile)

Aggregations

Highway (uk.me.parabola.imgfmt.app.lbl.Highway)2 LBLFile (uk.me.parabola.imgfmt.app.lbl.LBLFile)2 Exit (uk.me.parabola.imgfmt.app.Exit)1 Label (uk.me.parabola.imgfmt.app.Label)1 ExitFacility (uk.me.parabola.imgfmt.app.lbl.ExitFacility)1 POIRecord (uk.me.parabola.imgfmt.app.lbl.POIRecord)1 Point (uk.me.parabola.imgfmt.app.trergn.Point)1 MapExitPoint (uk.me.parabola.mkgmap.general.MapExitPoint)1 MapPoint (uk.me.parabola.mkgmap.general.MapPoint)1