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


Java MapFile类代码示例

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


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

示例1: MapsforgeTileSource

import org.mapsforge.map.reader.MapFile; //导入依赖的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();

    }
 
开发者ID:typebrook,项目名称:FiveMinsMore,代码行数:32,代码来源:MapsforgeTileSource.java

示例2: onCreate

import org.mapsforge.map.reader.MapFile; //导入依赖的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);
}
 
开发者ID:lienching,项目名称:MapsforgeSample,代码行数:19,代码来源:SimpleMapView.java

示例3: test_read

import org.mapsforge.map.reader.MapFile; //导入依赖的package包/类
public void test_read() {

        initialTestTileList();


        //inital mapsforge reader
        File mapFile = new File(CONSTANTS.RESOURCE + "map-Berlin.map");
        MapFile re = new MapFile(mapFile);

        int count =0;
        for (Tile tile : testTileList) {
            MapReadResult result = re.readMapData(tile);
            assertFalse("Map result must have a way! result ("+ count +") has no ways", result.ways.isEmpty());
            count++;
        }

    }
 
开发者ID:Longri,项目名称:CB_MAP,代码行数:18,代码来源:Read_CB_MAP.java

示例4: readBerlinMap

import org.mapsforge.map.reader.MapFile; //导入依赖的package包/类
public static void readBerlinMap() {

        initialTestTileList();

        //inital mapsforge reader
        File mapFile = new File(CONSTANTS.RESOURCE + "map-Berlin.map");
        MapFile re = new MapFile(mapFile);

        int count =0;
        for (Tile tile : testTileList) {
            MapReadResult result = re.readMapData(tile);
            count+=result.ways.size();
        }

        System.out.println(count + " ways read");

    }
 
开发者ID:Longri,项目名称:CB_MAP,代码行数:18,代码来源:Read_CB_MAP.java

示例5: test_read

import org.mapsforge.map.reader.MapFile; //导入依赖的package包/类
public void test_read() {

        initialTestTileList();


        //inital mapsforge reader
        File mapFile = new File(CONSTANTS.RESOURCE + "berlin.map");
        org.mapsforge.map.reader.MapFile re = new MapFile(mapFile);

        int count =0;
        for (Tile tile : testTileList) {
            MapReadResult result = re.readMapData(tile);
            assertFalse("Map result must have a way! result ("+ count +") has no ways", result.ways.isEmpty());
            count++;
        }

    }
 
开发者ID:Longri,项目名称:CB_MAP,代码行数:18,代码来源:Read_Mapsforge.java

示例6: readBerlinMap

import org.mapsforge.map.reader.MapFile; //导入依赖的package包/类
public static void readBerlinMap() {

        initialTestTileList();

        //inital mapsforge reader
        File mapFile = new File(CONSTANTS.RESOURCE + "berlin.map");
        org.mapsforge.map.reader.MapFile re = new MapFile(mapFile);

        int count =0;
        for (Tile tile : testTileList) {
            MapReadResult result = re.readMapData(tile);
            count+=result.ways.size();
        }

        System.out.println(count + " ways read");

    }
 
开发者ID:Longri,项目名称:CB_MAP,代码行数:18,代码来源:Read_Mapsforge.java

示例7: getMapFile

import org.mapsforge.map.reader.MapFile; //导入依赖的package包/类
/**
 * Opens map file
 * @param context
 * @return map file, null if file not found or error while opening map file
 */
public static MapFile getMapFile(final Context context) {
	final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
	File file = new File(FileUtils.getMapFolder(context).getAbsolutePath(),
			prefs.getString(Preferences.KEY_MAP_FILE, Preferences.VAL_MAP_FILE));

	if (file.exists()) {
		try {
			return new MapFile(file);
		} catch (MapFileException mfe) {
			Toast.makeText(context,
						   context.getString(R.string.failed_to_load_map_file_can_be_damaged),
						   Toast.LENGTH_SHORT).show();
			Log.e(TAG, "Failed to load map, file can be damaged " + mfe.getMessage(), mfe);
			return null;
		}
	} else {
		Log.e(TAG, "Map file doesn't exist");
		return null;
	}
}
 
开发者ID:openbmap,项目名称:radiocells-scanner-android,代码行数:26,代码来源:MapUtils.java

示例8: getInitialPosition

import org.mapsforge.map.reader.MapFile; //导入依赖的package包/类
private MapPosition getInitialPosition() {
    File mapFile = getMapFile();
    MapDataStore mapDataStore = new MapFile(mapFile);

    final LatLong uniteich = new LatLong(48.33706, 14.31960);
    final byte zoomLevel = (byte) Math.max(Math.min(DEFAULT_ZOOM_LEVEL /*mapDataStore.startZoomLevel()*/, MAX_ZOOM_LEVEL), MIN_ZOOM_LEVEL);

    if (mapDataStore.boundingBox().contains(uniteich)) {
        // Insel im Uniteich
        return new MapPosition(uniteich, zoomLevel);
    } else if (mapDataStore.startPosition() != null &&
            mapDataStore.boundingBox().contains(mapDataStore.startPosition())) {
        // given start position, zoom in range
        return new MapPosition(mapDataStore.startPosition(), zoomLevel);
    } else {
        // center of the map
        return new MapPosition(
                mapDataStore.boundingBox().getCenterPoint(),
                zoomLevel);
    }
}
 
开发者ID:marunjar,项目名称:anewjkuapp,代码行数:22,代码来源:MapFragment.java

示例9: onCreate

import org.mapsforge.map.reader.MapFile; //导入依赖的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);
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:23,代码来源:SamplesApplication.java

示例10: getMapFile2

import org.mapsforge.map.reader.MapFile; //导入依赖的package包/类
/**
 * @return the map file for the second view
 */
protected MapFile getMapFile2() {
	return new MapFile(new File(new File("/storage/sdcard1"), this.getMapFileName2()));
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:7,代码来源:TwoMaps.java

示例11: onStart

import org.mapsforge.map.reader.MapFile; //导入依赖的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);
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:27,代码来源:Map.java

示例12: onStart

import org.mapsforge.map.reader.MapFile; //导入依赖的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));
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:26,代码来源:Map.java

示例13: onStart

import org.mapsforge.map.reader.MapFile; //导入依赖的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);
}
 
开发者ID:emdete,项目名称:Simplicissimus,代码行数:19,代码来源:Map.java

示例14: getMapFile

import org.mapsforge.map.reader.MapFile; //导入依赖的package包/类
/**
 * Opens map file
 * @param context
 * @return
 * @throws IOException 
 */
public static MapFile getMapFile(final Context context) {
	final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
	File file = new File(prefs.getString(Preferences.KEY_MAP_FOLDER,
			context.getExternalFilesDir(null).getAbsolutePath() + File.separator + Preferences.MAPS_SUBDIR), 
			prefs.getString(Preferences.KEY_MAP_FILE, Preferences.VAL_MAP_FILE));
	
	if (file.exists()) {
		return new MapFile(file);
	} else { 
		Log.e(TAG, "Map file doesn't exist");
		return null;
	}
}
 
开发者ID:saintbyte,项目名称:openbmap,代码行数:20,代码来源:MapUtils.java

示例15: createTileRendererLayer

import org.mapsforge.map.reader.MapFile; //导入依赖的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;
}
 
开发者ID:ianmalcolm,项目名称:DeadReckoning,代码行数:10,代码来源:MainFrame.java


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