Search in sources :

Example 16 with Projection

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;
}
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 17 with Projection

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

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

Example 19 with Projection

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

Example 20 with Projection

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

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