点击图层列表Google Earth后改变placemark的样式



Google Earth:在图层列表中点击Placemark后是否可以改变Placemark的样式?默认情况下,如果你在图层列表中点击Placemark, Balooon(弹出)将在Placemark上打开。我也想改变风格。

谢谢

KML允许使用StyleMap为给定的Placemark定义两组样式。

StyleMap允许你定义一个默认样式(普通)和一个高亮样式,当用户将鼠标悬停在地图上的特征上时,高亮样式会激活。

  <Style id="normalState">
      <IconStyle>
        <scale>1.1</scale>
        <Icon>
          <href>http://maps.google.com/mapfiles/kml/paddle/A.png</href>
        </Icon>            
      </IconStyle>
  </Style>
  <Style id="highlightState">
      <IconStyle>
        <scale>1.3</scale>
        <Icon>
          <href>http://maps.google.com/mapfiles/kml/paddle/B.png</href>
        </Icon>           
      </IconStyle>
  </Style>
  <StyleMap id="styleMapExample">
    <Pair>
      <key>normal</key>
      <styleUrl>#normalState</styleUrl>
    </Pair>
    <Pair>
      <key>highlight</key>
      <styleUrl>#highlightState</styleUrl>
    </Pair>
  </StyleMap>

这里有一个简单的例子,当你将鼠标悬停在图标上时,它会改变图标及其大小:
http://kml-samples.googlecode.com/svn/trunk/kml/Style/inline-stylemap.kml

最新更新