[mapguide-internals] RFC60 - Server integration issues
traian.stanev at autodesk.com
Tue Mar 17 15:18:07 EDT 2009
The approach that is most consistent with the existing code is to retrieve the palette from the MgMap object and pass it down to the renderer. The last place in the callstack where the MgMap is available is in the ServerRenderingService::RenderMapInternal. In there you also know the map scale. There, you would extract the palette and pass it to the Renderer in the Save() call, which also takes the output format, width and height as arguments. If you pass it into Save(), there is only a single level of API indirection to get to AGGImageIO::Save. You will probably have to make a minor modification in the internal ServerRenderingService functions to pass down the name of the base layer group as well as the list of layers in that group into the RenderMapInternal from the RenderTile call, but this is a modification that does not affect any public APIs.
From: mapguide-internals-bounces at lists.osgeo.org [mailto:mapguide-internals-bounces at lists.osgeo.org] On Behalf Of UV
Sent: Tuesday, March 17, 2009 12:24 PM
To: MapGuide Internals Mail List
Subject: [mapguide-internals] RFC60 - Server integration issues
The whole approach regarding integration into the server has changed in the last week as some more clarity emerged after a number of debugging session.
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?
// 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
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 = dynamic_cast<CompositeRule*>(rule);
if (paRule != NULL)
AreaSymbolization2D* pasym =
pcolorMultiMap ->insert (LABELCOLORPAIR(label,pasym->GetFill()->GetForegroundColor()));
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
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
More information about the mapguide-internals