230 | | getSessionId(): |
231 | | |
232 | | When a Map is defined in the ApplicationDefinition file, it can have a default MapDefinition that is automatically loaded when the application is loaded. But it is not mandatory to specify a default map. When no default map is specified, the Map widget is still initialized. Loading of a MapDefinition is then done in response to a widget (such as the MapMenu widget) or some application-specific code. Regardless of how it happens, when a MapDefinition has been loaded, the Map widget will trigger a MAP_LOADED event. Most widgets are not useful if there is no map loaded, so they use the MAP_LOADED event to determine when they should be enabled. This means that most widgets will appear initially disabled until the map has been loaded. There are some notable exceptions, including the Map Menu widget which is used to provide a drop-down menu of MapDefinitions that the user can pick from. |
| 230 | {{{getSessionId():}}} |
| 231 | This returns the session id that is used with the server side support scripts for this map. |
| 232 | |
| 233 | When a Map is defined in the ApplicationDefinition file, it can have a default !MapDefinition that is automatically loaded when the application is loaded. But it is not mandatory to specify a default map. When no default map is specified, the Map widget is still initialized. Loading of a !MapDefinition is then done in response to a widget (such as the MapMenu widget) or some application-specific code. Regardless of how it happens, when a !MapDefinition has been loaded, the Map widget will trigger a {{{Fusion.Event.MAP_LOADED}}} event. Most widgets are not useful if there is no map loaded, so they use the {{{Fusion.Event.MAP_LOADED}}} event to determine when they should be enabled. This means that most widgets will appear initially disabled until the map has been loaded. There are some notable exceptions, including the Map Menu widget which is used to provide a drop-down menu of !MapDefinitions that the user can pick from. |
236 | | MAP_SESSION_CREATED. The Map widget is responsible for creating and maintaining a session with the server. When the session has been created, this event is triggered. Nothing can happen until this event has been triggered. |
237 | | MAP_LOADING. The Map widget triggers this event when it is starting to load a new Map. This is primarily used by widgets to prepare themselves for the new map by discarding their current state and temporarily disabling themselves. |
238 | | MAP_LOADED. The Map widget triggers this event when a map has been loaded and is ready. |
239 | | MAP_EXTENTS_CHANGED. The Map widget triggers this event for any navigation that changes the current extents. |
240 | | MAP_BUSY_CHANGED. The Map widget maintains a reference count of asynchronous events as they start and finish. An application can use this event to display a processing image so that the user is aware that some asynchronous activitity is happening. |
241 | | MAP_RESIZED. The Map widget triggers this event when the size of the map is changed. |
242 | | MAP_SELECTION_ON. The Map widget triggers this event when a new selection has been created. |
243 | | MAP_SELECTION_OFF. The Map widget triggers this event when the current selection has been cleared. |
244 | | MAP_ACTIVE_LAYER_CHANGED. The Map widget allows for a single layer to be marked as active by the application. This event is triggered when the active layer is changed. |
245 | | MAP_GENERIC_EVENT. Most widgets rely directly on their Map widget for everything. In some cases, though, widgets need to be informed of changes in other widgets. In these cases, the Map widget can act as a broker for events through the MAP_GENERIC_EVENT. Widgets that employ the MAP_GENERIC_EVENT normally do so for a specific internal purpose, and the application should not normally register for this event. |
246 | | |
247 | | Working with Selections |
| 237 | {{{Fusion.Event.MAP_SESSION_CREATED}}}: |
| 238 | The Map widget is responsible for creating and maintaining a session with the server. When the session has been created, this event is triggered. Nothing can happen until this event has been triggered. |
| 239 | {{{Fusion.Event.MAP_LOADING}}}: |
| 240 | The Map widget triggers this event when it is starting to load a new Map. This is primarily used by widgets to prepare themselves for the new map by discarding their current state and temporarily disabling themselves. |
| 241 | {{{Fusion.Event.MAP_LOADED}}}: |
| 242 | The Map widget triggers this event when a map has been loaded and is ready. |
| 243 | {{{Fusion.Event.MAP_EXTENTS_CHANGED}}}: |
| 244 | The Map widget triggers this event for any navigation that changes the current extents. |
| 245 | {{{Fusion.Event.MAP_BUSY_CHANGED}}}: |
| 246 | The Map widget maintains a reference count of asynchronous events as they start and finish. An application can use this event to display a processing image so that the user is aware that some asynchronous activitity is happening. |
| 247 | {{{Fusion.Event.MAP_RESIZED}}}: |
| 248 | The Map widget triggers this event when the size of the map is changed. |
| 249 | {{{Fusion.Event.MAP_SELECTION_ON}}}: |
| 250 | The Map widget triggers this event when a new selection has been created. |
| 251 | {{{Fusion.Event.MAP_SELECTION_OFF}}}: |
| 252 | The Map widget triggers this event when the current selection has been cleared. |
| 253 | {{{Fusion.Event.MAP_ACTIVE_LAYER_CHANGED}}}: |
| 254 | The Map widget allows for a single layer to be marked as active by the application. This event is triggered when the active layer is changed. |
| 255 | {{{Fusion.Event.MAP_GENERIC_EVENT}}}: |
| 256 | Most widgets rely directly on their Map widget for everything. In some cases, though, widgets need to be informed of changes in other widgets. In these cases, the Map widget can act as a broker for events through the MAP_GENERIC_EVENT. Widgets that employ the {{{Fusion.Event.MAP_GENERIC_EVENT}}} normally do so for a specific internal purpose, and the application should not normally register for this event. |
| 257 | |
| 258 | == Working with Selections == |
253 | | MAP_SELECTION_ON. The Map widget triggers this event when a new selection has been created. |
254 | | MAP_SELECTION_OFF. The Map widget triggers this event when the current selection has been cleared. |
255 | | |
256 | | When the application receives a MAP_SELECTION_ON event from the Map widget, it can use the following functions to work with the selection: |
257 | | |
258 | | hasSelection(). This method returns a boolean value which indicates if there is currently a selection or not |
259 | | getSelection(callback). This method retrieves the current selection. Retrieving the selection is potentially an asynchronous operation and so the callee provides a callback function that is called when the selection is ready. The callback function is passed a single argument, a Selection object, described below. |
260 | | clearSelection(). This method is used to clear the current selection. This removes the selection from the map and invalidates the current selection object. |
| 264 | {{{Fusion.Event.MAP_SELECTION_ON}}}: |
| 265 | The Map widget triggers this event when a new selection has been created. |
| 266 | {{Fusion.Event.{MAP_SELECTION_OFF}}}: |
| 267 | The Map widget triggers this event when the current selection has been cleared. |
| 268 | |
| 269 | When the application receives a {{{Fusion.Event.MAP_SELECTION_ON}}} event from the Map widget, it can use the following functions to work with the selection: |
| 270 | |
| 271 | {{{hasSelection()}}}: |
| 272 | This method returns a boolean value which indicates if there is currently a selection or not |
| 273 | {{{getSelection(callback)}}}: |
| 274 | This method retrieves the current selection. Retrieving the selection is potentially an asynchronous operation and so the callee provides a callback function that is called when the selection is ready. The callback function is passed a single argument, a Selection object, described below. |
| 275 | {{{clearSelection()}}}: |
| 276 | This method is used to clear the current selection. This removes the selection from the map and invalidates the current selection object. |
291 | | getNumLayers() returns the number of layers that have features selected |
292 | | getNumElements() returns the total number of features that are selected |
293 | | getLowerLeftCoord() returns the lower, left coordinate of the bounding box of all selected features |
294 | | getUpperRightCoord() returns the upper, right coordinate of the bounding box of all selected features |
295 | | getLayerByName(name) gets the layer selection object for a layer from the name of the layer. This returns null if there is no layer with the requested name in the selection results |
296 | | getLayer(index) gets the layer selection object for the requested layer where index is between 0 and one less that the value returned by getNumLayers(). |
| 309 | {{{getNumLayers()}}}: |
| 310 | returns the number of layers that have features selected |
| 311 | {{{getNumElements()}}}: |
| 312 | returns the total number of features that are selected |
| 313 | {{{getLowerLeftCoord()}}}: |
| 314 | returns the lower, left coordinate of the bounding box of all selected features |
| 315 | {{{getUpperRightCoord()}}}: |
| 316 | returns the upper, right coordinate of the bounding box of all selected features |
| 317 | {{{getLayerByName(name)}}}: |
| 318 | gets the layer selection object for a layer from the name of the layer. This returns null if there is no layer with the requested name in the selection results |
| 319 | {{{getLayer(index)}}}: |
| 320 | gets the layer selection object for the requested layer where index is between 0 and one less that the value returned by {{{getNumLayers()}}}. |
300 | | getName() returns the name of the layer that the selected features are in |
301 | | getNumElements() returns the number of features selected in this layer |
302 | | getNumProperties() returns the number of data properties, or attributes, of the features in this layer |
303 | | getPropertyNames() returns an array of the names of each of the properties |
304 | | getPropertyTypes() returns an array of the types of the properties |
305 | | getElementValue(elementIndex, propertyIndex) returns the actual value of a given property for a given element |
306 | | |
307 | | |
| 324 | {{{getName()}}}: |
| 325 | returns the name of the layer that the selected features are in |
| 326 | {{{getNumElements()}}}: |
| 327 | returns the number of features selected in this layer |
| 328 | {{{getNumProperties()}}}: |
| 329 | returns the number of data properties, or attributes, of the features in this layer |
| 330 | {{{getPropertyNames()}}}: |
| 331 | returns an array of the names of each of the properties |
| 332 | {{{getPropertyTypes()}}}: |
| 333 | returns an array of the types of the properties |
| 334 | {{{getElementValue(elementIndex, propertyIndex)}}}: |
| 335 | returns the actual value of a given property for a given element |
| 336 | |