Search in sources :

Example 1 with Projection

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

Example 2 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 3 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 4 with Projection

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

Example 5 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)

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