本文整理汇总了Java中org.mapsforge.map.rendertheme.InternalRenderTheme类的典型用法代码示例。如果您正苦于以下问题:Java InternalRenderTheme类的具体用法?Java InternalRenderTheme怎么用?Java InternalRenderTheme使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
InternalRenderTheme类属于org.mapsforge.map.rendertheme包,在下文中一共展示了InternalRenderTheme类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import org.mapsforge.map.rendertheme.InternalRenderTheme; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View rootView = inflater.inflate(R.layout.fragment_item_detail,
container, false);
if (this.dummyItem != null) {
this.mapView = (MapView) rootView.findViewById(R.id.mapView);
this.mapView.setClickable(true);
this.mapView.getFpsCounter().setVisible(true);
this.mapView.getMapScaleBar().setVisible(true);
LayerManager layerManager = this.mapView.getLayerManager();
Layers layers = layerManager.getLayers();
MapViewPosition mapViewPosition = this.mapView.getModel().mapViewPosition;
mapViewPosition.setZoomLevel((byte) 16);
this.tileCache = AndroidUtil.createTileCache(this.getActivity(),
"fragments",
this.mapView.getModel().displayModel.getTileSize(), 1.0f,
1.5);
mapViewPosition.setCenter(this.dummyItem.location);
layers.add(AndroidUtil.createTileRendererLayer(this.tileCache,
mapViewPosition, getMapFile(),
InternalRenderTheme.OSMARENDER, false, true));
}
return rootView;
}
示例2: onStart
import org.mapsforge.map.rendertheme.InternalRenderTheme; //导入依赖的package包/类
@Override public void onStart() {
super.onStart();
if (DEBUG) { Log.d(TAG, "Map.onStart"); }
// warp to 'unter den linden'
mapView.getModel().mapViewPosition.setCenter(new LatLong(52.517037, 13.38886));
mapView.getModel().mapViewPosition.setZoomLevel((byte)12);
MultiMapDataStore multiMapDataStore = new MultiMapDataStore(MultiMapDataStore.DataPolicy.DEDUPLICATE);
tileLayer = new TileRendererLayer(tileCache, multiMapDataStore, mapView.getModel().mapViewPosition,
false, true, AndroidGraphicFactory.INSTANCE);
multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE1)), true, true);
multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE2)), false, false);
tileLayer.setXmlRenderTheme(InternalRenderTheme.OSMARENDER);
mapView.getLayerManager().getLayers().add(tileLayer);
Bitmap bitmap = AndroidGraphicFactory.convertToBitmap(getResources().getDrawable(R.drawable.poi_black));
bitmap.incrementRefCount();
Marker marker = new Marker(new LatLong(52.517037, 13.38886), bitmap, 0, -bitmap.getHeight() / 2) {
@Override public boolean onTap(LatLong geoPoint, Point viewPosition, Point tapPoint) {
if (contains(viewPosition, tapPoint)) {
Toast.makeText(getActivity(), "Unter den Linden Ecke Friedrichstraße, Berlin", Toast.LENGTH_SHORT).show();
return true;
}
return false;
}
};
mapView.getLayerManager().getLayers().add(marker);
}
示例3: onStart
import org.mapsforge.map.rendertheme.InternalRenderTheme; //导入依赖的package包/类
@Override public void onStart() {
super.onStart();
if (DEBUG) { Log.d(TAG, "Map.onStart"); }
// warp to 'unter den linden'
mapView.getModel().mapViewPosition.setCenter(new LatLong(52.517037, 13.38886));
mapView.getModel().mapViewPosition.setZoomLevel((byte)12);
MultiMapDataStore multiMapDataStore = new MultiMapDataStore(MultiMapDataStore.DataPolicy.DEDUPLICATE);
tileLayer = new TileRendererLayer(tileCache, multiMapDataStore, mapView.getModel().mapViewPosition,
false, true, AndroidGraphicFactory.INSTANCE);
tileLayer.setTextScale(1.5f);
multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE1)), true, true);
multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE2)), false, false);
multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE0)), false, false);
try {
tileLayer.setXmlRenderTheme(new ExternalRenderTheme(new File(THEMEFILE))); // set a different render theme
}
catch (FileNotFoundException ignore) {
tileLayer.setXmlRenderTheme(InternalRenderTheme.OSMARENDER); // fallback if not founr
}
mapView.getLayerManager().getLayers().add(tileLayer);
mapView.getLayerManager().getLayers().add( // add a grid around each tile
new TileGridLayer(AndroidGraphicFactory.INSTANCE, mapView.getModel().displayModel));
mapView.getLayerManager().getLayers().add( // add text to show x/y/z of each tile
new TileCoordinatesLayer(AndroidGraphicFactory.INSTANCE, mapView.getModel().displayModel));
}
示例4: onStart
import org.mapsforge.map.rendertheme.InternalRenderTheme; //导入依赖的package包/类
@Override public void onStart() {
super.onStart();
if (DEBUG) { Log.d(TAG, "Map.onStart"); }
// warp to 'unter den linden'
mapView.getModel().mapViewPosition.setCenter(new LatLong(52.517037, 13.38886));
mapView.getModel().mapViewPosition.setZoomLevel((byte)12);
MultiMapDataStore multiMapDataStore = new MultiMapDataStore(MultiMapDataStore.DataPolicy.DEDUPLICATE);
tileLayer = new TileRendererLayer(tileCache, multiMapDataStore, mapView.getModel().mapViewPosition,
false, true, AndroidGraphicFactory.INSTANCE);
multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE1)), true, true);
multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE2)), false, false);
multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE0)), false, false);
tileLayer.setXmlRenderTheme(InternalRenderTheme.OSMARENDER);
mapView.getLayerManager().getLayers().add(tileLayer);
myLocationOverlay = new ThreeStateLocationOverlay(getActivity(), mapView.getModel().mapViewPosition);
myLocationOverlay.setSnapToLocationEnabled(true);
mapView.getLayerManager().getLayers().add(myLocationOverlay);
}
示例5: loadMap
import org.mapsforge.map.rendertheme.InternalRenderTheme; //导入依赖的package包/类
/**
* load map to mapView
*
* @param areaFolder
*/
public void loadMap(File areaFolder) {
logToast("Loading map: " + currentArea);
File mapFile = new File(areaFolder, currentArea + ".map");
mapView.getLayerManager().getLayers().clear();
TileRendererLayer tileRendererLayer =
new TileRendererLayer(tileCache, mapView.getModel().mapViewPosition, false, true,
AndroidGraphicFactory.INSTANCE) {
@Override public boolean onTap(LatLong tapLatLong, Point layerXY, Point tapXY) {
return myOnTap(tapLatLong, layerXY, tapXY);
}
};
tileRendererLayer.setMapFile(mapFile);
tileRendererLayer.setTextScale(0.8f);
tileRendererLayer.setXmlRenderTheme(InternalRenderTheme.OSMARENDER);
// log("last location " + Variable.getVariable().getLastLocation());
if (Variable.getVariable().getLastLocation() == null) {
centerPointOnMap(tileRendererLayer.getMapDatabase().getMapFileInfo().boundingBox.getCenterPoint(), 6);
} else {
centerPointOnMap(Variable.getVariable().getLastLocation(), Variable.getVariable().getLastZoomLevel());
}
mapView.getLayerManager().getLayers().add(tileRendererLayer);
ViewGroup.LayoutParams params =
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
activity.addContentView(mapView, params);
loadGraphStorage();
}
示例6: createTileRendererLayer
import org.mapsforge.map.rendertheme.InternalRenderTheme; //导入依赖的package包/类
private TileRendererLayer createTileRendererLayer(TileCache tileCache,
MapViewPosition mapViewPosition, boolean isTransparent,
boolean renderLabels, File mapFile) {
TileRendererLayer tileRendererLayer = new TileRendererLayer(tileCache,
new MapFile(mapFile), mapViewPosition, isTransparent,
renderLabels, GRAPHIC_FACTORY);
tileRendererLayer.setXmlRenderTheme(InternalRenderTheme.OSMARENDER);
return tileRendererLayer;
}
示例7: onStart
import org.mapsforge.map.rendertheme.InternalRenderTheme; //导入依赖的package包/类
@Override
protected void onStart() {
super.onStart();
multiMapDataStore.addMapDataStore(worldMap,true,true);
multiMapDataStore.addMapDataStore(taiwanMap,false,false);
//multiMapDataStore.setStartPosition(new LatLong(23, 121));
//multiMapDataStore.setStartZoomLevel((byte) 7);
tileRendererLayer = new TileRendererLayer(tileCache,multiMapDataStore,mapView.getModel().mapViewPosition,false,true, AndroidGraphicFactory.INSTANCE);
tileRendererLayer.setXmlRenderTheme(InternalRenderTheme.OSMARENDER);
mapView.getModel().mapViewPosition.setMapPosition(new MapPosition(new LatLong(23, 121), (byte) 7));
mapView.getLayerManager().getLayers().add(tileRendererLayer);
}
示例8: createTileRendererLayer
import org.mapsforge.map.rendertheme.InternalRenderTheme; //导入依赖的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;
}
示例9: getRenderTheme
import org.mapsforge.map.rendertheme.InternalRenderTheme; //导入依赖的package包/类
private XmlRenderTheme getRenderTheme() {
try {
return InternalRenderTheme.DEFAULT;
} catch (Exception e) {
Analytics.sendException(getContext(), e, false);
}
return InternalRenderTheme.OSMARENDER;
}
示例10: onStart
import org.mapsforge.map.rendertheme.InternalRenderTheme; //导入依赖的package包/类
@Override public void onStart() {
super.onStart();
if (DEBUG) { Log.d(TAG, "Map.onStart"); }
List<LatLong> latLongs = polyline.getLatLongs();
LatLong latLong = new LatLong(52.5, 13.4);
try {
for (TrackGpxParser.TrackPoint trackPoint : new TrackGpxParser(new File(GPXFILE))) {
latLong = trackPoint;
latLongs.add(latLong);
}
// add: mapView.getModel().mapViewPosition.setMapPosition(new MapPosition(bb.getCenterPoint(), LatLongUtils.zoomForBounds(dimension, bb, mapView.getModel().displayModel.getTileSize())));
}
catch (Exception e) {
Log.e(TAG, "Map.onStart", e);
}
// warp to track
mapView.getModel().mapViewPosition.setCenter(latLong);
mapView.getModel().mapViewPosition.setZoomLevel((byte)12);
MultiMapDataStore multiMapDataStore = new MultiMapDataStore(MultiMapDataStore.DataPolicy.DEDUPLICATE);
tileLayer = new TileRendererLayer(tileCache, multiMapDataStore, mapView.getModel().mapViewPosition,
false, true, AndroidGraphicFactory.INSTANCE);
multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE1)), true, true);
multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE2)), false, false);
tileLayer.setXmlRenderTheme(InternalRenderTheme.OSMARENDER);
mapView.getLayerManager().getLayers().add(tileLayer);
mapView.getLayerManager().getLayers().add(polyline);
}
示例11: onStart
import org.mapsforge.map.rendertheme.InternalRenderTheme; //导入依赖的package包/类
@Override
public void onStart() {
super.onStart();
if (DEBUG) {
Log.d(TAG, "Map.onStart");
}
MultiMapDataStore multiMapDataStore = new MultiMapDataStore(MultiMapDataStore.DataPolicy.DEDUPLICATE);
tileLayer = new TileRendererLayer(tileCache, multiMapDataStore, mapView.getModel().mapViewPosition,
false, true, AndroidGraphicFactory.INSTANCE);
multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE1)), true, true);
multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE2)), false, false);
multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE0)), false, false);
tileLayer.setXmlRenderTheme(InternalRenderTheme.OSMARENDER);
mapView.getLayerManager().getLayers().add(tileLayer);
}
示例12: onStart
import org.mapsforge.map.rendertheme.InternalRenderTheme; //导入依赖的package包/类
@Override public void onStart() {
super.onStart();
if (DEBUG) { Log.d(TAG, "Map.onStart"); }
// warp to 'unter den linden'
mapView.getModel().mapViewPosition.setCenter(new LatLong(52.517037, 13.38886));
mapView.getModel().mapViewPosition.setZoomLevel((byte)12);
MultiMapDataStore multiMapDataStore = new MultiMapDataStore(MultiMapDataStore.DataPolicy.DEDUPLICATE);
tileLayer = new TileRendererLayer(tileCache, multiMapDataStore, mapView.getModel().mapViewPosition,
false, true, AndroidGraphicFactory.INSTANCE);
multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE1)), true, true);
multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE2)), false, false);
multiMapDataStore.addMapDataStore(new MapFile(new File(MAPFILE0)), false, false);
tileLayer.setXmlRenderTheme(InternalRenderTheme.OSMARENDER);
mapView.getLayerManager().getLayers().add(tileLayer);
}
示例13: onStart
import org.mapsforge.map.rendertheme.InternalRenderTheme; //导入依赖的package包/类
@Override protected void onStart() {
super.onStart();
if (DEBUG) Log.d(TAG, "onStart");
// warp to 'unter den linden'
mapView.getModel().mapViewPosition.setCenter(new LatLong(52.517037, 13.38886));
mapView.getModel().mapViewPosition.setZoomLevel((byte)12);
tileLayer = new TileRendererLayer(tileCache, new MapFile(new File(MAPFILE)), mapView.getModel().mapViewPosition,
false, true, AndroidGraphicFactory.INSTANCE);
tileLayer.setXmlRenderTheme(InternalRenderTheme.OSMARENDER);
mapView.getLayerManager().getLayers().add(tileLayer);
}
示例14: createTileRendererLayer
import org.mapsforge.map.rendertheme.InternalRenderTheme; //导入依赖的package包/类
static Layer createTileRendererLayer(TileCache tileCache, MapViewPosition mapViewPosition, File mapFile) {
TileRendererLayer tileRendererLayer = new TileRendererLayer(tileCache, mapViewPosition,
false, false, AndroidGraphicFactory.INSTANCE);
tileRendererLayer.setMapFile(mapFile);
tileRendererLayer.setXmlRenderTheme(InternalRenderTheme.OSMARENDER);
tileRendererLayer.setTextScale(1.5f);
return tileRendererLayer;
}
示例15: getRenderTheme
import org.mapsforge.map.rendertheme.InternalRenderTheme; //导入依赖的package包/类
private static XmlRenderTheme getRenderTheme(String xmlRenderThemeFilename){
if(Strings.isEmpty(xmlRenderThemeFilename)==false){
File renderThemeFile = RelativeFiles.validateRelativeFiles(xmlRenderThemeFilename, AppConstants.ODL_CONFIG_DIR);
if (renderThemeFile != null) {
try {
return new ExternalRenderTheme(renderThemeFile.getAbsoluteFile());
} catch (Exception e) {
// just return the default theme
}
}
}
return InternalRenderTheme.OSMARENDER;
}