Compare commits
No commits in common. "430b32d0c6cbc943b02d34825ac7bf4e5564e51b" and "cc24f96395909f9f7754b65a1693b25ff38a4189" have entirely different histories.
430b32d0c6
...
cc24f96395
@ -80,16 +80,22 @@
|
||||
MapEditor.panorama.setPano(panoLocationData.pano);
|
||||
},
|
||||
|
||||
requestPanoData: function (location) {
|
||||
requestPanoData: function (location, canBeIndoor) {
|
||||
var sv = new google.maps.StreetViewService();
|
||||
|
||||
sv.getPanorama({
|
||||
location: location,
|
||||
preference: google.maps.StreetViewPreference.NEAREST,
|
||||
radius: MapEditor.map.getSearchRadius(location),
|
||||
source: canBeIndoor ? google.maps.StreetViewSource.DEFAULT : google.maps.StreetViewSource.OUTDOOR
|
||||
}, function (data, status) {
|
||||
var panoLocationData = status === google.maps.StreetViewStatus.OK ? data.location : null;
|
||||
|
||||
if (panoLocationData === null && !canBeIndoor) {
|
||||
MapEditor.requestPanoData(location, true);
|
||||
return;
|
||||
}
|
||||
|
||||
document.getElementById('loading').style.visibility = 'hidden';
|
||||
|
||||
MapEditor.loadPanoForNewPlace(panoLocationData);
|
||||
|
@ -140,7 +140,7 @@ class Place extends Model
|
||||
return $this->pov->getZoom();
|
||||
}
|
||||
|
||||
public function getFreshPanoId(): ?string
|
||||
public function getFreshPanoId(bool $canBeIndoor = false): ?string
|
||||
{
|
||||
if (
|
||||
$this->panoIdCachedTimestamp !== null &&
|
||||
@ -152,13 +152,19 @@ class Place extends Model
|
||||
$request = new Request('https://maps.googleapis.com/maps/api/streetview/metadata', Request::HTTP_GET);
|
||||
$request->setQuery([
|
||||
'key' => $_ENV['GOOGLE_MAPS_SERVER_API_KEY'],
|
||||
'location' => $this->position->getLat() . ',' . $this->position->getLng()
|
||||
'location' => $this->position->getLat() . ',' . $this->position->getLng(),
|
||||
'source' => $canBeIndoor ? 'default' : 'outdoor'
|
||||
]);
|
||||
|
||||
$response = $request->send();
|
||||
$panoData = json_decode($response->getBody(), true);
|
||||
$panoId = $panoData['status'] === 'OK' ? $panoData['pano_id'] : null;
|
||||
|
||||
// enable indoor panos if no outdoor found
|
||||
if ($panoId === null && !$canBeIndoor) {
|
||||
return $this->getFreshPanoId(true);
|
||||
}
|
||||
|
||||
$this->panoIdCached = $panoId;
|
||||
$this->panoIdCachedTimestamp = new DateTime();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user