Update rendering types
This commit is contained in:
parent
d3c2545dcf
commit
d99c5a9dca
5 changed files with 45 additions and 48 deletions
|
@ -64,8 +64,34 @@ public class MapRenderingTypes {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void getAmenityTagValue(AmenityType type, String subType, StringBuilder tag, StringBuilder value) {
|
||||||
|
tag.setLength(0);
|
||||||
|
tag.append(type.getDefaultTag());
|
||||||
|
value.setLength(0);
|
||||||
|
value.append(subType);
|
||||||
|
Map<AmenityType, Map<String, String>> m = getAmenityTypeNameToTagVal();
|
||||||
|
if (m.containsKey(type)) {
|
||||||
|
Map<String, String> map = m.get(type);
|
||||||
|
if (map.containsKey(subType)) {
|
||||||
|
String res = map.get(subType);
|
||||||
|
if (res != null) {
|
||||||
|
int i = res.indexOf(' ');
|
||||||
|
if (i != -1) {
|
||||||
|
tag.setLength(0);
|
||||||
|
tag.append(res.substring(0, i));
|
||||||
|
value.setLength(0);
|
||||||
|
value.append(res.substring(i + 1));
|
||||||
|
} else {
|
||||||
|
tag.setLength(0);
|
||||||
|
tag.append(res);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Map<AmenityType, Map<String, String>> getAmenityTypeNameToTagVal() {
|
private Map<AmenityType, Map<String, String>> getAmenityTypeNameToTagVal() {
|
||||||
if (amenityTypeNameToTagVal == null) {
|
if (amenityTypeNameToTagVal == null) {
|
||||||
Map<String, AmenityRuleType> types = getAmenityEncodingRuleTypes();
|
Map<String, AmenityRuleType> types = getAmenityEncodingRuleTypes();
|
||||||
amenityTypeNameToTagVal = new LinkedHashMap<AmenityType, Map<String, String>>();
|
amenityTypeNameToTagVal = new LinkedHashMap<AmenityType, Map<String, String>>();
|
||||||
|
@ -90,6 +116,7 @@ public class MapRenderingTypes {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Map<String, AmenityType> getAmenityNameToType(){
|
public Map<String, AmenityType> getAmenityNameToType(){
|
||||||
if(amenityNameToType == null){
|
if(amenityNameToType == null){
|
||||||
amenityNameToType = new LinkedHashMap<String, AmenityType>();
|
amenityNameToType = new LinkedHashMap<String, AmenityType>();
|
||||||
|
@ -320,6 +347,6 @@ public class MapRenderingTypes {
|
||||||
protected boolean poiSpecified;
|
protected boolean poiSpecified;
|
||||||
protected AmenityRuleType targetTagValue;
|
protected AmenityRuleType targetTagValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
BIN
OsmAnd/res/drawable-large/map_compass_white.png
Normal file
BIN
OsmAnd/res/drawable-large/map_compass_white.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.6 KiB |
|
@ -434,27 +434,11 @@ public class EditingPOIActivity implements DialogProvider {
|
||||||
final String msg = n.getId() == -1 ? resources.getString(R.string.poi_action_add) : resources
|
final String msg = n.getId() == -1 ? resources.getString(R.string.poi_action_add) : resources
|
||||||
.getString(R.string.poi_action_change);
|
.getString(R.string.poi_action_change);
|
||||||
OsmPoint.Action action = n.getId() == -1 ? OsmPoint.Action.CREATE : OsmPoint.Action.MODIFY;
|
OsmPoint.Action action = n.getId() == -1 ? OsmPoint.Action.CREATE : OsmPoint.Action.MODIFY;
|
||||||
Map<AmenityType, Map<String, String>> typeNameToTagVal = MapRenderingTypes.getDefault().getAmenityTypeNameToTagVal();
|
StringBuilder tag = new StringBuilder();
|
||||||
AmenityType type = a.getType();
|
StringBuilder value = new StringBuilder();
|
||||||
String tag = type.getDefaultTag();
|
|
||||||
String subType = typeText.getText().toString();
|
String subType = typeText.getText().toString();
|
||||||
String val = subType;
|
MapRenderingTypes.getDefault().getAmenityTagValue(a.getType(), subType, tag, value);
|
||||||
if (typeNameToTagVal.containsKey(type)) {
|
n.putTag(tag.toString(), value.toString());
|
||||||
Map<String, String> map = typeNameToTagVal.get(type);
|
|
||||||
if (map.containsKey(subType)) {
|
|
||||||
String res = map.get(subType);
|
|
||||||
if (res != null) {
|
|
||||||
int i = res.indexOf(' ');
|
|
||||||
if (i != -1) {
|
|
||||||
tag = res.substring(0, i);
|
|
||||||
val = res.substring(i + 1);
|
|
||||||
} else {
|
|
||||||
tag = res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
n.putTag(tag, val);
|
|
||||||
String name = nameText.getText().toString();
|
String name = nameText.getText().toString();
|
||||||
if(name.length() > 0) {
|
if(name.length() > 0) {
|
||||||
n.putTag(OSMTagKey.NAME.getValue(), name);
|
n.putTag(OSMTagKey.NAME.getValue(), name);
|
||||||
|
|
|
@ -62,28 +62,10 @@ public class OpenstreetmapLocalUtil implements OpenstreetmapUtil {
|
||||||
Node entity = new Node(n.getLocation().getLatitude(),
|
Node entity = new Node(n.getLocation().getLatitude(),
|
||||||
n.getLocation().getLongitude(),
|
n.getLocation().getLongitude(),
|
||||||
nodeId);
|
nodeId);
|
||||||
|
StringBuilder tag = new StringBuilder();
|
||||||
Map<AmenityType, Map<String, String>> typeNameToTagVal = MapRenderingTypes.getDefault().getAmenityTypeNameToTagVal();
|
StringBuilder value = new StringBuilder();
|
||||||
AmenityType type = n.getType();
|
MapRenderingTypes.getDefault().getAmenityTagValue(n.getType(), n.getSubType(), tag, value);
|
||||||
String tag = type.getDefaultTag();
|
entity.putTag(tag.toString(), value.toString());
|
||||||
String subType = n.getSubType();
|
|
||||||
String val = subType;
|
|
||||||
if (typeNameToTagVal.containsKey(type)) {
|
|
||||||
Map<String, String> map = typeNameToTagVal.get(type);
|
|
||||||
if (map.containsKey(subType)) {
|
|
||||||
String res = map.get(subType);
|
|
||||||
if (res != null) {
|
|
||||||
int i = res.indexOf(' ');
|
|
||||||
if (i != -1) {
|
|
||||||
tag = res.substring(0, i);
|
|
||||||
val = res.substring(i + 1);
|
|
||||||
} else {
|
|
||||||
tag = res;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
entity.putTag(tag, val);
|
|
||||||
entity.putTag(OSMTagKey.NAME.getValue(), n.getName());
|
entity.putTag(OSMTagKey.NAME.getValue(), n.getName());
|
||||||
entity.putTag(OSMTagKey.OPENING_HOURS.getValue(), n.getOpeningHours());
|
entity.putTag(OSMTagKey.OPENING_HOURS.getValue(), n.getOpeningHours());
|
||||||
|
|
||||||
|
|
|
@ -10,6 +10,7 @@ import net.osmand.access.AccessibleToast;
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
import net.osmand.data.AmenityType;
|
import net.osmand.data.AmenityType;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
|
import net.osmand.osm.MapRenderingTypes;
|
||||||
import net.osmand.plus.ContextMenuAdapter;
|
import net.osmand.plus.ContextMenuAdapter;
|
||||||
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
import net.osmand.plus.ContextMenuAdapter.OnContextMenuClick;
|
||||||
import net.osmand.plus.OsmAndFormatter;
|
import net.osmand.plus.OsmAndFormatter;
|
||||||
|
@ -181,10 +182,13 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
canvas.drawCircle(x, y, r, pointAltUI);
|
canvas.drawCircle(x, y, r, pointAltUI);
|
||||||
canvas.drawCircle(x, y, r, point);
|
canvas.drawCircle(x, y, r, point);
|
||||||
String id = null;
|
String id = null;
|
||||||
if (RenderingIcons.containsIcon(o.getType().getDefaultTag() + "_" + o.getSubType())) {
|
StringBuilder tag = new StringBuilder();
|
||||||
id = o.getType().getDefaultTag() + "_" + o.getSubType();
|
StringBuilder value = new StringBuilder();
|
||||||
} else if(RenderingIcons.containsIcon(o.getSubType())){
|
MapRenderingTypes.getDefault().getAmenityTagValue(o.getType(), o.getSubType(), tag, value);
|
||||||
id = o.getSubType();
|
if (RenderingIcons.containsIcon(tag + "_" + value)) {
|
||||||
|
id = tag + "_" + value;
|
||||||
|
} else if(RenderingIcons.containsIcon(tag.toString())){
|
||||||
|
id = tag.toString();
|
||||||
}
|
}
|
||||||
if(id != null){
|
if(id != null){
|
||||||
Bitmap bmp = RenderingIcons.getIcon(view.getContext(), id);
|
Bitmap bmp = RenderingIcons.getIcon(view.getContext(), id);
|
||||||
|
|
Loading…
Reference in a new issue