当前位置: 首页>>代码示例>>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;未经允许,请勿转载。