所以我设法在点击时在 OpenLayers 中创建了一个圆圈。但是,圆圈总是出现在地图的原点,我希望它出现在我点击的任何地方。这是我的代码 -
circleStyle = {
strokeColor: "#FF0000",
strokeOpacity: 1,
strokeWidth: 3,
fillOpacity: 0.8
}
lon = mapApp.get("mapModel").get("mouse").get("longitude")
lat = mapApp.get("mapModel").get("mouse").get("latitude")
circleLayer = new OpenLayers.Layer.Vector "Alpr GeoSearch"
circle = new OpenLayers.Geometry.Polygon.createRegularPolygon(
new OpenLayers.Geometry.Point(100,100),
10000,
60
)
feature = new OpenLayers.Feature.Vector(circle,testPoint,circleStyle)
circleLayer.addFeatures(feature)
console.log(circleLayer)
mapApp.map.openLayersMap.addLayer circleLayer