[OpenLayers-Users] problem with panel control
Eric Lemoine
Eric.Lemoine at camptocamp.com
Wed Mar 21 04:09:00 EDT 2007
Hi all,
I'd like to build my own panel control object, composed of a
Navigation and a DrawFeature. So far I've had no success, my panel
refuses to display!
My code looks like that of OpenLayers.Control.EditingToolbar:
MyToolbar = OpenLayers.Class.create();
MyToolbar.prototype =
OpenLayers.Class.inherit( OpenLayers.Control.Panel, {
initialize: function(layer, options) {
OpenLayers.Control.Panel.prototype.initialize.apply(this, [options]);
this.addControls(
[ new OpenLayers.Control.Navigation() ]
);
var controls = [
new OpenLayers.Control.DrawFeature(layer,
OpenLayers.Handler.Point, {'displayClass':
'olControlDrawFeaturePoint'})
];
for (var i = 0; i < controls.length; i++) {
controls[i].featureAdded = function(feature) {
feature.state = OpenLayers.State.INSERT; }
}
this.addControls(controls);
},
draw: function() {
var div = OpenLayers.Control.Panel.prototype.draw.apply(this,
arguments);
this.activateControl(this.controls[0]);
return div;
},
CLASS_NAME: "MyToolbar"
});
var tb = new MyToolbar(editLayer);
map.addControl(tb);
Any idea?
--
Eric Lemoine
Camptocamp France SAS
Savoie Technolac, BP 352
73377 Le Bourget du Lac, Cedex
Tel : 00 33 4 79 44 44 96
Mail : eric.lemoine at camptocamp.com
http://www.camptocamp.com
More information about the Users
mailing list