[OpenLayers-Users] custom function after dblclick

Jachym Cepicky jachym.cepicky at gmail.com
Thu Jun 21 16:47:00 EDT 2007


vector_layer = new OpenLayers.Layer.Vector( "Editable" );
...
vector_layer.preFeatureInsert =  function(feature) {
    // do something with the feature
};


jachym


Jachym Cepicky píše v Čt 21. 06. 2007 v 09:36 +0200:
> Hi,
> 
> I would like to call some function immediately, after the polygon is
> digitized (user ends the digitization with dblclick and
> OpenLayers.Handler.Polygon.dblclick(evt)  is called.
> 
> I did it like this:
> 
> /*
>  * reinitialization of dblclick function
>  */
> OpenLayers.Handler.Polygon.prototype.dblclick = function(evt) {
>         if(!this.freehandMode(evt)) {
>             // remove the penultimate point
>             var index = this.line.geometry.components.length - 2;
> 
> this.line.geometry.removeComponent(this.line.geometry.components[index]);
>             this.finalize();
>         }
>         serialize("GeoRSS");
>         return false;
>     }
> 
> /*
>  * Added editing toolbar
>  */
> editbar = new OpenLayers.Control.EditingToolbar(vlayer);
> map.addControl(editbar);
> 
> 
> 
> /*
>  * function for displaying digitized coordinates
>  */
> 
> function serialize(type) {
>             var xmls = new XMLSerializer();
> 
>             var serialize = new
> OpenLayers.Format[type]({},map.layers[1]);
>             var data = serialize.write(map.layers[1].features);
>             alert(xmls.serializeToString(data));
> }
> 
> Is there some better way, how to call some function, when digitizing is
> done?
> 
> Thanks a lot
> 
> Jachym
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
-- 
Jachym Cepicky
e-mail: jachym.cepicky at gmail.com
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Toto je =?UTF-8?Q?digit=C3=A1ln=C4=9B?=
	=?ISO-8859-1?Q?_podepsan=E1?= =?UTF-8?Q?_=C4=8D=C3=A1st?=
	=?ISO-8859-1?Q?_zpr=E1vy?=
Url : http://lists.osgeo.org/pipermail/openlayers-users/attachments/20070621/3a05a7a8/attachment.bin


More information about the Users mailing list