4

同じジオロケーションで「ロンドン」に 2 つの画鋲がある場合、それらを離して両方が見えるようにする API はありますか?

PreventIconCollisions を持っていた古いマップ ポイント API に関するドキュメントしか見つけることができません。

JavaScript API を使用しています。

4

2 に答える 2

0

私の理解が正しければ、同じ場所に同様の情報がありますが、これで正しいでしょうか?

両方の情報を表示するには、次の 2 つのオプションがあります。

  1. このUI要素内に情報を表示する適切な方法を使用して、テキストボックス内の情報をマージします(たとえば、独自のタブ付きインフォボックスを使用)
  2. 特定のレベルのズームにいるときに、ポイントを手動でクラスター解除します

これを設定するためのデフォルトのプロパティはなく、多くのプッシュピンでこれを行うのは本当に面倒ですが、主なアイデアでは、次のことを行う必要があります。特定のズームレベル(またはより高いズームレベル)にいる場合は、viewchangeend イベントを検出します。 ) 次に、それらをデクラスタリングします (私はこれを近くの画鋲の decluter と呼びます)。

// Bind pushpin mouseover.
    Microsoft.Maps.Events.addHandler(pin, 'mouseover', function (e) {
        var currentPin = e.target;
        currentPin.setOptions({ visible: false });
        var currentLocation = currentPin.getLocation().clone();

        var currentPoint = bmGlobals.geo.map.tryLocationToPixel(currentLocation);
        if (currentPin.associatedCluster.length == 2) {
            // Display the first pushpin
            var pinA = createPin(currentPin.associatedCluster[0]);
            var locA = bmGlobals.geo.map.tryPixelToLocation(new Microsoft.Maps.Point(currentPoint.x - pinA.getWidth(), currentPoint.y));
            pinA.setLocation(locA);
            bmGlobals.geo.layerClusteredPin.push(pinA);

            // Display the second pushpin
            var pinB = createPin(currentPin.associatedCluster[1]);
            var locB = bmGlobals.geo.map.tryPixelToLocation(new Microsoft.Maps.Point(currentPoint.x + pinB.getWidth(), currentPoint.y));
            pinB.setLocation(locB);
            bmGlobals.geo.layerClusteredPin.push(pinB);
        }
    });

これについて bing maps モジュールを作成しようとしますが、実際には、クラスター化された画鋲 (または 2 つの関連付けられたデータ オブジェクトを持つ独自の画鋲) を取得する必要があります。クライアント側でのレンダリング。

于 2013-01-30T06:46:48.650 に答える