use of org.gwtopenmaps.openlayers.client.Projection in project geo-platform by geosdi.
the class ViewportWidget method onCreateViewport.
@Override
public void onCreateViewport(List<GPLayerBean> layerList, String viewportName) {
Bounds bounds = ViewportUtility.calculateMaxBound(layerList, map);
Projection currentProjection = new Projection(GPCoordinateReferenceSystem.WGS_84.getCode());
Projection destinationProjection = new Projection(map.getProjection());
bounds.transform(currentProjection, destinationProjection);
double zoom = map.getZoomForExtent(bounds, Boolean.FALSE);
bounds.transform(destinationProjection, currentProjection);
BBoxClientInfo bbox = ViewportUtility.generateBBOXFromBounds(bounds);
this.viewportToAdd = new GPClientViewport(viewportName, MapModuleConstants.INSTANCE.ViewportUtility_newViewportDescriptionText(), bbox, zoom, Boolean.FALSE);
this.show();
}
use of org.gwtopenmaps.openlayers.client.Projection in project geo-platform by geosdi.
the class AbstractPublisherWidget method generateLayer.
public WMS generateLayer(PreviewLayer previewLayer) {
WMSParams wmsParams = new WMSParams();
wmsParams.setFormat("image/png");
wmsParams.setLayers(previewLayer.getName());
wmsParams.setStyles(previewLayer.getStyleName());
wmsParams.setTransparent(Boolean.TRUE);
Double lowerX = previewLayer.getLowerX();
Double lowerY = previewLayer.getLowerY();
Double upperX = previewLayer.getUpperX();
Double upperY = previewLayer.getUpperY();
Bounds layerBounds = new Bounds(lowerX, lowerY, upperX, upperY);
layerBounds.transform(new Projection(previewLayer.getCrs()), new Projection(shpPreviewWidget.getMapPreview().getMap().getProjection()));
WMSOptions wmsOption = new WMSOptions();
wmsOption.setMaxExtent(layerBounds);
wmsOption.setIsBaseLayer(false);
wmsOption.setDisplayInLayerSwitcher(true);
this.updateMapBounds(layerBounds);
return new WMS(previewLayer.getName(), previewLayer.getDataSource(), wmsParams, wmsOption);
}
use of org.gwtopenmaps.openlayers.client.Projection in project geo-platform by geosdi.
the class PreviewWidget method createMapPreviewOption.
@Override
public MapOptions createMapPreviewOption() {
MapOptions defaultMapOptions = new MapOptions();
defaultMapOptions.setNumZoomLevels(18);
defaultMapOptions.setProjection(GPCoordinateReferenceSystem.GOOGLE_MERCATOR.getCode());
defaultMapOptions.setDisplayProjection(new Projection(GPCoordinateReferenceSystem.WGS_84.getCode()));
defaultMapOptions.setUnits(MapUnits.METERS);
defaultMapOptions.setMaxExtent(new Bounds(-20037508, -20037508, 20037508, 20037508.34));
defaultMapOptions.setMaxResolution(new Double(156543.0339).floatValue());
return defaultMapOptions;
}
use of org.gwtopenmaps.openlayers.client.Projection in project geo-platform by geosdi.
the class GPRoutingLine method drawLine.
/**
* (non-Javadoc)
*
* @see
* org.geosdi.geoplatform.gui.puregwt.routing.event.TraceRoutingLineEventHandler#drawLine(java.lang.String)
*/
@Override
public void drawLine(String wkt) {
if (this.feature != null) {
layer.removeFeature(feature);
}
MultiLineString geometry = MultiLineString.narrowToMultiLineString(Geometry.fromWKT(wkt).getJSObject());
if (geoPlatformMap.getMap().getProjection().equals(GPCoordinateReferenceSystem.GOOGLE_MERCATOR.getCode())) {
geometry.transform(new Projection(GPCoordinateReferenceSystem.WGS_84.getCode()), new Projection(GPCoordinateReferenceSystem.EPSG_GOOGLE.getCode()));
}
this.feature = new VectorFeature(geometry);
this.feature.setStyle(style);
this.layer.addFeature(feature);
this.geoPlatformMap.getMap().zoomToExtent(geometry.getBounds());
}
use of org.gwtopenmaps.openlayers.client.Projection in project geo-platform by geosdi.
the class MapLayerBuilder method generateBoundsTransformationFromMap.
Bounds generateBoundsTransformationFromMap(GPLayerBean layerBean) {
checkArgument(layerBean != null, "The Parameter layerBean must not be null.");
Bounds bounds = null;
if (layerBean.getBbox() != null) {
BBoxClientInfo bbox = layerBean.getBbox();
bounds = ViewportUtility.generateBoundsFromBBOX(bbox);
bounds.transform(new Projection(layerBean.getCrs()), new Projection(mapWidget.getMap().getProjection()));
}
return bounds;
}
Aggregations