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
> [email protected]
> http://openlayers.org/mailman/listinfo/users
-- 
Jachym Cepicky
e-mail: [EMAIL PROTECTED]
URL: http://les-ejk.cz
GPG: http://www.les-ejk.cz/pgp/jachym_cepicky-gpg.pub

Attachment: signature.asc
Description: Toto je digitálně podepsaná část zprávy

_______________________________________________
Users mailing list
[email protected]
http://openlayers.org/mailman/listinfo/users

Reply via email to