package net.osmand.binary; import java.util.LinkedHashMap; import java.util.Map; import gnu.trove.list.array.TIntArrayList; import gnu.trove.map.hash.TIntObjectHashMap; import net.osmand.binary.BinaryMapIndexReader.MapIndex; import net.osmand.render.RenderingRulesStorage; public class BinaryMapDataObject { protected int[] coordinates = null; protected int[][] polygonInnerCoordinates = null; protected boolean area = false; protected int[] types = null; protected int[] additionalTypes = null; protected int objectType = RenderingRulesStorage.POINT_RULES; protected TIntObjectHashMap objectNames = null; protected TIntArrayList namesOrder = null; protected long id = 0; protected MapIndex mapIndex = null; public BinaryMapDataObject(){ } public BinaryMapDataObject(int[] coordinates, int[] types, int[][] polygonInnerCoordinates, long id){ this.polygonInnerCoordinates = polygonInnerCoordinates; this.coordinates = coordinates; this.additionalTypes = new int[0]; this.types = types; this.id = id; } protected void setCoordinates(int[] coordinates) { this.coordinates = coordinates; } public String getName(){ if(objectNames == null){ return ""; } String name = objectNames.get(mapIndex.nameEncodingType); if(name == null){ return ""; } return name; } public TIntObjectHashMap getObjectNames() { return objectNames; } public Map getOrderedObjectNames() { LinkedHashMap lm = new LinkedHashMap (); for (int i = 0; i < namesOrder.size(); i++) { int nm = namesOrder.get(i); lm.put(nm, objectNames.get(nm)); } return lm; } public void putObjectName(int type, String name){ if(objectNames == null){ objectNames = new TIntObjectHashMap(); namesOrder = new TIntArrayList(); } objectNames.put(type, name); namesOrder.add(type); } public int[][] getPolygonInnerCoordinates() { return polygonInnerCoordinates; } public int[] getTypes(){ return types; } public boolean containsType(int cachedType) { if(cachedType != -1) { for(int i=0; i