Simon Hunt

GUI -- Cleaned up Glyphs library code.

 - added new test page; removed old test page.
 - added copyright to oblique test page.

Change-Id: If8770fbcadc82a1a680c8ba83b3b31beadabc8d4
<!DOCTYPE html>
<!--
~ Copyright 2014 Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!--
ONOS -- Glyphs library test page
@author Simon Hunt
-->
<html>
<head>
<meta charset="utf-8">
<title>Glyphs</title>
<script src="../tp/d3.js"></script>
<style>
html,
body {
background-color: #ddf;
font-family: Arial, Helvetica, sans-serif;
font-size: 9pt;
}
svg {
background-color: #fff;
}
svg .glyph {
stroke: none;
fill: black;
fill-rule: evenodd;
}
svg .icon text {
text-anchor: middle;
font-size: 5pt;
fill: green;
stroke: none;
}
</style>
</head>
<body>
<!-- minimal framework to access glyphs library module -->
<script>
var libs = {};
var ONOS = { ui: { addLib: function (id, things) { libs[id] = things; }}};
</script>
<!-- import the glyphs library -->
<script src="../glyphs.js"></script>
<svg></svg>
<!-- code to display the glyphs in the library -->
<script>
(function () {
var w = 1000,
h = 400,
vb = '0 0 ' + w + ' ' + h;
var svg = d3.select('svg')
.attr({ width: w, height: h, viewBox: vb });
// create definitions element...
var defs = svg.append('defs');
// create scaling group
var grp = svg.append('g')
.attr('transform', 'translate(20,20)scale(2)');
function translate(loc) {
return 'translate(' + loc[0] + ',' + loc[1] +')';
}
function icon(what, id, loc, color, bg, size) {
var i = '#' + id,
c = color || 'black',
b = bg || '#eef',
z = size || 40,
g;
g = what.append('g')
.attr({ 'class': 'icon', transform: translate(loc) });
g.append('rect')
.attr({ width: z, height: z, rx: 4 })
.style('fill', b)
.style('stroke', 'black')
.style('stroke-width', 0.5);
g.append('use')
.attr({ 'class': 'glyph', width: z, height: z, 'xlink:href': i })
.style('fill', c);
if (id !== 'bird') {
g.append('text')
.text(id)
.attr({ x: z / 2, y: z + 8 })
}
}
// import glyphs...
libs.glyphs.defBird(defs);
libs.glyphs.defGlyphs(defs);
libs.glyphs.defBadges(defs);
// bird, top right corner
icon(svg, 'bird', [830,10], '#800', '#ecc', 160);
// show icons...
icon(grp, 'unknown', [ 0, 0]);
icon(grp, 'node', [ 50, 0]);
icon(grp, 'switch', [100, 0]);
icon(grp, 'roadm', [150, 0]);
icon(grp, 'endstation', [200, 0]);
icon(grp, 'router', [250, 0]);
icon(grp, 'bgpSpeaker', [300, 0]);
icon(grp, 'uiAttached', [350, 0]);
icon(grp, 'chain', [ 0, 60]);
// more goodies to come soon.....
})();
</script>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Icons</title>
<script src="../tp/d3.js"></script>
<script src="../tp/topojson.v1.min.js"></script>
<script src="../tp/jquery-2.1.1.min.js"></script>
<style>
html,
body {
background-color: #ddf;
font-family: Arial, Helvetica, sans-serif;
font-size: 9pt;
}
svg {
background-color: #fff;
}
svg .glyph {
stroke: none;
fill: black;
fill-rule: evenodd;
}
svg .device rect.iconBg {
fill: #ddd;
stroke: #000;
}
.hide {
visibility: hidden;
}
</style>
</head>
<body>
<svg width="1000px" height="600px" viewBox="0 0 1000 600" >
<defs>
<symbol id="router" class="glyph" viewBox="-55 -55 110 110">
<path d="M-45 0 A45 45 0 0 1 45 0 A45 45 0 0 1 -45 0
M -35 -5 l 12 0, 0 -8, 18 13, -18 13, 0 -8, -12 0 z
M 35 -5 l -12 0, 0 -8, -18 13, 18 13, 0 -8, 12 0 z
M -5 -8 l 0 -12, -8 0, 13 -18, 13 18, -8 0, 0 12 z
M -5 8 l 0 12, -8 0, 13 18, 13 -18, -8 0, 0 -12 z
"></path>
</symbol>
<symbol id="bgpSpeaker" class="glyph" viewBox="-55 -55 110 110">
<path d="M-45 -15
a45 35 0 0 1 90 0
Q45 22 0 45
Q-45 22 -45 -15
z
M -5 -26 l 12 0, 0 -8, 18 13, -18 13, 0 -8, -12 0 z
M 5 2 l -12 0, 0 -8, -18 13, 18 13, 0 -8, 12 0 z
"></path>
<!-- a45 45 0 0 1 -10 30
-->
</symbol>
<symbol id="switch" class="glyph" viewBox="-55 -55 110 110">
<path d="M-45 -35 a10 10 0 0 1 10 -10 h70
a 10 10 0 0 1 10 10 v70
a 10 10 0 0 1 -10 10 h -70
a 10 10 0 0 1 -10 -10 z
M 5 -29 l 12 0, 0 -8, 18 13, -18 13, 0 -8, -12 0 z
M 5 5 l 12 0, 0 -8, 18 13, -18 13, 0 -8, -12 0 z
M -5 -15 l -12 0, 0 -8, -18 13, 18 13, 0 -8, 12 0 z
M -5 19 l -12 0, 0 -8, -18 13, 18 13, 0 -8, 12 0 z
"></path>
</symbol>
<symbol id="roadm" class="glyph" viewBox="-55 -55 110 110">
<path d="M-45 -20 l25 -25 h40 l25 25 v40
l-25 25 h-40 l-25 -25 z
M 3 -29 l 12 0, 0 -8, 18 13, -18 13, 0 -8, -12 0 z
M 3 5 l 12 0, 0 -8, 18 13, -18 13, 0 -8, -12 0 z
M -3 -15 l -12 0, 0 -8, -18 13, 18 13, 0 -8, 12 0 z
M -3 19 l -12 0, 0 -8, -18 13, 18 13, 0 -8, 12 0 z
"></path>
</symbol>
<symbol id="node" class="glyph" viewBox="-55 -55 110 110">
<path d="M-40 45 a5 5 0 0 1 -5 -5 v-65 a5 5 0 0 1 5 -5
h80 a5 5 0 0 1 5 5 v65 a5 5 0 0 1 -5 5 z
M-41 -32.5 l11 -11 a10 3 0 0 1 10 -2 h40
a10 3 0 0 1 10 2 l11 11 z
M-39 -20 a5 5 0 0 1 10 0 a5 5 0 0 1 -10 0 z
"></path>
</symbol>
<symbol id="nodeSlave" class="glyph" viewBox="-55 -55 110 110">
<path d="M-40 45 a5 5 0 0 1 -5 -5 v-65 a5 5 0 0 1 5 -5
h80 a5 5 0 0 1 5 5 v65 a5 5 0 0 1 -5 5 z
M-41 -32.5 l11 -11 a10 3 0 0 1 10 -2 h40
a10 3 0 0 1 10 2 l11 11 z
M-39 -20 a5 5 0 0 1 10 0 a5 5 0 0 1 -10 0 z
M-6 -6
l6 -6
a8.485 8.485 0 0 1 12 12
l-6 6
a8.485 8.485 0 0 1 -13 -2
l3 -3
a4 4 0 0 0 6 1
l8 -8
a2.8 2.8 0 0 0 -5 -5
l-5 5
z
"></path>
</symbol>
<symbol id="host" class="glyph" viewBox="-55 -55 110 110">
<path d="M-45 -40 a5 5 0 0 1 5 -5 h65 a5 5 0 0 1 5 5
v80 a5 5 0 0 1 -5 5 h-65 a5 5 0 0 1 -5 -5 z
M32.5 -41 l11 11 a3 10 0 0 1 2 10 v40
a3 10 0 0 1 -2 10 l-11 11 z
M-38 -36
a2 2 0 0 1 2 -2 h56
a2 2 0 0 1 2 2 v26
a2 2 0 0 1 -2 2 h-56
a2 2 0 0 1 -2 -2
z
M-35 -35 h54 v10 h-54 z
M-35 -22 h54 v10 h-54 z
M-13 15 a5 5 0 0 1 10 0 a5 5 0 0 1 -10 0 z
"></path>
</symbol>
<symbol id="unknown" class="glyph" viewBox="-55 -55 110 110">
<path d="M-20 -15 a5 5 0 0 1 5 -5 h30 a5 5 0 0 1 5 5 v30 a5 5 0 0 1 -5 5 h-30 a5 5 0 0 1 -5 -5 z "></path>
</symbol>
</defs>
<g transform="translate(10,10)scale(4)translate(0,20)" >
<g class="hide">
<!--link-->
<path fill="#010101" d="M459.654,233.373l-90.531,90.5c-49.969,50-131.031,50-181,0c-7.875-7.844-14.031-16.688-19.438-25.813
l42.063-42.063c2-2.016,4.469-3.172,6.828-4.531c2.906,9.938,7.984,19.344,15.797,27.156c24.953,24.969,65.563,24.938,90.5,0
l90.5-90.5c24.969-24.969,24.969-65.563,0-90.516c-24.938-24.953-65.531-24.953-90.5,0l-32.188,32.219
c-26.109-10.172-54.25-12.906-81.641-8.891l68.578-68.578c50-49.984,131.031-49.984,181.031,0
C509.623,102.342,509.623,183.389,459.654,233.373z M220.326,382.186l-32.203,32.219c-24.953,24.938-65.563,24.938-90.516,0
c-24.953-24.969-24.953-65.563,0-90.531l90.516-90.5c24.969-24.969,65.547-24.969,90.5,0c7.797,7.797,12.875,17.203,15.813,27.125
c2.375-1.375,4.813-2.5,6.813-4.5l42.063-42.047c-5.375-9.156-11.563-17.969-19.438-25.828c-49.969-49.984-131.031-49.984-181.016,0
l-90.5,90.5c-49.984,50-49.984,131.031,0,181.031c49.984,49.969,131.031,49.969,181.016,0l68.594-68.594
C274.561,395.092,246.42,392.342,220.326,382.186z"></path>
<!--crown-->
<path d="M94.257,32.808c0,4.466-3.62,8.085-8.085,8.085c-0.495,0-0.979-0.051-1.449-0.136l-6.637,23.695v8.518H21.914v-8.849
l-6.579-23.373c-0.489,0.092-0.992,0.145-1.507,0.145c-4.465,0-8.085-3.619-8.085-8.085c0-4.466,3.62-8.086,8.085-8.086
c4.465,0,8.085,3.62,8.085,8.086c0,1.099-0.222,2.146-0.619,3.102c8.078,2.726,20.551,4.947,26.163-4.449
c-3.219-1.066-5.543-4.095-5.543-7.671c0-4.466,3.62-8.086,8.085-8.086s8.085,3.62,8.085,8.086c0,3.573-2.32,6.6-5.536,7.669
c3.276,6.052,10.577,12.374,26.494,5.165c-0.608-1.137-0.957-2.435-0.957-3.815c0-4.466,3.62-8.086,8.085-8.086
S94.257,28.342,94.257,32.808z M21.915,84.297h56.173v-7.658H21.915V84.297z"></path>
</g>
<g class="show">
<g class="device" transform="translate(0,0)">
<rect x="0" y="0" width="40" height="40" rx="4" class="iconBg"></rect>
<use xlink:href="#router" width="40" height="40"></use>
</g>
<g class="device" transform="translate(50,0)">
<rect x="0" y="0" width="40" height="40" rx="4" class="iconBg"></rect>
<use xlink:href="#switch" width="40" height="40"></use>
</g>
<g class="device" transform="translate(100,0)">
<rect x="0" y="0" width="40" height="40" rx="4" class="iconBg"></rect>
<use xlink:href="#roadm" width="40" height="40"></use>
</g>
<g class="device" transform="translate(0,50)">
<rect x="0" y="0" width="40" height="40" rx="4" class="iconBg"></rect>
<use xlink:href="#node" width="40" height="40"></use>
</g>
<g class="device" transform="translate(50,50)">
<rect x="0" y="0" width="40" height="40" rx="4" class="iconBg"></rect>
<use xlink:href="#host" width="40" height="40"></use>
</g>
<g class="device" transform="translate(100,50)">
<rect x="0" y="0" width="40" height="40" rx="4" class="iconBg"></rect>
<use xlink:href="#bgpSpeaker" width="40" height="40"></use>
</g>
<g class="device" transform="translate(150,0)">
<rect x="0" y="0" width="40" height="40" rx="4" class="iconBg"></rect>
<use xlink:href="#unknown" width="40" height="40"></use>
</g>
</g>
</g>
</svg>
</body>
</html>
<!DOCTYPE html>
<!--
~ Copyright 2014 Open Networking Laboratory
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!--
Testing transformations for transitioning between overhead and
perspective projections of two layers.
......@@ -11,7 +27,6 @@
<title>Layer Transformations</title>
<script src="../tp/d3.js"></script>
<script src="../tp/topojson.v1.min.js"></script>
<script src="../tp/jquery-2.1.1.min.js"></script>
<style>
......
......@@ -15,7 +15,7 @@
*/
/*
SVG Glyphs.
ONOS -- SVG Glyphs Library.
@author Simon Hunt
*/
......@@ -24,104 +24,93 @@
(function (onos) {
'use strict';
// TODO: refactor this library...
var birdData = "M427.7,300.4 c-6.9,0.6-13.1,5-19.2,7.1" +
"c-18.1,6.2-33.9,9.1-56.5,4.7c24.6,17.2,36.6,13,63.7,0.1" +
"c-0.5,0.6-0.7,1.3-1.3,1.9c1.4-0.4,2.4-1.7,3.4-2.2" +
"c-0.4,0.7-0.9,1.5-1.4,1.9c2.2-0.6,3.7-2.3,5.9-3.9" +
"c-2.4,2.1-4.2,5-6,8c-1.5,2.5-3.1,4.8-5.1,6.9c-1,1-1.9,1.9-2.9,2.9" +
"c-1.4,1.3-2.9,2.5-5.1,2.9c1.7,0.1,3.6-0.3,6.5-1.9" +
"c-1.6,2.4-7.1,6.2-9.9,7.2c10.5-2.6,19.2-15.9,25.7-18" +
"c18.3-5.9,13.8-3.4,27-14.2c1.6-1.3,3-1,5.1-0.8" +
"c1.1,0.1,2.1,0.3,3.2,0.5c0.8,0.2,1.4,0.4,2.2,0.8l1.8,0.9" +
"c-1.9-4.5-2.3-4.1-5.9-6c-2.3-1.3-3.3-3.8-6.2-4.9" +
"c-7.1-2.6-11.9,11.7-11.7-5c0.1-8,4.2-14.4,6.4-22" +
"c1.1-3.8,2.3-7.6,2.4-11.5c0.1-2.3,0-4.7-0.4-7" +
"c-2-11.2-8.4-21.5-19.7-24.8c-1-0.3-1.1-0.3-0.9,0" +
"c9.6,17.1,7.2,38.3,3.1,54.2C429.9,285.5,426.7,293.2,427.7,300.4z";
function defBird(defs) {
defs.append('symbol')
.attr({
id: 'bird',
viewBox: '352 224 113 112'
})
.append('path').attr('d', birdData);
}
var glyphData = {
unknown: "M-20 -15 a5 5 0 0 1 5 -5 h30 a5 5 0 0 1 5 5 v30 " +
"a5 5 0 0 1 -5 5 h-30 a5 5 0 0 1 -5 -5 z",
node: "M-40 45 a5 5 0 0 1 -5 -5 v-65 a5 5 0 0 1 5 -5 h80 " +
"a5 5 0 0 1 5 5 v65 a5 5 0 0 1 -5 5 z M-41 -32.5 l11 -11 " +
"a10 3 0 0 1 10 -2 h40 a10 3 0 0 1 10 2 l11 11 z M-39 -20 " +
"a5 5 0 0 1 10 0 a5 5 0 0 1 -10 0 z",
switch: "M-45 -35 a10 10 0 0 1 10 -10 h70 a 10 10 0 0 1 10 10 " +
"v70 a 10 10 0 0 1 -10 10 h -70 a 10 10 0 0 1 -10 -10 z " +
"M 5 -29 l 12 0, 0 -8, 18 13, -18 13, 0 -8, -12 0 z M 5 5 " +
"l 12 0, 0 -8, 18 13, -18 13, 0 -8, -12 0 z M -5 -15 " +
"l -12 0, 0 -8, -18 13, 18 13, 0 -8, 12 0 z M -5 19 " +
"l -12 0, 0 -8, -18 13, 18 13, 0 -8, 12 0 z",
roadm: "M-45 -20 l25 -25 h40 l25 25 v40 l-25 25 h-40 l-25 -25 z " +
"M 3 -29 l 12 0, 0 -8, 18 13, -18 13, 0 -8, -12 0 z M 3 5 " +
"l 12 0, 0 -8, 18 13, -18 13, 0 -8, -12 0 z M -3 -15 " +
"l -12 0, 0 -8, -18 13, 18 13, 0 -8, 12 0 z M -3 19 " +
"l -12 0, 0 -8, -18 13, 18 13, 0 -8, 12 0 z",
endstation: "M-45 -40 a5 5 0 0 1 5 -5 h65 a5 5 0 0 1 5 5 v80 " +
"a5 5 0 0 1 -5 5 h-65 a5 5 0 0 1 -5 -5 z M32.5 -41 l11 11 " +
"a3 10 0 0 1 2 10 v40 a3 10 0 0 1 -2 10 l-11 11 z M-38 -36 " +
"a2 2 0 0 1 2 -2 h56 a2 2 0 0 1 2 2 v26 a2 2 0 0 1 -2 2 h-56 " +
"a2 2 0 0 1 -2 -2 z M-35 -35 h54 v10 h-54 z M-35 -22 h54 v10 " +
"h-54 z M-13 15 a5 5 0 0 1 10 0 a5 5 0 0 1 -10 0 z",
router: "M-45 0 A45 45 0 0 1 45 0 A45 45 0 0 1 -45 0 M -35 -5 " +
"l 12 0, 0 -8, 18 13, -18 13, 0 -8, -12 0 z M 35 -5 " +
"l -12 0, 0 -8, -18 13, 18 13, 0 -8, 12 0 z M -5 -8 " +
"l 0 -12, -8 0, 13 -18, 13 18, -8 0, 0 12 z M -5 8 " +
"l 0 12, -8 0, 13 18, 13 -18, -8 0, 0 -12 z",
bgpSpeaker: "M-45 -15 a45 35 0 0 1 90 0 Q45 22 0 45 Q-45 22 -45 -15 z " +
"M -5 -26 l 12 0, 0 -8, 18 13, -18 13, 0 -8, -12 0 z M 5 2" +
" l -12 0, 0 -8, -18 13, 18 13, 0 -8, 12 0 z"
};
var glyphParams = {
viewBox: '-55 -55 110 110'
};
var badgeData = {
uiAttached: "M-3-2.5 a.5 .5 0 0 1 .5-.5 h5 a.5 .5 0 0 1 .5 .5 v3 " +
"a.5 .5 0 0 1-.5 .5 h-5 a.5 .5 0 0 1-.5-.5 z M-2.5-2.2 " +
"a.3 .3 0 0 1 .3-.3 h4.4 a.3 .3 0 0 1 .3 .3 v2.4 a.3 .3 0 0 1-.3 .3 " +
"h-4.4 a.3 .3 0 0 1-.3-.3 z M-3 1.55 h6 l1 1.45 h-8 z"
};
var badgeParams = {
viewBox: '-5 -5 10 10'
};
function defStuff(defs, params, data) {
var birdViewBox = '352 224 113 112',
birdData = {
bird: "M427.7,300.4 c-6.9,0.6-13.1,5-19.2,7.1c-18.1,6.2-33.9," +
"9.1-56.5,4.7c24.6,17.2,36.6,13,63.7,0.1c-0.5,0.6-0.7,1.3-1.3," +
"1.9c1.4-0.4,2.4-1.7,3.4-2.2c-0.4,0.7-0.9,1.5-1.4,1.9c2.2-0.6," +
"3.7-2.3,5.9-3.9c-2.4,2.1-4.2,5-6,8c-1.5,2.5-3.1,4.8-5.1,6.9c-1," +
"1-1.9,1.9-2.9,2.9c-1.4,1.3-2.9,2.5-5.1,2.9c1.7,0.1,3.6-0.3,6.5" +
"-1.9c-1.6,2.4-7.1,6.2-9.9,7.2c10.5-2.6,19.2-15.9,25.7-18c18.3" +
"-5.9,13.8-3.4,27-14.2c1.6-1.3,3-1,5.1-0.8c1.1,0.1,2.1,0.3,3.2," +
"0.5c0.8,0.2,1.4,0.4,2.2,0.8l1.8,0.9c-1.9-4.5-2.3-4.1-5.9-6c-2.3" +
"-1.3-3.3-3.8-6.2-4.9c-7.1-2.6-11.9,11.7-11.7-5c0.1-8,4.2-14.4," +
"6.4-22c1.1-3.8,2.3-7.6,2.4-11.5c0.1-2.3,0-4.7-0.4-7c-2-11.2-8.4" +
"-21.5-19.7-24.8c-1-0.3-1.1-0.3-0.9,0c9.6,17.1,7.2,38.3,3.1,54.2" +
"C429.9,285.5,426.7,293.2,427.7,300.4z"
},
glyphViewBox = '0 0 110 110',
glyphData = {
unknown: "M35,40a5,5,0,0,1,5-5h30a5,5,0,0,1,5,5v30a5,5,0,0,1-5,5" +
"h-30a5,5,0,0,1-5-5z",
node: "M15,100a5,5,0,0,1-5-5v-65a5,5,0,0,1,5-5h80a5,5,0,0,1,5,5" +
"v65a5,5,0,0,1-5,5zM14,22.5l11-11a10,3,0,0,1,10-2h40a10,3,0,0,1," +
"10,2l11,11zM16,35a5,5,0,0,1,10,0a5,5,0,0,1-10,0z",
switch: "M10,20a10,10,0,0,1,10-10h70a10,10,0,0,1,10,10v70a10,10," +
"0,0,1-10,10h-70a10,10,0,0,1-10-10zM60,26l12,0,0-8,18,13-18,13,0" +
"-8-12,0zM60,60l12,0,0-8,18,13-18,13,0-8-12,0zM50,40l-12,0,0-8" +
"-18,13,18,13,0-8,12,0zM50,74l-12,0,0-8-18,13,18,13,0-8,12,0z",
roadm: "M10,35l25-25h40l25,25v40l-25,25h-40l-25-25zM58,26l12,0,0" +
"-8,18,13-18,13,0-8-12,0zM58,60l12,0,0-8,18,13-18,13,0-8-12,0z" +
"M52,40l-12,0,0-8-18,13,18,13,0-8,12,0zM52,74l-12,0,0-8-18,13," +
"18,13,0-8,12,0z",
endstation: "M10,15a5,5,0,0,1,5-5h65a5,5,0,0,1,5,5v80a5,5,0,0,1" +
"-5,5h-65a5,5,0,0,1-5-5zM87.5,14l11,11a3,10,0,0,1,2,10v40a3,10," +
"0,0,1,-2,10l-11,11zM17,19a2,2,0,0,1,2-2h56a2,2,0,0,1,2,2v26a2," +
"2,0,0,1-2,2h-56a2,2,0,0,1-2-2zM20,20h54v10h-54zM20,33h54v10h" +
"-54zM42,70a5,5,0,0,1,10,0a5,5,0,0,1-10,0z",
router: "M10,55A45,45,0,0,1,100,55A45,45,0,0,1,10,55M20,50l12,0," +
"0-8,18,13-18,13,0-8-12,0zM90,50l-12,0,0-8-18,13,18,13,0-8,12,0z" +
"M50,47l0-12-8,0,13-18,13,18-8,0,0,12zM50,63l0,12-8,0,13,18,13" +
"-18-8,0,0-12z",
bgpSpeaker: "M10,40a45,35,0,0,1,90,0Q100,77,55,100Q10,77,10,40z" +
"M50,29l12,0,0-8,18,13-18,13,0-8-12,0zM60,57l-12,0,0-8-18,13," +
"18,13,0-8,12,0z",
chain: "M60.4,77.6c-4.9,5.2-9.6,11.3-15.3,16.3c-8.6,7.5-20.4,6.8" +
"-28-0.8c-7.7-7.7-8.4-19.6-0.8-28.4c6.5-7.4,13.5-14.4,20.9-20.9" +
"c7.5-6.7,19.2-6.7,26.5-0.8c3.5,2.8,4.4,6.1,2.2,8.7c-2.7,3.1" +
"-5.5,2.5-8.5,0.3c-4.7-3.4-9.7-3.2-14,0.9C37.1,58.7,31,64.8," +
"25.2,71c-4.2,4.4-4.2,10.6-0.6,14.3c3.7,3.7,9.7,3.7,14.3-0.4" +
"c2.9-2.5,5.3-5.5,8.3-8c1-0.9,3-1.1,4.4-0.9C54.8,76.3,57.9,77.1," +
"60.4,77.6zM49.2,32.2c5-5.2,9.7-10.9,15.2-15.7c12.8-11,31.2" +
"-4.9,34.3,11.2C100,34.2,98.3,40.2,94,45c-6.7,7.4-13.7,14.6" +
"-21.2,21.2C65.1,73,53.2,72.7,46,66.5c-3.2-2.8-3.9-5.8-1.6-8.4" +
"c2.6-2.9,5.3-2.4,8.2-0.3c5.2,3.7,10,3.3,14.7-1.1c5.8-5.6,11.6" +
"-11.3,17.2-17.2c4.6-4.8,4.9-11.1,0.9-15c-3.9-3.9-10.1-3.4-15," +
"1.2c-3.1,2.9-5.7,7.4-9.3,8.5C57.6,35.3,53,33,49.2,32.2z"
},
badgeViewBox = '0 0 10 10',
badgeData = {
uiAttached: "M2,2.5a.5,.5,0,0,1,.5-.5h5a.5,.5,0,0,1,.5,.5v3" +
"a.5,.5,0,0,1-.5,.5h-5a.5,.5,0,0,1-.5-.5zM2.5,2.8a.3,.3,0,0,1," +
".3-.3h4.4a.3,.3,0,0,1,.3,.3v2.4a.3,.3,0,0,1-.3,.3h-4.4" +
"a.3,.3,0,0,1-.3-.3zM2,6.55h6l1,1.45h-8z"
};
function defStuff(defs, viewbox, data) {
d3.map(data).keys().forEach(function (key) {
defs.append('symbol')
.attr({
id: key,
viewBox: params.viewBox
})
.attr({ id: key, viewBox: viewbox })
.append('path').attr('d', data[key]);
});
}
// === register the functions as a library
onos.ui.addLib('glyphs', {
defBird: defBird,
defGlyphs: function (defs) { defStuff(defs, glyphParams, glyphData); },
defBadges: function (defs) { defStuff(defs, badgeParams, badgeData); }
defBird: function (defs) { defStuff(defs, birdViewBox, birdData); },
defGlyphs: function (defs) { defStuff(defs, glyphViewBox, glyphData); },
defBadges: function (defs) { defStuff(defs, badgeViewBox, badgeData); }
});
}(ONOS));
......