Revision: 7381
http://mupad-combinat.svn.sourceforge.net/mupad-combinat/?rev=7381&view=rev
Author: nthiery
Date: 2008-01-17 16:21:33 -0800 (Thu, 17 Jan 2008)
Log Message:
-----------
New options: VertexOptions, RankSep, NodeSep
New vertex option: Color
New edge option: LabelStyle
Misc fixes
Modified Paths:
--------------
trunk/MuPAD-Combinat/lib/GRAPH/dotTeX.mu
Modified: trunk/MuPAD-Combinat/lib/GRAPH/dotTeX.mu
===================================================================
--- trunk/MuPAD-Combinat/lib/GRAPH/dotTeX.mu 2008-01-16 15:36:14 UTC (rev 7380)
+++ trunk/MuPAD-Combinat/lib/GRAPH/dotTeX.mu 2008-01-18 00:21:33 UTC (rev 7381)
@@ -2,18 +2,23 @@
Graph::dotTeX :=
proc(G: Graph) : DOM_STRING
- local weights, vertexRanker, vertex, child, result, options, edge, fixquoting, rankdir, edgeOptions, arrow, knownEdges;
+ local weights, vertexRanker, vertex, child, result, options, edge, fixquoting, rankdir, vertexOptions, edgeOptions, arrow, knownEdges;
begin
- options := prog::getOptions(table(EdgeColors = table(),
+ options := prog::getOptions([ EdgeColors = table(),
Direction = Down,
Directed = G::isDirected(),
EdgeOptions = (()->{}),
+ VertexOptions = (()->{}),
Loops = TRUE,
- Dot2TeXOptions = ""
- ),
+ Dot2TeXOptions = "",
+ RankSep, NodeSep
+ ],
table(EdgeColors = Type::TableOf(Graph::getEdges(G), DOM_STRING),
Direction = [Left, Right, Up, Down],
+ RankSep = Dom::Float,
+ NodeSep = Dom::Float,
Directed = DOM_BOOL,
+ VertexOptions = Type::Function,
EdgeOptions = Type::Function,
Loops = DOM_BOOL,
Dot2TeXOptions = DOM_STRING
@@ -35,6 +40,12 @@
if contains(rankdir, options[Direction]) then
result := result."rankdir=".rankdir[options[Direction]]."\n";
end_if;
+ if contains(options, RankSep) then
+ result := result."ranksep=".options[RankSep]."\n";
+ end_if;
+ if contains(options, NodeSep) then
+ result := result."nodesep=".options[NodeSep]."\n";
+ end_if;
fixquoting :=
proc(s)
begin
@@ -49,11 +60,18 @@
end_proc:
knownEdges := {};
for vertex in dom::getVertices(G) do
+ vertexOptions := table(op(options[VertexOptions](vertex)));
result := _concat(result,
- "N_", vertexRanker(vertex),
- " [ label = \" \", texlbl = \"$",
+ "N_", vertexRanker(vertex),
+ " [ label = \" \", texlbl = \"$",
fixquoting(generate::TeX(vertex)),
- "$\" ];\n");
+ "$\",",
+ if contains(vertexOptions, Color) then
+ "lblstyle = ".vertexOptions[Color].", "
+ else
+ ()
+ end_if,
+ "];\n");
for child in dom::getAdjacentEdgesLeaving(G, [vertex]) do
if not options[Loops] and vertex=child then next; end_if;
edge := [vertex, child];
@@ -85,12 +103,12 @@
end_if,
" [ ",
if not edgeOptions[Directed] then
- " arrowhead=none "
+ " arrowhead=none, "
else
""
end_if,
if contains(options[EdgeColors], edge) then
- "color = \"", options[EdgeColors][edge], "\" "
+ "color = \"", options[EdgeColors][edge], "\", "
else
""
end_if,
@@ -109,10 +127,15 @@
else
""
end_if,
+ if contains(edgeOptions, LabelStyle) then
+ "lblstyle=\"".edgeOptions[LabelStyle]."\", "
+ else
+ ""
+ end_if,
if edgeOptions[Label] <> NIL then
"label = \" \", texlbl = \"$",
fixquoting(generate::TeX(edgeOptions[Label])),
- "$\""
+ "$\","
else
""
end_if,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|