<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 310, comments - 6939, trackbacks - 0, articles - 3
      BlogJava :: 首頁 :: 新隨筆 :: 聯(lián)系 :: 聚合  :: 管理

    Clustering Pushpins with the Virtual Earth Map Control API

    One of the new features introduced in the Virtual Earth Map Control API is Pushpin Clustering.  When there are hundreds of pushpin shapes on the map in a dense area, the map can become very cluttered. The pushpins can overlap each other and obscure the map view and make the map difficult to use.  Previously, to solve this problem, developers using the Virtual Earth map control would have to either divide groups of pushpins into VEShapeLayers and manually control which layers to show and hide at different zoom levels, or just not show Pushpins at zoom levels if there were too many on the screen.  With the v6.2 Virtual Earth Map Control API, this situation has gotten a lot easier to manage with the addition of the pushpin clustering feature.

    In the v6.2 Virtual Earth Map Control API, we introduced two new methods on the VEShapeLayer to support pushpin clustering.  In a previous blog post awhile back, I talked about the VEShapeLayer class which is designed to group a set of VEShapes so they can be managed as a collective group.  The two new methods for pushpin clustering are VEShapeLayer.SetClusteringConfiguration and VEShapeLayer.GetClusteredShapes.  The v6.2 Virtual Earth Map Control API is reverse compatible with the previous v6.1 and v6 APIs and does not cluster pushpins by default.

    The SetClusteringConfiguration method allows you to specify how you want to cluster shapes in a shape layer.  The first parameter is either a VEClusteringType enumeration specifying a known clustering algorithm supported by Virtual Earth, or it can be a reference to a custom function which does the clustering.  Currently VEClusteringType can either be VEClusteringType.Grid to specify a grid-based clustering algorithm or VEClusteringType.None which turns off clustering.  By default clustering is off if you do not call SetClusteringConfiguration on a VEShapeLayer.

    So, you can turn on grid clustering with a single call to SetClusteringConfiguration.  Assuming you have a VEShapeLayer reference called shapeLayer, here's the syntax:

    shapeLayer.SetClusteringConfiguration(VEClusteringType.Grid);

    The built-in grid based clustering algorithm divides the screen into equal-sized squares.  If there are more than one VEShape pushpins in a square, they are combined into a cluster.  So, at the highest altitude, you will see more clusters and at the lowest altitude (highest level of detail) you will see less clusters, but more individual shapes.  So, as you zoom in on clusters to highest level of detail, they will eventually break up and show individual shapes.  So, with one line of code, this simple algorithm now reduces clutter on the map significantly and divides shapes up into manageable chunks.  By default, pushpin clusters will have a special cluster pushpin icon just like VEShape pushpins have their own default pin icon also.  Each cluster will also have a default popup balloon with information about the cluster.  The default popup shows the number of shapes in the cluster.  In a future blog post, I will show you how to override some of these default settings to provide more advanced customization to pushpin clustering.

    Figure 1 below shows a set of pushpins that are not clustered.  Figure 2 shows the same set of pushpins clustered with Grid clustering: 

    Figure 1. Unclustered Pushpins Figure 2. Clustered Pushpins

     

    If you want to turn off pushpin clustering after you have turned it on, you just have to make the following call:

    shapeLayer.SetClusteringConfiguration(VEClusteringType.None);

    If you want to know what shapes are in each pushpin cluster, you can do so with the GetClusteredShapes method on the VEShapeLayer which also takes in a VEClusteringType parameter.  For example:

    var shapeClusters = shapeLayer.GetClusteredShapes(VEClusteringType.Grid)

    This call returns an array of VEClusterSpecification objects representing the set of shape clusters with the passed in clustering type.  Each VEClusterSpecification object in the array represents a cluster.  The Shapes property on the object specifies the pushpins in the cluster.  The LatLong property is a VELatLong and specifies the Latitude, Longitude location of the center of the cluster where the cluster icon is positioned.  This provides all the information you have for a cluster, so no information is lost when pushpins are clustered. Also, this method works even when clustering is off. So, if you want to have a complete custom rendering for a cluster, or just know what shapes would be clustered if you turned clustering on, you can use this method.

    Click on the link below to see a sample of pushpin clustering with Virtual Earth.

    Virtual Earth Map Control API Clustering Sample

    Keith Kinnan

    Software Development Lead, Virtual Earth Platform


    只有注冊用戶登錄后才能發(fā)表評論。


    網(wǎng)站導(dǎo)航:
     
    主站蜘蛛池模板: 和老外3p爽粗大免费视频| 日韩亚洲AV无码一区二区不卡 | a级毛片免费网站| 免费jjzz在线播放国产| 处破女第一次亚洲18分钟| 国产免费久久精品久久久| 亚洲AV成人无码网站| 又黄又爽无遮挡免费视频| 看成年女人免费午夜视频| 亚洲国产精品自产在线播放| 又大又硬又粗又黄的视频免费看 | 亚洲人成黄网在线观看| 国产1024精品视频专区免费| 国产亚洲中文日本不卡二区| 蜜臀91精品国产免费观看| 尤物视频在线免费观看| 亚洲国产一二三精品无码| 日本免费一区二区三区四区五六区| 亚洲综合无码一区二区| 成年人免费视频观看| 国产亚洲精品美女久久久久 | 亚洲成熟xxxxx电影| 国产92成人精品视频免费| 亚洲精品日韩一区二区小说| 亚洲av午夜成人片精品电影| 岛国精品一区免费视频在线观看| 亚洲欧洲日产国产综合网| 成年在线网站免费观看无广告| 美美女高清毛片视频黄的一免费| 亚洲日本韩国在线| 中文字幕免费在线观看| 亚洲国产aⅴ成人精品无吗| 亚洲香蕉成人AV网站在线观看| 99热这里只有精品6免费| 亚洲AV成人一区二区三区观看| 亚洲人成精品久久久久| 国产精品无码免费播放| 中文在线观看免费网站| 亚洲人妖女同在线播放| 国产成人精品亚洲精品| 亚洲免费网站观看视频|