15 #include <sbml/Model.h>
31 #define SPC(level) std::string(level, ' ')
60 std::ostringstream oss;
63 if (unitInformation2 != NULL)
82 if (!unitInformation && !unitInformation2)
96 std::ostringstream oss;
99 if (!unitInformation && unitInformation2)
104 if (unitInformation && !unitInformation2)
109 if (unitInformation && unitInformation2)
121 tmp +=
"<mi mathcolor = \"red\">conflict!</mi>";
129 tmp +=
"<mi mathcolor = \"orange\">unknown</mi>";
152 tmp +=
"</mfenced><mo>^</mo><mi mathcolor = \"#c06000\">" + ui.
getSymbolicExponent() +
"</mi><mo>^</mo><mn>" + ttt.str() +
"</mn>";
160 const std::string & color,
size_t l)
const
162 out <<
SPC(l) <<
"<mstyle background=\"" << color <<
"\"><mfrac linethickness=\"0\">" << std::endl;
164 out <<
SPC(l + 1) <<
"<mstyle scriptlevel=\"+1\">" << std::endl;
165 out <<
SPC(l + 2) << b << std::endl;
166 out <<
SPC(l + 1) <<
"</mstyle>" << std::endl;
167 out <<
SPC(l) <<
"</mfrac></mstyle>" << std::endl;
174 const std::string & color,
size_t l)
const
176 out <<
SPC(l) <<
"<mstyle background=\"" << color <<
"\"><mtable rowspacing=\"0.1 ex\">" << std::endl;
177 out <<
SPC(l + 1) <<
"<mtr><mtd>" << std::endl;
179 out <<
SPC(l + 1) <<
"</mtd></mtr>" << std::endl;
180 out <<
SPC(l + 1) <<
"<mtr><mtd><mstyle scriptlevel=\"+1\">" << std::endl;
181 out <<
SPC(l + 2) << b << std::endl;
182 out <<
SPC(l + 1) <<
"</mstyle></mtd></mtr>" << std::endl;
183 out <<
SPC(l + 1) <<
"<mtr><mtd><mstyle scriptlevel=\"+1\">" << std::endl;
184 out <<
SPC(l + 2) << c << std::endl;
185 out <<
SPC(l + 1) <<
"</mstyle></mtd></mtr>" << std::endl;
186 out <<
SPC(l) <<
"</mtable></mstyle>" << std::endl;
207 size_t i, imax = ud.getNumUnits();
209 for (i = 0; i < imax; ++i)
211 if (ud.getUnit((
unsigned int) i)->getExponent() >= 0)
213 if (!isFirst) tmp +=
"<mo>·</mo>";
215 tmp +=
getMathML(ud.getUnit((
unsigned int) i),
true);
220 if (isFirst) tmp +=
"<mn>1</mn>";
225 for (i = 0; i < imax; ++i)
227 if (ud.getUnit((
unsigned int) i)->getExponent() < 0)
229 if (!isFirst) tmp2 +=
"<mo>·</mo>";
231 tmp2 +=
getMathML(ud.getUnit((
unsigned int) i),
true);
236 if (!isFirst) tmp +=
"<mo>/</mo>" + tmp2;
246 return "<mi>EEE</mi>";
248 int exponent = absExp ?
abs(u->getExponent()) : u->getExponent();
249 bool flagExp = (exponent != 1);
250 bool flag = (u->getMultiplier() != 1.0) || (u->getScale() != 0);
252 std::ostringstream tmp;
254 if (flagExp) tmp <<
"<msup>";
259 if (flag) tmp <<
"<mo>(</mo>";
261 if (u->getMultiplier() != 1.0)
262 tmp <<
"<mn>" << u->getMultiplier() <<
"</mn><mo>·</mo>";
264 if (u->getScale() != 0)
265 tmp <<
"<msup><mn>10</mn><mn>" << u->getScale() <<
"</mn></msup><mo>·</mo>";
268 tmp << UnitKind_toString(u->getKind());
271 if (flag) tmp <<
"<mo>)</mo>";
276 if (flagExp) tmp <<
"<mn>" << exponent <<
"</mn>";
278 if (flagExp) tmp <<
"</msup>";
virtual void writeMathMLNumber(std::ostream &out, const ASTNode *node, size_t l) const
void setUnitInterface(CSBMLunitInterface *unitInterface, CSBMLunitInterface *unitInterface2)
const Reaction * mpReaction
Expression2PresentationMMLUnits(const ASTNode *rootnode)
CSBMLunitInformation * getMappedUnitFromIdentifier(const std::string &node, const CEnvironmentInformation &ei)
virtual void writeMathMLNumber(std::ostream &out, const ASTNode *node, size_t l) const
CSBMLunitInterface * mpUnitInterface
void writeMathMLBox(std::ostream &out, const std::string &a, const std::string &b, const std::string &color, size_t l) const
int getSymbolicExpExp() const
CSBMLunitInformation * getMappedUnitFromNumberNode(const ASTNode *node)
std::string getMathML(const CSBMLunitInformation &ui) const
UnitDefinition & getSBMLUnitDefinition()
CSBMLunitInterface * mpUnitInterface2
virtual void writeMathMLName(std::ostream &out, const ASTNode *node, size_t l) const
const std::string & getSymbolicExponent() const
virtual void writeMathMLName(std::ostream &out, const ASTNode *node, size_t l) const
const std::set< const ASTNode * > & getListOfConflictingNodes() const