コード例 #1
0
ファイル: GraphIO_ogml.cpp プロジェクト: marvin2k/ogdf
// write cluster layout with attributes
static void write_ogml_layout(const ClusterGraphAttributes &A, ostream &os)
{
	const ClusterGraph &C = A.constClusterGraph();

	GraphIO::indent(os,2) << "<layout>\n";
	GraphIO::indent(os,3) << "<styles>\n";

	for(cluster c : C.clusters) {
		if(c != C.rootCluster()) {
			GraphIO::indent(os,4) << "<nodeStyle idRef=\"c" << c->index() << "\">\n";

			GraphIO::indent(os,5) << "<location x=\"" << A.x(c) << "\" y=\"" << A.y(c) << "\" />\n";
			GraphIO::indent(os,5) << "<shape type=\"rect\" width=\"" << A.width(c) << "\" height=\"" << A.height(c) << "\" />\n";
			GraphIO::indent(os,5) << "<fill color=\"" << A.fillColor(c) << "\""
				<< " pattern=\"" << fillPatternToOGML(A.fillPattern(c))
				<< "\" patternColor=\""
				<< A.fillBgColor(c) << "\" />\n";
			GraphIO::indent(os,5) << "<line type=\"" << edgeStyleToOGML(A.strokeType(c)) << "\" width=\"" << A.strokeWidth(c) << "\" color=\"" << A.strokeColor(c) << "\" />\n";

			GraphIO::indent(os,4) << "</nodeStyle>\n";
		}
	}

	write_ogml_layout_nodes_edges(A,os);

	GraphIO::indent(os,3) << "</styles>\n";
	GraphIO::indent(os,2) << "</layout>\n";
}