Gets statistics about a topology.
struct resbuf
*map_topostat(
ade_id tpm_id);
Returns a resbuf list containing the statistics for the specified topology, or NULL if an error occurs.
tpm_id | The ID of the topology for which to get statistics. The topology must be open for read. |
You must release the resbuf.
The following tables show statistic names, the data type and the topology types they apply to:
node_count | RTSHORT |
link_count | RTSHORT |
polygon_count | RTSHORT |
min_x | RTREAL |
min_y | RTREAL |
max_x | RTREAL |
max_y | RTREAL |
Note This function is not designed to count polygons in a partial topology. If the topology in question is partial, the polygon_count statistic may be overstated. This is because map_topostat counts not only the polygons in the partial topology, but also any polygons that share common edges with them in the complete topology, even if the adjacent polygons are not actually present in the current drawing.
length_total | RTREAL |
length_average | RTREAL |
length_min | RTREAL |
length_max | RTREAL |
length_variance | RTREAL |
length_deviation | RTREAL |
area_total | RTREAL |
area_average | RTREAL |
area_min | RTREAL |
area_max | RTREAL |
area_variance | RTREAL |
area_deviation | RTREAL |
perimeter_total | RTREAL |
perimeter_average | RTREAL |
perimeter_min | RTREAL |
perimeter_max | RTREAL |
perimeter_variance | RTREAL |
perimeter_deviation | RTREAL |
The following sample loads and then opens a network topology for read using tpm_acload() and tpm_acopen() respectively. A resbuf is populated with that topologies information, then is displayed. The resbuf is released as required.
char* pszTopoName = "NetTopo"; int topoWriteAccess = 0; int returnCode = tpm_acload(pszTopoName, 0); ade_id topoId = tpm_acopen(pszTopoName, topoWriteAccess); struct resbuf* pTopoStatsRb = map_topoStat(topoId); if (NULL != pTopoStatsRb){ struct resbuf* rb = pTopoStatsRb; while(NULL != rb) { if (rb->restype == RTSTR) { acutPrintf( "\nThe \"%s\" property contained the value:" , rb->resval.rstring); if (NULL != (rb = rb->rbnext)){ if (rb->restype == RTDOTE) { rb = rb->rbnext; switch(rb->restype) { case RTSTR: acutPrintf( " \"%s\" RTSTR" , rb->resval.rstring); break; case RTREAL: acutPrintf( " %.2lf RTREAL" , rb->resval.rreal); break; case RTSHORT: acutPrintf( " %d RTSHORT" , rb->resval.rint); break; case RTLONG: acutPrintf( " %d RTLONG" , rb->resval.rlong); break; default: break; } } } } rb = rb->rbnext; } } else { acutPrintf( "\nNo topologies are accessable in this project."); } acutRelRb(pTopoStatsRb); tpm_acclose(topoId); tpm_acunload(pszTopoName);