[mapguide-users] Re: Showing running numbers of selected items

Alex Kob a.kobelev at gmail.com
Wed Dec 7 01:50:30 EST 2011


Hello, David.

Here is brief description of my working solution:

1. Create a widget named SelectionLabels for example. It has one meaningful
method: displayLabels which would send ajax request to server-side script to
enable/disable labels.
In method initializeWidget insert following code:

this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_ON,
OpenLayers.Function.bind(this.selectionOn, this)); 
this.getMap().registerForEvent(Fusion.Event.MAP_SELECTION_OFF,
OpenLayers.Function.bind(this.selectionOff, this)); 

It will activate or deactivate labels. Methods selectionOn and selectionOff
are simple:

selectionOn: function() {
    this.displayLabels(true);
},

selectionOff: function() {
    this.displayLabels(false);
},

2. Create a server-side script for widget. It will receive request to
enable/disable labels and process it as follows:
- create a new dynamic feature source for points
- create a new dynamic layer for placing labels. I have create a special
symbol for labels and setup layer template so that symbols is used for point
stylization. Layer must use previously created feature source.
- get selection and add new features (as point geometry) to feature source.
- add layer to map

3. To create labels when selection is set, you have to include div with your
widget to application:
<div id="SelectionLabels"></div>

Done!

I could give a more detailed description of these steps if you need it.


--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Showing-running-numbers-of-selected-items-tp7053885p7069570.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list