Autodesk 15606-011408-9300 Developer Guide - Page 63
Handling Busy State and Map Refresh, assign it to a variable called
UPC - 606121429548
View all Autodesk 15606-011408-9300 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 63 highlights
The showFeatureCount function starts by checking the status of the global variable, legendSet. If legendSet is set to True, showFeatureCount terminates: if (legendSet) return; This keeps showFeatureCount from printing multiple messages to the legend if the user clicks the button more than once. Next, showFeatureCount creates an instance of the map and checks to see if the map is in a busy state (see "Handling Busy State and Map Refresh" on page 43 for more information about the busy state): var map = getMap(); if (map.isBusy() == false) If the map is not busy, the function continues. First, it uses the getMapLayersEx method to obtain a layer collection and assign it to a variable called layers. Then it uses the size method to get the number of layers and assign that number to the cnt variable: var layers = map.getMapLayersEx(); var cnt = layers.size(); Then it creates a loop that counts the features in each layer and uses the getLegendLabel and setLegendLabel methods, as shown in the illustrations following the example, to report the map feature counts in the map legend: var i; var msg; for (i = 0; i