本文整理汇总了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;
}
示例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;
}