[mapguide-internals] Some pointers please for Integration into
server code for MapGuide RFC 60
Bruce Dechant
bruce.dechant at autodesk.com
Mon Mar 2 14:29:33 EST 2009
UV,
Please see my comments below.
Note: I will comment on the RFC60 in the other thread.
Thanks,
Bruce
-----Original Message-----
From: mapguide-internals-bounces at lists.osgeo.org [mailto:mapguide-internals-bounces at lists.osgeo.org] On Behalf Of UV
Sent: Thursday, February 26, 2009 9:35 PM
To: MapGuide Internals Mail List
Subject: [mapguide-internals] Some pointers please for Integration into server code for MapGuide RFC 60
Hi all,
I am working on improvement of color palette quantization for PNG8 tiles.
The RFC has been set up in the wiki: MapGuideRfc60
<http://trac.osgeo.org/mapguide/wiki/MapGuideRfc60>
Any further ideas and comments are greatly appreciated.
The general algorithm has been implemented within AGGImageIO.cpp and
tested.
I found some pieces of png C code in there and simply added another 2
methods (~100 lines) to it.
Whats remaining now is the clean integration into the server and the
configuration issues.
Being fairly new to the mapguide server I can use some help where to
find things.
Searching the whole codebase has turned out to be very unefficient.
Therefore I would appreciate some pointers into the code tree:
- where to add the color extraction code from the map definitions
(InitializeTileService????)
[Bruce Dechant] You could add it to the GetTile() method as it extracts the Map definition information and caches it for future use.
- where is the best place to add the color palette in the resource tree.
[Bruce Dechant] I think as a new ColorPalatte resource that is referenced by the Map Definition.
- where I can find example code that parses the map definition (for the
color extraction)
[Bruce Dechant] Here is some sample code that parses the map definition resource:
// get the map definition from the resource repository
Ptr<MgByteReader> content = m_resourceService->GetResourceContent(mapDefinition);
Ptr<MgByteSink> sink = new MgByteSink(content);
Ptr<MgByte> bytes = sink->ToBuffer();
// parse the map definition
MdfParser::SAX2Parser parser;
parser.ParseString((const char*)bytes->Bytes(), bytes->GetLength());
if (!parser.GetSucceeded())
{
STRING errorMsg = parser.GetErrorMessage();
MgStringCollection arguments;
arguments.Add(errorMsg);
throw new MgInvalidMapDefinitionException(L"MgMap.Create", __LINE__, __WFILE__, &arguments, L"", NULL);
}
// build the runtime map object from the parsed definition
std::auto_ptr<MdfModel::MapDefinition> mdef(parser.DetachMapDefinition());
- whats the recommended way to throw an exception from the included C-code
throw new std::exception("AGGImageIO.cpp:1086: the base color cannot be
found in the provided colormap: ABORT")
[Bruce Dechant] Aborting the program due to this failure is not a good idea - I assume that is just part of your sample exception comment and not what you really want to do. The existing AGG code has a couple of example exceptions - see _DWFCORE_THROW. These are DWF specific so I would suggest you introduce a new type something like _AGG_THROW.
thanks for your support.
_______________________________________________
mapguide-internals mailing list
mapguide-internals at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
More information about the mapguide-internals
mailing list