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


Java Tile类代码示例

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


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

示例1: test_read

import org.mapsforge.core.model.Tile; //导入依赖的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

示例2: readBerlinMap

import org.mapsforge.core.model.Tile; //导入依赖的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

示例3: test_read

import org.mapsforge.core.model.Tile; //导入依赖的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

示例4: readBerlinMap

import org.mapsforge.core.model.Tile; //导入依赖的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

示例5: FileSystemTileCache

import org.mapsforge.core.model.Tile; //导入依赖的package包/类
/**
 * @param capacity
 *            the maximum number of entries in this cache.
 * @param mapViewId
 *            the ID of the MapView to separate caches for different MapViews.
 * @throws IllegalArgumentException
 *             if the capacity is negative.
 */
public FileSystemTileCache(int capacity, int mapViewId) {
	this.mapViewId = mapViewId;
	this.capacity = checkCapacity(capacity);

	if (this.capacity > 0 && this.cacheDirectory != null) {
		Map<MapGeneratorJob, File> deserializedMap = deserializeMap(this.cacheDirectory);
		if (deserializedMap == null) {
			this.map = createMap(this.capacity);
		} else {
			this.map = deserializedMap;
		}
		this.byteBuffer = ByteBuffer.allocate(TILE_SIZE_IN_BYTES);
		this.bitmapGet = Bitmap.createBitmap(Tile.TILE_SIZE, Tile.TILE_SIZE, Config.RGB_565);
	} else {
		this.byteBuffer = null;
		this.bitmapGet = null;
		this.map = createMap(0);
	}
}
 
开发者ID:DonTomika,项目名称:mapsforge,代码行数:28,代码来源:FileSystemTileCache.java

示例6: removeOutOfTileAreaLabels

import org.mapsforge.core.model.Tile; //导入依赖的package包/类
/**
 * This method removes the area labels, that are not visible in the actual tile.
 * 
 * @param areaLabels
 *            area Labels from the actual tile
 */
private void removeOutOfTileAreaLabels(List<PointTextContainer> areaLabels) {
	for (int i = 0; i < areaLabels.size(); i++) {
		this.label = areaLabels.get(i);

		if (this.label.x > Tile.TILE_SIZE) {
			areaLabels.remove(i);

			i--;
		} else if (this.label.y - this.label.boundary.height() > Tile.TILE_SIZE) {
			areaLabels.remove(i);

			i--;
		} else if (this.label.x + this.label.boundary.width() < 0.0f) {
			areaLabels.remove(i);

			i--;
		} else if (this.label.y + this.label.boundary.height() < 0.0f) {
			areaLabels.remove(i);

			i--;
		}
	}
}
 
开发者ID:DonTomika,项目名称:mapsforge,代码行数:30,代码来源:LabelPlacement.java

示例7: removeOutOfTileLabels

import org.mapsforge.core.model.Tile; //导入依赖的package包/类
/**
 * This method removes the labels, that are not visible in the actual tile.
 * 
 * @param labels
 *            Labels from the actual tile
 */
private void removeOutOfTileLabels(List<PointTextContainer> labels) {
	for (int i = 0; i < labels.size();) {
		this.label = labels.get(i);

		if (this.label.x - this.label.boundary.width() / 2 > Tile.TILE_SIZE) {
			labels.remove(i);
			this.label = null;
		} else if (this.label.y - this.label.boundary.height() > Tile.TILE_SIZE) {
			labels.remove(i);
			this.label = null;
		} else if ((this.label.x - this.label.boundary.width() / 2 + this.label.boundary.width()) < 0.0f) {
			labels.remove(i);
			this.label = null;
		} else if (this.label.y < 0.0f) {
			labels.remove(i);
			this.label = null;
		} else {
			i++;
		}
	}
}
 
开发者ID:DonTomika,项目名称:mapsforge,代码行数:28,代码来源:LabelPlacement.java

示例8: removeOutOfTileSymbols

import org.mapsforge.core.model.Tile; //导入依赖的package包/类
/**
 * This method removes the Symbols, that are not visible in the actual tile.
 * 
 * @param symbols
 *            Symbols from the actual tile
 */
private void removeOutOfTileSymbols(List<SymbolContainer> symbols) {
	for (int i = 0; i < symbols.size();) {
		this.symbolContainer = symbols.get(i);

		if (this.symbolContainer.point.x > Tile.TILE_SIZE) {
			symbols.remove(i);
		} else if (this.symbolContainer.point.y > Tile.TILE_SIZE) {
			symbols.remove(i);
		} else if (this.symbolContainer.point.x + this.symbolContainer.symbol.getWidth() < 0.0f) {
			symbols.remove(i);
		} else if (this.symbolContainer.point.y + this.symbolContainer.symbol.getHeight() < 0.0f) {
			symbols.remove(i);
		} else {
			i++;
		}
	}
}
 
开发者ID:DonTomika,项目名称:mapsforge,代码行数:24,代码来源:LabelPlacement.java

示例9: calculateTileBitmask

import org.mapsforge.core.model.Tile; //导入依赖的package包/类
static int calculateTileBitmask(Tile tile, int zoomLevelDifference) {
	if (zoomLevelDifference == 1) {
		return getFirstLevelTileBitmask(tile);
	}

	// calculate the XY numbers of the second level sub-tile
	long subtileX = tile.tileX >>> (zoomLevelDifference - 2);
	long subtileY = tile.tileY >>> (zoomLevelDifference - 2);

	// calculate the XY numbers of the parent tile
	long parentTileX = subtileX >>> 1;
	long parentTileY = subtileY >>> 1;

	// determine the correct bitmask for all 16 sub-tiles
	if (parentTileX % 2 == 0 && parentTileY % 2 == 0) {
		return getSecondLevelTileBitmaskUpperLeft(subtileX, subtileY);
	} else if (parentTileX % 2 == 1 && parentTileY % 2 == 0) {
		return getSecondLevelTileBitmaskUpperRight(subtileX, subtileY);
	} else if (parentTileX % 2 == 0 && parentTileY % 2 == 1) {
		return getSecondLevelTileBitmaskLowerLeft(subtileX, subtileY);
	} else {
		return getSecondLevelTileBitmaskLowerRight(subtileX, subtileY);
	}
}
 
开发者ID:DonTomika,项目名称:mapsforge,代码行数:25,代码来源:QueryCalculations.java

示例10: readMapData

import org.mapsforge.core.model.Tile; //导入依赖的package包/类
/**
 * Reads all map data for the area covered by the given tile at the tile zoom level.
 * 
 * @param tile
 *            defines area and zoom level of read map data.
 * @return the read map data.
 */
public MapReadResult readMapData(Tile tile) {
	try {
		prepareExecution();
		QueryParameters queryParameters = new QueryParameters();
		queryParameters.queryZoomLevel = this.mapFileHeader.getQueryZoomLevel(tile.zoomLevel);

		// get and check the sub-file for the query zoom level
		SubFileParameter subFileParameter = this.mapFileHeader.getSubFileParameter(queryParameters.queryZoomLevel);
		if (subFileParameter == null) {
			LOGGER.warning("no sub-file for zoom level: " + queryParameters.queryZoomLevel);
			return null;
		}

		QueryCalculations.calculateBaseTiles(queryParameters, tile, subFileParameter);
		QueryCalculations.calculateBlocks(queryParameters, subFileParameter);

		return processBlocks(queryParameters, subFileParameter);
	} catch (IOException e) {
		LOGGER.log(Level.SEVERE, null, e);
		return null;
	}
}
 
开发者ID:DonTomika,项目名称:mapsforge,代码行数:30,代码来源:MapDatabase.java

示例11: executeQueryTest

import org.mapsforge.core.model.Tile; //导入依赖的package包/类
@Test
public void executeQueryTest() {
	MapDatabase mapDatabase = new MapDatabase();
	FileOpenResult fileOpenResult = mapDatabase.openFile(MAP_FILE);
	Assert.assertTrue(fileOpenResult.getErrorMessage(), mapDatabase.hasOpenFile());
	Assert.assertTrue(fileOpenResult.getErrorMessage(), fileOpenResult.isSuccess());

	for (byte zoomLevel = 0; zoomLevel <= ZOOM_LEVEL_MAX; ++zoomLevel) {
		long tileX = MercatorProjection.longitudeToTileX(1, zoomLevel);
		long tileY = MercatorProjection.latitudeToTileY(1, zoomLevel);
		Tile tile = new Tile(tileX, tileY, zoomLevel);

		MapReadResult mapReadResult = mapDatabase.readMapData(tile);

		Assert.assertTrue(mapReadResult.pointOfInterests.isEmpty());
		Assert.assertTrue(mapReadResult.ways.isEmpty());
	}

	mapDatabase.closeFile();
	Assert.assertFalse(mapDatabase.hasOpenFile());
}
 
开发者ID:DonTomika,项目名称:mapsforge,代码行数:22,代码来源:MapDatabaseEmptyTest.java

示例12: runTest

import org.mapsforge.core.model.Tile; //导入依赖的package包/类
static void runTest(File mapFile) {
	MapDatabase mapDatabase = new MapDatabase();
	FileOpenResult fileOpenResult = mapDatabase.openFile(mapFile);
	Assert.assertTrue(fileOpenResult.getErrorMessage(), fileOpenResult.isSuccess());

	long tileX = MercatorProjection.longitudeToTileX(0, ZOOM_LEVEL);
	long tileY = MercatorProjection.latitudeToTileY(0, ZOOM_LEVEL);
	Tile tile = new Tile(tileX, tileY, ZOOM_LEVEL);

	MapReadResult mapReadResult = mapDatabase.readMapData(tile);
	mapDatabase.closeFile();

	Assert.assertTrue(mapReadResult.pointOfInterests.isEmpty());
	Assert.assertEquals(1, mapReadResult.ways.size());

	GeoPoint geoPoint1 = new GeoPoint(0.0, 0.0);
	GeoPoint geoPoint2 = new GeoPoint(0.0, 0.1);
	GeoPoint geoPoint3 = new GeoPoint(-0.1, 0.1);
	GeoPoint geoPoint4 = new GeoPoint(-0.1, 0.0);
	GeoPoint[][] geoPointsExpected = new GeoPoint[][] { { geoPoint1, geoPoint2, geoPoint3, geoPoint4, geoPoint1 } };

	Way way = mapReadResult.ways.get(0);
	Assert.assertArrayEquals(geoPointsExpected, way.geoPoints);
}
 
开发者ID:DonTomika,项目名称:mapsforge,代码行数:25,代码来源:EncodingTest.java

示例13: getImage

import org.mapsforge.core.model.Tile; //导入依赖的package包/类
public synchronized BufferedImage getImage( final int zoomLevel, final int xTile, final int yTile ) {
    try {
        Tile tile = new Tile(xTile, yTile, (byte) zoomLevel, tileSize);
        // displayModel.setFixedTileSize(tileSize);
        // Draw the tile
        float userScaleFactor = model.getUserScaleFactor();
        RendererJob mapGeneratorJob = new RendererJob(tile, mapDatabase, theme, model, userScaleFactor, false, false);
        AwtTileBitmap bmp = (AwtTileBitmap) renderer.executeJob(mapGeneratorJob);
        if (bmp != null) {
            BufferedImage bitmap = AwtGraphicFactory.getBitmap(bmp);
            return bitmap;
        }
    } catch (Exception e) {
        // e.printStackTrace();
        // will try again later
        System.err.println(
                "Not rendering tile: " + zoomLevel + "/" + xTile + "/" + yTile + "  (" + e.getLocalizedMessage() + ")");
    }
    return null;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:21,代码来源:OsmTilegenerator.java

示例14: getTilePath

import org.mapsforge.core.model.Tile; //导入依赖的package包/类
public String getTilePath( Tile tile ) {
    int zoomLevel = tile.zoomLevel;
    int tileX = (int) tile.tileX;
    int tileY = (int) tile.tileY;

    String tmpTilePart = tilePart.replaceFirst("\\?", String.valueOf(zoomLevel)); //$NON-NLS-1$
    tmpTilePart = tmpTilePart.replaceFirst("\\?", String.valueOf(tileX)); //$NON-NLS-1$
    tmpTilePart = tmpTilePart.replaceFirst("\\?", String.valueOf(tileY)); //$NON-NLS-1$

    return tmpTilePart;
}
 
开发者ID:GitHubDroid,项目名称:geodroid_master_update,代码行数:12,代码来源:GeopackageTileDownloader.java

示例15: getTile

import org.mapsforge.core.model.Tile; //导入依赖的package包/类
public Bitmap getTile(Tile tile) throws OutOfMemoryError
{
	org.mapsforge.core.graphics.Bitmap bitmap = loadTile(tile);
	Bitmap tileBitmap = null;
	if (bitmap != null)
		tileBitmap = AndroidGraphicFactory.getBitmap(bitmap);

	if (tileBitmap == null)
		tileBitmap = generateTile(tile);

	if (tileBitmap != null)
	{
		if (dynZoom != 1.0)
		{
			int ss = (int) (dynZoom * tileSize);
			tileBitmap = Bitmap.createScaledBitmap(tileBitmap, ss, ss, true);
		}
	}
	return tileBitmap;
}
 
开发者ID:andreynovikov,项目名称:Androzic,代码行数:21,代码来源:ForgeMap.java


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