Fix compilation errors
This commit is contained in:
parent
8d5d72f80e
commit
769acbf30f
5 changed files with 45 additions and 69 deletions
|
@ -14,9 +14,10 @@ public class ToDoConstants {
|
|||
// POI index exclude building hno from categories!!!
|
||||
// Routing index !!
|
||||
// Identify coastline areas and pure ocean areas !!!
|
||||
|
||||
// Extract & remove the code with multipolygons
|
||||
// render different texts
|
||||
|
||||
|
||||
// FIXME layer and renderer 1) FIXME Layer 2 2) FIXME oneway 1
|
||||
|
||||
|
||||
// TO try & to test
|
||||
|
|
|
@ -1326,9 +1326,9 @@ public class BinaryMapIndexReader {
|
|||
|
||||
Map<String, Map<String, Integer>> encodingRules = new LinkedHashMap<String, Map<String, Integer>>();
|
||||
TIntObjectMap<TagValuePair> decodingRules = new TIntObjectHashMap<TagValuePair>();
|
||||
int nameEncodingType = 0;
|
||||
int refEncodingType = -1;
|
||||
int coastlineEncodingType = 0;
|
||||
public int nameEncodingType = 0;
|
||||
public int refEncodingType = -1;
|
||||
public int coastlineEncodingType = -1;
|
||||
|
||||
public List<MapRoot> getRoots() {
|
||||
return roots;
|
||||
|
|
|
@ -366,7 +366,7 @@ public class MapRenderRepositories {
|
|||
List<BinaryMapDataObject> res = c.searchMapIndex(searchRequest);
|
||||
for (BinaryMapDataObject r : res) {
|
||||
if (PerformanceFlags.checkForDuplicateObjectIds) {
|
||||
if (ids.contains(r.getId())) {
|
||||
if (ids.contains(r.getId()) && r.getId() > 0) {
|
||||
// do not add object twice
|
||||
continue;
|
||||
}
|
||||
|
@ -375,10 +375,9 @@ public class MapRenderRepositories {
|
|||
count++;
|
||||
|
||||
for (int i = 0; i < r.getTypes().length; i++) {
|
||||
if ((r.getTypes()[i] & 0x3) == MapRenderingTypes.MULTY_POLYGON_TYPE) {
|
||||
if (r.getTypes()[i] == r.getMapIndex().coastlineEncodingType) {
|
||||
// multy polygon r.getId() >> 3
|
||||
TagValuePair pair = r.getMapIndex().decodeType(MapRenderingTypes.getMainObjectType(r.getTypes()[i]),
|
||||
MapRenderingTypes.getObjectSubType(r.getTypes()[i]));
|
||||
TagValuePair pair = r.getMapIndex().decodeType(r.getTypes()[i]);
|
||||
if (pair != null) {
|
||||
pair = new TagValuePair(pair.tag, pair.value, r.getTypes()[i]);
|
||||
if (!multiPolygons.containsKey(pair)) {
|
||||
|
@ -682,7 +681,6 @@ public class MapRenderRepositories {
|
|||
// delete direction last bit (to not show point)
|
||||
pl.setTag(type.tag);
|
||||
pl.setValue(type.value);
|
||||
pl.setLayer(MapRenderingTypes.getNegativeWayLayer(type.additionalAttribute));
|
||||
long dbId = 0;
|
||||
for (int km = 0; km < 2; km++) {
|
||||
List<BinaryMapDataObject> list = km == 0 ? directList : inverselist;
|
||||
|
|
|
@ -398,14 +398,22 @@ public class OsmandRenderer {
|
|||
for (int j = 0; j < o.getTypes().length; j++) {
|
||||
// put(orderMap, BinaryMapDataObject.getOrder(o.getTypes()[j]), sh + j, init);
|
||||
int wholeType = o.getTypes()[j];
|
||||
int mask = wholeType & 3;
|
||||
|
||||
int mask = MapRenderingTypes.POINT_TYPE;
|
||||
if(o.getPointsLength() > 1) {
|
||||
if(o.isArea()){
|
||||
mask = MapRenderingTypes.POLYGON_TYPE;
|
||||
} else {
|
||||
mask = MapRenderingTypes.POLYLINE_TYPE;
|
||||
}
|
||||
}
|
||||
int layer = 0;
|
||||
if (mask != MapRenderingTypes.POINT_TYPE) {
|
||||
layer = MapRenderingTypes.getNegativeWayLayer(wholeType);
|
||||
// FIXME Layer
|
||||
// layer = MapRenderingTypes.getNegativeWayLayer(wholeType);
|
||||
}
|
||||
|
||||
TagValuePair pair = o.getMapIndex().decodeType(MapRenderingTypes.getMainObjectType(wholeType),
|
||||
MapRenderingTypes.getObjectSubType(wholeType));
|
||||
TagValuePair pair = o.getMapIndex().decodeType(wholeType);
|
||||
if (pair != null) {
|
||||
render.setTagValueZoomLayer(pair.tag, pair.value, rc.zoom, layer);
|
||||
render.setIntFilter(render.ALL.R_ORDER_TYPE, mask);
|
||||
|
@ -447,25 +455,17 @@ public class OsmandRenderer {
|
|||
}
|
||||
} else {
|
||||
int mainType = obj.getTypes()[l];
|
||||
int t = mainType & 3;
|
||||
int type = MapRenderingTypes.getMainObjectType(mainType);
|
||||
int subtype = MapRenderingTypes.getObjectSubType(mainType);
|
||||
TagValuePair pair = obj.getMapIndex().decodeType(type, subtype);
|
||||
if (t == MapRenderingTypes.POINT_TYPE && !drawOnlyShadow) {
|
||||
TagValuePair pair = obj.getMapIndex().decodeType(mainType);
|
||||
if (obj.getPointsLength() == 1 && !drawOnlyShadow) {
|
||||
drawPoint(obj, render, canvas, rc, pair, renderText);
|
||||
} else if (t == MapRenderingTypes.POLYLINE_TYPE) {
|
||||
int layer = MapRenderingTypes.getNegativeWayLayer(mainType);
|
||||
drawPolyline(obj, render, canvas, rc, pair, layer, drawOnlyShadow);
|
||||
} else if (t == MapRenderingTypes.POLYGON_TYPE && !drawOnlyShadow) {
|
||||
} else if (!obj.isArea()) {
|
||||
// FIXME Layer
|
||||
// int layer = MapRenderingTypes.getNegativeWayLayer(mainType);
|
||||
drawPolyline(obj, render, canvas, rc, pair, 0, drawOnlyShadow);
|
||||
} else if (obj.isArea() && !drawOnlyShadow) {
|
||||
drawPolygon(obj, render, canvas, rc, pair);
|
||||
} else {
|
||||
if (t == MapRenderingTypes.MULTY_POLYGON_TYPE && !(obj instanceof MultyPolygon)) {
|
||||
// log this situation
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -533,10 +533,7 @@ public class OsmandRenderer {
|
|||
}
|
||||
}
|
||||
if (cnt > 0) {
|
||||
String name = ((MultyPolygon) obj).getName(i);
|
||||
if (name != null) {
|
||||
textRenderer.renderText(name, render, rc, new TagValuePair(tag, value), xText / cnt, yText / cnt, null, null);
|
||||
}
|
||||
textRenderer.renderText(obj, render, rc, new TagValuePair(tag, value, 0), xText / cnt, yText / cnt, null, null);
|
||||
}
|
||||
}
|
||||
canvas.drawPath(path, paint);
|
||||
|
@ -587,10 +584,7 @@ public class OsmandRenderer {
|
|||
if (updatePaint(render, paint, 1, false, rc)) {
|
||||
canvas.drawPath(path, paint);
|
||||
}
|
||||
String name = obj.getName();
|
||||
if(name != null){
|
||||
textRenderer.renderText(name, render, rc, pair, xText / len, yText / len, null, null);
|
||||
}
|
||||
textRenderer.renderText(obj, render, rc, pair, xText / len, yText / len, null, null);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -677,11 +671,7 @@ public class OsmandRenderer {
|
|||
render.search(RenderingRulesStorage.POINT_RULES);
|
||||
|
||||
String resId = render.getStringPropertyValue(render.ALL.R_ICON);
|
||||
String name = null;
|
||||
if (renderText) {
|
||||
name = obj.getName();
|
||||
}
|
||||
if(resId == null && name == null){
|
||||
if(resId == null && !renderText){
|
||||
return;
|
||||
}
|
||||
int len = obj.getPointsLength();
|
||||
|
@ -704,8 +694,8 @@ public class OsmandRenderer {
|
|||
ico.resId = resId;
|
||||
rc.iconsToDraw.add(ico);
|
||||
}
|
||||
if (name != null && name.trim().length() > 0) {
|
||||
textRenderer.renderText(name, render, rc, pair, ps.x, ps.y, null, null);
|
||||
if (renderText) {
|
||||
textRenderer.renderText(obj, render, rc, pair, ps.x, ps.y, null, null);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -749,9 +739,10 @@ public class OsmandRenderer {
|
|||
return;
|
||||
}
|
||||
boolean oneway = false;
|
||||
if(rc.zoom >= 16 && "highway".equals(pair.tag) && MapRenderingTypes.isOneWayWay(obj.getHighwayAttributes())){ //$NON-NLS-1$
|
||||
oneway = true;
|
||||
}
|
||||
//FIXME oneway
|
||||
// if(rc.zoom >= 16 && "highway".equals(pair.tag) && MapRenderingTypes.isOneWayWay(obj.getHighwayAttributes())){ //$NON-NLS-1$
|
||||
// oneway = true;
|
||||
// }
|
||||
|
||||
rc.visible++;
|
||||
|
||||
|
@ -760,7 +751,7 @@ public class OsmandRenderer {
|
|||
float yMid = 0;
|
||||
int middle = obj.getPointsLength() / 2;
|
||||
PointF[] textPoints = null;
|
||||
if (!drawOnlyShadow && obj.getName() != null && obj.getName().length() > 0) {
|
||||
if (!drawOnlyShadow) {
|
||||
textPoints = new PointF[length];
|
||||
}
|
||||
|
||||
|
@ -805,7 +796,7 @@ public class OsmandRenderer {
|
|||
}
|
||||
}
|
||||
if (textPoints != null) {
|
||||
textRenderer.renderText(obj.getName(), render, rc, pair, xMid, yMid, path, textPoints);
|
||||
textRenderer.renderText(obj, render, rc, pair, xMid, yMid, path, textPoints);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,8 +5,8 @@ import java.util.Collections;
|
|||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import net.osmand.binary.BinaryMapDataObject;
|
||||
import net.osmand.binary.BinaryMapIndexReader.TagValuePair;
|
||||
import net.osmand.osm.MapRenderingTypes;
|
||||
import net.osmand.plus.render.OsmandRenderer.RenderingContext;
|
||||
import net.osmand.render.RenderingRuleSearchRequest;
|
||||
import net.osmand.render.RenderingRulesStorage;
|
||||
|
@ -206,12 +206,6 @@ public class TextRenderer {
|
|||
for (int i = 0; i < size; i++) {
|
||||
TextDrawInfo text = rc.textToDraw.get(i);
|
||||
if (text.text != null && text.text.length() > 0) {
|
||||
int d = text.text.indexOf(MapRenderingTypes.DELIM_CHAR);
|
||||
// not used now functionality
|
||||
// possibly it will be used specifying english names after that character
|
||||
if (d > 0) {
|
||||
text.text = text.text.substring(0, d);
|
||||
}
|
||||
if (useEnglishNames) {
|
||||
text.text = Junidecode.unidecode(text.text);
|
||||
}
|
||||
|
@ -329,22 +323,14 @@ public class TextRenderer {
|
|||
}
|
||||
}
|
||||
|
||||
public void renderText(String name, RenderingRuleSearchRequest render, RenderingContext rc, TagValuePair pair,
|
||||
public void renderText(BinaryMapDataObject obj, RenderingRuleSearchRequest render, RenderingContext rc, TagValuePair pair,
|
||||
float xMid, float yMid, Path path, PointF[] points) {
|
||||
// TODO other render text
|
||||
String ref = null;
|
||||
if(name.charAt(0) == MapRenderingTypes.REF_CHAR){
|
||||
ref = name.substring(1);
|
||||
name = ""; //$NON-NLS-1$
|
||||
for(int k = 0; k < ref.length(); k++){
|
||||
if(ref.charAt(k) == MapRenderingTypes.REF_CHAR){
|
||||
if(k < ref.length() - 1){
|
||||
name = ref.substring(k + 1);
|
||||
}
|
||||
ref = ref.substring(0, k);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(obj.getMapIndex().refEncodingType >= 0 ) {
|
||||
ref = obj.getObjectNames().get(obj.getMapIndex().refEncodingType);
|
||||
}
|
||||
String name = obj.getObjectNames().get(obj.getMapIndex().nameEncodingType);
|
||||
if(ref != null && ref.trim().length() > 0){
|
||||
createTextDrawInfo(render, rc, pair, xMid, yMid, path, points, ref, true);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue