我正在尝试使用 openlayer(多边形)的绘图功能。最终用户可以绘制多边形。但我想通过java脚本绘制多边形。我正在尝试使用openlayer的insertXY和insertDeltaXY函数,但是出现了一个js错误“对象不支持属性或方法'insertXY' ”。
跟随是我的代码块。
var draw = new OpenLayers.Control.DrawFeature(
vectorLayer,
OpenLayers.Handler.Polygon }
);
map.addControl(draw);
draw.activate();
//Listen for sketch events on the layer
draw.layer.events.on({
featureadded: that.PolygonAdded
});
//Draw polygon if provided from codebehind
//Insert a point in the current sketch given x & y coordinates
handler.insertXY(cords[0], cords[1]);
//Insert a point given offsets from the previously inserted point.
handler.insertDeltaXY(cords[2], cords[3]);
handler.insertDeltaXY(cords[4], cords[5]);
.....
非常感谢任何帮助。