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

Function msWCSCommon20_CreateRangeType

mapwcs20.c:1795–1903  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1793/************************************************************************/
1794
1795static void msWCSCommon20_CreateRangeType(layerObj* layer, wcs20coverageMetadataObjPtr cm, char *bands,
1796 xmlNsPtr psGmlNs, xmlNsPtr psGmlcovNs, xmlNsPtr psSweNs, xmlNsPtr psXLinkNs, xmlNodePtr psRoot)
1797{
1798 xmlNodePtr psRangeType, psDataRecord, psField, psQuantity,
1799 psUom, psConstraint, psAllowedValues = NULL, psNilValues = NULL;
1800 char **arr = NULL;
1801 int i, num = 0;
1802
1803 if(NULL != bands)
1804 {
1805 arr = msStringSplit(bands, ',', &num);
1806 }
1807
1808 psRangeType = xmlNewChild( psRoot, psGmlcovNs, BAD_CAST "rangeType", NULL);
1809 psDataRecord = xmlNewChild(psRangeType, psSweNs, BAD_CAST "DataRecord", NULL);
1810
1811 /* iterate over every band */
1812 for(i = 0; i < cm->numbands; ++i)
1813 {
1814 /* only add bands that are in the range subset */
1815 if (NULL != arr && num > 0)
1816 {
1817 int found = MS_FALSE, j, repr;
1818 for(j = 0; j < num; ++j)
1819 {
1820 msStringParseInteger(arr[j], &repr);
1821 if(repr == i + 1)
1822 {
1823 found = MS_TRUE;
1824 break;
1825 }
1826 }
1827 if(found == MS_FALSE)
1828 {
1829 /* ignore this band since it is not in the range subset */
1830 continue;
1831 }
1832 }
1833
1834 /* add field tag */
1835 psField = xmlNewChild(psDataRecord, psSweNs, BAD_CAST "field", NULL);
1836
1837 if(cm->bands[i].name != NULL)
1838 {
1839 xmlNewProp(psField, BAD_CAST "name", BAD_CAST cm->bands[i].name);
1840 }
1841 else
1842 {
1843 xmlNewProp(psField, BAD_CAST "name", BAD_CAST "band");
1844 }
1845 /* add Quantity tag */
1846 psQuantity = xmlNewChild(psField, psSweNs, BAD_CAST "Quantity", NULL);
1847 if(cm->bands[i].definition != NULL)
1848 {
1849 xmlNewProp(psQuantity, BAD_CAST "definition", BAD_CAST cm->bands[i].definition);
1850 }
1851 if(cm->bands[i].description != NULL)
1852 {

Callers 2

msWCSGetCoverage20Function · 0.85

Calls 2

msStringSplitFunction · 0.85
msStringParseIntegerFunction · 0.85

Tested by

no test coverage detected