void Foam::gnuplotGraph::write(const graph& g, Ostream& os) const { os << "#set term postscript color" << endl << "set output \"" << word(g.title()) << ".ps\"" << endl << "set title " << g.title() << " 0,0" << endl << "show title" << endl << "set xlabel " << g.xName() << " 0,0" << endl << "show xlabel" << endl << "set ylabel " << g.yName() << " 0,0" << endl << "show ylabel" << endl << "plot"; bool firstField = true; for (graph::const_iterator iter = g.begin(); iter != g.end(); ++iter) { if (!firstField) { os << ','; } firstField = false; os << "'-' title " << iter()->name() << " with lines"; } os << "; pause -1" << endl; for (graph::const_iterator iter = g.begin(); iter != g.end(); ++iter) { os << endl; writeXY(g.x(), *iter(), os); } }
void Foam::xmgrGraph::write(const graph& g, Ostream& os) const { os << "@title " << g.title() << nl << "@xaxis label " << g.xName() << nl << "@yaxis label " << g.yName() << endl; label fieldI = 0; forAllConstIter(graph, g, iter) { os << "@s" << fieldI << " legend " << iter()->name() << nl << "@target G0.S" << fieldI << nl << "@type xy" << endl; writeXY(g.x(), *iter(), os); os << endl; fieldI++; }
void Foam::xmgrGraph::write(const graph& g, Ostream& os) const { os << "@title " << g.title() << endl << "@xaxis label " << g.xName() << endl << "@yaxis label " << g.yName() << endl; label fieldI = 0; for (graph::const_iterator iter = g.begin(); iter != g.end(); ++iter) { os << "@s" << fieldI << " legend " << iter()->name() << endl << "@target G0.S" << fieldI << endl << "@type xy" << endl; writeXY(g.x(), *iter(), os); os << endl; fieldI++; } }
void LowLevelGraphicsPostScriptRenderer::writePath (const Path& path) const { out << "newpath "; float lastX = 0.0f; float lastY = 0.0f; int itemsOnLine = 0; Path::Iterator i (path); while (i.next()) { if (++itemsOnLine == 4) { itemsOnLine = 0; out << '\n'; } switch (i.elementType) { case Path::Iterator::startNewSubPath: writeXY (i.x1, i.y1); lastX = i.x1; lastY = i.y1; out << "m "; break; case Path::Iterator::lineTo: writeXY (i.x1, i.y1); lastX = i.x1; lastY = i.y1; out << "l "; break; case Path::Iterator::quadraticTo: { const float cp1x = lastX + (i.x1 - lastX) * 2.0f / 3.0f; const float cp1y = lastY + (i.y1 - lastY) * 2.0f / 3.0f; const float cp2x = cp1x + (i.x2 - lastX) / 3.0f; const float cp2y = cp1y + (i.y2 - lastY) / 3.0f; writeXY (cp1x, cp1y); writeXY (cp2x, cp2y); writeXY (i.x2, i.y2); out << "ct "; lastX = i.x2; lastY = i.y2; } break; case Path::Iterator::cubicTo: writeXY (i.x1, i.y1); writeXY (i.x2, i.y2); writeXY (i.x3, i.y3); out << "ct "; lastX = i.x3; lastY = i.y3; break; case Path::Iterator::closePath: out << "cp "; break; default: jassertfalse; break; } } out << '\n'; }