Hi,
I would like to deactivate the control based on OpenLayers.Control.Measure 
inside its own callback function. After the second click the error appears - 
"this.point.geometry' is null or not an object" on 
this.callback("modify",[this.point.geometry,this.getSketch()]);

My code:
        var map;
        function init(){
            map = new OpenLayers.Map('map', {projection: new 
OpenLayers.Projection("EPSG:900913")});

            var ghyb = new OpenLayers.Layer.Google(
                "Google",
                { type: G_SATELLITE_MAP }
            );

            map.addLayers([ghyb]);

            var madrid = new OpenLayers.LonLat(5, 40).transform(new 
OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
            map.setCenter(madrid, 5);

            var ctrl = new OpenLayers.Control.MyMeas(OpenLayers.Handler.Path);
            map.addControl(ctrl);
            ctrl.activate();
        }

        OpenLayers.Control.MyMeas = 
OpenLayers.Class(OpenLayers.Control.Measure, {
            clicks: 0,

            draw: function() {
                this.handler.callbacks = { point: this.point };
            },

            point: function(pnt, geom) {
                switch (this.clicks) {
                    case 0:
                        this.clicks++;
                        break;
                    case 1:
                        this.deactivate();
                        break;
                }
            }

        });


Thank you for any idea.

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

Reply via email to