* msWMSPrintNestedGroups() * * * * purpose: Writes the layers to the capabilities that have the * * "WMS_LAYER_GROUP" metadata set. * *
| 1947 | * -numNestedGroups: This array holds the number of nested groups for each layer * |
| 1948 | ***********************************************************************************/ |
| 1949 | void msWMSPrintNestedGroups(mapObj* map, int nVersion, char* pabLayerProcessed, |
| 1950 | int index, int level, char*** nestedGroups, int* numNestedGroups, const char *script_url_encoded) |
| 1951 | { |
| 1952 | int j; |
| 1953 | |
| 1954 | if (numNestedGroups[index] <= level) /* no more subgroups */ |
| 1955 | { |
| 1956 | /* we are at the deepest level of the group branchings, so add layer now. */ |
| 1957 | msDumpLayer(map, GET_LAYER(map, index), nVersion, script_url_encoded, ""); |
| 1958 | pabLayerProcessed[index] = 1; /* done */ |
| 1959 | } |
| 1960 | else /* not yet there, we have to deal with this group and possible subgroups and layers. */ |
| 1961 | { |
| 1962 | /* Beginning of a new group... enclose the group in a layer block */ |
| 1963 | msIO_printf(" <Layer>\n"); |
| 1964 | msIO_printf(" <Title>%s</Title>\n", nestedGroups[index][level]); |
| 1965 | |
| 1966 | /* Look for one group deeper in the current layer */ |
| 1967 | if (!pabLayerProcessed[index]) |
| 1968 | { |
| 1969 | msWMSPrintNestedGroups(map, nVersion, pabLayerProcessed, |
| 1970 | index, level + 1, nestedGroups, |
| 1971 | numNestedGroups, script_url_encoded); |
| 1972 | } |
| 1973 | |
| 1974 | /* look for subgroups in other layers. */ |
| 1975 | for (j = index + 1; j < map->numlayers; j++) |
| 1976 | { |
| 1977 | if (msWMSIsSubGroup(nestedGroups[index], level, nestedGroups[j], numNestedGroups[j])) |
| 1978 | { |
| 1979 | if (!pabLayerProcessed[j]) |
| 1980 | { |
| 1981 | msWMSPrintNestedGroups(map, nVersion, pabLayerProcessed, |
| 1982 | j, level + 1, nestedGroups, |
| 1983 | numNestedGroups, script_url_encoded); |
| 1984 | } |
| 1985 | } |
| 1986 | else |
| 1987 | { |
| 1988 | /* TODO: if we would sort all layers on "WMS_LAYER_GROUP" beforehand */ |
| 1989 | /* we could break out of this loop at this point, which would increase */ |
| 1990 | /* performance. */ |
| 1991 | } |
| 1992 | } |
| 1993 | /* Close group layer block */ |
| 1994 | msIO_printf(" </Layer>\n"); |
| 1995 | } |
| 1996 | |
| 1997 | } /* msWMSPrintNestedGroups */ |
| 1998 | |
| 1999 | /* |
| 2000 | ** msWMSGetCapabilities() |
no test coverage detected