MCPcopy Index your code
hub / github.com/MapServer/MapServer / treeNodeTrim

Function treeNodeTrim

maptree.c:422–448  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420}
421
422static int treeNodeTrim( treeNodeObj *node )
423{
424 int i;
425
426 /* -------------------------------------------------------------------- */
427 /* Trim subtrees, and free subnodes that come back empty. */
428 /* -------------------------------------------------------------------- */
429 for(i=0; i<node->numsubnodes; i++ ) {
430 if(treeNodeTrim(node->subnode[i])) {
431 destroyTreeNode(node->subnode[i]);
432 node->subnode[i] = node->subnode[node->numsubnodes-1];
433 node->numsubnodes--;
434 i--; /* process the new occupant of this subnode entry */
435 }
436 }
437
438 if( node->numsubnodes == 1 && node->numshapes == 0 ) {
439 node = node->subnode[0];
440 }
441/* if I only have 1 subnode promote that subnode to my positon */
442
443 /* -------------------------------------------------------------------- */
444 /* We should be trimmed if we have no subnodes, and no shapes. */
445 /* -------------------------------------------------------------------- */
446
447 return(node->numsubnodes == 0 && node->numshapes == 0);
448}
449
450void msTreeTrim(treeObj *tree)
451{

Callers 1

msTreeTrimFunction · 0.85

Calls 1

destroyTreeNodeFunction · 0.85

Tested by

no test coverage detected