blob: d970af9721cf4c2f86b32ff0b7dce14e91cc550c [file] [log] [blame]
Simon Hunta1028c42017-02-07 20:08:03 -08001/*
2 * Copyright 2017-present Open Networking Laboratory
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17/*
18 * ONOS GUI -- SVG -- Sprite Data Service
19 * Bundled sprite and layout definitions.
20 */
21(function () {
22 'use strict';
23
24 // ----------------------------------------------------------------------
25 // === Sprite Data ===
26
27 var cloud = {
28 // TODO: define cloud sprite...
29 vbox: '0 0 305 186',
30 d: [
31 "M91.2,48.4C121.2,6.3,187.9-13.4,219,45.6",
32 "M43.1,139.6C21.8,142.9-15.6,108.4,26.1,79",
33 "M103.7,150C89,205.2-11.2,167.4,30.5,138",
34 "M192.3,147.3c-33.5,48-82.1,32.3-94.5-8.2",
35 "M267.1,115c27.9,67.8-77.6,74.3-83.1,41",
36 "M34.3,89.9C10.8,79,59.5,10.7,97.2,39.6",
37 "M211.9,34.2c51.9-38.8,118,57.4,59,94.5"
38 ],
39 style: {
40 fill: 'none',
41 'stroke-miterlimit': 10
42 }
43 };
44
45 // TODO: define other core sprites here...
46
47 // ----------------------------------------------------------------------
48 // === API functions ===
49
50 function registerCoreSprites(ssApi) {
51 ssApi.registerSprite(cloud);
52
53 // TODO: add base set of sprites here ...
54
55 // ----------------------------------------------------------$$$
56 // This following code is for initial development of Topo2 sprite layer
57 ssApi.createSprite('rack', 40, 50)
Simon Hunta6ae1212017-03-18 17:58:53 -070058 .addRect(0, 0, 40, 50, {fill: 'gold1'})
Simon Hunta1028c42017-02-07 20:08:03 -080059 .addPath([
60 'M5,20h30v5h-30z',
61 'M5,30h30v5h-30z',
62 'M5,40h30v5h-30z'
Simon Hunta6ae1212017-03-18 17:58:53 -070063 ], {stroke: 'gray1'})
Simon Hunta1028c42017-02-07 20:08:03 -080064 .register();
65
66 ssApi.createLayout('segmentRouting', 130, 75)
67 .addSprite('rack', 10, 40, 20)
68 .addSprite('rack', 40, 40, 20)
69 .addSprite('rack', 70, 40, 20)
70 .addSprite('rack', 100, 40, 20)
71 .addLabel('Segment Routing', 120, 10, {anchor: 'right'})
72 .register();
73
Simon Huntc4ca7102017-04-08 22:28:04 -070074 ssApi.createLayout('segmentRoutingTwo', 70, 75)
75 .addSprite('rack', 10, 40, 20)
76 .addSprite('rack', 40, 40, 20)
77 .addLabel('Segment Routing 2', 120, 10, {anchor: 'right'})
78 .register();
79
Simon Hunt0ee20bf2017-05-10 19:59:17 -070080 ssApi.createLayout('plain', 80, 60)
81 .register();
82
Simon Hunta1028c42017-02-07 20:08:03 -080083 ssApi.dump();
84 // ----------------------------------------------------------$$$
85 }
86
87 // ----------------------------------------------------------------------
88
89 angular.module('onosSvg')
90 .factory('SpriteDataService', [
91 function () {
92 return {
93 registerCoreSprites: registerCoreSprites
94 };
95 }
96 ]);
97
98}());