當前位置: 首頁>>代碼示例>>Java>>正文


Java TileCode類代碼示例

本文整理匯總了Java中org.geomajas.layer.tile.TileCode的典型用法代碼示例。如果您正苦於以下問題:Java TileCode類的具體用法?Java TileCode怎麽用?Java TileCode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


TileCode類屬於org.geomajas.layer.tile包,在下文中一共展示了TileCode類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: applyConnectedOnce

import org.geomajas.layer.tile.TileCode; //導入依賴的package包/類
/**
 * Execute a {@link TileFunction} in this tile and all connected tiles. Only tiles which are not yet included in
 * updatedTiles are processed. Tiles are added in updatedTiles when processed. If these connected tiles are not yet
 * part of the cache, then they will be fetched before applying the {@link TileFunction} on them.
 * 
 * @param filter A filter that needs to be used in case connected tile need to be fetched.
 * @param callback The {@link TileFunction} to execute on the connected tiles.
 * @param updatedTiles list of already processed tiles to assure tiles are only processed once
 */
public void applyConnectedOnce(final String filter, final TileFunction<VectorTile> callback,
		final Map<String, VectorTile> updatedTiles) {
	apply(filter, new TileFunction<VectorTile>() {

		public void execute(VectorTile tile) {
			updatedTiles.put(tile.getCode().toString(), tile);
			callback.execute(tile);
			List<TileCode> tileCodes = tile.getCodes();
			for (TileCode tileCode : tileCodes) {
				if (!updatedTiles.containsKey(tileCode.toString())) {
					VectorTile temp = tile.cache.addTile(tileCode);
					updatedTiles.put(tileCode.toString(), temp);
					temp.apply(filter, callback);
				}
			}
		}
	});
}
 
開發者ID:geomajas,項目名稱:geomajas-project-client-gwt,代碼行數:28,代碼來源:VectorTile.java

示例2: getTiles

import org.geomajas.layer.tile.TileCode; //導入依賴的package包/類
/**
 * Update showing state.
 *
 * @param fireEvents Should events be fired if state changes?
 */
/*protected void updateShowing(boolean fireEvents) {
	//setShowing(isVisible());
	// don't do anything?
} */


private List<Tile> getTiles(WmsLayer wmsLayer, double resolution, org.geomajas.geometry.Bbox worldBounds) {
		TileConfiguration tileConfig = wmsLayer.getTileConfiguration();
		List<org.geomajas.gwt2.client.map.render.TileCode> codes = TileService.getTileCodesForBounds(tileConfig,
				worldBounds, resolution);
		List<Tile> tiles = new ArrayList<Tile>();
		if (!codes.isEmpty()) {
			double actualResolution = tileConfig.getResolution(codes.get(0).getTileLevel());
			for (org.geomajas.gwt2.client.map.render.TileCode code : codes) {
				org.geomajas.geometry.Bbox bounds = TileService.getWorldBoundsForTile(tileConfig, code);
				Tile tile = new Tile(getScreenBounds(actualResolution, bounds));
				tile.setCode(code);
				tile.setUrl(WmsClient.getInstance().getWmsService().getMapUrl(wmsLayer.getConfiguration(),
						bounds, tileConfig.getTileWidth(), tileConfig.getTileHeight()));
				tiles.add(tile);
			}
		}
		return tiles;
	}
 
開發者ID:geomajas,項目名稱:geomajas-project-client-gwt,代碼行數:30,代碼來源:InternalClientWmsLayer.java

示例3: getTiles

import org.geomajas.layer.tile.TileCode; //導入依賴的package包/類
private List<Tile> getTiles(WmsLayer layer, String crs, double resolution, Bbox worldBounds) {
	TileConfiguration tileConfig = layer.getTileConfiguration();
	Bbox maxBounds = layer.getMaxBounds();
	worldBounds = BboxService.intersection(worldBounds, maxBounds);
	List<Tile> tiles = new ArrayList<Tile>();
	if (worldBounds != null) {
		List<org.geomajas.gwt2.client.map.render.TileCode> codes = TileService.getTileCodesForBounds(tileConfig,
				worldBounds, resolution);
		if (!codes.isEmpty()) {
			double actualResolution = tileConfig.getResolution(codes.get(0).getTileLevel());
			for (org.geomajas.gwt2.client.map.render.TileCode code : codes) {
				Bbox bounds = TileService.getWorldBoundsForTile(tileConfig, code);
				Tile tile = new Tile(getScreenBounds(actualResolution, bounds));
				tile.setCode(code);
				tile.setUrl(WmsClient.getInstance().getWmsService().getMapUrl(layer.getConfiguration(),
						bounds, tileConfig.getTileWidth(), tileConfig.getTileHeight()));
				tiles.add(tile);
			}
		}
	}
	return tiles;
}
 
開發者ID:geomajas,項目名稱:geomajas-project-client-gwt2,代碼行數:23,代碼來源:WmsLayerBuilder.java

示例4: getTiles

import org.geomajas.layer.tile.TileCode; //導入依賴的package包/類
private List<Tile> getTiles(AbstractTileBasedLayer layer, String crs, double resolution, Bbox worldBounds) {
	TileConfiguration tileConfig = layer.getTileConfiguration();
	Bbox maxBounds = layer.getMaxBounds();
	worldBounds = BboxService.intersection(worldBounds, maxBounds);
	List<Tile> tiles = new ArrayList<Tile>();
	if (worldBounds != null) {
		List<org.geomajas.gwt2.client.map.render.TileCode> codes = TileService.getTileCodesForBounds(tileConfig,
				worldBounds, resolution);
		if (!codes.isEmpty()) {
			double actualResolution = tileConfig.getResolution(codes.get(0).getTileLevel());
			for (org.geomajas.gwt2.client.map.render.TileCode code : codes) {
				Bbox bounds = TileService.getWorldBoundsForTile(tileConfig, code);
				Tile tile = new Tile(getScreenBounds(actualResolution, bounds));
				tile.setCode(code);
				TileRenderer tileRenderer = layer.getTileRenderer();
				tile.setUrl(tileRenderer.getUrl(code));
				tiles.add(tile);
			}
		}
	}
	return tiles;
}
 
開發者ID:geomajas,項目名稱:geomajas-project-client-gwt2,代碼行數:23,代碼來源:TileBasedLayerBuilder.java

示例5: testTileCodeComparator3on3

import org.geomajas.layer.tile.TileCode; //導入依賴的package包/類
@Test
public void testTileCodeComparator3on3() {
	List<TileCode> list = createTileCodes(0, 0, 3, 3); 
	TileCodeComparator tcc = new TileCodeComparator(1, 1);
	
	Collections.sort(list, tcc);
	
	Assert.assertArrayEquals(new TileCode[] {
			new TileCode(0, 1, 1), 
			
			new TileCode(0, 0, 2),  // maybe not 1,2 but 0,2
			new TileCode(0, 1, 2), 
			new TileCode(0, 2, 2), 
			new TileCode(0, 2, 1), 
			new TileCode(0, 2, 0), 
			new TileCode(0, 1, 0), 
			new TileCode(0, 0, 0), 
			new TileCode(0, 0, 1), 

			}, list.toArray(new TileCode[0]));
}
 
開發者ID:geomajas,項目名稱:geomajas-project-server,代碼行數:22,代碼來源:TileCodeComparatorTest.java

示例6: testShuffeledTileCodeComparator3on3

import org.geomajas.layer.tile.TileCode; //導入依賴的package包/類
@Test
public void testShuffeledTileCodeComparator3on3() {
	List<TileCode> list = createShuffeledTileCodes(0, 0, 3, 3); 
	TileCodeComparator tcc = new TileCodeComparator(1, 1);
	
	Collections.sort(list, tcc);
	
	Assert.assertArrayEquals(new TileCode[] {
			new TileCode(0, 1, 1), 
			
			new TileCode(0, 0, 2),  // maybe not 1,2 but 0,2
			new TileCode(0, 1, 2), 
			new TileCode(0, 2, 2), 
			new TileCode(0, 2, 1), 
			new TileCode(0, 2, 0), 
			new TileCode(0, 1, 0), 
			new TileCode(0, 0, 0), 
			new TileCode(0, 0, 1), 

			}, list.toArray(new TileCode[0]));
}
 
開發者ID:geomajas,項目名稱:geomajas-project-server,代碼行數:22,代碼來源:TileCodeComparatorTest.java

示例7: RasterTile

import org.geomajas.layer.tile.TileCode; //導入依賴的package包/類
/**
 * Constructor for a raster tile.
 *
 * @param code tile code
 * @param bbox bounding box
 * @param url tile URL
 * @param store raster layer store
 */
public RasterTile(TileCode code, Bbox bbox, String url, RasterLayerStore store) {
	this.code = code;
	this.bbox = bbox;
	this.url = url;
	this.store = store;
	this.id = store.getLayer().getMapModel().getId() + "." + store.getLayer().getId() + "." + code.toString();
	String styleStr = store.getLayer().getLayerInfo().getStyle();
}
 
開發者ID:geomajas,項目名稱:geomajas-project-client-gwt,代碼行數:17,代碼來源:RasterTile.java

示例8: fetch

import org.geomajas.layer.tile.TileCode; //導入依賴的package包/類
/**
 * Fetch all data related to this tile.
 * 
 * @param filter When fetching it is possible to filter the data with this filter object. Null otherwise.
 * @param callback When this node's data comes from the server, it will be handled by this callback function.
 */
public void fetch(final String filter, final TileFunction<VectorTile> callback) {
	final GetVectorTileRequest request = createRequest(filter);
	GwtCommand command = new GwtCommand(GetVectorTileRequest.COMMAND);
	command.setCommandRequest(request);
	final VectorTile self = this;
	lastRequest = request;
	deferred = GwtCommandDispatcher.getInstance().execute(command,
			new AbstractCommandCallback<GetVectorTileResponse>() {

				public void execute(GetVectorTileResponse tileResponse) {
					if (null == deferred || !deferred.isCancelled()) {
						org.geomajas.layer.tile.VectorTile tile = tileResponse.getTile();
						for (TileCode relatedTile : tile.getCodes()) {
							codes.add(relatedTile);
						}
						code = tile.getCode();
						contentType = tile.getContentType();
						featureContent.setContent(tile.getFeatureContent());
						labelContent.setContent(tile.getLabelContent());
						try {
							callback.execute(self);
						} catch (Throwable t) {
							Log.logError("VectorTile: error calling the callback after a fetch.", t);
						}
					}
					deferred = null;
				}
			});
}
 
開發者ID:geomajas,項目名稱:geomajas-project-client-gwt,代碼行數:36,代碼來源:VectorTile.java

示例9: addTile

import org.geomajas.layer.tile.TileCode; //導入依賴的package包/類
/**
 * Adds the tile with the specified code to the cache or returns the tile if it's already in the cache.
 * 
 * @param tileCode
 *            A {@link TileCode} instance.
 */
public VectorTile addTile(TileCode tileCode) {
	String code = tileCode.toString();
	VectorTile tile = tiles.get(code);
	if (tile == null) {
		tile = new VectorTile(tileCode, calcBoundsForTileCode(tileCode), this);
		tile.setPictureStyle(new PictureStyle(layer.getOpacity()));
		tiles.put(code, tile);
	}
	return tile;
}
 
開發者ID:geomajas,項目名稱:geomajas-project-client-gwt,代碼行數:17,代碼來源:TileCache.java

示例10: calcBoundsForTileCode

import org.geomajas.layer.tile.TileCode; //導入依賴的package包/類
/**
 * Calculate the exact bounding box for a tile, given it's tile-code.
 * 
 * @param tileCode
 *            tile code
 * @return bbox for tile
 */
protected Bbox calcBoundsForTileCode(TileCode tileCode) {
	// Calculate tile width and height for tileLevel=tileCode.getTileLevel()
	double div = Math.pow(2, tileCode.getTileLevel());
	double scale = layer.getMapModel().getMapView().getCurrentScale();
	double tileWidth = Math.ceil((scale * layerBounds.getWidth()) / div) / scale;
	double tileHeight = Math.ceil((scale * layerBounds.getHeight()) / div) / scale;

	// Now calculate indices, and return bbox:
	double x = layerBounds.getX() + tileCode.getX() * tileWidth;
	double y = layerBounds.getY() + tileCode.getY() * tileHeight;
	return new Bbox(x, y, tileWidth, tileHeight);
}
 
開發者ID:geomajas,項目名稱:geomajas-project-client-gwt,代碼行數:20,代碼來源:TileCache.java

示例11: calcCodesForBounds

import org.geomajas.layer.tile.TileCode; //導入依賴的package包/類
/**
 * Saves the complete array of TileCode objects for the given bounds (and the current scale).
 * 
 * @param bounds
 *            view bounds
 * @return list of tiles in these bounds
 */
protected List<TileCode> calcCodesForBounds(Bbox bounds) {
	// Calculate tile width and height for tileLevel=currentTileLevel
	double div = Math.pow(2, currentTileLevel); // tile level must be correct!
	double scale = layer.getMapModel().getMapView().getCurrentScale();
	double tileWidth = Math.ceil((scale * layerBounds.getWidth()) / div) / scale;
	double tileHeight = Math.ceil((scale * layerBounds.getHeight()) / div) / scale;

	// For safety (to prevent division by 0):
	List<TileCode> codes = new ArrayList<TileCode>();
	if (tileWidth == 0 || tileHeight == 0) {
		return codes;
	}

	// Calculate bounds relative to extents:
	Bbox clippedBounds = bounds.intersection(layerBounds);
	if (clippedBounds == null) {
		Log.logError("Map bounds outside of layer extents, check the server configuration, it is incorrect.");
		return codes;
	}
	double relativeBoundX = Math.abs(clippedBounds.getX() - layerBounds.getX());
	double relativeBoundY = Math.abs(clippedBounds.getY() - layerBounds.getY());
	currentMinX = (int) Math.floor(relativeBoundX / tileWidth);
	currentMinY = (int) Math.floor(relativeBoundY / tileHeight);
	currentMaxX = (int) Math.ceil((relativeBoundX + clippedBounds.getWidth()) / tileWidth) - 1;
	currentMaxY = (int) Math.ceil((relativeBoundY + clippedBounds.getHeight()) / tileHeight) - 1;

	// Now fill the list with the correct codes:
	for (int x = currentMinX; x <= currentMaxX; x++) {
		for (int y = currentMinY; y <= currentMaxY; y++) {
			codes.add(new TileCode(currentTileLevel, x, y));
		}
	}
	return codes;
}
 
開發者ID:geomajas,項目名稱:geomajas-project-client-gwt,代碼行數:42,代碼來源:TileCache.java

示例12: buildUrl

import org.geomajas.layer.tile.TileCode; //導入依賴的package包/類
@Override
public String buildUrl(TileCode tileCode, String baseTmsUrl) {
	StringBuilder builder = new StringBuilder(baseTmsUrl);
	if (!baseTmsUrl.endsWith("/")) {
		builder.append("/");
	}
	builder.append(tileCode.getTileLevel());
	builder.append("/");
	builder.append(tileCode.getX());
	builder.append("/");
	builder.append(tileCode.getY());
	builder.append(extension);
	return builder.toString();
}
 
開發者ID:geomajas,項目名稱:geomajas-project-server,代碼行數:15,代碼來源:SimpleTmsUrlBuilder.java

示例13: buildUrl

import org.geomajas.layer.tile.TileCode; //導入依賴的package包/類
private static String buildUrl(TileCode tileCode, TileMap tileMap, String baseTmsUrl) {
	if (tileCode == null || tileMap == null || baseTmsUrl == null) {
		throw new IllegalArgumentException("All parameters are required");
	}
	
	StringBuilder builder;

	// assuming they are ordered:
	TileSet tileSet = tileMap.getTileSets().getTileSets().get(tileCode.getTileLevel());
	String href = tileSet.getHref();
	if (href.startsWith("http://") || href.startsWith("https://")) {
		builder = new StringBuilder(href);
		if (!href.endsWith("/")) {
			builder.append("/");
		}
	} else {
		builder = new StringBuilder(baseTmsUrl);
		if (!baseTmsUrl.endsWith("/")) {
			builder.append("/");
		}
		builder.append(href);
		builder.append("/");
	}

	builder.append(tileCode.getX());
	builder.append("/");
	builder.append(tileCode.getY());
	builder.append(".");
	builder.append(tileMap.getTileFormat().getExtension());
	return builder.toString();
}
 
開發者ID:geomajas,項目名稱:geomajas-project-server,代碼行數:32,代碼來源:TileMapUrlBuilder.java

示例14: parseTileCode

import org.geomajas.layer.tile.TileCode; //導入依賴的package包/類
/**
 * @param relativeUrl just the part with level/x/y.extension
 * @return
 */
public static TileCode parseTileCode(String relativeUrl) {
	TileCode tc = new TileCode();
	StringTokenizer tokenizer = new StringTokenizer(relativeUrl, "/");
	tc.setTileLevel(Integer.parseInt(tokenizer.nextToken()));
	tc.setX(Integer.parseInt(tokenizer.nextToken()));
	tc.setY(Integer.parseInt(tokenizer.nextToken().split("\\.")[0]));
	return tc;
}
 
開發者ID:geomajas,項目名稱:geomajas-project-server,代碼行數:13,代碼來源:TileMapUrlBuilder.java

示例15: testBuildUrl1

import org.geomajas.layer.tile.TileCode; //導入依賴的package包/類
@Test
public void testBuildUrl1() throws TmsLayerException {
	TmsLayer tmsLayer = new TmsLayer();
	tmsLayer.setBaseTmsUrl("classpath:/org/geomajas/layer/tms/tileMapCapa1.xml");
	TileMap tileMap = configurationService
			.getCapabilities(tmsLayer);
	TileMapUrlBuilder builder = new TileMapUrlBuilder(tileMap);
	String url = builder.buildUrl(new TileCode(1, 2, 3), BASE_TMS_URL);
	Assert.assertEquals("http://www.geomajas.org/tms/some_layer/href2/2/3.extension", url);
}
 
開發者ID:geomajas,項目名稱:geomajas-project-server,代碼行數:11,代碼來源:TileMapUrlBuilderTest.java


注:本文中的org.geomajas.layer.tile.TileCode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。