@Override protected void createLayers() { TileStoreLayer tileStoreLayer = new TileStoreLayer(this.tileCaches.get(0), this.mapView.getModel().mapViewPosition, AndroidGraphicFactory.INSTANCE, false); mapView.getLayerManager().getLayers().add(tileStoreLayer); }
@Override public void onDestroy() { if (this.mapView != null) { this.mapView.destroyAll(); } super.onDestroy(); }
/** * Template method to create the map views. */ protected void createMapViews() { mapView = getMapView(); mapView.getModel().init(this.preferencesFacade); mapView.setClickable(true); mapView.getMapScaleBar().setVisible(true); mapView.setBuiltInZoomControls(hasZoomControls()); mapView.getMapZoomControls().setAutoHide(isZoomControlsAutoHide()); mapView.getMapZoomControls().setZoomLevelMin(getZoomLevelMin()); mapView.getMapZoomControls().setZoomLevelMax(getZoomLevelMax()); }
@Override public void onClick(View view) { mapView.onZoomEvent(); MapZoomControls.this.mapView.getModel().mapViewPosition.zoomIn(); } });
@Override public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) { if (!this.isInScale && e1.getPointerCount() == 1 && e2.getPointerCount() == 1) { this.mapView.onMoveEvent(); this.mapView.getModel().mapViewPosition.moveCenter(-distanceX, -distanceY, false); return true; } return false; }
@Override protected void createMapViews() { super.createMapViews(); // any position change in one view will be reflected in the other this.observer1 = new MapViewPositionObserver( this.mapView.getModel().mapViewPosition, this.mapView2.getModel().mapViewPosition); this.observer2 = new MapViewPositionObserver( this.mapView2.getModel().mapViewPosition, this.mapView.getModel().mapViewPosition); }
mapView = new MapView(this); setContentView(mapView); mapView.setClickable(true); mapView.getMapScaleBar().setVisible(true); mapView.setBuiltInZoomControls(true); mapView.getModel().displayModel.getTileSize(), 1f, mapView.getModel().frameBufferModel.getOverdrawFactor()); MapDataStore mapDataStore = new MapFile(mapFile); TileRendererLayer tileRendererLayer = new TileRendererLayer(tileCache, mapDataStore, mapView.getModel().mapViewPosition, AndroidGraphicFactory.INSTANCE); tileRendererLayer.setXmlRenderTheme(InternalRenderTheme.DEFAULT); mapView.getLayerManager().getLayers().add(tileRendererLayer); mapView.setCenter(new LatLong(52.517037, 13.38886)); mapView.setZoomLevel((byte) 12); } catch (Exception e) {
/** * */ private void proceedAfterHeatmapCompleted() { if (pointsLoaded && layoutInflated && !updatePending) { updatePending = true; clearLayer(); final BoundingBox bbox = MapPositionUtil.getBoundingBox( mMapView.getModel().mapViewPosition.getMapPosition(), mMapView.getDimension(), mMapView.getModel().displayModel.getTileSize()); target = mMapView.getModel().mapViewPosition.getCenter(); zoomAtTrigger = mMapView.getModel().mapViewPosition.getZoomLevel(); heatmapLayer = new Marker(target, null, 0, 0); mMapView.getLayerManager().getLayers().add(heatmapLayer); builder = new HeatmapBuilder( WifiDetailsMap.this, mMapView.getWidth(), mMapView.getHeight(), bbox, mMapView.getModel().mapViewPosition.getZoomLevel(), mMapView.getModel().displayModel.getScaleFactor(), mMapView.getModel().displayModel.getTileSize(), RADIUS).execute(points); } else { Log.i(TAG, "Another heat-map is currently generated. Skipped"); } }
mPreferencesFacade = new AndroidPreferences(sharedPreferences); mMapView.getModel().init(mPreferencesFacade); mMapView.setClickable(true); mMapView.getMapScaleBar().setVisible(true); if (mMapView.getModel().mapViewPosition.getZoomLevel() < (byte) 10 || mMapView.getModel().mapViewPosition.getZoomLevel() > (byte) 18) { Log.i(TAG, "Reseting zoom level"); mMapView.getModel().mapViewPosition.setZoomLevel((byte) 15); mMapView.getLayerManager().getLayers().clear(); addOfflineLayer(); } else if (MapUtils.useOnlineMaps(this.getActivity())) { mMapView.getModel().mapViewPosition.addObserver(mMapObserver);
this.mTileCache = MapUtils.createTileCache(this.getActivity().getApplicationContext(), mMapView.getModel().displayModel.getTileSize(), this.mMapView.getModel().frameBufferModel.getOverdrawFactor()); final ViewTreeObserver vto = mMapView.getViewTreeObserver(); vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() { this.mMapView.getModel().mapViewPosition.addObserver(mMapObserver); this.mMapView.setClickable(true); this.mMapView.getMapScaleBar().setVisible(true); this.mMapView.getModel().mapViewPosition.setZoomLevel((byte) 16);
@Override protected void createLayers() { this.downloadLayer = new TileDownloadLayer(this.tileCaches.get(0), this.mapView.getModel().mapViewPosition, OpenStreetMapMapnik.INSTANCE, AndroidGraphicFactory.INSTANCE); mapView.getLayerManager().getLayers().add(this.downloadLayer); mapView.setZoomLevelMin(OpenStreetMapMapnik.INSTANCE.getZoomLevelMin()); mapView.setZoomLevelMax(OpenStreetMapMapnik.INSTANCE.getZoomLevelMax()); }
void changeTileSize() { Integer[] tileSizes = {256, 120, 0, 120}; if (tileSizes.length > 0) { iteration += 1; // destroy and recreate the tile caches so that old storage is // freed and a new tile cache is created based on the new tile size mapView.getLayerManager().getLayers().remove(tileRendererLayer); tileRendererLayer.onDestroy(); purgeTileCaches(); int tileSize = tileSizes[iteration % tileSizes.length]; this.mapView.getModel().displayModel.setFixedTileSize(tileSize); createTileCaches(); createLayers(); this.mapView.getMapScaleBar().redrawScaleBar(); this.mapView.getLayerManager().redrawLayers(); } }
protected void createLayers() { TileCache tileCache = AndroidUtil.createTileCache(this.getActivity(), "fragments", this.mapView.getModel().displayModel.getTileSize(), 1.0f, 1.5); this.mapView.getLayerManager().getLayers().add(AndroidUtil.createTileRendererLayer( tileCache, this.mapView.getModel().mapViewPosition, getMapFile(), InternalRenderTheme.DEFAULT)); this.mapView.setCenter(this.dummyItem.location); this.mapView.setZoomLevel((byte) 16); }
protected void redrawLayers() { mapView.getLayerManager().redrawLayers(); }
@Override protected void createLayers() { super.createLayers(); // Add a grid layer and a layer showing tile coordinates mapView.getLayerManager().getLayers().add(new TileGridLayer(AndroidGraphicFactory.INSTANCE, this.mapView.getModel().displayModel)); TileCoordinatesLayer tileCoordinatesLayer = new TileCoordinatesLayer(AndroidGraphicFactory.INSTANCE, this.mapView.getModel().displayModel); tileCoordinatesLayer.setDrawSimple(true); mapView.getLayerManager().getLayers().add(tileCoordinatesLayer); // Enable frame counter mapView.getFpsCounter().setVisible(true); }
private void triggerGpxObjectsUpdate() { if (mMapView == null) { return; } final BoundingBox bbox = MapPositionUtil.getBoundingBox( mMapView.getModel().mapViewPosition.getMapPosition(), mMapView.getDimension(), mMapView.getModel().displayModel.getTileSize()); final GpxMapObjectsLoader task = new GpxMapObjectsLoader(getActivity().getApplicationContext(), this); // query with some extra space task.execute(mSessionId, bbox.minLatitude - 0.01, bbox.maxLatitude + 0.01, bbox.minLongitude - 0.15, bbox.maxLatitude + 0.15); }
DistanceUnitAdapter secondaryDistanceUnitAdapter) { if (null == primaryDistanceUnitAdapter && null == secondaryDistanceUnitAdapter) { mapView.setMapScaleBar(null); } else { MapScaleBar scaleBar = mapView.getMapScaleBar(); if (scaleBar == null) { scaleBar = new DefaultMapScaleBar(mapView.getModel().mapViewPosition, mapView.getModel().mapViewDimension, AndroidGraphicFactory.INSTANCE, mapView.getModel().displayModel); mapView.setMapScaleBar(scaleBar);
IMapViewPosition mapViewPosition = this.mapView.getModel().mapViewPosition; if (this.doubleTapEnabled && mapViewPosition.getZoomLevel() < mapViewPosition.getZoomLevelMax()) { Point center = this.mapView.getModel().mapViewDimension.getDimension().getCenter(); byte zoomLevelDiff = 1; double moveHorizontal = (center.x - e.getX()) / Math.pow(2, zoomLevelDiff); double moveVertical = (center.y - e.getY()) / Math.pow(2, zoomLevelDiff); LatLong pivot = this.mapView.getMapViewProjection().fromPixels(e.getX(), e.getY()); if (pivot != null) { this.mapView.onMoveEvent(); this.mapView.onZoomEvent(); mapViewPosition.setPivot(pivot); mapViewPosition.moveCenterAndZoom(moveHorizontal, moveVertical, zoomLevelDiff);
super.createMapViews(); this.mapView2.getModel().mapViewPosition.setZoomLevel((byte) 12); this.mapView2.getMapScaleBar().setVisible(false); this.observer = new MapViewPositionObserver(this.mapView.getModel().mapViewPosition, this.mapView2.getModel().mapViewPosition) { Polyline lastLine;