Add missing map message
This commit is contained in:
parent
15f307a155
commit
d7a9b434c4
6 changed files with 48 additions and 29 deletions
|
@ -1387,7 +1387,7 @@ public class BinaryMapIndexReader {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initMapEncodingRule(int type, int id, String tag, String val) {
|
public void initMapEncodingRule(int type, int id, String tag, String val) {
|
||||||
if(!encodingRules.containsKey(tag)){
|
if(!encodingRules.containsKey(tag)){
|
||||||
encodingRules.put(tag, new LinkedHashMap<String, Integer>());
|
encodingRules.put(tag, new LinkedHashMap<String, Integer>());
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
<type tag="oneway" value="yes" minzoom="15" additional="true"/>
|
<type tag="oneway" value="yes" minzoom="15" additional="true"/>
|
||||||
<type tag="oneway" value="no" minzoom="15" additional="true"/>
|
<type tag="oneway" value="no" minzoom="15" additional="true"/>
|
||||||
<type tag="oneway" value="-1" minzoom="15" additional="true"/>
|
<type tag="oneway" value="-1" minzoom="15" additional="true"/>
|
||||||
|
<type tag="access" value="no" minzoom="15" additional="true"/>
|
||||||
|
<type tag="access" value="private" minzoom="15" additional="true"/>
|
||||||
|
<type tag="access" value="yes" minzoom="15" additional="true"/>
|
||||||
|
|
||||||
<type tag="layer" value="0" minzoom="10" additional="true"/>
|
<type tag="layer" value="0" minzoom="10" additional="true"/>
|
||||||
<type tag="layer" value="1" minzoom="10" additional="true"/>
|
<type tag="layer" value="1" minzoom="10" additional="true"/>
|
||||||
|
|
|
@ -1101,9 +1101,15 @@
|
||||||
<filter minzoom="17" maxzoom="17" strokeWidth="15" strokeWidth_2="13"/>
|
<filter minzoom="17" maxzoom="17" strokeWidth="15" strokeWidth_2="13"/>
|
||||||
<filter minzoom="18" strokeWidth="20" strokeWidth_2="18"/>
|
<filter minzoom="18" strokeWidth="20" strokeWidth_2="18"/>
|
||||||
<groupFilter>
|
<groupFilter>
|
||||||
<filter additional="access=no" nightMode="true" color="#ffffff" color_2="#9F9F9F" color_3="#F7D4D4" strokeWidth_3="5" pathEffect_3="10_2"/>
|
|
||||||
<filter nightMode="true" color="#ffffff" color_2="#9F9F9F"/>
|
<filter nightMode="true" color="#ffffff" color_2="#9F9F9F"/>
|
||||||
<filter additional="access=no" color_3="#F7D4D4" strokeWidth_3="5" pathEffect_3="10_2"/>
|
<filter/>
|
||||||
|
<groupFilter>
|
||||||
|
<filter additional="access=no" />
|
||||||
|
<filter additional="access=private" />
|
||||||
|
<groupFilter>
|
||||||
|
<filter color_3="#F7D4D4" strokeWidth_3="5" pathEffect_3="10_2"/>
|
||||||
|
</groupFilter>
|
||||||
|
</groupFilter>
|
||||||
</groupFilter>
|
</groupFilter>
|
||||||
</filter>
|
</filter>
|
||||||
<filter>
|
<filter>
|
||||||
|
@ -1117,11 +1123,17 @@
|
||||||
<filter minzoom="17" maxzoom="17" strokeWidth="13"/>
|
<filter minzoom="17" maxzoom="17" strokeWidth="13"/>
|
||||||
<filter minzoom="18" strokeWidth="18"/>
|
<filter minzoom="18" strokeWidth="18"/>
|
||||||
<groupFilter>
|
<groupFilter>
|
||||||
<filter layer="-1" nightMode="true" color="#9F9F9F" color_2="#9F9F9F" pathEffect="4_4" cap="BUTT"/>
|
<!-- <filter layer="-1" nightMode="true" color="#9F9F9F" color_2="#9F9F9F" pathEffect="4_4" cap="BUTT"/>
|
||||||
<filter layer="-1" pathEffect="4_4" cap="BUTT"/>
|
<filter layer="-1" pathEffect="4_4" cap="BUTT"/>
|
||||||
<filter additional="access=no" nightMode="true" color="#9F9F9F" color_2="#9F9F9F" color_3="#F7D4D4" strokeWidth_3="5" pathEffect_3="10_2"/>
|
<filter nightMode="true" color="#9F9F9F" color_2="#9F9F9F" />
|
||||||
<filter nightMode="true" color="#9F9F9F" color_2="#9F9F9F"/>
|
<filter/>
|
||||||
<filter additional="access=no" color_3="#F7D4D4" strokeWidth_3="5" pathEffect_3="10_2"/>
|
<groupFilter> -->
|
||||||
|
<filter additional="access=no" color_3="#F7D4D4" strokeWidth_3="5" pathEffect_3="10_2"/>
|
||||||
|
<filter additional="access=private" color_3="#F7D4D4" strokeWidth_3="5" pathEffect_3="10_2"/>
|
||||||
|
<groupFilter>
|
||||||
|
<filter color_3="#F7D4D4" strokeWidth_3="5" pathEffect_3="10_2"/>
|
||||||
|
</groupFilter>
|
||||||
|
<!-- </groupFilter> -->
|
||||||
</groupFilter>
|
</groupFilter>
|
||||||
</filter>
|
</filter>
|
||||||
</groupFilter>
|
</groupFilter>
|
||||||
|
|
|
@ -204,7 +204,7 @@ public class MapRenderRepositories {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean updateMapIsNeeded(RotatedTileBox box, DrawSettings drawSettings) {
|
public boolean updateMapIsNeeded(RotatedTileBox box, DrawSettings drawSettings) {
|
||||||
if (files.isEmpty() || box == null) {
|
if (box == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (requestedBox == null) {
|
if (requestedBox == null) {
|
||||||
|
@ -305,11 +305,6 @@ public class MapRenderRepositories {
|
||||||
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
|
|
||||||
if (files.isEmpty()) {
|
|
||||||
cObjectsBox = dataBox;
|
|
||||||
cObjects = new ArrayList<BinaryMapDataObject>();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
try {
|
try {
|
||||||
System.gc(); // to clear previous objects
|
System.gc(); // to clear previous objects
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
@ -398,7 +393,8 @@ public class MapRenderRepositories {
|
||||||
|
|
||||||
String coastlineTime = "";
|
String coastlineTime = "";
|
||||||
boolean addBasemapCoastlines = true;
|
boolean addBasemapCoastlines = true;
|
||||||
boolean emptyData = zoom > BASEMAP_ZOOM && tempResult.isEmpty() && coastLines.isEmpty() ;
|
boolean emptyData = zoom > BASEMAP_ZOOM && tempResult.isEmpty() && coastLines.isEmpty();
|
||||||
|
boolean basemapMissing = zoom <= BASEMAP_ZOOM && basemapCoastLines.isEmpty() && mi == null;
|
||||||
|
|
||||||
if(!coastLines.isEmpty()) {
|
if(!coastLines.isEmpty()) {
|
||||||
long ms = System.currentTimeMillis();
|
long ms = System.currentTimeMillis();
|
||||||
|
@ -420,14 +416,21 @@ public class MapRenderRepositories {
|
||||||
o.setMapIndex(mi);
|
o.setMapIndex(mi);
|
||||||
tempResult.add(o);
|
tempResult.add(o);
|
||||||
}
|
}
|
||||||
if(emptyData && tempResult.size() > 0){
|
if(emptyData || basemapMissing){
|
||||||
// message
|
// message
|
||||||
BinaryMapDataObject p = tempResult.get(0);
|
MapIndex mapIndex;
|
||||||
|
if(!tempResult.isEmpty()) {
|
||||||
|
mapIndex = tempResult.get(0).getMapIndex();
|
||||||
|
} else {
|
||||||
|
mapIndex = new MapIndex();
|
||||||
|
mapIndex.initMapEncodingRule(0, 1, "natural", "coastline");
|
||||||
|
mapIndex.initMapEncodingRule(0, 2, "name", "");
|
||||||
|
}
|
||||||
// avoid overflow int errors
|
// avoid overflow int errors
|
||||||
BinaryMapDataObject o = new BinaryMapDataObject(new int[] { leftX + (rightX - leftX) / 2, topY + (bottomY - topY) / 2 },
|
BinaryMapDataObject o = new BinaryMapDataObject(new int[] { leftX + (rightX - leftX) / 2, topY + (bottomY - topY) / 2 },
|
||||||
new int[] { p.getMapIndex().coastlineEncodingType }, null, -1);
|
new int[] { mapIndex.coastlineEncodingType }, null, -1);
|
||||||
o.setMapIndex(p.getMapIndex());
|
o.setMapIndex(mapIndex);
|
||||||
o.putObjectName(o.getMapIndex().nameEncodingType, context.getString(R.string.switch_to_raster_map_to_see));
|
o.putObjectName(mapIndex.nameEncodingType, context.getString(R.string.switch_to_raster_map_to_see));
|
||||||
tempResult.add(o);
|
tempResult.add(o);
|
||||||
}
|
}
|
||||||
if(zoom <= BASEMAP_ZOOM || emptyData) {
|
if(zoom <= BASEMAP_ZOOM || emptyData) {
|
||||||
|
|
|
@ -193,19 +193,19 @@ public class OsmandRenderer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void generateNewBitmap(RenderingContext rc, List<BinaryMapDataObject> objects, Bitmap bmp,
|
public void generateNewBitmap(RenderingContext rc, List<BinaryMapDataObject> objects, Bitmap bmp,
|
||||||
RenderingRuleSearchRequest render, final List<IMapDownloaderCallback> notifyList) {
|
RenderingRuleSearchRequest render, final List<IMapDownloaderCallback> notifyList) {
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
|
// fill area
|
||||||
|
Canvas cv = new Canvas(bmp);
|
||||||
|
if (rc.defaultColor != 0) {
|
||||||
|
cv.drawColor(rc.defaultColor);
|
||||||
|
}
|
||||||
if (objects != null && !objects.isEmpty() && rc.width > 0 && rc.height > 0) {
|
if (objects != null && !objects.isEmpty() && rc.width > 0 && rc.height > 0) {
|
||||||
// init rendering context
|
// init rendering context
|
||||||
rc.tileDivisor = (int) (1 << (31 - rc.zoom));
|
rc.tileDivisor = (int) (1 << (31 - rc.zoom));
|
||||||
rc.cosRotateTileSize = FloatMath.cos((float) Math.toRadians(rc.rotate)) * TILE_SIZE;
|
rc.cosRotateTileSize = FloatMath.cos((float) Math.toRadians(rc.rotate)) * TILE_SIZE;
|
||||||
rc.sinRotateTileSize = FloatMath.sin((float) Math.toRadians(rc.rotate)) * TILE_SIZE;
|
rc.sinRotateTileSize = FloatMath.sin((float) Math.toRadians(rc.rotate)) * TILE_SIZE;
|
||||||
// fill area
|
|
||||||
Canvas cv = new Canvas(bmp);
|
|
||||||
if (rc.defaultColor != 0) {
|
|
||||||
cv.drawColor(rc.defaultColor);
|
|
||||||
}
|
|
||||||
// put in order map
|
// put in order map
|
||||||
TIntObjectHashMap<TIntArrayList> orderMap = sortObjectsByProperOrder(rc, objects, render);
|
TIntObjectHashMap<TIntArrayList> orderMap = sortObjectsByProperOrder(rc, objects, render);
|
||||||
|
|
||||||
|
@ -273,8 +273,6 @@ public class OsmandRenderer {
|
||||||
log.info(rc.renderingDebugInfo);
|
log.info(rc.renderingDebugInfo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void notifyListenersWithDelay(final RenderingContext rc, final List<IMapDownloaderCallback> notifyList, final Handler h) {
|
private void notifyListenersWithDelay(final RenderingContext rc, final List<IMapDownloaderCallback> notifyList, final Handler h) {
|
||||||
|
|
|
@ -714,6 +714,7 @@ ResultPublisher* searchObjectsForRendering(SearchQuery* q, bool skipDuplicates,
|
||||||
std::vector<MapDataObject*> coastLines;
|
std::vector<MapDataObject*> coastLines;
|
||||||
std::vector<MapDataObject*> basemapCoastLines;
|
std::vector<MapDataObject*> basemapCoastLines;
|
||||||
|
|
||||||
|
bool basemapExists = false;
|
||||||
for (; i != openFiles.end() && !q->publisher->isCancelled(); i++) {
|
for (; i != openFiles.end() && !q->publisher->isCancelled(); i++) {
|
||||||
BinaryMapFile* file = i->second;
|
BinaryMapFile* file = i->second;
|
||||||
fseek(file->f, 0, 0);
|
fseek(file->f, 0, 0);
|
||||||
|
@ -732,6 +733,7 @@ ResultPublisher* searchObjectsForRendering(SearchQuery* q, bool skipDuplicates,
|
||||||
if (q->publisher->isCancelled()) {
|
if (q->publisher->isCancelled()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
basemapExists |= file->isBasemap();
|
||||||
if (mapLevel->minZoom <= q->zoom && mapLevel->maxZoom >= q->zoom) {
|
if (mapLevel->minZoom <= q->zoom && mapLevel->maxZoom >= q->zoom) {
|
||||||
if (mapLevel->right >= q->left && q->right >= mapLevel->left && mapLevel->bottom >= q->top
|
if (mapLevel->right >= q->left && q->right >= mapLevel->left && mapLevel->bottom >= q->top
|
||||||
&& q->bottom >= mapLevel->top) {
|
&& q->bottom >= mapLevel->top) {
|
||||||
|
@ -784,6 +786,7 @@ ResultPublisher* searchObjectsForRendering(SearchQuery* q, bool skipDuplicates,
|
||||||
} else {
|
} else {
|
||||||
bool addBasemapCoastlines = true;
|
bool addBasemapCoastlines = true;
|
||||||
bool emptyData = q->zoom > BASEMAP_ZOOM && tempResult.empty() && coastLines.empty();
|
bool emptyData = q->zoom > BASEMAP_ZOOM && tempResult.empty() && coastLines.empty();
|
||||||
|
bool basemapMissing = q->zoom <= BASEMAP_ZOOM && basemapCoastLines.empty() && !basemapExists;
|
||||||
if (!coastLines.empty()) {
|
if (!coastLines.empty()) {
|
||||||
bool coastlinesWereAdded = processCoastlines(coastLines, q->left, q->right, q->bottom, q->top, q->zoom,
|
bool coastlinesWereAdded = processCoastlines(coastLines, q->left, q->right, q->bottom, q->top, q->zoom,
|
||||||
basemapCoastLines.empty(), true, tempResult);
|
basemapCoastLines.empty(), true, tempResult);
|
||||||
|
@ -812,7 +815,7 @@ ResultPublisher* searchObjectsForRendering(SearchQuery* q, bool skipDuplicates,
|
||||||
}
|
}
|
||||||
tempResult.push_back(o);
|
tempResult.push_back(o);
|
||||||
}
|
}
|
||||||
if (emptyData) {
|
if (emptyData || basemapMissing) {
|
||||||
// message
|
// message
|
||||||
// avoid overflow int errors
|
// avoid overflow int errors
|
||||||
MapDataObject* o = new MapDataObject();
|
MapDataObject* o = new MapDataObject();
|
||||||
|
|
Loading…
Reference in a new issue