Index: src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java =================================================================== --- src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java (revision 1077) +++ src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java (working copy) @@ -97,6 +97,7 @@ private final Rule relationRules; private boolean ignoreMaxspeeds; + private boolean addPoisToAreas; class AccessMapping { private final String type; @@ -138,6 +139,7 @@ nodeRules = style.getNodeRules(); relationRules = style.getRelationRules(); ignoreMaxspeeds = props.getProperty("ignore-maxspeeds") != null; + addPoisToAreas = props.getProperty("add-pois-to-areas") != null; LineAdder overlayAdder = style.getOverlays(lineAdder); if (overlayAdder != null) @@ -159,6 +161,9 @@ preConvertRules(way); + Way wayForPoiConversion = new Way(way.getId()); + wayForPoiConversion.copyTags(way); + GType foundType = wayRules.resolveType(way); if (foundType == null) return; @@ -170,9 +175,20 @@ addRoad(way, foundType); else addLine(way, foundType); + } else { + if (addPoisToAreas) { + GType foundTypeForPoiConversion = nodeRules.resolveType(wayForPoiConversion); + if (foundTypeForPoiConversion == null) { + addShape(way, foundType, null, null); + } else { + postConvertRules(wayForPoiConversion, foundTypeForPoiConversion); + + addShape(way, foundType, foundTypeForPoiConversion, wayForPoiConversion.getName()); + } + } else { + addShape(way, foundType, null, null); + } } - else - addShape(way, foundType); } /** @@ -272,17 +288,16 @@ clipper.clipLine(line, lineAdder); } - private void addShape(Way way, GType gt) { + private void addShape(Way way, GType gt, GType gtPoi, String namePoi) { MapShape shape = new MapShape(); elementSetup(shape, gt, way); shape.setPoints(way.getPoints()); clipper.clipShape(shape, collector); - GType pointType = nodeRules.resolveType(way); - - if(pointType != null) - shape.setPoiType(pointType.getType()); + shape.setPoiName(namePoi); + if(gtPoi != null) + shape.setPoiType(gtPoi.getType()); } private void addPoint(Node node, GType gt) { Index: src/uk/me/parabola/mkgmap/main/MapMaker.java =================================================================== --- src/uk/me/parabola/mkgmap/main/MapMaker.java (revision 1072) +++ src/uk/me/parabola/mkgmap/main/MapMaker.java (working copy) @@ -164,29 +164,27 @@ } for (MapShape shape : src.getShapes()) { - String shapeName = shape.getName(); - int pointType = shape.getPoiType(); + String pointName = shape.getPoiName(); // only make a point if the shape has a name and we know what type of point to make if (pointType == 0) continue; - // We don't want to add unnamed cities !! - if(MapPoint.isCityType(pointType) && shapeName == null) + if(MapPoint.isCityType(pointType) && pointName == null) continue; // check if there is not already a poi in that shape - if(poiMap.findPointInShape(shape, pointType, shapeName) == null) + if(poiMap.findPointInShape(shape, pointType, pointName) == null) { MapPoint newPoint = new MapPoint(); - newPoint.setName(shapeName); + newPoint.setName(pointName); newPoint.setType(pointType); newPoint.setLocation(shape.getLocation()); // TODO use centriod src.getPoints().add(newPoint); - log.info("created POI ", shapeName, "from shape"); + log.info("created POI ", pointName, "from shape"); } } } Index: src/uk/me/parabola/mkgmap/general/MapShape.java =================================================================== --- src/uk/me/parabola/mkgmap/general/MapShape.java (revision 1072) +++ src/uk/me/parabola/mkgmap/general/MapShape.java (working copy) @@ -29,6 +29,7 @@ public class MapShape extends MapLine {// So top code can link objects from here private int poiType; + private String poiName; public MapShape() { } @@ -55,6 +56,16 @@ { return this.poiType; } + + public void setPoiName(String name) + { + this.poiName = name; + } + + public String getPoiName() + { + return this.poiName; + } /** * Checks if a point is contained within this shape. Points on the