0
我很困惑如何去添加樣式到我的功能,其中包括一個矢量內的LineString。我是否將樣式添加到LineString或Vector?我想更改線條的顏色和大小,並儘可能使線條不透明。如何添加樣式到我的特徵(矢量LineString)?
mapObject = new OpenLayers.Layer.Vector("Vector");
var p1 = new OpenLayers.Geometry.Point(mapObjectTopLeftLon, mapObjectTopLeftLat);
var p2 = new OpenLayers.Geometry.Point(mapObjectTopRightLon, mapObjectTopRightLat);
var p3 = new OpenLayers.Geometry.Point(mapObjectBottomRightLon, mapObjectBottomRightLat);
var p4 = new OpenLayers.Geometry.Point(mapObjectBottomLeftLon, mapObjectBottomLeftLat);
var p5 = new OpenLayers.Geometry.Point(mapObjectTopLeftLon, mapObjectTopLeftLat);
var pnt = [];
pnt.push(p1,p2,p3,p4,p5);
mapObject.addFeatures([new OpenLayers.Feature.Vector(new OpenLayers.Geometry.LineString(pnt))]);
map.addLayer(mapObject);