BTW here are the changes as patch applied against 1871. I think it would
be worthwhile adding it to the trunk.
On 19.02.2011 18:30, Torsten Leistikow wrote:
Moin,
I have taken a look at the add-pois-to-areas function:
The function is implemented in MAPMaker.java (makeAreaPOIs), which means, it is
active, AFTER the processing of the osm-data. So without a greater change this
function can not be modified to be controlled by action rules during the style
controlled osm-data processing.
So I tried a limited modification, its not perfekt but for me it is an
improvement over the actual implementation. This does not allow to create POIs
for areas without the creation of a polygon (as a workaround a transparent
polygon can be created). But the modification allows to control the POI
generation for each polygon type on its own, i.e. via the style file single
polygon types can be selected for the POI generation.
My modification disables the add-pois-to-areas command line option, instead the
POI generation is now triggered by a new command "add_poi" in the element type
definition in the polygon style, e.g.: amenity=bank [0x2f06 level 3 add_poi]
Since I am not really familiar with my java environment, I can not provide my
modification as a patch, instead you will find the modified files attached to
this mail. I have marked my changes with "//TTT-start" and "//TTT-end".
Gruss
Torsten
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev
Index: uk/me/parabola/mkgmap/main/MapMaker.java
===================================================================
--- uk/me/parabola/mkgmap/main/MapMaker.java (revision 1871)
+++ uk/me/parabola/mkgmap/main/MapMaker.java (working copy)
@@ -152,7 +152,10 @@
private void makeAreaPOIs(CommandArgs args, LoadableMapDataSource src) {
String s = args.get("add-pois-to-areas", null);
- if (s != null) {
+//TTT-start
+// if (s != null) {
+ if (true) {
+//TTT-end
MapPointFastFindMap poiMap = new MapPointFastFindMap();
@@ -172,9 +175,11 @@
continue;
- // We don't want to add unnamed cities !!
- if(MapPoint.isCityType(pointType) && shapeName == null)
- continue;
+//TTT-start
+// // We don't want to add unnamed cities !!
+// if(MapPoint.isCityType(pointType) && shapeName == null)
+// continue;
+//TTT-end
// check if there is not already a poi in that shape
Index: uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
===================================================================
--- uk/me/parabola/mkgmap/osmstyle/StyledConverter.java (revision 1871)
+++ uk/me/parabola/mkgmap/osmstyle/StyledConverter.java (working copy)
@@ -283,7 +283,7 @@
preConvertRules(way);
Rule rules;
- if ("polyline".equals(way.getTag("mkgmap:stylefilter")))
+ if ("polyline".equals(way.getTag("mkgmap:stylefilter")) || way.isClosed() == false)
rules = lineRules;
else if ("polygon".equals(way.getTag("mkgmap:stylefilter")))
rules = polygonRules;
@@ -540,13 +540,18 @@
shape.setPoints(way.getPoints());
clipper.clipShape(shape, collector);
-
- nodeRules.resolveType(way, new TypeResult() {
- public void add(Element el, GType type) {
- if(type != null)
- shape.setPoiType(type.getType());
- }
- });
+//TTT-start
+ if (gt.isAddPoi()) {
+//TTT-end
+ nodeRules.resolveType(way, new TypeResult() {
+ public void add(Element el, GType type) {
+ if(type != null)
+ shape.setPoiType(type.getType());
+ }
+ });
+//TTT-start
+ }
+//TTT-end
}
private void addPoint(Node node, GType gt) {
Index: uk/me/parabola/mkgmap/osmstyle/TypeReader.java
===================================================================
--- uk/me/parabola/mkgmap/osmstyle/TypeReader.java (revision 1871)
+++ uk/me/parabola/mkgmap/osmstyle/TypeReader.java (working copy)
@@ -69,6 +69,10 @@
gt.propagateActions(true);
} else if (w.equals("no_propagate")) {
gt.propagateActions(false);
+//TTT-start
+ } else if (w.equals("add_poi")) {
+ gt.setAddPoi(true);
+//TTT-end
} else if (w.equals("oneway")) {
// reserved
} else if (w.equals("access")) {
Index: uk/me/parabola/mkgmap/reader/osm/GType.java
===================================================================
--- uk/me/parabola/mkgmap/reader/osm/GType.java (revision 1871)
+++ uk/me/parabola/mkgmap/reader/osm/GType.java (working copy)
@@ -59,6 +59,11 @@
// actions will always be executed
private boolean propogateActionsOnContinue;
+//TTT-start
+ // only applicable for ways (roads, lines and shapes)
+ private boolean addPoi = false;
+//TTT-end
+
public GType(int featureKind, String type) {
this.featureKind = featureKind;
try {
@@ -198,4 +203,14 @@
public void setContinueSearch(boolean continueSearch) {
this.continueSearch = continueSearch;
}
+
+//TTT-start
+ public void setAddPoi(boolean addPoi) {
+ this.addPoi = addPoi;
+ }
+
+ public boolean isAddPoi() {
+ return addPoi;
+ }
+//TTT-end
}
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev