Example usage for com.google.gwt.maps.client.control SmallMapControl SmallMapControl

List of usage examples for com.google.gwt.maps.client.control SmallMapControl SmallMapControl

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.control SmallMapControl SmallMapControl.

Prototype

public SmallMapControl() 

Source Link

Document

Creates a control with buttons to pan in four directions, and zoom in and zoom out.

Usage

From source file:com.apress.progwt.client.map.CollegeMapApp.java

License:Apache License

public CollegeMapApp(int pageID) {
    super(pageID);

    try {/*from   w  ww. ja  va2  s.c o  m*/
        Log.debug("In CollegeBound");
        double latitude = Double.parseDouble(getParam("latitude"));

        double longitude = Double.parseDouble(getParam("longitude"));

        LatLng collegeCenter = new LatLng(latitude, longitude);

        if (latitude == -1 && longitude == -1) {
            map = new MapWidget();
        } else {
            map = new MapWidget(collegeCenter, DEFAULT_ZOOM);
        }

        map.setSize("300px", "250px");

        map.addControl(new SmallMapControl());
        map.addControl(new MapTypeControl());
        map.setScrollWheelZoomEnabled(true);
        map.clearOverlays();

        map.addOverlay(new Marker(collegeCenter));
        Log.debug("Show CollegeBound");

        show(map);

    } catch (Exception e) {
        Log.error("EX " + e);
        loadError(e);
    }

}

From source file:com.apress.progwt.client.map.MyCollegeMap.java

License:Apache License

public MyCollegeMap(ServiceCache serviceCache) {

    map = new MapWidget(middleAmerica, 4);
    map.setPixelSize(760, 300);/*from   ww w . j a v  a2  s  . c o m*/

    map.addControl(new SmallMapControl());
    map.addControl(new MapTypeControl());
    map.setScrollWheelZoomEnabled(true);

    SimplePanel sizeCorrector = new SimplePanel();
    sizeCorrector.add(map);
    sizeCorrector.setPixelSize(760, 300);

    initWidget(sizeCorrector);

}

From source file:com.google.gwt.maps.sample.hellomaps.client.ClickDemo.java

License:Apache License

public ClickDemo() {
    map = new MapWidget(LatLng.newInstance(37.4419, -122.1419), 13);
    map.setSize("500px", "300px");
    initWidget(map);/*  w w  w.j  av a 2 s . c o  m*/

    map.addControl(new SmallMapControl());
    map.addControl(new MapTypeControl());

    map.addMapClickHandler(new MapClickHandler() {
        public void onClick(MapClickEvent e) {
            MapWidget sender = e.getSender();
            Overlay overlay = e.getOverlay();
            LatLng point = e.getLatLng();

            if (overlay != null && overlay instanceof Marker) {
                sender.removeOverlay(overlay);
            } else {
                sender.addOverlay(new Marker(point));
            }
        }
    });
}

From source file:com.google.gwt.maps.sample.hellomaps.client.ControlsDemo.java

License:Apache License

public ControlsDemo() {
    map = new MapWidget(LatLng.newInstance(37.4419, -122.1419), 13);
    map.setSize("500px", "300px");
    initWidget(map);//from  www.j a  va 2  s .  c o m
    map.addControl(new SmallMapControl());
    map.addControl(new MapTypeControl());

    Timer timer = new Timer() {

        @Override
        public void run() {
            // Exercise the minimum & maximum resolution entry points.
            MapType types[] = map.getMapTypes();
            for (MapType t : types) {
                int minResolution = t.getMinimumResolution();
                int maxResolution = t.getMaximumResolution();
                GWT.log("Map Type: " + t.getName(true) + " Min resolution: " + minResolution
                        + " Max Resolution: " + maxResolution, null);

                minResolution = t.getMinimumResolution();
                maxResolution = t.getMaximumResolution();
                GWT.log("@ point: " + map.getCenter().toString() + " Map Type: " + t.getName(true)
                        + " Min resolution: " + minResolution + " Max Resolution: " + maxResolution, null);
            }
        }
    };
    timer.schedule(1000);
}

From source file:com.google.gwt.maps.sample.hellomaps.client.CustomOverlayDemo.java

License:Apache License

public CustomOverlayDemo() {
    map = new MapWidget(LatLng.newInstance(37.4419, -122.1419), 13);
    map.setSize("500px", "300px");
    map.addControl(new SmallMapControl());
    map.addControl(new MapTypeControl());
    initWidget(map);/*  w w  w .  ja  v  a  2 s .c  o  m*/
}

From source file:com.google.gwt.maps.sample.hellomaps.client.EarthPluginDemo.java

License:Apache License

public EarthPluginDemo() {
    Panel panel = new FlowPanel();
    map = new MapWidget(LatLng.newInstance(37.42317, -122.08364), 16);
    map.setSize("500px", "500px");
    map.addControl(new SmallMapControl());
    map.addMapType(MapType.getEarthMap());
    map.setCurrentMapType(MapType.getEarthMap());
    panel.add(map);//w  w  w  . ja v  a2  s. c o m
    initWidget(panel);
    map.getEarthInstance(new EarthInstanceHandler() {

        public void onEarthInstance(EarthInstanceEvent event) {
            final JavaScriptObject earth = event.getEarthInstance();
            if (earth == null) {
                Window.alert("Failed to init earth plugin");
            } else {
                /*
                 * Create a marker. The timer is set to give the earth plugin a chance
                 * to position to the proper point on the map.
                 */
                new Timer() {

                    @Override
                    public void run() {
                        createPlacemark(earth);
                    }
                }.schedule(1000);
            }
        }
    });
}

From source file:com.google.gwt.maps.sample.hellomaps.client.EventDemo.java

License:Apache License

public EventDemo() {
    Panel panel = new FlowPanel();
    map = new MapWidget(LatLng.newInstance(37.4419, -122.1419), 13);
    map.setSize("500px", "300px");
    map.addControl(new SmallMapControl());
    panel.add(map);/*w w  w  .j a  v  a 2s. co  m*/
    final Label message = new Label();
    panel.add(message);
    initWidget(panel);

    map.addMapMoveEndHandler(new MapMoveEndHandler() {
        public void onMoveEnd(MapMoveEndEvent event) {
            message.setText(map.getCenter().toString());
        }
    });
}

From source file:com.google.gwt.maps.sample.hellomaps.client.GroundOverlayDemo.java

License:Apache License

public GroundOverlayDemo() {
    VerticalPanel vp = new VerticalPanel();
    map = new MapWidget(LatLng.newInstance(37.4419, -122.1419), 13);
    vp.add(map);/*w w  w.j  av  a2  s.  c om*/
    vp.setSpacing(10);
    map.setSize("500px", "500px");
    map.addControl(new SmallMapControl());
    map.addControl(new MapTypeControl());

    hideButton = new Button("Hide");
    vp.add(hideButton);
    hideButton.addClickListener(new ClickListener() {

        public void onClick(Widget sender) {
            if (groundOverlay.isVisible()) {
                hideButton.setText("Show");
            } else {
                hideButton.setText("Hide");
            }
            groundOverlay.setVisible(!groundOverlay.isVisible());
        }

    });
    initWidget(vp);
}

From source file:com.google.gwt.maps.sample.hellomaps.client.IconClassDemo.java

License:Apache License

public IconClassDemo() {
    map = new MapWidget(LatLng.newInstance(37.4419, -122.1419), 13);
    map.setSize("500px", "300px");
    initWidget(map);//from   ww  w. j  av  a 2s  .  c  o  m

    map.addControl(new SmallMapControl());
    map.addControl(new MapTypeControl());

    // Create a base icon for all of our markers that specifies the
    // shadow, icon dimensions, etc.
    baseIcon = Icon.newInstance();
    baseIcon.setShadowURL("http://www.google.com/mapfiles/shadow50.png");
    baseIcon.setIconSize(Size.newInstance(20, 34));
    baseIcon.setShadowSize(Size.newInstance(37, 34));
    baseIcon.setIconAnchor(Point.newInstance(9, 34));
    baseIcon.setInfoWindowAnchor(Point.newInstance(9, 2));
    // TOOD(sgross): undocumented?
    // baseIcon.setInfoShadowAnchor(new GPoint(18, 25));
}

From source file:com.google.gwt.maps.sample.hellomaps.client.IconDemo.java

License:Apache License

public IconDemo() {
    map = new MapWidget(LatLng.newInstance(37.4419, -122.1419), 13);
    map.setSize("500px", "300px");
    initWidget(map);//from   ww  w.  j  a  va2 s .  co m
    map.addControl(new SmallMapControl());
    map.addControl(new MapTypeControl());
}