Example usage for com.google.gwt.maps.client.streetview Pov newInstance

List of usage examples for com.google.gwt.maps.client.streetview Pov newInstance

Introduction

In this page you can find the example usage for com.google.gwt.maps.client.streetview Pov newInstance.

Prototype

public static Pov newInstance() 

Source Link

Document

Returns a new instance of Pov class.

Usage

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

License:Apache License

public StreetviewDemo() {
    StreetviewPanoramaOptions options = StreetviewPanoramaOptions.newInstance();
    options.setLatLng(tenthStreet);/* ww w. ja  v  a2 s .c o m*/
    svClient = new StreetviewClient();
    panorama = new StreetviewPanoramaWidget(options);
    panorama.setSize("500px", "300px");

    map = new MapWidget(tenthStreet, 16);
    map.setSize("500px", "300px");
    map.addMapClickHandler(new MapClickHandler() {
        public void onClick(MapClickEvent event) {
            LatLng point = event.getLatLng() == null ? event.getOverlayLatLng() : event.getLatLng();
            if (point != null) {
                svClient.getNearestPanoramaLatLng(point, new LatLngStreetviewCallback() {
                    @Override
                    public void onFailure() {
                    }

                    @Override
                    public void onSuccess(LatLng point) {
                        panorama.setLocationAndPov(point, Pov.newInstance());
                    }
                });
            }
        }
    });

    panorama.addInitializedHandler(new StreetviewInitializedHandler() {
        public void onInitialized(StreetviewInitializedEvent event) {
            currentLatLng = event.getLocation().getLatLng();
            currentPov = event.getLocation().getPov();
            map.setCenter(currentLatLng);
            updatePolyline();
        }
    });

    panorama.addPitchChangedHandler(new StreetviewPitchChangedHandler() {
        public void onPitchChanged(StreetviewPitchChangedEvent event) {
            currentPov.setPitch(event.getPitch());
            updatePolyline();
        }
    });

    panorama.addYawChangedHandler(new StreetviewYawChangedHandler() {
        public void onYawChanged(StreetviewYawChangedEvent event) {
            currentPov.setYaw(event.getYaw());
            updatePolyline();
        }
    });

    panorama.addZoomChangedHandler(new StreetviewZoomChangedHandler() {
        public void onZoomChanged(StreetviewZoomChangedEvent event) {
            currentPov.setZoom(event.getZoom());
            updatePolyline();
        }
    });

    panel = new VerticalPanel();
    panel.add(panorama);
    panel.add(map);
    initWidget(panel);
}