INCLUDE capability added...

Steve Lime Steve.Lime at DNR.STATE.MN.US
Thu Jul 6 14:57:47 EDT 2006


To me that's a different problem - sort of a load from buffer option, where that string is a snippet of a mapfile from a file, a URL parameter or even a DB record. I haven't thought about implementation specifics though.

We can parse string buffers but augmenting or creating indivual objects will be tricky.

Steve

>>> Fernando Simon <fsimon at UNIVALI.BR> 7/6/2006 8:54:38 AM >>>
Hi Steve,
    It's really good enhancement. Just a last question. Can we add this 
for Mapscript?
    Using a new parameter/attribute "include" for objects? I know that 
this issue will be more complicated because we need to force to include 
just full objects or append right objects, and after parse again this 
definitions for new objects, like "refresh" for objects.
     Best regards.

Fernando Simon


Steve Lime wrote:
> Good questions. 
>
> 1) The one benefit of leaving this functionality in the lexer is that it works anywhere. You switch buffers within whatever parent object you where in when the include was encountered and when you hit an EOF you revert to the parent buffer. Syntax checking should still work. Of course this needs to be verified...
>
> 2) Yes, you can nest includes. This all works by using a buffer stack that flex manages. The size of that stack is pre-determined (I know, another static array) at the moment but that's probably ok as there are practical limits on include depth (I wouldn't think more than 2 would be very useful). It's set to 5 now.
>
> Steve
>
>   
>>>> Fernando Simon <fsimon at univali.br> 07/06/06 8:10 AM >>>
>>>>         
> Hi all,
>     It's a very good improvement  for Mapfiles, but I have just a little 
> questions.
>     The "INCLUDE" will just accept full objects (layers, symbols, 
> legend) or can I use to append definitions, like:
> LAYER
>         TYPE POINT
>         STATUS DEFAULT
>         INCLUDE "features_layer.lyr"
>         INCLUDE "class_layer.cls"   
> END
>
>      The "features_layer.lyr" is:
> FEATURE
>     POINTS 10 10 40 20 300 300 400 10 10 400 END
> END
>
>      And "class_layer.cls", is:
> 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
>
>     Another question, can I use and include with another include inside?
>     Best regards.
>
> Fernando Simon
>
>
>
> Daniel Morissette wrote:
>   
>> Cool!
>>
>> This may not warrant a RFC, but could you please at least create a bug 
>> report to document the enhancement, when it was added, what the 
>> implications and limitations are, etc. (basically what you wrote in 
>> your email).
>>
>> Sorry to be a pain about this, but it's always easier to point users 
>> to bug reports or RFCs in release notes than having to tell them to 
>> dig through the list archives to find the information (that's assuming 
>> they are registered and able to reach the list archives).
>>
>> Daniel
>>
>> Steve Lime wrote:
>>     
>>> 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