blob: 243681a91a8721c0b8166a05603ac93accbfc378 [file] [log] [blame]
Simon Huntabf66d92015-04-15 12:57:31 -07001{
2 "defn_name": "layout",
3 "defn_desc": "Sample Layout Sprite Data",
4
5 "_comment": [
Simon Huntb2c4cc82015-04-15 17:16:28 -07006 "Sample sprite layout file, demonstrating user-defined paths",
Simon Huntabf66d92015-04-15 12:57:31 -07007 "(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 Hunt017a7c32015-04-15 19:23:27 -070021 "viewbox": "0 0 1 1",
22 "d": "M0,0h1v1h-1z",
23 "_comment": "path defined in single string"
Simon Huntabf66d92015-04-15 12:57:31 -070024 },
25 {
Simon Hunt017a7c32015-04-15 19:23:27 -070026 "tag": "banner",
27 "viewbox": "0 0 4 8",
Simon Huntabf66d92015-04-15 12:57:31 -070028 "d": [
Simon Hunt017a7c32015-04-15 19:23:27 -070029 "M0,0h4v6l-2,-2l-2,2z",
30 "M1,6h2v2h-2z"
Simon Huntabf66d92015-04-15 12:57:31 -070031 ],
Simon Hunt017a7c32015-04-15 19:23:27 -070032 "_comment": "path defined in multiple strings"
Simon Huntabf66d92015-04-15 12:57:31 -070033 },
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 Hunt017a7c32015-04-15 19:23:27 -070054 " 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 Huntabf66d92015-04-15 12:57:31 -070062 ],
63 "defn": [
64 {
65 "id": "border",
Simon Hunt017a7c32015-04-15 19:23:27 -070066 "path": "border",
67 "dim":[1000,1000]
Simon Huntabf66d92015-04-15 12:57:31 -070068 },
69 {
70 "id": "multi",
71 "path": "multi"
72 },
73 {
74 "id": "small_tri",
75 "path": "triangle",
Simon Huntb2c4cc82015-04-15 17:16:28 -070076 "scale":4
Simon Huntabf66d92015-04-15 12:57:31 -070077 },
78 {
79 "id": "big_tri",
80 "path": "triangle",
Simon Huntb2c4cc82015-04-15 17:16:28 -070081 "scale":12
Simon Huntabf66d92015-04-15 12:57:31 -070082 },
83 {
84 "id": "subnet",
85 "glyph": "cloud",
Simon Huntb2c4cc82015-04-15 17:16:28 -070086 "scale":8,
Simon Huntabf66d92015-04-15 12:57:31 -070087 "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 Hunt017a7c32015-04-15 19:23:27 -0700110 { "id": "border", "class": "gold1" },
Simon Huntabf66d92015-04-15 12:57:31 -0700111 { "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 Huntb2c4cc82015-04-15 17:16:28 -0700114 { "id": "subnet2", "pos":[300,400], "class": "gray1" }
Simon Huntabf66d92015-04-15 12:57:31 -0700115 ],
116 "labels": [
Simon Huntb2c4cc82015-04-15 17:16:28 -0700117 { "pos":[500,850], "text":"Sample Layout", "class":"blue1", "size":1.6 },
118 { "pos":[500,900], "text":"Illustrating Sprites", "class":"gray1" }
Simon Huntabf66d92015-04-15 12:57:31 -0700119 ]
Simon Huntb2c4cc82015-04-15 17:16:28 -0700120 },
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 Huntabf66d92015-04-15 12:57:31 -0700129}