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


Java MercatorUtils類代碼示例

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


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

示例1: toWMSURL

import org.jdesktop.swingx.mapviewer.util.MercatorUtils; //導入依賴的package包/類
/**
 * Convertes to a WMS URL
 * @param x the x coordinate
 * @param y the y coordinate
 * @param zoom the zomm factor
 * @param tileSize the tile size
 * @return a URL request string 
 */
public String toWMSURL(int x, int y, int zoom, int tileSize)
{
	String format = "image/jpeg";
	String styles = "";
	String srs = "EPSG:4326";
	int ts = tileSize;
	int circumference = widthOfWorldInPixels(zoom, tileSize);
	double radius = circumference / (2 * Math.PI);
	double ulx = MercatorUtils.xToLong(x * ts, radius);
	double uly = MercatorUtils.yToLat(y * ts, radius);
	double lrx = MercatorUtils.xToLong((x + 1) * ts, radius);
	double lry = MercatorUtils.yToLat((y + 1) * ts, radius);
	String bbox = ulx + "," + uly + "," + lrx + "," + lry;
	String url = getBaseUrl() + "version=1.1.1&request=" + "GetMap&Layers=" + layer + "&format=" + format
			+ "&BBOX=" + bbox + "&width=" + ts + "&height=" + ts + "&SRS=" + srs + "&Styles=" + styles +
			// "&transparent=TRUE"+
			"";
	return url;
}
 
開發者ID:DSheirer,項目名稱:sdrtrunk,代碼行數:28,代碼來源:WMSService.java

示例2: toWMSURL

import org.jdesktop.swingx.mapviewer.util.MercatorUtils; //導入依賴的package包/類
public String toWMSURL(int x, int y, int zoom, int tileSize) {
    String format = "image/jpeg";
    String layers = "BMNG";
    String styles = "";
    String srs = "EPSG:4326";
    int ts = tileSize;
    int circumference = widthOfWorldInPixels(zoom, tileSize);
    double radius = circumference / (2* Math.PI);
    double ulx = MercatorUtils.xToLong(x*ts, radius);
    double uly = MercatorUtils.yToLat(y*ts, radius);
    double lrx = MercatorUtils.xToLong((x+1)*ts, radius);
    double lry = MercatorUtils.yToLat((y+1)*ts, radius);
    String bbox = ulx + "," + uly+","+lrx+","+lry;
    String url = getBaseUrl() + 
            "version=1.1.1&request="+
            "GetMap&Layers="+layer+
            "&format="+format+
            "&BBOX="+bbox+
            "&width="+ts+"&height="+ts+
            "&SRS="+srs+
            "&Styles="+styles+
            //"&transparent=TRUE"+
            "";
    return url;
}
 
開發者ID:3dcitydb,項目名稱:swingx-ws,代碼行數:26,代碼來源:WMSService.java


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