Package org.wicketstuff.gmap

Examples of org.wicketstuff.gmap.GMap$ZoomOutBehavior


    private void buildGui() {

        final EntityCollectionModel model = getModel();
        final List<ObjectAdapter> adapterList = model.getObject();

        final GMap map = new GMap(ID_MAP);
        map.setStreetViewControlEnabled(true);
        map.setScaleControlEnabled(true);
        map.setScrollWheelZoomEnabled(true);
        map.setPanControlEnabled(true);
        map.setDoubleClickZoomEnabled(true);

        // centre the map on the first object that has a location.
        for (ObjectAdapter adapter : adapterList) {
            GLatLng latLng = asGLatLng((Locatable)adapterList.get(0).getObject());
            if(latLng != null) {
                map.setCenter(latLng);
                break;
            }
        }
       
        addOrReplace(map);
View Full Code Here


    private void buildGui() {

        final EntityCollectionModel model = getModel();
        final List<ObjectAdapter> adapterList = model.getObject();

        final GMap map = new GMap(ID_MAP);
        map.setStreetViewControlEnabled(true);
        map.setScaleControlEnabled(true);
        map.setScrollWheelZoomEnabled(true);
        map.setPanControlEnabled(true);
        map.setDoubleClickZoomEnabled(true);

        // centre the map on the first object that has a location.
        for (ObjectAdapter adapter : adapterList) {
            GLatLng latLng = asGLatLng((Locatable)adapterList.get(0).getObject());
            if(latLng != null) {
                map.setCenter(latLng);
                break;
            }
        }
       
        addOrReplace(map);
View Full Code Here

    private static final long serialVersionUID = 1L;

    public HomePage()
    {
        final GMap map = new GMap("topPanel");
        add(map);

        final WebMarkupContainer zoomIn = new WebMarkupContainer("zoomIn");
        zoomIn.add(map.new ZoomInBehavior("onclick"));
        add(zoomIn);
View Full Code Here

    private final MultiLineLabel boundsLabel;
    private DragEndListener moveEndBehavior;

    public HomePage()
    {
        final GMap map = new GMap("map");
        add(map);
        moveEndBehavior = new MyDragEndListener();
        map.add(moveEndBehavior);
        map.add(new LoadListener()
        {
            private static final long serialVersionUID = 1L;

            @Override
            protected void onLoad(AjaxRequestTarget target)
            {
                target.add(boundsLabel);
            }
        });

        map.add(new ZoomChangedListener()
        {
            private static final long serialVersionUID = 1L;

            @Override
            protected void onZoomChanged(AjaxRequestTarget target)
            {
                target.add(zoomLabel);
                target.add(boundsLabel);
            }
        });

        zoomLabel = new Label("zoom", new PropertyModel<Integer>(map, "zoom"));
        zoomLabel.setOutputMarkupId(true);
        add(zoomLabel);

        boundsLabel = new MultiLineLabel("bounds", new PropertyModel<GLatLngBounds>(map, "bounds"))
        {
            private static final long serialVersionUID = 1L;

            @Override
            public IConverter getConverter(@SuppressWarnings( "rawtypes") Class type)
            {
                if (GLatLngBounds.class.isAssignableFrom(type))
                {
                    return new IConverter()
                    {
                        private static final long serialVersionUID = 1L;

                        @Override
                        public GLatLngBounds convertToObject(String value, Locale locale)
                        {
                            throw new UnsupportedOperationException();
                        }

                        @Override
                        public String convertToString(Object value, Locale locale)
                        {
                            GLatLngBounds bounds = (GLatLngBounds) value;

                            StringBuffer buffer = new StringBuffer();
                            buffer.append("NE (");
                            buffer.append(bounds.getNE().getLat());
                            buffer.append(",");
                            buffer.append(bounds.getNE().getLng());
                            buffer.append(")\nSW (");
                            buffer.append(bounds.getSW().getLat());
                            buffer.append(",");
                            buffer.append(bounds.getSW().getLng());
                            buffer.append(")");
                            return buffer.toString();
                        }
                    };
                }
                return super.getConverter(type);
            }
        };
        boundsLabel.setOutputMarkupId(true);
        add(boundsLabel);
        final Label enabledLabel = new Label("enabled", new Model<Boolean>()
        {
            private static final long serialVersionUID = 1L;

            @Override
            public Boolean getObject()
            {
                return map.getBehaviors().contains(moveEndBehavior);
            }
        });
        enabledLabel.add(new AjaxEventBehavior("onclick")
        {
            private static final long serialVersionUID = 1L;

            @Override
            protected void onEvent(AjaxRequestTarget target)
            {
                if (map.getBehaviors().contains(moveEndBehavior))
                {
                    map.remove(moveEndBehavior);
                }
                else
                {
                    // AbstractAjaxBehaviors are not reusable, so we have
                    // to recreate:
                    // https://issues.apache.org/jira/browse/WICKET-713
                    moveEndBehavior = new MyDragEndListener();
                    map.add(moveEndBehavior);
                    map.update();
                }
                target.add(map);
                target.add(enabledLabel);
            }
        });
View Full Code Here

{
    private static final long serialVersionUID = 1L;

    public HomePage()
    {
        final GMap map = new GMap("topPanel");
        add(map);
       
        List<GLatLng> markersToShow = new ArrayList<GLatLng>();
       
        // add some markers
        GLatLng glatlng1 = new GLatLng(47.4915285, 8.2050407);
        GMarkerOptions opts1 = new GMarkerOptions(map, glatlng1);
        GMarker marker1 = new GMarker("marker1", opts1);
        map.addOverlay(marker1);
       
        GLatLng glatlng2 = new GLatLng(50.7706934, 2.2164129);
        GMarkerOptions opts2 = new GMarkerOptions(map, glatlng2);
        GMarker marker2 = new GMarker("marker2", opts2);
        map.addOverlay(marker2);
       
        GLatLng glatlng3 = new GLatLng(48.858859, 2.34706);
        GMarkerOptions opts3 = new GMarkerOptions(map, glatlng3);
        GMarker marker3 = new GMarker("marker3", opts3);
        map.addOverlay(marker3);
       
        // add them to the list of coordinates that we need in our viewport
        markersToShow.add(glatlng1);
        markersToShow.add(glatlng2);
        markersToShow.add(glatlng3);
        map.fitMarkers(markersToShow);
    }
View Full Code Here

    private final GMap map;
    private final Label mapTypeLabel;

    public HomePage()
    {
        map = new GMap("panel");
        add(map);
        map.add(new MapTypeChangedListener()
        {
            private static final long serialVersionUID = 1L;
View Full Code Here

public class MapPanel extends Panel
{
  public MapPanel(String id)
  {
    super(id);
    GMap map = new GMap("map");
    map.setStreetViewControlEnabled(false);
    map.setScaleControlEnabled(true);
    map.setScrollWheelZoomEnabled(true);
    map.setCenter(new GLatLng(52.47649, 13.228573));       
    add(map);
  }
View Full Code Here

    private static final long serialVersionUID = 1L;

    public HomePage()
    {
        final GMap map = new GMap("topPanel");
        add(map);
        map.add(new ClickListener()
        {
            private static final long serialVersionUID = 1L;

            @Override
            protected void onClick(AjaxRequestTarget target, GLatLng latLng)
            {
                if (latLng != null)
                {
                    if (map.getOverlays().size() >= 3)
                    {
                        map.removeOverlay(map.getOverlays().get(0));
                    }
                    map.addOverlay(new GMarker(new GMarkerOptions(map, latLng)));
                }
            }
        });
    }
View Full Code Here

  private static final long serialVersionUID = 1L;

  public HomePage()
  {
    final GMap map = new GMap("map");
    map.setOutputMarkupId( true );
    add(map);

    WebMarkupContainer resize = new WebMarkupContainer( "resize" );
    resize.add( new AttributeModifier( "onclick", createResizeScript(map, 600, 600) + map.getTriggerResizeScript().toString() ) );
    add(resize);

    WebMarkupContainer resizeWrong = new WebMarkupContainer( "resizeWrong" );
    resizeWrong.add( new AttributeModifier( "onclick", createResizeScript(map, 600, 600) ));
    add(resizeWrong);
View Full Code Here

    private static final long serialVersionUID = 1L;

    public CustomPointPage()
    {
        GMap map = new GMap("map");
        map.setCenter(new GLatLng(52.37649, 4.888573));
        add(map);

        GIcon icon =
                new GIcon("/pin.gif").setScaledSize(
                new GSize(64, 64)).setSize(new GSize(64, 64));
        GIcon shadow =
                new GIcon("/shadow.png").setScaledSize(
                new GSize(64, 64)).setSize(new GSize(64, 64));
        GOverlay marker = new GMarker(new GMarkerOptions(map, new GLatLng(52.37649, 4.888573), "My Title", icon, shadow));

        map.addOverlay(marker);
    }
View Full Code Here

TOP

Related Classes of org.wicketstuff.gmap.GMap$ZoomOutBehavior

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.