Chris,

You are correct. I am using a Handle.Box control and the loX, LoY, HiX, HiY
is available which I then simply use to draw into a temporary vector layer.

This leaves me with a blue box over the area I selected.

So I am already doing as you suggest I believe. My snippet of code is as
follows:

//set up the getfeature info alert on shift mouse box select
control = new OpenLayers.Control();
OpenLayers.Util.extend(control,
        {
                draw: function ()
                {
                        // this Handler.Box will intercept the shift-mousedown 
before
Control.MouseDefault gets to see it
                        this.box = new OpenLayers.Handler.Box( control, {"done":
this.notice},{keyMask: OpenLayers.Handler.MOD_SHIFT});
                        this.box.activate();
                },      notice: function (bounds)
                        {
                                removeCreateVectors()   // this will clear out 
any previous vectors

// use the shift mouse control to drag a box and now get the coords of box
                                ll = map.getLonLatFromPixel(new 
OpenLayers.Pixel(bounds.left,
bounds.bottom));
                                ur = map.getLonLatFromPixel(new 
OpenLayers.Pixel(bounds.right,
bounds.top));
                                centX = (bounds.left + bounds.right)/2
                                centY = (bounds.bottom + bounds.top)/2
                                var loX = ll.lon.toFixed(12);
                                var loY = ll.lat.toFixed(12);
                                var hiX = ur.lon.toFixed(12);
                                var hiY = ur.lat.toFixed(12);
                                BBox = loX+","+loY+"%20"+ hiX+ ","+hiY;   // 
used in GFI request

                                // OK now draw out the drag box as vectors
                                drawSelectBox(loX,loY,hiX,hiY)  // this just 
draws a box
                }
        });
        map.addControl(control);

However, after I have finished doing what I want any vertical pan movement
'floats' the vectors relative to the base map and the selected features.

Cheers,

Brad Spencer


-----Original Message-----
From: Christopher Schmidt [mailto:[EMAIL PROTECTED]
Sent: Thursday, 17 April 2008 2:18 PM
To: bradleyspencer
Cc: openlayers users
Subject: Re: [OpenLayers-Users] Vectors on the move

On Thu, Apr 17, 2008 at 02:10:51PM +1000, bradleyspencer wrote:
> I am creating a selection box with a Shift-Mouse control and using this as
a
> BBox criteria to do a getfeatureInfo request. That works just fine. I also
> draw the box on a vector layer and that is fine as well.
>
> However, when you pan up and down the select box 'floats' relative to the
> base map. Has anyone seen this and if so is there a workaround?
>
> If this is new I will make a little test app.

You're using a Handler.Box, I assume? How are you getting this to stay
on the map? every implementation I know of, it disappears when you let
go.

In general, controls are stationary: if you want something to stick on
the map, you're going to need to draw it in some other way than as a
control, because it needs to be in the viewport div in order to move
with the map. The best way to do this is probably via a temporary vector
layer, since this will correctly handle things like map zooms, drags,
etc.

Regards,
--
Christopher Schmidt
MetaCarta

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

Reply via email to