use of org.gwtopenmaps.openlayers.client.Projection in project geo-platform by geosdi.
the class MapControlManager method drawFeatureOnMap.
/**
* Draw Feature on the Map
*
* @param wkt
*/
public void drawFeatureOnMap(String wkt) {
MultiPolygon geom = MultiPolygon.narrowToMultiPolygon(Geometry.fromWKT(wkt).getJSObject());
geom.transform(new Projection(WGS_84.getCode()), new Projection(GOOGLE_MERCATOR.getCode()));
VectorFeature vectorFeature = new VectorFeature(geom);
this.vector.addFeature(vectorFeature);
this.map.zoomToExtent(geom.getBounds());
Projection projection = new Projection(WGS_84.getCode());
Projection mapProjection = new Projection(map.getProjection());
Bounds mapBounds = this.map.getExtent().transform(mapProjection, projection);
BBoxClientInfo bbox = ViewportUtility.generateBBOXFromBounds(mapBounds);
}
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 CatalogMapMoveListenerProvider method get.
@Override
public MapMoveEndListener get() {
return new MapMoveEndListener() {
@Override
public void onMapMoveEnd(MapMoveEndEvent eventObject) {
Map map = eventObject.getSource();
fireCatalogBBoxChangeEvent(CatalogMapExtentReprojector.reprojects(new Projection(map.getProjection()), map.getExtent()));
}
};
}
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();
}
Aggregations