org.gwtopenmaps.openlayers.client.layer.WMS Java Examples

The following examples show how to use org.gwtopenmaps.openlayers.client.layer.WMS. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WmsGetInfoTool.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
public Control WMSGetFeatureInfo(final WMS layer) {
			
	final WMSGetFeatureInfoOptions wmsGetFeatureInfoOptions = new WMSGetFeatureInfoOptions();
	wmsGetFeatureInfoOptions.setMaxFeaturess(50);		
	wmsGetFeatureInfoOptions.setDrillDown(true);
	if(layer != null) {
		final List<WMS> layers = new ArrayList<WMS>();
		layers.add(layer);
		wmsGetFeatureInfoOptions.setTitle(layer.getName());			
		wmsGetFeatureInfoOptions.setLayers(layers.toArray(new WMS[]{}));					
	}
	
	
	final WMSGetFeatureInfo wmsGetFeatureInfo = new WMSGetFeatureInfo(
			wmsGetFeatureInfoOptions);

	wmsGetFeatureInfo.addGetFeatureListener(getFeatureInfoListener());
	return wmsGetFeatureInfo;
	
}
 
Example #2
Source File: WmsLayerDef.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
@Override
public Layer getLayer() {
	WMSParams wmsParams = new WMSParams();
	wmsParams.setFormat(format);
	wmsParams.setLayers(layerName);
	wmsParams.setTransparent(true);		
	
	WMSOptions wmsLayerParams = new WMSOptions();
	wmsLayerParams.setProjection(epsg);
	wmsLayerParams.setTransitionEffect(TransitionEffect.RESIZE);
	wmsLayerParams.setDisplayOutsideMaxExtent(true);			
	wmsLayerParams.setNumZoomLevels(GeoMapInitializer.MAX_NUM_ZOOM_LEVEL);
	wmsLayerParams.setIsBaseLayer(true);
	String attribution = getAttribution();
	if(attribution != null) {
		wmsLayerParams.setAttribution(attribution);
	}
	
	WMS wmsLayer = new WMS(getName(), url, wmsParams, wmsLayerParams);
	wmsLayer.setIsBaseLayer(false);

	return wmsLayer;	
}
 
Example #3
Source File: ToggleTool.java    From geowe-core with GNU General Public License v3.0 6 votes vote down vote up
public void setWMSLayer(final WMS layer) {
	this.layer = layer;
	setEnabled(true);

	final List<Control> toDelete = new ArrayList<Control>();
	final List<Control> toInsert = new ArrayList<Control>();

	for (final Control control : controls) {

		if (control instanceof WMSGetFeatureInfo) {
			toDelete.add(control);
			final Control newControl = ((WmsGetInfoTool) this)
					.WMSGetFeatureInfo(layer);
			toInsert.add(newControl);
		} else {
			Info.display(UIMessages.INSTANCE.warning(),
					"No implemented yet!!! " + control.getClassName());
		}
	}

	updateControl(toDelete, toInsert);
}
 
Example #4
Source File: AppView.java    From geofence with GNU General Public License v2.0 6 votes vote down vote up
/**
 *
 */
private void addBaseLayer()
{

	GeofenceGlobalConfiguration geoFenceConfiguration = (GeofenceGlobalConfiguration) GeofenceUtils.getInstance().getGlobalConfiguration();
	
    /* base layer */
    WMSParams wmsParams = new WMSParams();
    wmsParams.setLayers(geoFenceConfiguration.getBaseLayerName());
    wmsParams.setFormat(geoFenceConfiguration.getBaseLayerFormat());
    wmsParams.setStyles(geoFenceConfiguration.getBaseLayerStyle());

    WMSOptions wmsLayerParams = new WMSOptions();
    wmsLayerParams.setTransitionEffect(TransitionEffect.RESIZE);

    WMS layer = new WMS(geoFenceConfiguration.getBaseLayerTitle(),
    		geoFenceConfiguration.getBaseLayerURL(), wmsParams, wmsLayerParams);
    Dispatcher.forwardEvent(GeoGWTEvents.ADD_LAYER, layer);
}
 
Example #5
Source File: OpenLayersMapWrapper.java    From SensorWebClient with GNU General Public License v2.0 6 votes vote down vote up
private WMS initializeWMSLayer(String url) {
    PropertiesManager properties = getPropertiesManager();
    defaultMapOptions.setProjection(DISPLAY_PROJECTION);
    currentMapProjection = DISPLAY_PROJECTION;

    String format = properties.getParameterAsString("wmsFormat");
    String styles = properties.getParameterAsString("wmsStyles");
    String layer = properties.getParameterAsString("wmsLayerName");
    String bgColor = properties.getParameterAsString("wmsBGColor");
    String isTransparent = properties.getParameterAsString("wmsIsTransparent");

    WMSParams wmsParameters = new WMSParams();
    wmsParameters.setFormat(format);
    wmsParameters.setLayers(layer);
    wmsParameters.setStyles(styles);
    wmsParameters.setIsTransparent(new Boolean(isTransparent));
    wmsParameters.getJSObject().setProperty("BGCOLOR", bgColor);

    WMSOptions wmsOptions = new WMSOptions();
    wmsOptions.setProjection(spatialReference);
    wmsOptions.setDisplayInLayerSwitcher(true);
    wmsOptions.setIsBaseLayer(true);
    return new WMS(layer, url, wmsParameters, wmsOptions);
}
 
Example #6
Source File: MapPreviewWidget.java    From geofence with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Inits the map widget.
 *
 * @param defaultMapOptions
 *            the default map options
 * @param isGoogle
 *            the is google
 */
private void initMapWidget(MapOptions defaultMapOptions, boolean isGoogle)
{
    mapWidget = new MapWidget("100%", "100%", defaultMapOptions);
    this.map = mapWidget.getMap();
    // this.map.addControl(new LayerSwitcher());
    if (isGoogle)
    {
        this.createOSM();
        // this.createBaseGoogleLayer();
    }
    else
    {
        WMSParams wmsParams = new WMSParams();
        wmsParams.setFormat("image/png");
        wmsParams.setLayers("basic");
        wmsParams.setStyles("");

        WMSOptions wmsLayerParams = new WMSOptions();
        wmsLayerParams.setTransitionEffect(TransitionEffect.RESIZE);

        layer = new WMS("Basic WMS", "http://labs.metacarta.com/wms/vmap0", wmsParams,
                wmsLayerParams);
        this.map.addLayer(layer);
    }

    this.initVectorLayer();
}
 
Example #7
Source File: WmsGetInfoTool.java    From geowe-core with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void onChange(final WMS layer) {
	setWMSLayer(layer);		
}
 
Example #8
Source File: ChangeSelectedWMSLayerListener.java    From geowe-core with GNU General Public License v3.0 votes vote down vote up
public void onChange(WMS layer);