Search in sources :

Example 11 with Projection

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();
}
Also used : BBoxClientInfo(org.geosdi.geoplatform.gui.configuration.map.client.geometry.BBoxClientInfo) GPClientViewport(org.geosdi.geoplatform.gui.configuration.map.client.GPClientViewport) Bounds(org.gwtopenmaps.openlayers.client.Bounds) Projection(org.gwtopenmaps.openlayers.client.Projection)

Example 12 with Projection

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);
}
Also used : WMSParams(org.gwtopenmaps.openlayers.client.layer.WMSParams) Bounds(org.gwtopenmaps.openlayers.client.Bounds) Projection(org.gwtopenmaps.openlayers.client.Projection) WMSOptions(org.gwtopenmaps.openlayers.client.layer.WMSOptions) WMS(org.gwtopenmaps.openlayers.client.layer.WMS)

Example 13 with Projection

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;
}
Also used : MapOptions(org.gwtopenmaps.openlayers.client.MapOptions) Bounds(org.gwtopenmaps.openlayers.client.Bounds) Projection(org.gwtopenmaps.openlayers.client.Projection)

Example 14 with Projection

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());
}
Also used : MultiLineString(org.gwtopenmaps.openlayers.client.geometry.MultiLineString) VectorFeature(org.gwtopenmaps.openlayers.client.feature.VectorFeature) Projection(org.gwtopenmaps.openlayers.client.Projection)

Example 15 with Projection

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;
}
Also used : BBoxClientInfo(org.geosdi.geoplatform.gui.configuration.map.client.geometry.BBoxClientInfo) Bounds(org.gwtopenmaps.openlayers.client.Bounds) Projection(org.gwtopenmaps.openlayers.client.Projection)

Aggregations

Projection (org.gwtopenmaps.openlayers.client.Projection)25 Bounds (org.gwtopenmaps.openlayers.client.Bounds)13 BBoxClientInfo (org.geosdi.geoplatform.gui.configuration.map.client.geometry.BBoxClientInfo)9 VectorFeature (org.gwtopenmaps.openlayers.client.feature.VectorFeature)5 MultiPolygon (org.gwtopenmaps.openlayers.client.geometry.MultiPolygon)3 WMS (org.gwtopenmaps.openlayers.client.layer.WMS)3 WMSOptions (org.gwtopenmaps.openlayers.client.layer.WMSOptions)3 WMSParams (org.gwtopenmaps.openlayers.client.layer.WMSParams)3 GPClientViewport (org.geosdi.geoplatform.gui.configuration.map.client.GPClientViewport)2 MultiLineString (org.gwtopenmaps.openlayers.client.geometry.MultiLineString)2 Point (org.gwtopenmaps.openlayers.client.geometry.Point)2 GwtDevice (org.eclipse.kapua.app.console.shared.model.GwtDevice)1 GeocodingVectorFeature (org.geosdi.geoplatform.gui.client.widget.map.feature.GeocodingVectorFeature)1 GPLayerBean (org.geosdi.geoplatform.gui.model.GPLayerBean)1 LonLat (org.gwtopenmaps.openlayers.client.LonLat)1 Map (org.gwtopenmaps.openlayers.client.Map)1 MapOptions (org.gwtopenmaps.openlayers.client.MapOptions)1 Size (org.gwtopenmaps.openlayers.client.Size)1 Style (org.gwtopenmaps.openlayers.client.Style)1 SelectFeature (org.gwtopenmaps.openlayers.client.control.SelectFeature)1