@@ 42,13 42,16 @@ func renderSVG(out io.Writer, rs Ranks)
c.Gid(_id)
c.Rect(0, 0, boxW, boxH, "fill: inherit; stroke: black; stroke-width: 1;")
c.Gend()
+ c.Gid(_root_id)
+ c.Rect(0, 0, boxW, boxH, "fill: inherit; stroke: black; stroke-width: 3;")
+ c.Gend()
c.DefEnd()
defer c.End()
b := make(map[string]Box)
xoff := marginW
for _, p := range rs[0] {
- drawOrg(c, xoff, marginH/2, p, b, false)
+ drawOrg(c, xoff, marginH/2, p, b, true, false)
xoff += p.Width()
}
for _, r := range rs {
@@ 56,8 59,8 @@ func renderSVG(out io.Writer, rs Ranks)
}
}
-func drawOrg(canvas *svg.SVG, xoffset, yoffset int, p *Person, boxes map[string]Box, leaf bool) {
- drawPerson(canvas, xoffset, yoffset, p.Index(), p, boxes, leaf)
+func drawOrg(canvas *svg.SVG, xoffset, yoffset int, p *Person, boxes map[string]Box, root, leaf bool) {
+ drawPerson(canvas, xoffset, yoffset, p.Index(), p, boxes, root, leaf)
if len(p.Reports) > 0 {
isLeaf := true
for _, report := range p.Reports {
@@ 65,7 68,7 @@ func drawOrg(canvas *svg.SVG, xoffset, y
}
yoffset += boxH + (gapH / 2)
for _, q := range p.Reports {
- drawOrg(canvas, xoffset, yoffset, q, boxes, isLeaf)
+ drawOrg(canvas, xoffset, yoffset, q, boxes, false, isLeaf)
if isLeaf {
yoffset += boxH + (gapH / 2)
} else {
@@ 75,21 78,25 @@ func drawOrg(canvas *svg.SVG, xoffset, y
}
}
-func drawPerson(canvas *svg.SVG, x, y, ind int, person *Person, boxes map[string]Box, leaf bool) {
+func drawPerson(canvas *svg.SVG, x, y, ind int, person *Person, boxes map[string]Box, root, leaf bool) {
if !leaf {
x += (person.Width() - (boxW + (gapH / 2))) / 2
}
- drawBox(canvas, x, y, person)
+ drawBox(canvas, x, y, person, root)
boxes[person.Name] = Box{X: x, Y: y, Leaf: leaf}
}
-func drawBox(c *svg.SVG, x, y int, p *Person) {
- c.Use(x+2, y+3, _ref, `filter="url(#blur)"`)
+func drawBox(c *svg.SVG, x, y int, p *Person, root bool) {
+ ref := _ref
+ if root {
+ ref = _root_ref
+ }
+ c.Use(x+2, y+3, ref, `filter="url(#blur)"`)
fill := "fill: white"
if p.Contractor {
fill = "fill: yellow"
}
- c.Use(x, y, _ref, fill)
+ c.Use(x, y, ref, fill)
toff := x + (boxW / 2)
toffY := y + textSize + textPY
if p.Title != "" {