com.google.android.gms.maps.model.StreetViewPanoramaLocation Java Examples

The following examples show how to use com.google.android.gms.maps.model.StreetViewPanoramaLocation. 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: StreetViewNavigationActivity.java    From Complete-Google-Map-API-Tutorial with Apache License 2.0 5 votes vote down vote up
public void walk()
{
	StreetViewPanoramaLocation location = streetViewPanorama.getLocation();
	StreetViewPanoramaCamera camera = streetViewPanorama.getPanoramaCamera();
	if (location != null && location.links != null)
	{
		StreetViewPanoramaLink link = findClosestLinkToBearing(location.links, camera.bearing);
		streetViewPanorama.setPosition(link.panoId);
	}
}
 
Example #2
Source File: StreetViewAndMapActivity.java    From Complete-Google-Map-API-Tutorial with Apache License 2.0 5 votes vote down vote up
@Override
public void onStreetViewPanoramaChange(StreetViewPanoramaLocation streetViewPanoramaLocation)
{
	if (streetViewPanoramaLocation != null)
	{
		marker.setPosition(streetViewPanoramaLocation.position);
	}
}
 
Example #3
Source File: StreetViewPanoramaNavigationDemoActivity.java    From android-samples with Apache License 2.0 5 votes vote down vote up
public void onMovePosition(View view) {
    StreetViewPanoramaLocation location = mStreetViewPanorama.getLocation();
    StreetViewPanoramaCamera camera = mStreetViewPanorama.getPanoramaCamera();
    if (location != null && location.links != null) {
        StreetViewPanoramaLink link = findClosestLinkToBearing(location.links, camera.bearing);
        mStreetViewPanorama.setPosition(link.panoId);
    }
}
 
Example #4
Source File: StreetViewEventsActivity.java    From Complete-Google-Map-API-Tutorial with Apache License 2.0 4 votes vote down vote up
@Override
public void onStreetViewPanoramaChange(StreetViewPanoramaLocation streetViewPanoramaLocation)
{
	Log.d(MainActivity.TAG, "onStreetViewPanoramaChange() called with: streetViewPanoramaLocation = [" + streetViewPanoramaLocation + "]");
}
 
Example #5
Source File: NSTStreetView.java    From react-native-streetview with MIT License 4 votes vote down vote up
@Override
public void onStreetViewPanoramaReady(StreetViewPanorama panorama) {

    this.panorama = panorama;
    this.panorama.setPanningGesturesEnabled(allGesturesEnabled);

    final EventDispatcher eventDispatcher = ((ReactContext) getContext())
            .getNativeModule(UIManagerModule.class).getEventDispatcher();

    this.panorama.setOnStreetViewPanoramaCameraChangeListener(new StreetViewPanorama.OnStreetViewPanoramaCameraChangeListener() {
        @Override
        public void onStreetViewPanoramaCameraChange(StreetViewPanoramaCamera streetViewPanoramaCamera) {
            if (!(streetViewPanoramaCamera.bearing >= 0 ) && coordinate != null) {
                eventDispatcher.dispatchEvent(
                        new NSTStreetViewEvent(getId(), NSTStreetViewEvent.ON_ERROR)
                );
            }
        }
    });

    panorama.setOnStreetViewPanoramaChangeListener(new StreetViewPanorama.OnStreetViewPanoramaChangeListener() {
        @Override
        public void onStreetViewPanoramaChange(StreetViewPanoramaLocation streetViewPanoramaLocation) {
            if (streetViewPanoramaLocation != null) {
                WritableMap map = Arguments.createMap();
                map.putDouble("latitude", streetViewPanoramaLocation.position.latitude);
                map.putDouble("longitude", streetViewPanoramaLocation.position.longitude);
                eventDispatcher.dispatchEvent(
                        new NSTStreetViewEvent(getId(), NSTStreetViewEvent.ON_SUCCESS, map)
                );
            } else {
                eventDispatcher.dispatchEvent(
                        new NSTStreetViewEvent(getId(), NSTStreetViewEvent.ON_ERROR)
                );
            }
        }
    });

    if (coordinate != null) {
        this.panorama.setPosition(coordinate, radius);
    }

   long duration = 1000;
   if (bearing > 0) {
         StreetViewPanoramaCamera camera = new StreetViewPanoramaCamera.Builder()
       .zoom(zoom)
       .tilt(tilt)
       .bearing(bearing)
       .build();
         panorama.animateTo(camera,duration);
    }
    this.started = true;
}
 
Example #6
Source File: LotInfoFragment.java    From android with MIT License 4 votes vote down vote up
@Override
public void setAttributes(LotAttrs attrs, final StreetView streetView) {
    this.mAttrs = attrs;
    this.mStreetView = streetView;
    if (mAdapter != null) {
        mAdapter.setFooterAttrs(attrs);
    }

    if (vStreetViewPanoramaView != null) {
        vStreetViewPanoramaView.getStreetViewPanoramaAsync(new OnStreetViewPanoramaReadyCallback() {
            @Override
            public void onStreetViewPanoramaReady(final StreetViewPanorama panorama) {
                vStreetViewPanoramaView.setVisibility(View.VISIBLE);
                panorama.setUserNavigationEnabled(false);
                panorama.setPanningGesturesEnabled(false);
                panorama.setZoomGesturesEnabled(false);

                if (!TextUtils.isEmpty(streetView.getId())) {
                    panorama.setPosition(streetView.getId());

                    panorama.setOnStreetViewPanoramaChangeListener(new StreetViewPanorama.OnStreetViewPanoramaChangeListener() {
                        @Override
                        public void onStreetViewPanoramaChange(StreetViewPanoramaLocation streetViewPanoramaLocation) {
                            if (streetViewPanoramaLocation == null) {
                                Log.v(TAG, "Location not found. panoramaId: " + streetView.getId());
                                return;
                            }

                            try {
                                if (streetView.getId().equals(streetViewPanoramaLocation.panoId)) {
                                    panorama.animateTo(new StreetViewPanoramaCamera.Builder()
                                            .zoom(Const.UiConfig.STREET_VIEW_ZOOM)
                                            .bearing(streetView.getHead())
                                            .build(), Const.UiConfig.STREET_VIEW_DELAY);

                                    vStreetViewPanoramaView.postDelayed(new Runnable() {
                                        @Override
                                        public void run() {
                                            ObjectAnimator
                                                    .ofFloat(vStreetViewDelayFix, View.ALPHA, 1, 0)
                                                    .start();
                                        }
                                    }, Const.UiConfig.STREET_VIEW_DELAY);
                                }
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        }
                    });
                }
            }
        });
    }
}
 
Example #7
Source File: SplitStreetViewPanoramaAndMapDemoActivity.java    From android-samples with Apache License 2.0 4 votes vote down vote up
@Override
public void onStreetViewPanoramaChange(StreetViewPanoramaLocation location) {
    if (location != null) {
        marker.setPosition(location.position);
    }
}
 
Example #8
Source File: StreetViewPanoramaEventsDemoActivity.java    From android-samples with Apache License 2.0 4 votes vote down vote up
@Override
public void onStreetViewPanoramaChange(StreetViewPanoramaLocation location) {
    if (location != null) {
        panoChangeTimesTextView.setText("Times panorama changed=" + ++panoChangeTimes);
    }
}
 
Example #9
Source File: MainActivity.java    From journaldev with MIT License 3 votes vote down vote up
@Override
public void onStreetViewPanoramaChange(
        StreetViewPanoramaLocation streetViewPanoramaLocation) {


    Toast.makeText(getApplicationContext(), "Lat: " + streetViewPanoramaLocation.position.latitude + " Lng: " + streetViewPanoramaLocation.position.longitude, Toast.LENGTH_SHORT).show();

}