gpt4 book ai didi

ios - 标记未显示在 GMSPanoramaView 上

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:06:10 29 4
gpt4 key购买 nike

我有一个简单的测试应用程序,我在其中执行以下代码

    let marker = GMSMarker(position:CLLocationCoordinate2DMake(33.987884, -118.474434))
marker.icon = GMSMarker.markerImageWithColor(UIColor.redColor())
marker.panoramaView = panoramaView;
marker.snippet = "I am Here!"

panoramaView.moveNearCoordinate(marker.position)

如果我将坐标移动到海滩外的其他街道,我可以很好地看到标记。但是从上面的代码我什么也看不到。有谁知道为什么我可以让一个区域在 GMSPanoramaView 中正常显示,但是在那里放置一个标记却不起作用?

最佳答案

我认为有些实现没有完成。不确定这些实现是什么,但我找到了一些关于您的问题的教程。或者根据文档“请注意,如果标记的位置距离 panoramaView 的当前全景图位置太远,它将不会显示,因为它会太小”。

检查 Street View locations and point-of-view (POV) :

GMSPanoramaView *panoView_;
panoView_.camera = [GMSPanoramaCamera cameraWithHeading:180
pitch:-10
zoom:1];

街景中的标记

// Create a marker at the Eiffel Tower
CLLocationCoordinate2D position = CLLocationCoordinate2DMake(48.858,2.294);
GMSMarker *marker = [GMSMarker markerWithPosition:position];

// Add the marker to a GMSPanoramaView object named panoView_
marker.panoramaView = panoView_;

// Add the marker to a GMSMapView object named mapView_
marker.map = mapView_;

这是第一个选项,另一个选项是 WebView 中的 Google Maps JavaScript APIhttps://developers.google.com/maps/documentation/javascript/examples/streetview-overlays

var panorama;

function initMap() {
var astorPlace = {lat: 40.729884, lng: -73.990988};

// Set up the map
var map = new google.maps.Map(document.getElementById('map'), {
center: astorPlace,
zoom: 18,
streetViewControl: false
});

// Set up the markers on the map
var cafeMarker = new google.maps.Marker({
position: {lat: 40.730031, lng: -73.991428},
map: map,
icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_icon&chld=cafe|FFFF00',
title: 'Cafe'
});

var bankMarker = new google.maps.Marker({
position: {lat: 40.729681, lng: -73.991138},
map: map,
icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_icon&chld=dollar|FFFF00',
title: 'Bank'
});

var busMarker = new google.maps.Marker({
position: {lat: 40.729559, lng: -73.990741},
map: map,
icon: 'http://chart.apis.google.com/chart?chst=d_map_pin_icon&chld=bus|FFFF00',
title: 'Bus Stop'
});

// We get the map's default panorama and set up some defaults.
// Note that we don't yet set it visible.
panorama = map.getStreetView();
panorama.setPosition(astorPlace);
panorama.setPov(/** @type {google.maps.StreetViewPov} */({
heading: 265,
pitch: 0
}));
}

function toggleStreetView() {
var toggle = panorama.getVisible();
if (toggle == false) {
panorama.setVisible(true);
} else {
panorama.setVisible(false);
}
}

这里是教程的链接和代码的repo

关于ios - 标记未显示在 GMSPanoramaView 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37304881/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com