SVG issues with OrthoLayout

34 views
Skip to first unread message

malte.a...@googlemail.com

unread,
Jul 9, 2018, 5:56:01 PM7/9/18
to ogdf
Hi,

I'm currently using SVG as a visualization solution for a tool that deals with architecture diagrams. I'm using the most up-to-date snapshot (2018-03-28) and I'm having issues with the SVG files resulting from my diagrams.

This is my code, mostly derived from the example on your homepage:

int main(int argc, char* argv[])
{
std::ifstream is("diagram.gml", std::ifstream::binary);

Graph G;
GraphAttributes GA(G,
GraphAttributes::nodeGraphics |
GraphAttributes::edgeGraphics |
GraphAttributes::nodeLabel |
GraphAttributes::edgeStyle |
GraphAttributes::nodeStyle |
GraphAttributes::nodeTemplate);

//GraphIO::readGML(GA, G, std::cin);
GraphIO::readGML(GA, G, is);

PlanarizationLayout pl;

SubgraphPlanarizer crossMin;

auto* ps = new PlanarSubgraphFast<int>;
ps->runs(100);
VariableEmbeddingInserter *ves = new VariableEmbeddingInserter;
ves->removeReinsert(RemoveReinsertType::All);

crossMin.setSubgraph(ps);
crossMin.setInserter(ves);

EmbedderMinDepthMaxFaceLayers *emb = new EmbedderMinDepthMaxFaceLayers;
pl.setEmbedder(emb);

OrthoLayout *ol = new OrthoLayout;
ol->separation(20.0);
ol->cOverhang(0.4);
pl.setPlanarLayouter(ol);

pl.call(GA);

GraphIO::drawSVG(GA, std::cout);
std::flush(std::cout);
std::ofstream outputFile("output.svg");
GraphIO::drawSVG(GA, outputFile);

return 0;
}

Everything works as intended, but the resulting SVG of my diagram (see attached files) has serious issues with lines (not connected, sections missing...). Is this issue already known and does anyone now a possible solution?

Regards,

Malte

diagram.gml
output.svg

Tilo

unread,
Jul 13, 2018, 5:05:11 AM7/13/18
to ogdf
Dear Malte,

thank you for reporting this error.

You also need to enable edgeGraphics, edgeType, and nodeType for your GraphAttributges-object.
Running your program in debug mode should raise the respective errors (see build guide).

Still, I confirm the faulty behavior you observed.
As a workaround you may add
GA.directed() = false;
right after constructing GA, assuming that you don't want to indicate the direction of your edges.

The error will (probably) be fixed in the next snapshot.

Cheers
Tilo

malte.a...@googlemail.com

unread,
Jul 13, 2018, 7:26:05 AM7/13/18
to ogdf
Dear Tilo,

thanks for your hints! Not rendering the direction of the edges should be okay for now, I'm looking forward for a possible fix.
Have a nice weekend!

Regards,
Malte
Reply all
Reply to author
Forward
0 new messages