Dear Sirs.
I´m using the source code version of you library from the Snapshot 2013-04-16
Because this version has the “How-tos” synchronized.
I’m using the source code of the tool gml2pic as a reference to create a
GML viewer in OpenGL
I´m trying to understand how gml2pic works so I can adapt the code to generate a 3D representation of the graphs generated by OGDF
In this source code there are some references to attributes and methods of
an old version of the library ogdf/fileformats/XmlParser
Where
can I find documentation explaining how to transform the old code to work with
the new version of the library?
Can you give me your advice about the way I chose to achieve my goal (use gml2pic as reference)?
Do you think that there is any easier way?
Please help
1010836
Hi Carsten Gutwenger
1. The file DinoXmlParser has been renamed to XmlParser but in the version 2007.07 (Skura) existed 2 files.
1.1.
One named DinoXmlParser and another called
XmlParser
2. On the Snapshot
2013-04-16 there is only one file named XmlParser that
corresponds to the old DinoXmlParser.
2.1. I’m sending you 1 picture where you can compare the list of files of the 2 versions
2.1.1. A1_Header_Files_List_Comparation.png
3. The gml2pic
project uses the old class XmlParser to parse a string that contains label attributes
like size and color.
3.1.
The string content is stored in XML format,
and the function extracts all the attributes to individual variables
3.2.
I’m sending you 1 picture with the code of
that function
3.2.1.
A2_Function_That_Uses_Old_XmlParser_File
4. I don’t
need gml2pic to work with the new version of the OGDF library
4.1. I only want to know if in these new OGDF version exists any class that implements the functionality of the old XmlParser class
4.2.
If not I will join the old XmlParser class
with another name to my project
Many Thanks
Evaristo Figueiredo
labelFromString in gml2pic, but now I'm done. The changed function implementation looks now as follows:
// retrieve text and formatting info from string representation void GMLProcessor::labelFromString(const char *attrStr, QColor &myTextColor, QFont &myFont, int &myAlign, QString &myLabel) { std::istringstream is(attrStr); try { XmlParser xml(is); xml.createParseTree(); QColor textColor = myTextColor; QFont font = myFont; int align = myAlign; QString text; const XmlTagObject *root = &xml.getRootTag(); if(root->getName() == "label") { const XmlAttributeObject *son = root->m_pFirstAttribute; for(; son; son = son->m_pNextAttribute) { const string &n = son->getName(); if(n == "font") { font.fromString(son->getValue().c_str()); } else if(n == "align") { align = stoi(son->getValue()); } else if(n == "textColor") { textColor = colorFromString(son->getValue().c_str()); } } text = QString::fromLatin1(root->getValue().c_str()); } if(text.isNull()) { // support for old format myLabel = attrStr; } else { myFont = font; myAlign = align; myTextColor = textColor; myLabel = text; } } catch(AlgorithmFailureException ex) { // just ignore parse error } }So to answer your questions: Yes, there is a class providing that functionality, but it needs a little rewriting as the interface is not the same.Regards,Carsten
Carsten
Thank you very much for your precious help
Your project is managed and supported in a really professional way
Thanks
Evaristo