Moin,

my mkgmap build process is very shaky, but finally I managed to create a patch
of my changes. Perhaps it is even working?

Gruss
Torsten
Index: src/uk/me/parabola/mkgmap/osmstyle/TypeReader.java
===================================================================
--- src/uk/me/parabola/mkgmap/osmstyle/TypeReader.java	(Revision 1878)
+++ src/uk/me/parabola/mkgmap/osmstyle/TypeReader.java	(Arbeitskopie)
@@ -69,6 +69,8 @@
 				gt.propagateActions(true);
 			} else if (w.equals("no_propagate")) {
 				gt.propagateActions(false);
+			} else if (w.equals("add_poi")) {
+				gt.setAddPoi(true);
 			} else if (w.equals("oneway")) {
 				// reserved
 			} else if (w.equals("access")) {
Index: src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java
===================================================================
--- src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java	(Revision 1878)
+++ src/uk/me/parabola/mkgmap/osmstyle/StyledConverter.java	(Arbeitskopie)
@@ -541,12 +541,14 @@
 
 		clipper.clipShape(shape, collector);
 		
-		nodeRules.resolveType(way, new TypeResult() {
-			public void add(Element el, GType type) {
-				if(type != null)
-			shape.setPoiType(type.getType());
-			}
-		});
+		if (gt.isAddPoi()) {
+			nodeRules.resolveType(way, new TypeResult() {
+				public void add(Element el, GType type) {
+					if(type != null)
+						shape.setPoiType(type.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 1878)
+++ src/uk/me/parabola/mkgmap/main/MapMaker.java	(Arbeitskopie)
@@ -151,47 +151,39 @@
 	}
 
 	private void makeAreaPOIs(CommandArgs args, LoadableMapDataSource src) {
-		String s = args.get("add-pois-to-areas", null);
-		if (s != null) {
 			
-			MapPointFastFindMap poiMap = new MapPointFastFindMap();
+		MapPointFastFindMap poiMap = new MapPointFastFindMap();
 
-			for (MapPoint point : src.getPoints()) 
-			{
-				if(!point.isRoadNamePOI()) // Don't put road pois in this list
-					poiMap.put(null, point);
-			}
+		for (MapPoint point : src.getPoints()) 
+		{
+			if(!point.isRoadNamePOI()) // Don't put road pois in this list
+				poiMap.put(null, point);
+		}
 			
-			for (MapShape shape : src.getShapes()) {
-				String shapeName = shape.getName();
+		for (MapShape shape : src.getShapes()) {
+			String shapeName = shape.getName();
 
-				int pointType = shape.getPoiType();
+			int pointType = shape.getPoiType();
 				
-				// only make a point if the shape has a name and we know what type of point to make
-				if (pointType == 0)
-					continue;
+			// 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)
-					continue;
-				
-				// check if there is not already a poi in that shape 
+			// check if there is not already a poi in that shape 
 							
-				if(poiMap.findPointInShape(shape, pointType, shapeName) == null) {
-					MapPoint newPoint = new MapPoint();
+			if(poiMap.findPointInShape(shape, pointType, shapeName) == null) {
+				MapPoint newPoint = new MapPoint();
 					
-					newPoint.setName(shapeName);
-					newPoint.setType(pointType);
+				newPoint.setName(shapeName);
+				newPoint.setType(pointType);
 
-					copyAddressInformation(shape, newPoint);
+				copyAddressInformation(shape, newPoint);
 
-					newPoint.setLocation(shape.getLocation()); // TODO use centroid
+				newPoint.setLocation(shape.getLocation()); // TODO use centroid
 
-					src.getPoints().add(newPoint);
+				src.getPoints().add(newPoint);
 
-					log.info("created POI ", shapeName, "from shape");
-				}
+				log.info("created POI ", shapeName, "from shape");
 			}
 		}
 
Index: src/uk/me/parabola/mkgmap/reader/osm/GType.java
===================================================================
--- src/uk/me/parabola/mkgmap/reader/osm/GType.java	(Revision 1878)
+++ src/uk/me/parabola/mkgmap/reader/osm/GType.java	(Arbeitskopie)
@@ -59,6 +59,9 @@
 	// actions will always be executed
 	private boolean propogateActionsOnContinue;
 
+	// only applicable for ways (roads, lines and shapes)
+	private boolean addPoi = false;
+
 	public GType(int featureKind, String type) {
 		this.featureKind = featureKind;
 		try {
@@ -198,4 +201,12 @@
 	public void setContinueSearch(boolean continueSearch) {
 		this.continueSearch = continueSearch;
 	}
+
+	public void setAddPoi(boolean addPoi) {
+		this.addPoi = addPoi;
+	}
+
+	public boolean isAddPoi() {
+		return addPoi;
+	}
 }
_______________________________________________
mkgmap-dev mailing list
[email protected]
http://www.mkgmap.org.uk/mailman/listinfo/mkgmap-dev

Reply via email to