[mapguide-users] Mouse Cursor Change when over selectable feature?

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Mon Aug 11 15:36:05 EDT 2008


The "tooltips" use a call named "QUERYMAPFEATURES".
Its input includes a geometry object (usually a small polygon around the 
cursor).
When called, the function returns a Xml file describing the features 
that intersects the input geometry object.

Fortunately "QUERYMAPFEATURES" also accepts a parameter called 
"LAYERATTRIBUTEFILTER".
This parameter can take the values:
        AllLayers = 0,
        OnlyVisible = 1
        OnlySelectable = 2
        Default = 3
        OnlyWithToolTips = 4
        VisibleWithToolTips = 5

I belive you are looking for "OnlySelectable" with value 2.
You can query the server for the objects below the cursor, just like the 
tooltip code does.

As for speed, the usual trick is to use a timer, so every time the mouse 
moves, the timer is reset.
When the mouse pauses long enough for the timer to run out, you call the 
server.
To avoid spurious results, where the server is called just as the mouse 
moves,
you can use some sort of counter, to see if the result is from the 
current request.
In my test setups, the callback is completed in less than 100ms.
Paired with the above, it gives the illusion that it happens instantly.

Happy coding :)

Regards, Kenneth Skovhede, GEOGRAF A/S



Jamo181 skrev:
> Gday was wondering if it is possible to make the cursor change when you hover
> over a selectable feature..
>
> So for those features you tick as selectable in Maestro / Autodesk Mapguide
> when you hover over the feature in the viewer the cursor changes but no need
> to refresh the image in the viewer?
>
> Would it be possible to modify the ajaxmappane.templ to add this
> functionality?
>
> I'm unsure how to proceed I played around with the tooltips seeming as it
> grabs information from the elements without updating the view.... perhaps
> this would be a good feature to include?
>
> I'm unsure how to check if element under cursor is selectable without
> selecting it and whether or not this will be possible / fast enough to
> change the mouse cursor as the user moves it around the view ?
>
> Any thoughts?
>
>   


More information about the mapguide-users mailing list