我試圖在Bing地圖的EntityLayer
上顯示多個Pushpin
對象。雖然Pushpins
正在檢索數據,而EntityLayer
正確存儲Pushpins
,但MapView
未顯示EntityLayer
。EntityLayer未鏈接到MapView
JSONObject json = retrieveJSON();
JSONArray array = json.getJSONArray("Sites");
Coordinate closestGauge;
fooLayer = new EntityLayer("foos");
for(int i = 0; i < array.length(); i++)
{
JSONObject site = array.getJSONObject(i);
double lon = site.getDouble("Longitude");
double lat = site.getDouble("Latitude");
Pushpin foo = null;
fooCoordinate = new Coordinate(lat, lon);
PushpinOptions fooData = new PushpinOptions();
fooData.Text = Double.toString(site.getDouble("Data"));
fooData.Icon = Constants.PushpinIcons.RedFlag;
foo = new Pushpin(fooCoordinate, fooData);
_FWSGPSLayer.add(foo);
}
fooMap.getLayerManager().addLayer(fooLayer);
fooLayer.updateLayer();
通過Debug透視圖一起去,我注意到EntityLayer
從來沒有鏈接到MapView
爲_map
參數/值始終設置爲null
。我已經嘗試了各種顯示圖層的方法,例如從EntityLayer
調用setBingMapsView
方法,但目前爲止沒有任何工作。
有什麼我做錯了嗎?我試圖將示例與示例Bing地圖應用程序進行匹配,但它並沒有提供幫助。
編輯:我已經做了一些調試,這是我迄今發現的:當我註釋掉for循環,並簡單地添加一個圖釘,它的工作原理。這使我相信Bing地圖對可添加的圖釘數量有限制。但是,我的數組只包含〜200個數據點,而我被引導認爲上限是數千。