diff options
Diffstat (limited to 'src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala')
-rw-r--r-- | src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala | 57 |
1 files changed, 27 insertions, 30 deletions
diff --git a/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala b/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala index 320a8e23b2..2deb669ea9 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala +++ b/src/scaladoc/scala/tools/nsc/doc/html/page/diagram/DotDiagramGenerator.scala @@ -10,7 +10,7 @@ package html package page package diagram -import scala.xml.{NodeSeq, XML, PrefixedAttribute, Elem, MetaData, Null, UnprefixedAttribute} +import scala.xml.{NodeSeq, PrefixedAttribute, Elem, Null, UnprefixedAttribute} import scala.collection.immutable._ import model._ import model.diagram._ @@ -246,15 +246,12 @@ class DotDiagramGenerator(settings: doc.Settings, dotRunner: DotRunner) extends // HTML label var name = escape(node.name) - var img = "" - if(node.isTraitNode) - img = "trait_diagram.png" - else if(node.isClassNode) - img = "class_diagram.png" - else if(node.isObjectNode) - img = "object_diagram.png" - else if(node.isTypeNode) - img = "type_diagram.png" + var img = + if(node.isTraitNode) "trait_diagram.png" + else if(node.isClassNode) "class_diagram.png" + else if(node.isObjectNode) "object_diagram.png" + else if(node.isTypeNode) "type_diagram.png" + else "" if(!img.equals("")) { img = "<TD><IMG SCALE=\"TRUE\" SRC=\"" + settings.outdir.value + "/lib/" + img + "\" /></TD>" @@ -364,7 +361,7 @@ class DotDiagramGenerator(settings: doc.Settings, dotRunner: DotRunner) extends // add an id and class attribute to the SVG element case Elem(prefix, "svg", attribs, scope, child @ _*) => { val klass = if (isInheritanceDiagram) "class-diagram" else "package-diagram" - Elem(prefix, "svg", attribs, scope, child map(x => transform(x)) : _*) % + Elem(prefix, "svg", attribs, scope, true, child map(x => transform(x)) : _*) % new UnprefixedAttribute("id", "graph" + counter, Null) % new UnprefixedAttribute("class", klass, Null) } @@ -378,7 +375,7 @@ class DotDiagramGenerator(settings: doc.Settings, dotRunner: DotRunner) extends // assign id and class attributes to edges and nodes: // the id attribute generated by dot has the format: "{class}|{id}" case g @ Elem(prefix, "g", attribs, scope, children @ _*) if (List("edge", "node").contains((g \ "@class").toString)) => { - var res = new Elem(prefix, "g", attribs, scope, (children map(x => transform(x))): _*) + var res = new Elem(prefix, "g", attribs, scope, true, (children map(x => transform(x))): _*) val dotId = (g \ "@id").toString if (dotId.count(_ == '|') == 1) { val Array(klass, id) = dotId.toString.split("\\|") @@ -395,11 +392,11 @@ class DotDiagramGenerator(settings: doc.Settings, dotRunner: DotRunner) extends val imageNode = <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href={ ("./lib/" + kind + "_diagram.png") } width="16px" height="16px" preserveAspectRatio="xMinYMin meet" x={ xposition.get.toString } y={ yposition.get.toString }/> val anchorNode = (g \ "a") match { case Seq(Elem(prefix, "a", attribs, scope, children @ _*)) => - transform(new Elem(prefix, "a", attribs, scope, (children ++ imageNode): _*)) + transform(new Elem(prefix, "a", attribs, scope, true, (children ++ imageNode): _*)) case _ => g \ "a" } - res = new Elem(prefix, "g", attribs, scope, anchorNode: _*) + res = new Elem(prefix, "g", attribs, scope, true, anchorNode: _*) DiagramStats.addFixedImage() } } @@ -413,7 +410,7 @@ class DotDiagramGenerator(settings: doc.Settings, dotRunner: DotRunner) extends scala.xml.Text("") // apply recursively case Elem(prefix, label, attribs, scope, child @ _*) => - Elem(prefix, label, attribs, scope, child map(x => transform(x)) : _*) + Elem(prefix, label, attribs, scope, true, child map(x => transform(x)) : _*) case x => x } @@ -439,22 +436,22 @@ class DotDiagramGenerator(settings: doc.Settings, dotRunner: DotRunner) extends ) private val nodeAttributes = Map( - "shape" -> "rectangle", - "style" -> "filled", + "shape" -> "rect", + "style" -> "filled,rounded", "penwidth" -> "1", "margin" -> "0.08,0.01", "width" -> "0.0", "height" -> "0.0", - "fontname" -> "Arial", - "fontsize" -> "10.00" + "fontname" -> "Source Code Pro", + "fontsize" -> "8.00" ) private val edgeAttributes = Map( "color" -> "#d4d4d4", - "arrowsize" -> "0.5", + "arrowsize" -> "0.7", "fontcolor" -> "#aaaaaa", - "fontsize" -> "10.00", - "fontname" -> "Arial" + "fontsize" -> "9.00", + "fontname" -> "Source Code Pro" ) private val defaultStyle = Map( @@ -477,26 +474,26 @@ class DotDiagramGenerator(settings: doc.Settings, dotRunner: DotRunner) extends ) private val traitStyle = Map( - "color" -> "#37657D", - "fillcolor" -> "#498AAD", + "color" -> "#2E6D82", + "fillcolor" -> "#2E6D82", "fontcolor" -> "#ffffff" ) private val classStyle = Map( - "color" -> "#115F3B", - "fillcolor" -> "#0A955B", + "color" -> "#418565", + "fillcolor" -> "#418565", "fontcolor" -> "#ffffff" ) private val objectStyle = Map( - "color" -> "#102966", - "fillcolor" -> "#3556a7", + "color" -> "#103A51", + "fillcolor" -> "#103A51", "fontcolor" -> "#ffffff" ) private val typeStyle = Map( - "color" -> "#115F3B", - "fillcolor" -> "#0A955B", + "color" -> "#2E6D82", + "fillcolor" -> "#2E6D82", "fontcolor" -> "#ffffff" ) |