use of org.gwtopenmaps.openlayers.client.Projection in project geo-platform by geosdi.
the class ViewportUtility method generateViewportFromMap.
public static GPClientViewport generateViewportFromMap(Map map) {
Projection currentProjection = new Projection(map.getProjection());
Projection destinationProjection = new Projection(GPCoordinateReferenceSystem.WGS_84.getCode());
Bounds bounds = map.getExtent().transform(currentProjection, destinationProjection);
BBoxClientInfo bbox = generateBBOXFromBounds(bounds);
GPClientViewport viewport = new GPClientViewport(MapModuleConstants.INSTANCE.ViewportUtility_newViewportBeanNameText(), MapModuleConstants.INSTANCE.ViewportUtility_newViewportDescriptionText(), bbox, map.getZoom(), Boolean.FALSE);
return viewport;
}
use of org.gwtopenmaps.openlayers.client.Projection in project geo-platform by geosdi.
the class WFSMapLayerBuilder method buildVector.
@Override
public WMS buildVector(GPVectorBean vectorBean) {
WMSParams wmsParams = new WMSParams();
wmsParams.setFormat("image/png");
this.addAuthTuple(wmsParams);
wmsParams.setLayers(vectorBean.getName());
wmsParams.setStyles("");
wmsParams.setTransparent(TRUE);
final String cqlFilter = vectorBean.getCqlFilter();
if (GPSharedUtils.isNotEmpty(cqlFilter)) {
wmsParams.setCQLFilter(vectorBean.getCqlFilter());
}
WMSOptions wmsOption = new WMSOptions();
if (vectorBean.getBbox() != null) {
BBoxClientInfo bbox = vectorBean.getBbox();
Bounds bounds = WFSViewportUtility.generateBoundsFromBBOX(bbox);
bounds.transform(new Projection(vectorBean.getCrs()), new Projection(mapWidget.getMap().getProjection()));
wmsOption.setMaxExtent(bounds);
}
wmsOption.setIsBaseLayer(false);
wmsOption.setDisplayInLayerSwitcher(false);
wmsOption.setDisplayOutsideMaxExtent(true);
wmsOption.setBuffer(0);
wmsOption.setRatio(1);
String dataSource = vectorBean.getDataSource();
dataSource = dataSource.replaceAll("wfs", "wms");
return new WMS(vectorBean.getLabel(), dataSource, wmsParams, wmsOption);
}
use of org.gwtopenmaps.openlayers.client.Projection in project geo-platform by geosdi.
the class FeatureMapWidget method onZoomToMaxExtend.
@Override
public void onZoomToMaxExtend(BBoxClientInfo bbox, String crs) {
Bounds bounds = WFSViewportUtility.generateBoundsFromBBOX(bbox);
if (!this.mapWidget.getMap().getProjection().equals(crs)) {
if (this.mapWidget.getMap().getProjection().equals(GOOGLE_MERCATOR.getCode())) {
bounds.transform(new Projection(crs), new Projection(EPSG_GOOGLE.getCode()));
}
}
this.mapWidget.getMap().zoomToExtent(bounds);
}
use of org.gwtopenmaps.openlayers.client.Projection in project geo-platform by geosdi.
the class FeatureMapLayerBuilder method generateBoundsTransformationFromMap.
private Bounds generateBoundsTransformationFromMap(GPLayerBean layerBean) {
Bounds bounds = null;
if (layerBean.getBbox() != null) {
BBoxClientInfo bbox = layerBean.getBbox();
bounds = new Bounds(bbox.getLowerLeftX(), bbox.getLowerLeftY(), bbox.getUpperRightX(), bbox.getUpperRightY());
if (!layerBean.getCrs().equals(super.mapWidget.getMap().getProjection())) {
bounds.transform(new Projection(layerBean.getCrs()), new Projection(mapWidget.getMap().getProjection()));
}
}
return bounds;
}
use of org.gwtopenmaps.openlayers.client.Projection in project geo-platform by geosdi.
the class LinearRingConverterHandler method generateGeometryWKT.
@Override
protected String generateGeometryWKT(Geometry geom, Projection dest) {
LinearRing linearRing = LinearRing.narrowToLinearRing(geom.getJSObject());
linearRing.transform(new Projection(mapWidget.getMap().getProjection()), dest);
return linearRing.toString();
}
Aggregations