[mapguide-internals] RFC60 - Server integration issues

UV uvwild at gmail.com
Tue Mar 17 12:23:58 EDT 2009

The whole approach regarding integration into the server has changed in 
the last week as some more clarity emerged after a number of debugging 

We confirmed that the base colors of the map needs to be collected per 
BaseGroup and per zoomlevel.
This creates the small problem of providing access to the relevant 
objects from within the imageconverter
I made a sequence diagram to support demonstrating this issue and are 
trying to enclose it....(link to WIKI below)

The difficulty I am now facing is that the runtime map object MgMap 
which has access to the colordata in the map via the VectorLayerDefinitions
needs the current zoom level and the name of the basemaplayergroup to 
determine the correct colors from the VectorLayerDefinitions of a map.
1. Most simply I would like to inject the relevant references to the 
colormap into imageconverter in AGGImageIO from the rendering service.
However, AGGImageIo is only used as a namespace and not as a real object 
instance (static methods and c code only) so this would be working only 
for a single user scenario.

2. So the next approach would be to hand down the relevant references 
over the stack, down the call graph to the ImageIo,
but this means changing 5-6 method signatures to pass down the map 
reference and the basegroupname ..... this feels not so good either....

3. maybe I should create instances of the AGGImageIo and use injection 
of the references from the rendering service.....

anyone has a better idea?

diagram at 

// PURPOSE: Accessor method for the base colors defined in this Layer.
// RETURNS: A pointer to the collection of colors per scalerange so we 
can compute the colormap from this with a given zoomlevel
// and basemapname.... the colors are indexed with labels from the rules 
they are found in
PSCALECOLORMAP VectorLayerDefinition::GetColorScaleMap()
    if (this->m_colorMap == NULL)
        this->m_colorMap = new SCALECOLORMAP();
        int csrcount = this->m_collScaleRanges.GetCount();   
        for (int i=0; i< csrcount; i++)
            PCOLORMULTIMAP cpolorMultiMap = new COLORMULTIMAP();
            VectorScaleRange* pvsr = this->m_collScaleRanges.GetAt(i);

            // we simply keep all colors in a larger map

            // iterate through the featuretypecollection
            FeatureTypeStyleCollection* pftsColl = 
            int ftsccount = pftsColl->GetCount();
            for (int j=0; j< ftsccount; j++)
                FeatureTypeStyle* pfts = pftsColl->GetAt(j);

                // iterate through the rulecollection
                RuleCollection* ruleColl = pfts->GetRules();
                int rccount = ruleColl->GetCount();
                for (int k=0; k < rccount; k++)
                    Rule* rule = ruleColl->GetAt(k);

                    // get the label which will be the key in the color map
                    const MdfString& label = rule->GetLegendLabel();

                    // do the casting to access the relevant members
                    // this is bad style but we save touching too many 
different files
                    AreaRule* paRule = dynamic_cast<AreaRule*>(rule);
                    LineRule* plRule = dynamic_cast<LineRule*>(rule);
                    //PointRule* ppRule = 
dynamic_cast<PointRule*>(rule);   // only line and area for now
                    //CompositeRule* pcRule = 

                    if (paRule != NULL)
                        AreaSymbolization2D* pasym = 

                        pcolorMultiMap ->insert 

                    if (plRule != NULL)
                        LineSymbolizationCollection* plsymcol = 
                        // iterate through the linesymbolizations
                        int lsccount = ruleColl->GetCount();
                        for (int l=0; l < lsccount; l++)
                            LineSymbolization2D* plsym = plsymcol->GetAt(l);
                } // for GetRules
            } // for GetFeatureTypeStyles
            // only add colorMultiMaps with values...
            if (colorMultiMap->size() > 0)
        } // for m_collScaleRanges
    } // if null
    return this->m_colorMap;

PS to stay aligned with the code base I also rather copied code around 
instead of doing method extraction.
......which IMHO would simplify the understanding and the maintenance of 
the codebase
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GetTileSequence.png
Type: image/png
Size: 35553 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/mapguide-internals/attachments/20090318/f88d2ce8/GetTileSequence-0001.png

More information about the mapguide-internals mailing list