[mapserver-dev] A question...

Daniel Morissette dmorissette at mapgears.com
Thu Aug 6 10:58:25 EDT 2009


kiran varma wrote:
> In order to implement SVG functionality currently i am trying to mimic 
> VECTOR rendering. Can someone explain the flow of control for the 
> rendering of vector symbol? Preferably from mapfile parsing upto gd/agg 
> rendering. This will help me understand the route that i have to take in 
> order to render SVG symbol.
> 

1- Parsing:

When the mapfile/symbolset is parsed, the symbol definitions is stored 
in a symbolObj

2- At rendering time, msDrawMap() is called, which in turn calls 
msDrawLayer() for each layer

3- For each shape read, msDrawShape() is called. This function contains 
a switch/case statement based on layer type

The rest of the processing depends on the layer type and renderer. Let's 
continue with the GD renderer:

4a- MS_LAYER_POINT: For a shape in a point layer, msDrawMarkerSymbol() 
(which in turn calls msDrawMarkerSymbolGD() ) is called to draw the 
symbol at the right location on the map based on the symbolObj 
information. The point layer case is different from the two other layer 
types because it doesn't use the symbol cache, the symbol is drawn 
directly on top of the output image... I'm not exactly sure why, but 
there is a TODO comment about this in the code.


4b- MS_LAYER_LINE: For a shape in a line layer, msDrawLineSymbol() is 
called, which in turn calls msDrawLineSymbolGD(). Then 
searchImageCache() is used to check if the symbol is already in the 
cache for the current size, color and angle, and if not then 
createBrush() is used to render the symbol in a and gdImagePtr, we store 
it in the cache using addImageCache() and finally it is used as a brush 
to render the line with gdImageLine().

4c - MS_LAYER_POLYGON: I leave that one to you as an exercise.

Hint: stepping through the code in GDB is an excellent way to figure the 
flow of control of a given operation.

Daniel
-- 
Daniel Morissette
http://www.mapgears.com/


More information about the mapserver-dev mailing list