Simon Hunt | abf66d9 | 2015-04-15 12:57:31 -0700 | [diff] [blame] | 1 | { |
| 2 | "defn_name": "layout", |
| 3 | "defn_desc": "Sample Layout Sprite Data", |
| 4 | |
| 5 | "_comment": [ |
Simon Hunt | b2c4cc8 | 2015-04-15 17:16:28 -0700 | [diff] [blame] | 6 | "Sample sprite layout file, demonstrating user-defined paths", |
Simon Hunt | abf66d9 | 2015-04-15 12:57:31 -0700 | [diff] [blame] | 7 | "(1) Register on the server with ...", |
| 8 | " onos-upload-sprites localhost layout.json", |
| 9 | "(2) Load into topology view with ...", |
| 10 | " http://localhost:8181/onos/ui/index.html#/topo?sprites=layout" |
| 11 | ], |
| 12 | |
| 13 | "_comment_paths": [ |
| 14 | "The 'paths' array contains custom path data.", |
| 15 | "Note that viewbox defaults to [0 0 1000 1000], which is the logical", |
| 16 | "coordinate space of the topology view." |
| 17 | ], |
| 18 | "paths": [ |
| 19 | { |
| 20 | "tag": "border", |
Simon Hunt | 017a7c3 | 2015-04-15 19:23:27 -0700 | [diff] [blame] | 21 | "viewbox": "0 0 1 1", |
| 22 | "d": "M0,0h1v1h-1z", |
| 23 | "_comment": "path defined in single string" |
Simon Hunt | abf66d9 | 2015-04-15 12:57:31 -0700 | [diff] [blame] | 24 | }, |
| 25 | { |
Simon Hunt | 017a7c3 | 2015-04-15 19:23:27 -0700 | [diff] [blame] | 26 | "tag": "banner", |
| 27 | "viewbox": "0 0 4 8", |
Simon Hunt | abf66d9 | 2015-04-15 12:57:31 -0700 | [diff] [blame] | 28 | "d": [ |
Simon Hunt | 017a7c3 | 2015-04-15 19:23:27 -0700 | [diff] [blame] | 29 | "M0,0h4v6l-2,-2l-2,2z", |
| 30 | "M1,6h2v2h-2z" |
Simon Hunt | abf66d9 | 2015-04-15 12:57:31 -0700 | [diff] [blame] | 31 | ], |
Simon Hunt | 017a7c3 | 2015-04-15 19:23:27 -0700 | [diff] [blame] | 32 | "_comment": "path defined in multiple strings" |
Simon Hunt | abf66d9 | 2015-04-15 12:57:31 -0700 | [diff] [blame] | 33 | }, |
| 34 | { |
| 35 | "tag": "triangle", |
| 36 | "viewbox": "0 0 1 1", |
| 37 | "d": "M.5,.2l.3,.6,h-.6z", |
| 38 | "_comment": "defines its own viewbox" |
| 39 | }, |
| 40 | { |
| 41 | "tag": "diamond", |
| 42 | "viewbox": "0 0 1 1", |
| 43 | "d": "M.2,.5l.3,-.3l.3,.3l-.3,.3z" |
| 44 | } |
| 45 | ], |
| 46 | |
| 47 | "_comment_defn": [ |
| 48 | "The 'defn' array contains sprite definitions that combine", |
| 49 | "path, dimensions, and label-offset into 'sprites' that can be", |
| 50 | "replicated (stamped) in different positions in the view.", |
| 51 | "", |
| 52 | "The 'glyph' property refers to glyphs registered with the UI.", |
| 53 | "Alternatively, the 'path' property refers to a custom path defined in", |
Simon Hunt | 017a7c3 | 2015-04-15 19:23:27 -0700 | [diff] [blame] | 54 | " the path array above.", |
| 55 | "The 'dim' property provides the [width,height] bounds within which the", |
| 56 | " glyph/path is drawn. (default is [40,40])", |
| 57 | "The 'labelyoff' property defines the Y-offset of the label as a", |
| 58 | " percentage from the top of the sprite; for example, 0.4 = 40%. The", |
| 59 | " label is centered horizontally.", |
| 60 | "The 'scale' property (default is 1) defines the scaling factor, which", |
| 61 | " is applied after the sprite has been translated to its position." |
Simon Hunt | abf66d9 | 2015-04-15 12:57:31 -0700 | [diff] [blame] | 62 | ], |
| 63 | "defn": [ |
| 64 | { |
| 65 | "id": "border", |
Simon Hunt | 017a7c3 | 2015-04-15 19:23:27 -0700 | [diff] [blame] | 66 | "path": "border", |
| 67 | "dim":[1000,1000] |
Simon Hunt | abf66d9 | 2015-04-15 12:57:31 -0700 | [diff] [blame] | 68 | }, |
| 69 | { |
| 70 | "id": "multi", |
| 71 | "path": "multi" |
| 72 | }, |
| 73 | { |
| 74 | "id": "small_tri", |
| 75 | "path": "triangle", |
Simon Hunt | b2c4cc8 | 2015-04-15 17:16:28 -0700 | [diff] [blame] | 76 | "scale":4 |
Simon Hunt | abf66d9 | 2015-04-15 12:57:31 -0700 | [diff] [blame] | 77 | }, |
| 78 | { |
| 79 | "id": "big_tri", |
| 80 | "path": "triangle", |
Simon Hunt | b2c4cc8 | 2015-04-15 17:16:28 -0700 | [diff] [blame] | 81 | "scale":12 |
Simon Hunt | abf66d9 | 2015-04-15 12:57:31 -0700 | [diff] [blame] | 82 | }, |
| 83 | { |
| 84 | "id": "subnet", |
| 85 | "glyph": "cloud", |
Simon Hunt | b2c4cc8 | 2015-04-15 17:16:28 -0700 | [diff] [blame] | 86 | "scale":8, |
Simon Hunt | abf66d9 | 2015-04-15 12:57:31 -0700 | [diff] [blame] | 87 | "labelyoff": 0.4 |
| 88 | }, |
| 89 | { |
| 90 | "id": "subnet2", |
| 91 | "glyph": "cloud", |
| 92 | "dim":[200,200], |
| 93 | "labelyoff": 0.4 |
| 94 | } |
| 95 | ], |
| 96 | |
| 97 | "_comment_load": [ |
| 98 | "The 'load' object contains sprites and labels to load into the view.", |
| 99 | "", |
| 100 | "Items in the sprite list associate sprites with a position,", |
| 101 | "style class, and optional label. Note that the coordinates of", |
| 102 | "the position define the top-left corner of the sprite.", |
| 103 | "Default 'pos' is [0,0]. Default 'class' is 'gray1'.", |
| 104 | "", |
| 105 | "Items in the label list associate labels with a position and", |
| 106 | "style class. Note that the text is centered on the x-coordinate." |
| 107 | ], |
| 108 | "load": { |
| 109 | "sprites": [ |
Simon Hunt | 017a7c3 | 2015-04-15 19:23:27 -0700 | [diff] [blame] | 110 | { "id": "border", "class": "gold1" }, |
Simon Hunt | abf66d9 | 2015-04-15 12:57:31 -0700 | [diff] [blame] | 111 | { "id": "subnet", "pos":[-40,20], "label":"apples", "class": "blue1" }, |
| 112 | { "id": "subnet", "pos":[400,40], "label":"bananas", "class": "blue1" }, |
| 113 | { "id": "subnet", "pos":[840,60], "label":"cherries", "class": "blue1" }, |
Simon Hunt | b2c4cc8 | 2015-04-15 17:16:28 -0700 | [diff] [blame] | 114 | { "id": "subnet2", "pos":[300,400], "class": "gray1" } |
Simon Hunt | abf66d9 | 2015-04-15 12:57:31 -0700 | [diff] [blame] | 115 | ], |
| 116 | "labels": [ |
Simon Hunt | b2c4cc8 | 2015-04-15 17:16:28 -0700 | [diff] [blame] | 117 | { "pos":[500,850], "text":"Sample Layout", "class":"blue1", "size":1.6 }, |
| 118 | { "pos":[500,900], "text":"Illustrating Sprites", "class":"gray1" } |
Simon Hunt | abf66d9 | 2015-04-15 12:57:31 -0700 | [diff] [blame] | 119 | ] |
Simon Hunt | b2c4cc8 | 2015-04-15 17:16:28 -0700 | [diff] [blame] | 120 | }, |
| 121 | "junk":[ |
| 122 | { "id": "border" }, |
| 123 | { "id": "multi", "class": "gray1" }, |
| 124 | { "id": "small_tri", "pos":[10, 20] }, |
| 125 | { "id": "small_tri", "pos":[110, 20] }, |
| 126 | { "id": "small_tri", "pos":[210, 20] }, |
| 127 | { "id": "small_tri", "pos":[310, 20] } |
| 128 | ] |
Simon Hunt | abf66d9 | 2015-04-15 12:57:31 -0700 | [diff] [blame] | 129 | } |