本文整理汇总了Java中org.mapsforge.map.reader.header.MapFileInfo类的典型用法代码示例。如果您正苦于以下问题:Java MapFileInfo类的具体用法?Java MapFileInfo怎么用?Java MapFileInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MapFileInfo类属于org.mapsforge.map.reader.header包,在下文中一共展示了MapFileInfo类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getCenterForMapsforgeFile
import org.mapsforge.map.reader.header.MapFileInfo; //导入依赖的package包/类
public MapPosition getCenterForMapsforgeFile(final String filePath){
final File file = new File(filePath);
Log.i(SupportedType.class.getSimpleName(), "Map file is " + file.getAbsolutePath()+ " file exists "+Boolean.toString(file.exists()));
final String fileName = filePath.substring(filePath.lastIndexOf("/") + 1);
MapDatabase mapDatabase = new MapDatabase();
final FileOpenResult result = mapDatabase.openFile(file);
if (result.isSuccess()) {
final MapFileInfo mapFileInfo = mapDatabase.getMapFileInfo();
if (mapFileInfo != null && mapFileInfo.startPosition != null) {
return new MapPosition(mapFileInfo.startPosition, mapFileInfo.startZoomLevel != null ? mapFileInfo.startZoomLevel : 8);
} else if(mapFileInfo != null){
final LatLong center = mapFileInfo.boundingBox.getCenterPoint();
if(center != null){
return new MapPosition(center, mapFileInfo.startZoomLevel != null ? mapFileInfo.startZoomLevel : 8);
}else{
Log.e(SupportedType.class.getSimpleName(), "could not retrieve bounding box center position for "+fileName);
}
}else{
Log.e(SupportedType.class.getSimpleName(), "could not retrieve map start position for "+fileName);
return new MapPosition(new LatLong(0,0),(byte) 8);
}
}
throw new IllegalArgumentException("Invalid Map File " + fileName);
}
开发者ID:RoProducts,项目名称:rastertheque,代码行数:26,代码来源:MainActivity.java
示例2: getInitialPosition
import org.mapsforge.map.reader.header.MapFileInfo; //导入依赖的package包/类
protected MapPosition getInitialPosition() {
MapDatabase mapDatabase = new MapDatabase();
final FileOpenResult result = mapDatabase.openFile(getMapFile());
if (result.isSuccess()) {
final MapFileInfo mapFileInfo = mapDatabase.getMapFileInfo();
if (mapFileInfo != null && mapFileInfo.startPosition != null) {
return new MapPosition(mapFileInfo.startPosition,
(byte) mapFileInfo.startZoomLevel);
} else {
return new MapPosition(new LatLong(27.517037, 85.38886),
(byte) 12);
}
}
throw new IllegalArgumentException("Invalid Map File "
+ getMapFileName());
}
开发者ID:nirabpudasaini,项目名称:Mero-Bhada-Meter,代码行数:17,代码来源:OfflineMapActivity.java
示例3: getStartPoint
import org.mapsforge.map.reader.header.MapFileInfo; //导入依赖的package包/类
/**
* @return the start point (may be null).
*/
public GeoPoint getStartPoint() {
if (this.mapDatabase != null && this.mapDatabase.hasOpenFile()) {
MapFileInfo mapFileInfo = this.mapDatabase.getMapFileInfo();
if (mapFileInfo.startPosition != null) {
return mapFileInfo.startPosition;
}
return mapFileInfo.boundingBox.getCenterPoint();
}
return null;
}
开发者ID:DonTomika,项目名称:mapsforge,代码行数:15,代码来源:DatabaseRenderer.java
示例4: getStartZoomLevel
import org.mapsforge.map.reader.header.MapFileInfo; //导入依赖的package包/类
/**
* @return the start zoom level (may be null).
*/
public Byte getStartZoomLevel() {
if (this.mapDatabase != null && this.mapDatabase.hasOpenFile()) {
MapFileInfo mapFileInfo = this.mapDatabase.getMapFileInfo();
if (mapFileInfo.startZoomLevel != null) {
return mapFileInfo.startZoomLevel;
}
}
return DEFAULT_START_ZOOM_LEVEL;
}
开发者ID:DonTomika,项目名称:mapsforge,代码行数:14,代码来源:DatabaseRenderer.java
示例5: getMapFileInfo
import org.mapsforge.map.reader.header.MapFileInfo; //导入依赖的package包/类
/**
* @return the metadata for the current map file.
* @throws IllegalStateException
* if no map is currently opened.
*/
public MapFileInfo getMapFileInfo() {
if (this.mapFileHeader == null) {
throw new IllegalStateException("no map file is currently opened");
}
return this.mapFileHeader.getMapFileInfo();
}
开发者ID:DonTomika,项目名称:mapsforge,代码行数:12,代码来源:MapDatabase.java
示例6: executeQueryTest
import org.mapsforge.map.reader.header.MapFileInfo; //导入依赖的package包/类
@Test
public void executeQueryTest() {
MapDatabase mapDatabase = new MapDatabase();
FileOpenResult fileOpenResult = mapDatabase.openFile(MAP_FILE);
Assert.assertTrue(mapDatabase.hasOpenFile());
Assert.assertTrue(fileOpenResult.getErrorMessage(), fileOpenResult.isSuccess());
MapFileInfo mapFileInfo = mapDatabase.getMapFileInfo();
Assert.assertTrue(mapFileInfo.debugFile);
for (byte zoomLevel = ZOOM_LEVEL_MIN; zoomLevel <= ZOOM_LEVEL_MAX; ++zoomLevel) {
long tileX = MercatorProjection.longitudeToTileX(0.04, zoomLevel);
long tileY = MercatorProjection.latitudeToTileY(0.04, zoomLevel);
Tile tile = new Tile(tileX, tileY, zoomLevel);
MapReadResult mapReadResult = mapDatabase.readMapData(tile);
Assert.assertEquals(1, mapReadResult.pointOfInterests.size());
Assert.assertEquals(1, mapReadResult.ways.size());
checkPointOfInterest(mapReadResult.pointOfInterests.get(0));
checkWay(mapReadResult.ways.get(0));
}
mapDatabase.closeFile();
Assert.assertFalse(mapDatabase.hasOpenFile());
}
开发者ID:DonTomika,项目名称:mapsforge,代码行数:28,代码来源:MapDatabaseWithDataTest.java
示例7: getMapFileInfoTest
import org.mapsforge.map.reader.header.MapFileInfo; //导入依赖的package包/类
@Test
public void getMapFileInfoTest() {
MapDatabase mapDatabase = new MapDatabase();
FileOpenResult fileOpenResult = mapDatabase.openFile(MAP_FILE);
Assert.assertTrue(fileOpenResult.getErrorMessage(), fileOpenResult.isSuccess());
MapFileInfo mapFileInfo = mapDatabase.getMapFileInfo();
mapDatabase.closeFile();
Assert.assertTrue(fileOpenResult.getErrorMessage(), fileOpenResult.isSuccess());
Assert.assertNull(fileOpenResult.getErrorMessage());
Assert.assertEquals(BOUNDING_BOX, mapFileInfo.boundingBox);
Assert.assertEquals(FILE_SIZE, mapFileInfo.fileSize);
Assert.assertEquals(FILE_VERSION, mapFileInfo.fileVersion);
Assert.assertEquals(MAP_DATE, mapFileInfo.mapDate);
Assert.assertEquals(NUMBER_OF_SUBFILES, mapFileInfo.numberOfSubFiles);
Assert.assertEquals(PROJECTION_NAME, mapFileInfo.projectionName);
Assert.assertEquals(TILE_PIXEL_SIZE, mapFileInfo.tilePixelSize);
Assert.assertEquals(0, mapFileInfo.poiTags.length);
Assert.assertEquals(0, mapFileInfo.wayTags.length);
Assert.assertFalse(mapFileInfo.debugFile);
Assert.assertEquals(START_POSITION, mapFileInfo.startPosition);
Assert.assertEquals(START_ZOOM_LEVEL, mapFileInfo.startZoomLevel);
Assert.assertEquals(LANGUAGE_PREFERENCE, mapFileInfo.languagePreference);
Assert.assertEquals(COMMENT, mapFileInfo.comment);
Assert.assertEquals(CREATED_BY, mapFileInfo.createdBy);
}
开发者ID:DonTomika,项目名称:mapsforge,代码行数:31,代码来源:MapDatabaseFileHeaderTest.java
示例8: onOptionsItemSelected
import org.mapsforge.map.reader.header.MapFileInfo; //导入依赖的package包/类
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.menu_info:
return true;
case R.id.menu_info_map_file:
showDialog(DIALOG_INFO_MAP_FILE);
return true;
case R.id.menu_info_about:
startActivity(new Intent(this, InfoView.class));
return true;
case R.id.menu_position:
return true;
case R.id.menu_position_my_location_enable:
enableShowMyLocation(true);
return true;
case R.id.menu_position_my_location_disable:
disableShowMyLocation();
return true;
case R.id.menu_position_last_known:
gotoLastKnownPosition();
return true;
case R.id.menu_position_enter_coordinates:
showDialog(DIALOG_ENTER_COORDINATES);
return true;
case R.id.menu_position_map_center:
// disable GPS follow mode if it is enabled
disableSnapToLocation(true);
MapFileInfo mapFileInfo = this.mapView.getMapDatabase().getMapFileInfo();
this.mapView.getMapViewPosition().setCenter(mapFileInfo.boundingBox.getCenterPoint());
return true;
case R.id.menu_screenshot:
return true;
case R.id.menu_screenshot_jpeg:
this.screenshotCapturer.captureScreenshot(CompressFormat.JPEG);
return true;
case R.id.menu_screenshot_png:
this.screenshotCapturer.captureScreenshot(CompressFormat.PNG);
return true;
case R.id.menu_preferences:
startActivity(new Intent(this, EditPreferences.class));
return true;
case R.id.menu_render_theme:
return true;
case R.id.menu_render_theme_osmarender:
this.mapView.setRenderTheme(InternalRenderTheme.OSMARENDER);
return true;
case R.id.menu_render_theme_select_file:
startRenderThemePicker();
return true;
case R.id.menu_mapfile:
startMapFilePicker();
return true;
default:
return false;
}
}
开发者ID:DonTomika,项目名称:mapsforge,代码行数:75,代码来源:AdvancedMapViewer.java
示例9: checkCenterLocation
import org.mapsforge.map.reader.header.MapFileInfo; //导入依赖的package包/类
/**
* Function to check and correct bounds / zoom level [for 'Map-Files only']
*
* @param mapCenterLocation [point/zoom to check] result of PositionUtilities.getMapCenterFromPreferences(preferences,true,true);
* @param doCorrectIfOutOfRange if <code>true</code>, change mapCenterLocation values if out of range.
* @return 0=inside valid area/zoom ; i_rc > 0 outside area or zoom ; i_parm=0 no corrections ; 1= correct tileBounds values.
*/
public int checkCenterLocation( double[] mapCenterLocation, boolean doCorrectIfOutOfRange ) {
/*
* mj10777: i_rc=0=inside valid area/zoom ; i_rc > 0 outside area or zoom ;
* i_parm=0 no corrections ; 1= correct mapCenterLocation values.
*/
int i_rc = 0; // inside area
// MapDatabase().openFile(File).getMapFileInfo()
if (this.mapView.getMapDatabase() == null)
return 100; // supported only with map files
MapFileInfo mapFileInfo = this.mapView.getMapDatabase().getMapFileInfo();
double bounds_west = (double) (mapFileInfo.boundingBox.getMinLongitude());
double bounds_south = (double) (mapFileInfo.boundingBox.getMinLatitude());
double bounds_east = (double) (mapFileInfo.boundingBox.getMaxLongitude());
double bounds_north = (double) (mapFileInfo.boundingBox.getMaxLatitude());
double centerX = mapFileInfo.boundingBox.getCenterPoint().getLongitude();
double centerY = mapFileInfo.boundingBox.getCenterPoint().getLatitude();
int maxZoom = this.mapView.getMapZoomControls().getZoomLevelMax();
int minZoom = this.mapView.getMapZoomControls().getZoomLevelMin();
// SpatialDatabasesManager.app_log(-1,"MapActivity.checkCenterLocation: center_location[x="+mapCenterLocation[0]+" ; y="+mapCenterLocation[1]+" ; z="+mapCenterLocation[2]+"] bbox=["+bounds_west+","+bounds_south+","+bounds_east+","+bounds_north+"]");
if (((mapCenterLocation[0] < bounds_west) || (mapCenterLocation[0] > bounds_east))
|| ((mapCenterLocation[1] < bounds_south) || (mapCenterLocation[1] > bounds_north))
|| ((mapCenterLocation[2] < minZoom) || (mapCenterLocation[2] > maxZoom))) {
if (((mapCenterLocation[0] >= bounds_west) && (mapCenterLocation[0] <= bounds_east))
&& ((mapCenterLocation[1] >= bounds_south) && (mapCenterLocation[1] <= bounds_north))) {
/*
* We are inside the Map-Area, but Zoom is not correct
*/
if (mapCenterLocation[2] < minZoom) {
i_rc = 1;
if (doCorrectIfOutOfRange) {
mapCenterLocation[2] = minZoom;
}
}
if (mapCenterLocation[2] > maxZoom) {
i_rc = 2;
if (doCorrectIfOutOfRange) {
mapCenterLocation[2] = maxZoom;
}
}
} else {
if (mapCenterLocation[2] < minZoom) {
i_rc = 11;
if (doCorrectIfOutOfRange) {
mapCenterLocation[2] = minZoom;
}
}
if (mapCenterLocation[2] > maxZoom) {
i_rc = 12;
if (doCorrectIfOutOfRange) {
mapCenterLocation[2] = maxZoom;
}
}
if ((mapCenterLocation[0] < bounds_west) || (mapCenterLocation[0] > bounds_east)) {
i_rc = 13;
if (doCorrectIfOutOfRange) {
mapCenterLocation[0] = centerX;
}
}
if ((mapCenterLocation[1] < bounds_south) || (mapCenterLocation[1] > bounds_north)) {
i_rc = 14;
if (doCorrectIfOutOfRange) {
mapCenterLocation[1] = centerY;
}
}
}
}
return i_rc;
}
开发者ID:GitHubDroid,项目名称:geodroid_master_update,代码行数:76,代码来源:MapsActivity.java
注:本文中的org.mapsforge.map.reader.header.MapFileInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论