本文整理汇总了Java中org.mapsforge.map.model.DisplayModel类的典型用法代码示例。如果您正苦于以下问题:Java DisplayModel类的具体用法?Java DisplayModel怎么用?Java DisplayModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DisplayModel类属于org.mapsforge.map.model包,在下文中一共展示了DisplayModel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreate
import org.mapsforge.map.model.DisplayModel; //导入依赖的package包/类
@Override public void onCreate(Bundle bundle) {
if (DEBUG) Log.d(TAG, "Map.onCreate bundle=" + bundle);
super.onCreate(bundle);
// AndroidGraphicFactory.createInstance(getActivity().getApplication());
mapView = new MapView(getActivity()) {
@Override public boolean onTouchEvent(MotionEvent motionEvent) {
if (snapToLocationEnabled) {
informSnapToLocation(false);
}
return super.onTouchEvent(motionEvent);
}
};
preferences = getActivity().getSharedPreferences("map", Context.MODE_PRIVATE);
mapView.setClickable(true);
// TODO: consider mapView.setGestureDetector();?
mapView.getMapScaleBar().setVisible(false);
mapView.getModel().mapViewPosition.setZoomLevelMin((byte) 4);
mapView.getModel().mapViewPosition.setZoomLevelMax((byte) 20);
mapView.getModel();
mapView.setBuiltInZoomControls(false);
mapView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
DisplayModel displayModel = mapView.getModel().displayModel;
displayModel.setBackgroundColor(0xffbbbbbb);
displayModel.setUserScaleFactor(1.5f);
}
示例2: onCreate
import org.mapsforge.map.model.DisplayModel; //导入依赖的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);
}
}
示例3: onCreate
import org.mapsforge.map.model.DisplayModel; //导入依赖的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);
}
示例4: onCreate
import org.mapsforge.map.model.DisplayModel; //导入依赖的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());
}
示例5: MapsforgeTileFactory
import org.mapsforge.map.model.DisplayModel; //导入依赖的package包/类
MapsforgeTileFactory(TileFactoryInfo info, String xmlRenderThemeFilename,MapDataStore mapDatabase, FadeConfig fadeColour) {
super(info);
this.fadeColour =fadeColour;
this.mapDatabase = mapDatabase;
zoomLevelConverter = new ZoomLevelConverter(info);
databaseRenderer = new DatabaseRenderer(mapDatabase, AwtGraphicFactory.INSTANCE,createDummyTileCacheForMapsforgeLabelPlacementAlgorithm());
renderTheme =getRenderTheme(xmlRenderThemeFilename);
model = new DisplayModel();
model.setFixedTileSize(TILE_SIZE);
model.setBackgroundColor(backgroundMapColour().getRGB());
// use single thread at the moment as DatabaseRenderer is probably single threaded
service = Executors.newFixedThreadPool(1, new ThreadFactory() {
private int count = 0;
@Override
public Thread newThread(Runnable r) {
Thread t = new Thread(r, "mapsforge-tile-pool-" + count++);
t.setPriority(Thread.MIN_PRIORITY);
t.setDaemon(true);
return t;
}
});
}
示例6: onCreate
import org.mapsforge.map.model.DisplayModel; //导入依赖的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);
}
}
示例7: onSharedPreferenceChanged
import org.mapsforge.map.model.DisplayModel; //导入依赖的package包/类
@Override
public void onSharedPreferenceChanged(SharedPreferences preferences,
String key) {
if (SamplesApplication.SETTING_SCALE.equals(key)) {
destroyTileCaches();
for (MapView mapView : mapViews) {
mapView.getModel().displayModel.setUserScaleFactor(DisplayModel
.getDefaultUserScaleFactor());
}
Log.d(SamplesApplication.TAG, "Tilesize now "
+ mapViews.get(0).getModel().displayModel.getTileSize());
createTileCaches();
redrawLayers();
}
}
示例8: onCreate
import org.mapsforge.map.model.DisplayModel; //导入依赖的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);
}
}
示例9: initialize
import org.mapsforge.map.model.DisplayModel; //导入依赖的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;
}
示例10: setDisplayModel
import org.mapsforge.map.model.DisplayModel; //导入依赖的package包/类
@Override
public synchronized void setDisplayModel(DisplayModel displayModel) {
super.setDisplayModel(displayModel);
if (displayModel != null) {
this.worker = new RasterWorkerThread(this.tileCache, this.jobQueue, this.rasterRenderer, this, mStatus);
this.worker.start();
} else {
// if we do not have a displayModel any more we can stop rendering.
if (this.worker != null) {
this.worker.interrupt();
}
}
}
示例11: onSharedPreferenceChanged
import org.mapsforge.map.model.DisplayModel; //导入依赖的package包/类
@Override
public void onSharedPreferenceChanged(SharedPreferences preferences, String key) {
if (SamplesApplication.SETTING_SCALE.equals(key)) {
this.mapView.getModel().displayModel.setUserScaleFactor(DisplayModel.getDefaultUserScaleFactor());
Log.d(SamplesApplication.TAG, "Tilesize now " + this.mapView.getModel().displayModel.getTileSize());
AndroidUtil.restartActivity(this);
}
if (SamplesApplication.SETTING_TILECACHE_PERSISTENCE.equals(key)) {
if (!preferences.getBoolean(SamplesApplication.SETTING_TILECACHE_PERSISTENCE, false)) {
Log.d(SamplesApplication.TAG, "Purging tile caches");
for (TileCache tileCache : this.tileCaches) {
tileCache.purge();
}
}
AndroidUtil.restartActivity(this);
}
if (SamplesApplication.SETTING_TEXTWIDTH.equals(key)) {
AndroidUtil.restartActivity(this);
}
if (SamplesApplication.SETTING_TILECACHE_QUEUESIZE.equals(key) || SamplesApplication.SETTING_TILECACHE_THREADING.equals(key)) {
AndroidUtil.restartActivity(this);
}
if (SETTING_SCALEBAR.equals(key)) {
setMapScaleBar();
}
if (SamplesApplication.SETTING_DEBUG_TIMING.equals(key)) {
MapWorker.DEBUG_TIMING = preferences.getBoolean(SamplesApplication.SETTING_DEBUG_TIMING, false);
}
if (SamplesApplication.SETTING_WAYFILTERING_DISTANCE.equals(key) ||
SamplesApplication.SETTING_WAYFILTERING.equals(key)) {
MapFile.wayFilterEnabled = preferences.getBoolean(SamplesApplication.SETTING_WAYFILTERING, true);
if (MapFile.wayFilterEnabled) {
MapFile.wayFilterDistance = Integer.parseInt(preferences.getString(SamplesApplication.SETTING_WAYFILTERING_DISTANCE, "20"));
}
}
}
示例12: onSharedPreferenceChanged
import org.mapsforge.map.model.DisplayModel; //导入依赖的package包/类
@Override
public void onSharedPreferenceChanged(SharedPreferences preferences,
String key) {
if (SamplesApplication.SETTING_SCALE.equals(key)) {
float userScaleFactor = DisplayModel.getDefaultUserScaleFactor();
float fs = Float.valueOf(preferences.getString(
SamplesApplication.SETTING_SCALE,
Float.toString(userScaleFactor)));
if (fs != userScaleFactor) {
DisplayModel.setDefaultUserScaleFactor(fs);
}
} else if (this.renderthemeOptions != null && this.renderthemeOptions.getId().equals(key)) {
createRenderthemeMenu();
}
}
示例13: OsmTilegenerator
import org.mapsforge.map.model.DisplayModel; //导入依赖的package包/类
public OsmTilegenerator( MapDataStore mapDatabase, final DatabaseRenderer renderer, final RenderThemeFuture renderTheme,
final DisplayModel displayModel, int tileSize ) {
this.mapDatabase = mapDatabase;
this.renderer = renderer;
this.theme = renderTheme;
this.model = displayModel;
this.tileSize = tileSize;
}
示例14: RasterJob
import org.mapsforge.map.model.DisplayModel; //导入依赖的package包/类
protected RasterJob(Tile pTile, DisplayModel pDisplayModel, final File pFile, boolean pHasAlpha) {
super(pTile, pHasAlpha);
this.mFile = pFile;
this.displayModel = pDisplayModel;
this.hashCodeValue = calculateHashCode();
}
示例15: createLayers
import org.mapsforge.map.model.DisplayModel; //导入依赖的package包/类
@Override
protected void createLayers() {
super.createLayers();
DisplayModel displayModel = this.mapView.getModel().displayModel;
Paint lineFront = Utils.createPaint(
AndroidGraphicFactory.INSTANCE.createColor(Color.BLACK),
(int) (2 * displayModel.getScaleFactor()),
Style.STROKE);
Paint lineBack = Utils.createPaint(
AndroidGraphicFactory.INSTANCE.createColor(Color.WHITE),
(int) (4 * displayModel.getScaleFactor()),
Style.STROKE);
Map<Byte, Double> spacingConfig = new HashMap<Byte, Double>(25);
spacingConfig.put((byte)(0), 10d);
spacingConfig.put((byte)(1), 10d);
spacingConfig.put((byte)(2), 10d);
spacingConfig.put((byte)(3), 10d);
spacingConfig.put((byte)(4), 5d);
spacingConfig.put((byte)(5), 2.5d);
spacingConfig.put((byte)(6), 2.5d);
spacingConfig.put((byte)(7), 1d);
spacingConfig.put((byte)(8), .5d);
spacingConfig.put((byte)(9), .5d);
spacingConfig.put((byte)(10), .2d);
spacingConfig.put((byte)(11), .1d);
spacingConfig.put((byte)(12), .1d);
spacingConfig.put((byte)(13), .05d);
spacingConfig.put((byte)(14), .02d);
spacingConfig.put((byte)(15), .01d);
spacingConfig.put((byte)(16), .01d);
spacingConfig.put((byte)(17), .005d);
spacingConfig.put((byte)(18), .002d);
spacingConfig.put((byte)(19), .001d);
spacingConfig.put((byte)(20), .0005d);
spacingConfig.put((byte)(21), .0002d);
spacingConfig.put((byte)(22), .0001d);
mapView.getLayerManager().getLayers().add(
new Grid(displayModel, spacingConfig,lineBack, lineFront));
}