refactor: rename MapView -> Map, MapViewPosition -> Viewport

This commit is contained in:
Hannes Janetzek
2013-09-03 04:17:49 +02:00
parent 07db32f394
commit 870363bf2f
39 changed files with 560 additions and 442 deletions

View File

@@ -81,10 +81,10 @@ class GwtGdxMap extends GdxMap {
p.angle = rotation;
p.tilt = tilt;
mMapView.setMapPosition(p);
mMap.setMapPosition(p);
//mMapView.getMapViewPosition().setTilt(tilt);
//mMapView.getMapViewPosition().setRotation(rotation);
//mMap.getViewport().setTilt(tilt);
//mMap.getViewport().setRotation(rotation);
String url = c.getTileUrl();
String sourceName = c.getTileSource();
@@ -101,9 +101,9 @@ class GwtGdxMap extends GdxMap {
initDefaultMap(tileSource, false, true, true);
if ("naturalearth".equals(c.getBackgroundLayer()))
mMapView.setBackgroundMap(new BitmapTileLayer(mMapView, NaturalEarth.INSTANCE));
mMap.setBackgroundMap(new BitmapTileLayer(mMap, NaturalEarth.INSTANCE));
mSearchBox = new SearchBox(mMapView);
mSearchBox = new SearchBox(mMap);
// update URL hash to current position, every 5 seconds
Timer timer = new Timer() {
@@ -111,7 +111,7 @@ class GwtGdxMap extends GdxMap {
private MapPosition pos = new MapPosition();
public void run() {
mMapView.getMapViewPosition().getMapPosition(pos);
mMap.getViewport().getMapPosition(pos);
int lat = (int) (MercatorProjection.toLatitude(pos.y) * 1000);
int lon = (int) (MercatorProjection.toLongitude(pos.x) * 1000);
int rot = (int) (pos.angle);

View File

@@ -8,7 +8,7 @@ import org.oscim.core.BoundingBox;
import org.oscim.core.GeometryBuffer;
import org.oscim.core.MapPosition;
import org.oscim.layers.overlay.PathOverlay;
import org.oscim.view.MapView;
import org.oscim.view.Map;
import com.google.gwt.cell.client.AbstractCell;
import com.google.gwt.core.client.JavaScriptObject;
@@ -181,12 +181,12 @@ public class SearchBox {
}
}
public SearchBox(final MapView mapView) {
public SearchBox(final Map map) {
final Button searchButton = new Button("Search");
final TextBox searchField = new TextBox();
//searchField.setText("Bremen");
final PathOverlay mOverlay = new PathOverlay(mapView, 0xCC0000FF);
mapView.getLayerManager().add(mOverlay);
final PathOverlay mOverlay = new PathOverlay(map, 0xCC0000FF);
map.getLayerManager().add(mOverlay);
// We can add style names to widgets
searchButton.addStyleName("sendButton");
@@ -237,9 +237,9 @@ public class SearchBox {
if (b.maxLatitudeE6 - b.minLatitudeE6 < 100 &&
b.maxLongitudeE6 - b.minLongitudeE6 < 100)
// for small bbox use zoom=16 to get an overview
mapView.getMapViewPosition().animateTo(500, b.getCenterPoint(), 1 << 16, false);
map.getViewport().animateTo(500, b.getCenterPoint(), 1 << 16, false);
else
mapView.getMapViewPosition().animateTo(b);
map.getViewport().animateTo(b);
if (d instanceof NominatimData && ((NominatimData) d).getWkt() != null) {
String wkt = ((NominatimData) d).getWkt();
@@ -261,7 +261,7 @@ public class SearchBox {
mOverlay.addPoint(b.maxLatitudeE6, b.minLongitudeE6);
}
// hide overlay after 5 seconds
mapView.postDelayed(new Runnable() {
map.postDelayed(new Runnable() {
@Override
public void run() {
mOverlay.clearPath();
@@ -270,13 +270,13 @@ public class SearchBox {
} else {
MapPosition pos = new MapPosition();
mapView.getMapViewPosition().setTilt(0);
mapView.getMapViewPosition().setRotation(0);
map.getViewport().setTilt(0);
map.getViewport().setRotation(0);
pos.setZoomLevel(13);
pos.setPosition(d.getLatitude(), d.getLongitude());
mapView.setMapPosition(pos);
mapView.updateMap(true);
map.setMapPosition(pos);
map.updateMap(true);
}
scroller.setVisible(false);

View File

@@ -28,7 +28,7 @@ import org.oscim.layers.tile.bitmap.TileSource.FadeStep;
import org.oscim.renderer.sublayers.BitmapLayer;
import org.oscim.renderer.sublayers.Layers;
import org.oscim.utils.FastMath;
import org.oscim.view.MapView;
import org.oscim.view.Map;
import com.google.gwt.event.dom.client.ErrorEvent;
import com.google.gwt.event.dom.client.ErrorHandler;
@@ -42,8 +42,8 @@ public class BitmapTileLayer extends TileLayer<TileLoader> {
final TileSource mTileSource;
private final FadeStep[] mFade;
public BitmapTileLayer(MapView mapView, TileSource tileSource) {
super(mapView, tileSource.getZoomLevelMin(), tileSource.getZoomLevelMax(), 100);
public BitmapTileLayer(Map map, TileSource tileSource) {
super(map, tileSource.getZoomLevelMin(), tileSource.getZoomLevelMax(), 100);
mTileSource = tileSource;
mFade = mTileSource.getFadeSteps();
}