implement rendering
git-svn-id: https://osmand.googlecode.com/svn/trunk@517 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
4556286177
commit
0ab77ae514
9 changed files with 55 additions and 38 deletions
|
@ -12,43 +12,31 @@ public class ToDoConstants {
|
|||
// ! 81. Add some objects to POI category (1) to add them into OSM 2) to help navigation)
|
||||
// highway (?), traffic_calming (?), barrier(?), military(?-), landuse (?), office(?), man_made(?), power(?),
|
||||
// railway( station, subway?) - issue 17
|
||||
// 86. Allow to add/edit custom tags to POI objects.
|
||||
// 87. Use network availability for defining loading tiles from internet.
|
||||
|
||||
// 89. Transport redesign UI (enable run from context menu, switch go to goal/not) !
|
||||
// ! 87. Use network availability for defining loading tiles from internet.
|
||||
// ! 89. Transport redesign UI (enable run from context menu, switch go to goal/not) !
|
||||
// ! 95. Show progress while map rendered and loaded
|
||||
// 86. Allow to add/edit custom tags to POI objects.
|
||||
|
||||
// outside base 0.4 release
|
||||
// 90. Use Junidecode library on the client for english translation (for map rendering and other save disk space)
|
||||
// 91. Invent binary format (minimize disk space, maximize speed)
|
||||
// 92. Replace poi index with standard map index and unify POI categories
|
||||
// 93. Implement multytype vector objects (?) - building with fence, road & tram ... (binary format)
|
||||
// 93. Implement multitype vector objects (?) - building with fence, road & tram ... (binary format)
|
||||
// 94. Revise index to decrease their size (especially address) - replace to float lat/lon
|
||||
|
||||
|
||||
// TODO small improvements for release :
|
||||
// 1. If select vector map, notice if there are no loaded maps.
|
||||
// 2. Fix bug with regenerating map when it is rotated
|
||||
// 3. Do not write for area last point as it is first poitn
|
||||
// 4. FIX park cheluskincev - forest
|
||||
// 5. FIX subway tunnel
|
||||
// +1. If select vector map, notice if there are no loaded maps.
|
||||
// +2. Fix bug with regenerating map when it is rotated (think about rotate)
|
||||
// +5. FIX subway tunnel
|
||||
|
||||
|
||||
// TODO Improvements :
|
||||
// 1! VELCOM
|
||||
// +2. rotate map gps without location
|
||||
// 4. recalculating route when location is far from ! (error) (reproduce?)
|
||||
// 5. keyboard (issue 43 )?
|
||||
// +6. Do not upload empty files (transport, poi... ).
|
||||
// +7. Implement auto-delete from site
|
||||
|
||||
// +13! Support multiple database for map rendering
|
||||
// 16. Internet access bits
|
||||
// 17. Implement multipolygons to polygons (!?) + coastline - (todo indexCreator)
|
||||
// 18. Fix loading map data in rotated mode (check properly boundaries)
|
||||
// +- 20. Add text to rendering (area, point, polyline) (BUILDINGS,
|
||||
// features_text.xml (+-), main_text.xml(+), layer-placenames.xml.inc(+)
|
||||
// 21. Shield, ref.
|
||||
// 22. Verify all POI has a point_type (in order to search them)
|
||||
|
||||
|
||||
// 19. colors for road trunk and motorway
|
||||
// 12. Fix : find proper location for streets ! centralize them (when create index)?
|
||||
|
||||
|
|
|
@ -95,7 +95,8 @@ public class MapRenderObject {
|
|||
} else if ((type & MapRenderingTypes.TYPE_MASK) == MapRenderingTypes.POLYLINE_TYPE) {
|
||||
// 10 - 68
|
||||
int layer = MapRenderingTypes.getWayLayer(type);
|
||||
if(layer == 1){
|
||||
if(layer == 1 && oType != MapRenderingTypes.RAILWAY){
|
||||
// not subway especially
|
||||
order = 10;
|
||||
} else if(layer == 2) {
|
||||
order = 67; // over buildings
|
||||
|
|
|
@ -401,12 +401,20 @@ public class MapRenderingTypes {
|
|||
attr <<= 2;
|
||||
String l = e.getTag(OSMTagKey.LAYER);
|
||||
if(l != null){
|
||||
int la = Integer.parseInt(l);
|
||||
if(l.startsWith("+")){
|
||||
l = l.substring(1);
|
||||
}
|
||||
int la = 0;
|
||||
try {
|
||||
la = Integer.parseInt(l);
|
||||
} catch (NumberFormatException es) {
|
||||
}
|
||||
if(la < 0){
|
||||
attr |= 1;
|
||||
} else if(la > 0){
|
||||
attr |= 2;
|
||||
}
|
||||
|
||||
} else if(e.getTag(OSMTagKey.BRIDGE) != null){
|
||||
attr |= 2;
|
||||
} else if(e.getTag(OSMTagKey.TUNNEL) != null){
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="no_vector_map_loaded">Векторные карты не загружены в приложение</string>
|
||||
<string name="gpx_reverse_route">Обратный путь</string>
|
||||
<string name="gpx_direct_route">Прямой путь</string>
|
||||
<string name="map_route_by_gpx">Навигация по GPX</string>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="no_vector_map_loaded">Vector maps were not loaded</string>
|
||||
<string name="gpx_reverse_route">Reverse route</string>
|
||||
<string name="gpx_direct_route">Direct route</string>
|
||||
<string name="map_route_by_gpx">Route using GPX</string>
|
||||
|
|
|
@ -37,6 +37,7 @@ import net.osmand.map.IMapLocationListener;
|
|||
import net.osmand.map.ITileSource;
|
||||
import net.osmand.osm.LatLon;
|
||||
import net.osmand.osm.MapUtils;
|
||||
import net.osmand.render.MapRenderRepositories;
|
||||
import net.osmand.render.RendererLayer;
|
||||
import net.osmand.views.AnimateDraggingMapThread;
|
||||
import net.osmand.views.ContextMenuLayer;
|
||||
|
@ -723,11 +724,18 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
|||
|
||||
private void updateMapSource(){
|
||||
boolean vectorData = OsmandSettings.isUsingMapVectorData(this);
|
||||
ResourceManager rm = ((OsmandApplication)getApplication()).getResourceManager();
|
||||
if(vectorData){
|
||||
if(rm.getRenderer().isEmpty()){
|
||||
Toast.makeText(MapActivity.this, getString(R.string.no_vector_map_loaded), Toast.LENGTH_LONG).show();
|
||||
vectorData = false;
|
||||
}
|
||||
}
|
||||
ITileSource newSource = OsmandSettings.getMapTileSource(this);
|
||||
if(mapView.getMap() instanceof SQLiteTileSource){
|
||||
((SQLiteTileSource)mapView.getMap()).closeDB();
|
||||
}
|
||||
((OsmandApplication)getApplication()).getResourceManager().updateMapSource(vectorData, newSource);
|
||||
rm.updateMapSource(vectorData, newSource);
|
||||
|
||||
mapView.setMap(vectorData ? null : newSource);
|
||||
rendererLayer.setVisible(vectorData);
|
||||
|
@ -1455,7 +1463,13 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
|||
public void onClick(DialogInterface dialog, int which) {
|
||||
Editor edit = OsmandSettings.getWriteableEditor(MapActivity.this);
|
||||
if(which == 0){
|
||||
edit.putBoolean(OsmandSettings.MAP_VECTOR_DATA, true);
|
||||
MapRenderRepositories r = ((OsmandApplication)getApplication()).getResourceManager().getRenderer();
|
||||
if(r.isEmpty()){
|
||||
Toast.makeText(MapActivity.this, getString(R.string.no_vector_map_loaded), Toast.LENGTH_LONG).show();
|
||||
return;
|
||||
} else {
|
||||
edit.putBoolean(OsmandSettings.MAP_VECTOR_DATA, true);
|
||||
}
|
||||
} else {
|
||||
edit.putBoolean(OsmandSettings.MAP_VECTOR_DATA, false);
|
||||
edit.putString(OsmandSettings.MAP_TILE_SOURCES, keys.get(which - 1));
|
||||
|
|
|
@ -207,10 +207,15 @@ public class MapRenderRepositories {
|
|||
rotate += 360;
|
||||
}
|
||||
|
||||
return !inside || Math.abs(rotate - cRotate) > 30;
|
||||
return !inside || Math.abs(rotate - cRotate) > 15; // leave only 15 to find that UI box out of searched
|
||||
|
||||
}
|
||||
|
||||
public boolean isEmpty(){
|
||||
return connections.isEmpty();
|
||||
}
|
||||
|
||||
// MapUtils.getLatitudeFromTile(17, topY)
|
||||
private boolean insideBox(double topY, double leftX, double bottomY, double rightX, int zoom) {
|
||||
boolean inside = cZoom == zoom && cTopY <= topY && cLeftX <= leftX && cRightX >= rightX
|
||||
&& cBottomY >= bottomY;
|
||||
|
|
|
@ -469,7 +469,7 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
|
|||
|
||||
if (rc.textSize > 0 && name != null) {
|
||||
TextDrawInfo info = new TextDrawInfo(name);
|
||||
|
||||
info.fillProperties(rc, center.x, center.y);
|
||||
rc.textToDraw.add(info);
|
||||
}
|
||||
}
|
||||
|
@ -1163,9 +1163,9 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
|
|||
if(zoom >= 16){
|
||||
textColor = 0xff444444;
|
||||
textSize = 9;
|
||||
if(textSize >= 17){
|
||||
if(zoom >= 17){
|
||||
textSize = 11;
|
||||
if(textSize >= 18){
|
||||
if(zoom >= 18){
|
||||
textSize = 15;
|
||||
}
|
||||
}
|
||||
|
@ -1196,7 +1196,7 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
|
|||
shadowRadius = 1;
|
||||
textSize = 9;
|
||||
textColor = Color.BLACK;
|
||||
dy = 9;
|
||||
dy = 14;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1218,7 +1218,7 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
|
|||
if (zoom >= 17) {
|
||||
textColor = 0xff993399;
|
||||
textSize = 8;
|
||||
dy = 11;
|
||||
dy = 13;
|
||||
shadowRadius = 1;
|
||||
wrapWidth = 14;
|
||||
}
|
||||
|
@ -1226,7 +1226,7 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
|
|||
if (zoom >= 16) {
|
||||
textSize = 9;
|
||||
textColor = 0xff993399;
|
||||
dy = 12;
|
||||
dy = 13;
|
||||
shadowRadius = 1;
|
||||
wrapWidth = 20;
|
||||
}
|
||||
|
@ -1239,7 +1239,7 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
|
|||
if (zoom >= 16) {
|
||||
textSize = 8;
|
||||
textColor = 0xffda0092;
|
||||
dy = 10;
|
||||
dy = 12;
|
||||
shadowRadius = 2;
|
||||
wrapWidth = 24;
|
||||
}
|
||||
|
@ -1247,7 +1247,7 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
|
|||
if (zoom >= 17) {
|
||||
textSize = 8;
|
||||
textColor = 0xffda0092;
|
||||
dy = 9;
|
||||
dy = 11;
|
||||
shadowRadius = 1;
|
||||
wrapWidth = 12;
|
||||
}
|
||||
|
@ -1309,13 +1309,13 @@ public class OsmandRenderer implements Comparator<MapRenderObject> {
|
|||
shadowRadius = 1;
|
||||
textColor = 0xff734a08;
|
||||
wrapWidth = 34;
|
||||
dy = 11;
|
||||
dy = 13;
|
||||
textSize = 10;
|
||||
} else if (subType >= 4 && subType <= 6) {
|
||||
shadowRadius = 1;
|
||||
textColor = 0xff734a08;
|
||||
wrapWidth = 34;
|
||||
dy = 11;
|
||||
dy = 13;
|
||||
textSize = 10;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,6 @@ public class RendererLayer implements OsmandMapLayer {
|
|||
pixRect.set(0, 0, view.getWidth(), view.getHeight());
|
||||
view.calculateTileRectangle(pixRect, view.getCenterPointX(),
|
||||
view.getCenterPointY(), view.getXTile(), view.getYTile(), tileRect);
|
||||
|
||||
if (view.getFloatZoom() == view.getZoom()
|
||||
&& resourceManager.updateRenderedMapNeeded(tileRect, view.getZoom(), view.getRotate())) {
|
||||
pixRect.set(-view.getWidth(), -view.getHeight()/2, 2*view.getWidth(), 3*view.getHeight()/2);
|
||||
|
|
Loading…
Reference in a new issue