Hello,
Thanks for this app. Integration with Django looks very nice !
You might find my need too easy, but I just want being able to draw
old-school standard rectangle.
The OpenLayer examples (
http://openlayers.org/dev/examples/custom-
control.html) shows what kind of shape I want to drag. However:
- I would like to have the custom button in the toolbar, like for
Point and Polygons
- I would like the shape to stay in the map
See also
http://openlayers.org/dev/examples/boxes.html
I tooked a look at OpenLayer API, and:
1) OpenLayers.Geometry.Rectangle looked fine
http://dev.openlayers.org/docs/files/OpenLayers/Geometry/Rectangle-js.html
But documentation said it's not supported, and we should use something
like
var poly = new OpenLayers.Bounds(0,0,10,10).toGeometry();
I don't see how to use this in olwidget ...
2) OpenLayers.Handler.RegularPolygon looked fine
I've tried to implement it in olwidget.js, adding a custom geometry
eg. 'regularpolygon'.
So far I've add in olwidgets.js:
l.21:
multiGeometryClasses: {
'linestring': OpenLayers.Geometry.MultiLineString,
'point': OpenLayers.Geometry.MultiPoint,
'polygon': OpenLayers.Geometry.MultiPolygon,
'collection': OpenLayers.Geometry.Collection,
'regularpolygon': OpenLayers.Geometry.MultiPolygon,
},
l.648
} else if (geometries[i] == 'point') {
drawControl = new OpenLayers.Control.DrawFeature(this,
OpenLayers.Handler.Point, {
'displayClass': 'olControlDrawFeaturePoint',
"title": "Draw points"
});
} else if (geometries[i] == 'regularpolygon') {
drawControl = new OpenLayers.Control.DrawFeature(this,
OpenLayers.Handler.RegularPolygon, {
'displayClass': 'olControlDrawFeaturePolygon',
"title": "Draw boxs"
});
}
RegularPolygon is displayed fine, but I can still "rotate" it on the
map. I would like it to stay "parralells" to the latitudes/longitudes.
I've seen a snapAngle option from
http://dev.openlayers.org/docs/files/OpenLayers/Handler/RegularPolygon-js.html
, but I don't see how to pass it in olwidget code.
Any idea ?
Many thanks,
Stéphane