Sunday, May 10, 2015

Re: GWT + Mapserver

Hello, 

I hope you managed to overcome this issue.
I'm having the same problem.
Please let me know if you solved the problem

Le mercredi 13 octobre 2010 13:00:20 UTC+1, ana a écrit :
Hello,  i´m new with gwt..I know only a little about this  technology,
so i need some help...my problem is referent to mapserver, i want use
openlayers and mapserver to generate a map image ..for that, i use the
wrapper gwt-openlayers..then i do it something like this(see the
code), but it´s not working, the program don´t has error, but the
image don´t show....please someone help me..

CODE:
package org.yournamehere.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;

import org.gwtopenmaps.openlayers.client.Bounds;
import org.gwtopenmaps.openlayers.client.Icon;
import org.gwtopenmaps.openlayers.client.LonLat;
import org.gwtopenmaps.openlayers.client.Map;
import org.gwtopenmaps.openlayers.client.MapOptions;
import org.gwtopenmaps.openlayers.client.MapWidget;
import org.gwtopenmaps.openlayers.client.Marker;
import org.gwtopenmaps.openlayers.client.Pixel;
import org.gwtopenmaps.openlayers.client.Size;
import org.gwtopenmaps.openlayers.client.control.LayerSwitcher;
import org.gwtopenmaps.openlayers.client.control.MousePosition;
import org.gwtopenmaps.openlayers.client.control.MouseToolbar;
import org.gwtopenmaps.openlayers.client.control.PanZoomBar;
import org.gwtopenmaps.openlayers.client.control.Scale;
import org.gwtopenmaps.openlayers.client.event.EventHandler;
import org.gwtopenmaps.openlayers.client.layer.Layer;
import org.gwtopenmaps.openlayers.client.layer.Markers;
import org.gwtopenmaps.openlayers.client.layer.WMS;
import org.gwtopenmaps.openlayers.client.layer.WMSParams;
import org.gwtopenmaps.openlayers.client.popup.AnchoredBubble;
import org.gwtopenmaps.openlayers.client.popup.Popup;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.RootPanel;
import org.gwtopenmaps.openlayers.client.util.JObjectArray;
import org.gwtopenmaps.openlayers.client.util.JSObject;

public class MainEntryPoint implements EntryPoint {

        private MapWidget mapWidget;
        private Map map;
        private WMS wmsLayer;
        private Markers markers;
        private Popup popup;
        private  WMS layer1;
        private  WMS layer2;

    public MainEntryPoint() {
    }

        public void onModuleLoad() {


        MapOptions mapOptions = new MapOptions();
        mapOptions.setControls(new JObjectArray(new JSObject[]{}));
        mapOptions.setNumZoomLevels(16);
        mapOptions.setProjection("EPSG:4326");

        mapWidget = new MapWidget("800px", "475px", mapOptions);
        map = mapWidget.getMap();
        markers = new Markers("marker layer");


                WMSParams wmsParams = new WMSParams();
                wmsParams.setFormat("image/png");
                wmsParams.setLayers("tiger-ny");
                wmsParams.setStyles("");
                wmsParams.setMaxExtent(new Bounds(-79, 0, -61, 12));

                wmsLayer = new WMS("estados", "http://localhost:8080/
cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/WebApplication2/src/Mapa/

Venezuela.map", wmsParams);
                layer1 = new WMS("municipios", "http://localhost:8080/
cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/WebApplication2/src/Mapa/

Venezuela.map", wmsParams);
                layer2 = new WMS("parroquias", "http://localhost:8080/
cgi-bin/mapserv.exe?map=C:/ms4w/Apache/htdocs/WebApplication2/src/Mapa/

Venezuela.map", wmsParams);

                map.addLayers(new Layer[] {wmsLayer,layer1,layer2,
markers});


                map.addControl(new PanZoomBar(RootPanel.get("nav").getElement()));
                map.addControl(new
MousePosition(RootPanel.get("position").getElement()));
                map.addControl(new Scale(RootPanel.get("scale").getElement()));
                map.addControl(new MouseToolbar());
                map.addControl(new LayerSwitcher());

                LonLat center = new LonLat(679600, 180000);
                map.setCenter(center, 13);

                Size size = new Size(32,32);
                Pixel offset = new Pixel(-5, -17);
                Icon icon = new Icon("img/marker.png", size, offset);
                Marker marker = new Marker(center, icon);
                markers.addMarker(marker);

                DockPanel dockPanel = new DockPanel();
                dockPanel.add(mapWidget, DockPanel.CENTER);
                dockPanel.setBorderWidth(1);

                RootPanel.get("map").add(dockPanel);

    }
}

thanks!!!

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment