INCLUDE capability added...

Steve Lime Steve.Lime at DNR.STATE.MN.US
Thu Jul 6 02:12:30 EDT 2006


Hi all: I sat down and actually read the Flex manual last night and discovered a simple ability to support INCLUDEd files. It's implemented within the lexer so doesn't impact any of the C source. Only a basic implementation is in place but it seems to work nicely, so now you can do stuff like:

MAP
  NAME 'include'
  EXTENT 0 0 500 500
  SIZE 250 250
  
  INCLUDE "test_include_symbols.map"
  INCLUDE "test_include_layer.map"
END

where test_include_symbols.map contains:

  SYMBOL
    NAME 'square'
    TYPE VECTOR
    FILLED TRUE
    POINTS 0 0 0 1 1 1 1 0 0 0 END
  END

and test_include_layer.map contains:

  LAYER
    TYPE POINT
    STATUS DEFAULT
    FEATURE
      POINTS 10 10 40 20 300 300 400 10 10 400 END
    END
    CLASS
      NAME 'Church'
      COLOR 0 0 0
      SYMBOL 'square'
      SIZE 7
      STYLE
        SYMBOL "square"
        SIZE 5
        COLOR 255 255 255
      END
      STYLE
        SYMBOL "square"
        SIZE 3
        COLOR 0 0 255
      END
    END
  END

I think this could be extended to non-filebased sources but this'll do for now. Some caveats:

  - the filename must be double qouted for the moment
  - I'm sure there will be some pathing issues
  - I'm not sure everything (especially file handles) is being cleaned up properly yet
  - includes are never written when the mapObj is written to disk (I don't think it's necessary or even possible to do so)

Anyway, it was simple to add and will be simple to back out if necessary. Figured it was worth testing since it is backwards compatible.

Steve



More information about the mapserver-dev mailing list