0

ズームコントロール付きのGeoExtマップパネルがあります。setVisibilityマップ上のレイヤーが「範囲外」にある場合、つまりそれらがfalseに設定されている場合、ツリーパネルの一部のノードを無効にしたいのですが。ズームエンドイベントが機能していて、チェックチェンジイベントも機能していますが、ユーザーがズームバーを複数のレベルに押すと、チェックチェンジイベントが複数回評価されます。もう1つの問題は、ズームエンドイベントが終了した後もチェックチェンジが終了することです。ユーザーがノードのチェックボックスをオンまたはオフにするだけで起動します。このcheckchangeイベントを1回だけ実行し、ユーザーがズームバーを使用していない場合に発生しないように制御する方法が本当に必要です...

map.events.on({ "zoomend": function (e) {

                layerTree.on("checkchange", function (node, checked) {
                    alert(node.text + "Inside event");
                    if(checked == false)
                        node.disable();
                    else if(checked == true)
                        node.enable();

                });

                    if (this.getZoom() > 7) {
                        tib_villages.setVisibility(true);
                        tib_lakes.setVisibility(true);
                        tib_townships.setVisibility(true);


                    }
                    else {

                                    tib_villages.setVisibility(false);
                                    tib_lakes.setVisibility(false);
                                    tib_townships.setVisibility(false);

                        if (this.getZoom() > 5) {
                            infrastructure.setVisibility(true);
                            geography.setVisibility(true);
                            geography2.setVisibility(true);
                            tib_countys.setVisibility(true);

                        }
                        else{
                            infrastructure.setVisibility(false);
                            geography.setVisibility(false);
                            geography2.setVisibility(false);
                            tib_countys.setVisibility(false);
                        }
                    }//end else

                }//end function (e)

            }); //end map.events.on

いつもありがとうございました:)

エルシェ

4

1 に答える 1

1

作業はすでに完了していることがわかりました:)。http://trac.geoext.org/attachment/ticket/235/autoDisableLayerNode.patchにパッチがあり、minScale / maxScaleプロパティなどに基づいてノードを自動的に無効/有効にします。このファイルを自分のファイルに入れて、パッチを適用しました。 GeoExtディレクトリで、GeoExtディレクトリで次のコマンドを実行します。

patch -p0 < autoDisableLayerNode.patch

これがお役に立てば幸いです。それは私にとって不思議に働きました:)

エルシェ

于 2010-10-28T16:21:48.717 に答える