0

1つの問題ではない場合は、別の問題です。私はこれを一日中見てきましたが、ここで何が問題なのかわかりません。ここでも、county レイヤーと msa レイヤーの 2 つのレイヤーを含むマップがあります。ページ 1 には、county と表示されているページと、msa と表示されているリンクが 2 つあります。いずれかのリンクをクリックすると、マップの 1 つのレイヤーがオフになり、正しいレイヤーに表示されます。クリックイベントは次のとおりです。

$('.map-type-link').live('click', function () {
    params.display_region_type = parseInt($(this).attr('region_type'));

    if (params.display_region_type == 1) {

        app.currentFl = app.featureLayers[0];

    }
    else {

        app.currentFl = app.MSAfl;            
        app.flVis.setVisibility(false);
        app.MSAfl.setVisibility(true);
        app.currentFl.redraw();                        

    }                 

});

郡をクリックするだけでなく、app.flvis がまだ表示されています。

ここでは、フィーチャ レイヤーが作成されます。

dojo.forEach(app.layersUrls, function (info, idx) {
    app.featureLayers[idx] = new esri.layers.FeatureLayer(
        app.layersUrls[idx], {
            mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
            outFields: app.outFields[idx],
            opacity: 0.80
            }
        );       

    app.featureLayers[idx].setRenderer(br);

    //create min and max scales when layers load
    dojo.connect(app.featureLayers[idx], 'onLoad', function () {
        app.featureLayers[idx].minScale = app.layerScales[idx].min;
        app.featureLayers[idx].maxScale = app.layerScales[idx].max;
    });//ends connections 

    //add THIS feature layer to the map
    app.map.addLayer(app.featureLayers[idx]);
4

1 に答える 1

0

(私はあなたのすべての変数が何を意味するかを仮定しています。)

MSA レイヤーを有効にするには、4 行のコード (else ステートメント内) を使用します。

app.currentFl = app.MSAfl;            
app.flVis.setVisibility(false);
app.MSAfl.setVisibility(true);
app.currentFl.redraw();

if ステートメントには、レイヤーをオンまたはオフにしない 1 行のコードしかありません。

app.currentFl = app.featureLayers[0];

代わりに、else ステートメントで行ったことの例に従う必要があると思います。

app.currentFl = app.flVis;            
app.MSAfl.setVisibility(false);
app.flVis.setVisibility(true);
app.currentFl.redraw();

これは app.flVis が郡レイヤーであると仮定していますが、そうでない場合もあります。

于 2013-10-01T11:09:06.337 に答える