Adjust coastline for some areas

This commit is contained in:
Victor Shcherb 2012-09-07 11:38:37 +02:00
parent bf7c14a8e9
commit 5c986aa0f5
3 changed files with 12 additions and 10 deletions

View file

@ -316,6 +316,7 @@ public class MapRenderRepositories {
searchFilter = null;
}
boolean ocean = false;
boolean land = false;
MapIndex mi = null;
searchRequest = BinaryMapIndexReader.buildSearchRequest(leftX, rightX, topY, bottomY, zoom, searchFilter);
for (BinaryMapIndexReader c : files.values()) {
@ -353,8 +354,10 @@ public class MapRenderRepositories {
if (searchRequest.isOcean()) {
mi = c.getMapIndexes().get(0);
ocean = true;
} else if (searchRequest.isLand()) {
}
if (searchRequest.isLand()) {
mi = c.getMapIndexes().get(0);
land = true;
}
}
@ -379,7 +382,7 @@ public class MapRenderRepositories {
}
if(addBasemapCoastlines && mi != null){
BinaryMapDataObject o = new BinaryMapDataObject(new int[] { leftX, topY, rightX, topY, rightX, bottomY, leftX, bottomY, leftX,
topY }, new int[] { ocean ? mi.coastlineEncodingType : (mi.landEncodingType) }, null, -1);
topY }, new int[] { ocean && !land ? mi.coastlineEncodingType : (mi.landEncodingType) }, null, -1);
o.setMapIndex(mi);
tempResult.add(o);
}

View file

@ -744,7 +744,7 @@ bool searchMapTreeBounds(CodedInputStream* input, MapTreeBounds* current, MapTre
if(current->ocean){
req->ocean = true;
} else {
req->land = true;
req->mixed = true;
}
break;
}
@ -882,7 +882,6 @@ ResultPublisher* searchObjectsForRendering(SearchQuery* q, bool skipDuplicates,
map<std::string, BinaryMapFile*>::iterator i = openFiles.begin();
UNORDERED(set)<long long> ids;
int count = 0;
bool ocean = false;
std::vector<MapDataObject*> basemapResult;
std::vector<MapDataObject*> tempResult;
std::vector<MapDataObject*> coastLines;
@ -941,9 +940,7 @@ ResultPublisher* searchObjectsForRendering(SearchQuery* q, bool skipDuplicates,
}
}
}
if (q->ocean) {
ocean = true;
}
if (!q->publisher->isCancelled()) {
std::vector<MapDataObject*>::iterator r = q->publisher->result.begin();
tempResult.reserve((size_t)(q->publisher->result.size() + tempResult.size()));
@ -982,6 +979,8 @@ ResultPublisher* searchObjectsForRendering(SearchQuery* q, bool skipDuplicates,
deleteObjects(basemapCoastLines);
deleteObjects(basemapResult);
} else {
bool ocean = q->ocean;
bool land = q->mixed;
bool addBasemapCoastlines = true;
bool emptyData = q->zoom > BASEMAP_ZOOM && tempResult.empty() && coastLines.empty();
bool basemapMissing = q->zoom <= BASEMAP_ZOOM && basemapCoastLines.empty() && !basemapExists;
@ -1006,7 +1005,7 @@ ResultPublisher* searchObjectsForRendering(SearchQuery* q, bool skipDuplicates,
o->points.push_back(int_pair(q->right, q->bottom));
o->points.push_back(int_pair(q->left, q->bottom));
o->points.push_back(int_pair(q->left, q->top));
if (ocean) {
if (ocean && !land) {
o->types.push_back(tag_value("natural", "coastline"));
} else {
o->types.push_back(tag_value("natural", "land"));

View file

@ -221,7 +221,7 @@ struct SearchQuery {
coordinates cacheCoordinates;
bool ocean;
bool land;
bool mixed;
int numberOfVisitedObjects;
int numberOfAcceptedObjects;
@ -232,7 +232,7 @@ struct SearchQuery {
req(req), left(l), right(r), top(t), bottom(b),publisher(publisher) {
numberOfAcceptedObjects = numberOfVisitedObjects = 0;
numberOfAcceptedSubtrees = numberOfReadSubtrees = 0;
ocean = land = false;
ocean = mixed = false;
}
SearchQuery(int l, int r, int t, int b) :
req(req), left(l), right(r), top(t), bottom(b) {