7 # define _USE_MATH_DEFINES // without the following define, M_PI will not be declared under windows
22 #include <sbml/Compartment.h>
23 #include <sbml/Model.h>
24 #include <sbml/SBase.h>
25 #include <sbml/SBMLDocument.h>
26 #include <sbml/Species.h>
27 #include <sbml/xml/XMLNode.h>
28 #include <sbml/xml/XMLNamespaces.h>
29 #include <sbml/xml/XMLAttributes.h>
31 #include <sbml/packages/layout/sbml/CompartmentGlyph.h>
32 #include <sbml/packages/layout/sbml/CubicBezier.h>
33 #include <sbml/packages/layout/sbml/Curve.h>
34 #include <sbml/packages/layout/sbml/GraphicalObject.h>
35 #include <sbml/packages/layout/sbml/Layout.h>
36 #include <sbml/packages/layout/sbml/LineSegment.h>
37 #include <sbml/packages/layout/sbml/ReactionGlyph.h>
38 #include <sbml/packages/layout/sbml/SpeciesGlyph.h>
39 #include <sbml/packages/layout/sbml/SpeciesReferenceGlyph.h>
40 #include <sbml/packages/layout/sbml/SpeciesReferenceRole.h>
41 #include <sbml/packages/layout/sbml/TextGlyph.h>
43 #include <sbml/packages/layout/extension/LayoutModelPlugin.h>
46 #include <sbml/packages/render/sbml/ColorDefinition.h>
47 #include <sbml/packages/render/sbml/Ellipse.h>
48 #include <sbml/packages/render/sbml/RenderGroup.h>
49 #include <sbml/packages/render/sbml/LocalRenderInformation.h>
50 #include <sbml/packages/render/sbml/LocalStyle.h>
51 #include <sbml/packages/render/sbml/Polygon.h>
52 #include <sbml/packages/render/sbml/Rectangle.h>
53 #include <sbml/packages/render/sbml/RelAbsVector.h>
54 #include <sbml/packages/render/sbml/RenderCurve.h>
55 #include <sbml/packages/render/sbml/RenderPoint.h>
57 #include <sbml/packages/render/extension/RenderLayoutPlugin.h>
86 mpDocument(pDocument),
88 mpLocalRenderInfo(NULL)
90 setlocale(LC_ALL,
"C");
93 this->
mpDocument->getModel()->getAnnotation() != NULL)
97 if (pAnnotation != NULL)
117 this->
mpDocument->getModel()->getAnnotation() != NULL)
121 if (pAnnotation != NULL)
133 LayoutModelPlugin* lmPlugin = (LayoutModelPlugin*)this->
mpDocument->getModel()->getPlugin(
"layout");
135 if (lmPlugin != NULL)
138 unsigned int i, iMax = lmPlugin->getListOfLayouts()->size();
140 for (i = 0; i < iMax; ++i)
142 if (lmPlugin->getLayout(i) == this->
mpLayout)
144 lmPlugin->removeLayout(i);
186 const XMLNode* pNode = NULL;
188 if (pDocument != NULL && pAnnotation != NULL)
190 const Model* pModel = pDocument->getModel();
193 if (celldesigner_ns_found.first ==
true && pModel != NULL)
195 const XMLNamespaces* pNamespaces = NULL;
196 const std::string uri(
"http://www.sbml.org/2001/ns/celldesigner");
197 const XMLNode* pAnnoChild = NULL;
199 if (pAnnotation != NULL)
201 unsigned int i, iMax = pAnnotation->getNumChildren();
204 std::string ns_prefix;
206 if (pAnnotation->getNamespaces().hasURI(uri))
208 ns_prefix = pAnnotation->getNamespaces().getPrefix(uri);
210 else if (pDocument->getNamespaces()->hasURI(uri))
212 ns_prefix = pDocument->getNamespaces()->getPrefix(uri);
215 for (i = 0; i < iMax && pNode == NULL; ++i)
217 pAnnoChild = &pAnnotation->getChild(i);
221 if (pAnnoChild != NULL)
224 pNamespaces = &pAnnoChild->getNamespaces();
226 if (pNamespaces->hasURI(uri))
228 ns_prefix = pNamespaces->getPrefix(uri);
231 if (!ns_prefix.empty() && ns_prefix == pAnnoChild->getPrefix() && pAnnoChild->getName() ==
"extension")
255 std::pair<bool, std::string> result(
false,
"");
257 if (pDocument != NULL)
261 const XMLNamespaces* pNamespaces = pDocument->getNamespaces();
262 const std::string uri(
"http://www.sbml.org/2001/ns/celldesigner");
263 const Model* pModel = pDocument->getModel();
265 if (pNamespaces && pNamespaces->hasURI(uri))
268 result.second = pNamespaces->getPrefix(uri);
274 pNamespaces = pModel->getNamespaces();
276 if (pNamespaces != NULL && pNamespaces->hasURI(uri))
279 result.second = pNamespaces->getPrefix(uri);
284 const XMLNode* pAnnotation =
const_cast<Model*
>(pModel)->getAnnotation();
286 if (pAnnotation != NULL)
288 pNamespaces = &pAnnotation->getNamespaces();
290 if (pNamespaces != NULL && pNamespaces->hasURI(uri))
293 result.second = pNamespaces->getPrefix(uri);
297 unsigned int i, iMax = pAnnotation->getNumChildren();
298 const XMLNode* pChild = NULL;
300 for (i = 0; i < iMax; ++i)
302 pChild = &pAnnotation->getChild(i);
303 assert(pChild != NULL);
307 pNamespaces = &pChild->getNamespaces();
309 if (pNamespaces != NULL && pNamespaces->hasURI(uri))
312 result.second = pNamespaces->getPrefix(uri);
349 while (nit != nendit)
364 if (pCellDesignerAnnotation != NULL &&
365 pCellDesignerAnnotation->getName() ==
"extension" &&
370 std::map<std::string, const SBase*> metaids;
374 LayoutModelPlugin* lmPlugin = (LayoutModelPlugin*)this->
mpDocument->getModel()->getPlugin(
"layout");
375 assert(lmPlugin != NULL);
377 this->
mpLayout = lmPlugin->createLayout();
385 this->
mIdMap.insert(std::pair<std::string, const SBase*>(
id, this->
mpLayout));
388 RenderLayoutPlugin* rlPlugin = (RenderLayoutPlugin*) this->
mpLayout->getPlugin(
"render");
401 std::string render_id = this->
createUniqueId(
"RenderInformation");
410 pBlack->setId(color_id);
411 this->
mIdMap.insert(std::pair<std::string, const SBase*>(color_id, pBlack));
412 pBlack->setRGBA(0, 0, 0, 255);
413 this->
mColorStringMap.insert(std::pair<std::string, std::string>(
"#000000FF", color_id));
427 const XMLNode* pChild = NULL;
561 if (!result && this->
mpLayout != NULL)
565 LayoutModelPlugin* lmPlugin = (LayoutModelPlugin*)this->
mpDocument->getModel()->getPlugin(
"layout");
567 if (lmPlugin != NULL)
569 unsigned int i, iMax = lmPlugin->getListOfLayouts()->size();
571 for (i = 0; i < iMax; ++i)
573 if (lmPlugin->getLayout(i) == this->
mpLayout)
575 lmPlugin->removeLayout(i);
602 if (pLoCA != NULL && pLoCA->getName() ==
"listOfCompartmentAliases")
604 std::string prefix = pLoCA->getPrefix();
605 const XMLNode* pChild = NULL;
606 unsigned int i, iMax = pLoCA->getNumChildren();
608 for (i = 0; i < iMax && result ==
true; ++i)
610 pChild = &pLoCA->getChild(i);
612 if (pChild != NULL && pChild->getPrefix() == prefix && pChild->getName() ==
"compartmentAlias")
640 if (pLoSA != NULL && (pLoSA->getName() ==
"listOfSpeciesAliases" || pLoSA->getName() ==
"listOfComplexSpeciesAliases"))
642 std::string prefix = pLoSA->getPrefix();
643 const XMLNode* pChild = NULL;
644 unsigned int i, iMax = pLoSA->getNumChildren();
646 for (i = 0; i < iMax && result ==
true; ++i)
648 pChild = &pLoSA->getChild(i);
650 if (pChild != NULL &&
651 pChild->getPrefix() == prefix &&
652 (pChild->getName() ==
"speciesAlias" || pChild->getName() ==
"complexSpeciesAlias"))
682 CompartmentGlyph* pCGlyph = this->
mpLayout->createCompartmentGlyph();
690 this->
mIdMap.insert(std::pair<std::string, const SBase*>(
id, pCGlyph));
701 assert(pCGlyph->getBoundingBox() != NULL);
702 pCGlyph->setBoundingBox(&ca.
mBounds);
712 this->
mCompartmentAliasMap.insert(std::pair<const CompartmentGlyph*, CompartmentAlias>(pCGlyph, ca));
734 SpeciesGlyph* pSGlyph = NULL;
740 pSGlyph = this->
mpLayout->createSpeciesGlyph();
747 this->
mIdMap.insert(std::pair<std::string, const SBase*>(
id, pSGlyph));
749 pSGlyph->setBoundingBox(&sa.
mBounds);
752 this->
mCDBounds.insert(std::pair<std::string, BoundingBox>(sa.
mId, *pSGlyph->getBoundingBox()));
767 this->
mSpeciesAliasMap.insert(std::pair<const SpeciesGlyph*, SpeciesAlias>(pSGlyph, sa));
811 std::list<CCopasiNode<std::string>*>::const_iterator dependency_it, dependency_endit;
813 while (glyphs_it != glyphs_endit)
815 std::map<std::string, SpeciesAnnotation>::const_iterator anno_pos = this->
mSpeciesAnnotationMap.find(glyphs_it->second.mSpecies);
817 if (anno_pos != this->
mSpeciesAnnotationMap.end() && glyphs_it->first != NULL && glyphs_it->second.mComplexSpeciesAlias.empty())
823 while (dependency_it != dependency_endit)
825 if ((*dependency_it)->getData() == glyphs_it->second.mId)
833 if (dependency_it != dependency_endit)
838 assert(pCurrent != NULL);
840 std::map<std::string, SpeciesAlias>::const_iterator alias_pos;
842 std::string style_id = this->
createUniqueId(
"ComplexSpeciesGlyphStyle");
847 pStyle->setId(style_id);
848 this->
mIdMap.insert(std::pair<std::string, const SBase*>(style_id, pStyle));
850 pStyle->addId(glyphs_it->first->getId());
851 RenderGroup* pGroup = pStyle->getGroup();
852 assert(pGroup != NULL);
862 Point offset(
new LayoutPkgNamespaces(), -glyphs_it->first->getBoundingBox()->getPosition()->x(), -glyphs_it->first->getBoundingBox()->getPosition()->y());
864 while (pCurrent != NULL)
867 assert(!alias.empty());
871 bool is_included =
false;
872 std::map<std::string, std::pair<std::string, SpeciesIdentity> >::const_iterator nameMapPos;
882 std::string color_id;
888 if (result ==
true && pCurrent != *dependency_it)
893 if (pSpecies == NULL)
901 text = nameMapPos->second.first;
907 text = pSpecies->getName();
948 pCurrent = pCurrent->
getNext();
963 assert(pStyle != NULL);
967 pStyle->setId(style_id);
969 pStyle->addId(glyphs_it->first->getId());
970 this->
mIdMap.insert(std::pair<std::string, const SBase*>(style_id, pStyle));
973 if (!glyphs_it->second.mSpecies.empty())
975 std::map<std::string, SpeciesAnnotation>::const_iterator anno_pos = this->
mSpeciesAnnotationMap.find(glyphs_it->second.mSpecies);
979 assert(pStyle->getGroup() != NULL);
981 if (pStyle->getGroup() != NULL)
987 std::string color_id;
992 result =
CCellDesignerImporter::createPrimitive(pStyle->getGroup(), anno_pos->second.mIdentity, glyphs_it->second.mBounds, Point(
new LayoutPkgNamespaces(), -glyphs_it->first->getBoundingBox()->getPosition()->x(), -glyphs_it->first->getBoundingBox()->getPosition()->y()), 1.0,
"#000000", color_id);
1040 const BoundingBox& bounds,
1041 const Point& offset,
1042 double stroke_width,
1043 const std::string& stroke_color,
1044 const std::string& fill_color,
1045 const std::string& text
1054 if (pGroup != NULL &&
1067 cl = pos->second.mType;
1079 double width = bounds.getDimensions()->getWidth();
1080 double height = bounds.getDimensions()->getHeight();
1081 double shortside = (width < height) ? width : height;
1082 Ellipse* pEllipse = pGroup->createEllipse();
1083 assert(pEllipse != NULL);
1085 if (pEllipse != NULL)
1087 pEllipse->setCX(RelAbsVector(offset.x() + bounds.getPosition()->x() + width * 0.5, 0.0));
1088 pEllipse->setCY(RelAbsVector(offset.y() + bounds.getPosition()->y() + height * 0.5, 0.0));
1089 pEllipse->setRX(RelAbsVector(shortside * 0.5, 0.0));
1090 pEllipse->setRY(RelAbsVector(shortside * 0.5, 0.0));
1091 pEllipse->setStrokeWidth(stroke_width);
1092 pEllipse->setStroke(stroke_color);
1093 pEllipse->setFillColor(fill_color);
1105 Ellipse* pEllipse = pGroup->createEllipse();
1106 assert(pEllipse != NULL);
1108 if (pEllipse != NULL)
1110 double width = bounds.getDimensions()->getWidth();
1111 double height = bounds.getDimensions()->getHeight();
1112 pEllipse->setCX(RelAbsVector(offset.x() + bounds.getPosition()->x() + width * 0.5, 0.0));
1113 pEllipse->setCY(RelAbsVector(offset.y() + bounds.getPosition()->y() + height * 0.5, 0.0));
1114 pEllipse->setRX(RelAbsVector(bounds.getDimensions()->getWidth() * 0.5, 0.0));
1115 pEllipse->setRY(RelAbsVector(bounds.getDimensions()->getHeight() * 0.5, 0.0));
1116 pEllipse->setFillColor(fill_color);
1130 double width = bounds.getDimensions()->getWidth();
1131 double height = bounds.getDimensions()->getHeight();
1134 Rectangle* pRectangle = pGroup->createRectangle();
1135 assert(pRectangle != NULL);
1137 if (pRectangle != NULL)
1139 pRectangle->setX(RelAbsVector(offset.x() + bounds.getPosition()->x(), 0.0));
1140 pRectangle->setY(RelAbsVector(offset.y() + bounds.getPosition()->y(), 0.0));
1141 pRectangle->setRadiusX(RelAbsVector(height * 0.5, 0.0));
1142 pRectangle->setRadiusY(RelAbsVector(height * 0.5, 0.0));
1143 pRectangle->setWidth(RelAbsVector(width, 0.0));
1144 pRectangle->setHeight(RelAbsVector(height, 0.0));
1146 pRectangle->setStrokeWidth(stroke_width);
1147 pRectangle->setStroke(stroke_color);
1148 pRectangle->setFillColor(fill_color);
1156 pRectangle = pGroup->createRectangle();
1157 assert(pRectangle != NULL);
1159 if (pRectangle != NULL)
1161 pRectangle->setX(RelAbsVector(offset.x() + bounds.getPosition()->x() + 5, 0.0));
1162 pRectangle->setY(RelAbsVector(offset.y() + bounds.getPosition()->y() + 5, 0.0));
1163 pRectangle->setRadiusX(RelAbsVector(height * 0.5 - 5, 0.0));
1164 pRectangle->setRadiusY(RelAbsVector(height * 0.5 - 5, 0.0));
1165 pRectangle->setWidth(RelAbsVector(width - 10, 0.0));
1166 pRectangle->setHeight(RelAbsVector(height - 10, 0.0));
1168 pRectangle->setStrokeWidth(stroke_width);
1169 pRectangle->setStroke(stroke_color);
1170 pRectangle->setFillColor(fill_color);
1181 Ellipse* pEllipse = pGroup->createEllipse();
1182 assert(pEllipse != NULL);
1184 if (pEllipse != NULL)
1186 double width = bounds.getDimensions()->getWidth();
1187 double height = bounds.getDimensions()->getHeight();
1188 pEllipse->setCX(RelAbsVector(offset.x() + bounds.getPosition()->x() + width * 0.5, 0.0));
1189 pEllipse->setCY(RelAbsVector(offset.y() + bounds.getPosition()->y() + height * 0.5, 0.0));
1190 pEllipse->setRX(RelAbsVector(bounds.getDimensions()->getWidth() * 0.5, 0.0));
1191 pEllipse->setRY(RelAbsVector(bounds.getDimensions()->getHeight() * 0.5, 0.0));
1192 pEllipse->setStrokeWidth(stroke_width);
1193 pEllipse->setStroke(stroke_color);
1194 pEllipse->setFillColor(fill_color);
1205 Ellipse* pEllipse = pGroup->createEllipse();
1206 assert(pEllipse != NULL);
1208 if (pEllipse != NULL)
1210 double width = bounds.getDimensions()->getWidth();
1211 double height = bounds.getDimensions()->getHeight();
1212 pEllipse->setCX(RelAbsVector(offset.x() + bounds.getPosition()->x() + width * 0.5, 0.0));
1213 pEllipse->setCY(RelAbsVector(offset.y() + bounds.getPosition()->y() + height * 0.5, 0.0));
1214 double short_side = (width > height) ? height : width;
1215 pEllipse->setRX(RelAbsVector(short_side * 0.35, 0.0));
1216 pEllipse->setRY(RelAbsVector(short_side * 0.35, 0.0));
1217 pEllipse->setStrokeWidth(stroke_width);
1218 pEllipse->setStroke(stroke_color);
1219 pEllipse->setFillColor(fill_color);
1220 RenderCurve* pCurve = pGroup->createCurve();
1221 assert(pCurve != NULL);
1225 pCurve->setStrokeWidth(2.0);
1226 pCurve->setStroke(
"#000000FF");
1227 RenderPoint* pP = pCurve->createPoint();
1232 pP->setX((short_side - width) * 0.5);
1233 pP->setY((short_side - height) * 0.5 + short_side);
1234 pP = pCurve->createPoint();
1239 pP->setX((short_side - width) * 0.5 + short_side);
1240 pP->setY((short_side - height) * 0.5);
1267 double width = bounds.getDimensions()->getWidth();
1268 double height = bounds.getDimensions()->getHeight();
1270 double radius = 10.0;
1271 Polygon* pPoly = pGroup->createPolygon();
1272 assert(pPoly != NULL);
1276 pPoly->setStrokeWidth(stroke_width);
1277 pPoly->setStroke(stroke_color);
1278 pPoly->setFillColor(fill_color);
1279 RenderPoint* pP = pPoly->createPoint();
1280 RenderCubicBezier* pCB = NULL;
1284 pP->setX(RelAbsVector(radius, 0.0));
1285 pP->setY(RelAbsVector(0.0, 0.0));
1294 pP = pPoly->createPoint();
1298 pP->setX(RelAbsVector(width, 0.0));
1299 pP->setY(RelAbsVector(0.0, 0.0));
1309 pP = pPoly->createPoint();
1313 pP->setX(RelAbsVector(width, 0.0));
1314 pP->setY(RelAbsVector(0.8 * height, 0.0));
1324 pP = pPoly->createPoint();
1328 pP->setX(RelAbsVector(0.8 * width, 0.0));
1329 pP->setY(RelAbsVector(0.5 * height, 0.0));
1339 pP = pPoly->createPoint();
1343 pP->setX(RelAbsVector(0.8 * width, 0.0));
1344 pP->setY(RelAbsVector(height, 0.0));
1354 pP = pPoly->createPoint();
1358 pP->setX(RelAbsVector(radius, 0.0));
1359 pP->setY(RelAbsVector(height, 0.0));
1369 pCB = pPoly->createCubicBezier();
1373 pCB->setBasePoint1_X(RelAbsVector(0.0, 0.0));
1374 pCB->setBasePoint1_Y(RelAbsVector(height, 0.0));
1375 pCB->setBasePoint2_X(RelAbsVector(0.0, 0.0));
1376 pCB->setBasePoint2_Y(RelAbsVector(height, 0.0));
1377 pCB->setX(RelAbsVector(0.0, 0.0));
1378 pCB->setY(RelAbsVector(height - radius, 0.0));
1388 pP = pPoly->createPoint();
1392 pP->setX(RelAbsVector(0.0, 0.0));
1393 pP->setY(RelAbsVector(radius, 0.0));
1403 pCB = pPoly->createCubicBezier();
1407 pCB->setBasePoint1_X(RelAbsVector(0.0, 0.0));
1408 pCB->setBasePoint1_Y(RelAbsVector(0.0, 0.0));
1409 pCB->setBasePoint2_X(RelAbsVector(0.0, 0.0));
1410 pCB->setBasePoint2_Y(RelAbsVector(0.0, 0.0));
1411 pCB->setX(RelAbsVector(radius, 0.0));
1412 pCB->setY(RelAbsVector(0.0, 0.0));
1430 Rectangle* pRect = pGroup->createRectangle();
1431 assert(pRect != NULL);
1435 pRect->setX(RelAbsVector(offset.x() + bounds.getPosition()->x(), 0.0));
1436 pRect->setY(RelAbsVector(offset.y() + bounds.getPosition()->y(), 0.0));
1437 pRect->setRadiusX(RelAbsVector(0.0, 10.0));
1438 pRect->setRadiusY(RelAbsVector(0.0, 10.0));
1439 pRect->setWidth(RelAbsVector(bounds.getDimensions()->getWidth(), 0.0));
1440 pRect->setHeight(RelAbsVector(bounds.getDimensions()->getHeight(), 0.0));
1441 pRect->setStrokeWidth(stroke_width);
1442 pRect->setStroke(stroke_color);
1443 pRect->setFillColor(fill_color);
1459 assert(result ==
true);
1469 Polygon* pPoly = pGroup->createPolygon();
1470 assert(pPoly != NULL);
1474 pPoly->setStrokeWidth(stroke_width);
1475 pPoly->setStroke(stroke_color);
1476 pPoly->setFillColor(fill_color);
1477 RenderPoint* pP = pPoly->createPoint();
1481 pP->setY(RelAbsVector(0.0, 0.0));
1482 pP->setY(RelAbsVector(0.0, 50.0));
1491 pP = pPoly->createPoint();
1495 pP->setX(RelAbsVector(0.0, 15.0));
1496 pP->setY(RelAbsVector(0.0, 0.0));
1506 pP = pPoly->createPoint();
1510 pP->setX(RelAbsVector(0.0, 85.0));
1511 pP->setY(RelAbsVector(0.0, 0.0));
1521 pP = pPoly->createPoint();
1525 pP->setX(RelAbsVector(0.0, 100.0));
1526 pP->setY(RelAbsVector(0.0, 50.0));
1536 pP = pPoly->createPoint();
1540 pP->setX(RelAbsVector(0.0, 85.0));
1541 pP->setY(RelAbsVector(0.0, 100.0));
1551 pP = pPoly->createPoint();
1555 pP->setX(RelAbsVector(0.0, 15.0));
1556 pP->setY(RelAbsVector(0.0, 100.0));
1575 Polygon* pPoly = pGroup->createPolygon();
1576 assert(pPoly != NULL);
1580 pPoly->setStrokeWidth(stroke_width);
1581 pPoly->setStroke(stroke_color);
1582 pPoly->setFillColor(fill_color);
1583 RenderPoint* pP = pPoly->createPoint();
1587 pP->setX(RelAbsVector(0.0, 20.0));
1588 pP->setY(RelAbsVector(0.0, 0.0));
1597 pP = pPoly->createPoint();
1601 pP->setX(RelAbsVector(0.0, 100.0));
1602 pP->setY(RelAbsVector(0.0, 0.0));
1612 pP = pPoly->createPoint();
1616 pP->setX(RelAbsVector(0.0, 80.0));
1617 pP->setY(RelAbsVector(0.0, 100.0));
1627 pP = pPoly->createPoint();
1631 pP->setX(RelAbsVector(0.0, 0.0));
1632 pP->setY(RelAbsVector(0.0, 100.0));
1651 Polygon* pPoly = pGroup->createPolygon();
1652 assert(pPoly != NULL);
1656 pPoly->setStrokeWidth(stroke_width);
1657 pPoly->setStroke(stroke_color);
1658 pPoly->setFillColor(fill_color);
1659 RenderPoint* pP = pPoly->createPoint();
1663 pP->setY(RelAbsVector(0.0, 0.0));
1664 pP->setY(RelAbsVector(0.0, 0.0));
1673 pP = pPoly->createPoint();
1677 pP->setX(RelAbsVector(0.0, 80.0));
1678 pP->setY(RelAbsVector(0.0, 0.0));
1688 pP = pPoly->createPoint();
1692 pP->setX(RelAbsVector(0.0, 100.0));
1693 pP->setY(RelAbsVector(0.0, 100.0));
1703 pP = pPoly->createPoint();
1707 pP->setX(RelAbsVector(0.0, 20.0));
1708 pP->setY(RelAbsVector(0.0, 100.0));
1726 double width = bounds.getDimensions()->getWidth();
1727 double height = bounds.getDimensions()->getHeight();
1729 double ratio = height / width;
1730 Polygon* pPoly = pGroup->createPolygon();
1731 assert(pPoly != NULL);
1735 pPoly->setStrokeWidth(stroke_width);
1736 pPoly->setStroke(stroke_color);
1737 pPoly->setFillColor(fill_color);
1738 RenderPoint* pP = pPoly->createPoint();
1742 pP->setX(RelAbsVector(0.0, 10.0 * ratio));
1743 pP->setY(RelAbsVector(0.0, 0.0));
1752 pP = pPoly->createPoint();
1756 pP->setX(RelAbsVector(0.0, 100.0 - 10.0 * ratio));
1757 pP->setY(RelAbsVector(0.0, 0.0));
1767 pP = pPoly->createPoint();
1771 pP->setX(RelAbsVector(0.0, 100.0));
1772 pP->setY(RelAbsVector(0.0, 10.0));
1782 pP = pPoly->createPoint();
1786 pP->setX(RelAbsVector(0.0, 100.0));
1787 pP->setY(RelAbsVector(0.0, 90.0));
1797 pP = pPoly->createPoint();
1801 pP->setX(RelAbsVector(0.0, 100.0 - 10.0 * ratio));
1802 pP->setY(RelAbsVector(0.0, 100.0));
1812 pP = pPoly->createPoint();
1816 pP->setX(RelAbsVector(0.0, 10.0 * ratio));
1817 pP->setY(RelAbsVector(0.0, 100.0));
1827 pP = pPoly->createPoint();
1831 pP->setX(RelAbsVector(0.0, 0.0));
1832 pP->setY(RelAbsVector(0.0, 90.0));
1842 pP = pPoly->createPoint();
1846 pP->setX(RelAbsVector(0.0, 0.0));
1847 pP->setY(RelAbsVector(0.0, 10.0));
1865 Polygon* pPoly = pGroup->createPolygon();
1866 assert(pPoly != NULL);
1870 pPoly->setStrokeWidth(stroke_width);
1871 pPoly->setStroke(stroke_color);
1872 pPoly->setFillColor(fill_color);
1873 RenderPoint* pP = pPoly->createPoint();
1877 pP->setY(RelAbsVector(0.0, 0.0));
1878 pP->setY(RelAbsVector(0.0, 0.0));
1887 pP = pPoly->createPoint();
1891 pP->setX(RelAbsVector(0.0, 50.0));
1892 pP->setY(RelAbsVector(0.0, 15.0));
1902 pP = pPoly->createPoint();
1906 pP->setX(RelAbsVector(0.0, 100.0));
1907 pP->setY(RelAbsVector(0.0, 0.0));
1917 pP = pPoly->createPoint();
1921 pP->setX(RelAbsVector(0.0, 100.0));
1922 pP->setY(RelAbsVector(0.0, 85.0));
1932 pP = pPoly->createPoint();
1936 pP->setX(RelAbsVector(0.0, 50.0));
1937 pP->setY(RelAbsVector(0.0, 100.0));
1947 pP = pPoly->createPoint();
1951 pP->setX(RelAbsVector(0.0, 0.0));
1952 pP->setY(RelAbsVector(0.0, 85.0));
1970 double width = bounds.getDimensions()->getWidth();
1971 double height = bounds.getDimensions()->getHeight();
1972 Rectangle* pRect = pGroup->createRectangle();
1973 assert(pRect != NULL);
1977 pRect->setX(RelAbsVector(offset.x() + bounds.getPosition()->x(), 0.0));
1978 pRect->setY(RelAbsVector(offset.y() + bounds.getPosition()->y(), 0.0));
1979 pRect->setRadiusX(RelAbsVector(6.0, 0.0));
1980 pRect->setRadiusY(RelAbsVector(6.0, 0.0));
1981 pRect->setWidth(RelAbsVector(width * 0.75, 0.0));
1982 pRect->setHeight(RelAbsVector(height, 0.0));
1983 pRect->setStrokeWidth(stroke_width);
1984 pRect->setStroke(stroke_color);
1985 pRect->setFillColor(fill_color);
1992 pRect = pGroup->createRectangle();
1993 assert(pRect != NULL);
1997 pRect->setX(RelAbsVector(offset.x() + bounds.getPosition()->x() + width * 0.75, 0.0));
1998 pRect->setY(RelAbsVector(offset.y() + bounds.getPosition()->y(), 0.0));
1999 pRect->setWidth(RelAbsVector(width * 0.25, 0.0));
2000 pRect->setHeight(RelAbsVector(height, 0.0));
2001 pRect->setRadiusX(RelAbsVector(6.0, 0.0));
2002 pRect->setRadiusY(RelAbsVector(6.0, 0.0));
2003 pRect->setStrokeWidth(stroke_width);
2004 pRect->setStroke(stroke_color);
2005 pRect->setFillColor(fill_color);
2016 Rectangle* pRect = pGroup->createRectangle();
2017 assert(pRect != NULL);
2021 pRect->setX(RelAbsVector(offset.x() + bounds.getPosition()->x(), 0.0));
2022 pRect->setY(RelAbsVector(offset.y() + bounds.getPosition()->y(), 0.0));
2023 pRect->setWidth(RelAbsVector(bounds.getDimensions()->getWidth(), 0.0));
2024 pRect->setHeight(RelAbsVector(bounds.getDimensions()->getHeight(), 0.0));
2025 pRect->setStrokeWidth(stroke_width);
2026 pRect->setStroke(stroke_color);
2027 pRect->setFillColor(fill_color);
2042 if (result ==
true && !text.empty())
2046 Text* pText = pGroup->createText();
2047 assert(pText != NULL);
2051 pText->setTextAnchor(Text::ANCHOR_MIDDLE);
2052 pText->setVTextAnchor(Text::ANCHOR_MIDDLE);
2054 pText->setX(RelAbsVector(bounds.getPosition()->x() + offset.x() + 0.5 * bounds.getDimensions()->getWidth(), 0.0));
2056 pText->setY(RelAbsVector(bounds.getPosition()->y() + offset.y() + 0.5 * bounds.getDimensions()->getHeight(), 0.0));
2057 pText->setText(text);
2060 pText->setFontFamily(
"serif");
2061 pText->setFontSize(RelAbsVector(10.0, 0.0));
2062 pText->setStroke(
"#000000");
2083 const BoundingBox& bounds,
2084 const std::string& stroke_color
2095 Ellipse* pEllipse = pGroup->createEllipse();
2096 assert(pEllipse != NULL);
2098 if (pEllipse != NULL)
2100 pEllipse->setCX(RelAbsVector(0.0, 0.0));
2101 pEllipse->setCY(RelAbsVector(0.0, 0.0));
2102 pEllipse->setRX(RelAbsVector(7.0, 0.0));
2103 pEllipse->setRY(RelAbsVector(7.0, 0.0));
2104 pEllipse->setStrokeWidth(1.0);
2105 pEllipse->setStroke(stroke_color);
2106 pEllipse->setFillColor(
"#FFFFFFFF");
2108 std::string mod_string(
"");
2168 Text* pText = pGroup->createText();
2169 pText->setTextAnchor(Text::ANCHOR_MIDDLE);
2170 pText->setVTextAnchor(Text::ANCHOR_MIDDLE);
2171 pText->setX(RelAbsVector(0.0, 0.0));
2172 pText->setY(RelAbsVector(0.0, 0.0));
2173 pText->setText(mod_string);
2174 pText->setFontFamily(
"serif");
2175 pText->setFontSize(RelAbsVector(8.0, 0.0));
2176 pText->setStroke(
"#000000FF");
2191 static std::ostringstream os;
2192 unsigned int index = 1;
2193 std::string
id = prefix;
2218 Model* pModel = this->
mpDocument->getModel();
2222 unsigned int i, iMax = pModel->getNumReactions();
2224 for (i = 0; i < iMax && result ==
true; ++i)
2250 if (pReaction != NULL && pModel != NULL && pReaction->getAnnotation() != NULL)
2254 if (pAnnotation != NULL && pAnnotation->getName() ==
"extension" && this->
mpLayout != NULL)
2262 ReactionGlyph* pRGlyph = this->
mpLayout->createReactionGlyph();
2264 if (pRGlyph != NULL)
2268 pRGlyph->setReactionId(pReaction->getId());
2269 this->
mIdMap.insert(std::pair<std::string, const SBase*>(
id, pRGlyph));
2284 switch (ranno.
mType)
2314 std::map<std::string, BoundingBox>::const_iterator box_pos1 = this->
mCDBounds.find(ranno.
mBaseReactants[0].mAlias);
2315 std::map<std::string, BoundingBox>::const_iterator box_pos2 = this->
mCDBounds.find(ranno.
mBaseProducts[0].mAlias);
2316 assert(box_pos1 != this->
mCDBounds.end());
2317 assert(box_pos2 != this->
mCDBounds.end());
2331 Point v1(
new LayoutPkgNamespaces(), p2.x() - p1.x(), p2.y() - p1.y());
2332 Point v2(
new LayoutPkgNamespaces());
2335 Point p3(
new LayoutPkgNamespaces(), p1.x() + v2.x(), p1.y() + v2.y());
2337 Point p(
new LayoutPkgNamespaces());
2338 std::vector<Point> points;
2342 points.push_back(p1);
2344 while (pointIt != pointsEnd)
2348 points.push_back(p);
2352 points.push_back(p2);
2354 std::vector<Point> reactantPoints;
2355 pointIt = points.begin(), pointsEnd = points.end();
2356 reactantPoints.push_back(*pointIt);
2358 std::vector<Point> productPoints;
2363 while (index < rectangleIndex)
2365 reactantPoints.push_back(*pointIt);
2370 assert(pointIt != pointsEnd);
2372 if (pointIt != pointsEnd)
2380 p3 = reactantPoints.back();
2383 Point v(
new LayoutPkgNamespaces(), (p2.x() - p3.x()) / distance, (p2.y() - p3.y()) / distance);
2390 if (distance >= 7.5)
2395 Curve* pCurve = pRGlyph->getCurve();
2396 assert(pCurve != NULL);
2397 LineSegment* pLS = pCurve->createLineSegment();
2398 Point center(
new LayoutPkgNamespaces(), (p3.x() + p2.x()) * 0.5, (p3.y() + p2.y()) * 0.5);
2399 pLS->setStart(center.x() - distance * v.x(), center.y() - distance * v.y());
2400 pLS->setEnd(center.x() + distance * v.x(), center.y() + distance * v.y());
2403 reactantPoints.push_back(*pLS->getStart());
2405 productPoints.push_back(*pLS->getEnd());
2407 if (pointIt == pointsEnd)
2409 productPoints.push_back(p2);
2412 while (pointIt != pointsEnd)
2414 productPoints.push_back(*pointIt);
2419 SpeciesReferenceGlyph* pSRefGlyph1 = pRGlyph->createSpeciesReferenceGlyph();
2420 SpeciesReferenceGlyph* pSRefGlyph2 = pRGlyph->createSpeciesReferenceGlyph();
2421 assert(pSRefGlyph1 != NULL);
2422 assert(pSRefGlyph2 != NULL);
2424 if (pSRefGlyph1 != NULL && pSRefGlyph2 != NULL)
2428 pSRefGlyph1->setId(
id);
2429 this->
mIdMap.insert(std::pair<std::string, const SBase*>(
id, pSRefGlyph1));
2431 pSRefGlyph2->setId(
id);
2432 this->
mIdMap.insert(std::pair<std::string, const SBase*>(
id, pSRefGlyph2));
2434 pSRefGlyph1->setRole(SPECIES_ROLE_SUBSTRATE);
2435 pSRefGlyph2->setRole(SPECIES_ROLE_PRODUCT);
2437 pCurve = pSRefGlyph1->getCurve();
2438 assert(pCurve != NULL);
2440 if (pCurve != NULL && result ==
true)
2442 assert(reactantPoints.size() > 1);
2450 pCurve = pSRefGlyph2->getCurve();
2451 assert(pCurve != NULL);
2453 if (pCurve != NULL && result ==
true)
2455 assert(productPoints.size() > 1);
2493 Point connectionPoint(
new LayoutPkgNamespaces());
2512 assert(!alias1.empty());
2514 assert(!alias2.empty());
2516 assert(!alias3.empty());
2517 std::map<std::string, BoundingBox>::const_iterator pos1, pos2, pos3;
2525 if (!alias1.empty() &&
2532 Point p1(
new LayoutPkgNamespaces(), pos1->second.getPosition()->x() + pos1->second.getDimensions()->getWidth() * 0.5, pos1->second.getPosition()->y() + pos1->second.getDimensions()->getHeight() * 0.5);
2533 Point p2(
new LayoutPkgNamespaces(), pos2->second.getPosition()->x() + pos2->second.getDimensions()->getWidth() * 0.5, pos2->second.getPosition()->y() + pos2->second.getDimensions()->getHeight() * 0.5);
2534 Point p3(
new LayoutPkgNamespaces(), pos3->second.getPosition()->x() + pos3->second.getDimensions()->getWidth() * 0.5, pos3->second.getPosition()->y() + pos3->second.getDimensions()->getHeight() * 0.5);
2535 Point v1(
new LayoutPkgNamespaces(), p2.x() - p1.x(), p2.y() - p1.y());
2536 Point v2(
new LayoutPkgNamespaces(), p3.x() - p1.x(), p3.y() - p1.y());
2537 Point p(
new LayoutPkgNamespaces(), p1.x() + connectionPoint.x()*v1.x() + connectionPoint.y()*v2.x(), p1.y() + connectionPoint.x()*v1.y() + connectionPoint.y()*v2.y());
2564 Curve* pCurve = pRGlyph->getCurve();
2565 assert(pCurve != NULL);
2569 LineSegment* pLS = pCurve->createLineSegment();
2570 assert(pLS != NULL);
2574 pLS->setEnd(p.x(), p.y());
2578 assert(dist != 0.0);
2579 Point v(
new LayoutPkgNamespaces(), (p1.x() - p.x()) / dist, (p1.y() - p.y()) / dist);
2587 pLS->setStart(p.x() + dist * v.x(), p.y() + dist * v.y());
2592 SpeciesReferenceGlyph* pSRefGlyph = pRGlyph->createSpeciesReferenceGlyph();
2593 assert(pSRefGlyph != NULL);
2595 if (pSRefGlyph != NULL)
2598 pCurve = pSRefGlyph->getCurve();
2602 LineSegment* pLS2 = pCurve->createLineSegment();
2603 assert(pLS2 != NULL);
2607 pLS2->setStart(pLS->getStart()->x(), pLS->getStart()->y());
2608 pLS2->setEnd(p1.x(), p1.y());
2622 pSRefGlyph->setId(
id);
2623 this->
mIdMap.insert(std::pair<std::string, const SBase*>(
id, pSRefGlyph));
2625 pSRefGlyph->setRole(SPECIES_ROLE_SUBSTRATE);
2640 pSRefGlyph = pRGlyph->createSpeciesReferenceGlyph();
2641 assert(pSRefGlyph != NULL);
2643 if (pSRefGlyph != NULL)
2646 pCurve = pSRefGlyph->getCurve();
2650 LineSegment* pLS2 = pCurve->createLineSegment();
2651 assert(pLS2 != NULL);
2655 pLS2->setStart(pLS->getEnd()->x(), pLS->getEnd()->y());
2656 pLS2->setEnd(p1.x(), p1.y());
2670 pSRefGlyph->setId(
id);
2671 this->
mIdMap.insert(std::pair<std::string, const SBase*>(
id, pSRefGlyph));
2673 pSRefGlyph->setRole(SPECIES_ROLE_PRODUCT);
2689 pSRefGlyph = pRGlyph->createSpeciesReferenceGlyph();
2690 assert(pSRefGlyph != NULL);
2692 if (pSRefGlyph != NULL)
2695 pCurve = pSRefGlyph->getCurve();
2699 LineSegment* pLS2 = pCurve->createLineSegment();
2700 assert(pLS2 != NULL);
2704 pLS2->setStart(pLS->getEnd()->x(), pLS->getEnd()->y());
2705 pLS2->setEnd(p1.x(), p1.y());
2719 pSRefGlyph->setId(
id);
2720 this->
mIdMap.insert(std::pair<std::string, const SBase*>(
id, pSRefGlyph));
2722 pSRefGlyph->setRole(SPECIES_ROLE_PRODUCT);
2764 Point connectionPoint(
new LayoutPkgNamespaces());
2785 assert(!alias1.empty());
2787 assert(!alias2.empty());
2789 assert(!alias3.empty());
2790 std::map<std::string, BoundingBox>::const_iterator pos1, pos2, pos3;
2798 if (!alias1.empty() &&
2805 Point p1(
new LayoutPkgNamespaces(), pos1->second.getPosition()->x() + pos1->second.getDimensions()->getWidth() * 0.5, pos1->second.getPosition()->y() + pos1->second.getDimensions()->getHeight() * 0.5);
2806 Point p2(
new LayoutPkgNamespaces(), pos2->second.getPosition()->x() + pos2->second.getDimensions()->getWidth() * 0.5, pos2->second.getPosition()->y() + pos2->second.getDimensions()->getHeight() * 0.5);
2807 Point p3(
new LayoutPkgNamespaces(), pos3->second.getPosition()->x() + pos3->second.getDimensions()->getWidth() * 0.5, pos3->second.getPosition()->y() + pos3->second.getDimensions()->getHeight() * 0.5);
2831 Curve* pCurve = pRGlyph->getCurve();
2832 assert(pCurve != NULL);
2836 LineSegment* pLS = pCurve->createLineSegment();
2837 assert(pLS != NULL);
2841 pLS->setStart(p.x(), p.y());
2845 assert(dist != 0.0);
2846 Point v(
new LayoutPkgNamespaces(), (p3.x() - p.x()) / dist, (p3.y() - p.y()) / dist);
2854 pLS->setEnd(p.x() + dist * v.x(), p.y() + dist * v.y());
2859 SpeciesReferenceGlyph* pSRefGlyph = pRGlyph->createSpeciesReferenceGlyph();
2860 assert(pSRefGlyph != NULL);
2862 if (pSRefGlyph != NULL)
2865 pCurve = pSRefGlyph->getCurve();
2869 LineSegment* pLS2 = pCurve->createLineSegment();
2870 assert(pLS2 != NULL);
2874 pLS2->setStart(p.x(), p.y());
2875 pLS2->setEnd(p3.x(), p3.y());
2889 pSRefGlyph->setId(
id);
2890 this->
mIdMap.insert(std::pair<std::string, const SBase*>(
id, pSRefGlyph));
2892 pSRefGlyph->setRole(SPECIES_ROLE_PRODUCT);
2907 pSRefGlyph = pRGlyph->createSpeciesReferenceGlyph();
2908 assert(pSRefGlyph != NULL);
2910 if (pSRefGlyph != NULL)
2913 pCurve = pSRefGlyph->getCurve();
2917 LineSegment* pLS2 = pCurve->createLineSegment();
2918 assert(pLS2 != NULL);
2922 pLS2->setStart(pLS->getStart()->x(), pLS->getStart()->y());
2923 pLS2->setEnd(p3.x(), p3.y());
2937 pSRefGlyph->setId(
id);
2938 this->
mIdMap.insert(std::pair<std::string, const SBase*>(
id, pSRefGlyph));
2940 pSRefGlyph->setRole(SPECIES_ROLE_SUBSTRATE);
2956 pSRefGlyph = pRGlyph->createSpeciesReferenceGlyph();
2957 assert(pSRefGlyph != NULL);
2959 if (pSRefGlyph != NULL)
2962 pCurve = pSRefGlyph->getCurve();
2966 LineSegment* pLS2 = pCurve->createLineSegment();
2967 assert(pLS2 != NULL);
2971 pLS2->setStart(pLS->getStart()->x(), pLS->getStart()->y());
2972 pLS2->setEnd(p3.x(), p3.y());
2986 pSRefGlyph->setId(
id);
2987 this->
mIdMap.insert(std::pair<std::string, const SBase*>(
id, pSRefGlyph));
2989 pSRefGlyph->setRole(SPECIES_ROLE_SUBSTRATE);
3071 if (pRGlyph != NULL)
3073 unsigned int i, iMax = links.size();
3076 for (i = 0; i < iMax && result ==
true; ++i)
3081 if (!pLink->
mAlias.empty())
3088 std::map<std::string, BoundingBox>::const_iterator pos = this->
mCDBounds.find(pLink->
mAlias);
3103 assert(!alias.empty());
3122 SpeciesReferenceGlyph* pSRG = pRGlyph->createSpeciesReferenceGlyph();
3128 this->
mIdMap.insert(std::pair<std::string, const SBase*>(
id, pSRG));
3129 assert(go_pos->second != NULL);
3130 pSRG->setSpeciesGlyphId(go_pos->second->getId());
3135 !pRGlyph->getReactionId().empty() &&
3139 Reaction* pReaction = this->
mpDocument->getModel()->getReaction(pRGlyph->getReactionId());
3141 if (pReaction != NULL)
3144 if (reactants ==
true)
3146 pSRG->setRole(
"SUBSTRATE");
3152 unsigned int i, iMax = pReaction->getNumReactants();
3154 for (i = 0; i < iMax; ++i)
3156 if (pReaction->getReactant(i)->getSpecies() == id)
3165 if (!pReaction->getReactant(i)->isSetId())
3168 pReaction->getReactant(i)->setId(
id);
3169 this->
mIdMap.insert(std::pair<std::string, const SBase*>(
id, pReaction->getReactant(i)));
3172 id = pReaction->getReactant(i)->getId();
3173 pSRG->setSpeciesReferenceId(
id);
3178 pSRG->setRole(
"PRODUCT");
3184 unsigned int i, iMax = pReaction->getNumProducts();
3186 for (i = 0; i < iMax; ++i)
3188 if (pReaction->getProduct(i)->getSpecies() == id)
3197 if (!pReaction->getProduct(i)->isSetId())
3200 pReaction->getProduct(i)->setId(
id);
3201 this->
mIdMap.insert(std::pair<std::string, const SBase*>(
id, pReaction->getProduct(i)));
3204 id = pReaction->getProduct(i)->getId();
3205 pSRG->setSpeciesReferenceId(
id);
3225 startsMap.insert(std::pair<SpeciesReferenceGlyph*, Point>(pSRG, p));
3232 startsMap.insert(std::pair<SpeciesReferenceGlyph*, Point>(pSRG, Point(
new LayoutPkgNamespaces(), 0.0, 0.0)));
3267 double x = std::numeric_limits<double>::quiet_NaN(), y = std::numeric_limits<double>::quiet_NaN();
3268 double bx = box.getPosition()->x();
3269 double by = box.getPosition()->y();
3270 double bw = box.getDimensions()->getWidth();
3271 double bh = box.getDimensions()->getHeight();
3367 return Point(
new LayoutPkgNamespaces(), x, y);
3380 Model* pModel = this->
mpDocument->getModel();
3381 unsigned int i, iMax = pModel->getNumCompartments();
3382 Compartment* pCompartment = NULL;
3383 const XMLNode* pAnnotation = NULL;
3385 for (i = 0; i < iMax && result ==
true; ++i)
3387 pCompartment = pModel->getCompartment(i);
3389 if (pCompartment->getAnnotation() != NULL)
3394 if (pAnnotation != NULL)
3403 std::multimap<std::string, GraphicalObject*>::const_iterator pos = this->
mModelIdToLayoutElement.find(pCompartment->getId());
3409 TextGlyph* pTGlyph = this->
mpLayout->createTextGlyph();
3412 this->
mIdMap.insert(std::pair<std::string, const SBase*>(
id, pTGlyph));
3414 pTGlyph->setText(canno.
mName);
3415 pTGlyph->setGraphicalObjectId(pos->second->getId());
3418 const CompartmentGlyph* pCGlyph =
dynamic_cast<const CompartmentGlyph*
>(pos->second);
3419 assert(pCGlyph != NULL);
3421 Point p(
new LayoutPkgNamespaces(), 0.0, 0.0);
3429 Point position = *pCGlyph->getBoundingBox()->getPosition();
3431 position.setX(position.x() + p.x());
3432 position.setY(position.y() + p.y());
3433 Dimensions dim = *pCGlyph->getBoundingBox()->getDimensions();
3435 dim.setWidth(dim.getWidth() - p.x());
3436 dim.setHeight(dim.getHeight() - p.y());
3438 bb.setPosition(&position);
3439 bb.setDimensions(&dim);
3440 pTGlyph->setBoundingBox(&bb);
3443 std::map<const CompartmentGlyph*, CompartmentAlias>::const_iterator compAliasPos = this->
mCompartmentAliasMap.find(pCGlyph);
3448 this->
createTextGlyphStyle(compAliasPos->second.mFontSize, Text::ANCHOR_START, Text::ANCHOR_BOTTOM, pTGlyph->getId());
3487 Model* pModel = this->
mpDocument->getModel();
3488 unsigned int i, iMax = pModel->getNumSpecies();
3489 Species* pSpecies = NULL;
3490 const XMLNode* pAnnotation = NULL;
3492 for (i = 0; i < iMax && result ==
true; ++i)
3494 pSpecies = pModel->getSpecies(i);
3496 if (pSpecies->getAnnotation() != NULL)
3501 if (pAnnotation != NULL)
3509 this->
mSpeciesAnnotationMap.insert(std::pair<std::string, SpeciesAnnotation>(pSpecies->getId(), sanno));
3510 std::string name = pSpecies->getName();
3516 std::multimap<std::string, GraphicalObject*>::const_iterator pos = this->
mModelIdToLayoutElement.find(pSpecies->getId());
3518 assert(pos->second != NULL);
3524 const SpeciesGlyph* pSGlyph =
dynamic_cast<const SpeciesGlyph*
>(pos->second);
3525 assert(pSGlyph != NULL);
3527 if (pSGlyph != NULL)
3529 TextGlyph* pTGlyph = this->
mpLayout->createTextGlyph();
3532 this->
mIdMap.insert(std::pair<std::string, const SBase*>(
id, pTGlyph));
3534 pTGlyph->setText(name);
3535 pTGlyph->setGraphicalObjectId(pSGlyph->getId());
3537 Point position = *pSGlyph->getBoundingBox()->getPosition();
3538 Dimensions dim = *pSGlyph->getBoundingBox()->getDimensions();
3540 bb.setPosition(&position);
3541 bb.setDimensions(&dim);
3542 pTGlyph->setBoundingBox(&bb);
3545 std::map<const SpeciesGlyph*, SpeciesAlias>::const_iterator speciesAliasPos = this->
mSpeciesAliasMap.find(pSGlyph);
3550 Text::TEXT_ANCHOR vAnchor = Text::ANCHOR_MIDDLE;
3552 if (speciesAliasPos->second.mComplex)
3554 vAnchor = Text::ANCHOR_BOTTOM;
3557 this->
createTextGlyphStyle(speciesAliasPos->second.mFontSize, Text::ANCHOR_MIDDLE, vAnchor, pTGlyph->getId());
3607 while (pCurrent != NULL)
3609 if (pCurrent->
getData() == parent)
3615 pCurrent = pCurrent->
getNext();
3618 if (pCurrent != NULL)
3641 while (tree != endit)
3644 if (tree != it && (*tree)->
getData() == child)
3649 while (pChild != NULL)
3653 (*tree)->removeChild(pChild);
3774 if (pNode != NULL && pNode->getName() ==
"listOfProteins")
3776 std::string prefix = pNode->getPrefix();
3777 unsigned int i, iMax = pNode->getNumChildren();
3778 const XMLNode* pChild = NULL;
3780 for (i = 0; i < iMax; ++i)
3782 pChild = &pNode->getChild(i);
3784 if (pChild != NULL &&
3785 pChild->getPrefix() == prefix &&
3786 pChild->getName() ==
"protein" &&
3787 pChild->getAttributes().hasAttribute(
"id") &&
3788 pChild->getAttributes().hasAttribute(
"name"))
3792 prot.
mId = pChild->getAttributes().getValue(
"id");
3793 assert(!prot.
mId.empty());
3794 prot.
mName = pChild->getAttributes().getValue(
"name");
3795 assert(!prot.
mName.empty());
3797 if (pChild->getAttributes().hasAttribute(
"type"))
3799 std::string type = pChild->getAttributes().getValue(
"type");
3800 assert(!type.empty());
3801 std::transform(type.begin(), type.end(), type.begin(), ::toupper);
3803 if (type !=
"GENERIC")
3821 if (pModifications != NULL)
3823 unsigned int j = 0, jMax = pModifications->getNumChildren();
3824 const XMLNode* pChild2 = NULL;
3826 while (j < jMax && result ==
true)
3828 pChild2 = &pModifications->getChild(j);
3829 assert(pChild2 != NULL);
3831 if (pChild2 != NULL &&
3832 pChild2->getPrefix() == pModifications->getPrefix() &&
3833 pChild2->getName() ==
"modificationResidue")
3872 if (pNode != NULL &&
3873 pNode->getName() ==
"modificationResidue")
3875 const XMLAttributes& attr = pNode->getAttributes();
3877 if (attr.hasAttribute(
"id"))
3880 mod.
mId = attr.getValue(
"id");
3883 if (attr.hasAttribute(
"name"))
3885 mod.
mName = attr.getValue(
"name");
3892 if (attr.hasAttribute(
"angle"))
3896 std::string s = attr.getValue(
"angle");
3898 v = strtod(s.c_str(), err);
3900 if (err == NULL || *err != s.c_str())
3936 if (pNode != NULL && pNode->getName() ==
"extension")
3942 if (pNameNode != NULL && pNameNode->getNumChildren() == 1 && pNameNode->getChild(0).isText())
3944 anno.
mName = pNameNode->getChild(0).getCharacters();
3967 if (pNode != NULL && pNode->getName() ==
"extension")
3978 if (pIdentityNode != NULL)
4004 if (pNode != NULL && pNode->getName() ==
"speciesIdentity")
4010 if (pChild != NULL &&
4011 pChild->getNumChildren() == 1 &&
4012 pChild->getChild(0).isText())
4014 std::string cl = pChild->getChild(0).getCharacters();
4015 assert(!cl.empty());
4027 if (pNameNode != NULL && pNameNode->getNumChildren() == 1 && pNameNode->getChild(0).isText())
4043 if (pNameNode != NULL && pNameNode->getNumChildren() == 1 && pNameNode->getChild(0).isText())
4091 if (pNode != NULL && pNode->getName() ==
"state")
4098 unsigned int i = 0, iMax = pChild->getNumChildren();
4099 const XMLNode* pChild2 = NULL;
4101 while (i < iMax && result ==
true)
4103 pChild2 = &pChild->getChild(i);
4104 assert(pChild2 != NULL);
4106 if (pChild2 != NULL)
4142 if (pNode != NULL &&
4143 pNode->getName() ==
"modification")
4145 const XMLAttributes& attr = pNode->getAttributes();
4147 if (attr.hasAttribute(
"residue") &&
4148 attr.hasAttribute(
"state"))
4150 mod.
mResidue = attr.getValue(
"residue");
4152 std::string s = attr.getValue(
"state");
4178 const XMLNode*
pResult = NULL;
4180 if (pNode != NULL && !name.empty())
4182 const XMLNode* pChild = NULL;
4183 unsigned int i, iMax = pNode->getNumChildren();
4185 for (i = 0; i < iMax && pResult == NULL; ++i)
4187 pChild = &pNode->getChild(i);
4189 if (pChild != NULL && pChild->getPrefix() == prefix &&
4190 pChild->getName() == name)
4196 if (recursive && pChild != NULL && pChild->getNumChildren() > 0)
4217 const XMLNode* pChild = NULL;
4225 if (pChild->getNumChildren() == 1 && pChild->getChild(0).isText())
4227 std::string s = pChild->getChild(0).getCharacters();
4272 if (pChild->getNumChildren() == 1 && pChild->getChild(0).isText())
4274 ranno.
mName = pChild->getChild(0).getCharacters();
4306 if (pChild->getAttributes().hasAttribute(
"x") && pChild->getAttributes().hasAttribute(
"y"))
4308 s = pChild->getAttributes().getValue(
"x");
4311 v = strtod(s.c_str(), err);
4313 if (err == NULL || *err != s.c_str())
4317 v = strtod(s.c_str(), err);
4319 if (err == NULL || *err != s.c_str())
4411 if (s ==
"STATE_TRANSITION")
4415 else if (s ==
"KNOWN_TRANSITION_OMITTED")
4419 else if (s ==
"UNKNOWN_TRANSITION")
4423 else if (s ==
"CATALYSIS")
4427 else if (s ==
"UNKNOWN_CATALYSIS")
4431 else if (s ==
"INHIBITION")
4435 else if (s ==
"UNKNOWN_INHIBITION")
4439 else if (s ==
"TRANSPORT")
4443 else if (s ==
"HETERODIMER_ASSOCIATION")
4447 else if (s ==
"DISSOCIATION")
4451 else if (s ==
"TRUNCATION")
4455 else if (s ==
"TRANSCRIPTIONAL_ACTIVATION")
4459 else if (s ==
"TRANSCRIPTIONAL_INHIBITION")
4463 else if (s ==
"TRANSLATIONAL_ACTIVATION")
4467 else if (s ==
"TRANSLATIONAL_INHIBITION")
4471 else if (s ==
"TRANSCRIPTION")
4475 else if (s ==
"TRANSLATION")
4492 if (s ==
"CATALYSIS")
4496 else if (s ==
"UNKNOWN_CATALYSIS")
4500 else if (s ==
"INHIBITION")
4504 else if (s ==
"UNKNOWN_INHIBITION")
4508 else if (s ==
"TRANSPORT")
4512 else if (s ==
"HETERODIMER_ASSOCIATION")
4516 else if (s ==
"TRANSCRIPTIONAL_ACTIVATION")
4520 else if (s ==
"TRANSCRIPTIONAL_INHIBITION")
4524 else if (s ==
"TRANSLATIONAL_ACTIVATION")
4528 else if (s ==
"TRANSLATIONAL_INHIBITION")
4532 else if (s ==
"PHYSICAL_STIMULATION")
4536 else if (s ==
"MODULATION")
4540 else if (s ==
"TRIGGER")
4544 else if (s ==
"BOOLEAN_LOGIC_GATE_AND")
4548 else if (s ==
"BOOLEAN_LOGIC_GATE_OR")
4552 else if (s ==
"BOOLEAN_LOGIC_GATE_NOT")
4556 else if (s ==
"BOOLEAN_LOGIC_GATE_UNKNOWN")
4573 if (s ==
"CATALYSIS")
4577 else if (s ==
"UNKNOWN_CATALYSIS")
4581 else if (s ==
"INHIBITION")
4585 else if (s ==
"UNKNOWN_INHIBITION")
4589 else if (s ==
"TRANSPORT")
4593 else if (s ==
"HETERODIMER_ASSOCIATION")
4597 else if (s ==
"TRANSCRIPTIONAL_ACTIVATION")
4601 else if (s ==
"TRANSCRIPTIONAL_INHIBITION")
4605 else if (s ==
"TRANSLATIONAL_ACTIVATION")
4609 else if (s ==
"TRANSLATIONAL_INHIBITION")
4613 else if (s ==
"PHYSICAL_STIMULATION")
4617 else if (s ==
"MODULATION")
4634 if (s ==
"OUTER_SURFACE")
4638 else if (s ==
"TRANSMEMBRANE")
4642 else if (s ==
"INNER_SURFACE")
4646 else if (s ==
"INSIDE")
4650 else if (s ==
"INSIDE_MEMBRANE")
4671 else if (s ==
"SQUARE")
4692 else if (s ==
"HORIZONTAL")
4696 else if (s ==
"VERTICAL")
4716 else if (pos ==
"NNE")
4720 else if (pos ==
"NE")
4724 else if (pos ==
"ENE")
4728 else if (pos ==
"E")
4732 else if (pos ==
"ESE")
4736 else if (pos ==
"SE")
4740 else if (pos ==
"SSE")
4744 else if (pos ==
"S")
4748 else if (pos ==
"SSW")
4752 else if (pos ==
"SW")
4756 else if (pos ==
"WSW")
4760 else if (pos ==
"W")
4764 else if (pos ==
"WNW")
4768 else if (pos ==
"NW")
4772 else if (pos ==
"NNW")
4793 else if (s ==
"GRADIENT")
4814 else if (cl ==
"SIMPLE_MOLECULE")
4818 else if (cl ==
"PROTEIN")
4822 else if (cl ==
"GENE")
4826 else if (cl ==
"RNA")
4830 else if (cl ==
"ANTISENSE_RNA")
4834 else if (cl ==
"PHENOTYPE")
4838 else if (cl ==
"DRUG")
4842 else if (cl ==
"UNKNOWN")
4846 else if (cl ==
"COMPLEX")
4850 else if (cl ==
"SQUARE")
4854 else if (cl ==
"OVAL")
4858 else if (cl ==
"SQUARE_CLOSEUP_NORTHWEST")
4862 else if (cl ==
"SQUARE_CLOSEUP_NORTHEAST")
4866 else if (cl ==
"SQUARE_CLOSEUP_SOUTHWEST")
4870 else if (cl ==
"SQUARE_CLOSEUP_SOUTHEAST")
4874 else if (cl ==
"SQUARE_CLOSEUP_NORTH")
4878 else if (cl ==
"SQUARE_CLOSEUP_EAST")
4882 else if (cl ==
"SQUARE_CLOSEUP_WEST")
4886 else if (cl ==
"SQUARE_CLOSEUP_SOUTH")
4890 else if (cl ==
"DEGRADED")
4894 else if (cl ==
"RECEPTOR")
4898 else if (cl ==
"TRUNCATED")
4902 else if (cl ==
"ION_CHANNEL")
4919 if (pNode != NULL &&
4920 (pNode->getName() ==
"baseReactants" ||
4921 pNode->getName() ==
"baseProducts")
4927 unsigned int i, iMax = pNode->getNumChildren();
4928 const XMLNode* pChild = NULL;
4931 for (i = 0; i < iMax && result ==
true; ++i)
4933 pChild = &pNode->getChild(i);
4935 if (pChild != NULL &&
4936 pChild->getPrefix() == pNode->getPrefix() &&
4937 (pChild->getName() ==
"baseReactant" ||
4938 pChild->getName() ==
"baseProduct")
4943 elements.push_back(l);
4964 if (pNode != NULL && pNode->getName() ==
"connectScheme")
4968 const XMLAttributes& attr = pNode->getAttributes();
4970 if (attr.hasAttribute(
"connectPolicy"))
4972 std::string s = attr.getValue(
"connectPolicy");
4978 if (attr.hasAttribute(
"rectangleIndex"))
4980 s = attr.getValue(
"rectangleIndex");
4982 long val = strtol(s.c_str(), err, 10);
4984 if (!err || *err != s.c_str())
4997 if (pDirections != NULL)
5000 unsigned int i, iMax = pDirections->getNumChildren();
5001 const XMLNode* pChild = NULL;
5003 for (i = 0; i < iMax && result ==
true; ++i)
5005 pChild = &pDirections->getChild(i);
5007 if (pChild != NULL &&
5008 pChild->getPrefix() == pDirections->getPrefix() &&
5009 pChild->getName() ==
"lineDirection")
5049 if (pNode != NULL && pNode->getName() ==
"line")
5053 const XMLAttributes& attr = pNode->getAttributes();
5055 if (attr.hasAttribute(
"color") && attr.hasAttribute(
"width"))
5057 std::string s = attr.getValue(
"color");
5059 s = attr.getValue(
"width");
5061 double dbl = strtod(s.c_str(), err);
5063 if (!err || *err != s.c_str())
5074 if (attr.hasAttribute(
"type"))
5076 s = attr.getValue(
"type");
5107 if (pNode != NULL &&
5108 (pNode->getName() ==
"listOfReactantLinks" ||
5109 pNode->getName() ==
"listOfProductLinks")
5114 unsigned int i, iMax = pNode->getNumChildren();
5115 const XMLNode* pChild = NULL;
5118 for (i = 0; i < iMax && result ==
true; ++i)
5120 pChild = &pNode->getChild(i);
5122 if (pChild != NULL &&
5123 pChild->getPrefix() == pNode->getPrefix() &&
5124 (pChild->getName() ==
"reactantLink" ||
5125 pChild->getName() ==
"productLink")
5130 rlinks.push_back(l);
5151 if (pNode != NULL && pNode->getName() ==
"editPoints")
5156 if (pNode->getNumChildren() == 1 && pNode->getChild(0).isText())
5158 std::string s = pNode->getChild(0).getCharacters();
5162 const XMLAttributes& attr = pNode->getAttributes();
5165 if (result && attr.hasAttribute(
"num0"))
5167 s = attr.getValue(
"num0");
5169 val = strtol(s.c_str(), err, 10);
5171 if (!err || *err != s.c_str())
5173 editpoints.
mNum0 = val;
5181 if (result && attr.hasAttribute(
"num1"))
5183 s = attr.getValue(
"num1");
5185 val = strtol(s.c_str(), err, 10);
5187 if (!err || *err != s.c_str())
5189 editpoints.
mNum1 = val;
5197 if (result && attr.hasAttribute(
"num2"))
5199 s = attr.getValue(
"num2");
5201 val = strtol(s.c_str(), err, 10);
5203 if (!err || *err != s.c_str())
5205 editpoints.
mNum2 = val;
5213 if (result && attr.hasAttribute(
"tShapeIndex"))
5215 s = attr.getValue(
"tShapeIndex");
5217 val = strtol(s.c_str(), err, 10);
5219 if (!err || *err != s.c_str())
5229 if (result && attr.hasAttribute(
"omittedShapeIndex"))
5231 s = attr.getValue(
"omittedShapeIndex");
5233 val = strtol(s.c_str(), err, 10);
5235 if (!err || *err != s.c_str())
5267 if (pNode != NULL && pNode->getName() ==
"listOfModification")
5269 unsigned int i, iMax = pNode->getNumChildren();
5270 const XMLNode* pChild = NULL;
5272 for (i = 0; i < iMax && result ==
true; ++i)
5274 pChild = &pNode->getChild(i);
5276 if (pChild != NULL &&
5277 pChild->getPrefix() == pNode->getPrefix() &&
5278 pChild->getName() ==
"modification")
5282 rmods.push_back(rmod);
5303 if (pNode != NULL &&
5304 (pNode->getName() ==
"baseReactant" ||
5305 pNode->getName() ==
"baseProduct" ||
5306 pNode->getName() ==
"linkTarget")
5311 const XMLAttributes& attr = pNode->getAttributes();
5313 if (attr.hasAttribute(
"alias") && attr.hasAttribute(
"species"))
5315 std::string s = attr.getValue(
"alias");
5317 s = attr.getValue(
"species");
5321 if (pAnchor != NULL)
5323 if (pAnchor->getAttributes().hasAttribute(
"position"))
5325 s = pAnchor->getAttributes().getValue(
"position");
5361 if (pNode != NULL &&
5362 pNode->getName() ==
"lineDirection")
5366 const XMLAttributes& attr = pNode->getAttributes();
5368 if (attr.hasAttribute(
"index") && attr.hasAttribute(
"value"))
5370 std::string s = attr.getValue(
"index");
5372 long val = strtol(s.c_str(), err, 10);
5374 if (!err || *err != s.c_str())
5378 s = attr.getValue(
"value");
5383 if (attr.hasAttribute(
"arm"))
5385 s = attr.getValue(
"arm");
5387 val = strtol(s.c_str(), err, 10);
5389 if (!err || *err != s.c_str())
5427 if (pNode != NULL &&
5428 (pNode->getName() ==
"productLink" ||
5429 pNode->getName() ==
"reactantLink")
5433 const XMLAttributes& attr = pNode->getAttributes();
5435 if (attr.hasAttribute(
"alias") &&
5436 (attr.hasAttribute(
"reactant") ||
5437 attr.hasAttribute(
"product")) &&
5438 attr.hasAttribute(
"targetLineIndex"))
5440 std::string s = attr.getValue(
"alias");
5443 if (attr.hasAttribute(
"reactant"))
5445 s = attr.getValue(
"reactant");
5449 s = attr.getValue(
"product");
5453 s = attr.getValue(
"targetLineIndex");
5454 std::vector<std::string> parts;
5458 if (result && parts.size() == 2)
5463 long val = strtol(parts[1].c_str(), err, 10);
5465 if (!err || *err != s.c_str())
5471 if (pLineNode != NULL)
5480 if (pLineNode != NULL && pLineNode->getAttributes().hasAttribute(
"position"))
5528 if (pNode != NULL &&
5529 pNode->getName() ==
"modification")
5537 const XMLAttributes& attr = pNode->getAttributes();
5539 if (attr.hasAttribute(
"aliases") &&
5540 attr.hasAttribute(
"modifiers") &&
5541 attr.hasAttribute(
"type") &&
5542 attr.hasAttribute(
"targetLineIndex"))
5544 std::string s = attr.getValue(
"aliases");
5549 s = attr.getValue(
"modifiers");
5554 s = attr.getValue(
"type");
5559 s = attr.getValue(
"targetLineIndex");
5564 std::vector<std::string> tmp;
5567 if (result ==
true && tmp.size() == 2)
5570 long val = strtol(tmp[1].c_str(), err, 10);
5572 if (!err || *err != tmp[1].c_str())
5601 if (attr.hasAttribute(
"editPoints"))
5603 s = attr.getValue(
"editPoints");
5607 if (result ==
true && attr.hasAttribute(
"num0"))
5609 s = attr.getValue(
"num0");
5611 val = strtol(s.c_str(), err, 10);
5613 if (!err || *err != s.c_str())
5623 if (result ==
true && attr.hasAttribute(
"num1"))
5625 s = attr.getValue(
"num1");
5627 val = strtol(s.c_str(), err, 10);
5629 if (!err || *err != s.c_str())
5639 if (result ==
true && attr.hasAttribute(
"num2"))
5641 s = attr.getValue(
"num2");
5643 val = strtol(s.c_str(), err, 10);
5645 if (!err || *err != s.c_str())
5655 if (result ==
true && attr.hasAttribute(
"modificationType"))
5657 s = attr.getValue(
"modificationType");
5666 if (result ==
true && attr.hasAttribute(
"offsetX"))
5668 s = attr.getValue(
"offsetX");
5670 dval = strtod(s.c_str(), err);
5672 if (!err || *err != s.c_str())
5682 if (result ==
true && attr.hasAttribute(
"offsetY"))
5684 s = attr.getValue(
"offsetY");
5686 dval = strtod(s.c_str(), err);
5688 if (!err || *err != s.c_str())
5722 unsigned int i, iMax = pNode->getNumChildren();
5725 for (i = 0; i < iMax && result ==
true; ++i)
5727 pNode2 = &pNode->getChild(i);
5729 if (pNode2 != NULL &&
5730 pNode2->getPrefix() == pNode->getPrefix() &&
5731 pNode2->getName() ==
"linkTarget")
5764 std::string splitChars =
" \n\t\r";
5765 std::vector<std::string> parts;
5771 std::vector<std::string>::const_iterator it = parts.begin(), endit = parts.end();
5772 std::vector<std::string> tmp;
5773 std::string splitter(
",");
5776 Point p(
new LayoutPkgNamespaces());
5778 while (it != endit && result ==
true)
5786 if (tmp.size() == 2)
5789 dbl = strtod(tmp[0].c_str(), err);
5791 if (!err || *err != tmp[0].c_str())
5795 dbl = strtod(tmp[1].c_str(), err);
5797 if (!err || *err != tmp[0].c_str())
5800 points.push_back(p);
5836 if (splitChars.empty())
5843 size_t next = s.find_first_of(splitChars, pos);
5845 while (next != std::string::npos)
5848 parts.push_back(s.substr(pos, next - pos));
5852 while (splitChars.find(s[pos]) != std::string::npos)
5859 next = s.find_first_of(splitChars, pos);
5863 next = std::string::npos;
5867 next = s.find_last_of(splitChars);
5869 if (next < pos || next == std::string::npos)
5871 parts.push_back(s.substr(pos, s.size() - pos));
5890 if (pNode != NULL && pNode->getName() ==
"compartmentAlias")
5893 const XMLAttributes& attr = pNode->getAttributes();
5895 if (attr.hasAttribute(
"id") && attr.hasAttribute(
"compartment"))
5897 ca.
mId = attr.getValue(
"id");
5910 if (pChild != NULL && pChild->getNumChildren() == 1 && pChild->getChild(0).isText())
5929 if (pChild->getAttributes().hasAttribute(
"x") && pChild->getAttributes().hasAttribute(
"y"))
5931 Point tmp(
new LayoutPkgNamespaces());
5946 ca.
mBounds.setWidth(ld.getWidth() - tmp.x());
5947 ca.
mBounds.setHeight(ld.getHeight() - tmp.y());
5957 ca.
mBounds.setHeight(ld.getHeight() - tmp.y());
5966 ca.
mBounds.setWidth(ld.getWidth() - tmp.x());
5967 ca.
mBounds.setHeight(tmp.y());
5977 ca.
mBounds.setHeight(tmp.y());
5985 ca.
mBounds.setWidth(ld.getWidth());
5986 ca.
mBounds.setHeight(ld.getHeight() - tmp.y());
5995 ca.
mBounds.setHeight(ld.getHeight());
6003 ca.
mBounds.setWidth(ld.getWidth() - tmp.x());
6004 ca.
mBounds.setHeight(ld.getHeight());
6012 ca.
mBounds.setWidth(ld.getWidth());
6013 ca.
mBounds.setHeight(tmp.y());
6062 if (pChild != NULL && pChild->getAttributes().hasAttribute(
"size"))
6064 std::string s = pChild->getAttributes().getValue(
"size");
6066 double dbl = strtod(s.c_str(), err);
6068 if (!err || *err != s.c_str())
6119 if (pNode != NULL &&
6120 (pNode->getName() ==
"speciesAlias" ||
6121 pNode->getName() ==
"complexSpeciesAlias")
6124 if (pNode->getName() ==
"complexSpeciesAlias")
6130 const XMLAttributes& attr = pNode->getAttributes();
6132 if (attr.hasAttribute(
"id") && attr.hasAttribute(
"species"))
6134 sa.
mId = attr.getValue(
"id");
6135 sa.
mSpecies = attr.getValue(
"species");
6138 if (attr.hasAttribute(
"complexSpeciesAlias"))
6142 else if (attr.hasAttribute(
"compartmentAlias"))
6152 std::string s = pChild->getAttributes().getValue(
"size");
6154 double dbl = strtod(s.c_str(), err);
6156 if (!err || *err != s.c_str())
6208 if (pNode != NULL &&
6209 pNode->getAttributes().hasAttribute(
"x") &&
6210 pNode->getAttributes().hasAttribute(
"y"))
6212 std::string s = pNode->getAttributes().getValue(
"x");
6214 double val = strtod(s.c_str(), err);
6216 if (!err || *err != s.c_str())
6219 s = pNode->getAttributes().getValue(
"y");
6221 val = strtod(s.c_str(), err);
6223 if (!err || *err != s.c_str())
6255 if (pNode != NULL &&
6256 pNode->getAttributes().hasAttribute(
"x") &&
6257 pNode->getAttributes().hasAttribute(
"y") &&
6258 pNode->getAttributes().hasAttribute(
"w") &&
6259 pNode->getAttributes().hasAttribute(
"h"))
6265 std::string s = pNode->getAttributes().getValue(
"w");
6267 double val = strtod(s.c_str(), err);
6269 if (!err || *err != s.c_str())
6271 box.getDimensions()->setWidth(val);
6272 s = pNode->getAttributes().getValue(
"h");
6274 val = strtod(s.c_str(), err);
6276 if (!err || *err != s.c_str())
6278 box.getDimensions()->setHeight(val);
6308 if (pNode != NULL && pNode->getName() ==
"usualView")
6333 if (pChild != NULL && pChild->getAttributes().hasAttribute(
"width"))
6335 std::string s = pChild->getAttributes().getValue(
"width");
6337 double dbl = strtod(s.c_str(), err);
6339 if (!err || *err != s.c_str())
6381 if (pNode != NULL &&
6382 pNode->getName() ==
"modelDisplay" &&
6383 pNode->getAttributes().hasAttribute(
"sizeX") &&
6384 pNode->getAttributes().hasAttribute(
"sizeY"))
6386 std::string s = pNode->getAttributes().getValue(
"sizeX");
6388 double val = strtod(s.c_str(), err);
6390 if (!err || *err != s.c_str())
6393 s = pNode->getAttributes().getValue(
"sizeY");
6395 val = strtod(s.c_str(), err);
6397 if (!err || *err != s.c_str())
6428 if (pNode != NULL &&
6429 pNode->getAttributes().hasAttribute(
"width") &&
6430 pNode->getAttributes().hasAttribute(
"height"))
6432 std::string s = pNode->getAttributes().getValue(
"width");
6434 double val = strtod(s.c_str(), err);
6436 if (!err || *err != s.c_str())
6439 s = pNode->getAttributes().getValue(
"height");
6441 val = strtod(s.c_str(), err);
6443 if (!err || *err != s.c_str())
6474 if (pNode != NULL &&
6475 pNode->getName() ==
"doubleLine")
6477 const XMLAttributes& attr = pNode->getAttributes();
6479 if (attr.hasAttribute(
"innerWidth") &&
6480 attr.hasAttribute(
"outerWidth") &&
6481 attr.hasAttribute(
"thickness"))
6483 std::string s = attr.getValue(
"innerWidth");
6485 double val = strtod(s.c_str(), err);
6487 if (!err || *err != s.c_str())
6490 s = attr.getValue(
"outerWidth");
6492 val = strtod(s.c_str(), err);
6494 if (!err || *err != s.c_str())
6497 s = attr.getValue(
"thickness");
6499 val = strtod(s.c_str(), err);
6501 if (!err || *err != s.c_str())
6542 if (pNode != NULL && pNode->getName() ==
"paint")
6544 const XMLAttributes& attr = pNode->getAttributes();
6546 if (attr.hasAttribute(
"color") &&
6547 attr.hasAttribute(
"scheme"))
6549 p.
mColor = attr.getValue(
"color");
6588 !pCGlyph->getId().empty())
6590 std::string color_id;
6596 std::string inner_color_id, inner_color_string = ca.
mPaint.
mColor;
6598 if (inner_color_string.length() == 7)
6600 inner_color_string +=
"23";
6603 else if (inner_color_string.length() == 9)
6605 inner_color_string[7] =
'2';
6606 inner_color_string[8] =
'3';
6622 this->
mIdMap.insert(std::pair<std::string, const SBase*>(style_id, pStyle));
6623 RenderGroup* pGroup = pStyle->getGroup();
6624 assert(pGroup != NULL);
6629 pGroup->setFontSize(ca.
m