/ GetMapserverExpression */ / Return a mapserver expression base on the Filer encoding nodes. */ /
| 1920 | /* Return a mapserver expression base on the Filer encoding nodes. */ |
| 1921 | /************************************************************************/ |
| 1922 | char *FLTGetMapserverExpression(FilterEncodingNode *psFilterNode, layerObj *lp) |
| 1923 | { |
| 1924 | char *pszExpression = NULL; |
| 1925 | const char *pszAttribute = NULL; |
| 1926 | char szTmp[256]; |
| 1927 | char **tokens = NULL; |
| 1928 | int nTokens = 0, i=0,bString=0; |
| 1929 | char *pszTmp; |
| 1930 | |
| 1931 | if (!psFilterNode) |
| 1932 | return NULL; |
| 1933 | |
| 1934 | if (psFilterNode->eType == FILTER_NODE_TYPE_COMPARISON) |
| 1935 | { |
| 1936 | if ( psFilterNode->psLeftNode && psFilterNode->psRightNode) |
| 1937 | { |
| 1938 | if (FLTIsBinaryComparisonFilterType(psFilterNode->pszValue)) |
| 1939 | { |
| 1940 | pszExpression = FLTGetBinaryComparisonExpresssion(psFilterNode, lp); |
| 1941 | } |
| 1942 | else if (strcasecmp(psFilterNode->pszValue, |
| 1943 | "PropertyIsBetween") == 0) |
| 1944 | { |
| 1945 | pszExpression = FLTGetIsBetweenComparisonExpresssion(psFilterNode, lp); |
| 1946 | } |
| 1947 | else if (strcasecmp(psFilterNode->pszValue, |
| 1948 | "PropertyIsLike") == 0) |
| 1949 | { |
| 1950 | pszExpression = FLTGetIsLikeComparisonExpression(psFilterNode); |
| 1951 | } |
| 1952 | } |
| 1953 | } |
| 1954 | else if (psFilterNode->eType == FILTER_NODE_TYPE_LOGICAL) |
| 1955 | { |
| 1956 | if (strcasecmp(psFilterNode->pszValue, "AND") == 0 || |
| 1957 | strcasecmp(psFilterNode->pszValue, "OR") == 0) |
| 1958 | { |
| 1959 | pszExpression = FLTGetLogicalComparisonExpresssion(psFilterNode, lp); |
| 1960 | } |
| 1961 | else if (strcasecmp(psFilterNode->pszValue, "NOT") == 0) |
| 1962 | { |
| 1963 | pszExpression = FLTGetLogicalComparisonExpresssion(psFilterNode, lp); |
| 1964 | } |
| 1965 | } |
| 1966 | else if (psFilterNode->eType == FILTER_NODE_TYPE_SPATIAL) |
| 1967 | { |
| 1968 | /* TODO */ |
| 1969 | } |
| 1970 | else if (psFilterNode->eType == FILTER_NODE_TYPE_FEATUREID) |
| 1971 | { |
| 1972 | #if defined(USE_WMS_SVR) || defined (USE_WFS_SVR) || defined (USE_WCS_SVR) || defined(USE_SOS_SVR) |
| 1973 | if (psFilterNode->pszValue) |
| 1974 | { |
| 1975 | pszAttribute = msOWSLookupMetadata(&(lp->metadata), "OFG", "featureid"); |
| 1976 | if (pszAttribute) |
| 1977 | { |
| 1978 | tokens = msStringSplit(psFilterNode->pszValue,',', &nTokens); |
| 1979 | if (tokens && nTokens > 0) |
nothing calls this directly
no test coverage detected