Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance default style rendering by use of prototypes #5

Open
hlindberg opened this issue Jun 2, 2011 · 2 comments
Open

enhance default style rendering by use of prototypes #5

hlindberg opened this issue Jun 2, 2011 · 2 comments

Comments

@hlindberg
Copy link
Contributor

Currently default style information is only output for the root graph and this is done by collecting styles from a default GCSS (defined and passed around in the API for this sole purpose). When producing the output, prototype instance of graph, edge and vertex are created and then styled using the GCSS package - the result is output as the default style.

If the GCSS rules instead were written to only apply to identified instances "org.cloudsmith.graph.prototype.edge" etc. then the style rules could be defined in the same package and it would be possible to use a different set of prototypes for different graphs by using an additional containment rule.

The result is that the generated dot output could be much more compact for certain types of graphs where they currently have to have style information per instance.

@hlindberg
Copy link
Contributor Author

Actually, this is not as easy - there are rules that should apply to all instances (the label of edges) and this can not be set in the defaults. Therefore it is always required to separate the two style sets (default, and instance). The API is thus not simplified, and this enhancement seems less valuable. Only when producing really huge graphs would there be a saving in the size of the generated dot source.

As the result is the same of setting say color on individual items and as the default in a sub graph it is not really worth the trouble. It is also questionable if it i meaningful to optimize the dot text output (it would be possible to collect all styles and compute the best defaults).

@hlindberg
Copy link
Contributor Author

Anyway, if considering implementing this, the defaults could be selected as follows

For the root graph:

Select.graph("RootGraph", "prototype")
Select.vertex("RootGraph", "prototype")
...

For all other graphs 'g' :

Select.graph(g.getId(), "prototype");
Select.vertex(g.getId(), "prototype");
...

As this would enable a user to add default style rules that are specific to a subgraph.

Currently the selection is done as this:

Select.graph();
Select.vertex();
...

and the prototypes are created like this:

new RootGraph(null, null, "prototype")
Vertex v = new Vertex(null, null, "prototype");
new Edge(v, v, "prototype");

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant