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)){
|
||||
encodingRules.put(tag, new LinkedHashMap<String, Integer>());
|
||||
}
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
<type tag="oneway" value="yes" minzoom="15" additional="true"/>
|
||||
<type tag="oneway" value="no" 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="1" minzoom="10" additional="true"/>
|
||||
|
|
|
@ -1101,9 +1101,15 @@
|
|||
<filter minzoom="17" maxzoom="17" strokeWidth="15" strokeWidth_2="13"/>
|
||||
<filter minzoom="18" strokeWidth="20" strokeWidth_2="18"/>
|
||||
<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 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>
|
||||
</filter>
|
||||
<filter>
|
||||
|
@ -1117,11 +1123,17 @@
|
|||
<filter minzoom="17" maxzoom="17" strokeWidth="13"/>
|
||||
<filter minzoom="18" strokeWidth="18"/>
|
||||
<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 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 additional="access=no" color_3="#F7D4D4" strokeWidth_3="5" pathEffect_3="10_2"/>
|
||||
<filter nightMode="true" color="#9F9F9F" color_2="#9F9F9F" />
|
||||
<filter/>
|
||||
<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>
|
||||
</filter>
|
||||
</groupFilter>
|
||||
|
|
|
@ -204,7 +204,7 @@ public class MapRenderRepositories {
|
|||
}
|
||||
|
||||
public boolean updateMapIsNeeded(RotatedTileBox box, DrawSettings drawSettings) {
|
||||
if (files.isEmpty() || box == null) {
|
||||
if (box == null) {
|
||||
return false;
|
||||
}
|
||||
if (requestedBox == null) {
|
||||
|
@ -305,11 +305,6 @@ public class MapRenderRepositories {
|
|||
|
||||
long now = System.currentTimeMillis();
|
||||
|
||||
if (files.isEmpty()) {
|
||||
cObjectsBox = dataBox;
|
||||
cObjects = new ArrayList<BinaryMapDataObject>();
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
System.gc(); // to clear previous objects
|
||||
int count = 0;
|
||||
|
@ -398,7 +393,8 @@ public class MapRenderRepositories {
|
|||
|
||||
String coastlineTime = "";
|
||||
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()) {
|
||||
long ms = System.currentTimeMillis();
|
||||
|
@ -420,14 +416,21 @@ public class MapRenderRepositories {
|
|||
o.setMapIndex(mi);
|
||||
tempResult.add(o);
|
||||
}
|
||||
if(emptyData && tempResult.size() > 0){
|
||||
if(emptyData || basemapMissing){
|
||||
// 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
|
||||
BinaryMapDataObject o = new BinaryMapDataObject(new int[] { leftX + (rightX - leftX) / 2, topY + (bottomY - topY) / 2 },
|
||||
new int[] { p.getMapIndex().coastlineEncodingType }, null, -1);
|
||||
o.setMapIndex(p.getMapIndex());
|
||||
o.putObjectName(o.getMapIndex().nameEncodingType, context.getString(R.string.switch_to_raster_map_to_see));
|
||||
new int[] { mapIndex.coastlineEncodingType }, null, -1);
|
||||
o.setMapIndex(mapIndex);
|
||||
o.putObjectName(mapIndex.nameEncodingType, context.getString(R.string.switch_to_raster_map_to_see));
|
||||
tempResult.add(o);
|
||||
}
|
||||
if(zoom <= BASEMAP_ZOOM || emptyData) {
|
||||
|
|
|
@ -193,19 +193,19 @@ public class OsmandRenderer {
|
|||
}
|
||||
|
||||
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();
|
||||
|
||||
// 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) {
|
||||
// init rendering context
|
||||
rc.tileDivisor = (int) (1 << (31 - rc.zoom));
|
||||
rc.cosRotateTileSize = FloatMath.cos((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
|
||||
TIntObjectHashMap<TIntArrayList> orderMap = sortObjectsByProperOrder(rc, objects, render);
|
||||
|
||||
|
@ -273,8 +273,6 @@ public class OsmandRenderer {
|
|||
log.info(rc.renderingDebugInfo);
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
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*> basemapCoastLines;
|
||||
|
||||
bool basemapExists = false;
|
||||
for (; i != openFiles.end() && !q->publisher->isCancelled(); i++) {
|
||||
BinaryMapFile* file = i->second;
|
||||
fseek(file->f, 0, 0);
|
||||
|
@ -732,6 +733,7 @@ ResultPublisher* searchObjectsForRendering(SearchQuery* q, bool skipDuplicates,
|
|||
if (q->publisher->isCancelled()) {
|
||||
break;
|
||||
}
|
||||
basemapExists |= file->isBasemap();
|
||||
if (mapLevel->minZoom <= q->zoom && mapLevel->maxZoom >= q->zoom) {
|
||||
if (mapLevel->right >= q->left && q->right >= mapLevel->left && mapLevel->bottom >= q->top
|
||||
&& q->bottom >= mapLevel->top) {
|
||||
|
@ -784,6 +786,7 @@ ResultPublisher* searchObjectsForRendering(SearchQuery* q, bool skipDuplicates,
|
|||
} else {
|
||||
bool addBasemapCoastlines = true;
|
||||
bool emptyData = q->zoom > BASEMAP_ZOOM && tempResult.empty() && coastLines.empty();
|
||||
bool basemapMissing = q->zoom <= BASEMAP_ZOOM && basemapCoastLines.empty() && !basemapExists;
|
||||
if (!coastLines.empty()) {
|
||||
bool coastlinesWereAdded = processCoastlines(coastLines, q->left, q->right, q->bottom, q->top, q->zoom,
|
||||
basemapCoastLines.empty(), true, tempResult);
|
||||
|
@ -812,7 +815,7 @@ ResultPublisher* searchObjectsForRendering(SearchQuery* q, bool skipDuplicates,
|
|||
}
|
||||
tempResult.push_back(o);
|
||||
}
|
||||
if (emptyData) {
|
||||
if (emptyData || basemapMissing) {
|
||||
// message
|
||||
// avoid overflow int errors
|
||||
MapDataObject* o = new MapDataObject();
|
||||
|
|
Loading…
Reference in a new issue