[mapserver-commits] r10348 - sandbox/sdlime/common-expressions/mapserver

svn at osgeo.org svn at osgeo.org
Tue Jul 13 20:14:33 EDT 2010


Author: sdlime
Date: 2010-07-14 00:14:33 +0000 (Wed, 14 Jul 2010)
New Revision: 10348

Modified:
   sandbox/sdlime/common-expressions/mapserver/mapparser.c
   sandbox/sdlime/common-expressions/mapserver/mapparser.y
Log:
Added dwithin and beyond operators.

Modified: sandbox/sdlime/common-expressions/mapserver/mapparser.c
===================================================================
--- sandbox/sdlime/common-expressions/mapserver/mapparser.c	2010-07-13 23:44:36 UTC (rev 10347)
+++ sandbox/sdlime/common-expressions/mapserver/mapparser.c	2010-07-14 00:14:33 UTC (rev 10348)
@@ -286,16 +286,16 @@
 /* YYFINAL -- State number of the termination state. */
 #define YYFINAL  29
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   298
+#define YYLAST   282
 
 /* YYNTOKENS -- Number of terminals. */
 #define YYNTOKENS  43
 /* YYNNTS -- Number of nonterminals. */
 #define YYNNTS  8
 /* YYNRULES -- Number of rules. */
-#define YYNRULES  67
+#define YYNRULES  69
 /* YYNRULES -- Number of states. */
-#define YYNSTATES  139
+#define YYNSTATES  143
 
 /* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
 #define YYUNDEFTOK  2
@@ -348,8 +348,8 @@
       64,    68,    72,    76,    80,    84,    88,    92,    96,   100,
      104,   108,   112,   116,   120,   124,   128,   132,   136,   140,
      144,   148,   152,   156,   160,   164,   168,   172,   176,   180,
-     182,   186,   190,   194,   198,   202,   206,   209,   213,   218,
-     223,   225,   229,   234,   236,   240,   244,   246
+     184,   188,   190,   194,   198,   202,   206,   210,   214,   217,
+     221,   226,   231,   233,   237,   242,   244,   248,   252,   254
 };
 
 /* YYRHS -- A `-1'-separated list of the rules' RHS. */
@@ -373,13 +373,14 @@
       48,    -1,    48,    30,    48,    -1,    48,    29,    48,    -1,
       48,    28,    48,    -1,    48,    27,    48,    -1,    48,    26,
       48,    -1,    48,    25,    48,    -1,    48,    24,    48,    -1,
-       3,    -1,    41,    47,    42,    -1,    47,    34,    47,    -1,
-      47,    35,    47,    -1,    47,    36,    47,    -1,    47,    38,
-      47,    -1,    47,    37,    47,    -1,    35,    47,    -1,    47,
-      40,    47,    -1,    31,    41,    49,    42,    -1,    32,    41,
-      48,    42,    -1,     7,    -1,    41,    48,    42,    -1,    33,
-      41,    49,    42,    -1,     4,    -1,    41,    49,    42,    -1,
-      49,    34,    49,    -1,     6,    -1,    41,    50,    42,    -1
+      48,    22,    48,    -1,    48,    23,    48,    -1,     3,    -1,
+      41,    47,    42,    -1,    47,    34,    47,    -1,    47,    35,
+      47,    -1,    47,    36,    47,    -1,    47,    38,    47,    -1,
+      47,    37,    47,    -1,    35,    47,    -1,    47,    40,    47,
+      -1,    31,    41,    49,    42,    -1,    32,    41,    48,    42,
+      -1,     7,    -1,    41,    48,    42,    -1,    33,    41,    49,
+      42,    -1,     4,    -1,    41,    49,    42,    -1,    49,    34,
+      49,    -1,     6,    -1,    41,    50,    42,    -1
 };
 
 /* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
@@ -389,9 +390,9 @@
      116,   124,   133,   141,   150,   151,   152,   165,   171,   177,
      183,   189,   195,   201,   202,   210,   218,   227,   235,   243,
      251,   257,   263,   269,   275,   281,   287,   308,   329,   335,
-     343,   350,   361,   372,   383,   394,   405,   416,   427,   440,
-     441,   442,   443,   444,   445,   446,   453,   454,   455,   456,
-     466,   467,   468,   480,   481,   482,   485,   486
+     343,   350,   361,   372,   383,   394,   405,   416,   427,   438,
+     448,   460,   461,   462,   463,   464,   465,   466,   473,   474,
+     475,   476,   486,   487,   488,   500,   501,   502,   505,   506
 };
 #endif
 
@@ -430,9 +431,9 @@
       46,    46,    46,    46,    46,    46,    46,    46,    46,    46,
       46,    46,    46,    46,    46,    46,    46,    46,    46,    46,
       46,    46,    46,    46,    46,    46,    46,    46,    46,    46,
-      46,    46,    46,    46,    46,    46,    46,    46,    46,    47,
-      47,    47,    47,    47,    47,    47,    47,    47,    47,    47,
-      48,    48,    48,    49,    49,    49,    50,    50
+      46,    46,    46,    46,    46,    46,    46,    46,    46,    46,
+      46,    47,    47,    47,    47,    47,    47,    47,    47,    47,
+      47,    47,    48,    48,    48,    49,    49,    49,    50,    50
 };
 
 /* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
@@ -442,9 +443,9 @@
        3,     3,     3,     3,     2,     2,     3,     3,     3,     3,
        3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
        3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
-       3,     3,     3,     3,     3,     3,     3,     3,     3,     1,
-       3,     3,     3,     3,     3,     3,     2,     3,     4,     4,
-       1,     3,     4,     1,     3,     3,     1,     3
+       3,     3,     3,     3,     3,     3,     3,     3,     3,     3,
+       3,     1,     3,     3,     3,     3,     3,     3,     2,     3,
+       4,     4,     1,     3,     4,     1,     3,     3,     1,     3
 };
 
 /* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
@@ -452,26 +453,27 @@
    means the default is an error.  */
 static const unsigned char yydefact[] =
 {
-       2,    49,    63,    66,    60,     0,     0,     0,     0,     0,
+       2,    51,    65,    68,    62,     0,     0,     0,     0,     0,
        0,     0,     3,     4,     0,     0,     0,    14,    15,     0,
-       0,     0,     0,    56,     0,     0,     0,     0,     0,     1,
+       0,     0,     0,    58,     0,     0,     0,     0,     0,     1,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,    23,
-      50,    61,    64,    67,     6,     8,     7,     9,    10,    12,
-      11,    13,    38,    37,    21,    22,    19,    20,    18,    17,
-      51,    52,    53,    55,    54,    57,    41,    48,    47,    46,
-      45,    44,    43,    42,    39,    36,    28,    29,    26,    27,
-      25,    24,     5,    16,    65,     0,    40,    34,    35,    32,
-      33,    31,    30,     0,    58,     0,    59,    62,     0
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+       0,    23,    52,    63,    66,    69,     6,     8,     7,     9,
+      10,    12,    11,    13,    38,    37,    21,    22,    19,    20,
+      18,    17,    53,    54,    55,    57,    56,    59,    41,    49,
+      50,    48,    47,    46,    45,    44,    43,    42,    39,    36,
+      28,    29,    26,    27,    25,    24,     5,    16,    67,     0,
+      40,    34,    35,    32,    33,    31,    30,     0,    60,     0,
+      61,    64,     0
 };
 
 /* YYDEFGOTO[NTERM-NUM]. */
 static const yysigned_char yydefgoto[] =
 {
-      -1,    11,   123,    12,    13,    14,    15,    16
+      -1,    11,   127,    12,    13,    14,    15,    16
 };
 
 /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
@@ -479,26 +481,27 @@
 #define YYPACT_NINF -39
 static const short int yypact[] =
 {
-     131,   -39,   -39,   -39,   -39,   131,   -38,   -31,   -23,    47,
-     131,    24,    -2,   172,    73,   251,   271,   -39,   219,     8,
-      -3,     8,    47,   -15,     6,   139,   221,   210,    94,   -39,
-     131,   131,   131,   131,    47,     8,    47,    47,    47,    47,
-      47,    47,    47,    47,    47,    47,    47,    47,    -3,    -3,
-      -3,    -3,    -3,    -3,    -3,    -3,     8,     8,     8,     8,
-       8,     8,     8,     8,    18,     8,    -4,    -4,    -4,    -4,
-      -4,    -4,    -4,     8,   -29,    -3,   -14,   -28,   239,   -39,
-     -39,   -39,   -39,   -39,    23,   182,   -39,   219,    23,   182,
-     -39,   219,   258,    -5,   258,   258,   258,   258,   258,   258,
-     -17,   -17,   -15,   -15,   -15,   -15,   -39,   -39,   -39,   -39,
-     -39,   -39,   -39,   -39,    -5,    -5,    -5,    -5,    -5,    -5,
-      -5,    -5,   -39,   -39,   -39,    -4,   -39,   -39,   -39,   -39,
-     -39,   -39,   -39,   -27,   -39,    -7,   -39,   -39,    -6
+     105,   -39,   -39,   -39,   -39,   105,   -38,   -36,   -25,    83,
+     105,    19,    17,   148,   250,   248,   206,   -39,   216,     9,
+      -3,     9,    83,   -18,    10,   115,   218,   186,   195,   -39,
+     105,   105,   105,   105,    83,     9,    83,    83,    83,    83,
+      83,    83,    83,    83,    83,    83,    83,    83,    -3,    -3,
+      -3,    -3,    -3,    -3,    -3,    -3,    -3,    -3,     9,     9,
+       9,     9,     9,     9,     9,     9,    23,     9,    -4,    -4,
+      -4,    -4,    -4,    -4,    -4,     9,   -19,    -3,    -6,   -17,
+     -28,   -39,   -39,   -39,   -39,   -39,    21,   158,   -39,   216,
+      21,   158,   -39,   216,   107,    32,   107,   107,   107,   107,
+     107,   107,    47,    47,   -18,   -18,   -18,   -18,   -39,   -39,
+     -39,   -39,   -39,   -39,   -39,   -39,   -39,   -39,    32,    32,
+      32,    32,    32,    32,    32,    32,   -39,   -39,   -39,    -4,
+     -39,   -39,   -39,   -39,   -39,   -39,   -39,   -16,   -39,    11,
+     -39,   -39,    25
 };
 
 /* YYPGOTO[NTERM-NUM].  */
 static const yysigned_char yypgoto[] =
 {
-     -39,   -39,   -39,    22,    86,    -9,    12,   -10
+     -39,   -39,   -39,    24,    60,    -9,    14,   -10
 };
 
 /* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
@@ -508,70 +511,68 @@
 #define YYTABLE_NINF -1
 static const unsigned char yytable[] =
 {
-      28,    26,     3,    19,     4,    65,    65,    65,    30,    31,
-      20,    76,     2,   134,   137,    82,    30,    31,    21,    44,
-      45,    46,    27,    47,    29,    47,   122,    17,   136,    65,
-       8,    74,    24,    77,    31,    81,    83,   125,    75,   106,
-     107,   108,   109,   110,   111,   112,   113,    93,    79,    73,
-       1,     0,    84,    86,    88,    90,   126,   127,   128,   129,
-     130,   131,   132,     0,     0,     0,   135,     0,   114,   115,
-     116,   117,   118,   119,   120,   121,     0,   124,     6,     7,
-       0,     0,     9,     0,     0,   133,     0,     0,    22,     0,
-       0,    18,     0,    48,     0,    23,    25,    49,    50,    51,
-      52,    53,    54,    55,     0,     0,     0,    66,    78,    67,
-      68,    69,    70,    71,    72,   138,    85,    87,    89,    91,
-      92,     0,    94,    95,    96,    97,    98,    99,   100,   101,
-     102,   103,   104,   105,     1,     2,    83,     3,     4,     0,
-       0,     0,     0,     5,     0,     0,     0,     0,     0,    32,
-      33,     0,    34,    35,    36,    37,    38,    39,    40,    41,
-       0,     0,     6,     7,     8,     0,     9,     0,     0,     0,
-       0,     0,    10,    42,    43,    44,    45,    46,     0,    47,
-       0,    80,    32,    33,     0,    34,    35,    36,    37,    38,
-      39,    40,    41,    33,     0,    34,    35,    36,    37,    38,
-      39,    40,    41,     0,     0,     0,    42,    43,    44,    45,
-      46,     0,    47,     0,     0,     0,    42,    43,    44,    45,
-      46,     0,    47,    56,    57,    58,    59,    60,    61,    62,
-      63,    64,    34,    35,    36,    37,    38,    39,    40,    41,
-       0,    48,     0,     0,    65,    49,    50,    51,    52,    53,
-      54,    55,    82,    42,    43,    44,    45,    46,     0,    47,
-       0,     0,     0,    81,    56,    57,    58,    59,    60,    61,
-      62,    63,    64,    42,    43,    44,    45,    46,     0,    47,
-       0,    80,     0,     0,    66,    65,    67,    68,    69,    70,
-      71,    72,    42,    43,    44,    45,    46,     0,    47
+      28,    26,     3,    19,     4,    20,    42,    43,    44,    45,
+      46,    78,    47,     2,    82,    67,    21,    67,    67,    29,
+      30,    31,    47,   138,    27,   141,    84,    30,    31,    17,
+       8,   126,    31,    76,    24,    79,   140,   129,    77,   108,
+     109,   110,   111,   112,   113,   114,   115,   116,   117,    95,
+      75,     0,    81,    83,    86,    88,    90,    92,   130,   131,
+     132,   133,   134,   135,   136,    18,    67,    85,   139,    23,
+      25,     0,   118,   119,   120,   121,   122,   123,   124,   125,
+       0,   128,    80,    44,    45,    46,     1,    47,     0,   137,
+      87,    89,    91,    93,    94,     0,    96,    97,    98,    99,
+     100,   101,   102,   103,   104,   105,   106,   107,     1,     2,
+       0,     3,     4,     0,     6,     7,     0,     5,     9,   142,
+       0,     0,     0,     0,    22,    32,    33,     0,    34,    35,
+      36,    37,    38,    39,    40,    41,     6,     7,     8,     0,
+       9,    42,    43,    44,    45,    46,    10,    47,     0,    42,
+      43,    44,    45,    46,     0,    47,     0,    82,    32,    33,
+       0,    34,    35,    36,    37,    38,    39,    40,    41,    33,
+       0,    34,    35,    36,    37,    38,    39,    40,    41,     0,
+       0,     0,    42,    43,    44,    45,    46,     0,    47,     0,
+       0,     0,    42,    43,    44,    45,    46,     0,    47,    58,
+      59,    60,    61,    62,    63,    64,    65,    66,    68,     0,
+      69,    70,    71,    72,    73,    74,     0,     0,     0,    68,
+      67,    69,    70,    71,    72,    73,    74,     0,    84,    34,
+      35,    36,    37,    38,    39,    40,    41,    85,    48,     0,
+      49,    50,    51,    52,    53,    54,    55,    56,    57,     0,
+      42,    43,    44,    45,    46,     0,    47,     0,     0,     0,
+      83,    58,    59,    60,    61,    62,    63,    64,    65,    66,
+      48,     0,    49,    50,    51,    52,    53,    54,    55,    56,
+      57,     0,    67
 };
 
-static const yysigned_char yycheck[] =
+static const short int yycheck[] =
 {
-      10,    10,     6,    41,     7,    34,    34,    34,    10,    11,
-      41,    20,     4,    42,    42,    42,    10,    11,    41,    36,
-      37,    38,    10,    40,     0,    40,     8,     5,    42,    34,
-      33,    19,    10,    21,    11,    42,    42,    41,    41,    48,
-      49,    50,    51,    52,    53,    54,    55,    35,    42,    41,
-       3,    -1,    30,    31,    32,    33,    66,    67,    68,    69,
-      70,    71,    72,    -1,    -1,    -1,    75,    -1,    56,    57,
-      58,    59,    60,    61,    62,    63,    -1,    65,    31,    32,
-      -1,    -1,    35,    -1,    -1,    73,    -1,    -1,    41,    -1,
-      -1,     5,    -1,    20,    -1,     9,    10,    24,    25,    26,
-      27,    28,    29,    30,    -1,    -1,    -1,    13,    22,    15,
-      16,    17,    18,    19,    20,   125,    30,    31,    32,    33,
-      34,    -1,    36,    37,    38,    39,    40,    41,    42,    43,
-      44,    45,    46,    47,     3,     4,    42,     6,     7,    -1,
-      -1,    -1,    -1,    12,    -1,    -1,    -1,    -1,    -1,    10,
-      11,    -1,    13,    14,    15,    16,    17,    18,    19,    20,
-      -1,    -1,    31,    32,    33,    -1,    35,    -1,    -1,    -1,
-      -1,    -1,    41,    34,    35,    36,    37,    38,    -1,    40,
-      -1,    42,    10,    11,    -1,    13,    14,    15,    16,    17,
-      18,    19,    20,    11,    -1,    13,    14,    15,    16,    17,
-      18,    19,    20,    -1,    -1,    -1,    34,    35,    36,    37,
-      38,    -1,    40,    -1,    -1,    -1,    34,    35,    36,    37,
-      38,    -1,    40,    13,    14,    15,    16,    17,    18,    19,
-      20,    21,    13,    14,    15,    16,    17,    18,    19,    20,
-      -1,    20,    -1,    -1,    34,    24,    25,    26,    27,    28,
-      29,    30,    42,    34,    35,    36,    37,    38,    -1,    40,
-      -1,    -1,    -1,    42,    13,    14,    15,    16,    17,    18,
-      19,    20,    21,    34,    35,    36,    37,    38,    -1,    40,
-      -1,    42,    -1,    -1,    13,    34,    15,    16,    17,    18,
-      19,    20,    34,    35,    36,    37,    38,    -1,    40
+      10,    10,     6,    41,     7,    41,    34,    35,    36,    37,
+      38,    20,    40,     4,    42,    34,    41,    34,    34,     0,
+      10,    11,    40,    42,    10,    42,    42,    10,    11,     5,
+      33,     8,    11,    19,    10,    21,    42,    41,    41,    48,
+      49,    50,    51,    52,    53,    54,    55,    56,    57,    35,
+      41,    -1,    42,    42,    30,    31,    32,    33,    68,    69,
+      70,    71,    72,    73,    74,     5,    34,    42,    77,     9,
+      10,    -1,    58,    59,    60,    61,    62,    63,    64,    65,
+      -1,    67,    22,    36,    37,    38,     3,    40,    -1,    75,
+      30,    31,    32,    33,    34,    -1,    36,    37,    38,    39,
+      40,    41,    42,    43,    44,    45,    46,    47,     3,     4,
+      -1,     6,     7,    -1,    31,    32,    -1,    12,    35,   129,
+      -1,    -1,    -1,    -1,    41,    10,    11,    -1,    13,    14,
+      15,    16,    17,    18,    19,    20,    31,    32,    33,    -1,
+      35,    34,    35,    36,    37,    38,    41,    40,    -1,    34,
+      35,    36,    37,    38,    -1,    40,    -1,    42,    10,    11,
+      -1,    13,    14,    15,    16,    17,    18,    19,    20,    11,
+      -1,    13,    14,    15,    16,    17,    18,    19,    20,    -1,
+      -1,    -1,    34,    35,    36,    37,    38,    -1,    40,    -1,
+      -1,    -1,    34,    35,    36,    37,    38,    -1,    40,    13,
+      14,    15,    16,    17,    18,    19,    20,    21,    13,    -1,
+      15,    16,    17,    18,    19,    20,    -1,    -1,    -1,    13,
+      34,    15,    16,    17,    18,    19,    20,    -1,    42,    13,
+      14,    15,    16,    17,    18,    19,    20,    42,    20,    -1,
+      22,    23,    24,    25,    26,    27,    28,    29,    30,    -1,
+      34,    35,    36,    37,    38,    -1,    40,    -1,    -1,    -1,
+      42,    13,    14,    15,    16,    17,    18,    19,    20,    21,
+      20,    -1,    22,    23,    24,    25,    26,    27,    28,    29,
+      30,    -1,    34
 };
 
 /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
@@ -582,16 +583,17 @@
       41,    44,    46,    47,    48,    49,    50,    46,    47,    41,
       41,    41,    41,    47,    46,    47,    48,    49,    50,     0,
       10,    11,    10,    11,    13,    14,    15,    16,    17,    18,
-      19,    20,    34,    35,    36,    37,    38,    40,    20,    24,
-      25,    26,    27,    28,    29,    30,    13,    14,    15,    16,
-      17,    18,    19,    20,    21,    34,    13,    15,    16,    17,
-      18,    19,    20,    41,    49,    41,    48,    49,    47,    42,
-      42,    42,    42,    42,    46,    47,    46,    47,    46,    47,
-      46,    47,    47,    49,    47,    47,    47,    47,    47,    47,
-      47,    47,    47,    47,    47,    47,    48,    48,    48,    48,
-      48,    48,    48,    48,    49,    49,    49,    49,    49,    49,
-      49,    49,     8,    45,    49,    41,    50,    50,    50,    50,
-      50,    50,    50,    49,    42,    48,    42,    42,    50
+      19,    20,    34,    35,    36,    37,    38,    40,    20,    22,
+      23,    24,    25,    26,    27,    28,    29,    30,    13,    14,
+      15,    16,    17,    18,    19,    20,    21,    34,    13,    15,
+      16,    17,    18,    19,    20,    41,    49,    41,    48,    49,
+      47,    42,    42,    42,    42,    42,    46,    47,    46,    47,
+      46,    47,    46,    47,    47,    49,    47,    47,    47,    47,
+      47,    47,    47,    47,    47,    47,    47,    47,    48,    48,
+      48,    48,    48,    48,    48,    48,    48,    48,    49,    49,
+      49,    49,    49,    49,    49,    49,     8,    45,    49,    41,
+      50,    50,    50,    50,    50,    50,    50,    49,    42,    48,
+      42,    42,    50
 };
 
 #if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
@@ -1762,44 +1764,72 @@
 #line 427 "mapparser.y"
     {
       int rval;
-      rval = msGEOSContains((yyvsp[-2].shpval), (yyvsp[0].shpval));
+      rval = msGEOSWithin((yyvsp[-2].shpval), (yyvsp[0].shpval));
       if((yyvsp[-2].shpval)->scope == 1) msFreeShape((yyvsp[-2].shpval));
       if((yyvsp[0].shpval)->scope == 1) msFreeShape((yyvsp[0].shpval));
       if(rval == -1) {
-        yyerror("Contains operator failed.");
+        yyerror("Within operator failed.");
         return(-1);
       } else
         (yyval.intval) = rval;
     }
     break;
 
+  case 49:
+#line 438 "mapparser.y"
+    {
+      double d;
+      d = msGEOSDistance((yyvsp[-2].shpval), (yyvsp[0].shpval));
+      if((yyvsp[-2].shpval)->scope == 1) msFreeShape((yyvsp[-2].shpval));
+      if((yyvsp[0].shpval)->scope == 1) msFreeShape((yyvsp[0].shpval));
+      if(d == 0.0) 
+        (yyval.intval) = MS_TRUE;
+      else
+        (yyval.intval) = MS_FALSE;
+    }
+    break;
+
   case 50:
-#line 441 "mapparser.y"
+#line 448 "mapparser.y"
+    {
+      double d;
+      d = msGEOSDistance((yyvsp[-2].shpval), (yyvsp[0].shpval));
+      if((yyvsp[-2].shpval)->scope == 1) msFreeShape((yyvsp[-2].shpval));
+      if((yyvsp[0].shpval)->scope == 1) msFreeShape((yyvsp[0].shpval));
+      if(d > 0.0) 
+        (yyval.intval) = MS_TRUE;
+      else
+        (yyval.intval) = MS_FALSE;
+    }
+    break;
+
+  case 52:
+#line 461 "mapparser.y"
     { (yyval.dblval) = (yyvsp[-1].dblval); }
     break;
 
-  case 51:
-#line 442 "mapparser.y"
+  case 53:
+#line 462 "mapparser.y"
     { (yyval.dblval) = (yyvsp[-2].dblval) + (yyvsp[0].dblval); }
     break;
 
-  case 52:
-#line 443 "mapparser.y"
+  case 54:
+#line 463 "mapparser.y"
     { (yyval.dblval) = (yyvsp[-2].dblval) - (yyvsp[0].dblval); }
     break;
 
-  case 53:
-#line 444 "mapparser.y"
+  case 55:
+#line 464 "mapparser.y"
     { (yyval.dblval) = (yyvsp[-2].dblval) * (yyvsp[0].dblval); }
     break;
 
-  case 54:
-#line 445 "mapparser.y"
+  case 56:
+#line 465 "mapparser.y"
     { (yyval.dblval) = (int)(yyvsp[-2].dblval) % (int)(yyvsp[0].dblval); }
     break;
 
-  case 55:
-#line 446 "mapparser.y"
+  case 57:
+#line 466 "mapparser.y"
     {
       if((yyvsp[0].dblval) == 0.0) {
         yyerror("Division by zero.");
@@ -1809,23 +1839,23 @@
     }
     break;
 
-  case 56:
-#line 453 "mapparser.y"
+  case 58:
+#line 473 "mapparser.y"
     { (yyval.dblval) = (yyvsp[0].dblval); }
     break;
 
-  case 57:
-#line 454 "mapparser.y"
+  case 59:
+#line 474 "mapparser.y"
     { (yyval.dblval) = pow((yyvsp[-2].dblval), (yyvsp[0].dblval)); }
     break;
 
-  case 58:
-#line 455 "mapparser.y"
+  case 60:
+#line 475 "mapparser.y"
     { (yyval.dblval) = strlen((yyvsp[-1].strval)); }
     break;
 
-  case 59:
-#line 456 "mapparser.y"
+  case 61:
+#line 476 "mapparser.y"
     {
       if((yyvsp[-1].shpval)->type != MS_SHAPE_POLYGON) {
         yyerror("Area can only be computed for polygon shapes.");
@@ -1836,13 +1866,13 @@
     }
     break;
 
-  case 61:
-#line 467 "mapparser.y"
+  case 63:
+#line 487 "mapparser.y"
     { (yyval.shpval) = (yyvsp[-1].shpval); }
     break;
 
-  case 62:
-#line 468 "mapparser.y"
+  case 64:
+#line 488 "mapparser.y"
     {
     shapeObj *s;
     s = msShapeFromWKT((yyvsp[-1].strval));
@@ -1855,18 +1885,18 @@
   }
     break;
 
-  case 64:
-#line 481 "mapparser.y"
+  case 66:
+#line 501 "mapparser.y"
     { (yyval.strval) = (yyvsp[-1].strval); free((yyvsp[-1].strval)); }
     break;
 
-  case 65:
-#line 482 "mapparser.y"
+  case 67:
+#line 502 "mapparser.y"
     { sprintf((yyval.strval), "%s%s", (yyvsp[-2].strval), (yyvsp[0].strval)); free((yyvsp[-2].strval)); free((yyvsp[0].strval)); }
     break;
 
-  case 67:
-#line 486 "mapparser.y"
+  case 69:
+#line 506 "mapparser.y"
     { (yyval.tmval) = (yyvsp[-1].tmval); }
     break;
 
@@ -1874,7 +1904,7 @@
     }
 
 /* Line 1037 of yacc.c.  */
-#line 1878 "mapparser.c"
+#line 1908 "mapparser.c"
 
   yyvsp -= yylen;
   yyssp -= yylen;
@@ -2102,7 +2132,7 @@
 }
 
 
-#line 489 "mapparser.y"
+#line 509 "mapparser.y"
 
 
 /*

Modified: sandbox/sdlime/common-expressions/mapserver/mapparser.y
===================================================================
--- sandbox/sdlime/common-expressions/mapserver/mapparser.y	2010-07-13 23:44:36 UTC (rev 10347)
+++ sandbox/sdlime/common-expressions/mapserver/mapparser.y	2010-07-14 00:14:33 UTC (rev 10348)
@@ -426,15 +426,35 @@
     }
   | shape_exp CONTAINS shape_exp {
       int rval;
-      rval = msGEOSContains($1, $3);
+      rval = msGEOSWithin($1, $3);
       if($1->scope == 1) msFreeShape($1);
       if($3->scope == 1) msFreeShape($3);
       if(rval == -1) {
-        yyerror("Contains operator failed.");
+        yyerror("Within operator failed.");
         return(-1);
       } else
         $$ = rval;
     }
+  | shape_exp DWITHIN shape_exp {
+      double d;
+      d = msGEOSDistance($1, $3);
+      if($1->scope == 1) msFreeShape($1);
+      if($3->scope == 1) msFreeShape($3);
+      if(d == 0.0) 
+        $$ = MS_TRUE;
+      else
+        $$ = MS_FALSE;
+    }
+  | shape_exp BEYOND shape_exp {
+      double d;
+      d = msGEOSDistance($1, $3);
+      if($1->scope == 1) msFreeShape($1);
+      if($3->scope == 1) msFreeShape($3);
+      if(d > 0.0) 
+        $$ = MS_TRUE;
+      else
+        $$ = MS_FALSE;
+    }
 ;
 
 math_exp: NUMBER



More information about the mapserver-commits mailing list