📄 adfhorizonlookup.java
字号:
package com.esri.solutions.jitk.web.projection.horizon;
import com.esri.adf.web.data.geometry.WebExtent;
import com.esri.adf.web.data.geometry.WebPolygon;
import com.esri.adf.web.data.geometry.WebRing;
import com.esri.adf.web.data.geometry.WebSpatialReference;
import org.apache.log4j.Logger;
public class ADFHorizonLookup implements IHorizonLookup {
private static final Logger _logger = Logger.getLogger(ADFHorizonLookup.class);
public WebExtent lookup(int spatialReferenceId) {
WebExtent horizon = null;
WebSpatialReference spr = null;
WebPolygon polyHorizon = null;
double minx = 180D;
double miny = 90D;
double maxx = -180D;
double maxy = -90D;
try {
_logger.debug("Creating WebSpatialReference for ID: " +
spatialReferenceId);
spr = WebSpatialReference.getWebSpatialReference(spatialReferenceId);
if (spr == null) {
_logger.warn(
"Unable to create WebSpatialReference for given ID: " +
spatialReferenceId);
return horizon;
}
polyHorizon = spr.getHorizon(false);
for (WebRing ring : polyHorizon.getRings()) {
for (double x : ring.getXs()) {
if (x < minx) {
minx = x;
} else if (x > maxx) {
maxx = x;
}
}
for (double y : ring.getYs()) {
if (y < miny) {
miny = y;
} else if (y > maxy) {
maxy = y;
}
}
}
horizon = new WebExtent(minx, miny, maxx, maxy, spr);
_logger.debug(
"Successfully retrieved horizon for Spatial Reference: " +
spr.getId());
return horizon;
} catch (Exception ex) {
_logger.warn(
"An Exception has occurred retrieving horizon for Spatial Reference: " +
spatialReferenceId);
_logger.error(
"An Exception has occurred retrieving horizon for Spatial Reference: " +
spatialReferenceId, ex);
return null;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -