マップにポリゴンを作成するために、jQuery.getJSON()
ポリゴンとマルチポリゴンを含む geojson ファイルを読み込んでいます。次に、github プラグイン (loadgeojson) を使用して geojson を分析し、最終的にマップ上にポリゴンを作成します。
が呼び出される<div>
直前に表示されるマップをオーバーレイする読み込み中の gif を配置します。jQuery.getJSON()
問題は外すタイミングです。すべてのポリゴンの表示プロパティをTrueに設定すると、ロード アニメーションが消えます。
<div>
マップ上にポリゴンが表示されたときに を消したいです。でも、とりあえず、その少し前に消えます。そのため、低速のブラウザでは<div>
、ポリゴンが消えてから現れるまでに比較的大きな遅延があります。
イベントにリスナーを配置しようとしましたが、必要なものに対応するイベントが見つかりませんでした。
マップにポリゴンが表示されたときにロード アニメーションを削除するにはどうすればよいですか?
これが私のコードです:
function readJSON(id){
showLoadingAnimation();
// If .json hasn't been read
if(stockArray[id].length == 0) {
$.getJSON(id + ".json", function(data){
showFeature(data, id)
})
}
}
function showFeature(geojson, elemtype){
currentFeature_or_Features = new GeoJSON(geojson, elemtype, options);
if (currentFeature_or_Features.type && currentFeature_or_Features.type == "Error"){
return;
}
// Display object
if (currentFeature_or_Features.length){
for (var i = 0; i < currentFeature_or_Features.length; i++){
if(currentFeature_or_Features[i].length){
for(var j = 0; j < currentFeature_or_Features[i].length; j++){
// Display multipolygon
currentFeature_or_Features[i][j].setMap(map);
// Mouse events for multipolygons
mouseEventsMulti(i,j,elemtype);
}
}
else{
// Display polygons, polylines and points
currentFeature_or_Features[i].setMap(map);
// Mouse events for polygons, polylines and points
mouseEventsSimple(i,elemtype)
}
}
} else {
currentFeature_or_Features.setMap(map)
}
// Stop loading animation
dontShowLoadingAnimation();
}