我正在尝试设置 LineString 的样式,但它似乎不起作用。这是我的代码:
function connectStationFeatures(feat1, feat2){
var lineLayer = getLinesLayer();
var point1 = feat1.geometry;
var point2 = feat2.geometry;
var style = new OpenLayers.StyleMap({
'fillColor':"#FF8C00",
'strokeWidth':10,
'strokeDashstyle':"dashdot"
});
var line = new OpenLayers.Geometry.LineString([point1, point2]);
lineLayer.addFeatures([new OpenLayers.Feature.Vector(line, {styleMap:style})]);
}
或者我试过:
function connectStationFeatures(feat1, feat2){
var lineLayer = getLinesLayer();
var point1 = feat1.geometry;
var point2 = feat2.geometry;
var style = new OpenLayers.StyleMap({
'fillColor':"#FF8C00",
'strokeWidth':10,
'strokeDashstyle':"dashdot"
});
var line = new OpenLayers.Geometry.LineString([point1, point2]);
var lineFeat = new OpenLayers.Feature.Vector(line);
lineFeat.styleMap = style;
lineLayer.addFeatures([lineFeat]);
}
非常感谢任何帮助!谢谢