diff --git a/DataExtractionOSM/src/net/osmand/binary/BinaryInspector.java b/DataExtractionOSM/src/net/osmand/binary/BinaryInspector.java index f18c98ffa2..478556ae30 100644 --- a/DataExtractionOSM/src/net/osmand/binary/BinaryInspector.java +++ b/DataExtractionOSM/src/net/osmand/binary/BinaryInspector.java @@ -30,20 +30,21 @@ public class BinaryInspector { public static void main(String[] args) throws IOException { inspector(args); // test cases show info -// inspector(new String[]{"E:\\Information\\OSM maps\\osmand\\Minsk.map.pbf"}); -// inspector(new String[]{"E:\\Information\\OSM maps\\osmand\\Belarus_4.map.pbf"}); +// inspector(new String[]{"E:\\Information\\OSM maps\\osmand\\Minsk.obf"}); +// inspector(new String[]{"E:\\Information\\OSM maps\\osmand\\Belarus_4.obf"}); +// inspector(new String[]{"E:\\Information\\OSM maps\\osmand\\Belarus.obf"}); // inspector(new String[]{"E:\\Information\\OSM maps\\osm_map\\Poland.obf"}); -// inspector(new String[]{"E:\\Information\\OSM maps\\osm_map\\Netherlands\\Netherlands_trans.map.pbf"}); +// inspector(new String[]{"E:\\Information\\OSM maps\\osm_map\\Netherlands\\Netherlands_trans.map.obf"}); // test case extract parts -// inspector(new String[]{"-c", "E:\\Information\\OSM maps\\osmand\\Netherlands-addr-trans.map.pbf", -// "E:\\Information\\OSM maps\\osmand\\Netherlands.map.pbf", "-1"}); +// inspector(new String[]{"-c", "E:\\Information\\OSM maps\\osmand\\Netherlands-addr-trans.map.obf", +// "E:\\Information\\OSM maps\\osmand\\Netherlands.map.obf", "-1"}); // test case -// inspector(new String[]{"-c", "E:\\Information\\OSM maps\\osmand\\Netherlands-addr-trans.map.pbf", -// "E:\\Information\\OSM maps\\osmand\\Netherlands.map.pbf", "-1", -// "E:\\Information\\OSM maps\\osmand\\Belarus_4.map.pbf", "E:\\Information\\OSM maps\\osmand\\Minsk.map.pbf"}); -// inspector(new String[]{"E:\\Information\\OSM maps\\osmand\\Netherlands-addr-trans.map.pbf"}); +// inspector(new String[]{"-c", "E:\\Information\\OSM maps\\osmand\\Netherlands-addr-trans.map.obf", +// "E:\\Information\\OSM maps\\osmand\\Netherlands.map.obf", "-1", +// "E:\\Information\\OSM maps\\osmand\\Belarus_4.map.obf", "E:\\Information\\OSM maps\\osmand\\Minsk.map.obf"}); +// inspector(new String[]{"E:\\Information\\OSM maps\\osmand\\Netherlands-addr-trans.map.obf"}); } @@ -74,7 +75,7 @@ public class BinaryInspector { } } } - List extracted = combineParts(new File(args[1]), parts); + List extracted = combineParts(new File(args[1]), parts); if(extracted != null){ System.out.println("\n"+extracted.size()+" parts were successfully extracted to " + args[1]); } @@ -100,11 +101,11 @@ public class BinaryInspector { } @SuppressWarnings("unchecked") - public static List combineParts(File fileToExtract, Map partsToExtractFrom) throws IOException { + public static List combineParts(File fileToExtract, Map partsToExtractFrom) throws IOException { BinaryMapIndexReader[] indexes = new BinaryMapIndexReader[partsToExtractFrom.size()]; RandomAccessFile[] rafs = new RandomAccessFile[partsToExtractFrom.size()]; - LinkedHashSet[] partsSet = new LinkedHashSet[partsToExtractFrom.size()]; + LinkedHashSet[] partsSet = new LinkedHashSet[partsToExtractFrom.size()]; int c = 0; Set addressNames = new LinkedHashSet(); @@ -117,7 +118,7 @@ public class BinaryInspector { } rafs[c] = new RandomAccessFile(f, "r"); indexes[c] = new BinaryMapIndexReader(rafs[c]); - partsSet[c] = new LinkedHashSet(); + partsSet[c] = new LinkedHashSet(); if(version == -1){ version = indexes[c].getVersion(); } else { @@ -127,19 +128,19 @@ public class BinaryInspector { } } - LinkedHashSet temp = new LinkedHashSet(); + LinkedHashSet temp = new LinkedHashSet(); String pattern = partsToExtractFrom.get(f); boolean minus = true; if(pattern != null){ minus = pattern.startsWith("-"); String[] split = pattern.substring(1).split(","); for(String s : split){ - temp.add(Integer.parseInt(s)); + temp.add(Float.parseFloat(s)); } } for (int i = 0; i < indexes[c].getIndexes().size(); i++) { - partsSet[c].add(i + 1); + partsSet[c].add(i + 1f); } if(minus){ partsSet[c].removeAll(temp); @@ -153,21 +154,21 @@ public class BinaryInspector { // write files FileOutputStream fout = new FileOutputStream(fileToExtract); CodedOutputStream ous = CodedOutputStream.newInstance(fout, BUFFER_SIZE); - List list = new ArrayList(); + List list = new ArrayList(); byte[] BUFFER_TO_READ = new byte[BUFFER_SIZE]; ous.writeInt32(OsmandOdb.OsmAndStructure.VERSION_FIELD_NUMBER, version); for (int k = 0; k < indexes.length; k++) { - LinkedHashSet partSet = partsSet[k]; + LinkedHashSet partSet = partsSet[k]; BinaryMapIndexReader index = indexes[k]; RandomAccessFile raf = rafs[k]; for (int i = 0; i < index.getIndexes().size(); i++) { - if (!partSet.contains(i + 1)) { + if (!partSet.contains(i + 1f)) { continue; } - list.add(i + 1); + list.add(i + 1f); BinaryIndexPart part = index.getIndexes().get(i); String map; @@ -175,7 +176,7 @@ public class BinaryInspector { ous.writeTag(OsmandOdb.OsmAndStructure.ADDRESSINDEX_FIELD_NUMBER, WireFormat.WIRETYPE_FIXED32_LENGTH_DELIMITED); map = "Address"; if (addressNames.contains(part.getName())) { - System.err.println("Error : going to merge 2 same addresses skip " + part.getName()); + System.err.println("Error : going to merge 2 addresses with same names. Skip " + part.getName()); continue; } addressNames.add(part.getName()); @@ -249,10 +250,12 @@ public class BinaryInspector { ti.getTop() << sh, ti.getBottom() << sh)); } else if(p instanceof MapIndex){ MapIndex m = ((MapIndex) p); + int j = 1; for(MapRoot mi : m.getRoots()){ - System.out.println(MessageFormat.format("\tMap level minZoom = {0}, maxZoom = {1}, size = {2} bytes \n\t\tBounds {3}", + System.out.println(MessageFormat.format("\t{4}.{5} Map level minZoom = {0}, maxZoom = {1}, size = {2} bytes \n\t\tBounds {3}", mi.getMinZoom(), mi.getMaxZoom(), mi.getLength(), - formatBounds(mi.getLeft(), mi.getRight(), mi.getTop(), mi.getBottom()))); + formatBounds(mi.getLeft(), mi.getRight(), mi.getTop(), mi.getBottom()), + i, j++)); } } i++; diff --git a/DataExtractionOSM/src/net/osmand/binary/BinaryMapDataObject.java b/DataExtractionOSM/src/net/osmand/binary/BinaryMapDataObject.java index 6ebb228e87..d8755b492c 100644 --- a/DataExtractionOSM/src/net/osmand/binary/BinaryMapDataObject.java +++ b/DataExtractionOSM/src/net/osmand/binary/BinaryMapDataObject.java @@ -115,109 +115,4 @@ public class BinaryMapDataObject { } - public static float getOrder(int wholeType) { - float order = 0; - int t = wholeType & 3; - int oType = MapRenderingTypes.getMainObjectType(wholeType); - int sType = MapRenderingTypes.getObjectSubType(wholeType); - int layer = MapRenderingTypes.getWayLayer(wholeType); - if (t == MapRenderingTypes.MULTY_POLYGON_TYPE || t == MapRenderingTypes.POLYGON_TYPE) { - // 1 - 9 - if (oType == MapRenderingTypes.MAN_MADE && sType == MapRenderingTypes.SUBTYPE_BUILDING) { - // draw over lines - if(layer != 1){ - order = 64; - } else { - order = 2; - } - } else { - if(layer == 1){ - order = 0.5f; - } else if(layer == 2){ - // over lines - order = 64; - } else if (oType == MapRenderingTypes.LANDUSE) { - switch (sType) { - case 5: - case 6: - case 15: - case 18: - case 20: - case 23: - order = 1; - break; - case 22: - order = 5; - break; - default: - order = 1f; - break; - } - } else if (oType == MapRenderingTypes.LEISURE) { - switch (sType) { - case 3: - case 10: - case 13: - order = 2; - break; - case 6: - order = 4; - default: - order = 2; - break; - } - } else if (oType == MapRenderingTypes.POWER) { - order = 4; - } else if (oType == MapRenderingTypes.NATURAL) { - if (order == 5) { - // coastline - order = 0.5f; - } else if (order == 21) { - // water - order = 5; - } else { - order = 1; - } - } else if (oType == MapRenderingTypes.WATERWAY) { - // water 5 - order = 5; - } else { - order = 1; - } - } - } else if (t == MapRenderingTypes.POLYLINE_TYPE) { - // 10 - 68 - if(layer == 1 && oType != MapRenderingTypes.RAILWAY){ - // not subway especially - order = 10; - } else if(layer == 2) { - order = 67; // over buildings - } else if (oType == MapRenderingTypes.HIGHWAY) { - order = 32 - sType + 24; - if(sType == MapRenderingTypes.PL_HW_MOTORWAY){ - // TODO ? that was done only to have good overlay - // but really it should be motorway_link have -= 10 - order -= 2; - } - } else if (oType == MapRenderingTypes.RAILWAY) { - order = 58; - } else if (oType == MapRenderingTypes.AERIALWAY) { - order = 68; // over buildings - } else if (oType == MapRenderingTypes.POWER) { - order = 68; // over buildings - } else if (oType == MapRenderingTypes.ADMINISTRATIVE) { - order = 62; - } else if (oType == MapRenderingTypes.WATERWAY) { - order = 18; - } else { - order = 10; - } - } else { - order = 128; - } - return order; - } - - - } diff --git a/DataExtractionOSM/src/net/osmand/binary/BinaryMapIndexReader.java b/DataExtractionOSM/src/net/osmand/binary/BinaryMapIndexReader.java index 77c4cf5aad..3467e63ca8 100644 --- a/DataExtractionOSM/src/net/osmand/binary/BinaryMapIndexReader.java +++ b/DataExtractionOSM/src/net/osmand/binary/BinaryMapIndexReader.java @@ -669,7 +669,7 @@ public class BinaryMapIndexReader { case 0: if(index.encodingRules.isEmpty()){ // init encoding rules by default - Map map = MapRenderingTypes.getEncodingRuleTypes(); + Map map = MapRenderingTypes.getDefault().getEncodingRuleTypes(); for(String tags : map.keySet()){ MapRulType rt = map.get(tags); if(rt.getType(null) != 0){ diff --git a/DataExtractionOSM/src/net/osmand/data/AmenityType.java b/DataExtractionOSM/src/net/osmand/data/AmenityType.java index ad1549df42..9a6611c7de 100644 --- a/DataExtractionOSM/src/net/osmand/data/AmenityType.java +++ b/DataExtractionOSM/src/net/osmand/data/AmenityType.java @@ -62,8 +62,8 @@ public enum AmenityType { return AmenityType.values(); } - public static Collection getSubCategories(AmenityType t){ - Map> amenityTypeNameToTagVal = MapRenderingTypes.getAmenityTypeNameToTagVal(); + public static Collection getSubCategories(AmenityType t, MapRenderingTypes renderingTypes){ + Map> amenityTypeNameToTagVal = renderingTypes.getAmenityTypeNameToTagVal(); if(!amenityTypeNameToTagVal.containsKey(t)){ return Collections.emptyList(); } diff --git a/DataExtractionOSM/src/net/osmand/data/index/IndexBatchCreator.java b/DataExtractionOSM/src/net/osmand/data/index/IndexBatchCreator.java index b1f1bea10b..fccae0c72c 100644 --- a/DataExtractionOSM/src/net/osmand/data/index/IndexBatchCreator.java +++ b/DataExtractionOSM/src/net/osmand/data/index/IndexBatchCreator.java @@ -27,6 +27,8 @@ import net.osmand.LogUtil; import net.osmand.data.preparation.IndexCreator; import net.osmand.data.preparation.MapZooms; import net.osmand.impl.ConsoleProgressImplementation; +import net.osmand.osm.MapRenderingTypes; +import net.osmand.swing.DataExtractionSettings; import org.apache.commons.logging.Log; import org.w3c.dom.Document; @@ -52,6 +54,7 @@ public class IndexBatchCreator { boolean generateIndexes = false; boolean uploadIndexes = false; MapZooms mapZooms = null; + MapRenderingTypes types = MapRenderingTypes.getDefault(); boolean deleteFilesAfterUploading = true; File osmDirFiles; @@ -131,6 +134,13 @@ public class IndexBatchCreator { } else { mapZooms = MapZooms.parseZooms(zooms); } + + String f = process.getAttribute("renderingTypesFile"); + if(f == null || f.length() == 0){ + types = MapRenderingTypes.getDefault(); + } else { + types = new MapRenderingTypes(f); + } String dir = process.getAttribute("directory_for_osm_files"); if(dir == null || !new File(dir).exists()) { @@ -296,7 +306,7 @@ public class IndexBatchCreator { indexCreator.setMapFileName(mapFileName); try { alreadyGeneratedFiles.add(f.getName()); - indexCreator.generateIndexes(f, new ConsoleProgressImplementation(3), null, mapZooms); + indexCreator.generateIndexes(f, new ConsoleProgressImplementation(3), null, mapZooms, types); if (indexPOI) { uploadIndex(new File(indexDirFiles, poiFileName), alreadyUploadedFiles); } diff --git a/DataExtractionOSM/src/net/osmand/data/index/batch.xml b/DataExtractionOSM/src/net/osmand/data/index/batch.xml index 5015d92338..68bd9fa577 100644 --- a/DataExtractionOSM/src/net/osmand/data/index/batch.xml +++ b/DataExtractionOSM/src/net/osmand/data/index/batch.xml @@ -22,7 +22,7 @@ + indexTransport="true" indexAddress="true" mapZooms="" renderingTypesFile=""> diff --git a/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java b/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java index a0cbf36c8d..ddf7acedb1 100644 --- a/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java +++ b/DataExtractionOSM/src/net/osmand/data/preparation/IndexCreator.java @@ -154,6 +154,7 @@ public class IndexCreator { private RTree[] mapTree = null; private MapZooms mapZooms = null; + private MapRenderingTypes renderingTypes = MapRenderingTypes.getDefault(); // MEMORY map : save it in memory while that is allowed @@ -1368,7 +1369,7 @@ public class IndexCreator { } private int findMultiPolygonType(Entity e, int level) { - int t = MapRenderingTypes.encodeEntityWithType(e, mapZooms.getLevel(level).getMaxZoom(), true, typeUse); + int t = renderingTypes.encodeEntityWithType(e, mapZooms.getLevel(level).getMaxZoom(), true, typeUse); int mtType = 0; if (t != 0) { if ((t & 3) == MapRenderingTypes.MULTY_POLYGON_TYPE) { @@ -1495,7 +1496,7 @@ public class IndexCreator { } private void writeBinaryEntityToMapDatabase(Entity e, long baseId, boolean inverse, int level) throws SQLException { - int type = MapRenderingTypes.encodeEntityWithType(e, mapZooms.getLevel(level).getMaxZoom(), false, typeUse); + int type = renderingTypes.encodeEntityWithType(e, mapZooms.getLevel(level).getMaxZoom(), false, typeUse); Map> multiPolygonsWays = this.multiPolygonsWays[level]; boolean hasMulti = e instanceof Way && multiPolygonsWays.containsKey(e.getId()); if (hasMulti) { @@ -1996,7 +1997,7 @@ public class IndexCreator { } } selectData.close(); - writer.writeMapEncodingRules(MapRenderingTypes.getEncodingRuleTypes()); + writer.writeMapEncodingRules(renderingTypes.getEncodingRuleTypes()); writer.endWriteMapIndex(); writer.flush(); } catch (RTreeException e) { @@ -2229,8 +2230,12 @@ public class IndexCreator { return mapFile.getAbsolutePath() + ".prtree"; //$NON-NLS-1$ } - public void generateIndexes(File readFile, IProgress progress, IOsmStorageFilter addFilter, MapZooms mapZooms) throws IOException, SAXException, + public void generateIndexes(File readFile, IProgress progress, IOsmStorageFilter addFilter, MapZooms mapZooms, MapRenderingTypes renderingTypes) + throws IOException, SAXException, SQLException { + if(renderingTypes != null){ + this.renderingTypes = renderingTypes; + } this.mapZooms = mapZooms; multiPolygonsWays = new Map[mapZooms.size()]; @@ -2777,7 +2782,8 @@ public class IndexCreator { creator.deleteDatabaseIndexes = true; creator.setNodesDBFile(new File("e:/Information/OSM maps/osmand/minsk.tmp.odb")); - creator.generateIndexes(new File("e:/Information/OSM maps/belarus osm/minsk.osm"), new ConsoleProgressImplementation(3), null, MapZooms.getDefault()); + creator.generateIndexes(new File("e:/Information/OSM maps/belarus osm/minsk.osm"), new ConsoleProgressImplementation(3), + null, MapZooms.getDefault(), null); // creator.setNodesDBFile(new File("e:/Information/OSM maps/osmand/belarus_nodes.tmp.odb")); //$NON-NLS-1$ diff --git a/DataExtractionOSM/src/net/osmand/osm/MapRenderingTypes.java b/DataExtractionOSM/src/net/osmand/osm/MapRenderingTypes.java index e3a6539efb..d3512b7f8e 100644 --- a/DataExtractionOSM/src/net/osmand/osm/MapRenderingTypes.java +++ b/DataExtractionOSM/src/net/osmand/osm/MapRenderingTypes.java @@ -3,6 +3,7 @@ package net.osmand.osm; import gnu.trove.map.TIntByteMap; import gnu.trove.map.hash.TIntByteHashMap; +import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.Collection; @@ -72,65 +73,8 @@ public class MapRenderingTypes { public final static char REF_CHAR = ((char)0x0019); public final static char DELIM_CHAR = ((char)0x0018); + - public final static int HIGHWAY = 1; - public final static int BARRIER = 2; - public final static int WATERWAY = 3; - public final static int RAILWAY = 4; - public final static int AEROWAY = 5; - public final static int AERIALWAY = 6; - public final static int POWER = 7; - public final static int MAN_MADE = 8; - public final static int LEISURE = 9; - public final static int OFFICE = 10; - public final static int SHOP = 11; - public final static int EMERGENCY = 12; - public final static int TOURISM = 13; - public final static int HISTORIC = 14; - public final static int LANDUSE = 15; - public final static int MILITARY = 16; - public final static int NATURAL = 17; - public final static int AMENITY_SUSTENANCE = 18; - public final static int AMENITY_EDUCATION = 19; - public final static int AMENITY_TRANSPORTATION = 20; - public final static int AMENITY_FINANCE = 21; - public final static int AMENITY_HEALTHCARE = 22; - public final static int AMENITY_ENTERTAINMENT = 23; - public final static int AMENITY_OTHER = 24; - public final static int ADMINISTRATIVE = 25; - public final static int ROUTE = 26; //NOT DONE YET - public final static int SPORT = 27; //+no icons - - - public final static int SUBTYPE_BUILDING = 1; - public final static int SUBTYPE_GARAGES = 5; - public final static int SUBTYPE_PARKING = 1; - - - public final static int PL_HW_TRUNK = 1; - public final static int PL_HW_MOTORWAY = 2; - public final static int PL_HW_PRIMARY = 3; - public final static int PL_HW_SECONDARY = 4; - public final static int PL_HW_TERTIARY = 5; - public final static int PL_HW_RESIDENTIAL = 6; - public final static int PL_HW_SERVICE = 7; - public final static int PL_HW_UNCLASSIFIED = 8; - public final static int PL_HW_TRACK = 9; - public final static int PL_HW_PATH = 10; - public final static int PL_HW_LIVING_STREET = 11; - - public final static int PL_HW_PEDESTRIAN = 16; - public final static int PL_HW_CYCLEWAY = 17; - public final static int PL_HW_BYWAY = 18; - public final static int PL_HW_FOOTWAY = 19; - public final static int PL_HW_STEPS = 20; - public final static int PL_HW_BRIDLEWAY = 21; - public final static int PL_HW_SERVICES = 22; - public final static int PL_HW_FORD = 23; - - public final static int PL_HW_CONSTRUCTION = 25; - public final static int PL_HW_PROPOSED = 26; - public final static byte RESTRICTION_NO_RIGHT_TURN = 1; public final static byte RESTRICTION_NO_LEFT_TURN = 2; @@ -154,21 +98,35 @@ public class MapRenderingTypes { return (type >> 7) & PG_SUBTYPE_MASK; } } - + + private String resourceName = null; // stored information to convert from osm tags to int type - private static Map types = null; + private Map types = null; - private static TIntByteMap objectsToMinZoom = null; + private TIntByteMap objectsToMinZoom = null; private static Map amenityTagValToType = null; private static Map amenityTagValToPrefix = null; private static String TAG_DELIMETER = "&&"; //$NON-NLS-1$ - private static Map> amenityTypeNameToTagVal = null; - private static Map amenityNameToType = null; + private Map> amenityTypeNameToTagVal = null; + private Map amenityNameToType = null; + public MapRenderingTypes(String fileName){ + this.resourceName = fileName; + } + + + private static MapRenderingTypes DEFAULT_INSTANCE = null; + + public static MapRenderingTypes getDefault() { + if(DEFAULT_INSTANCE == null){ + DEFAULT_INSTANCE = new MapRenderingTypes(null); + } + return DEFAULT_INSTANCE; + } private final static int POLYGON_WITH_CENTER_TYPE = 9; // special type means that ways will transform in area with the same point subtype = as area subtype @@ -273,7 +231,7 @@ public class MapRenderingTypes { } - public static Map getEncodingRuleTypes(){ + public Map getEncodingRuleTypes(){ if (types == null) { types = new LinkedHashMap(); init(INIT_RULE_TYPES); @@ -283,7 +241,7 @@ public class MapRenderingTypes { // if type equals 0 no need to save that point - public static int encodeEntityWithType(Entity e, int zoom, boolean multipolygon, List additionalTypes) { + public int encodeEntityWithType(Entity e, int zoom, boolean multipolygon, List additionalTypes) { if (types == null) { types = new LinkedHashMap(); init(INIT_RULE_TYPES); @@ -364,6 +322,9 @@ public class MapRenderingTypes { additionalTypes.add(pointType); } } else if (polygon && (pr == DEFAULT_POLYGON_BUILDING)) { + // TODO get polygon type + int MAN_MADE = 8; + int SUBTYPE_BUILDING = 1; if(polygonType == 0 && polylineType == 0){ int attr = getLayerAttributes(e) << 12; polygonType = (multipolygon ? MULTY_POLYGON_TYPE : POLYGON_TYPE) | (((SUBTYPE_BUILDING << 5) | MAN_MADE) << 2) | attr; @@ -567,7 +528,7 @@ public class MapRenderingTypes { } - private static void initAmenityMap(){ + private void initAmenityMap(){ if (amenityTypeNameToTagVal == null) { amenityTypeNameToTagVal = new LinkedHashMap>(); init(INIT_AMENITY_MAP); @@ -579,7 +540,7 @@ public class MapRenderingTypes { * @return map * only when minzoom < 15 */ - public static TIntByteMap getObjectTypeMinZoom(){ + public TIntByteMap getObjectTypeMinZoom(){ if(objectsToMinZoom == null){ objectsToMinZoom = new TIntByteHashMap(); init(INIT_TYPE_ZOOM); @@ -588,12 +549,12 @@ public class MapRenderingTypes { } - public static Map> getAmenityTypeNameToTagVal() { + public Map> getAmenityTypeNameToTagVal() { initAmenityMap(); return amenityTypeNameToTagVal; } - public static Map getAmenityNameToType(){ + public Map getAmenityNameToType(){ initAmenityMap(); if(amenityNameToType == null){ amenityNameToType = new LinkedHashMap(); @@ -613,7 +574,7 @@ public class MapRenderingTypes { - private static void registerAmenity(String tag, String val, int type, int subtype){ + private void registerAmenity(String tag, String val, int type, int subtype){ AmenityType t = getAmenityType(tag, val); if (t != null) { if (val != null) { @@ -657,9 +618,14 @@ public class MapRenderingTypes { private final static int INIT_AMENITY_MAP = 1; private final static int INIT_TYPE_ZOOM = 2; - private static void init(final int st){ - InputStream is = MapRenderingTypes.class.getResourceAsStream("rendering_types.xml"); //$NON-NLS-1$ + private void init(final int st){ + InputStream is; try { + if(resourceName == null){ + is = MapRenderingTypes.class.getResourceAsStream("rendering_types.xml"); //$NON-NLS-1$ + } else { + is = new FileInputStream(resourceName); + } long time = System.currentTimeMillis(); final SAXParser parser = SAXParserFactory.newInstance().newSAXParser(); @@ -724,6 +690,7 @@ public class MapRenderingTypes { } }); log.info("Time to init " + (System.currentTimeMillis() - time)); //$NON-NLS-1$ + is.close(); } catch (IOException e) { log.error("Unexpected error", e); //$NON-NLS-1$ e.printStackTrace(); @@ -743,7 +710,7 @@ public class MapRenderingTypes { } } - private static void stepSubtype(int st, int minZoom, String tag, String val, int type, int subtype, int polygonRule, int polylineRule, + private void stepSubtype(int st, int minZoom, String tag, String val, int type, int subtype, int polygonRule, int polylineRule, int pointRule) { if(st == INIT_RULE_TYPES){ MapRulType rtype = types.get(tag); @@ -960,9 +927,10 @@ public class MapRenderingTypes { // } // System.out.println(getAmenityNameToType()); // long ts = System.currentTimeMillis(); - initAmenityMap(); - System.out.println(amenityTypeNameToTagVal); - System.out.println(getAmenityNameToType()); + MapRenderingTypes def = MapRenderingTypes.getDefault(); + def.initAmenityMap(); + System.out.println(def.amenityTypeNameToTagVal); + System.out.println(def.getAmenityNameToType()); } } diff --git a/DataExtractionOSM/src/net/osmand/swing/DataExtractionSettings.java b/DataExtractionOSM/src/net/osmand/swing/DataExtractionSettings.java index 92b68b49b2..7f3d599872 100644 --- a/DataExtractionOSM/src/net/osmand/swing/DataExtractionSettings.java +++ b/DataExtractionOSM/src/net/osmand/swing/DataExtractionSettings.java @@ -61,6 +61,15 @@ public class DataExtractionSettings { preferences.put("map_zooms", zooms); } + + public String getMapRenderingTypesFile(){ + return preferences.get("rendering_types_file", ""); + } + + + public void setMapRenderingTypesFile(String fileName){ + preferences.put("rendering_types_file", fileName); + } public int getDefaultZoom(){ return preferences.getInt("default_zoom", 5); } diff --git a/DataExtractionOSM/src/net/osmand/swing/OsmExtractionUI.java b/DataExtractionOSM/src/net/osmand/swing/OsmExtractionUI.java index 48213dd06c..593f075c18 100644 --- a/DataExtractionOSM/src/net/osmand/swing/OsmExtractionUI.java +++ b/DataExtractionOSM/src/net/osmand/swing/OsmExtractionUI.java @@ -40,6 +40,7 @@ import net.osmand.Version; import net.osmand.data.preparation.IndexCreator; import net.osmand.map.IMapLocationListener; import net.osmand.map.ITileSource; +import net.osmand.osm.MapRenderingTypes; import net.osmand.osm.io.IOsmStorageFilter; import net.osmand.osm.io.OsmBaseStorage; import net.osmand.osm.io.OsmBoundsFilter; @@ -411,7 +412,14 @@ public class OsmExtractionUI implements IMapLocationListener { creator.setNormalizeStreets(normalizingStreets.isSelected()); creator.setIndexTransport(buildTransportIndex.isSelected()); creator.setIndexMap(buildMapIndex.isSelected()); - creator.generateIndexes(f, dlg, filter, DataExtractionSettings.getSettings().getMapZooms()); + String fn = DataExtractionSettings.getSettings().getMapRenderingTypesFile(); + MapRenderingTypes types; + if(fn == null || fn.length() == 0){ + types = MapRenderingTypes.getDefault(); + } else { + types = new MapRenderingTypes(fn); + } + creator.generateIndexes(f, dlg, filter, DataExtractionSettings.getSettings().getMapZooms(), types); } catch (IOException e) { throw new IllegalArgumentException(e); } catch (SAXException e) { diff --git a/OsmAnd/src/net/osmand/AmenityIndexRepository.java b/OsmAnd/src/net/osmand/AmenityIndexRepository.java index 35969df074..d8202ce340 100644 --- a/OsmAnd/src/net/osmand/AmenityIndexRepository.java +++ b/OsmAnd/src/net/osmand/AmenityIndexRepository.java @@ -16,6 +16,7 @@ import net.osmand.data.AmenityType; import net.osmand.data.index.IndexConstants; import net.osmand.osm.Entity; import net.osmand.osm.LatLon; +import net.osmand.osm.MapRenderingTypes; import net.osmand.osm.MapUtils; import net.osmand.osm.Node; import net.osmand.osm.io.IOsmStorageFilter; diff --git a/OsmAnd/src/net/osmand/activities/EditPOIFilterActivity.java b/OsmAnd/src/net/osmand/activities/EditPOIFilterActivity.java index 5ef8396374..b054072cb4 100644 --- a/OsmAnd/src/net/osmand/activities/EditPOIFilterActivity.java +++ b/OsmAnd/src/net/osmand/activities/EditPOIFilterActivity.java @@ -15,6 +15,7 @@ import net.osmand.R; import net.osmand.activities.search.SearchPOIActivity; import net.osmand.data.AmenityType; import net.osmand.osm.LatLon; +import net.osmand.osm.MapRenderingTypes; import android.app.AlertDialog; import android.app.ListActivity; import android.app.AlertDialog.Builder; @@ -163,7 +164,7 @@ public class EditPOIFilterActivity extends ListActivity { ScrollView scroll = new ScrollView(this); ListView listView = new ListView(this); - final LinkedHashSet subCategories = new LinkedHashSet(AmenityType.getSubCategories(amenity)); + final LinkedHashSet subCategories = new LinkedHashSet(AmenityType.getSubCategories(amenity, MapRenderingTypes.getDefault())); List subtypes = filter.getAcceptedSubtypes(amenity); boolean allSubTypesAccepted = subtypes == null; LinkedHashSet acceptedCategories = subtypes == null ? null : new LinkedHashSet(subtypes); diff --git a/OsmAnd/src/net/osmand/activities/EditingPOIActivity.java b/OsmAnd/src/net/osmand/activities/EditingPOIActivity.java index ddc9fa63fe..0fa3ce6a23 100644 --- a/OsmAnd/src/net/osmand/activities/EditingPOIActivity.java +++ b/OsmAnd/src/net/osmand/activities/EditingPOIActivity.java @@ -185,7 +185,7 @@ public class EditingPOIActivity { @Override public void afterTextChanged(Editable s) { String str = s.toString(); - AmenityType t = MapRenderingTypes.getAmenityNameToType().get(str); + AmenityType t = MapRenderingTypes.getDefault().getAmenityNameToType().get(str); if(t != null && a.getType() != t){ a.setType(t); typeButton.setText(AmenityType.toPublicString(t)); @@ -241,7 +241,7 @@ public class EditingPOIActivity { final String msg = n.getId() == -1 ? resources.getString(R.string.poi_action_add) : resources .getString(R.string.poi_action_change); String action = n.getId() == -1 ? CREATE_ACTION : MODIFY_ACTION; - Map> typeNameToTagVal = MapRenderingTypes.getAmenityTypeNameToTagVal(); + Map> typeNameToTagVal = MapRenderingTypes.getDefault().getAmenityTypeNameToTagVal(); AmenityType type = a.getType(); String tag = type.getDefaultTag(); String subType = typeText.getText().toString(); @@ -289,8 +289,8 @@ public class EditingPOIActivity { private void updateSubTypesAdapter(AmenityType t){ - Set subCategories = new LinkedHashSet(AmenityType.getSubCategories(t)); - for(String s : MapRenderingTypes.getAmenityNameToType().keySet()){ + Set subCategories = new LinkedHashSet(AmenityType.getSubCategories(t, MapRenderingTypes.getDefault())); + for(String s : MapRenderingTypes.getDefault().getAmenityNameToType().keySet()){ if(!subCategories.contains(s)){ subCategories.add(s); } diff --git a/OsmAnd/src/net/osmand/render/MapRenderRepositories.java b/OsmAnd/src/net/osmand/render/MapRenderRepositories.java index a9cee43602..e54a7eb9df 100644 --- a/OsmAnd/src/net/osmand/render/MapRenderRepositories.java +++ b/OsmAnd/src/net/osmand/render/MapRenderRepositories.java @@ -212,7 +212,8 @@ public class MapRenderRepositories { searchRequest = BinaryMapIndexReader.buildSearchRequest(leftX, rightX, topY, bottomY, zoom); if (zoom < 15) { searchRequest.setSearchFilter(new BinaryMapIndexReader.SearchFilter() { - TIntByteMap map = MapRenderingTypes.getObjectTypeMinZoom(); + // not correct should be used map from rendering to display minzoom + TIntByteMap map = MapRenderingTypes.getDefault().getObjectTypeMinZoom(); @Override public boolean accept(TIntArrayList types) { diff --git a/OsmAnd/src/net/osmand/render/TextRenderer.java b/OsmAnd/src/net/osmand/render/TextRenderer.java deleted file mode 100644 index a9c746d9ea..0000000000 --- a/OsmAnd/src/net/osmand/render/TextRenderer.java +++ /dev/null @@ -1,764 +0,0 @@ -package net.osmand.render; - -import net.osmand.R; -import net.osmand.osm.MapRenderingTypes; -import net.osmand.render.OsmandRenderer.RenderingContext; -import android.graphics.Color; - -public class TextRenderer { - - private static int[] trunkShields = new int[]{R.drawable.tru_shield1, R.drawable.tru_shield2, R.drawable.tru_shield3, - R.drawable.tru_shield4, R.drawable.tru_shield5, R.drawable.tru_shield6, R.drawable.tru_shield7,}; - private static int[] motorShields = new int[]{R.drawable.mot_shield1, R.drawable.mot_shield2, R.drawable.mot_shield3, - R.drawable.mot_shield4, R.drawable.mot_shield5, R.drawable.mot_shield6, R.drawable.mot_shield7,}; - private static int[] primaryShields = new int[]{R.drawable.pri_shield1, R.drawable.pri_shield2, R.drawable.pri_shield3, - R.drawable.pri_shield4, R.drawable.pri_shield5, R.drawable.pri_shield6, R.drawable.pri_shield7,}; - private static int[] secondaryShields = new int[]{R.drawable.sec_shield1, R.drawable.sec_shield2, R.drawable.sec_shield3, - R.drawable.sec_shield4, R.drawable.sec_shield5, R.drawable.sec_shield6, R.drawable.sec_shield7,}; - private static int[] tertiaryShields = new int[]{R.drawable.ter_shield1, R.drawable.ter_shield2, R.drawable.ter_shield3, - R.drawable.ter_shield4, R.drawable.ter_shield5, R.drawable.ter_shield6, R.drawable.ter_shield7,}; - - public static String renderObjectText(String name, int subType, int type, int zoom, boolean point, RenderingContext rc) { - if(name == null || name.length() == 0){ - return null; - } - int textSize = 0; - int textColor = 0; - int wrapWidth = 0; - int shadowRadius = 0; - int textMinDistance = 0; - int textShield = 0; - int dy = 0; - boolean bold = false; - boolean showTextOnPath = false; - - switch (type) { - case MapRenderingTypes.HIGHWAY : { - if(name.charAt(0) == MapRenderingTypes.REF_CHAR){ - name = name.substring(1); - for(int k = 0; k < name.length(); k++){ - if(name.charAt(k) == MapRenderingTypes.REF_CHAR){ - if(k < name.length() - 1 && zoom > 14){ - rc.showAnotherText = name.substring(k + 1); - } - name = name.substring(0, k); - break; - } - } - if(rc.showAnotherText != null && zoom >= 16){ - break; - } - if(name.length() > 6){ - name = name.substring(0, 6); - } - int len = name.length(); - if(len == 0){ - // skip it - } else { - textSize = 10; - textColor = Color.WHITE; - bold = true; - textMinDistance = 70; - // spacing = 750 - if (subType == MapRenderingTypes.PL_HW_TRUNK) { - textShield = trunkShields[len - 1]; - if(zoom < 10){ - textSize = 0; - } - } else if (subType == MapRenderingTypes.PL_HW_MOTORWAY) { - textShield = motorShields[len - 1]; - if(zoom < 10){ - textSize = 0; - } - } else if (subType == MapRenderingTypes.PL_HW_PRIMARY) { - textShield = primaryShields[len - 1]; - if(zoom < 11){ - textSize = 0; - } - } else if (subType == MapRenderingTypes.PL_HW_SECONDARY) { - if(zoom < 14){ - textSize = 0; - } - textShield = secondaryShields[len - 1]; - } else if (subType == MapRenderingTypes.PL_HW_TERTIARY) { - if(zoom < 15){ - textSize = 0; - } - textShield = tertiaryShields[len - 1]; - } else { - if(zoom < 16){ - textSize = 0; - } else { - showTextOnPath = true; - textColor = Color.BLACK; - textSize = 10; - textMinDistance = 40; - shadowRadius = 1; - // spacing = 750; - } - } - } - } else { - if(subType == MapRenderingTypes.PL_HW_TRUNK || subType == MapRenderingTypes.PL_HW_PRIMARY - || subType == MapRenderingTypes.PL_HW_SECONDARY){ - textColor = Color.BLACK; - showTextOnPath = true; - if(zoom == 13 && type != MapRenderingTypes.PL_HW_SECONDARY){ - textSize = 8; - } else if(zoom == 14){ - textSize = 9; - } else if(zoom > 14 && zoom < 17){ - textSize = 10; - } else if(zoom > 16){ - textSize = 12; - } - } else if(subType == MapRenderingTypes.PL_HW_TERTIARY || subType == MapRenderingTypes.PL_HW_RESIDENTIAL - || subType == MapRenderingTypes.PL_HW_UNCLASSIFIED || subType == MapRenderingTypes.PL_HW_SERVICE){ - textColor = Color.BLACK; - showTextOnPath = true; - if(zoom < 15){ - textSize = 0; - } else if(zoom < 17){ - textSize = 9; - } else { - textSize = 11; - } - } else if(subType < 32){ - // highway subtype - if(zoom >= 16){ - textColor = Color.BLACK; - showTextOnPath = true; - textSize = 9; - } - } else if(subType == 40){ - // bus stop - if(zoom >= 17){ - textMinDistance = 20; - textColor = Color.BLACK; - textSize = 9; - wrapWidth = 25; - dy = 11; - } - } - } - } break; - case MapRenderingTypes.WATERWAY : { - if (subType == 1) { - if (zoom >= 15 /* && !tunnel */) { - showTextOnPath = true; - textSize = 8; - shadowRadius = 1; - textColor = 0xff6699cc; - } - } else if (subType == 2 || subType == 4) { - if (zoom >= 12 /* && !tunnel */) { - textSize = 9; - showTextOnPath = true; - shadowRadius = 1; - textColor = 0xff6699cc; - textMinDistance = 70; - } - } else if (subType == 5 || subType == 6) { - if (zoom >= 15 /* && !tunnel */) { - textSize = 8; - showTextOnPath = true; - shadowRadius = 1; - textColor = 0xff6699cc; - } - } else if (subType == 12) { - if(zoom >= 15){ - textColor = Color.BLACK; - textSize = 8; - shadowRadius = 1; - } - } else if (subType == 8) { - if (zoom >= 15) { - shadowRadius = 1; - textSize = 9; - textColor = 0xff0066ff; - wrapWidth = 70; - dy = 10; - } - } - } - break; - case MapRenderingTypes.AEROWAY: { - textColor = 0xff6692da; - shadowRadius = 1; - if(name.charAt(0) == MapRenderingTypes.REF_CHAR){ - name = name.substring(1); - } - if (subType == 7 || subType == 8) { - if (zoom >= 15) { - showTextOnPath = true; - textSize = 10; - textColor = 0xff333333; - textMinDistance = 50; - shadowRadius = 1; - // spacing = 750; - } - } else if (subType == 10) { - // airport - if (zoom >= 10 && zoom <= 12) { - textSize = 9; - dy = -12; - bold = true; - - } - } else if (subType == 1) { - // aerodrome - if (zoom >= 10 && zoom <= 12) { - textSize = 8; - dy = -12; - } - } else if (subType == 12) { - if (zoom >= 17) { - textSize = 10; - textColor = 0xffaa66cc; - shadowRadius = 1; - wrapWidth = 10; - } - } - } - break; - case MapRenderingTypes.AERIALWAY: { - if (subType == 7) { - if (zoom >= 14) { - textColor = 0xff6666ff; - shadowRadius = 1; - if (zoom == 14) { - dy = -7; - textSize = 8; - - } else { - dy = -10; - textSize = 10; - } - } - - } - } - break; - case MapRenderingTypes.RAILWAY: { - if (zoom >= 14) { - textColor = 0xff6666ff; - shadowRadius = 1; - if (subType == 13) { - bold = true; - if (zoom == 14) { - dy = -8; - textSize = 9; - } else { - dy = -10; - textSize = 11; - } - } else if (subType == 22 || subType == 23) { - if (zoom == 14) { - dy = -7; - textSize = 8; - } else { - dy = -10; - textSize = 10; - } - } - } - } - break; - case MapRenderingTypes.EMERGENCY: { - if (zoom >= 17) { - if (subType == 10) { - dy = 9; - textColor = 0xff734a08; - wrapWidth = 30; - textSize = 10; - } - } - } - break; - case MapRenderingTypes.NATURAL: { - if (subType == 23) { - if (zoom >= 12) { - shadowRadius = 2; - textColor = 0xff00000; - textSize = 10; - wrapWidth = 10; - } - } else if (subType == 13) { - if (zoom >= 14) { - shadowRadius = 1; - textColor = 0xff654321; - textSize = 9; - dy = 5; - } - } else if (subType == 3) { - if (zoom >= 15) { - shadowRadius = 1; - textColor = 0xff654321; - textSize = 10; - dy = 9; - wrapWidth = 20; - } - } else if (subType == 21) { - if (zoom >= 12) { - textSize = 10; - shadowRadius = 1; - wrapWidth = 20; - textColor = 0xff6699cc; - } - } else if (subType == 2) { - if (zoom >= 14) { - textSize = 10; - shadowRadius = 1; - wrapWidth = 20; - textColor = 0xff6699cc; - } - } else if (subType == 17) { - if (zoom >= 16) { - textSize = 8; - shadowRadius = 1; - dy = 10; - wrapWidth = 20; - textColor = 0xff6699cc; - } - } - } - break; - case MapRenderingTypes.LANDUSE: { - if (zoom >= 15) { - if (subType == 22) { - textSize = 10; - shadowRadius = 1; - wrapWidth = 20; - textColor = 0xff6699cc; - } else if (point) { - textColor = 0xff000000; - shadowRadius = 2; - wrapWidth = 10; - textSize = 9; - } - } - } - break; - case MapRenderingTypes.TOURISM: { - if (subType == 9) { - if (zoom >= 16) { - textColor = 0xff6699cc; - shadowRadius = 1; - dy = 15; - textSize = 9; - } - } else if (subType == 12 || subType == 13 || subType == 14) { - if (zoom >= 17) { - textColor = 0xff0066ff; - shadowRadius = 1; - dy = 14; - textSize = 10; - } - } else if (subType == 11) { - if (zoom >= 17) { - textColor = 0xff0066ff; - shadowRadius = 1; - dy = 13; - textSize = 8; - } - } else if (subType == 4) { - if (zoom >= 17) { - shadowRadius = 1; - textSize = 10; - textColor = 0xff0066ff; - wrapWidth = 70; - dy = 15; - } - } else if (subType == 5) { - if (zoom >= 17) { - shadowRadius = 1; - textSize = 10; - textColor = 0xff0066ff; - wrapWidth = 70; - dy = 19; - } - } else if (subType == 7) { - if (zoom >= 15) { - textColor = 0xff734a08; - textSize = 9; - wrapWidth = 30; - shadowRadius = 1; - } - } else if (subType == 15) { - if (zoom >= 17) { - textColor = 0xff734a08; - textSize = 10; - dy = 12; - shadowRadius = 1; - } - } - } - break; - case MapRenderingTypes.LEISURE: { - if (subType == 8) { - if (zoom >= 15) { - textColor = Color.BLUE; - textSize = 9; - wrapWidth = 30; - shadowRadius = 1; - } - } else if ((zoom >= 15 && !point) || zoom >= 17) { - textColor = 0xff000000; - shadowRadius = 2; - wrapWidth = 15; - textSize = 9; - } - } - break; - case MapRenderingTypes.HISTORIC: { - if (zoom >= 17) { - if (subType == 6) { - shadowRadius = 1; - textColor = 0xff654321; - textSize = 9; - dy = 12; - wrapWidth = 20; - } - } - } - break; - case MapRenderingTypes.AMENITY_TRANSPORTATION: { - if (zoom >= 17) { - if (subType == 1) { - dy = 9; - textColor = 0xff0066ff; - textSize = 9; - wrapWidth = 34; - } else if (subType == 4 || subType == 18) { - textColor = 0xff0066ff; - shadowRadius = 1; - dy = 13; - textSize = 9; - } - } - } - break; - case MapRenderingTypes.AMENITY_EDUCATION: { - if (subType == 4) { - if (zoom >= 17) { - dy = 12; - textColor = 0xff734a08; - bold = true; - textSize = 10; - } - } else if (subType == 5) { - if (zoom >= 15) { - textColor = 0xff000033; - bold = true; - textSize = 9; - wrapWidth = 16; - } - } else if (subType == 1 || subType == 2 || subType == 3) { - if (zoom >= 16) { - textColor = 0xff000033; - if(subType != 1){ - dy = 11; - } - textSize = 9; - wrapWidth = 16; - } - } - } - break; - case MapRenderingTypes.MAN_MADE: { - if (subType == 1 || subType == 5) { - if(zoom >= 16){ - textColor = 0xff444444; - textSize = 9; - if(zoom >= 17){ - textSize = 11; - if(zoom >= 18){ - textSize = 15; - } - } - wrapWidth = 16; - } - } else if (subType == 17) { - if (zoom >= 15) { - textColor = 0xff000033; - textSize = 9; - shadowRadius = 2; - dy = 16; - wrapWidth = 12; - } - } else if (subType == 27) { - if (zoom >= 17) { - textSize = 9; - textColor = 0xff734a08; - dy = 12; - shadowRadius = 1; - wrapWidth = 20; - } - } - } - break; - case MapRenderingTypes.AMENITY_ENTERTAINMENT: { - if (zoom >= 17) { - textSize = 9; - textColor = 0xff734a08; - dy = 12; - shadowRadius = 1; - wrapWidth = 15; - } - } break; - case MapRenderingTypes.AMENITY_FINANCE: { - if (subType == 2) { - if (zoom >= 17) { - shadowRadius = 1; - textSize = 9; - textColor = Color.BLACK; - dy = 14; - } - } - } - break; - case MapRenderingTypes.MILITARY: { - if (subType == 4) { - if (zoom >= 12) { - bold = true; - textSize = 9; - shadowRadius = 1; - wrapWidth = 10; - textColor = 0xffffc0cb; - } - } - } - break; - case MapRenderingTypes.SHOP: { - if (subType == 42 || subType == 13 || subType == 16 || subType == 19 || subType == 31 || subType == 48) { - if (zoom >= 17) { - textColor = 0xff993399; - textSize = 8; - dy = 13; - shadowRadius = 1; - wrapWidth = 14; - } - } else if (subType == 65 || subType == 17) { - if (zoom >= 16) { - textSize = 9; - textColor = 0xff993399; - dy = 13; - shadowRadius = 1; - wrapWidth = 20; - } - } - - } - break; - case MapRenderingTypes.AMENITY_HEALTHCARE: { - if (subType == 2) { - if (zoom >= 16) { - textSize = 8; - textColor = 0xffda0092; - dy = 12; - shadowRadius = 2; - wrapWidth = 24; - } - } else if (subType == 1) { - if (zoom >= 17) { - textSize = 8; - textColor = 0xffda0092; - dy = 11; - shadowRadius = 1; - wrapWidth = 12; - } - } - - } - break; - case MapRenderingTypes.AMENITY_OTHER: { - if (subType == 10) { - if (zoom >= 17) { - wrapWidth = 30; - textSize = 10; - textColor = 0xff734a08; - dy = 10; - } - } else if (subType == 26) { - if (zoom >= 17) { - wrapWidth = 30; - textSize = 11; - textColor = 0x000033; - dy = 10; - } - } else if (subType == 16) { - if (zoom >= 16) { - textColor = 0xff6699cc; - shadowRadius = 1; - dy = 15; - textSize = 9; - } - } else if (subType == 7) { - if (zoom >= 17) { - textColor = 0xff0066ff; - shadowRadius = 1; - wrapWidth = 20; - dy = 8; - textSize = 9; - } - } else if (subType == 13) { - if (zoom >= 17) { - textColor = 0xff734a08; - textSize = 10; - shadowRadius = 1; - wrapWidth = 20; - dy = 16; - } - } else if (subType == 2) { - if (zoom >= 16) { - textColor = 0xff660033; - textSize = 10; - shadowRadius = 2; - wrapWidth = 10; - } - } - } - break; - case MapRenderingTypes.AMENITY_SUSTENANCE: { - if (zoom >= 17) { - if (subType >= 1 && subType <= 4) { - shadowRadius = 1; - textColor = 0xff734a08; - wrapWidth = 34; - dy = 13; - textSize = 10; - } else if (subType >= 4 && subType <= 6) { - shadowRadius = 1; - textColor = 0xff734a08; - wrapWidth = 34; - dy = 13; - textSize = 10; - } - } - } - break; - case MapRenderingTypes.ADMINISTRATIVE: { - shadowRadius = 1; - switch (subType) { - case 11: { - if (zoom >= 14 && zoom < 16) { - textColor = 0xFF000000; - textSize = 8; - } else if (zoom >= 16) { - textColor = 0xFF777777; - textSize = 11; - } - } - break; - case 8: - case 9: { - if (zoom >= 12 && zoom < 15) { - textColor = 0xFF000000; - textSize = 9; - } else if (zoom >= 15) { - textColor = 0xFF777777; - textSize = 12; - } - } - break; - case 10: { - if (zoom >= 12 && zoom < 14) { - textColor = 0xFF000000; - textSize = 10; - } else if (zoom >= 14) { - textColor = 0xFF777777; - textSize = 13; - } - } - break; - case 19: { - if (zoom >= 8) { - textColor = 0xFF99cc99; - wrapWidth = 14; - if (zoom < 10) { - bold = true; - textSize = 8; - } else if (zoom < 12) { - bold = true; - textSize = 11; - } - } - } - break; - case 12: { - if (zoom >= 10) { - textColor = 0xFF000000; - textSize = 9; - } - } - break; - case 7: { - wrapWidth = 20; - if (zoom >= 9 && zoom < 11) { - textColor = 0xFF000000; - textSize = 8; - } else if (zoom >= 11 && zoom < 14) { - textColor = 0xFF000000; - textSize = 11; - } else if (zoom >= 14) { - textColor = 0xFF777777; - textSize = 13; - } - } - break; - case 6: { - wrapWidth = 20; - textColor = 0xFF000000; - if (zoom >= 6 && zoom < 9) { - textSize = 8; - } else if (zoom >= 9 && zoom < 11) { - textSize = 11; - } else if (zoom >= 11 && zoom <= 14) { - textSize = 14; - } - } - break; - case 42: { - wrapWidth = 20; - textColor = 0xff9d6c9d; - if (zoom >= 2 && zoom < 4) { - textSize = 8; - } else if (zoom >= 4 && zoom < 7) { - textSize = 10; - } - } - break; - case 43: - case 44: { - wrapWidth = 20; - textColor = 0xff9d6c9d; - if (zoom >= 4 && zoom < 8) { - textSize = 9; - } else if (zoom >= 7 && zoom < 9) { - textSize = 11; - } - } - break; - case 33: { - if (zoom >= 17) { - textSize = 9; - textColor = 0xff444444; - } - } - break; - } - } - break; - } - rc.textColor = textColor; - rc.textSize = textSize; - rc.textMinDistance = textMinDistance; - rc.showTextOnPath = showTextOnPath; - rc.textShield = textShield; - rc.textWrapWidth = wrapWidth; - rc.textHaloRadius = shadowRadius; - rc.textBold = bold; - rc.textDy = dy; - return name; - } -}