本文整理匯總了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;
}