0
我想知道我在哪裏可以添加知名度:假在下面的代碼: 就像在第二個代碼?在openlayers代碼中增加可見性:false?
var line_10 = new OpenLayers.Layer.GML("Line nr-10",
"lines/line_10.kml",
{
format: OpenLayers.Format.KML,
style: {strokeWidth: 4, strokeColor: "#f08080", fillOpacity: 1 },
projection: map.displayProjection
}
);
第二碼:
var linja4_2 = new OpenLayers.Layer.Vector("Line nr-4 stations", {
projection: map.displayProjection,
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.HTTP({
url: "/data/linja-nr4.kml",
format: new OpenLayers.Format.KML({
extractStyles: true,
extractAttributes: true
})
}),
visibility: false
});
嘗試使用GML上的'setVisibility()'。 http://dev.openlayers.org/docs/files/OpenLayers/Layer/GML-js.html#OpenLayers.Layer.GML.setVisibility – Smamatti
對不起,但我不知道應該放在哪一行。 !? –
在你的變量line_10聲明後面的代碼之外。我不能在這裏測試它,但我想這應該工作:'line_10.setVisibility(false);' – Smamatti