Remove output in MapView.

This commit is contained in:
Holt59 2018-03-03 00:41:55 +01:00
parent 6768374b92
commit 0622f9fa83

View File

@ -108,8 +108,8 @@ public class MapViewDrawing extends MapView implements Drawing {
public void moveTo(Point point) { public void moveTo(Point point) {
Marker marker = (Marker) this.layers[0]; Marker marker = (Marker) this.layers[0];
this.delete(); this.delete();
marker = new Marker(convertPoint(point), marker.getBitmap(), marker = new Marker(convertPoint(point), marker.getBitmap(), marker.getHorizontalOffset(),
marker.getHorizontalOffset(), marker.getVerticalOffset()); marker.getVerticalOffset());
this.layers[0] = marker; this.layers[0] = marker;
MapViewDrawing.this.getLayerManager().getLayers().add(marker); MapViewDrawing.this.getLayerManager().getLayers().add(marker);
} }
@ -203,15 +203,13 @@ public class MapViewDrawing extends MapView implements Drawing {
return new LatLong(point.getLatitude(), point.getLongitude()); return new LatLong(point.getLatitude(), point.getLongitude());
} }
private TileRendererLayer createTileRendererLayer(TileCache tileCache, private TileRendererLayer createTileRendererLayer(TileCache tileCache, MapDataStore mapDataStore,
MapDataStore mapDataStore, MapViewPosition mapViewPosition, MapViewPosition mapViewPosition, HillsRenderConfig hillsRenderConfig) {
HillsRenderConfig hillsRenderConfig) { TileRendererLayer tileRendererLayer = new TileRendererLayer(tileCache, mapDataStore, mapViewPosition, false,
TileRendererLayer tileRendererLayer = new TileRendererLayer(tileCache, mapDataStore, true, false, GRAPHIC_FACTORY, hillsRenderConfig) {
mapViewPosition, false, true, false, GRAPHIC_FACTORY, hillsRenderConfig) {
@Override @Override
public boolean onTap(LatLong tapLatLong, org.mapsforge.core.model.Point layerXY, public boolean onTap(LatLong tapLatLong, org.mapsforge.core.model.Point layerXY,
org.mapsforge.core.model.Point tapXY) { org.mapsforge.core.model.Point tapXY) {
System.out.println("Tap on: " + tapLatLong);
Point pt = new Point(tapLatLong.getLongitude(), tapLatLong.getLatitude()); Point pt = new Point(tapLatLong.getLongitude(), tapLatLong.getLatitude());
for (DrawingClickListener listener: MapViewDrawing.this.drawingClickListeners) { for (DrawingClickListener listener: MapViewDrawing.this.drawingClickListeners) {
listener.mouseClicked(pt); listener.mouseClicked(pt);
@ -264,8 +262,7 @@ public class MapViewDrawing extends MapView implements Drawing {
public void drawGraph(File file) { public void drawGraph(File file) {
// Tile cache // Tile cache
TileCache tileCache = AwtUtil.createTileCache(tileSize, TileCache tileCache = AwtUtil.createTileCache(tileSize, getModel().frameBufferModel.getOverdrawFactor(), 1024,
getModel().frameBufferModel.getOverdrawFactor(), 1024,
new File(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString())); new File(System.getProperty("java.io.tmpdir"), UUID.randomUUID().toString()));
// Layers // Layers
@ -278,12 +275,10 @@ public class MapViewDrawing extends MapView implements Drawing {
BoundingBox boundingBox = mapDataStore.boundingBox(); BoundingBox boundingBox = mapDataStore.boundingBox();
final Model model = getModel(); final Model model = getModel();
if (model.mapViewPosition.getZoomLevel() == 0 if (model.mapViewPosition.getZoomLevel() == 0 || !boundingBox.contains(model.mapViewPosition.getCenter())) {
|| !boundingBox.contains(model.mapViewPosition.getCenter())) { byte zoomLevel = LatLongUtils.zoomForBounds(model.mapViewDimension.getDimension(), boundingBox,
byte zoomLevel = LatLongUtils.zoomForBounds(model.mapViewDimension.getDimension(), model.displayModel.getTileSize());
boundingBox, model.displayModel.getTileSize()); model.mapViewPosition.setMapPosition(new MapPosition(boundingBox.getCenterPoint(), zoomLevel));
model.mapViewPosition
.setMapPosition(new MapPosition(boundingBox.getCenterPoint(), zoomLevel));
} }
} }
@ -306,8 +301,7 @@ public class MapViewDrawing extends MapView implements Drawing {
PathOverlay overlay = null; PathOverlay overlay = null;
if (markers) { if (markers) {
Marker origin = createMarker(path.getOrigin().getPoint(), DEFAULT_PATH_COLOR), Marker origin = createMarker(path.getOrigin().getPoint(), DEFAULT_PATH_COLOR),
destination = createMarker(path.getDestination().getPoint(), destination = createMarker(path.getDestination().getPoint(), DEFAULT_PATH_COLOR);
DEFAULT_PATH_COLOR);
overlay = new MapViewPathOverlay(line, origin, destination); overlay = new MapViewPathOverlay(line, origin, destination);
} }
else { else {