Changes between Initial Version and Version 1 of GSoC_SVG_Symbols_SECOND_DRAFT_OF_THE_MS_RFC


Ignore:
Timestamp:
Aug 10, 2009, 10:45:40 AM (15 years ago)
Author:
kiranvarma
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GSoC_SVG_Symbols_SECOND_DRAFT_OF_THE_MS_RFC

    v1 v1  
     1                                MS RFC – SVG symbol Support with AGG
     2                                   Kiran Anjaneya Varma Alluri
     3                                    August 10, 2009
     41 Overview
     5Popular tools such as Inkscape generate SVG graphics natively. So far MapServer has not supported the SVG format, which
     6leaves many users with the extra work of converting between formats. This RFC aims to introduce support for SVG graphics
     7as an alternate method to define vector symbols in the MapServer symbolset.
     8
     92 Method
     10The SVG parsing and rendering will be triggered by the following syntax:
     11SYMBOL
     12TYPE SVG
     13SVGPATH / p a t h / t o / f i l e . svg
     14END
     15The choice for using a SYMBOL for the task is to allow for the reuse of the SVG symbol easily within classes.
     16
     173 Technical Overview
     18In order to support the SVG format, we make use of the AGG library. The reasons for going with the AGG library are:
     191. It has already been integrated into MapServer. While other popular libraries, such as Cairo, can be used, they would
     20require effort to integrate into MapServer and would further introduce many dependencies into the MapServer code.
     212. It is a very lightweight library and delivers performance equal to, and sometimes higher than other popular libraries.
     22
     23There are some disadvantages that emerge from using the AGG library. Foremost, the AGG library has an incomplete SVG
     24specification. To avoid having to reimplement the missing subset of the specification (which would, without a doubt, be a
     25non-trivial task, and would add to the complexity of this RFC), we stick by the following techniques:
     26
     271. A modular design is used, where the generation of the intermediate pixmap is done by a single function so that it can be
     28easily modified to adjust to a diferent library. Thus, using a pixmap will allow us to use any rendering library.
     291
     302. The unimplemented subset of the SVG specification is clearly provided to users in the documentation to prevent frustration
     31on their side.
     32
     33
     34To implement this functionality, the following steps needs to be accomplished:
     351. Implement an SVG parser. For this, we directly make use of the SVG Viewer example provided along with the AGG
     36sources.
     372. Modify the MapServer lexical analyzer and parser to recognize the new keywords (SVG and SVGPATH).
     383. Modify the symbolObj structure to store information about the SVG symbol requested (eg. File path).
     394. Write a single function to render a parsed SVG file to a pixmap. The pixmap will be an intermediate form that can then
     40be rendered. The pixmap will be stored in cache memory to prevent having to constantly be rasterized it every time a
     41symbol is drawn.
     425. Create a createBrushFromSVG() function that creates a GD image pixmap. Also modify the basic rendering functions
     43to support the new symbol type by using the createBrushFromSVG function.
     446. Render the pixmap into the final image file. This will be done using a mixture of the AGG and GD libraries.
     45
     46
     474 Files Added and Modified
     484.1 AGG/SVG Parser
     49The SVG parsing and pixmap generation functions will be stored in source files stored at
     50/ maps e rve r / r e n d e r e r s / agg / svg /
     51The files within the above directory include the files for:
     52a. SVG Parsing
     53b. Trigger Function (based on Mapfile syntax)
     54c. SVG to Pixmap generation
     55All files are within the C++ ’mapserver’ namespace.
     56
     574.2 Rendering Functions
     58The rendering functions in mapgd.c will be modified to support the SVG type. These include all the basic shapes such as
     59points, lines, circles etc. These will make use of the createBrushFromSVG function to render to a GD pixmap.
     60
     614.3 Lexical Analyzer and Parser
     62The maplexer.l file will be modified to support two new keywords (SVG and SVGPATH). The mapsymbol.h file be modified
     63by adding SVG related data to the symbolObj structure along with basic enumerations and defines. The mapsymbol.c file’s
     64loadSymbol function will be modified to generate the required new fields in the symbolObj structure.
     65
     66
     675 Documentation
     68The following documentation needs to be prepared for this project:
     691. Missing SVG specification document.
     702. Basic usage tutorial of new functionality with examples.