Simon Hunt

GUI - Converted Hosts to use Glyph icons instead of png's.

Change-Id: I5adce1b263985ec853a62db28d59e6d3e252f158
...@@ -119,16 +119,6 @@ svg .node.host circle { ...@@ -119,16 +119,6 @@ svg .node.host circle {
119 fill: #ddd; 119 fill: #ddd;
120 } 120 }
121 121
122 -#topo svg .node.host.bgpSpeaker circle {
123 - stroke: #000;
124 - fill: #ddd;
125 -}
126 -
127 -#topo svg .node.host.router circle {
128 - stroke: #000;
129 - fill: #ddd;
130 -}
131 -
132 /* LINKS */ 122 /* LINKS */
133 123
134 #topo svg .link { 124 #topo svg .link {
......
...@@ -1244,7 +1244,7 @@ ...@@ -1244,7 +1244,7 @@
1244 // Augment as needed... 1244 // Augment as needed...
1245 node.class = 'host'; 1245 node.class = 'host';
1246 if (!node.type) { 1246 if (!node.type) {
1247 - node.type = 'endstation'; 1247 + node.type = 'host';
1248 } 1248 }
1249 node.svgClass = 'node host ' + node.type; 1249 node.svgClass = 'node host ' + node.type;
1250 positionNode(node); 1250 positionNode(node);
...@@ -1451,15 +1451,17 @@ ...@@ -1451,15 +1451,17 @@
1451 } 1451 }
1452 } 1452 }
1453 1453
1454 - function addHostIcon(node, radius, iconId) { 1454 + function addHostIcon(node, radius, iid) {
1455 var dim = radius * 1.5, 1455 var dim = radius * 1.5,
1456 xlate = -dim / 2; 1456 xlate = -dim / 2;
1457 1457
1458 - node.append('svg:image') 1458 + node.append('use').attr({
1459 - .attr('transform', translate(xlate,xlate)) 1459 + class: 'glyphIcon hostIcon',
1460 - .attr('xlink:href', 'img/' + iconId + '.png') 1460 + transform: translate(xlate,xlate),
1461 - .attr('width', dim) 1461 + 'xlink:href': iid,
1462 - .attr('height', dim); 1462 + width: dim,
1463 + height: dim
1464 + });
1463 } 1465 }
1464 1466
1465 function updateNodes() { 1467 function updateNodes() {
...@@ -1521,7 +1523,7 @@ ...@@ -1521,7 +1523,7 @@
1521 router: 14, 1523 router: 14,
1522 host: 14 1524 host: 14
1523 }, 1525 },
1524 - hostIcon = { 1526 + hostGlyphId = {
1525 bgpSpeaker: 'bgpSpeaker', 1527 bgpSpeaker: 'bgpSpeaker',
1526 router: 'router', 1528 router: 'router',
1527 host: 'host' 1529 host: 'host'
...@@ -1533,7 +1535,7 @@ ...@@ -1533,7 +1535,7 @@
1533 var node = d3.select(this), 1535 var node = d3.select(this),
1534 r = hostRadius[d.type] || defaultHostRadius, 1536 r = hostRadius[d.type] || defaultHostRadius,
1535 textDy = r + 10, 1537 textDy = r + 10,
1536 - icon = hostIcon[d.type]; 1538 + iid = iconGlyphUrl(d);
1537 1539
1538 // provide ref to element from backing data.... 1540 // provide ref to element from backing data....
1539 d.el = node; 1541 d.el = node;
...@@ -1541,8 +1543,8 @@ ...@@ -1541,8 +1543,8 @@
1541 node.append('circle') 1543 node.append('circle')
1542 .attr('r', r); 1544 .attr('r', r);
1543 1545
1544 - if (icon) { 1546 + if (iid) {
1545 - addHostIcon(node, r, icon); 1547 + addHostIcon(node, r, iid);
1546 } 1548 }
1547 1549
1548 1550
...@@ -1617,7 +1619,8 @@ ...@@ -1617,7 +1619,8 @@
1617 dy = box.y + config.icons.yoff; 1619 dy = box.y + config.icons.yoff;
1618 } 1620 }
1619 1621
1620 - g = node.append('g').attr('class', 'glyphIcon deviceIcon') 1622 + g = node.append('g')
1623 + .attr('class', 'glyphIcon deviceIcon')
1621 .attr('transform', translate(dx, dy)); 1624 .attr('transform', translate(dx, dy));
1622 1625
1623 g.append('rect').attr({ 1626 g.append('rect').attr({
......