-
Notifications
You must be signed in to change notification settings - Fork 5
/
sbgn_map.cpp.txt
81 lines (60 loc) · 1.86 KB
/
sbgn_map.cpp.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
LIBSBGN_CPP_NAMESPACE_BEGIN
#ifdef __cplusplus
#include <sbml/packages/render/common/RenderExtensionTypes.h>
#include <sbml/packages/render/sbml/LocalRenderInformation.h>
bool
SbgnMap::readOtherXML(LIBSBML_CPP_NAMESPACE_QUALIFIER XMLInputStream& stream)
{
return false;
}
std::string SbgnMap::getRenderInformationAsString() const
{
LIBSBML_CPP_NAMESPACE_QUALIFIER LocalRenderInformation* info = getRenderInformation();
if (info != NULL)
{
LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode node = info->toXML();
return XMLNode::convertXMLNodeToString(&node);
}
return std::string();
}
const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode*
getRenderInformationNode(const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* node)
{
if (node == NULL)
return NULL;
if (node->getName() == "renderInformation")
return node;
for (unsigned int i = 0; i < node->getNumChildren(); ++i)
{
const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode& current = node->getChild(i);
if (current.getName() == "renderInformation")
return ¤t;
}
return NULL;
}
LIBSBML_CPP_NAMESPACE_QUALIFIER LocalRenderInformation*
SbgnMap::getRenderInformation() const
{
const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* node = getExtension();
if (node == NULL)
return NULL;
const LIBSBML_CPP_NAMESPACE_QUALIFIER XMLNode* infoNode = getRenderInformationNode(node);
if (infoNode == NULL)
return NULL;
LIBSBML_CPP_NAMESPACE_QUALIFIER
LocalRenderInformation* result = new LIBSBML_CPP_NAMESPACE_QUALIFIER
LocalRenderInformation();
result->parseXML(*infoNode);
return result;
}
void
SbgnMap::setRenderInformation(
const LIBSBML_CPP_NAMESPACE_QUALIFIER LocalRenderInformation *info)
{
if (info == NULL) return;
XMLNode xml = info->toXML();
xml.addNamespace(info->getURI());
replaceTopLevelExtensionElement(&xml);
}
#endif // __cplusplus
LIBSBGN_CPP_NAMESPACE_END