在哪里添加可见性:在openlayers代码中为false
where to add visibility: false in openlayers code?
我想知道在下面的代码中我可以在哪里添加visibility: 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
});
如果我没记错的话,我应该把visibility
放在这里:
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
}, {
visibility: 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
}
);
line_10.setVisibility(false);
相关文章:
- 从桌面读取python文件时高亮显示代码
- 如果 a 为 false,则 if(a) === if(false)
- 如何在angularJS中编辑时,如果DB中的值为true,则设置复选框,如果值为false,则取消选中复选框
- 如何将函数包装在函数中以避免代码重复
- 通过单击表单中的按钮,在代码生成中使用javascript生成字母数字代码
- 货币代码为欧元-金额的格式不应包含小数
- Regex代码只允许一个空格
- 为什么当async标志设置为false时,xmlhttprequest中的代码可以工作,而当它设置为true时却不能工作
- 这个代码会返回false吗
- 如何在选择框中设置只读 false,当选中复选框时,它将是可编辑的.在我的jquery代码中,禁用不起作用
- 使用 UseSubmitBehavior=false 访问代码隐藏中文本框的值
- 为什么这段代码不返回 false
- 返回false dos't停止ajax$.post中的代码
- 条件为false,但if语句中的代码在JavaScript中执行
- 在哪里添加可见性:在openlayers代码中为false
- 返回true/false在ajax代码中不起作用
- 这段代码用于检查应该返回false的数字
- 为什么if (false)语句中的代码被读取
- Javascript-以False条件运行代码
- 为什么这个代码日志返回false ?