本文整理汇总了Java中org.mapsforge.map.android.graphics.AndroidGraphicFactory.createInstance方法的典型用法代码示例。如果您正苦于以下问题:Java AndroidGraphicFactory.createInstance方法的具体用法?Java AndroidGraphicFactory.createInstance怎么用?Java AndroidGraphicFactory.createInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.mapsforge.map.android.graphics.AndroidGraphicFactory
的用法示例。
在下文中一共展示了AndroidGraphicFactory.createInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initMap
import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
private void initMap() {
AndroidGraphicFactory.createInstance(getApplication());
mapView = new MapView(this);
mapView.setClickable(true);
mapView.getMapScaleBar().setVisible(false);
mapView.setBuiltInZoomControls(false);
mapView.setZoomLevelMin((byte) 2);
mapView.setZoomLevelMax((byte) 10);
mapView.setZoomLevel((byte) 2);
mapView.getModel().displayModel.setBackgroundColor(ContextCompat.getColor(this, R.color.mapBackground));
layers = mapView.getLayerManager().getLayers();
MapCreator mapCreator = new MapCreator(this, layers);
mapCreator.parseGeoJson("world_map.geo.json");
initServerOnMap(layers);
LinearLayout map = (LinearLayout) findViewById(R.id.map);
map.addView(mapView);
}
示例2: MapsforgeTileSource
import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
/**
* The reason this constructor is protected is because all parameters,
* except file should be determined from the archive file. Therefore a
* factory method is necessary.
*
* @param file
* @param xmlRenderTheme the themeFuture to render tiles with
*/
protected MapsforgeTileSource(Application app,
File file,
XmlRenderTheme xmlRenderTheme,
MultiMapDataStore.DataPolicy dataPolicy) {
AndroidGraphicFactory.createInstance(app);
// model.setFixedTileSize(256);
mapDatabase = new MultiMapDataStore(dataPolicy);
mapDatabase.addMapDataStore(new MapFile(file), false, false);
InMemoryTileCache tileCache = new InMemoryTileCache(5);
renderer = new DatabaseRenderer(mapDatabase, factory, tileCache,
new TileBasedLabelStore(tileCache.getCapacityFirstLevel()), true, true, null);
Log.d(TAG, "min=" + MIN_ZOOM + " max=" + MAX_ZOOM + " tilesize=" + TILE_SIZE_PIXELS);
themeFuture = new RenderThemeFuture(factory, xmlRenderTheme, model);
//super important!! without the following line, all rendering activities will block until the themeFuture is created.
new Thread(themeFuture).start();
}
示例3: onCreate
import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Fabric.with(this, new Crashlytics());
// 配置 Android 繪圖資源,必須在 inflate 之前完成
AndroidGraphicFactory.createInstance(getApplication());
setContentView(R.layout.activity_main);
// 配置廣播接收器
this.registerReceiver(receiver, MainUtils.buildFragmentSwitchIntentFilter());
// 清理儲存空間
MainUtils.cleanStorage(this);
// 檢查是否殘留除錯設定,釋出前使用
checkDebugParameters();
// 先進入更新介面
changeFragment(mUpdateFragment);
}
示例4: onCreate
import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 3000, 5, this);
Variable.getVariable().setContext(getApplicationContext());
Variable.getVariable().setZoomLevels(22, 1);
AndroidGraphicFactory.createInstance(getApplication());
mapView = new MapView(this);
mapView.setClickable(true);
mapView.setBuiltInZoomControls(false);
MapHandler.getMapHandler()
.init(this, mapView, Variable.getVariable().getCountry(), Variable.getVariable().getMapsFolder());
MapHandler.getMapHandler().loadMap(new File(Variable.getVariable().getMapsFolder().getAbsolutePath(),
Variable.getVariable().getCountry() + "-gh"));
customMapView();
checkGpsAvailability();
getMyLastLocation();
updateCurrentLocation(null);
}
示例5: onCreate
import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidGraphicFactory.createInstance(this.getApplication());
setContentView(R.layout.activity_main);
btn_simplemap = (Button)findViewById(R.id.btn_simple_map);
btn_multimap = (Button)findViewById(R.id.btn_multi_map);
btn_simplemap.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent = new Intent(v.getContext(),SimpleMapView.class);
startActivity(intent);
}
});
checker = new EnvironmentCheck(this);
downloadManager = new MapDownloadManager(this);
}
示例6: onCreate
import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
EventBus.builder().addIndex(new MyEventBusIndex()).installDefaultEventBus();
Intent serviceIntent = new Intent(getApplicationContext(), MasterBrainService.class);
startService(serviceIntent);
AndroidGraphicFactory.createInstance(this);
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
final float fs = Float.valueOf(preferences.getString(SETTING_SCALE,
Float.toString(DisplayModel.getDefaultUserScaleFactor())));
if (fs != DisplayModel.getDefaultUserScaleFactor()) {
DisplayModel.setDefaultUserScaleFactor(fs);
}
}
示例7: onCreate
import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的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);
}
示例8: onCreate
import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的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());
preferencesFacade = new AndroidPreferences(getActivity().getSharedPreferences("map", Context.MODE_PRIVATE));
mapView.getModel().init(preferencesFacade);
if (mapView.getModel().mapViewPosition.getZoomLevel() == 0) {
// warp to 'unter den linden'
mapView.getModel().mapViewPosition.setCenter(new LatLong(52.517037, 13.38886));
mapView.getModel().mapViewPosition.setZoomLevel((byte)12);
}
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 = createExternalStorageTileCache(getActivity(), "osmarender", 50, mapView.getModel().displayModel.getTileSize());
}
示例9: onCreate
import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的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());
}
}
示例10: onCreate
import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的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());
}
示例11: onCreate
import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
AndroidGraphicFactory.createInstance(this);
Log.e(TAG,
"Device scale factor "
+ Float.toString(DisplayModel.getDeviceScaleFactor()));
SharedPreferences preferences = PreferenceManager
.getDefaultSharedPreferences(this);
float fs = Float.valueOf(preferences.getString(SETTING_SCALE,
Float.toString(DisplayModel.getDefaultUserScaleFactor())));
Log.e(TAG, "User ScaleFactor " + Float.toString(fs));
if (fs != DisplayModel.getDefaultUserScaleFactor()) {
DisplayModel.setDefaultUserScaleFactor(fs);
}
MapFile.wayFilterEnabled = preferences.getBoolean(SETTING_WAYFILTERING, true);
if (MapFile.wayFilterEnabled) {
MapFile.wayFilterDistance = Integer.parseInt(preferences.getString(SETTING_WAYFILTERING_DISTANCE, "20"));
}
MapWorker.DEBUG_TIMING = preferences.getBoolean(SETTING_DEBUG_TIMING, false);
}
示例12: onCreate
import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的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());
}
示例13: onCreate
import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的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());
}
示例14: onCreate
import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
AndroidGraphicFactory.createInstance(this);
Log.e(TAG,
"Device scale factor "
+ Float.toString(DisplayModel.getDeviceScaleFactor()));
SharedPreferences preferences = PreferenceManager
.getDefaultSharedPreferences(this);
float fs = Float.valueOf(preferences.getString(SETTING_SCALE,
Float.toString(DisplayModel.getDefaultUserScaleFactor())));
Log.e(TAG, "User ScaleFactor " + Float.toString(fs));
if (fs != DisplayModel.getDefaultUserScaleFactor()) {
DisplayModel.setDefaultUserScaleFactor(fs);
}
}
示例15: onCreate
import org.mapsforge.map.android.graphics.AndroidGraphicFactory; //导入方法依赖的package包/类
@Override
public void onCreate() {
super.onCreate();
Log.i(TAG, "Application created");
AndroidGraphicFactory.createInstance(this);
final SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
final float fs = Float.valueOf(preferences.getString(SETTING_SCALE,
Float.toString(DisplayModel.getDefaultUserScaleFactor())));
if (fs != DisplayModel.getDefaultUserScaleFactor()) {
DisplayModel.setDefaultUserScaleFactor(fs);
}
}