本文整理汇总了Java中org.geomajas.global.ExceptionCode.TRANSFORMER_CREATE_LAYER_TO_MAP_FAILED属性的典型用法代码示例。如果您正苦于以下问题:Java ExceptionCode.TRANSFORMER_CREATE_LAYER_TO_MAP_FAILED属性的具体用法?Java ExceptionCode.TRANSFORMER_CREATE_LAYER_TO_MAP_FAILED怎么用?Java ExceptionCode.TRANSFORMER_CREATE_LAYER_TO_MAP_FAILED使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.geomajas.global.ExceptionCode
的用法示例。
在下文中一共展示了ExceptionCode.TRANSFORMER_CREATE_LAYER_TO_MAP_FAILED属性的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getUnitLength
private double getUnitLength(String mapCrsKey, Bbox mapBounds) throws LayerException {
try {
if (null == mapBounds) {
throw new LayerException(ExceptionCode.MAP_MAX_EXTENT_MISSING);
}
Crs crs = geoService.getCrs2(mapCrsKey);
GeodeticCalculator calculator = new GeodeticCalculator(crs);
Coordinate center = new Coordinate(0.5 * (mapBounds.getX() + mapBounds.getMaxX()),
0.5 * (mapBounds.getY() + mapBounds.getMaxY()));
calculator.setStartingPosition(new DirectPosition2D(crs, center.getX(), center.getY()));
calculator.setDestinationPosition(new DirectPosition2D(crs, center.getX() + 1, center.getY()));
return calculator.getOrthodromicDistance();
} catch (TransformException e) {
throw new LayerException(e, ExceptionCode.TRANSFORMER_CREATE_LAYER_TO_MAP_FAILED);
}
}
示例2: getClientMaxExtent
public Bbox getClientMaxExtent(String mapCrsKey, String layerCrsKey, Bbox serverBbox, String layer)
throws LayerException {
if (mapCrsKey.equals(layerCrsKey)) {
return serverBbox;
}
try {
Crs mapCrs = geoService.getCrs2(mapCrsKey);
Crs layerCrs = geoService.getCrs2(layerCrsKey);
Envelope serverEnvelope = converterService.toInternal(serverBbox);
CrsTransform transformer = geoService.getCrsTransform(layerCrs, mapCrs);
Bbox res = converterService.toDto(geoService.transform(serverEnvelope, transformer));
if (Double.isNaN(res.getX()) || Double.isNaN(res.getY()) || Double.isNaN(res.getWidth())
|| Double.isNaN(res.getHeight())) {
throw new LayerException(ExceptionCode.LAYER_EXTENT_CANNOT_CONVERT, layer, mapCrsKey);
}
return res;
} catch (GeomajasException e) {
throw new LayerException(e, ExceptionCode.TRANSFORMER_CREATE_LAYER_TO_MAP_FAILED);
}
}