Fix rendering issue for sports and other polygons
This commit is contained in:
parent
88488dc600
commit
e50e1fec6d
7 changed files with 46 additions and 62 deletions
|
@ -46,18 +46,9 @@ public class BinaryInspector {
|
|||
public static void main(String[] args) throws IOException {
|
||||
inspector(args);
|
||||
// test cases show info
|
||||
// inspector(new String[]{"/home/victor/projects/OsmAnd/data/osm-gen/Luxembourg.obf"});
|
||||
|
||||
|
||||
inspector(new String[]{"-vmap", "/home/victor/projects/OsmAnd/data/osm-gen/Map.obf"});
|
||||
// test case extract parts
|
||||
// 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.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"});
|
||||
}
|
||||
|
||||
private static void println(String s) {
|
||||
|
|
|
@ -45,13 +45,6 @@ public class BinaryMapDataObject {
|
|||
return name;
|
||||
}
|
||||
|
||||
public int getObjectType() {
|
||||
return objectType;
|
||||
}
|
||||
|
||||
public void setObjectType(int objectType) {
|
||||
this.objectType = objectType;
|
||||
}
|
||||
|
||||
public TIntObjectHashMap<String> getObjectNames() {
|
||||
return objectNames;
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
|
||||
|
||||
<!-- input layer check tag, value, point, cycle, area -->
|
||||
<!-- Order should be between 0 and 255 (integer) -->
|
||||
<!-- output ! objectType point = 1, line = 2, polygon = 3 and order -->
|
||||
<order>
|
||||
<!-- point has order 128 -->
|
||||
|
@ -83,6 +84,8 @@
|
|||
<!-- default polygon -->
|
||||
<filter cycle="true" layer="-1" tag="" value="" order="3" objectType="3"/>
|
||||
<filter area="true" layer="-1" tag="" value="" order="3" objectType="3"/>
|
||||
<filter cycle="true" tag="" value="" order="3" objectType="7"/>
|
||||
<filter area="true" tag="" value="" order="3" objectType="7"/>
|
||||
<!-- default line -->
|
||||
<filter layer="-1" tag="" value="" order="10" objectType="2"/>
|
||||
<filter tag="" value="" order="11" objectType="2"/>
|
||||
|
|
|
@ -355,42 +355,42 @@ public class MapRenderRepositories {
|
|||
boolean ocean = false;
|
||||
MapIndex mi = null;
|
||||
searchRequest = BinaryMapIndexReader.buildSearchRequest(leftX, rightX, topY, bottomY, zoom, searchFilter);
|
||||
for (BinaryMapIndexReader c : files.values()) {
|
||||
for (BinaryMapIndexReader c : files.values()) {
|
||||
searchRequest.clearSearchResults();
|
||||
List<BinaryMapDataObject> res = c.searchMapIndex(searchRequest);
|
||||
for (BinaryMapDataObject r : res) {
|
||||
if (PerformanceFlags.checkForDuplicateObjectIds) {
|
||||
if (ids.contains(r.getId()) && r.getId() > 0) {
|
||||
// do not add object twice
|
||||
continue;
|
||||
}
|
||||
ids.add(r.getId());
|
||||
for (BinaryMapDataObject r : res) {
|
||||
if (PerformanceFlags.checkForDuplicateObjectIds) {
|
||||
if (ids.contains(r.getId()) && r.getId() > 0) {
|
||||
// do not add object twice
|
||||
continue;
|
||||
}
|
||||
count++;
|
||||
ids.add(r.getId());
|
||||
}
|
||||
count++;
|
||||
|
||||
if (r.containsType(r.getMapIndex().coastlineEncodingType)) {
|
||||
if(c.isBasemap()){
|
||||
basemapCoastLines.add(r);
|
||||
} else {
|
||||
coastLines.add(r);
|
||||
}
|
||||
if (r.containsType(r.getMapIndex().coastlineEncodingType)) {
|
||||
if (c.isBasemap()) {
|
||||
basemapCoastLines.add(r);
|
||||
} else {
|
||||
// do not mess coastline and other types
|
||||
if(c.isBasemap()){
|
||||
basemapResult.add(r);
|
||||
} else {
|
||||
tempResult.add(r);
|
||||
}
|
||||
coastLines.add(r);
|
||||
}
|
||||
if (checkWhetherInterrupted()) {
|
||||
return false;
|
||||
} else {
|
||||
// do not mess coastline and other types
|
||||
if (c.isBasemap()) {
|
||||
basemapResult.add(r);
|
||||
} else {
|
||||
tempResult.add(r);
|
||||
}
|
||||
}
|
||||
if (checkWhetherInterrupted()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if(searchRequest.isOcean() ){
|
||||
if (searchRequest.isOcean()) {
|
||||
mi = c.getMapIndexes().get(0);
|
||||
ocean = true;
|
||||
} else if(searchRequest.isLand()) {
|
||||
} else if (searchRequest.isLand()) {
|
||||
mi = c.getMapIndexes().get(0);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -217,9 +217,9 @@ public class OsmandRenderer {
|
|||
boolean shadowDrawn = false;
|
||||
|
||||
for (int k = 0; k < keys.length; k++) {
|
||||
if (!shadowDrawn && keys[k] >= rc.shadowLevelMin && keys[k] <= rc.shadowLevelMax && rc.shadowRenderingMode > 1) {
|
||||
if (!shadowDrawn && (keys[k]>>2) >= rc.shadowLevelMin && (keys[k]>>2) <= rc.shadowLevelMax && rc.shadowRenderingMode > 1) {
|
||||
for (int ki = k; ki < keys.length; ki++) {
|
||||
if (keys[ki] > rc.shadowLevelMax || rc.interrupted) {
|
||||
if ((keys[ki]>>2) > rc.shadowLevelMax || rc.interrupted) {
|
||||
break;
|
||||
}
|
||||
TIntArrayList list = orderMap.get(keys[ki]);
|
||||
|
@ -230,7 +230,7 @@ public class OsmandRenderer {
|
|||
BinaryMapDataObject obj = objects.get(ind);
|
||||
|
||||
// show text only for main type
|
||||
drawObj(obj, render, cv, rc, l, l == 0, true);
|
||||
drawObj(obj, render, cv, rc, l, l == 0, true, (keys[ki] & 3));
|
||||
objCount++;
|
||||
}
|
||||
}
|
||||
|
@ -248,10 +248,10 @@ public class OsmandRenderer {
|
|||
BinaryMapDataObject obj = objects.get(ind);
|
||||
|
||||
// show text only for main type
|
||||
drawObj(obj, render, cv, rc, l, l == 0, false);
|
||||
drawObj(obj, render, cv, rc, l, l == 0, false, (keys[k] & 3));
|
||||
objCount++;
|
||||
}
|
||||
rc.lastRenderedKey = keys[k];
|
||||
rc.lastRenderedKey = (keys[k] >> 2);
|
||||
if (objCount > 25) {
|
||||
notifyListeners(notifyList);
|
||||
objCount = 0;
|
||||
|
@ -359,9 +359,9 @@ public class OsmandRenderer {
|
|||
render.setBooleanFilter(render.ALL.R_POINT, o.getPointsLength() == 1);
|
||||
render.setBooleanFilter(render.ALL.R_CYCLE, o.isCycle());
|
||||
if (render.search(RenderingRulesStorage.ORDER_RULES)) {
|
||||
o.setObjectType(render.getIntPropertyValue(render.ALL.R_OBJECT_TYPE));
|
||||
int objectType = render.getIntPropertyValue(render.ALL.R_OBJECT_TYPE);
|
||||
int order = render.getIntPropertyValue(render.ALL.R_ORDER);
|
||||
put(orderMap, order, sh + j, init);
|
||||
put(orderMap, (order << 2) | objectType, sh + j, init);
|
||||
if (render.isSpecified(render.ALL.R_SHADOW_LEVEL)) {
|
||||
rc.shadowLevelMin = Math.min(rc.shadowLevelMin, order);
|
||||
rc.shadowLevelMax = Math.max(rc.shadowLevelMax, order);
|
||||
|
@ -388,9 +388,8 @@ public class OsmandRenderer {
|
|||
}
|
||||
|
||||
protected void drawObj(BinaryMapDataObject obj, RenderingRuleSearchRequest render, Canvas canvas, RenderingContext rc, int l,
|
||||
boolean renderText, boolean drawOnlyShadow) {
|
||||
boolean renderText, boolean drawOnlyShadow, int type) {
|
||||
rc.allObjects++;
|
||||
int type = obj.getObjectType();
|
||||
TagValuePair pair = obj.getMapIndex().decodeType(obj.getTypes()[l]);
|
||||
if (type == MapRenderingTypes.POINT_TYPE && !drawOnlyShadow) {
|
||||
drawPoint(obj, render, canvas, rc, pair, renderText);
|
||||
|
|
|
@ -19,7 +19,6 @@ public:
|
|||
|
||||
std::vector<tag_value> types;
|
||||
std::vector<tag_value> additionalTypes;
|
||||
int objectType;
|
||||
coordinates points;
|
||||
std::vector < coordinates > polygonInnerCoordinates;
|
||||
|
||||
|
|
|
@ -438,9 +438,8 @@ void drawPoint(MapDataObject* mObj, RenderingRuleSearchRequest* req, SkCanvas* c
|
|||
}
|
||||
|
||||
void drawObject(RenderingContext* rc, MapDataObject* mObj, SkCanvas* cv, RenderingRuleSearchRequest* req,
|
||||
SkPaint* paint, int l, int renderText, int drawOnlyShadow) {
|
||||
SkPaint* paint, int l, int renderText, int drawOnlyShadow, int t) {
|
||||
rc->allObjects++;
|
||||
int t = mObj->objectType;
|
||||
tag_value pair = mObj->types.at(l);
|
||||
if (t == 1 && !drawOnlyShadow) {
|
||||
// point
|
||||
|
@ -514,9 +513,9 @@ HMAP::hash_map<int, std::vector<int> > sortObjectsByProperOrder(std::vector <Map
|
|||
req->setIntFilter(req->props()->R_POINT, mobj->points.size() == 1);
|
||||
req->setIntFilter(req->props()->R_CYCLE, mobj->cycle());
|
||||
if (req->searchRule(RenderingRulesStorage::ORDER_RULES)) {
|
||||
mobj->objectType = req->getIntPropertyValue(req->props()->R_OBJECT_TYPE);
|
||||
int objectType = req->getIntPropertyValue(req->props()->R_OBJECT_TYPE);
|
||||
int order = req->getIntPropertyValue(req->props()->R_ORDER);
|
||||
orderMap[order].push_back(sh + j);
|
||||
orderMap[(order << 2)|objectType].push_back(sh + j);
|
||||
if (req->getIntPropertyValue(req->props()->R_SHADOW_LEVEL) > 0) {
|
||||
rc->shadowLevelMin = std::min(rc->shadowLevelMin, order);
|
||||
rc->shadowLevelMax = std::max(rc->shadowLevelMax, order);
|
||||
|
@ -548,9 +547,9 @@ void doRendering(std::vector <MapDataObject* > mapDataObjects, SkCanvas* canvas,
|
|||
}
|
||||
bool shadowDrawn = false;
|
||||
for (std::set<int>::iterator ks = keys.begin(); ks != keys.end(); ks++) {
|
||||
if (!shadowDrawn && *ks >= rc->shadowLevelMin && *ks <= rc->shadowLevelMax && rc->getShadowRenderingMode() > 1) {
|
||||
if (!shadowDrawn && ((*ks)>>2) >= rc->shadowLevelMin && ((*ks)>>2) <= rc->shadowLevelMax && rc->getShadowRenderingMode() > 1) {
|
||||
for (std::set<int>::iterator ki = ks; ki != keys.end(); ki++) {
|
||||
if (*ki > rc->shadowLevelMax || rc->interrupted()) {
|
||||
if (((*ki)>>2) > rc->shadowLevelMax || rc->interrupted()) {
|
||||
break;
|
||||
}
|
||||
std::vector<int> list = orderMap[*ki];
|
||||
|
@ -562,7 +561,7 @@ void doRendering(std::vector <MapDataObject* > mapDataObjects, SkCanvas* canvas,
|
|||
|
||||
// show text only for main type
|
||||
|
||||
drawObject(rc, mapObject, canvas, req, paint, l, l == 0, true);
|
||||
drawObject(rc, mapObject, canvas, req, paint, l, l == 0, true, (*ki)&3);
|
||||
}
|
||||
}
|
||||
shadowDrawn = true;
|
||||
|
@ -576,9 +575,9 @@ void doRendering(std::vector <MapDataObject* > mapDataObjects, SkCanvas* canvas,
|
|||
|
||||
MapDataObject* mapObject = mapDataObjects.at(ind);
|
||||
// show text only for main type
|
||||
drawObject(rc, mapObject, canvas, req, paint, l, l == 0, false);
|
||||
drawObject(rc, mapObject, canvas, req, paint, l, l == 0, false, (*ks)&3);
|
||||
}
|
||||
rc->lastRenderedKey = *ks;
|
||||
rc->lastRenderedKey = (*ks) >>2;
|
||||
if (rc->interrupted()) {
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue