0
使用OpenLayers,我有一個包含10個以上地標的KML文件。我想要做的是,當我點擊單選按鈕時,特定的地標會改變它的顏色。當onClick單選按鈕時,更改特定地標的顏色
有人知道該怎麼做嗎?
謝謝。
編輯:
所以這是我到目前爲止有:
function init(){
///////////////////////////////////////////////
CONTROLS AND MAP STUFF
//////////////////////////////////////////////
var myvector = new OpenLayers.Layer.Vector("myvector", {
projection: map.displayProjection,
styleMap: new OpenLayers.StyleMap(
{ 'default':
{
strokeColor: "#777777",
strokeOpacity: 1,
strokeWidth: "2",
fillColor: "#FFF900",
fillOpacity: 1,
pointRadius: 8,
pointerEvents: "visiblePainted",
graphicName: "circle",
}
}),
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: url_time,
format: new OpenLayers.Format.KML({
extractStyles: false,
extractAttributes: true
})
})
});
map.addLayers([wms, wms2, myvector]);
select = new OpenLayers.Control.SelectFeature(myvector);
myvector.events.on({
"featureselected": onFeatureSelect,
"featureunselected": onFeatureUnselect
});
map.addControl(select);
select.activate();
map.zoomToExtent(new OpenLayers.Bounds(-53,-21,13,22));
}
function switchLabels() {
/////// PROBABLY HERE IS THE PLACE TO DO THE TRICK ////////
myvector.redraw();
}
///////////////////////////////////////////////
SOME OTHER THINGS
//////////////////////////////////////////////
而且radion按鈕:
<input name="button1" type="radio" value="button1" onClick="switchLabels()">
Here是本switchLabels一個職位,但我不知道如何更改由一個地標創建的點。
謝謝。
我們展示你的代碼。你有什麼嘗試? – Engineer
沒人?請? – guppista