GUI -- Added "devices" scenario to display all device types.
- added "query" glyph. - added glyphDefined() predicate to glyph service. - made sure query glyph is displayed if a device type for which there is no corresponding glyph is encountered. Change-Id: Id5339ad3b666b885e096ced57760c5f84d8bcfc2
Showing
19 changed files
with
312 additions
and
1 deletions
... | @@ -55,6 +55,15 @@ | ... | @@ -55,6 +55,15 @@ |
55 | unknown: "M35,40a5,5,0,0,1,5-5h30a5,5,0,0,1,5,5v30a5,5,0,0,1-5,5" + | 55 | unknown: "M35,40a5,5,0,0,1,5-5h30a5,5,0,0,1,5,5v30a5,5,0,0,1-5,5" + |
56 | "h-30a5,5,0,0,1-5-5z", | 56 | "h-30a5,5,0,0,1-5-5z", |
57 | 57 | ||
58 | + query: "M51.4,69.9c0-0.9,0-1.6,0-2.1c0-2.7,0.4-5.1,1.2-7.1" + | ||
59 | + "c0.6-1.5,1.5-3,2.8-4.5c0.9-1.1,2.6-2.7,5.1-4.8c2.4-2.1,4-3.8," + | ||
60 | + "4.8-5.1 c0.7-1.3,1.1-2.6,1.1-4.1c0-2.7-1.1-5.1-3.2-7.1c-2.1-2" + | ||
61 | + "-4.8-3.1-7.9-3.1c-3,0-5.5,0.9-7.5,2.8c-2,1.9-3.3,4.8-4,8.7l-7.2" + | ||
62 | + "-0.8 c0.7-5.3,2.6-9.3,5.8-12.1c3.2-2.8,7.5-4.2,12.8-4.2c5.6,0," + | ||
63 | + "10.1,1.5,13.4,4.5c3.3,3,5,6.7,5,10.9c0,2.5-0.6,4.8-1.8,6.8 " + | ||
64 | + "s-3.5,4.6-6.9,7.6c-2.3,2-3.8,3.5-4.5,4.4c-0.7,1-1.2,2-1.6,3.3" + | ||
65 | + "c-0.3,1.2-0.5,3.2-0.6,6H51.4z M51,83.8v-7.9h8v7.9H51z", | ||
66 | + | ||
58 | node: "M15,100a5,5,0,0,1-5-5v-65a5,5,0,0,1,5-5h80a5,5,0,0,1,5,5" + | 67 | node: "M15,100a5,5,0,0,1-5-5v-65a5,5,0,0,1,5-5h80a5,5,0,0,1,5,5" + |
59 | "v65a5,5,0,0,1-5,5zM14,22.5l11-11a10,3,0,0,1,10-2h40a10,3,0,0,1," + | 68 | "v65a5,5,0,0,1-5,5zM14,22.5l11-11a10,3,0,0,1,10-2h40a10,3,0,0,1," + |
60 | "10,2l11,11zM16,35a5,5,0,0,1,10,0a5,5,0,0,1-10,0z", | 69 | "10,2l11,11zM16,35a5,5,0,0,1,10,0a5,5,0,0,1-10,0z", |
... | @@ -586,6 +595,10 @@ | ... | @@ -586,6 +595,10 @@ |
586 | return glyphs.get(id); | 595 | return glyphs.get(id); |
587 | } | 596 | } |
588 | 597 | ||
598 | + function glyphDefined(id) { | ||
599 | + return glyphs.has(id); | ||
600 | + } | ||
601 | + | ||
589 | // Note: defs should be a D3 selection of a single <defs> element | 602 | // Note: defs should be a D3 selection of a single <defs> element |
590 | function loadDefs(defs, glyphIds, noClear) { | 603 | function loadDefs(defs, glyphIds, noClear) { |
591 | var list = fs.isA(glyphIds) || ids(), | 604 | var list = fs.isA(glyphIds) || ids(), |
... | @@ -649,6 +662,7 @@ | ... | @@ -649,6 +662,7 @@ |
649 | registerGlyphSet: registerGlyphSet, | 662 | registerGlyphSet: registerGlyphSet, |
650 | ids: ids, | 663 | ids: ids, |
651 | glyph: glyph, | 664 | glyph: glyph, |
665 | + glyphDefined: glyphDefined, | ||
652 | loadDefs: loadDefs, | 666 | loadDefs: loadDefs, |
653 | addGlyph: addGlyph | 667 | addGlyph: addGlyph |
654 | }; | 668 | }; | ... | ... |
... | @@ -163,6 +163,7 @@ | ... | @@ -163,6 +163,7 @@ |
163 | // Returns the D3 selection of the icon. | 163 | // Returns the D3 selection of the icon. |
164 | function addDeviceIcon(elem, glyphId) { | 164 | function addDeviceIcon(elem, glyphId) { |
165 | var cfg = config.device, | 165 | var cfg = config.device, |
166 | + gid = gs.glyphDefined(glyphId) ? glyphId : 'query', | ||
166 | g = elem.append('g') | 167 | g = elem.append('g') |
167 | .attr('class', 'svgIcon deviceIcon'); | 168 | .attr('class', 'svgIcon deviceIcon'); |
168 | 169 | ||
... | @@ -175,7 +176,7 @@ | ... | @@ -175,7 +176,7 @@ |
175 | }); | 176 | }); |
176 | 177 | ||
177 | g.append('use').attr({ | 178 | g.append('use').attr({ |
178 | - 'xlink:href': '#' + glyphId, | 179 | + 'xlink:href': '#' + gid, |
179 | width: cfg.dim, | 180 | width: cfg.dim, |
180 | height: cfg.dim | 181 | height: cfg.dim |
181 | }); | 182 | }); | ... | ... |
-
Please register or login to post a comment