当前位置: 首页>>代码示例>>Java>>正文


Java Layer类代码示例

本文整理汇总了Java中org.mapsforge.map.layer.Layer的典型用法代码示例。如果您正苦于以下问题:Java Layer类的具体用法?Java Layer怎么用?Java Layer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Layer类属于org.mapsforge.map.layer包,在下文中一共展示了Layer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCreate

import org.mapsforge.map.layer.Layer; //导入依赖的package包/类
@Override
public final void onCreate(final Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	setHasOptionsMenu(true);

	// get shared preferences
	prefs = PreferenceManager.getDefaultSharedPreferences(getActivity());

	// Register our gps broadcast mReceiver
	registerReceiver();

	catalogObjects = new ArrayList<Layer>();
	sessionObjects = new ArrayList<Layer>();
	gpxObjects = new Polyline(MapUtils.createPaint(AndroidGraphicFactory.INSTANCE.createColor(Color.BLACK), STROKE_GPX_WIDTH,
			Style.STROKE), AndroidGraphicFactory.INSTANCE);
}
 
开发者ID:saintbyte,项目名称:openbmap,代码行数:17,代码来源:MapViewActivity.java

示例2: destroyAll

import org.mapsforge.map.layer.Layer; //导入依赖的package包/类
/**
 * Clear all map view elements.<br/>
 * i.e. layers, tile cache, label store, map view, resources, etc.
 */
@Override
public void destroyAll() {
	for (Layer layer : this.layerManager.getLayers()) {
		this.layerManager.getLayers().remove(layer);
		layer.onDestroy();
		if (layer instanceof TileLayer) {
			((TileLayer<?>) layer).getTileCache().destroy();
		}
		if (layer instanceof TileRendererLayer) {
			LabelStore labelStore = ((TileRendererLayer) layer)
					.getLabelStore();
			if (labelStore != null) {
				labelStore.clear();
			}
		}
	}
	destroy();
	AwtGraphicFactory.clearResourceMemoryCache();
}
 
开发者ID:ianmalcolm,项目名称:DeadReckoning,代码行数:24,代码来源:MapView.java

示例3: clearSessionLayer

import org.mapsforge.map.layer.Layer; //导入依赖的package包/类
/**
 *
 */
private void clearSessionLayer() {
    if (mSessionObjects == null) {
        return;
    }

    if (mMapView == null) {
        mSessionObjects = null;
        return;
    }

    for (final Iterator<Layer> iterator = mSessionObjects.iterator(); iterator.hasNext(); ) {
        final Layer layer = iterator.next();
        this.mMapView.getLayerManager().getLayers().remove(layer);
    }
    mSessionObjects.clear();
}
 
开发者ID:openbmap,项目名称:radiocells-scanner-android,代码行数:20,代码来源:MapViewActivity.java

示例4: clearCatalogLayer

import org.mapsforge.map.layer.Layer; //导入依赖的package包/类
/**
 * Clears catalog layer objects
 */
private void clearCatalogLayer() {
    if (mCatalogObjects == null) {
        return;
    }

    if (mMapView == null) {
        mCatalogObjects = null;
        return;
    }

    synchronized (mCatalogObjects) {
        for (final Iterator<Layer> iterator = mCatalogObjects.iterator(); iterator.hasNext(); ) {
            final Layer layer = iterator.next();
            this.mMapView.getLayerManager().getLayers().remove(layer);
        }
        mCatalogObjects.clear();
    }
}
 
开发者ID:openbmap,项目名称:radiocells-scanner-android,代码行数:22,代码来源:MapViewActivity.java

示例5: addOfflineLayer

import org.mapsforge.map.layer.Layer; //导入依赖的package包/类
private void addOfflineLayer() {
    final Layer offlineLayer = MapUtils.createTileRendererLayer(
            this.mTileCache,
            this.mMapView.getModel().mapViewPosition,
            MapUtils.getMapFile(this.getActivity()),
            MapUtils.getRenderTheme(this.getActivity()),null);

    if (offlineLayer != null) this.mMapView.getLayerManager().getLayers().add(offlineLayer);
}
 
开发者ID:openbmap,项目名称:radiocells-scanner-android,代码行数:10,代码来源:CellDetailsMap.java

示例6: addLayers

import org.mapsforge.map.layer.Layer; //导入依赖的package包/类
protected void addLayers(TileCache tileCache, MapViewPosition mapViewPosition) {
    if (isNetworkAvailable()) {
        downloadLayer = new TileDownloadLayer(this.tileCache,
                mapViewPosition, OpenStreetMapMapnik.INSTANCE,
                AndroidGraphicFactory.INSTANCE);
        layerManager.getLayers().add(downloadLayer);
    } else {
        Layer layer = Utils.createTileRendererLayer(tileCache, mapViewPosition, getMapFile());
        layerManager.getLayers().add(layer);
    }

    // a marker to show at the position
    Drawable drawable = getResources().getDrawable(R.drawable.pin);
    Bitmap bitmap = AndroidGraphicFactory.convertToBitmap(drawable);

    // create the overlay and tell it to follow the location
    myLocationOverlay = new MyLocationOverlay(this,
            mapViewPosition, bitmap, Utils.createPaint(AndroidGraphicFactory.INSTANCE.createColor(90, 15, 20, 25), 0,
            Style.FILL), null, user);
    myLocationOverlay.setSnapToLocationEnabled(false);

    layerManager.getLayers().add(this.myLocationOverlay);
}
 
开发者ID:monossido,项目名称:CoopTDMOrienteering,代码行数:24,代码来源:MapsActivity.java

示例7: destroyLayers

import org.mapsforge.map.layer.Layer; //导入依赖的package包/类
/**
 * Destroys layers and associated tile caches for the map view.
 * 
 * @param destroyOverlays Whether to destroy overlays (markers and circles) or just the tile layers
 */
private void destroyLayers(boolean destroyOverlays) {
	Layers layers = null;
	if (mapMap != null)
		layers = mapMap.getLayerManager().getLayers();
	
	if (mapDownloadLayer != null) {
		if (layers != null)
			layers.remove(mapDownloadLayer);
		mapDownloadLayer.onDestroy();
		mapDownloadLayer = null;
	}
	
	if (mapRendererLayer != null) {
		if (layers != null)
			layers.remove(mapRendererLayer);
		mapRendererLayer.onDestroy();
		mapRendererLayer = null;
	}
	
	if (mapDownloadTileCache != null) {
		mapDownloadTileCache.destroy();
		mapDownloadTileCache = null;
	}

	if (mapRendererTileCache != null) {
		mapRendererTileCache.destroy();
		mapRendererTileCache = null;
	}

	if (destroyOverlays && (layers != null))
		for (Layer layer : layers) {
			layer.onDestroy();
			layers.remove(layer);
		}
}
 
开发者ID:mvglasow,项目名称:satstat,代码行数:41,代码来源:MapSectionFragment.java

示例8: reloadTheme

import org.mapsforge.map.layer.Layer; //导入依赖的package包/类
public void reloadTheme(String newTheme) {
    if (!newTheme.equals(mCurrentTheme) && mReady) {
        try {
            Layer oldLayer = mTileLayer;
            mTileLayer = loadThemeLayer(newTheme, false);
            getLayerManager().getLayers().remove(oldLayer);
            getLayerManager().getLayers().add(0, mTileLayer);
            mCurrentTheme = newTheme;
        } catch(IOException ex) {
            Log.e(TAG, ex.getMessage());
        }
    }
}
 
开发者ID:OsmHackTW,项目名称:Geomancer,代码行数:14,代码来源:TaiwanMapView.java

示例9: clearSessionLayer

import org.mapsforge.map.layer.Layer; //导入依赖的package包/类
/**
 * 
 */
private void clearSessionLayer() {
	for (final Iterator<Layer> iterator = sessionObjects.iterator(); iterator.hasNext();) {
		final Layer layer = (Layer) iterator.next();
		this.mMapView.getLayerManager().getLayers().remove(layer);
	}
	sessionObjects.clear();

}
 
开发者ID:saintbyte,项目名称:openbmap,代码行数:12,代码来源:MapViewActivity.java

示例10: clearCatalogLayer

import org.mapsforge.map.layer.Layer; //导入依赖的package包/类
/**
 * Clears catalog layer objects
 */
private void clearCatalogLayer() {
	synchronized (catalogObjects) {
		for (final Iterator<Layer> iterator = catalogObjects.iterator(); iterator.hasNext();) {
			final Layer layer = (Layer) iterator.next();
			this.mMapView.getLayerManager().getLayers().remove(layer);
		}
		catalogObjects.clear();
	}
}
 
开发者ID:saintbyte,项目名称:openbmap,代码行数:13,代码来源:MapViewActivity.java

示例11: createTileDownloadLayer

import org.mapsforge.map.layer.Layer; //导入依赖的package包/类
@SuppressWarnings("unused")
private Layer createTileDownloadLayer(TileCache tileCache,
		MapViewPosition mapViewPosition) {
	TileSource tileSource = OpenStreetMapMapnik.INSTANCE;
	TileDownloadLayer tileDownloadLayer = new TileDownloadLayer(tileCache,
			mapViewPosition, tileSource, GRAPHIC_FACTORY);
	tileDownloadLayer.start();
	return tileDownloadLayer;
}
 
开发者ID:ianmalcolm,项目名称:DeadReckoning,代码行数:10,代码来源:MainFrame.java

示例12: onPause

import org.mapsforge.map.layer.Layer; //导入依赖的package包/类
@Override
public void onPause() {
	super.onPause();
	if (DEBUG) Log.d(TAG, "Track.onPause");
	MapView mapView = ((Tabulae) getActivity()).getMapView();
	Layers layers = mapView.getLayerManager().getLayers();
	for (Layer polyline: polylines) {
		((AlternatingLine)polyline).getLatLongs().clear();
		layers.remove(polyline, false);
	}
	polylines.clear();
}
 
开发者ID:emdete,项目名称:tabulae,代码行数:13,代码来源:Track.java

示例13: createTileRendererLayer

import org.mapsforge.map.layer.Layer; //导入依赖的package包/类
/**
 * Creates a tile layer, which optionally supports long press actions and custom render themes
 * @param tileCache
 * @param mapViewPosition
 * @param mapFile
 * @param renderTheme
 * @return
 */
public static Layer createTileRendererLayer(final TileCache tileCache, final MapViewPosition mapViewPosition,
		final MapFile mapFile, final XmlRenderTheme renderTheme, final onLongPressHandler handler) {

	if (mapFile == null) {
		return null;
	}

	final TileRendererLayer tileRendererLayer = new TileRendererLayer(tileCache, mapFile, mapViewPosition, AndroidGraphicFactory.INSTANCE) {
		@Override
		public boolean onLongPress(LatLong tapLatLong, Point thisXY, Point tapXY) {
               if (handler != null) {
                   ((onLongPressHandler)handler).onLongPress(tapLatLong, thisXY, tapXY);
                   return true;
               } else {
                   return false;
               }
		}
	};

       if (renderTheme == null) {
           Log.i(TAG, "Using default render theme");
           tileRendererLayer.setXmlRenderTheme(InternalRenderTheme.OSMARENDER);
       } else {
           Log.i(TAG, "Using custom theme");
           tileRendererLayer.setXmlRenderTheme(renderTheme);
       }

       tileRendererLayer.setTextScale(1.5f);
       return tileRendererLayer;
}
 
开发者ID:openbmap,项目名称:radiocells-scanner-android,代码行数:39,代码来源:MapUtils.java

示例14: addOfflineLayer

import org.mapsforge.map.layer.Layer; //导入依赖的package包/类
private void addOfflineLayer() {
	final Layer offlineLayer = MapUtils.createTileRendererLayer(
			this.mTileCache,
			this.mMapView.getModel().mapViewPosition,
			MapUtils.getMapFile(this.getActivity()),
			MapUtils.getRenderTheme(this.getActivity()),null);

	if (offlineLayer != null) this.mMapView.getLayerManager().getLayers().add(offlineLayer);
}
 
开发者ID:openbmap,项目名称:radiocells-scanner-android,代码行数:10,代码来源:WifiDetailsMap.java

示例15: addOfflineLayer

import org.mapsforge.map.layer.Layer; //导入依赖的package包/类
/**
 * Creates a long-press enabled offline map layer
 */
private void addOfflineLayer() {
    final Layer offlineLayer = MapUtils.createTileRendererLayer(
            this.mTileCache,
            this.mMapView.getModel().mapViewPosition,
            MapUtils.getMapFile(this.getActivity()),
            MapUtils.getRenderTheme(this.getActivity()),
            this
    );

    if (offlineLayer != null) this.mMapView.getLayerManager().getLayers().add(offlineLayer);
}
 
开发者ID:openbmap,项目名称:radiocells-scanner-android,代码行数:15,代码来源:MapViewActivity.java


注:本文中的org.mapsforge.map.layer.Layer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。