Autodesk 15606-011408-9300 Developer Guide - Page 62
Counting Map Features
UPC - 606121429548
View all Autodesk 15606-011408-9300 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 62 highlights
Before calling zoomSelected() After calling zoomSelected() Counting Map Features The showFeatureCount function counts the features on each map layer and adds that count to the legend: var legendSet; // Global variable, declared outside of function function showFeatureCount() { if (legendSet) return; var map = getMap(); if (map.isBusy() == false) // can also be written as 'if (!map.isBusy())' { var layers = map.getMapLayersEx(); var cnt = layers.size(); var i; var msg; for (i = 0; i
62
|
Chapter 4
Working with Map Layers, Map Features, and Printing
Before calling zoomSelected()
After calling zoomSelected()
Counting Map Features
The
showFeatureCount
function counts the features on each map layer and
adds that count to the legend:
var legendSet;
// Global variable, declared outside of function
function showFeatureCount()
{
if (legendSet)
return;
var map = getMap();
if (map.isBusy() == false)
// can also be written as 'if (!map.isBusy())'
{
var layers = map.getMapLayersEx();
var cnt = layers.size();
var i;
var msg;
for (i = 0; i<cnt; i++)
{
var layer = layers.item(i);
var objectCount = layer.getMapObjectsEx().size();
var label = layer.getLegendLabel();
label = label + " " + objectCount + " features";
layer.setLegendLabel(label);
}
}
legendSet = true;
}