本文整理汇总了Java中org.mapsforge.map.android.util.AndroidUtil.createTileCache方法的典型用法代码示例。如果您正苦于以下问题:Java AndroidUtil.createTileCache方法的具体用法?Java AndroidUtil.createTileCache怎么用?Java AndroidUtil.createTileCache使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mapsforge.map.android.util.AndroidUtil
的用法示例。
在下文中一共展示了AndroidUtil.createTileCache方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLayers
import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
@AfterPermissionGranted(PERMISSIONS_REQUEST_READ_STORAGE)
private void createLayers() {
if (EasyPermissions.hasPermissions(getContext(), Manifest.permission.READ_EXTERNAL_STORAGE)) {
TileCache tileCache = AndroidUtil.createTileCache(getContext(),
"mapFragment",
this.mapView.getModel().displayModel.getTileSize(),
1.0f,
this.mapView.getModel().frameBufferModel.getOverdrawFactor());
final Layers layers = this.mapView.getLayerManager().getLayers();
final MapViewPosition mapViewPosition = this.mapView.getModel().mapViewPosition;
initializePosition(mapViewPosition);
TileRendererLayer tileRendererLayer = createTileRendererLayer(tileCache, mapViewPosition,
getMapFile(), getRenderTheme());
layers.add(tileRendererLayer);
LabelLayer labelLayer = new LabelLayer(AndroidGraphicFactory.INSTANCE, tileRendererLayer.getLabelStore());
mapView.getLayerManager().getLayers().add(labelLayer);
// overlay with a marker to show the goal position
this.goalLocationOverlay = new Marker(null, null, 0, 0);
layers.add(this.goalLocationOverlay);
createLocationLayer();
} else {
EasyPermissions.requestPermissions(
this,
"",
PERMISSIONS_REQUEST_READ_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE);
}
}
示例2: onCreate
import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mapView = new MapView(this);
mapView.setClickable(true);
mapView.getMapScaleBar().setVisible(true);
mapView.setBuiltInZoomControls(true);
mapView.getMapZoomControls().setZoomLevelMin((byte) 5);
mapView.getMapZoomControls().setZoomLevelMax((byte) 20);
worldMap = new MapFile(new File(Constant.PATH_WORLDMAP));
taiwanMap = new MapFile(new File(Constant.PATH_TAIWANMAP));
multiMapDataStore = new MultiMapDataStore(MultiMapDataStore.DataPolicy.RETURN_ALL);
tileCache = AndroidUtil.createTileCache(this, "mapcache", mapView.getModel().displayModel.getTileSize(), 1f, this.mapView.getModel().frameBufferModel.getOverdrawFactor());
setContentView(mapView);
}
示例3: onCreate
import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
@Override public void onCreate(Bundle bundle) {
super.onCreate(bundle);
if (DEBUG) { Log.d(TAG, "Map.onCreate"); }
AndroidGraphicFactory.createInstance(getActivity().getApplication());
mapView = new MapView(getActivity());
//
mapView.setClickable(true);
mapView.getMapScaleBar().setVisible(true);
mapView.setBuiltInZoomControls(true);
mapView.getMapZoomControls().setZoomLevelMin((byte)2);
mapView.getMapZoomControls().setZoomLevelMax((byte)18);
mapView.getMapZoomControls().setShowMapZoomControls(true);
mapView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
tileCache = AndroidUtil.createTileCache(getActivity(), "mapcache", mapView.getModel().displayModel.getTileSize(),
1f, mapView.getModel().frameBufferModel.getOverdrawFactor());
polyline = new AlternatingLine(AndroidGraphicFactory.INSTANCE);
}
示例4: onCreate
import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
@Override public void onCreate(Bundle bundle) {
super.onCreate(bundle);
if (DEBUG) { Log.d(TAG, "Map.onCreate"); }
AndroidGraphicFactory.createInstance(getActivity().getApplication());
mapView = new MapView(getActivity());
//
mapView.setClickable(true);
mapView.getMapScaleBar().setVisible(true);
mapView.setBuiltInZoomControls(true);
mapView.getMapZoomControls().setZoomLevelMin((byte)2);
mapView.getMapZoomControls().setZoomLevelMax((byte)18);
mapView.getMapZoomControls().setShowMapZoomControls(true);
mapView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
for (int i=0;i<tileCaches.length;i++) {
tileCaches[i]= AndroidUtil.createTileCache(getActivity(),
"mapcache-" + i, mapView.getModel().displayModel.getTileSize(), 1f,
mapView.getModel().frameBufferModel.getOverdrawFactor());
}
}
示例5: onCreate
import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
@Override public void onCreate(Bundle bundle) {
super.onCreate(bundle);
if (DEBUG) { Log.d(TAG, "Map.onCreate"); }
AndroidGraphicFactory.createInstance(getActivity().getApplication());
mapView = new MapView(getActivity());
//
mapView.setClickable(true);
mapView.getMapScaleBar().setVisible(true);
mapView.setBuiltInZoomControls(true);
mapView.getMapZoomControls().setZoomLevelMin((byte)2);
mapView.getMapZoomControls().setZoomLevelMax((byte)18);
mapView.getMapZoomControls().setShowMapZoomControls(true);
mapView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
tileCache = AndroidUtil.createTileCache(getActivity(), "mapcache", mapView.getModel().displayModel.getTileSize(),
1f, mapView.getModel().frameBufferModel.getOverdrawFactor());
}
示例6: onCreateView
import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的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;
}
示例7: onCreate
import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
@Override public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
if (DEBUG) Log.d(TAG, "onCreate");
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
@Override
public void uncaughtException(Thread thread, Throwable e) {
Log.e(TAG, "error e=" + e, e);
finish();
}
});
AndroidGraphicFactory.createInstance(getApplication());
mapView = new MapView(this);
setContentView(mapView);
mapView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
mapView.setClickable(true);
mapView.getMapScaleBar().setVisible(true);
mapView.setBuiltInZoomControls(true);
mapView.getMapZoomControls().setZoomLevelMin((byte)2);
mapView.getMapZoomControls().setZoomLevelMax((byte)18);
mapView.getMapZoomControls().setShowMapZoomControls(true);
// create a tile cache of suitable size
tileCache = AndroidUtil.createTileCache(this, "mapcache",
mapView.getModel().displayModel.getTileSize(), 1f,
mapView.getModel().frameBufferModel.getOverdrawFactor());
}
示例8: onCreate
import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
@Override public void onCreate(Bundle bundle) {
super.onCreate(bundle);
if (DEBUG) { Log.d(TAG, "Map.onCreate"); }
AndroidGraphicFactory.createInstance(getActivity().getApplication());
mapView = new MapView(getActivity());
//
mapView.setClickable(true);
AndroidUtil.setMapScaleBar(mapView, MetricUnitAdapter.INSTANCE, null);
mapView.getMapScaleBar().setVisible(true);
mapView.setBuiltInZoomControls(true);
mapView.getMapZoomControls().setZoomLevelMin((byte)2);
mapView.getMapZoomControls().setZoomLevelMax((byte)18);
mapView.getMapZoomControls().setShowMapZoomControls(true);
mapView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
DisplayModel displayModel = mapView.getModel().displayModel;
displayModel.setBackgroundColor(0xffff0000); // red background, defaults to 0xffeeeeee
displayModel.setFixedTileSize(512); // change the tile size, defaults to 256
// displayModel.setMaxTextWidthFactor(0.3f); // defaults to .7f
// displayModel.setTileSizeMultiple(100); // defaults to 64
displayModel.setUserScaleFactor(1.5f); // scaled map, defaults to 1.0f
tileCache = AndroidUtil.createTileCache(getActivity(), "mapcache", mapView.getModel().displayModel.getTileSize(),
1f, mapView.getModel().frameBufferModel.getOverdrawFactor());
}
示例9: onCreateView
import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View rvalue = inflater.inflate(R.layout.fragment_map, container, false);
tileCache = AndroidUtil.createTileCache(getActivity(), MapsConfig.TILE_CACHE_ID, MapsConfig.TILE_SIZE, MapsConfig.SCREEN_RATION, MapsConfig.OVERDRAW);
final File mapFile = AbstractMap.instance().getMapsforgeFile(getActivity());
mMapView = new MapsforgeMapView(getActivity(), tileCache, mapFile.getAbsolutePath());
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
RelativeLayout forMap = (RelativeLayout) rvalue.findViewById(R.id.layout_map);
forMap.addView(mMapView, 0, params);
buildGoogleApiClient();
return rvalue;
}
示例10: onCreateView
import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final View rvalue = inflater.inflate(R.layout.fragment_map, container, false);
tileCache = AndroidUtil.createTileCache(getActivity(), MapsConfig.TILE_CACHE_ID, MapsConfig.TILE_SIZE, MapsConfig.SCREEN_RATION, MapsConfig.OVERDRAW);
final File mapFile = AbstractMap.instance().getMapsforgeFile(getActivity());
mMapView = new MapsforgeMapView(getActivity(), tileCache, mapFile.getAbsolutePath());
RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
RelativeLayout forMap = (RelativeLayout) rvalue.findViewById(R.id.layout_map);
forMap.addView(mMapView, 0, params);
return rvalue;
}
示例11: init
import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
public void init(Activity activity, MapView mapView, String currentArea, File mapsFolder) {
this.activity = activity;
this.mapView = mapView;
this.currentArea = currentArea;
this.mapsFolder = mapsFolder;
// this.prepareInProgress = prepareInProgress;
tileCache = AndroidUtil
.createTileCache(activity, getClass().getSimpleName(), mapView.getModel().displayModel.getTileSize(),
1f, mapView.getModel().frameBufferModel.getOverdrawFactor());
}
示例12: initialize
import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
public static boolean initialize(String locationOfMapFile,String renderThemeAddr, Context _context) {
Log.i(TAG, "Initilizing started");
mapFilePath = locationOfMapFile;
androidGraphicFactory = AndroidGraphicFactory.INSTANCE;
mapFile = new File(mapFilePath);
displayModel = new DisplayModel();
mapViewPosition = new MapViewPosition(displayModel);
mapDataStore = new MapFile(mapFile);
displayModel.setFixedTileSize(256);
TileCache tileCache = AndroidUtil.createTileCache(context, "111", 256, 1.0f, 1d);
// TileCache tileCache = null;
databaseRenderer = new DatabaseRenderer(mapDataStore, androidGraphicFactory, tileCache);
context = _context;
try {
xmlRenderTheme = new ExternalRenderTheme(new File(renderThemeAddr ));
Log.i(TAG, "xmlRenderTheme initialized successfully");
}
catch(Throwable e)
{
Log.i(TAG, "xmlRenderTheme error initializing ");
e.printStackTrace();
}
renderThemeFuture = new RenderThemeFuture(AndroidGraphicFactory.INSTANCE, xmlRenderTheme, displayModel);
new Thread(renderThemeFuture).run();
Log.i(TAG, "Mapsforge Initializing Ended");
return true;
}
示例13: LayerBase
import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
LayerBase(Tabulae activity, MapView mapView, boolean persistant) {
this.mapView = mapView;
if (persistant) {
int size = AndroidUtil.getMinimumCacheSize(activity, mapView.getModel().displayModel.getTileSize(), mapView.getModel().frameBufferModel.getOverdrawFactor(), 1f);
//if (DEBUG) Log.d(TAG, "LayerBase.LayerBase minmal cache size=" + size);
memCache = new InMemoryTileCache(size);
tileCache = new TwoLevelTileCache(
memCache,
new FileSystemTileCache(99999, new File(activity.getTilesDir(), getId()), AndroidGraphicFactory.INSTANCE, true)
);
} else {
tileCache = AndroidUtil.createTileCache(activity, getId(), mapView.getModel().displayModel.getTileSize(),
1f, mapView.getModel().frameBufferModel.getOverdrawFactor());
}
}
示例14: createTileCache
import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
/**
* Creates a tile cache for the baselayer
*
* @return
*/
protected final TileCache createTileCache() {
if (mMapView == null) {
return null;
}
return AndroidUtil.createTileCache(
getActivity().getApplicationContext(),
"mapcache",
mMapView.getModel().displayModel.getTileSize(),
1f,
mMapView.getModel().frameBufferModel.getOverdrawFactor());
}
示例15: createTileCache2
import org.mapsforge.map.android.util.AndroidUtil; //导入方法依赖的package包/类
protected TileCache createTileCache2() {
int tileSize = this.mapView2.getModel().displayModel
.getTileSize();
return AndroidUtil.createTileCache(this, getPersistableId2(), tileSize,
getScreenRatio2(),
this.mapView2.getModel().frameBufferModel
.getOverdrawFactor());
}