你好,我有一个多几何学当你传递鼠标appair线时,怎样有一个像翻转的样式,我的问题是多几何中的差异线串有可能的不同颜色?。
在下一个例子中,当你选择了一个样式时,我有地标Durham Tees Valley,但我希望这两行有不同的颜色。
由于
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>UK & Ireland, Flight Maps</name>
<open>1</open>
<LookAt>
<longitude>-3.478829007934099</longitude>
<latitude>52.50255557278696</latitude>
<altitude>0</altitude>
<range>730703.2034581316</range>
<tilt>53.03089122623036</tilt>
<heading>30.72599120906411</heading>
</LookAt>
<Style id="test">
<LineStyle>
<color>ff235523</color>
<width>0.5</width>
</LineStyle>
</Style>
<Style id="doc"><ListStyle><ItemIcon><state>open closed</state><href>http://maps.google.com/mapfiles/kml/shapes/airports.png</href></ItemIcon></ListStyle></Style>
<Style id="airportfolder"><ListStyle><ItemIcon><state>open closed</state><href>http://maps.google.com/mapfiles/kml/shapes/placemark_circle_highlight.png</href></ItemIcon></ListStyle></Style>
<Style id="info"><ListStyle><listItemType>checkHideChildren</listItemType><ItemIcon><state>open closed</state><href>http://www.barnabu.co.uk/files/icons/info.png</href></ItemIcon></ListStyle></Style>
<Style id="sh_spider"><IconStyle><scale>1.2</scale><Icon><href>http://maps.google.com/mapfiles/kml/shapes/placemark_circle_highlight.png</href></Icon></IconStyle><LabelStyle><color>ff001111</color><scale>1.4</scale></LabelStyle><LineStyle><width>0.5</width><color>ffff111f</color></LineStyle></Style>
<Style id="sn_spider"><IconStyle><scale>0.7</scale><Icon><href>http://maps.google.com/mapfiles/kml/shapes/placemark_circle_highlight.png</href></Icon></IconStyle><LabelStyle><color>ffb5b5b5</color><scale>0.9</scale></LabelStyle><LineStyle><color>00ff11ff</color></LineStyle></Style>
<StyleMap id="spider"><Pair><key>normal</key><styleUrl>#sn_spider</styleUrl></Pair><Pair><key>highlight</key><styleUrl>#sh_spider</styleUrl></Pair></StyleMap>
<Style id="2_sh_spider"><IconStyle><scale>1.2</scale><Icon><href>http://maps.google.com/mapfiles/kml/shapes/placemark_circle_highlight.png</href></Icon></IconStyle><LabelStyle><color>ff110011</color><scale>1.4</scale></LabelStyle><LineStyle><width>0.5</width><color>ff11111f</color></LineStyle></Style>
<Style id="2_sn_spider"><IconStyle><scale>0.7</scale><Icon><href>http://maps.google.com/mapfiles/kml/shapes/placemark_circle_highlight.png</href></Icon></IconStyle><LabelStyle><color>ff11ffb5</color><scale>0.9</scale></LabelStyle><LineStyle><color>001111ff</color></LineStyle></Style>
<StyleMap id="2_spider"><Pair><key>normal</key><styleUrl>#2_sn_spider</styleUrl></Pair><Pair><key>highlight</key><styleUrl>#2_sh_spider</styleUrl></Pair></StyleMap>
<styleUrl>#doc</styleUrl>
<Folder><name>Airports</name>
<styleUrl>#airportfolder</styleUrl>
<Placemark><name>Durham Tees Valley</name><description></description>
<Snippet maxLines="0"></Snippet><styleUrl>#2_spider</styleUrl><MultiGeometry><LineString><altitudeMode>relativeToGround</altitudeMode><coordinates>-1.426979,54.5105876,0 -1.37505058232182,54.3588196840161,8130.76624025246 -1.32350445540046,54.2070296447423,15640.4403479026 -1.27233575193875,54.0552177670135,22453.9881416349 -1.22153968418068,53.90338433094,28503.3309041539 -1.17111154230159,53.7515296120054,33728.0256022233 -1.12104669283672,53.5996538811612,38075.8688134745 -1.07134057714712,53.4477574049198,41503.4183257466 -1.02198870992187,53.2958404454444,43976.4271973102 -0.972986677715595,53.1439032606379,45470.1859409886 -0.924330137520422,52.9919461042286,45969.769413186 -0.876014815371306,52.8399692258547,45470.1859409886 -0.828036504983954,52.6879728711457,43976.4271973102 -0.780391066424406,52.5359572818033,41503.4183257466 -0.733074424809449,52.3839226956791,38075.8688134745 -0.686082569037039,52.2318693468513,33728.0256022233 -0.639411550545936,52.0797974656991,28503.3309041538 -0.593057482103787,51.9277072789755,22453.9881416349 -0.547016536622892,51.7755990098789,15640.4403479026 -0.501284946002942,51.623472878122,8130.76624025247 -0.455859000000019,51.4713291000001,0 </coordinates></LineString>
<LineString><altitudeMode>relativeToGround</altitudeMode><coordinates>-1.426979,54.5105876,0 -1.37505058232182,54.3588196840161,8130.76624025246 -1.32350445540046,54.2070296447423,15640.4403479026 -1.27233575193875,54.0552177670135,22453.9881416349 -1.22153968418068,53.90338433094,28503.3309041539 -1.17111154230159,53.7515296120054,33728.0256022233 -1.12104669283672,53.5996538811612,38075.8688134745 -1.07134057714712,53.4477574049198,41503.4183257466 -1.02198870992187,53.2958404454444,43976.4271973102 -0.972986677715595,53.1439032606379,45470.1859409886 -0.924330137520422,52.9919461042286,45969.769413186 -0.876014815371306,52.8399692258547,45470.1859409886 -0.828036504983954,52.6879728711457,43976.4271973102 -0.780391066424406,52.5359572818033,41503.4183257466 -0.733074424809449,52.3839226956791,38075.8688134745 -0.686082569037039,52.2318693468513,33728.0256022233 -0.639411550545936,52.0797974656991,28503.3309041538 -0.593057482103787,51.9277072789755,22453.9881416349 -0.547016536622892,51.7755990098789,15640.4403479026 -0.501284946002942,51.623472878122,8130.76624025247 -0.455859000000019,51.4713291000001,0 </coordinates></LineString>
<LineString><altitudeMode>relativeToGround</altitudeMode><coordinates>-1.426979,54.5105876,0 -1.46306991162193,54.6452657167915,8130.76624025246 -1.4994007562172,54.7799330335197,15640.4403479026 -1.5359743201564,54.9145894238809,22453.9881416349 -1.57279343190481,55.0492347596452,28503.3309041539 -1.6098609628193,55.1838689106202,33728.0256022233 -1.64717982796325,55.3184917446126,38075.8688134745 -1.6847529869399,55.4531031273904,41503.4183257466 -1.72258344474472,55.5877029226427,43976.4271973102 -1.76067425263717,55.7222909919396,45470.1859409886 -1.79902850903249,55.8568671946911,45969.769413186 -1.83764936041401,55.9914313881044,45470.1859409886 -1.87654000226647,56.1259834271408,43976.4271973102 -1.91570368003095,56.2605231644716,41503.4183257466 -1.95514369008209,56.3950504504321,38075.8688134745 -1.99486338072804,56.5295651329761,33728.0256022233 -2.03486615323379,56.6640670576277,28503.3309041538 -2.0751554628687,56.7985560674327,22453.9881416349 -2.11573481997855,56.933032002909,15640.4403479026 -2.15660779108317,57.0674947019956,8130.76624025247 -2.19777799999999,57.201944,0 </coordinates></LineString>
<Point><coordinates>-1.426979,54.5105876,0</coordinates></Point></MultiGeometry></Placemark>
</Folder>
</Document>
</kml>
答案 0 :(得分:6)
不,请参阅KML常见问题解答,它们会解决您的question:
我可以为a中的不同几何分配不同的颜色/样式吗? MultiGeometry元素?
MultiGeometry元素将几何图形分组 在同一个地标元素中一起使用。这允许几何形状 共享相同的样式,并在列表中显示为一个项目,如 Google地球中的“我的位置”窗格。
使用 styleUrl 元素在地标级别设置样式 或者样式元素。因此,该地标中的各个几何图形 不能有不同的风格。
另请参阅我发现有用的解决方法:
经常使用的解决方法是为其创建单独的地标 每个几何体,允许每个几何体具有不同的风格。阻止 列表中的项目数量激增,将它们放在 文件夹 中 ListStyle , listItemType , checkHideChildren 。在Google地球中 例如,这会将所有地标放在同一文件夹中 “我的位置”中的元素,并阻止用户打开它 显示大量元素。
答案 1 :(得分:1)
不,这是不可能的。 Multigeometry是Placemark的子节点,它具有styleUrl元素。您最好将它们分解为不同的Placemark元素,并将它们分组到文件夹级别。