UNPKG

278 kBJavaScriptView Raw
1/*
2* Copyright (C) 1998-2021 by Northwoods Software Corporation. All Rights Reserved.
3*/
4// This file holds definitions of all standard shape figures -- string values for Shape.figure.
5// You do not need to load this file in order to use named Shape figure.
6// The following figures are built-in to the go.js library and thus do not need to be redefined:
7// Rectangle, Square, RoundedRectangle, Border, Ellipse, Circle,
8// TriangleRight, TriangleDown, TriangleLeft, TriangleUp, Triangle,
9// LineH, LineV, None, BarH, BarV, MinusLine, PlusLine, XLine
10// If you need any of the other figures that are defined in this file, we suggest that you copy
11// just those definitions into your own code. Do not load this file unless you really want to
12// define a lot of code that your app does not use and will not get garbage-collected.
13import * as go from '../release/go-module.js';
14// The following functions and variables are used throughout this file:
15/**
16 * @hidden @internal
17 * This FigureParameter class describes various properties each parameter uses in figures.
18 */
19export class FigureParameter {
20 constructor(name, def, min, max) {
21 if (min === undefined)
22 min = 0.0;
23 if (max === undefined)
24 max = Infinity;
25 this._name = name;
26 this._defaultValue = def;
27 this._minimum = min;
28 this._maximum = max;
29 // (go.Shape as any)['_FigureParameters'] = {};
30 }
31 /**
32 * Gets or sets the name of the figure.
33 */
34 get name() { return this._name; }
35 set name(val) {
36 if (typeof val !== 'string' || val === '')
37 throw new Error('Shape name must be a valid string.');
38 this._name = val;
39 }
40 /**
41 * Gets or sets the default value for the parameter.
42 */
43 get defaultValue() { return this._defaultValue; }
44 set defaultValue(val) {
45 if (typeof val !== 'number' || isNaN(val))
46 throw new Error('The default value must be a real number, not: ' + val);
47 this._defaultValue = val;
48 }
49 /**
50 * Gets or sets the minimum value allowed for the figure parameter.
51 */
52 get minimum() { return this._minimum; }
53 set minimum(val) {
54 if (typeof val !== 'number' || isNaN(val))
55 throw new Error('Minimum must be a real number, not: ' + val);
56 this._minimum = val;
57 }
58 /**
59 * Gets or sets the maximum value allowed for the figure parameter.
60 */
61 get maximum() { return this._maximum; }
62 set maximum(val) {
63 if (typeof val !== 'number' || isNaN(val))
64 throw new Error('Maximum must be a real number, not: ' + val);
65 this._maximum = val;
66 }
67 /**
68 * This static function gets a FigureParameter for a particular figure name.
69 * @param {String} figurename
70 * @param {number} index, currently must be either 0 or 1
71 * @return {FigureParameter}
72 */
73 static getFigureParameter(figurename, index) {
74 // const arr = (go.Shape as any)['_FigureParameters'][figurename];
75 const arr = FigureParameter.definedParameters[figurename];
76 if (!arr)
77 return null;
78 return arr[index];
79 }
80 /**
81 * This static function sets a FigureParameter for a particular figure name.
82 * @param {String} figurename
83 * @param {number} index, currently must be either 0 or 1
84 * @param {FigureParameter} figparam
85 */
86 static setFigureParameter(figurename, index, figparam) {
87 if (!(figparam instanceof FigureParameter))
88 throw new Error('Third argument to FigureParameter.setFigureParameter is not FigureParameter: ' + figparam);
89 if (figparam.defaultValue < figparam.minimum || figparam.defaultValue > figparam.maximum) {
90 throw new Error('defaultValue must be between minimum and maximum, not: ' + figparam.defaultValue);
91 }
92 // const paramObj = (go.Shape as any)['_FigureParameters'];
93 // let arr = paramObj[figurename];
94 let arr = FigureParameter.definedParameters[figurename];
95 if (!arr) {
96 // arr = [];
97 // paramObj[figurename] = arr;
98 arr = [];
99 FigureParameter.definedParameters[figurename] = arr;
100 }
101 arr[index] = figparam;
102 }
103}
104FigureParameter.definedParameters = {};
105/** @ignore */
106const _CachedPoints = [];
107/**
108 * @ignore
109 * @param {number} x
110 * @param {number} y
111 * @return {Point}
112 */
113function tempPointAt(x, y) {
114 const temp = _CachedPoints.pop();
115 if (temp === undefined)
116 return new go.Point(x, y);
117 temp.x = x;
118 temp.y = y;
119 return temp;
120}
121/**
122 * @ignore
123 * @return {Point}
124 */
125function tempPoint() {
126 const temp = _CachedPoints.pop();
127 if (temp === undefined)
128 return new go.Point();
129 return temp;
130}
131/**
132 * @ignore
133 * @param {Point} temp
134 */
135function freePoint(temp) {
136 _CachedPoints.push(temp);
137}
138/**
139 * @ignore
140 * @param {number} p1x
141 * @param {number} p1y
142 * @param {number} p2x
143 * @param {number} p2y
144 * @param {number} q1x
145 * @param {number} q1y
146 * @param {number} q2x
147 * @param {number} q2y
148 * @param {Point} result
149 * @return {Point}
150 */
151function getIntersection(p1x, p1y, p2x, p2y, q1x, q1y, q2x, q2y, result) {
152 const dx1 = p1x - p2x;
153 const dx2 = q1x - q2x;
154 let x;
155 let y;
156 if (dx1 === 0 || dx2 === 0) {
157 if (dx1 === 0) {
158 const m2 = (q1y - q2y) / dx2;
159 const b2 = q1y - m2 * q1x;
160 x = p1x;
161 y = m2 * x + b2;
162 }
163 else {
164 const m1 = (p1y - p2y) / dx1;
165 const b1 = p1y - m1 * p1x;
166 x = q1x;
167 y = m1 * x + b1;
168 }
169 }
170 else {
171 const m1 = (p1y - p2y) / dx1;
172 const m2 = (q1y - q2y) / dx2;
173 const b1 = p1y - m1 * p1x;
174 const b2 = q1y - m2 * q1x;
175 x = (b2 - b1) / (m1 - m2);
176 y = m1 * x + b1;
177 }
178 result.x = x;
179 result.y = y;
180 return result;
181}
182/**
183 * @ignore
184 * @param {number} startx
185 * @param {number} starty
186 * @param {number} c1x
187 * @param {number} c1y
188 * @param {number} c2x
189 * @param {number} c2y
190 * @param {number} endx
191 * @param {number} endy
192 * @param {number} fraction
193 * @param {Point} curve1cp1 // modified result control point
194 * @param {Point} curve1cp2 // modified result control point
195 * @param {Point} midpoint // modified result
196 * @param {Point} curve2cp1 // modified result control point
197 * @param {Point} curve2cp2 // modified result control point
198 */
199function breakUpBezier(startx, starty, c1x, c1y, c2x, c2y, endx, endy, fraction, curve1cp1, curve1cp2, midpoint, curve2cp1, curve2cp2) {
200 const fo = 1 - fraction;
201 const so = fraction;
202 const m1x = (startx * fo + c1x * so);
203 const m1y = (starty * fo + c1y * so);
204 const m2x = (c1x * fo + c2x * so);
205 const m2y = (c1y * fo + c2y * so);
206 const m3x = (c2x * fo + endx * so);
207 const m3y = (c2y * fo + endy * so);
208 const m12x = (m1x * fo + m2x * so);
209 const m12y = (m1y * fo + m2y * so);
210 const m23x = (m2x * fo + m3x * so);
211 const m23y = (m2y * fo + m3y * so);
212 const m123x = (m12x * fo + m23x * so);
213 const m123y = (m12y * fo + m23y * so);
214 curve1cp1.x = m1x;
215 curve1cp1.y = m1y;
216 curve1cp2.x = m12x;
217 curve1cp2.y = m12y;
218 midpoint.x = m123x;
219 midpoint.y = m123y;
220 curve2cp1.x = m23x;
221 curve2cp1.y = m23y;
222 curve2cp2.x = m3x;
223 curve2cp2.y = m3y;
224}
225const GeneratorEllipseSpot1 = new go.Spot(0.156, 0.156);
226const GeneratorEllipseSpot2 = new go.Spot(0.844, 0.844);
227const KAPPA = 4 * ((Math.sqrt(2) - 1) / 3);
228// PREDEFINED figures, built into the v2.0 library:
229// These first few are commented out due to optimizations in the built-in definitions.
230//go.Shape.defineFigureGenerator('Rectangle', (shape, w, h) => { // predefined in 2.0
231// const geo = new go.Geometry(go.Geometry.Rectangle);
232// geo.startX = 0;
233// geo.startY = 0;
234// geo.endX = w;
235// geo.endY = h;
236// return geo;
237//});
238//go.Shape.defineFigureGenerator('Square', (shape, w, h) => { // predefined in 2.0
239// const geo = new go.Geometry(go.Geometry.Rectangle);
240// geo.startX = 0;
241// geo.startY = 0;
242// geo.endX = w;
243// geo.endY = h;
244// geo.defaultStretch = go.GraphObject.Uniform;
245// return geo;
246//});
247FigureParameter.setFigureParameter('RoundedRectangle', 0, new FigureParameter('CornerRounding', 5));
248go.Shape.defineFigureGenerator('RoundedRectangle', (shape, w, h) => {
249 let param1 = shape ? shape.parameter1 : NaN;
250 if (isNaN(param1) || param1 < 0)
251 param1 = 5; // default corner
252 param1 = Math.min(param1, w / 3);
253 param1 = Math.min(param1, h / 3);
254 const cpOffset = param1 * KAPPA;
255 const geo = new go.Geometry()
256 .add(new go.PathFigure(param1, 0, true)
257 .add(new go.PathSegment(go.PathSegment.Line, w - param1, 0))
258 .add(new go.PathSegment(go.PathSegment.Bezier, w, param1, w - cpOffset, 0, w, cpOffset))
259 .add(new go.PathSegment(go.PathSegment.Line, w, h - param1))
260 .add(new go.PathSegment(go.PathSegment.Bezier, w - param1, h, w, h - cpOffset, w - cpOffset, h))
261 .add(new go.PathSegment(go.PathSegment.Line, param1, h))
262 .add(new go.PathSegment(go.PathSegment.Bezier, 0, h - param1, cpOffset, h, 0, h - cpOffset))
263 .add(new go.PathSegment(go.PathSegment.Line, 0, param1))
264 .add(new go.PathSegment(go.PathSegment.Bezier, param1, 0, 0, cpOffset, cpOffset, 0).close()));
265 if (cpOffset > 1) {
266 geo.spot1 = new go.Spot(0, 0, cpOffset, cpOffset);
267 geo.spot2 = new go.Spot(1, 1, -cpOffset, -cpOffset);
268 }
269 return geo;
270});
271go.Shape.defineFigureGenerator('Border', 'RoundedRectangle'); // predefined in 2.0
272//go.Shape.defineFigureGenerator('Ellipse', (shape, w, h) => { // predefined in 2.0
273// const geo = new go.Geometry(go.Geometry.Ellipse);
274// geo.startX = 0;
275// geo.startY = 0;
276// geo.endX = w;
277// geo.endY = h;
278// geo.spot1 = GeneratorEllipseSpot1;
279// geo.spot2 = GeneratorEllipseSpot2;
280// return geo;
281//});
282//go.Shape.defineFigureGenerator('Circle', (shape, w, h) => { // predefined in 2.0
283// const geo = new go.Geometry(go.Geometry.Ellipse);
284// geo.startX = 0;
285// geo.startY = 0;
286// geo.endX = w;
287// geo.endY = h;
288// geo.spot1 = GeneratorEllipseSpot1;
289// geo.spot2 = GeneratorEllipseSpot2;
290// geo.defaultStretch = go.GraphObject.Uniform;
291// return geo;
292//});
293go.Shape.defineFigureGenerator('TriangleRight', (shape, w, h) => {
294 return new go.Geometry()
295 .add(new go.PathFigure(0, 0)
296 .add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h))
297 .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()))
298 .setSpots(0, 0.25, 0.5, 0.75);
299});
300go.Shape.defineFigureGenerator('TriangleDown', (shape, w, h) => {
301 return new go.Geometry()
302 .add(new go.PathFigure(0, 0)
303 .add(new go.PathSegment(go.PathSegment.Line, w, 0))
304 .add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h).close()))
305 .setSpots(0.25, 0, 0.75, 0.5);
306});
307go.Shape.defineFigureGenerator('TriangleLeft', (shape, w, h) => {
308 return new go.Geometry()
309 .add(new go.PathFigure(w, h)
310 .add(new go.PathSegment(go.PathSegment.Line, 0, 0.5 * h))
311 .add(new go.PathSegment(go.PathSegment.Line, w, 0).close()))
312 .setSpots(0.5, 0.25, 1, 0.75);
313});
314go.Shape.defineFigureGenerator('TriangleUp', (shape, w, h) => {
315 return new go.Geometry()
316 .add(new go.PathFigure(w, h)
317 .add(new go.PathSegment(go.PathSegment.Line, 0, h))
318 .add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0).close()))
319 .setSpots(0.25, 0.5, 0.75, 1);
320});
321go.Shape.defineFigureGenerator('Triangle', 'TriangleUp'); // predefined in 2.0
322go.Shape.defineFigureGenerator('Diamond', (shape, w, h) => {
323 return new go.Geometry()
324 .add(new go.PathFigure(0.5 * w, 0)
325 .add(new go.PathSegment(go.PathSegment.Line, 0, 0.5 * h))
326 .add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h))
327 .add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h).close()))
328 .setSpots(0.25, 0.25, 0.75, 0.75);
329});
330go.Shape.defineFigureGenerator('LineH', (shape, w, h) => {
331 const geo = new go.Geometry(go.Geometry.Line);
332 geo.startX = 0;
333 geo.startY = h / 2;
334 geo.endX = w;
335 geo.endY = h / 2;
336 return geo;
337});
338go.Shape.defineFigureGenerator('LineV', (shape, w, h) => {
339 const geo = new go.Geometry(go.Geometry.Line);
340 geo.startX = w / 2;
341 geo.startY = 0;
342 geo.endX = w / 2;
343 geo.endY = h;
344 return geo;
345});
346go.Shape.defineFigureGenerator('BarH', 'Rectangle'); // predefined in 2.0
347go.Shape.defineFigureGenerator('BarV', 'Rectangle'); // predefined in 2.0
348go.Shape.defineFigureGenerator('MinusLine', 'LineH'); // predefined in 2.0
349go.Shape.defineFigureGenerator('PlusLine', (shape, w, h) => {
350 return new go.Geometry()
351 .add(new go.PathFigure(0, h / 2, false)
352 .add(new go.PathSegment(go.PathSegment.Line, w, h / 2))
353 .add(new go.PathSegment(go.PathSegment.Move, w / 2, 0))
354 .add(new go.PathSegment(go.PathSegment.Line, w / 2, h)));
355});
356go.Shape.defineFigureGenerator('XLine', (shape, w, h) => {
357 return new go.Geometry()
358 .add(new go.PathFigure(0, h, false)
359 .add(new go.PathSegment(go.PathSegment.Line, w, 0))
360 .add(new go.PathSegment(go.PathSegment.Move, 0, 0))
361 .add(new go.PathSegment(go.PathSegment.Line, w, h)));
362});
363// OPTIONAL figures, not predefined in the v2.0 library:
364go.Shape.defineFigureGenerator('AsteriskLine', (shape, w, h) => {
365 const offset = .2 / Math.SQRT2;
366 return new go.Geometry()
367 .add(new go.PathFigure(offset * w, (1 - offset) * h, false)
368 .add(new go.PathSegment(go.PathSegment.Line, (1 - offset) * w, offset * h))
369 .add(new go.PathSegment(go.PathSegment.Move, offset * w, offset * h))
370 .add(new go.PathSegment(go.PathSegment.Line, (1 - offset) * w, (1 - offset) * h))
371 .add(new go.PathSegment(go.PathSegment.Move, 0, h / 2))
372 .add(new go.PathSegment(go.PathSegment.Line, w, h / 2))
373 .add(new go.PathSegment(go.PathSegment.Move, w / 2, 0))
374 .add(new go.PathSegment(go.PathSegment.Line, w / 2, h)));
375});
376go.Shape.defineFigureGenerator('CircleLine', (shape, w, h) => {
377 const rad = w / 2;
378 const geo = new go.Geometry()
379 .add(new go.PathFigure(w, w / 2, false) // clockwise
380 .add(new go.PathSegment(go.PathSegment.Arc, 0, 360, rad, rad, rad, rad).close()));
381 geo.spot1 = GeneratorEllipseSpot1;
382 geo.spot2 = GeneratorEllipseSpot2;
383 geo.defaultStretch = go.GraphObject.Uniform;
384 return geo;
385});
386go.Shape.defineFigureGenerator('Line1', (shape, w, h) => {
387 const geo = new go.Geometry(go.Geometry.Line);
388 geo.startX = 0;
389 geo.startY = 0;
390 geo.endX = w;
391 geo.endY = h;
392 return geo;
393});
394go.Shape.defineFigureGenerator('Line2', (shape, w, h) => {
395 const geo = new go.Geometry(go.Geometry.Line);
396 geo.startX = w;
397 geo.startY = 0;
398 geo.endX = 0;
399 geo.endY = h;
400 return geo;
401});
402go.Shape.defineFigureGenerator('Curve1', (shape, w, h) => {
403 return new go.Geometry()
404 .add(new go.PathFigure(0, 0, false)
405 .add(new go.PathSegment(go.PathSegment.Bezier, w, h, KAPPA * w, 0, w, (1 - KAPPA) * h)));
406});
407go.Shape.defineFigureGenerator('Curve2', (shape, w, h) => {
408 return new go.Geometry()
409 .add(new go.PathFigure(0, 0, false)
410 .add(new go.PathSegment(go.PathSegment.Bezier, w, h, 0, KAPPA * h, (1 - KAPPA) * w, h)));
411});
412go.Shape.defineFigureGenerator('Curve3', (shape, w, h) => {
413 return new go.Geometry()
414 .add(new go.PathFigure(w, 0, false)
415 .add(new go.PathSegment(go.PathSegment.Bezier, 0, h, w, KAPPA * h, KAPPA * w, h)));
416});
417go.Shape.defineFigureGenerator('Curve4', (shape, w, h) => {
418 return new go.Geometry()
419 .add(new go.PathFigure(w, 0, false)
420 .add(new go.PathSegment(go.PathSegment.Bezier, 0, h, (1 - KAPPA) * w, 0, 0, (1 - KAPPA) * h)));
421});
422go.Shape.defineFigureGenerator('TriangleDownLeft', (shape, w, h) => {
423 return new go.Geometry()
424 .add(new go.PathFigure(0, 0, true)
425 .add(new go.PathSegment(go.PathSegment.Line, w, h))
426 .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()))
427 .setSpots(0, 0.5, 0.5, 1);
428});
429go.Shape.defineFigureGenerator('TriangleDownRight', (shape, w, h) => {
430 return new go.Geometry()
431 .add(new go.PathFigure(w, 0, true)
432 .add(new go.PathSegment(go.PathSegment.Line, w, h))
433 .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()))
434 .setSpots(0.5, 0.5, 1, 1);
435});
436go.Shape.defineFigureGenerator('TriangleUpLeft', (shape, w, h) => {
437 return new go.Geometry()
438 .add(new go.PathFigure(0, 0, true)
439 .add(new go.PathSegment(go.PathSegment.Line, w, 0))
440 .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()))
441 .setSpots(0, 0, 0.5, 0.5);
442});
443go.Shape.defineFigureGenerator('TriangleUpRight', (shape, w, h) => {
444 return new go.Geometry()
445 .add(new go.PathFigure(0, 0, true)
446 .add(new go.PathSegment(go.PathSegment.Line, w, 0))
447 .add(new go.PathSegment(go.PathSegment.Line, w, h).close()))
448 .setSpots(0.5, 0, 1, 0.5);
449});
450go.Shape.defineFigureGenerator('RightTriangle', 'TriangleDownLeft');
451FigureParameter.setFigureParameter('Parallelogram1', 0, new FigureParameter('Indent', .1, -.99, .99));
452go.Shape.defineFigureGenerator('Parallelogram1', (shape, w, h) => {
453 let param1 = shape ? shape.parameter1 : NaN; // indent's percent distance
454 if (isNaN(param1))
455 param1 = 0.1;
456 else if (param1 < -1)
457 param1 = -1;
458 else if (param1 > 1)
459 param1 = 1;
460 const indent = Math.abs(param1) * w;
461 if (param1 === 0) {
462 const geo = new go.Geometry(go.Geometry.Rectangle);
463 geo.startX = 0;
464 geo.startY = 0;
465 geo.endX = w;
466 geo.endY = h;
467 return geo;
468 }
469 else {
470 const geo = new go.Geometry();
471 if (param1 > 0) {
472 geo.add(new go.PathFigure(indent, 0)
473 .add(new go.PathSegment(go.PathSegment.Line, w, 0))
474 .add(new go.PathSegment(go.PathSegment.Line, w - indent, h))
475 .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()));
476 }
477 else { // param1 < 0
478 geo.add(new go.PathFigure(0, 0)
479 .add(new go.PathSegment(go.PathSegment.Line, w - indent, 0))
480 .add(new go.PathSegment(go.PathSegment.Line, w, h))
481 .add(new go.PathSegment(go.PathSegment.Line, indent, h).close()));
482 }
483 if (indent < w / 2) {
484 geo.setSpots(indent / w, 0, (w - indent) / w, 1);
485 }
486 return geo;
487 }
488});
489go.Shape.defineFigureGenerator('Parallelogram', 'Parallelogram1'); // alias
490// Parallelogram with absolutes instead of scaling
491FigureParameter.setFigureParameter('Parallelogram2', 0, new FigureParameter('Indent', 10, -Infinity, Infinity));
492go.Shape.defineFigureGenerator('Parallelogram2', (shape, w, h) => {
493 let param1 = shape ? shape.parameter1 : NaN; // indent's x distance
494 if (isNaN(param1))
495 param1 = 10;
496 else if (param1 < -1)
497 param1 = -w;
498 else if (param1 > 1)
499 param1 = w;
500 const indent = Math.abs(param1);
501 if (param1 === 0) {
502 const geo = new go.Geometry(go.Geometry.Rectangle);
503 geo.startX = 0;
504 geo.startY = 0;
505 geo.endX = w;
506 geo.endY = h;
507 return geo;
508 }
509 else {
510 const geo = new go.Geometry();
511 if (param1 > 0) {
512 geo.add(new go.PathFigure(indent, 0)
513 .add(new go.PathSegment(go.PathSegment.Line, w, 0))
514 .add(new go.PathSegment(go.PathSegment.Line, w - indent, h))
515 .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()));
516 }
517 else { // param1 < 0
518 geo.add(new go.PathFigure(0, 0)
519 .add(new go.PathSegment(go.PathSegment.Line, w - indent, 0))
520 .add(new go.PathSegment(go.PathSegment.Line, w, h))
521 .add(new go.PathSegment(go.PathSegment.Line, indent, h).close()));
522 }
523 if (indent < w / 2) {
524 geo.setSpots(indent / w, 0, (w - indent) / w, 1);
525 }
526 return geo;
527 }
528});
529FigureParameter.setFigureParameter('Trapezoid1', 0, new FigureParameter('Indent', .2, -.99, .99));
530go.Shape.defineFigureGenerator('Trapezoid1', (shape, w, h) => {
531 let param1 = shape ? shape.parameter1 : NaN; // indent's percent distance
532 if (isNaN(param1))
533 param1 = 0.2;
534 else if (param1 < 0.5)
535 param1 = -0.5;
536 else if (param1 > 0.5)
537 param1 = 0.5;
538 const indent = Math.abs(param1) * w;
539 if (param1 === 0) {
540 const geo = new go.Geometry(go.Geometry.Rectangle);
541 geo.startX = 0;
542 geo.startY = 0;
543 geo.endX = w;
544 geo.endY = h;
545 return geo;
546 }
547 else {
548 const geo = new go.Geometry();
549 if (param1 > 0) {
550 geo.add(new go.PathFigure(indent, 0)
551 .add(new go.PathSegment(go.PathSegment.Line, w - indent, 0))
552 .add(new go.PathSegment(go.PathSegment.Line, w, h))
553 .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()));
554 }
555 else { // param1 < 0
556 geo.add(new go.PathFigure(0, 0)
557 .add(new go.PathSegment(go.PathSegment.Line, w, 0))
558 .add(new go.PathSegment(go.PathSegment.Line, w - indent, h))
559 .add(new go.PathSegment(go.PathSegment.Line, indent, h).close()));
560 }
561 if (indent < w / 2) {
562 geo.setSpots(indent / w, 0, (w - indent) / w, 1);
563 }
564 return geo;
565 }
566});
567go.Shape.defineFigureGenerator('Trapezoid', 'Trapezoid1'); // alias
568// Trapezoid with absolutes instead of scaling
569FigureParameter.setFigureParameter('Trapezoid2', 0, new FigureParameter('Indent', 20, -Infinity, Infinity));
570go.Shape.defineFigureGenerator('Trapezoid2', (shape, w, h) => {
571 let param1 = shape ? shape.parameter1 : NaN; // indent's x distance
572 if (isNaN(param1))
573 param1 = 20; // default value
574 else if (param1 < -w)
575 param1 = -w / 2;
576 else if (param1 > w)
577 param1 = w / 2;
578 const indent = Math.abs(param1);
579 if (param1 === 0) {
580 const geo = new go.Geometry(go.Geometry.Rectangle);
581 geo.startX = 0;
582 geo.startY = 0;
583 geo.endX = w;
584 geo.endY = h;
585 return geo;
586 }
587 else {
588 const geo = new go.Geometry();
589 if (param1 > 0) {
590 geo.add(new go.PathFigure(indent, 0)
591 .add(new go.PathSegment(go.PathSegment.Line, w - indent, 0))
592 .add(new go.PathSegment(go.PathSegment.Line, w, h))
593 .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()));
594 }
595 else { // param1 < 0
596 geo.add(new go.PathFigure(0, 0)
597 .add(new go.PathSegment(go.PathSegment.Line, w, 0))
598 .add(new go.PathSegment(go.PathSegment.Line, w - indent, h))
599 .add(new go.PathSegment(go.PathSegment.Line, indent, h).close()));
600 }
601 if (indent < w / 2) {
602 geo.setSpots(indent / w, 0, (w - indent) / w, 1);
603 }
604 return geo;
605 }
606});
607FigureParameter.setFigureParameter('ManualOperation', 0, new FigureParameter('Indent', 10, -Infinity, Infinity));
608go.Shape.defineFigureGenerator('ManualOperation', (shape, w, h) => {
609 let param1 = shape ? shape.parameter1 : NaN;
610 // Distance from topleft of bounding rectangle,
611 // in % of the total width, of the topleft corner
612 if (isNaN(param1))
613 param1 = 10; // default value
614 else if (param1 < -w)
615 param1 = -w / 2;
616 else if (param1 > w)
617 param1 = w / 2;
618 const indent = Math.abs(param1);
619 if (param1 === 0) {
620 const geo = new go.Geometry(go.Geometry.Rectangle);
621 geo.startX = 0;
622 geo.startY = 0;
623 geo.endX = w;
624 geo.endY = h;
625 return geo;
626 }
627 else {
628 const geo = new go.Geometry();
629 if (param1 > 0) {
630 geo.add(new go.PathFigure(0, 0)
631 .add(new go.PathSegment(go.PathSegment.Line, w, 0))
632 .add(new go.PathSegment(go.PathSegment.Line, w - indent, h))
633 .add(new go.PathSegment(go.PathSegment.Line, indent, h).close()));
634 }
635 else { // param1 < 0
636 geo.add(new go.PathFigure(indent, 0)
637 .add(new go.PathSegment(go.PathSegment.Line, w - indent, 0))
638 .add(new go.PathSegment(go.PathSegment.Line, w, h))
639 .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()));
640 }
641 if (indent < w / 2) {
642 geo.setSpots(indent / w, 0, (w - indent) / w, 1);
643 }
644 return geo;
645 }
646});
647// The following functions are used by a group of regular figures that are defined below:
648/** @ignore */
649const _CachedArrays = [];
650/**
651 * @ignore
652 * @return {Array}
653 */
654function tempArray() {
655 const temp = _CachedArrays.pop();
656 if (temp === undefined)
657 return [];
658 return temp;
659}
660/**
661 * @ignore
662 * @param {Array} a
663 */
664function freeArray(a) {
665 a.length = 0; // clear any references to objects
666 _CachedArrays.push(a);
667}
668/**
669 * @ignore
670 * This allocates a temporary Array that should be freeArray()'ed by the caller.
671 * @param {number} sides
672 * @return {Array}
673 */
674function createPolygon(sides) {
675 // Point[] points = new Point[sides + 1];
676 const points = tempArray();
677 const radius = .5;
678 const center = .5;
679 const offsetAngle = Math.PI * 1.5;
680 let angle = 0;
681 // Loop through each side of the polygon
682 for (let i = 0; i < sides; i++) {
683 angle = 2 * Math.PI / sides * i + offsetAngle;
684 points[i] = new go.Point((center + radius * Math.cos(angle)), (center + radius * Math.sin(angle)));
685 }
686 // Add the last line
687 // points[points.length - 1] = points[0];
688 points.push(points[0]);
689 return points;
690}
691/**
692 * @ignore
693 * This allocates a temporary Array that should be freeArray()'ed by the caller.
694 * @param {number} points
695 * @return {Array}
696 */
697function createBurst(points) {
698 const star = createStar(points);
699 const pts = tempArray(); // new Point[points * 3 + 1];
700 pts[0] = star[0];
701 for (let i = 1, count = 1; i < star.length; i += 2, count += 3) {
702 pts[count] = star[i];
703 pts[count + 1] = star[i];
704 pts[count + 2] = star[i + 1];
705 }
706 freeArray(star);
707 return pts;
708}
709/**
710 * @ignore
711 * This allocates a temporary Array that should be freeArray()'ed by the caller.
712 * @param {number} points
713 * @return {Array}
714 */
715function createStar(points) {
716 // First, create a regular polygon
717 const polygon = createPolygon(points);
718 // Calculate the points inbetween
719 const pts = tempArray(); // new Point[points * 2 + 1];
720 const half = Math.floor(polygon.length / 2);
721 const count = polygon.length - 1;
722 const offset = (points % 2 === 0) ? 2 : 1;
723 for (let i = 0; i < count; i++) {
724 // Get the intersection of two lines
725 const p0 = polygon[i];
726 const p1 = polygon[i + 1];
727 const q21 = polygon[(half + i - 1) % count];
728 const q2off = polygon[(half + i + offset) % count];
729 pts[i * 2] = p0;
730 pts[i * 2 + 1] = getIntersection(p0.x, p0.y, q21.x, q21.y, p1.x, p1.y, q2off.x, q2off.y, new go.Point()); // ?? not currently managed
731 }
732 pts[pts.length] = pts[0];
733 freeArray(polygon);
734 return pts;
735}
736go.Shape.defineFigureGenerator('Pentagon', (shape, w, h) => {
737 const points = createPolygon(5);
738 const geo = new go.Geometry();
739 const fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);
740 geo.add(fig);
741 for (let i = 1; i < 5; i++) {
742 fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));
743 }
744 fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());
745 freeArray(points);
746 geo.spot1 = new go.Spot(.2, .22);
747 geo.spot2 = new go.Spot(.8, .9);
748 return geo;
749});
750go.Shape.defineFigureGenerator('Hexagon', (shape, w, h) => {
751 const points = createPolygon(6);
752 const geo = new go.Geometry();
753 const fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);
754 geo.add(fig);
755 for (let i = 1; i < 6; i++) {
756 fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));
757 }
758 fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());
759 freeArray(points);
760 geo.spot1 = new go.Spot(.07, .25);
761 geo.spot2 = new go.Spot(.93, .75);
762 return geo;
763});
764go.Shape.defineFigureGenerator('Heptagon', (shape, w, h) => {
765 const points = createPolygon(7);
766 const geo = new go.Geometry();
767 const fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);
768 geo.add(fig);
769 for (let i = 1; i < 7; i++) {
770 fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));
771 }
772 fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());
773 freeArray(points);
774 geo.spot1 = new go.Spot(.2, .15);
775 geo.spot2 = new go.Spot(.8, .85);
776 return geo;
777});
778go.Shape.defineFigureGenerator('Octagon', (shape, w, h) => {
779 const points = createPolygon(8);
780 const geo = new go.Geometry();
781 const fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);
782 geo.add(fig);
783 for (let i = 1; i < 8; i++) {
784 fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));
785 }
786 fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());
787 freeArray(points);
788 geo.spot1 = new go.Spot(.15, .15);
789 geo.spot2 = new go.Spot(.85, .85);
790 return geo;
791});
792go.Shape.defineFigureGenerator('Nonagon', (shape, w, h) => {
793 const points = createPolygon(9);
794 const geo = new go.Geometry();
795 const fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);
796 geo.add(fig);
797 for (let i = 1; i < 9; i++) {
798 fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));
799 }
800 fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());
801 freeArray(points);
802 geo.spot1 = new go.Spot(.17, .13);
803 geo.spot2 = new go.Spot(.82, .82);
804 return geo;
805});
806go.Shape.defineFigureGenerator('Decagon', (shape, w, h) => {
807 const points = createPolygon(10);
808 const geo = new go.Geometry();
809 const fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);
810 geo.add(fig);
811 for (let i = 1; i < 10; i++) {
812 fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));
813 }
814 fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());
815 freeArray(points);
816 geo.spot1 = new go.Spot(.16, .16);
817 geo.spot2 = new go.Spot(.84, .84);
818 return geo;
819});
820go.Shape.defineFigureGenerator('Dodecagon', (shape, w, h) => {
821 const points = createPolygon(12);
822 const geo = new go.Geometry();
823 const fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);
824 geo.add(fig);
825 for (let i = 1; i < 12; i++) {
826 fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));
827 }
828 fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());
829 freeArray(points);
830 geo.spot1 = new go.Spot(.16, .16);
831 geo.spot2 = new go.Spot(.84, .84);
832 return geo;
833});
834go.Shape.defineFigureGenerator('FivePointedStar', (shape, w, h) => {
835 const starPoints = createStar(5);
836 const geo = new go.Geometry();
837 const fig = new go.PathFigure(starPoints[0].x * w, starPoints[0].y * h, true);
838 geo.add(fig);
839 for (let i = 1; i < 10; i++) {
840 fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[i].x * w, starPoints[i].y * h));
841 }
842 fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[0].x * w, starPoints[0].y * h).close());
843 freeArray(starPoints);
844 geo.spot1 = new go.Spot(.266, .333);
845 geo.spot2 = new go.Spot(.733, .733);
846 return geo;
847});
848go.Shape.defineFigureGenerator('SixPointedStar', (shape, w, h) => {
849 const starPoints = createStar(6);
850 const geo = new go.Geometry();
851 const fig = new go.PathFigure(starPoints[0].x * w, starPoints[0].y * h, true);
852 geo.add(fig);
853 for (let i = 1; i < 12; i++) {
854 fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[i].x * w, starPoints[i].y * h));
855 }
856 fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[0].x * w, starPoints[0].y * h).close());
857 freeArray(starPoints);
858 geo.spot1 = new go.Spot(.17, .25);
859 geo.spot2 = new go.Spot(.83, .75);
860 return geo;
861});
862go.Shape.defineFigureGenerator('SevenPointedStar', (shape, w, h) => {
863 const starPoints = createStar(7);
864 const geo = new go.Geometry();
865 const fig = new go.PathFigure(starPoints[0].x * w, starPoints[0].y * h, true);
866 geo.add(fig);
867 for (let i = 1; i < 14; i++) {
868 fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[i].x * w, starPoints[i].y * h));
869 }
870 fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[0].x * w, starPoints[0].y * h).close());
871 freeArray(starPoints);
872 geo.spot1 = new go.Spot(.222, .277);
873 geo.spot2 = new go.Spot(.777, .666);
874 return geo;
875});
876go.Shape.defineFigureGenerator('EightPointedStar', (shape, w, h) => {
877 const starPoints = createStar(8);
878 const geo = new go.Geometry();
879 const fig = new go.PathFigure(starPoints[0].x * w, starPoints[0].y * h, true);
880 geo.add(fig);
881 for (let i = 1; i < 16; i++) {
882 fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[i].x * w, starPoints[i].y * h));
883 }
884 fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[0].x * w, starPoints[0].y * h).close());
885 freeArray(starPoints);
886 geo.spot1 = new go.Spot(.25, .25);
887 geo.spot2 = new go.Spot(.75, .75);
888 return geo;
889});
890go.Shape.defineFigureGenerator('NinePointedStar', (shape, w, h) => {
891 const starPoints = createStar(9);
892 const geo = new go.Geometry();
893 const fig = new go.PathFigure(starPoints[0].x * w, starPoints[0].y * h, true);
894 geo.add(fig);
895 for (let i = 1; i < 18; i++) {
896 fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[i].x * w, starPoints[i].y * h));
897 }
898 fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[0].x * w, starPoints[0].y * h).close());
899 freeArray(starPoints);
900 geo.spot1 = new go.Spot(.222, .277);
901 geo.spot2 = new go.Spot(.777, .666);
902 return geo;
903});
904go.Shape.defineFigureGenerator('TenPointedStar', (shape, w, h) => {
905 const starPoints = createStar(10);
906 const geo = new go.Geometry();
907 const fig = new go.PathFigure(starPoints[0].x * w, starPoints[0].y * h, true);
908 geo.add(fig);
909 for (let i = 1; i < 20; i++) {
910 fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[i].x * w, starPoints[i].y * h));
911 }
912 fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[0].x * w, starPoints[0].y * h).close());
913 freeArray(starPoints);
914 geo.spot1 = new go.Spot(.281, .261);
915 geo.spot2 = new go.Spot(.723, .748);
916 return geo;
917});
918go.Shape.defineFigureGenerator('FivePointedBurst', (shape, w, h) => {
919 const burstPoints = createBurst(5);
920 const geo = new go.Geometry();
921 const fig = new go.PathFigure(burstPoints[0].x * w, burstPoints[0].y * h, true);
922 geo.add(fig);
923 for (let i = 1; i < burstPoints.length; i += 3) {
924 fig.add(new go.PathSegment(go.PathSegment.Bezier, burstPoints[i + 2].x * w, burstPoints[i + 2].y * h, burstPoints[i].x * w, burstPoints[i].y * h, burstPoints[i + 1].x * w, burstPoints[i + 1].y * h));
925 }
926 const lst = fig.segments.last();
927 if (lst !== null)
928 lst.close();
929 freeArray(burstPoints);
930 geo.spot1 = new go.Spot(.222, .277);
931 geo.spot2 = new go.Spot(.777, .777);
932 return geo;
933});
934go.Shape.defineFigureGenerator('SixPointedBurst', (shape, w, h) => {
935 const burstPoints = createBurst(6);
936 const geo = new go.Geometry();
937 const fig = new go.PathFigure(burstPoints[0].x * w, burstPoints[0].y * h, true);
938 geo.add(fig);
939 for (let i = 1; i < burstPoints.length; i += 3) {
940 fig.add(new go.PathSegment(go.PathSegment.Bezier, burstPoints[i + 2].x * w, burstPoints[i + 2].y * h, burstPoints[i].x * w, burstPoints[i].y * h, burstPoints[i + 1].x * w, burstPoints[i + 1].y * h));
941 }
942 const lst = fig.segments.last();
943 if (lst !== null)
944 lst.close();
945 freeArray(burstPoints);
946 geo.spot1 = new go.Spot(.170, .222);
947 geo.spot2 = new go.Spot(.833, .777);
948 return geo;
949});
950go.Shape.defineFigureGenerator('SevenPointedBurst', (shape, w, h) => {
951 const burstPoints = createBurst(7);
952 const geo = new go.Geometry();
953 const fig = new go.PathFigure(burstPoints[0].x * w, burstPoints[0].y * h, true);
954 geo.add(fig);
955 for (let i = 1; i < burstPoints.length; i += 3) {
956 fig.add(new go.PathSegment(go.PathSegment.Bezier, burstPoints[i + 2].x * w, burstPoints[i + 2].y * h, burstPoints[i].x * w, burstPoints[i].y * h, burstPoints[i + 1].x * w, burstPoints[i + 1].y * h));
957 }
958 const lst = fig.segments.last();
959 if (lst !== null)
960 lst.close();
961 freeArray(burstPoints);
962 geo.spot1 = new go.Spot(.222, .222);
963 geo.spot2 = new go.Spot(.777, .777);
964 return geo;
965});
966go.Shape.defineFigureGenerator('EightPointedBurst', (shape, w, h) => {
967 const burstPoints = createBurst(8);
968 const geo = new go.Geometry();
969 const fig = new go.PathFigure(burstPoints[0].x * w, burstPoints[0].y * h, true);
970 geo.add(fig);
971 for (let i = 1; i < burstPoints.length; i += 3) {
972 fig.add(new go.PathSegment(go.PathSegment.Bezier, burstPoints[i + 2].x * w, burstPoints[i + 2].y * h, burstPoints[i].x * w, burstPoints[i].y * h, burstPoints[i + 1].x * w, burstPoints[i + 1].y * h));
973 }
974 const lst = fig.segments.last();
975 if (lst !== null)
976 lst.close();
977 freeArray(burstPoints);
978 geo.spot1 = new go.Spot(.222, .222);
979 geo.spot2 = new go.Spot(.777, .777);
980 return geo;
981});
982go.Shape.defineFigureGenerator('NinePointedBurst', (shape, w, h) => {
983 const burstPoints = createBurst(9);
984 const geo = new go.Geometry();
985 const fig = new go.PathFigure(burstPoints[0].x * w, burstPoints[0].y * h, true);
986 geo.add(fig);
987 for (let i = 1; i < burstPoints.length; i += 3) {
988 fig.add(new go.PathSegment(go.PathSegment.Bezier, burstPoints[i + 2].x * w, burstPoints[i + 2].y * h, burstPoints[i].x * w, burstPoints[i].y * h, burstPoints[i + 1].x * w, burstPoints[i + 1].y * h));
989 }
990 const lst = fig.segments.last();
991 if (lst !== null)
992 lst.close();
993 freeArray(burstPoints);
994 geo.spot1 = new go.Spot(.222, .222);
995 geo.spot2 = new go.Spot(.777, .777);
996 return geo;
997});
998go.Shape.defineFigureGenerator('TenPointedBurst', (shape, w, h) => {
999 const burstPoints = createBurst(10);
1000 const geo = new go.Geometry();
1001 const fig = new go.PathFigure(burstPoints[0].x * w, burstPoints[0].y * h, true);
1002 geo.add(fig);
1003 for (let i = 1; i < burstPoints.length; i += 3) {
1004 fig.add(new go.PathSegment(go.PathSegment.Bezier, burstPoints[i + 2].x * w, burstPoints[i + 2].y * h, burstPoints[i].x * w, burstPoints[i].y * h, burstPoints[i + 1].x * w, burstPoints[i + 1].y * h));
1005 }
1006 const lst = fig.segments.last();
1007 if (lst !== null)
1008 lst.close();
1009 freeArray(burstPoints);
1010 geo.spot1 = new go.Spot(.222, .222);
1011 geo.spot2 = new go.Spot(.777, .777);
1012 return geo;
1013});
1014FigureParameter.setFigureParameter('FramedRectangle', 0, new FigureParameter('ThicknessX', 8));
1015FigureParameter.setFigureParameter('FramedRectangle', 1, new FigureParameter('ThicknessY', 8));
1016go.Shape.defineFigureGenerator('FramedRectangle', (shape, w, h) => {
1017 let param1 = shape ? shape.parameter1 : NaN;
1018 let param2 = shape ? shape.parameter2 : NaN;
1019 if (isNaN(param1))
1020 param1 = 8; // default values PARAMETER 1 is for WIDTH
1021 if (isNaN(param2))
1022 param2 = 8; // default values PARAMETER 2 is for HEIGHT
1023 const geo = new go.Geometry();
1024 const fig = new go.PathFigure(0, 0, true);
1025 geo.add(fig);
1026 // outer rectangle, clockwise
1027 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
1028 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
1029 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
1030 if (param1 < w / 2 && param2 < h / 2) {
1031 // inner rectangle, counter-clockwise
1032 fig.add(new go.PathSegment(go.PathSegment.Move, param1, param2)); // subpath
1033 fig.add(new go.PathSegment(go.PathSegment.Line, param1, h - param2));
1034 fig.add(new go.PathSegment(go.PathSegment.Line, w - param1, h - param2));
1035 fig.add(new go.PathSegment(go.PathSegment.Line, w - param1, param2).close());
1036 }
1037 geo.setSpots(0, 0, 1, 1, param1, param2, -param1, -param2);
1038 return geo;
1039});
1040FigureParameter.setFigureParameter('Ring', 0, new FigureParameter('Thickness', 8));
1041go.Shape.defineFigureGenerator('Ring', (shape, w, h) => {
1042 let param1 = shape ? shape.parameter1 : NaN;
1043 if (isNaN(param1) || param1 < 0)
1044 param1 = 8;
1045 const rad = w / 2;
1046 const geo = new go.Geometry();
1047 const fig = new go.PathFigure(w, w / 2, true); // clockwise
1048 geo.add(fig);
1049 fig.add(new go.PathSegment(go.PathSegment.Arc, 0, 360, rad, rad, rad, rad).close());
1050 const rad2 = Math.max(rad - param1, 0);
1051 if (rad2 > 0) { // counter-clockwise
1052 fig.add(new go.PathSegment(go.PathSegment.Move, w / 2 + rad2, w / 2));
1053 fig.add(new go.PathSegment(go.PathSegment.Arc, 0, -360, rad, rad, rad2, rad2).close());
1054 }
1055 geo.spot1 = GeneratorEllipseSpot1;
1056 geo.spot2 = GeneratorEllipseSpot2;
1057 geo.defaultStretch = go.GraphObject.Uniform;
1058 return geo;
1059});
1060go.Shape.defineFigureGenerator('Cloud', (shape, w, h) => {
1061 return new go.Geometry()
1062 .add(new go.PathFigure(.08034461 * w, .1944299 * h, true)
1063 .add(new go.PathSegment(go.PathSegment.Bezier, .2008615 * w, .05349299 * h, -.09239631 * w, .07836421 * h, .1406031 * w, -.0542823 * h))
1064 .add(new go.PathSegment(go.PathSegment.Bezier, .4338609 * w, .074219 * h, .2450511 * w, -.00697547 * h, .3776197 * w, -.01112067 * h))
1065 .add(new go.PathSegment(go.PathSegment.Bezier, .6558228 * w, .07004196 * h, .4539471 * w, 0, .6066018 * w, -.02526587 * h))
1066 .add(new go.PathSegment(go.PathSegment.Bezier, .8921095 * w, .08370865 * h, .6914277 * w, -.01904177 * h, .8921095 * w, -.01220843 * h))
1067 .add(new go.PathSegment(go.PathSegment.Bezier, .9147671 * w, .3194596 * h, 1.036446 * w, .04105738 * h, 1.020377 * w, .3022052 * h))
1068 .add(new go.PathSegment(go.PathSegment.Bezier, .9082935 * w, .562044 * h, 1.04448 * w, .360238 * h, .992256 * w, .5219009 * h))
1069 .add(new go.PathSegment(go.PathSegment.Bezier, .9212406 * w, .8217117 * h, 1.032337 * w, .5771781 * h, 1.018411 * w, .8120651 * h))
1070 .add(new go.PathSegment(go.PathSegment.Bezier, .7592566 * w, .9156953 * h, 1.028411 * w, .9571472 * h, .8556702 * w, 1.052487 * h))
1071 .add(new go.PathSegment(go.PathSegment.Bezier, .5101666 * w, .9310455 * h, .7431877 * w, 1.009325 * h, .5624123 * w, 1.021761 * h))
1072 .add(new go.PathSegment(go.PathSegment.Bezier, .2609328 * w, .9344623 * h, .4820677 * w, 1.031761 * h, .3030112 * w, 1.002796 * h))
1073 .add(new go.PathSegment(go.PathSegment.Bezier, .08034461 * w, .870098 * h, .2329994 * w, 1.01518 * h, .03213784 * w, 1.01518 * h))
1074 .add(new go.PathSegment(go.PathSegment.Bezier, .06829292 * w, .6545475 * h, -.02812061 * w, .9032597 * h, -.01205169 * w, .6835638 * h))
1075 .add(new go.PathSegment(go.PathSegment.Bezier, .06427569 * w, .4265613 * h, -.01812061 * w, .6089503 * h, -.00606892 * w, .4555777 * h))
1076 .add(new go.PathSegment(go.PathSegment.Bezier, .08034461 * w, .1944299 * h, -.01606892 * w, .3892545 * h, -.01205169 * w, .1944299 * h)))
1077 .setSpots(.1, .1, .9, .9);
1078});
1079go.Shape.defineFigureGenerator('StopSign', (shape, w, h) => {
1080 const part = 1 / (Math.SQRT2 + 2);
1081 return new go.Geometry()
1082 .add(new go.PathFigure(part * w, 0, true)
1083 .add(new go.PathSegment(go.PathSegment.Line, (1 - part) * w, 0))
1084 .add(new go.PathSegment(go.PathSegment.Line, w, part * h))
1085 .add(new go.PathSegment(go.PathSegment.Line, w, (1 - part) * h))
1086 .add(new go.PathSegment(go.PathSegment.Line, (1 - part) * w, h))
1087 .add(new go.PathSegment(go.PathSegment.Line, part * w, h))
1088 .add(new go.PathSegment(go.PathSegment.Line, 0, (1 - part) * h))
1089 .add(new go.PathSegment(go.PathSegment.Line, 0, part * h).close()))
1090 .setSpots(part / 2, part / 2, 1 - part / 2, 1 - part / 2);
1091});
1092FigureParameter.setFigureParameter('Pie', 0, new FigureParameter('Start', 0, -360, 360));
1093FigureParameter.setFigureParameter('Pie', 1, new FigureParameter('Sweep', 315, -360, 360));
1094go.Shape.defineFigureGenerator('Pie', (shape, w, h) => {
1095 let param1 = shape ? shape.parameter1 : NaN;
1096 let param2 = shape ? shape.parameter2 : NaN;
1097 if (isNaN(param1))
1098 param1 = 0; // default values PARAMETER 1 is for Start Angle
1099 if (isNaN(param2))
1100 param2 = 315; // default values PARAMETER 2 is for Sweep Angle
1101 let start = param1 % 360;
1102 if (start < 0)
1103 start += 360;
1104 const sweep = param2 % 360;
1105 const rad = Math.min(w, h) / 2;
1106 return new go.Geometry()
1107 .add(new go.PathFigure(rad, rad) // start point
1108 .add(new go.PathSegment(go.PathSegment.Arc, start, sweep, // angles
1109 rad, rad, // center
1110 rad, rad) // radius
1111 .close()));
1112});
1113go.Shape.defineFigureGenerator('PiePiece', (shape, w, h) => {
1114 const factor = KAPPA / Math.SQRT2 * .5;
1115 const x1 = Math.SQRT2 / 2;
1116 const y1 = 1 - Math.SQRT2 / 2;
1117 return new go.Geometry()
1118 .add(new go.PathFigure(w, h, true)
1119 .add(new go.PathSegment(go.PathSegment.Bezier, x1 * w, y1 * h, w, (1 - factor) * h, (x1 + factor) * w, (y1 + factor) * h))
1120 .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()));
1121});
1122FigureParameter.setFigureParameter('ThickCross', 0, new FigureParameter('Thickness', 30));
1123go.Shape.defineFigureGenerator('ThickCross', (shape, w, h) => {
1124 let param1 = shape ? shape.parameter1 : NaN;
1125 if (isNaN(param1) || param1 < 0)
1126 param1 = 30;
1127 const t = Math.min(param1, w) / 2;
1128 const mx = w / 2;
1129 const my = h / 2;
1130 return new go.Geometry()
1131 .add(new go.PathFigure(mx - t, 0, true)
1132 .add(new go.PathSegment(go.PathSegment.Line, mx + t, 0))
1133 .add(new go.PathSegment(go.PathSegment.Line, mx + t, my - t))
1134 .add(new go.PathSegment(go.PathSegment.Line, w, my - t))
1135 .add(new go.PathSegment(go.PathSegment.Line, w, my + t))
1136 .add(new go.PathSegment(go.PathSegment.Line, mx + t, my + t))
1137 .add(new go.PathSegment(go.PathSegment.Line, mx + t, h))
1138 .add(new go.PathSegment(go.PathSegment.Line, mx - t, h))
1139 .add(new go.PathSegment(go.PathSegment.Line, mx - t, my + t))
1140 .add(new go.PathSegment(go.PathSegment.Line, 0, my + t))
1141 .add(new go.PathSegment(go.PathSegment.Line, 0, my - t))
1142 .add(new go.PathSegment(go.PathSegment.Line, mx - t, my - t).close()));
1143});
1144FigureParameter.setFigureParameter('ThinCross', 0, new FigureParameter('Thickness', 10));
1145go.Shape.defineFigureGenerator('ThinCross', (shape, w, h) => {
1146 let param1 = shape ? shape.parameter1 : NaN;
1147 if (isNaN(param1) || param1 < 0)
1148 param1 = 10;
1149 const t = Math.min(param1, w) / 2;
1150 const mx = w / 2;
1151 const my = h / 2;
1152 return new go.Geometry()
1153 .add(new go.PathFigure(mx - t, 0, true)
1154 .add(new go.PathSegment(go.PathSegment.Line, mx + t, 0))
1155 .add(new go.PathSegment(go.PathSegment.Line, mx + t, my - t))
1156 .add(new go.PathSegment(go.PathSegment.Line, w, my - t))
1157 .add(new go.PathSegment(go.PathSegment.Line, w, my + t))
1158 .add(new go.PathSegment(go.PathSegment.Line, mx + t, my + t))
1159 .add(new go.PathSegment(go.PathSegment.Line, mx + t, h))
1160 .add(new go.PathSegment(go.PathSegment.Line, mx - t, h))
1161 .add(new go.PathSegment(go.PathSegment.Line, mx - t, my + t))
1162 .add(new go.PathSegment(go.PathSegment.Line, 0, my + t))
1163 .add(new go.PathSegment(go.PathSegment.Line, 0, my - t))
1164 .add(new go.PathSegment(go.PathSegment.Line, mx - t, my - t).close()));
1165});
1166FigureParameter.setFigureParameter('ThickX', 0, new FigureParameter('Thickness', 30));
1167go.Shape.defineFigureGenerator('ThickX', (shape, w, h) => {
1168 let param1 = shape ? shape.parameter1 : NaN;
1169 if (isNaN(param1) || param1 < 0)
1170 param1 = 30;
1171 if (w === 0 || h === 0) {
1172 const geo = new go.Geometry(go.Geometry.Rectangle);
1173 geo.startX = 0;
1174 geo.startY = 0;
1175 geo.endX = w;
1176 geo.endY = h;
1177 return geo;
1178 }
1179 else {
1180 const w2 = w / 2;
1181 const h2 = h / 2;
1182 const a2 = Math.atan2(h, w);
1183 const dx = param1 - Math.min(Math.cos(a2) * param1 / 2, w2);
1184 const dy = param1 - Math.min(Math.sin(a2) * param1 / 2, h2);
1185 const geo = new go.Geometry();
1186 const fig = new go.PathFigure(dx, 0, true);
1187 geo.add(fig);
1188 fig.add(new go.PathSegment(go.PathSegment.Line, w2, .2 * h));
1189 fig.add(new go.PathSegment(go.PathSegment.Line, w - dx, 0));
1190 fig.add(new go.PathSegment(go.PathSegment.Line, w, dy));
1191 fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, h2));
1192 fig.add(new go.PathSegment(go.PathSegment.Line, w, h - dy));
1193 fig.add(new go.PathSegment(go.PathSegment.Line, w - dx, h));
1194 fig.add(new go.PathSegment(go.PathSegment.Line, w2, .8 * h));
1195 fig.add(new go.PathSegment(go.PathSegment.Line, dx, h));
1196 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h - dy));
1197 fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, h2));
1198 fig.add(new go.PathSegment(go.PathSegment.Line, 0, dy).close());
1199 return geo;
1200 }
1201});
1202FigureParameter.setFigureParameter('ThinX', 0, new FigureParameter('Thickness', 10));
1203go.Shape.defineFigureGenerator('ThinX', (shape, w, h) => {
1204 let param1 = shape ? shape.parameter1 : NaN;
1205 if (isNaN(param1) || param1 < 0)
1206 param1 = 10;
1207 const geo = new go.Geometry();
1208 const fig = new go.PathFigure(.1 * w, 0, true);
1209 geo.add(fig);
1210 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .4 * h));
1211 fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, 0));
1212 fig.add(new go.PathSegment(go.PathSegment.Line, w, .1 * h));
1213 fig.add(new go.PathSegment(go.PathSegment.Line, .6 * w, .5 * h));
1214 fig.add(new go.PathSegment(go.PathSegment.Line, w, .9 * h));
1215 fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, h));
1216 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .6 * h));
1217 fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, h));
1218 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .9 * h));
1219 fig.add(new go.PathSegment(go.PathSegment.Line, .4 * w, .5 * h));
1220 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .1 * h).close());
1221 return geo;
1222});
1223// adjust the width of the vertical beam
1224FigureParameter.setFigureParameter('SquareIBeam', 0, new FigureParameter('BeamWidth', 0.2, 0.1, 0.9));
1225go.Shape.defineFigureGenerator('SquareIBeam', (shape, w, h) => {
1226 let param1 = shape ? shape.parameter1 : NaN; // width of the ibeam in % of the total width
1227 if (isNaN(param1))
1228 param1 = .2;
1229 const geo = new go.Geometry();
1230 const fig = new go.PathFigure(0, 0, true);
1231 geo.add(fig);
1232 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
1233 fig.add(new go.PathSegment(go.PathSegment.Line, w, param1 * h));
1234 fig.add(new go.PathSegment(go.PathSegment.Line, (.5 + param1 / 2) * w, param1 * h));
1235 fig.add(new go.PathSegment(go.PathSegment.Line, (.5 + param1 / 2) * w, (1 - param1) * h));
1236 fig.add(new go.PathSegment(go.PathSegment.Line, w, (1 - param1) * h));
1237 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
1238 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
1239 fig.add(new go.PathSegment(go.PathSegment.Line, 0, (1 - param1) * h));
1240 fig.add(new go.PathSegment(go.PathSegment.Line, (.5 - param1 / 2) * w, (1 - param1) * h));
1241 fig.add(new go.PathSegment(go.PathSegment.Line, (.5 - param1 / 2) * w, param1 * h));
1242 fig.add(new go.PathSegment(go.PathSegment.Line, 0, param1 * h).close());
1243 return geo;
1244});
1245// parameter allows it easy to adjust the roundness of the curves that cut inward
1246FigureParameter.setFigureParameter('RoundedIBeam', 0, new FigureParameter('Curviness', .5, .05, .65));
1247go.Shape.defineFigureGenerator('RoundedIBeam', (shape, w, h) => {
1248 let param1 = shape ? shape.parameter1 : NaN; // curviness of the ibeam relative to total width
1249 if (isNaN(param1))
1250 param1 = .5;
1251 const geo = new go.Geometry();
1252 const fig = new go.PathFigure(0, 0, true);
1253 geo.add(fig);
1254 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
1255 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, h, Math.abs((1 - param1)) * w, .25 * h, Math.abs((1 - param1)) * w, .75 * h));
1256 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
1257 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0, param1 * w, .75 * h, param1 * w, .25 * h).close());
1258 return geo;
1259});
1260go.Shape.defineFigureGenerator('HalfEllipse', (shape, w, h) => {
1261 return new go.Geometry()
1262 .add(new go.PathFigure(0, 0, true)
1263 .add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, KAPPA * w, 0, w, (.5 - KAPPA / 2) * h))
1264 .add(new go.PathSegment(go.PathSegment.Bezier, 0, h, w, (.5 + KAPPA / 2) * h, KAPPA * w, h).close()))
1265 .setSpots(0, 0.156, 0.844, 0.844);
1266});
1267go.Shape.defineFigureGenerator('Crescent', (shape, w, h) => {
1268 return new go.Geometry()
1269 .add(new go.PathFigure(0, 0, true)
1270 .add(new go.PathSegment(go.PathSegment.Bezier, 0, h, w, 0, w, h))
1271 .add(new go.PathSegment(go.PathSegment.Bezier, 0, 0, 0.5 * w, 0.75 * h, 0.5 * w, 0.25 * h).close()))
1272 .setSpots(.311, 0.266, 0.744, 0.744);
1273});
1274go.Shape.defineFigureGenerator('Heart', (shape, w, h) => {
1275 return new go.Geometry()
1276 .add(new go.PathFigure(.5 * w, h, true)
1277 .add(new go.PathSegment(go.PathSegment.Bezier, 0, .3 * h, .1 * w, .8 * h, 0, .5 * h))
1278 .add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .3 * h, 0, 0, .45 * w, 0))
1279 .add(new go.PathSegment(go.PathSegment.Bezier, w, .3 * h, .55 * w, 0, w, 0))
1280 .add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, h, w, .5 * h, .9 * w, .8 * h).close()))
1281 .setSpots(.14, .29, .86, .78);
1282});
1283go.Shape.defineFigureGenerator('Spade', (shape, w, h) => {
1284 return new go.Geometry()
1285 .add(new go.PathFigure(.5 * w, 0, true)
1286 .add(new go.PathSegment(go.PathSegment.Line, .51 * w, .01 * h))
1287 .add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, .6 * w, .2 * h, w, .25 * h))
1288 .add(new go.PathSegment(go.PathSegment.Bezier, .55 * w, .7 * h, w, .8 * h, .6 * w, .8 * h))
1289 .add(new go.PathSegment(go.PathSegment.Bezier, .75 * w, h, .5 * w, .75 * h, .55 * w, .95 * h))
1290 .add(new go.PathSegment(go.PathSegment.Line, .25 * w, h))
1291 .add(new go.PathSegment(go.PathSegment.Bezier, .45 * w, .7 * h, .45 * w, .95 * h, .5 * w, .75 * h))
1292 .add(new go.PathSegment(go.PathSegment.Bezier, 0, .5 * h, .4 * w, .8 * h, 0, .8 * h))
1293 .add(new go.PathSegment(go.PathSegment.Bezier, .49 * w, .01 * h, 0, .25 * h, .4 * w, .2 * h).close()))
1294 .setSpots(.14, .26, .86, .78);
1295});
1296go.Shape.defineFigureGenerator('Club', (shape, w, h) => {
1297 const geo = new go.Geometry();
1298 const fig = new go.PathFigure(.4 * w, .6 * h, true);
1299 geo.add(fig);
1300 // Start the base
1301 fig.add(new go.PathSegment(go.PathSegment.Bezier, .15 * w, h, .5 * w, .75 * h, .45 * w, .95 * h));
1302 fig.add(new go.PathSegment(go.PathSegment.Line, .85 * w, h));
1303 fig.add(new go.PathSegment(go.PathSegment.Bezier, .6 * w, .6 * h, .55 * w, .95 * h, .5 * w, .75 * h));
1304 // First circle:
1305 let r = .2; // radius
1306 let cx = .3; // offset from Center x
1307 let cy = 0; // offset from Center y
1308 let d = r * KAPPA;
1309 fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 + r + cy) * h, (.5 - r + cx) * w, (.5 + d + cy) * h, (.5 - d + cx) * w, (.5 + r + cy) * h));
1310 fig.add(new go.PathSegment(go.PathSegment.Bezier, (1 - .5 + r + cx) * w, (.5 + cy) * h, (.5 + d + cx) * w, (.5 + r + cy) * h, (.5 + r + cx) * w, (.5 + d + cy) * h));
1311 fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 - r + cy) * h, (1 - .5 + r + cx) * w, (.5 - d + cy) * h, (.5 + d + cx) * w, (.5 - r + cy) * h));
1312 fig.add(new go.PathSegment(go.PathSegment.Bezier, (.65) * w, (0.36771243) * h, (.5 - d + cx) * w, (.5 - r + cy) * h, (.5 - r + cx + .05) * w, (.5 - d + cy - .02) * h));
1313 r = .2; // radius
1314 cx = 0; // offset from Center x
1315 cy = -.3; // offset from Center y
1316 d = r * KAPPA;
1317 fig.add(new go.PathSegment(go.PathSegment.Bezier, (1 - .5 + r + cx) * w, (.5 + cy) * h, (.5 + d + cx) * w, (.5 + r + cy) * h, (.5 + r + cx) * w, (.5 + d + cy) * h));
1318 fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 - r + cy) * h, (1 - .5 + r + cx) * w, (.5 - d + cy) * h, (.5 + d + cx) * w, (.5 - r + cy) * h));
1319 fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 - r + cx) * w, (.5 + cy) * h, (.5 - d + cx) * w, (.5 - r + cy) * h, (.5 - r + cx) * w, (.5 - d + cy) * h));
1320 fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 - d + cx) * w, (.5 + r + cy) * h, (.5 - r + cx) * w, (.5 + d + cy) * h, (.5 - d + cx) * w, (.5 + r + cy) * h));
1321 r = .2; // radius
1322 cx = -.3; // offset from Center x
1323 cy = 0; // offset from Center y
1324 d = r * KAPPA;
1325 fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 - r + cy) * h, (1 - .5 + r + cx - .05) * w, (.5 - d + cy - .02) * h, (.5 + d + cx) * w, (.5 - r + cy) * h));
1326 fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 - r + cx) * w, (.5 + cy) * h, (.5 - d + cx) * w, (.5 - r + cy) * h, (.5 - r + cx) * w, (.5 - d + cy) * h));
1327 fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 + r + cy) * h, (.5 - r + cx) * w, (.5 + d + cy) * h, (.5 - d + cx) * w, (.5 + r + cy) * h));
1328 fig.add(new go.PathSegment(go.PathSegment.Bezier, .4 * w, .6 * h, (.5 + d + cx) * w, (.5 + r + cy) * h, (.5 + r + cx) * w, (.5 + d + cy) * h).close());
1329 geo.setSpots(.06, .33, .93, .68);
1330 return geo;
1331});
1332go.Shape.defineFigureGenerator('YinYang', (shape, w, h) => {
1333 const geo = new go.Geometry();
1334 let fig = new go.PathFigure(w * 0.5, 0, true);
1335 geo.add(fig);
1336 // Right semi-circle
1337 fig.add(new go.PathSegment(go.PathSegment.Arc, 270, 180, w * 0.5, w * 0.5, w * 0.5, w * 0.5));
1338 // bottom semi-circle
1339 fig.add(new go.PathSegment(go.PathSegment.Arc, 90, -180, w * 0.5, w * 0.75, w * 0.25, w * 0.25));
1340 // top semi-circle
1341 fig.add(new go.PathSegment(go.PathSegment.Arc, 90, 180, w * 0.5, w * 0.25, w * 0.25, w * 0.25));
1342 const radius = .1; // of the small circles
1343 const centerx = .5;
1344 let centery = .25;
1345 // Top small circle, goes counter-clockwise
1346 fig.add(new go.PathSegment(go.PathSegment.Move, (centerx + radius) * w, (centery) * h));
1347 fig.add(new go.PathSegment(go.PathSegment.Arc, 0, -360, w * centerx, h * centery, radius * w, radius * w).close()); // Right semi-circle
1348 // Left semi-circle
1349 fig = new go.PathFigure(w * 0.5, 0, false);
1350 geo.add(fig);
1351 fig.add(new go.PathSegment(go.PathSegment.Arc, 270, -180, w * 0.5, w * 0.5, w * 0.5, w * 0.5));
1352 centery = .75;
1353 // Bottom small circle
1354 fig = new go.PathFigure((centerx + radius) * w, (centery) * h, true); // Not a subpath
1355 geo.add(fig);
1356 fig.add(new go.PathSegment(go.PathSegment.Arc, 0, 360, w * centerx, h * centery, radius * w, radius * w).close()); // Right semi-circle
1357 geo.defaultStretch = go.GraphObject.Uniform;
1358 return geo;
1359});
1360go.Shape.defineFigureGenerator('Peace', (shape, w, h) => {
1361 const a = 1.0 - 0.1464466094067262; // at 45 degrees
1362 const w2 = 0.5 * w;
1363 const h2 = 0.5 * h;
1364 return new go.Geometry()
1365 .add(new go.PathFigure(w2, 0, false)
1366 .add(new go.PathSegment(go.PathSegment.Arc, 270, 360, w2, h2, w2, h2))
1367 .add(new go.PathSegment(go.PathSegment.Line, w2, h))
1368 .add(new go.PathSegment(go.PathSegment.Move, w2, h2))
1369 .add(new go.PathSegment(go.PathSegment.Line, (1.0 - a) * w, a * h))
1370 .add(new go.PathSegment(go.PathSegment.Move, w2, h2))
1371 .add(new go.PathSegment(go.PathSegment.Line, a * w, a * h)));
1372});
1373go.Shape.defineFigureGenerator('NotAllowed', (shape, w, h) => {
1374 const geo = new go.Geometry();
1375 let cpOffset = KAPPA * .5;
1376 let radius = .5;
1377 const centerx = .5;
1378 const centery = .5;
1379 const fig = new go.PathFigure(centerx * w, (centery - radius) * h);
1380 geo.add(fig);
1381 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h));
1382 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h, (centerx - cpOffset) * w, (centery + radius) * h));
1383 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h));
1384 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h, (centerx + cpOffset) * w, (centery - radius) * h));
1385 // Inner circle, composed of two parts, separated by
1386 // a beam across going from top-right to bottom-left.
1387 radius = .40;
1388 cpOffset = KAPPA * .40;
1389 // First we cut up the top right 90 degree curve into two smaller
1390 // curves.
1391 // Since its clockwise, StartOfArrow is the first of the two points
1392 // on the circle. EndOfArrow is the other one.
1393 const startOfArrowc1 = tempPoint();
1394 const startOfArrowc2 = tempPoint();
1395 const startOfArrow = tempPoint();
1396 const unused = tempPoint();
1397 breakUpBezier(centerx, centery - radius, centerx + cpOffset, centery - radius, centerx + radius, centery - cpOffset, centerx + radius, centery, .42, startOfArrowc1, startOfArrowc2, startOfArrow, unused, unused);
1398 const endOfArrowc1 = tempPoint();
1399 const endOfArrowc2 = tempPoint();
1400 const endOfArrow = tempPoint();
1401 breakUpBezier(centerx, centery - radius, centerx + cpOffset, centery - radius, centerx + radius, centery - cpOffset, centerx + radius, centery, .58, unused, unused, endOfArrow, endOfArrowc1, endOfArrowc2);
1402 // Cut up the bottom left 90 degree curve into two smaller curves.
1403 const startOfArrow2c1 = tempPoint();
1404 const startOfArrow2c2 = tempPoint();
1405 const startOfArrow2 = tempPoint();
1406 breakUpBezier(centerx, centery + radius, centerx - cpOffset, centery + radius, centerx - radius, centery + cpOffset, centerx - radius, centery, .42, startOfArrow2c1, startOfArrow2c2, startOfArrow2, unused, unused);
1407 const endOfArrow2c1 = tempPoint();
1408 const endOfArrow2c2 = tempPoint();
1409 const endOfArrow2 = tempPoint();
1410 breakUpBezier(centerx, centery + radius, centerx - cpOffset, centery + radius, centerx - radius, centery + cpOffset, centerx - radius, centery, .58, unused, unused, endOfArrow2, endOfArrow2c1, endOfArrow2c2);
1411 fig.add(new go.PathSegment(go.PathSegment.Move, endOfArrow2.x * w, endOfArrow2.y * h));
1412 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, endOfArrow2c1.x * w, endOfArrow2c1.y * h, endOfArrow2c2.x * w, endOfArrow2c2.y * h));
1413 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - radius) * h));
1414 fig.add(new go.PathSegment(go.PathSegment.Bezier, startOfArrow.x * w, startOfArrow.y * h, startOfArrowc1.x * w, startOfArrowc1.y * h, startOfArrowc2.x * w, startOfArrowc2.y * h));
1415 fig.add(new go.PathSegment(go.PathSegment.Line, endOfArrow2.x * w, endOfArrow2.y * h).close());
1416 fig.add(new go.PathSegment(go.PathSegment.Move, startOfArrow2.x * w, startOfArrow2.y * h));
1417 fig.add(new go.PathSegment(go.PathSegment.Line, endOfArrow.x * w, endOfArrow.y * h));
1418 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, endOfArrowc1.x * w, endOfArrowc1.y * h, endOfArrowc2.x * w, endOfArrowc2.y * h));
1419 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
1420 fig.add(new go.PathSegment(go.PathSegment.Bezier, startOfArrow2.x * w, startOfArrow2.y * h, startOfArrow2c1.x * w, startOfArrow2c1.y * h, startOfArrow2c2.x * w, startOfArrow2c2.y * h).close());
1421 freePoint(startOfArrowc1);
1422 freePoint(startOfArrowc2);
1423 freePoint(startOfArrow);
1424 freePoint(unused);
1425 freePoint(endOfArrowc1);
1426 freePoint(endOfArrowc2);
1427 freePoint(endOfArrow);
1428 freePoint(startOfArrow2c1);
1429 freePoint(startOfArrow2c2);
1430 freePoint(startOfArrow2);
1431 freePoint(endOfArrow2c1);
1432 freePoint(endOfArrow2c2);
1433 freePoint(endOfArrow2);
1434 geo.defaultStretch = go.GraphObject.Uniform;
1435 return geo;
1436});
1437go.Shape.defineFigureGenerator('Fragile', (shape, w, h) => {
1438 return new go.Geometry()
1439 .add(new go.PathFigure(0, 0, true)
1440 .add(new go.PathSegment(go.PathSegment.Line, .25 * w, 0))
1441 .add(new go.PathSegment(go.PathSegment.Line, .2 * w, .15 * h))
1442 .add(new go.PathSegment(go.PathSegment.Line, .3 * w, .25 * h))
1443 .add(new go.PathSegment(go.PathSegment.Line, .29 * w, .33 * h))
1444 .add(new go.PathSegment(go.PathSegment.Line, .35 * w, .25 * h))
1445 .add(new go.PathSegment(go.PathSegment.Line, .3 * w, .15 * h))
1446 .add(new go.PathSegment(go.PathSegment.Line, .4 * w, 0))
1447 .add(new go.PathSegment(go.PathSegment.Line, w, 0))
1448 // Left Side
1449 .add(new go.PathSegment(go.PathSegment.Bezier, .55 * w, .5 * h, w, .25 * h, .75 * w, .5 * h))
1450 .add(new go.PathSegment(go.PathSegment.Line, .55 * w, .9 * h))
1451 // The base
1452 .add(new go.PathSegment(go.PathSegment.Line, .7 * w, .9 * h))
1453 .add(new go.PathSegment(go.PathSegment.Line, .7 * w, h))
1454 .add(new go.PathSegment(go.PathSegment.Line, .3 * w, h))
1455 .add(new go.PathSegment(go.PathSegment.Line, .3 * w, .9 * h))
1456 // Right side
1457 .add(new go.PathSegment(go.PathSegment.Line, .45 * w, .9 * h))
1458 .add(new go.PathSegment(go.PathSegment.Line, .45 * w, .5 * h))
1459 .add(new go.PathSegment(go.PathSegment.Bezier, 0, 0, .25 * w, .5 * h, 0, .25 * h).close()));
1460});
1461FigureParameter.setFigureParameter('HourGlass', 0, new FigureParameter('Thickness', 30));
1462go.Shape.defineFigureGenerator('HourGlass', (shape, w, h) => {
1463 let param1 = shape ? shape.parameter1 : NaN; // width at middle of hourglass
1464 if (isNaN(param1) || param1 < 0)
1465 param1 = 30;
1466 if (param1 > w)
1467 param1 = w;
1468 const x1 = (w - param1) / 2;
1469 const x2 = x1 + param1;
1470 return new go.Geometry()
1471 .add(new go.PathFigure(x2, 0.5 * h)
1472 .add(new go.PathSegment(go.PathSegment.Line, w, h))
1473 .add(new go.PathSegment(go.PathSegment.Line, 0, h))
1474 .add(new go.PathSegment(go.PathSegment.Line, x1, 0.5 * h))
1475 .add(new go.PathSegment(go.PathSegment.Line, 0, 0))
1476 .add(new go.PathSegment(go.PathSegment.Line, w, 0).close()));
1477});
1478go.Shape.defineFigureGenerator('Lightning', (shape, w, h) => {
1479 return new go.Geometry()
1480 .add(new go.PathFigure(0, 0.55 * h)
1481 .add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0))
1482 .add(new go.PathSegment(go.PathSegment.Line, 0.3 * w, 0.45 * h))
1483 .add(new go.PathSegment(go.PathSegment.Line, w, 0.45 * h))
1484 .add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, h))
1485 .add(new go.PathSegment(go.PathSegment.Line, 0.7 * w, 0.55 * h).close()));
1486});
1487go.Shape.defineFigureGenerator('GenderMale', (shape, w, h) => {
1488 const geo = new go.Geometry();
1489 let cpOffset = KAPPA * .4;
1490 let radius = .4;
1491 const centerx = .5;
1492 const centery = .5;
1493 const unused = tempPoint();
1494 const mid = tempPoint();
1495 const c1 = tempPoint();
1496 const c2 = tempPoint();
1497 const fig = new go.PathFigure((centerx - radius) * w, centery * h, false);
1498 geo.add(fig);
1499 // Outer circle
1500 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - radius) * h));
1501 breakUpBezier(centerx, centery - radius, centerx + cpOffset, centery - radius, centerx + radius, centery - cpOffset, centerx + radius, centery, .44, c1, c2, mid, unused, unused);
1502 fig.add(new go.PathSegment(go.PathSegment.Bezier, mid.x * w, mid.y * h, c1.x * w, c1.y * h, c2.x * w, c2.y * h));
1503 const startOfArrow = tempPointAt(mid.x, mid.y);
1504 breakUpBezier(centerx, centery - radius, centerx + cpOffset, centery - radius, centerx + radius, centery - cpOffset, centerx + radius, centery, .56, unused, unused, mid, c1, c2);
1505 const endOfArrow = tempPointAt(mid.x, mid.y);
1506 fig.add(new go.PathSegment(go.PathSegment.Line, (startOfArrow.x * .1 + .95 * .9) * w, (startOfArrow.y * .1) * h));
1507 fig.add(new go.PathSegment(go.PathSegment.Line, .85 * w, (startOfArrow.y * .1) * h));
1508 fig.add(new go.PathSegment(go.PathSegment.Line, .85 * w, 0));
1509 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
1510 fig.add(new go.PathSegment(go.PathSegment.Line, w, .15 * h));
1511 fig.add(new go.PathSegment(go.PathSegment.Line, (endOfArrow.x * .1 + .9) * w, .15 * h));
1512 fig.add(new go.PathSegment(go.PathSegment.Line, (endOfArrow.x * .1 + .9) * w, (endOfArrow.y * .1 + .05 * .9) * h));
1513 fig.add(new go.PathSegment(go.PathSegment.Line, endOfArrow.x * w, endOfArrow.y * h));
1514 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, c1.x * w, c1.y * h, c2.x * w, c2.y * h));
1515 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
1516 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h));
1517 // Inner circle
1518 radius = .35;
1519 cpOffset = KAPPA * .35;
1520 const fig2 = new go.PathFigure(centerx * w, (centery - radius) * h, false);
1521 geo.add(fig2);
1522 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h));
1523 fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h, (centerx - cpOffset) * w, (centery + radius) * h));
1524 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h));
1525 fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h, (centerx + cpOffset) * w, (centery - radius) * h));
1526 const fig3 = new go.PathFigure((centerx - radius) * w, centery * h, false);
1527 geo.add(fig3);
1528 freePoint(unused);
1529 freePoint(mid);
1530 freePoint(c1);
1531 freePoint(c2);
1532 freePoint(startOfArrow);
1533 freePoint(endOfArrow);
1534 geo.spot1 = new go.Spot(.202, .257);
1535 geo.spot2 = new go.Spot(.792, .739);
1536 geo.defaultStretch = go.GraphObject.Uniform;
1537 return geo;
1538});
1539go.Shape.defineFigureGenerator('GenderFemale', (shape, w, h) => {
1540 const geo = new go.Geometry();
1541 // Outer Circle
1542 let r = .375; // radius
1543 let cx = 0; // offset from Center x
1544 let cy = -.125; // offset from Center y
1545 let d = r * KAPPA;
1546 let fig = new go.PathFigure((.525 + cx) * w, (.5 + r + cy) * h, false);
1547 geo.add(fig);
1548 fig.add(new go.PathSegment(go.PathSegment.Bezier, (1 - .5 + r + cx) * w, (.5 + cy) * h, (.5 + d + cx) * w, (.5 + r + cy) * h, (.5 + r + cx) * w, (.5 + d + cy) * h));
1549 fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 - r + cy) * h, (1 - .5 + r + cx) * w, (.5 - d + cy) * h, (.5 + d + cx) * w, (.5 - r + cy) * h));
1550 fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 - r + cx) * w, (.5 + cy) * h, (.5 - d + cx) * w, (.5 - r + cy) * h, (.5 - r + cx) * w, (.5 - d + cy) * h));
1551 fig.add(new go.PathSegment(go.PathSegment.Bezier, (.475 + cx) * w, (.5 + r + cy) * h, (.5 - r + cx) * w, (.5 + d + cy) * h, (.5 - d + cx) * w, (.5 + r + cy) * h));
1552 // Legs
1553 fig.add(new go.PathSegment(go.PathSegment.Line, .475 * w, .85 * h));
1554 fig.add(new go.PathSegment(go.PathSegment.Line, .425 * w, .85 * h));
1555 fig.add(new go.PathSegment(go.PathSegment.Line, .425 * w, .9 * h));
1556 fig.add(new go.PathSegment(go.PathSegment.Line, .475 * w, .9 * h));
1557 fig.add(new go.PathSegment(go.PathSegment.Line, .475 * w, h));
1558 fig.add(new go.PathSegment(go.PathSegment.Line, .525 * w, h));
1559 fig.add(new go.PathSegment(go.PathSegment.Line, .525 * w, .9 * h));
1560 fig.add(new go.PathSegment(go.PathSegment.Line, .575 * w, .9 * h));
1561 fig.add(new go.PathSegment(go.PathSegment.Line, .575 * w, .85 * h));
1562 fig.add(new go.PathSegment(go.PathSegment.Line, .525 * w, .85 * h).close());
1563 // Inner circle
1564 r = .325; // radius
1565 cx = 0; // offset from Center x
1566 cy = -.125; // offset from Center y
1567 d = r * KAPPA;
1568 fig = new go.PathFigure((1 - .5 + r + cx) * w, (.5 + cy) * h, false);
1569 geo.add(fig);
1570 fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 + r + cy) * h, (.5 + r + cx) * w, (.5 + d + cy) * h, (.5 + d + cx) * w, (.5 + r + cy) * h));
1571 fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 - r + cx) * w, (.5 + cy) * h, (.5 - d + cx) * w, (.5 + r + cy) * h, (.5 - r + cx) * w, (.5 + d + cy) * h));
1572 fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 - r + cy) * h, (.5 - r + cx) * w, (.5 - d + cy) * h, (.5 - d + cx) * w, (.5 - r + cy) * h));
1573 fig.add(new go.PathSegment(go.PathSegment.Bezier, (1 - .5 + r + cx) * w, (.5 + cy) * h, (.5 + d + cx) * w, (.5 - r + cy) * h, (1 - .5 + r + cx) * w, (.5 - d + cy) * h));
1574 fig = new go.PathFigure((.525 + cx) * w, (.5 + r + cy) * h, false);
1575 geo.add(fig);
1576 geo.spot1 = new go.Spot(.232, .136);
1577 geo.spot2 = new go.Spot(.682, .611);
1578 geo.defaultStretch = go.GraphObject.Uniform;
1579 return geo;
1580});
1581go.Shape.defineFigureGenerator('LogicImplies', (shape, w, h) => {
1582 let param1 = shape ? shape.parameter1 : NaN;
1583 if (isNaN(param1))
1584 param1 = .2; // Distance the arrow folds from the right
1585 return new go.Geometry()
1586 .add(new go.PathFigure((1 - param1) * w, 0, false)
1587 .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h))
1588 .add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, h))
1589 .add(new go.PathSegment(go.PathSegment.Move, 0, .5 * h))
1590 .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h)))
1591 .setSpots(0, 0, 0.8, 0.5);
1592});
1593go.Shape.defineFigureGenerator('LogicIff', (shape, w, h) => {
1594 let param1 = shape ? shape.parameter1 : NaN;
1595 if (isNaN(param1))
1596 param1 = .2; // Distance the arrow folds from the right
1597 return new go.Geometry()
1598 .add(new go.PathFigure((1 - param1) * w, 0, false)
1599 .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h))
1600 .add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, h))
1601 .add(new go.PathSegment(go.PathSegment.Move, 0, .5 * h))
1602 .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h))
1603 .add(new go.PathSegment(go.PathSegment.Move, param1 * w, 0))
1604 .add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h))
1605 .add(new go.PathSegment(go.PathSegment.Line, param1 * w, h)))
1606 .setSpots(0.2, 0, 0.8, 0.5);
1607});
1608go.Shape.defineFigureGenerator('LogicNot', (shape, w, h) => {
1609 return new go.Geometry()
1610 .add(new go.PathFigure(0, 0, false)
1611 .add(new go.PathSegment(go.PathSegment.Line, w, 0))
1612 .add(new go.PathSegment(go.PathSegment.Line, w, h)));
1613});
1614go.Shape.defineFigureGenerator('LogicAnd', (shape, w, h) => {
1615 return new go.Geometry()
1616 .add(new go.PathFigure(0, h, false)
1617 .add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0))
1618 .add(new go.PathSegment(go.PathSegment.Line, w, h)))
1619 .setSpots(0.25, 0.5, 0.75, 1);
1620});
1621go.Shape.defineFigureGenerator('LogicOr', (shape, w, h) => {
1622 return new go.Geometry()
1623 .add(new go.PathFigure(0, 0, false)
1624 .add(new go.PathSegment(go.PathSegment.Line, .5 * w, h))
1625 .add(new go.PathSegment(go.PathSegment.Line, w, 0)))
1626 .setSpots(0.219, 0, 0.78, 0.409);
1627});
1628go.Shape.defineFigureGenerator('LogicXor', (shape, w, h) => {
1629 const geo = new go.Geometry()
1630 .add(new go.PathFigure(.5 * w, 0, false)
1631 .add(new go.PathSegment(go.PathSegment.Line, .5 * w, h))
1632 .add(new go.PathSegment(go.PathSegment.Move, 0, .5 * h))
1633 .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h))
1634 .add(new go.PathSegment(go.PathSegment.Arc, 0, 360, .5 * w, .5 * h, .5 * w, .5 * h)));
1635 geo.defaultStretch = go.GraphObject.Uniform;
1636 return geo;
1637});
1638go.Shape.defineFigureGenerator('LogicTruth', (shape, w, h) => {
1639 return new go.Geometry()
1640 .add(new go.PathFigure(0, 0, false)
1641 .add(new go.PathSegment(go.PathSegment.Line, w, 0))
1642 .add(new go.PathSegment(go.PathSegment.Move, .5 * w, 0))
1643 .add(new go.PathSegment(go.PathSegment.Line, .5 * w, h)));
1644});
1645go.Shape.defineFigureGenerator('LogicFalsity', (shape, w, h) => {
1646 return new go.Geometry()
1647 .add(new go.PathFigure(0, h, false)
1648 .add(new go.PathSegment(go.PathSegment.Line, w, h))
1649 .add(new go.PathSegment(go.PathSegment.Move, .5 * w, h))
1650 .add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0)));
1651});
1652go.Shape.defineFigureGenerator('LogicThereExists', (shape, w, h) => {
1653 return new go.Geometry()
1654 .add(new go.PathFigure(0, 0, false)
1655 .add(new go.PathSegment(go.PathSegment.Line, w, 0))
1656 .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h))
1657 .add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h))
1658 .add(new go.PathSegment(go.PathSegment.Move, w, .5 * h))
1659 .add(new go.PathSegment(go.PathSegment.Line, w, h))
1660 .add(new go.PathSegment(go.PathSegment.Line, 0, h)));
1661});
1662go.Shape.defineFigureGenerator('LogicForAll', (shape, w, h) => {
1663 return new go.Geometry()
1664 .add(new go.PathFigure(0, 0, false)
1665 .add(new go.PathSegment(go.PathSegment.Line, .5 * w, h))
1666 .add(new go.PathSegment(go.PathSegment.Line, w, 0))
1667 .add(new go.PathSegment(go.PathSegment.Move, .25 * w, .5 * h))
1668 .add(new go.PathSegment(go.PathSegment.Line, .75 * w, .5 * h)))
1669 .setSpots(0.25, 0, 0.75, 0.5);
1670});
1671go.Shape.defineFigureGenerator('LogicIsDefinedAs', (shape, w, h) => {
1672 return new go.Geometry()
1673 .add(new go.PathFigure(0, 0, false)
1674 .add(new go.PathSegment(go.PathSegment.Line, w, 0))
1675 .add(new go.PathSegment(go.PathSegment.Move, 0, .5 * h))
1676 .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h))
1677 .add(new go.PathSegment(go.PathSegment.Move, 0, h))
1678 .add(new go.PathSegment(go.PathSegment.Line, w, h)))
1679 .setSpots(0.01, 0.01, 0.99, 0.49);
1680});
1681go.Shape.defineFigureGenerator('LogicIntersect', (shape, w, h) => {
1682 const radius = 0.5;
1683 return new go.Geometry()
1684 .add(new go.PathFigure(0, h, false)
1685 .add(new go.PathSegment(go.PathSegment.Line, 0, radius * h))
1686 .add(new go.PathSegment(go.PathSegment.Arc, 180, 180, radius * w, radius * h, radius * w, radius * h))
1687 .add(new go.PathSegment(go.PathSegment.Line, w, h)))
1688 .setSpots(0, 0.5, 1, 1);
1689});
1690go.Shape.defineFigureGenerator('LogicUnion', (shape, w, h) => {
1691 const radius = 0.5;
1692 return new go.Geometry()
1693 .add(new go.PathFigure(w, 0, false)
1694 .add(new go.PathSegment(go.PathSegment.Line, w, radius * h))
1695 .add(new go.PathSegment(go.PathSegment.Arc, 0, 180, radius * w, radius * h, radius * w, radius * h))
1696 .add(new go.PathSegment(go.PathSegment.Line, 0, 0)))
1697 .setSpots(0, 0, 1, 0.5);
1698});
1699FigureParameter.setFigureParameter('Arrow', 0, new FigureParameter('ArrowheadWidth', .3, .01, .99));
1700FigureParameter.setFigureParameter('Arrow', 1, new FigureParameter('TailHeight', .3, .01, .99));
1701go.Shape.defineFigureGenerator('Arrow', (shape, w, h) => {
1702 let param1 = shape ? shape.parameter1 : NaN; // % width of arrowhead
1703 if (isNaN(param1))
1704 param1 = .3;
1705 let param2 = shape ? shape.parameter2 : NaN; // % height of tail
1706 if (isNaN(param2))
1707 param2 = .3;
1708 const x = (1 - param1) * w;
1709 const y1 = (.5 - param2 / 2) * h;
1710 const y2 = (.5 + param2 / 2) * h;
1711 const geo = new go.Geometry();
1712 const fig = new go.PathFigure(0, y1, true);
1713 geo.add(fig);
1714 fig.add(new go.PathSegment(go.PathSegment.Line, x, y1));
1715 fig.add(new go.PathSegment(go.PathSegment.Line, x, 0));
1716 fig.add(new go.PathSegment(go.PathSegment.Line, x, 0));
1717 fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
1718 fig.add(new go.PathSegment(go.PathSegment.Line, x, h));
1719 fig.add(new go.PathSegment(go.PathSegment.Line, x, y2));
1720 fig.add(new go.PathSegment(go.PathSegment.Line, 0, y2).close());
1721 geo.spot1 = new go.Spot(0, y1 / h);
1722 const temp = getIntersection(0, y2 / h, 1, y2 / h, x / w, 1, 1, .5, tempPoint());
1723 geo.spot2 = new go.Spot(temp.x, temp.y);
1724 freePoint(temp);
1725 return geo;
1726});
1727// Arrow with absolutes instead of scaling
1728FigureParameter.setFigureParameter('Arrow2', 0, new FigureParameter('ArrowheadWidth', 30));
1729FigureParameter.setFigureParameter('Arrow2', 1, new FigureParameter('TailHeight', 30));
1730go.Shape.defineFigureGenerator('Arrow2', (shape, w, h) => {
1731 let param1 = shape ? shape.parameter1 : NaN; // width of arrowhead
1732 if (isNaN(param1))
1733 param1 = 30;
1734 if (param1 > w)
1735 param1 = w;
1736 let param2 = shape ? shape.parameter2 : NaN; // height of tail
1737 if (isNaN(param2))
1738 param2 = 30;
1739 param2 = Math.min(param2, h / 2);
1740 const x = w - param1;
1741 const y1 = (h - param2) / 2;
1742 const y2 = y1 + param2;
1743 const geo = new go.Geometry();
1744 const fig = new go.PathFigure(0, y1, true);
1745 geo.add(fig);
1746 fig.add(new go.PathSegment(go.PathSegment.Line, x, y1));
1747 fig.add(new go.PathSegment(go.PathSegment.Line, x, 0));
1748 fig.add(new go.PathSegment(go.PathSegment.Line, x, 0));
1749 fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
1750 fig.add(new go.PathSegment(go.PathSegment.Line, x, h));
1751 fig.add(new go.PathSegment(go.PathSegment.Line, x, y2));
1752 fig.add(new go.PathSegment(go.PathSegment.Line, 0, y2).close());
1753 geo.spot1 = new go.Spot(0, y1 / h);
1754 const temp = getIntersection(0, y2 / h, 1, y2 / h, x / w, 1, 1, .5, tempPoint());
1755 geo.spot2 = new go.Spot(temp.x, temp.y);
1756 freePoint(temp);
1757 return geo;
1758});
1759go.Shape.defineFigureGenerator('Chevron', (shape, w, h) => {
1760 const geo = new go.Geometry();
1761 const fig = new go.PathFigure(0, 0, true);
1762 geo.add(fig);
1763 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));
1764 fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
1765 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));
1766 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
1767 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h).close());
1768 return geo;
1769});
1770go.Shape.defineFigureGenerator('DoubleArrow', (shape, w, h) => {
1771 const geo = new go.Geometry();
1772 const fig = new go.PathFigure(0, 0, true);
1773 geo.add(fig);
1774 fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 0.214 * h));
1775 fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 0));
1776 fig.add(new go.PathSegment(go.PathSegment.Line, 1.0 * w, .5 * h));
1777 fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 1.0 * h));
1778 fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 0.786 * h));
1779 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 1.0 * h).close());
1780 return geo;
1781});
1782FigureParameter.setFigureParameter('DoubleEndArrow', 0, new FigureParameter('ConnecterHeight', .3, .01, .99));
1783go.Shape.defineFigureGenerator('DoubleEndArrow', (shape, w, h) => {
1784 let param1 = shape ? shape.parameter1 : NaN; // height of midsection
1785 if (isNaN(param1))
1786 param1 = .3;
1787 const y1 = (.5 - param1 / 2) * h;
1788 const y2 = (.5 + param1 / 2) * h;
1789 const geo = new go.Geometry();
1790 const fig = new go.PathFigure(w, .5 * h, true);
1791 geo.add(fig);
1792 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h));
1793 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y2));
1794 fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, y2));
1795 fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, h));
1796 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h));
1797 fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 0));
1798 fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, y1));
1799 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y1));
1800 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, 0).close());
1801 let temp = getIntersection(0, .5, .3, 0, 0, y1 / h, .1, y1 / h, tempPoint());
1802 geo.spot1 = new go.Spot(temp.x, temp.y);
1803 temp = getIntersection(.7, 1, 1, .5, 0, y2 / h, 1, y2 / h, temp);
1804 geo.spot2 = new go.Spot(temp.x, temp.y);
1805 freePoint(temp);
1806 return geo;
1807});
1808// DoubleEndArrow with absolutes instead of scaling
1809FigureParameter.setFigureParameter('DoubleEndArrow2', 0, new FigureParameter('ConnecterHeight', 40));
1810FigureParameter.setFigureParameter('DoubleEndArrow2', 1, new FigureParameter('ArrowHeight', 100));
1811go.Shape.defineFigureGenerator('DoubleEndArrow2', (shape, w, h) => {
1812 let param1 = shape ? shape.parameter1 : NaN; // height of midsection
1813 if (isNaN(param1))
1814 param1 = 40;
1815 let param2 = shape ? shape.parameter2 : NaN; // height of arrows
1816 if (isNaN(param2))
1817 param2 = 100;
1818 /*
1819 y1outer
1820 /| |\
1821 / | | \
1822 / y1---- \
1823 / \
1824 \ /
1825 \ y2---- /
1826 \ | | /
1827 \| |/
1828 y2outer
1829 */
1830 let y1 = (h - param1) / 2;
1831 let y2 = y1 + param1;
1832 let y1outer = (h - param2) / 2;
1833 let y2outer = y1outer + param2;
1834 if (param1 > h || param2 > h) {
1835 if (param2 > param1) {
1836 param1 = param1 * h / param2; // use similar ratio
1837 y1 = (h - param1) / 2;
1838 y2 = y1 + param1;
1839 y1outer = 0;
1840 y2outer = h;
1841 }
1842 else {
1843 y1 = 0;
1844 y2 = h;
1845 y1outer = 0;
1846 y2outer = h;
1847 }
1848 }
1849 const geo = new go.Geometry();
1850 const fig = new go.PathFigure(w, .5 * h, true);
1851 geo.add(fig);
1852 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y2outer));
1853 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y2));
1854 fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, y2));
1855 fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, y2outer));
1856 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h));
1857 fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, y1outer));
1858 fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, y1));
1859 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y1));
1860 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y1outer).close());
1861 let temp = getIntersection(0, .5, .3, y1outer / h, 0, y1 / h, 1, y1 / h, tempPoint());
1862 geo.spot1 = new go.Spot(temp.x, temp.y);
1863 temp = getIntersection(.7, y2outer / h, 1, .5, 0, y2 / h, 1, y2 / h, temp);
1864 geo.spot2 = new go.Spot(temp.x, temp.y);
1865 freePoint(temp);
1866 return geo;
1867});
1868FigureParameter.setFigureParameter('IBeamArrow', 0, new FigureParameter('ConnectorHeight', .3, .01, .99));
1869go.Shape.defineFigureGenerator('IBeamArrow', (shape, w, h) => {
1870 let param1 = shape ? shape.parameter1 : NaN; // height of midsection
1871 if (isNaN(param1))
1872 param1 = .3;
1873 const y1 = (.5 - param1 / 2) * h;
1874 const y2 = (.5 + param1 / 2) * h;
1875 const geo = new go.Geometry();
1876 const fig = new go.PathFigure(w, .5 * h, true);
1877 geo.add(fig);
1878 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h));
1879 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y2));
1880 fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, y2));
1881 fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, h));
1882 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
1883 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
1884 fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, 0));
1885 fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, y1));
1886 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y1));
1887 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, 0).close());
1888 geo.spot1 = new go.Spot(0, y1 / h);
1889 const temp = getIntersection(.7, 1, 1, .5, 0, y2 / h, 1, y2 / h, tempPoint());
1890 geo.spot2 = new go.Spot(temp.x, temp.y);
1891 freePoint(temp);
1892 return geo;
1893});
1894// IBeamArrow with absolutes instead of scaling
1895FigureParameter.setFigureParameter('IBeamArrow2', 0, new FigureParameter('ConnectorHeight', 40));
1896FigureParameter.setFigureParameter('IBeamArrow2', 1, new FigureParameter('BeamArrowHeight', 100));
1897go.Shape.defineFigureGenerator('IBeamArrow2', (shape, w, h) => {
1898 let param1 = shape ? shape.parameter1 : NaN; // height of midsection
1899 if (isNaN(param1))
1900 param1 = 40;
1901 let param2 = shape ? shape.parameter2 : NaN; // height of beam and arrow
1902 if (isNaN(param2))
1903 param2 = 100;
1904 let y1 = (h - param1) / 2;
1905 let y2 = y1 + param1;
1906 let y1outer = (h - param2) / 2;
1907 let y2outer = y1outer + param2;
1908 if (param1 > h || param2 > h) {
1909 if (param2 > param1) {
1910 param1 = param1 * h / param2; // use similar ratio
1911 y1 = (h - param1) / 2;
1912 y2 = y1 + param1;
1913 y1outer = 0;
1914 y2outer = h;
1915 }
1916 else {
1917 y1 = 0;
1918 y2 = h;
1919 y1outer = 0;
1920 y2outer = h;
1921 }
1922 }
1923 const geo = new go.Geometry();
1924 const fig = new go.PathFigure(w, .5 * h, true);
1925 geo.add(fig);
1926 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y2outer));
1927 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y2));
1928 fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, y2));
1929 fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, y2outer));
1930 fig.add(new go.PathSegment(go.PathSegment.Line, 0, y2outer));
1931 fig.add(new go.PathSegment(go.PathSegment.Line, 0, y1outer));
1932 fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, y1outer));
1933 fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, y1));
1934 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y1));
1935 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y1outer).close());
1936 geo.spot1 = new go.Spot(0, y1 / h);
1937 const temp = getIntersection(.7, y2outer / h, 1, .5, 0, y2 / h, 1, y2 / h, tempPoint());
1938 geo.spot2 = new go.Spot(temp.x, temp.y);
1939 freePoint(temp);
1940 return geo;
1941});
1942FigureParameter.setFigureParameter('Pointer', 0, new FigureParameter('BackPoint', .1, 0, .2));
1943go.Shape.defineFigureGenerator('Pointer', (shape, w, h) => {
1944 let param1 = shape ? shape.parameter1 : NaN; // how much the back of the pointer comes in
1945 if (isNaN(param1))
1946 param1 = .1;
1947 const geo = new go.Geometry();
1948 const fig = new go.PathFigure(w, .5 * h, true);
1949 geo.add(fig);
1950 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
1951 fig.add(new go.PathSegment(go.PathSegment.Line, param1 * w, .5 * h));
1952 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0).close());
1953 geo.spot1 = new go.Spot(param1, .35);
1954 const temp = getIntersection(0, .65, 1, .65, 0, 1, 1, .5, tempPoint()); // ?? constant
1955 geo.spot2 = new go.Spot(temp.x, temp.y);
1956 freePoint(temp);
1957 return geo;
1958});
1959FigureParameter.setFigureParameter('RoundedPointer', 0, new FigureParameter('RoundedEdged', .3, 0, .5));
1960go.Shape.defineFigureGenerator('RoundedPointer', (shape, w, h) => {
1961 let param1 = shape ? shape.parameter1 : NaN; // how much the curved back of the pointer comes in
1962 if (isNaN(param1))
1963 param1 = .3;
1964 const geo = new go.Geometry();
1965 const fig = new go.PathFigure(w, .5 * h, true);
1966 geo.add(fig);
1967 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
1968 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0, param1 * w, .75 * h, param1 * w, .25 * h).close());
1969 geo.spot1 = new go.Spot(param1, .35);
1970 const temp = getIntersection(0, .65, 1, .65, 0, 1, 1, .5, tempPoint()); // ?? constant
1971 geo.spot2 = new go.Spot(temp.x, temp.y);
1972 freePoint(temp);
1973 return geo;
1974});
1975FigureParameter.setFigureParameter('SplitEndArrow', 0, new FigureParameter('TailHeight', 0.4, 0.01, .99));
1976go.Shape.defineFigureGenerator('SplitEndArrow', (shape, w, h) => {
1977 let param1 = shape ? shape.parameter1 : NaN; // % height of arrow tail
1978 if (isNaN(param1))
1979 param1 = .4;
1980 const y1 = (.5 - param1 / 2) * h;
1981 const y2 = (.5 + param1 / 2) * h;
1982 const geo = new go.Geometry();
1983 const fig = new go.PathFigure(w, .5 * h, true);
1984 geo.add(fig);
1985 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h));
1986 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y2));
1987 fig.add(new go.PathSegment(go.PathSegment.Line, 0, y2));
1988 fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .5 * h));
1989 fig.add(new go.PathSegment(go.PathSegment.Line, 0, y1));
1990 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y1));
1991 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, 0).close());
1992 geo.spot1 = new go.Spot(.2, y1 / h);
1993 const temp = getIntersection(.7, 1, 1, .5, 0, y2 / h, 1, y2 / h, tempPoint());
1994 geo.spot2 = new go.Spot(temp.x, temp.y);
1995 freePoint(temp);
1996 return geo;
1997});
1998// SplitEndArrow with absolutes instead of scaling
1999FigureParameter.setFigureParameter('SplitEndArrow2', 0, new FigureParameter('TailHeight', 40));
2000go.Shape.defineFigureGenerator('SplitEndArrow2', (shape, w, h) => {
2001 let param1 = shape ? shape.parameter1 : NaN; // height of arrow tail
2002 if (isNaN(param1))
2003 param1 = 50;
2004 let y1 = (h - param1) / 2;
2005 let y2 = y1 + param1;
2006 if (param1 > h) {
2007 y1 = 0;
2008 y2 = h;
2009 }
2010 const geo = new go.Geometry();
2011 const fig = new go.PathFigure(w, .5 * h, true);
2012 geo.add(fig);
2013 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h));
2014 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y2));
2015 fig.add(new go.PathSegment(go.PathSegment.Line, 0, y2));
2016 fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .5 * h));
2017 fig.add(new go.PathSegment(go.PathSegment.Line, 0, y1));
2018 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y1));
2019 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, 0).close());
2020 geo.spot1 = new go.Spot(.2, y1 / h);
2021 const temp = getIntersection(.7, 1, 1, .5, 0, y2 / h, 1, y2 / h, tempPoint());
2022 geo.spot2 = new go.Spot(temp.x, temp.y);
2023 freePoint(temp);
2024 return geo;
2025});
2026FigureParameter.setFigureParameter('SquareArrow', 0, new FigureParameter('ArrowPoint', .7, .2, .9));
2027go.Shape.defineFigureGenerator('SquareArrow', (shape, w, h) => {
2028 let param1 = shape ? shape.parameter1 : NaN; // pointiness of arrow, lower is more pointy
2029 if (isNaN(param1))
2030 param1 = .7;
2031 const geo = new go.Geometry();
2032 const fig = new go.PathFigure(w, .5 * h, true);
2033 geo.add(fig);
2034 fig.add(new go.PathSegment(go.PathSegment.Line, param1 * w, h));
2035 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
2036 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
2037 fig.add(new go.PathSegment(go.PathSegment.Line, param1 * w, 0).close());
2038 geo.spot1 = go.Spot.TopLeft;
2039 geo.spot2 = new go.Spot(param1, 1);
2040 return geo;
2041});
2042go.Shape.defineFigureGenerator('Cone1', (shape, w, h) => {
2043 const geo = new go.Geometry();
2044 const cpxOffset = KAPPA * .5;
2045 const cpyOffset = KAPPA * .1;
2046 const fig = new go.PathFigure(0, .9 * h, true);
2047 geo.add(fig);
2048 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));
2049 fig.add(new go.PathSegment(go.PathSegment.Line, w, .9 * h));
2050 fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, h, w, (.9 + cpyOffset) * h, (.5 + cpxOffset) * w, h));
2051 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .9 * h, (.5 - cpxOffset) * w, h, 0, (.9 + cpyOffset) * h).close());
2052 geo.spot1 = new go.Spot(.25, .5);
2053 geo.spot2 = new go.Spot(.75, .97);
2054 return geo;
2055});
2056go.Shape.defineFigureGenerator('Cone2', (shape, w, h) => {
2057 const geo = new go.Geometry();
2058 const fig = new go.PathFigure(0, .9 * h, true);
2059 geo.add(fig);
2060 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .9 * h, (1 - .85 / .9) * w, h, (.85 / .9) * w, h));
2061 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));
2062 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .9 * h).close());
2063 const fig2 = new go.PathFigure(0, .9 * h, false);
2064 geo.add(fig2);
2065 fig2.add(new go.PathSegment(go.PathSegment.Bezier, w, .9 * h, (1 - .85 / .9) * w, .8 * h, (.85 / .9) * w, .8 * h));
2066 geo.spot1 = new go.Spot(.25, .5);
2067 geo.spot2 = new go.Spot(.75, .82);
2068 return geo;
2069});
2070go.Shape.defineFigureGenerator('Cube1', (shape, w, h) => {
2071 const geo = new go.Geometry();
2072 const fig = new go.PathFigure(.5 * w, h, true);
2073 geo.add(fig);
2074 fig.add(new go.PathSegment(go.PathSegment.Line, w, .85 * h));
2075 fig.add(new go.PathSegment(go.PathSegment.Line, w, .15 * h));
2076 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));
2077 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .15 * h));
2078 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .85 * h).close());
2079 const fig2 = new go.PathFigure(.5 * w, h, false);
2080 geo.add(fig2);
2081 fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .3 * h));
2082 fig2.add(new go.PathSegment(go.PathSegment.Line, 0, .15 * h));
2083 fig2.add(new go.PathSegment(go.PathSegment.Move, .5 * w, .3 * h));
2084 fig2.add(new go.PathSegment(go.PathSegment.Line, w, .15 * h));
2085 geo.spot1 = new go.Spot(0, .3);
2086 geo.spot2 = new go.Spot(.5, .85);
2087 return geo;
2088});
2089go.Shape.defineFigureGenerator('Cube2', (shape, w, h) => {
2090 const geo = new go.Geometry();
2091 const fig = new go.PathFigure(0, .3 * h, true);
2092 geo.add(fig);
2093 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
2094 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h));
2095 fig.add(new go.PathSegment(go.PathSegment.Line, w, .7 * h));
2096 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
2097 fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 0).close());
2098 const fig2 = new go.PathFigure(0, .3 * h, false);
2099 geo.add(fig2);
2100 fig2.add(new go.PathSegment(go.PathSegment.Line, .7 * w, .3 * h));
2101 fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0));
2102 fig2.add(new go.PathSegment(go.PathSegment.Move, .7 * w, .3 * h));
2103 fig2.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h));
2104 geo.spot1 = new go.Spot(0, .3);
2105 geo.spot2 = new go.Spot(.7, 1);
2106 return geo;
2107});
2108go.Shape.defineFigureGenerator('Cylinder1', function (shape, w, h) {
2109 let param1 = shape ? shape.parameter1 : NaN; // half the height of the ellipse
2110 if (isNaN(param1))
2111 param1 = 5; // default value
2112 param1 = Math.min(param1, h / 3);
2113 const geo = new go.Geometry();
2114 const cpxOffset = KAPPA * .5;
2115 const fig = new go.PathFigure(0, param1, true);
2116 geo.add(fig);
2117 // The base (top)
2118 fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, 0, 0, KAPPA * param1, (.5 - cpxOffset) * w, 0));
2119 fig.add(new go.PathSegment(go.PathSegment.Bezier, 1.0 * w, param1, (.5 + cpxOffset) * w, 0, 1.0 * w, KAPPA * param1));
2120 fig.add(new go.PathSegment(go.PathSegment.Line, w, h - param1));
2121 // Bottom curve
2122 fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, 1.0 * h, 1.0 * w, h - KAPPA * param1, (.5 + cpxOffset) * w, 1.0 * h));
2123 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, h - param1, (.5 - cpxOffset) * w, 1.0 * h, 0, h - KAPPA * param1));
2124 fig.add(new go.PathSegment(go.PathSegment.Line, 0, param1));
2125 const fig2 = new go.PathFigure(w, param1, false);
2126 geo.add(fig2);
2127 fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, 2 * param1, 1.0 * w, 2 * param1 - KAPPA * param1, (.5 + cpxOffset) * w, 2 * param1));
2128 fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0, param1, (.5 - cpxOffset) * w, 2 * param1, 0, 2 * param1 - KAPPA * param1));
2129 geo.spot1 = new go.Spot(0, 0, 0, 2 * param1);
2130 geo.spot2 = new go.Spot(1, 1);
2131 return geo;
2132});
2133go.Shape.defineFigureGenerator('Cylinder2', function (shape, w, h) {
2134 let param1 = shape ? shape.parameter1 : NaN; // half the height of the ellipse
2135 if (isNaN(param1))
2136 param1 = 5; // default value
2137 param1 = Math.min(param1, h / 3);
2138 const geo = new go.Geometry();
2139 const cpxOffset = KAPPA * .5;
2140 const fig = new go.PathFigure(0, h - param1, true);
2141 geo.add(fig);
2142 // The body, starting and ending bottom left
2143 fig.add(new go.PathSegment(go.PathSegment.Line, 0, param1));
2144 fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, 0, 0, KAPPA * param1, (.5 - cpxOffset) * w, 0));
2145 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, param1, (.5 + cpxOffset) * w, 0, w, KAPPA * param1));
2146 fig.add(new go.PathSegment(go.PathSegment.Line, w, h - param1));
2147 fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, h, w, h - KAPPA * param1, (.5 + cpxOffset) * w, h));
2148 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, h - param1, (.5 - cpxOffset) * w, h, 0, h - KAPPA * param1));
2149 const fig2 = new go.PathFigure(0, h - param1, false);
2150 geo.add(fig2);
2151 // The base (bottom)
2152 fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, h - 2 * param1, 0, h - param1 - KAPPA * param1, (.5 - cpxOffset) * w, h - 2 * param1));
2153 fig2.add(new go.PathSegment(go.PathSegment.Bezier, w, h - param1, (.5 + cpxOffset) * w, h - 2 * param1, w, h - param1 - KAPPA * param1));
2154 geo.spot1 = new go.Spot(0, 0);
2155 geo.spot2 = new go.Spot(1, 1, 0, -2 * param1);
2156 return geo;
2157});
2158go.Shape.defineFigureGenerator('Cylinder3', function (shape, w, h) {
2159 let param1 = shape ? shape.parameter1 : NaN; // half the width of the ellipse
2160 if (isNaN(param1))
2161 param1 = 5; // default value
2162 param1 = Math.min(param1, w / 3);
2163 const geo = new go.Geometry();
2164 const cpyOffset = KAPPA * .5;
2165 const fig = new go.PathFigure(param1, 0, true);
2166 geo.add(fig);
2167 // The body, starting and ending top left
2168 fig.add(new go.PathSegment(go.PathSegment.Line, w - param1, 0));
2169 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, w - KAPPA * param1, 0, w, (.5 - cpyOffset) * h));
2170 fig.add(new go.PathSegment(go.PathSegment.Bezier, w - param1, h, w, (.5 + cpyOffset) * h, w - KAPPA * param1, h));
2171 fig.add(new go.PathSegment(go.PathSegment.Line, param1, h));
2172 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .5 * h, KAPPA * param1, h, 0, (.5 + cpyOffset) * h));
2173 fig.add(new go.PathSegment(go.PathSegment.Bezier, param1, 0, 0, (.5 - cpyOffset) * h, KAPPA * param1, 0));
2174 const fig2 = new go.PathFigure(param1, 0, false);
2175 geo.add(fig2);
2176 // Cylinder line (left)
2177 fig2.add(new go.PathSegment(go.PathSegment.Bezier, 2 * param1, .5 * h, param1 + KAPPA * param1, 0, 2 * param1, (.5 - cpyOffset) * h));
2178 fig2.add(new go.PathSegment(go.PathSegment.Bezier, param1, h, 2 * param1, (.5 + cpyOffset) * h, param1 + KAPPA * param1, h));
2179 geo.spot1 = new go.Spot(0, 0, 2 * param1, 0);
2180 geo.spot2 = new go.Spot(1, 1);
2181 return geo;
2182});
2183go.Shape.defineFigureGenerator('Cylinder4', function (shape, w, h) {
2184 let param1 = shape ? shape.parameter1 : NaN; // half the width of the ellipse
2185 if (isNaN(param1))
2186 param1 = 5; // default value
2187 param1 = Math.min(param1, w / 3);
2188 const geo = new go.Geometry();
2189 const cpyOffset = KAPPA * .5;
2190 const fig = new go.PathFigure(w - param1, 0, true);
2191 geo.add(fig);
2192 // The body, starting and ending top right
2193 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, w - KAPPA * param1, 0, w, (.5 - cpyOffset) * h));
2194 fig.add(new go.PathSegment(go.PathSegment.Bezier, w - param1, h, w, (.5 + cpyOffset) * h, w - KAPPA * param1, h));
2195 fig.add(new go.PathSegment(go.PathSegment.Line, param1, h));
2196 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .5 * h, KAPPA * param1, h, 0, (.5 + cpyOffset) * h));
2197 fig.add(new go.PathSegment(go.PathSegment.Bezier, param1, 0, 0, (.5 - cpyOffset) * h, KAPPA * param1, 0));
2198 fig.add(new go.PathSegment(go.PathSegment.Line, w - param1, 0));
2199 const fig2 = new go.PathFigure(w - param1, 0, false);
2200 geo.add(fig2);
2201 // Cylinder line (right)
2202 fig2.add(new go.PathSegment(go.PathSegment.Bezier, w - 2 * param1, .5 * h, w - param1 - KAPPA * param1, 0, w - 2 * param1, (.5 - cpyOffset) * h));
2203 fig2.add(new go.PathSegment(go.PathSegment.Bezier, w - param1, h, w - 2 * param1, (.5 + cpyOffset) * h, w - param1 - KAPPA * param1, h));
2204 geo.spot1 = new go.Spot(0, 0);
2205 geo.spot2 = new go.Spot(1, 1, -2 * param1, 0);
2206 return geo;
2207});
2208go.Shape.defineFigureGenerator('Prism1', (shape, w, h) => {
2209 const geo = new go.Geometry();
2210 const fig = new go.PathFigure(.25 * w, .25 * h, true);
2211 geo.add(fig);
2212 fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));
2213 fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
2214 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));
2215 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
2216 const fig2 = new go.PathFigure(.25 * w, .25 * h, false);
2217 geo.add(fig2);
2218 // Inner prism line
2219 fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));
2220 geo.spot1 = new go.Spot(.408, .172);
2221 geo.spot2 = new go.Spot(.833, .662);
2222 return geo;
2223});
2224go.Shape.defineFigureGenerator('Prism2', (shape, w, h) => {
2225 const geo = new go.Geometry();
2226 const fig = new go.PathFigure(0, .25 * h, true);
2227 geo.add(fig);
2228 fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));
2229 fig.add(new go.PathSegment(go.PathSegment.Line, w, .25 * h));
2230 fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, .75 * h));
2231 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
2232 const fig2 = new go.PathFigure(0, h, false);
2233 geo.add(fig2);
2234 // Inner prism lines
2235 fig2.add(new go.PathSegment(go.PathSegment.Line, .25 * w, .5 * h));
2236 fig2.add(new go.PathSegment(go.PathSegment.Line, w, .25 * h));
2237 fig2.add(new go.PathSegment(go.PathSegment.Move, 0, .25 * h));
2238 fig2.add(new go.PathSegment(go.PathSegment.Line, .25 * w, .5 * h));
2239 geo.spot1 = new go.Spot(.25, .5);
2240 geo.spot2 = new go.Spot(.75, .75);
2241 return geo;
2242});
2243go.Shape.defineFigureGenerator('Pyramid1', (shape, w, h) => {
2244 const geo = new go.Geometry();
2245 const fig = new go.PathFigure(.5 * w, 0, true);
2246 geo.add(fig);
2247 fig.add(new go.PathSegment(go.PathSegment.Line, w, .75 * h));
2248 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));
2249 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .75 * h).close());
2250 const fig2 = new go.PathFigure(.5 * w, 0, false);
2251 geo.add(fig2);
2252 // Inner pyramind line
2253 fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));
2254 geo.spot1 = new go.Spot(.25, .367);
2255 geo.spot2 = new go.Spot(.75, .875);
2256 return geo;
2257});
2258go.Shape.defineFigureGenerator('Pyramid2', (shape, w, h) => {
2259 const geo = new go.Geometry();
2260 const fig = new go.PathFigure(.5 * w, 0, true);
2261 geo.add(fig);
2262 fig.add(new go.PathSegment(go.PathSegment.Line, w, .85 * h));
2263 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));
2264 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .85 * h).close());
2265 const fig2 = new go.PathFigure(.5 * w, 0, false);
2266 geo.add(fig2);
2267 // Inner pyramid lines
2268 fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .7 * h));
2269 fig2.add(new go.PathSegment(go.PathSegment.Line, 0, .85 * h));
2270 fig2.add(new go.PathSegment(go.PathSegment.Move, .5 * w, .7 * h));
2271 fig2.add(new go.PathSegment(go.PathSegment.Line, w, .85 * h));
2272 geo.spot1 = new go.Spot(.25, .367);
2273 geo.spot2 = new go.Spot(.75, .875);
2274 return geo;
2275});
2276go.Shape.defineFigureGenerator('Actor', (shape, w, h) => {
2277 const geo = new go.Geometry();
2278 const radiusw = .2;
2279 const radiush = .1;
2280 const offsetw = KAPPA * radiusw;
2281 const offseth = KAPPA * radiush;
2282 let centerx = .5;
2283 let centery = .1;
2284 const fig = new go.PathFigure(centerx * w, (centery + radiush) * h, true);
2285 geo.add(fig);
2286 // Head
2287 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radiusw) * w, centery * h, (centerx - offsetw) * w, (centery + radiush) * h, (centerx - radiusw) * w, (centery + offseth) * h));
2288 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radiush) * h, (centerx - radiusw) * w, (centery - offseth) * h, (centerx - offsetw) * w, (centery - radiush) * h));
2289 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radiusw) * w, centery * h, (centerx + offsetw) * w, (centery - radiush) * h, (centerx + radiusw) * w, (centery - offseth) * h));
2290 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radiush) * h, (centerx + radiusw) * w, (centery + offseth) * h, (centerx + offsetw) * w, (centery + radiush) * h));
2291 let r = .05;
2292 let cpOffset = KAPPA * r;
2293 centerx = .05;
2294 centery = .25;
2295 const fig2 = new go.PathFigure(.5 * w, .2 * h, true);
2296 geo.add(fig2);
2297 // Body
2298 fig2.add(new go.PathSegment(go.PathSegment.Line, .95 * w, .2 * h));
2299 centerx = .95;
2300 centery = .25;
2301 // Right arm
2302 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + r) * w, centery * h, (centerx + cpOffset) * w, (centery - r) * h, (centerx + r) * w, (centery - cpOffset) * h));
2303 fig2.add(new go.PathSegment(go.PathSegment.Line, w, .6 * h));
2304 fig2.add(new go.PathSegment(go.PathSegment.Line, .85 * w, .6 * h));
2305 fig2.add(new go.PathSegment(go.PathSegment.Line, .85 * w, .35 * h));
2306 r = .025;
2307 cpOffset = KAPPA * r;
2308 centerx = .825;
2309 centery = .35;
2310 // Right under arm
2311 fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - r) * h, (centerx + r) * w, (centery - cpOffset) * h, (centerx + cpOffset) * w, (centery - r) * h));
2312 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - r) * w, centery * h, (centerx - cpOffset) * w, (centery - r) * h, (centerx - r) * w, (centery - cpOffset) * h));
2313 // Right side/leg
2314 fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, h));
2315 fig2.add(new go.PathSegment(go.PathSegment.Line, .55 * w, h));
2316 fig2.add(new go.PathSegment(go.PathSegment.Line, .55 * w, .7 * h));
2317 // Right in between
2318 r = .05;
2319 cpOffset = KAPPA * r;
2320 centerx = .5;
2321 centery = .7;
2322 fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - r) * h, (centerx + r) * w, (centery - cpOffset) * h, (centerx + cpOffset) * w, (centery - r) * h));
2323 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - r) * w, centery * h, (centerx - cpOffset) * w, (centery - r) * h, (centerx - r) * w, (centery - cpOffset) * h));
2324 // Left side/leg
2325 fig2.add(new go.PathSegment(go.PathSegment.Line, .45 * w, h));
2326 fig2.add(new go.PathSegment(go.PathSegment.Line, .2 * w, h));
2327 fig2.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .35 * h));
2328 r = .025;
2329 cpOffset = KAPPA * r;
2330 centerx = .175;
2331 centery = .35;
2332 // Left under arm
2333 fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - r) * h, (centerx + r) * w, (centery - cpOffset) * h, (centerx + cpOffset) * w, (centery - r) * h));
2334 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - r) * w, centery * h, (centerx - cpOffset) * w, (centery - r) * h, (centerx - r) * w, (centery - cpOffset) * h));
2335 // Left arm
2336 fig2.add(new go.PathSegment(go.PathSegment.Line, .15 * w, .6 * h));
2337 fig2.add(new go.PathSegment(go.PathSegment.Line, 0, .6 * h));
2338 fig2.add(new go.PathSegment(go.PathSegment.Line, 0, .25 * h));
2339 r = .05;
2340 cpOffset = KAPPA * r;
2341 centerx = .05;
2342 centery = .25;
2343 // Left shoulder
2344 fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - r) * h, (centerx - r) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - r) * h));
2345 fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .2 * h));
2346 geo.spot1 = new go.Spot(.2, .2);
2347 geo.spot2 = new go.Spot(.8, .65);
2348 return geo;
2349});
2350FigureParameter.setFigureParameter('Card', 0, new FigureParameter('CornerCutoutSize', .2, .1, .9));
2351go.Shape.defineFigureGenerator('Card', (shape, w, h) => {
2352 let param1 = shape ? shape.parameter1 : NaN; // size of corner cutout
2353 if (isNaN(param1))
2354 param1 = .2;
2355 const geo = new go.Geometry();
2356 const fig = new go.PathFigure(w, 0, true);
2357 geo.add(fig);
2358 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
2359 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
2360 fig.add(new go.PathSegment(go.PathSegment.Line, 0, param1 * h));
2361 fig.add(new go.PathSegment(go.PathSegment.Line, param1 * w, 0).close());
2362 geo.spot1 = new go.Spot(0, param1);
2363 geo.spot2 = go.Spot.BottomRight;
2364 return geo;
2365});
2366go.Shape.defineFigureGenerator('Collate', (shape, w, h) => {
2367 const geo = new go.Geometry();
2368 const fig = new go.PathFigure(.5 * w, .5 * h, true);
2369 geo.add(fig);
2370 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
2371 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
2372 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h));
2373 const fig2 = new go.PathFigure(.5 * w, .5 * h, true);
2374 geo.add(fig2);
2375 fig2.add(new go.PathSegment(go.PathSegment.Line, w, h));
2376 fig2.add(new go.PathSegment(go.PathSegment.Line, 0, h));
2377 fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h));
2378 geo.spot1 = new go.Spot(.25, 0);
2379 geo.spot2 = new go.Spot(.75, .25);
2380 return geo;
2381});
2382go.Shape.defineFigureGenerator('CreateRequest', (shape, w, h) => {
2383 const geo = new go.Geometry();
2384 let param1 = shape ? shape.parameter1 : NaN;
2385 if (isNaN(param1))
2386 param1 = .1;
2387 const fig = new go.PathFigure(0, 0, true);
2388 geo.add(fig);
2389 // Body
2390 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
2391 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
2392 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
2393 const fig2 = new go.PathFigure(0, param1 * h, false);
2394 geo.add(fig2);
2395 // Inside lines
2396 fig2.add(new go.PathSegment(go.PathSegment.Line, w, param1 * h));
2397 fig2.add(new go.PathSegment(go.PathSegment.Move, 0, (1 - param1) * h));
2398 fig2.add(new go.PathSegment(go.PathSegment.Line, w, (1 - param1) * h));
2399 // ??? geo.spot1 = new go.Spot(0, param1);
2400 // ??? geo.spot2 = new go.Spot(1, 1 - param1);
2401 return geo;
2402});
2403go.Shape.defineFigureGenerator('Database', (shape, w, h) => {
2404 const geo = new go.Geometry();
2405 const cpxOffset = KAPPA * .5;
2406 const cpyOffset = KAPPA * .1;
2407 const fig = new go.PathFigure(w, .1 * h, true);
2408 geo.add(fig);
2409 // Body
2410 fig.add(new go.PathSegment(go.PathSegment.Line, w, .9 * h));
2411 fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, h, w, (.9 + cpyOffset) * h, (.5 + cpxOffset) * w, h));
2412 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .9 * h, (.5 - cpxOffset) * w, h, 0, (.9 + cpyOffset) * h));
2413 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .1 * h));
2414 fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, 0, 0, (.1 - cpyOffset) * h, (.5 - cpxOffset) * w, 0));
2415 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .1 * h, (.5 + cpxOffset) * w, 0, w, (.1 - cpyOffset) * h));
2416 const fig2 = new go.PathFigure(w, .1 * h, false);
2417 geo.add(fig2);
2418 // Rings
2419 fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .2 * h, w, (.1 + cpyOffset) * h, (.5 + cpxOffset) * w, .2 * h));
2420 fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0, .1 * h, (.5 - cpxOffset) * w, .2 * h, 0, (.1 + cpyOffset) * h));
2421 fig2.add(new go.PathSegment(go.PathSegment.Move, w, .2 * h));
2422 fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .3 * h, w, (.2 + cpyOffset) * h, (.5 + cpxOffset) * w, .3 * h));
2423 fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0, .2 * h, (.5 - cpxOffset) * w, .3 * h, 0, (.2 + cpyOffset) * h));
2424 fig2.add(new go.PathSegment(go.PathSegment.Move, w, .3 * h));
2425 fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .4 * h, w, (.3 + cpyOffset) * h, (.5 + cpxOffset) * w, .4 * h));
2426 fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0, .3 * h, (.5 - cpxOffset) * w, .4 * h, 0, (.3 + cpyOffset) * h));
2427 geo.spot1 = new go.Spot(0, .4);
2428 geo.spot2 = new go.Spot(1, .9);
2429 return geo;
2430});
2431go.Shape.defineFigureGenerator('DataStorage', (shape, w, h) => {
2432 const geo = new go.Geometry();
2433 const fig = new go.PathFigure(0, 0, true);
2434 geo.add(fig);
2435 fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));
2436 fig.add(new go.PathSegment(go.PathSegment.Bezier, .75 * w, h, w, 0, w, h));
2437 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
2438 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0, .25 * w, .9 * h, .25 * w, .1 * h).close());
2439 geo.spot1 = new go.Spot(.226, 0);
2440 geo.spot2 = new go.Spot(.81, 1);
2441 return geo;
2442});
2443go.Shape.defineFigureGenerator('DiskStorage', (shape, w, h) => {
2444 const geo = new go.Geometry();
2445 const cpxOffset = KAPPA * .5;
2446 const cpyOffset = KAPPA * .1;
2447 const fig = new go.PathFigure(w, .1 * h, true);
2448 geo.add(fig);
2449 // Body
2450 fig.add(new go.PathSegment(go.PathSegment.Line, w, .9 * h));
2451 fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, h, w, (.9 + cpyOffset) * h, (.5 + cpxOffset) * w, h));
2452 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .9 * h, (.5 - cpxOffset) * w, h, 0, (.9 + cpyOffset) * h));
2453 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .1 * h));
2454 fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, 0, 0, (.1 - cpyOffset) * h, (.5 - cpxOffset) * w, 0));
2455 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .1 * h, (.5 + cpxOffset) * w, 0, w, (.1 - cpyOffset) * h));
2456 const fig2 = new go.PathFigure(w, .1 * h, false);
2457 geo.add(fig2);
2458 // Rings
2459 fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .2 * h, w, (.1 + cpyOffset) * h, (.5 + cpxOffset) * w, .2 * h));
2460 fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0, .1 * h, (.5 - cpxOffset) * w, .2 * h, 0, (.1 + cpyOffset) * h));
2461 fig2.add(new go.PathSegment(go.PathSegment.Move, w, .2 * h));
2462 fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .3 * h, w, (.2 + cpyOffset) * h, (.5 + cpxOffset) * w, .3 * h));
2463 fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0, .2 * h, (.5 - cpxOffset) * w, .3 * h, 0, (.2 + cpyOffset) * h));
2464 geo.spot1 = new go.Spot(0, .3);
2465 geo.spot2 = new go.Spot(1, .9);
2466 return geo;
2467});
2468go.Shape.defineFigureGenerator('Display', (shape, w, h) => {
2469 const geo = new go.Geometry();
2470 const fig = new go.PathFigure(.25 * w, 0, true);
2471 geo.add(fig);
2472 fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));
2473 fig.add(new go.PathSegment(go.PathSegment.Bezier, .75 * w, h, w, 0, w, h));
2474 fig.add(new go.PathSegment(go.PathSegment.Line, .25 * w, h));
2475 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h).close());
2476 geo.spot1 = new go.Spot(.25, 0);
2477 geo.spot2 = new go.Spot(.75, 1);
2478 return geo;
2479});
2480go.Shape.defineFigureGenerator('DividedEvent', (shape, w, h) => {
2481 const geo = new go.Geometry();
2482 let param1 = shape ? shape.parameter1 : NaN;
2483 if (isNaN(param1))
2484 param1 = .2;
2485 else if (param1 < .15)
2486 param1 = .15; // Minimum
2487 const cpOffset = KAPPA * .2;
2488 const fig = new go.PathFigure(0, .2 * h, true);
2489 geo.add(fig);
2490 fig.add(new go.PathSegment(go.PathSegment.Bezier, .2 * w, 0, 0, (.2 - cpOffset) * h, (.2 - cpOffset) * w, 0));
2491 fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, 0));
2492 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .2 * h, (.8 + cpOffset) * w, 0, w, (.2 - cpOffset) * h));
2493 fig.add(new go.PathSegment(go.PathSegment.Line, w, .8 * h));
2494 fig.add(new go.PathSegment(go.PathSegment.Bezier, .8 * w, h, w, (.8 + cpOffset) * h, (.8 + cpOffset) * w, h));
2495 fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, h));
2496 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .8 * h, (.2 - cpOffset) * w, h, 0, (.8 + cpOffset) * h));
2497 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .2 * h));
2498 const fig2 = new go.PathFigure(0, param1 * h, false);
2499 geo.add(fig2);
2500 fig2.add(new go.PathSegment(go.PathSegment.Line, w, param1 * h));
2501 // ??? geo.spot1 = new go.Spot(0, param1);
2502 // ??? geo.spot2 = new go.Spot(1, 1 - param1);
2503 return geo;
2504});
2505go.Shape.defineFigureGenerator('DividedProcess', (shape, w, h) => {
2506 const geo = new go.Geometry();
2507 let param1 = shape ? shape.parameter1 : NaN;
2508 if (isNaN(param1) || param1 < .1)
2509 param1 = .1; // Minimum
2510 const fig = new go.PathFigure(0, 0, true);
2511 geo.add(fig);
2512 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
2513 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
2514 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
2515 const fig2 = new go.PathFigure(0, param1 * h, false);
2516 geo.add(fig2);
2517 fig2.add(new go.PathSegment(go.PathSegment.Line, w, param1 * h));
2518 // ??? geo.spot1 = new go.Spot(0, param1);
2519 // ??? geo.spot2 = go.Spot.BottomRight;
2520 return geo;
2521});
2522go.Shape.defineFigureGenerator('Document', (shape, w, h) => {
2523 const geo = new go.Geometry();
2524 h = h / .8;
2525 const fig = new go.PathFigure(0, .7 * h, true);
2526 geo.add(fig);
2527 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
2528 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
2529 fig.add(new go.PathSegment(go.PathSegment.Line, w, .7 * h));
2530 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .7 * h, .5 * w, .4 * h, .5 * w, h).close());
2531 geo.spot1 = go.Spot.TopLeft;
2532 geo.spot2 = new go.Spot(1, .6);
2533 return geo;
2534});
2535go.Shape.defineFigureGenerator('ExternalOrganization', (shape, w, h) => {
2536 const geo = new go.Geometry();
2537 let param1 = shape ? shape.parameter1 : NaN;
2538 if (isNaN(param1) || param1 < .2)
2539 param1 = .2; // Minimum
2540 const fig = new go.PathFigure(0, 0, true);
2541 geo.add(fig);
2542 // Body
2543 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
2544 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
2545 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
2546 const fig2 = new go.PathFigure(param1 * w, 0, false);
2547 geo.add(fig2);
2548 // Top left triangle
2549 fig2.add(new go.PathSegment(go.PathSegment.Line, 0, param1 * h));
2550 // Top right triangle
2551 fig2.add(new go.PathSegment(go.PathSegment.Move, w, param1 * h));
2552 fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, 0));
2553 // Bottom left triangle
2554 fig2.add(new go.PathSegment(go.PathSegment.Move, 0, (1 - param1) * h));
2555 fig2.add(new go.PathSegment(go.PathSegment.Line, param1 * w, h));
2556 // Bottom right triangle
2557 fig2.add(new go.PathSegment(go.PathSegment.Move, (1 - param1) * w, h));
2558 fig2.add(new go.PathSegment(go.PathSegment.Line, w, (1 - param1) * h));
2559 // ??? geo.spot1 = new go.Spot(param1 / 2, param1 / 2);
2560 // ??? geo.spot2 = new go.Spot(1 - param1 / 2, 1 - param1 / 2);
2561 return geo;
2562});
2563go.Shape.defineFigureGenerator('ExternalProcess', (shape, w, h) => {
2564 const geo = new go.Geometry();
2565 const fig = new go.PathFigure(.5 * w, 0, true);
2566 geo.add(fig);
2567 // Body
2568 fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
2569 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));
2570 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h).close());
2571 const fig2 = new go.PathFigure(.1 * w, .4 * h, false);
2572 geo.add(fig2);
2573 // Top left triangle
2574 fig2.add(new go.PathSegment(go.PathSegment.Line, .1 * w, .6 * h));
2575 // Top right triangle
2576 fig2.add(new go.PathSegment(go.PathSegment.Move, .9 * w, .6 * h));
2577 fig2.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .4 * h));
2578 // Bottom left triangle
2579 fig2.add(new go.PathSegment(go.PathSegment.Move, .6 * w, .1 * h));
2580 fig2.add(new go.PathSegment(go.PathSegment.Line, .4 * w, .1 * h));
2581 // Bottom right triangle
2582 fig2.add(new go.PathSegment(go.PathSegment.Move, .4 * w, .9 * h));
2583 fig2.add(new go.PathSegment(go.PathSegment.Line, .6 * w, .9 * h));
2584 geo.spot1 = new go.Spot(.25, .25);
2585 geo.spot2 = new go.Spot(.75, .75);
2586 return geo;
2587});
2588go.Shape.defineFigureGenerator('File', (shape, w, h) => {
2589 const geo = new go.Geometry();
2590 const fig = new go.PathFigure(0, 0, true); // starting point
2591 geo.add(fig);
2592 fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));
2593 fig.add(new go.PathSegment(go.PathSegment.Line, w, .25 * h));
2594 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
2595 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
2596 const fig2 = new go.PathFigure(.75 * w, 0, false);
2597 geo.add(fig2);
2598 // The Fold
2599 fig2.add(new go.PathSegment(go.PathSegment.Line, .75 * w, .25 * h));
2600 fig2.add(new go.PathSegment(go.PathSegment.Line, w, .25 * h));
2601 geo.spot1 = new go.Spot(0, .25);
2602 geo.spot2 = go.Spot.BottomRight;
2603 return geo;
2604});
2605go.Shape.defineFigureGenerator('Interrupt', (shape, w, h) => {
2606 const geo = new go.Geometry();
2607 const fig = new go.PathFigure(w, .5 * h, true);
2608 geo.add(fig);
2609 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
2610 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
2611 fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
2612 const fig2 = new go.PathFigure(w, .5 * h, false);
2613 geo.add(fig2);
2614 fig2.add(new go.PathSegment(go.PathSegment.Line, w, h));
2615 const fig3 = new go.PathFigure(w, .5 * h, false);
2616 geo.add(fig3);
2617 fig3.add(new go.PathSegment(go.PathSegment.Line, w, 0));
2618 geo.spot1 = new go.Spot(0, .25);
2619 geo.spot2 = new go.Spot(.5, .75);
2620 return geo;
2621});
2622go.Shape.defineFigureGenerator('InternalStorage', (shape, w, h) => {
2623 const geo = new go.Geometry();
2624 let param1 = shape ? shape.parameter1 : NaN;
2625 let param2 = shape ? shape.parameter2 : NaN;
2626 if (isNaN(param1))
2627 param1 = .1; // Distance from left
2628 if (isNaN(param2))
2629 param2 = .1; // Distance from top
2630 const fig = new go.PathFigure(0, 0, true);
2631 geo.add(fig);
2632 // The main body
2633 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
2634 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
2635 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
2636 const fig2 = new go.PathFigure(param1 * w, 0, false);
2637 geo.add(fig2);
2638 // Two lines
2639 fig2.add(new go.PathSegment(go.PathSegment.Line, param1 * w, h));
2640 fig2.add(new go.PathSegment(go.PathSegment.Move, 0, param2 * h));
2641 fig2.add(new go.PathSegment(go.PathSegment.Line, w, param2 * h));
2642 // ??? geo.spot1 = new go.Spot(param1, param2);
2643 // ??? geo.spot2 = go.Spot.BottomRight;
2644 return geo;
2645});
2646go.Shape.defineFigureGenerator('Junction', (shape, w, h) => {
2647 const geo = new go.Geometry();
2648 const dist = (1 / Math.SQRT2);
2649 const small = ((1 - 1 / Math.SQRT2) / 2);
2650 const cpOffset = KAPPA * .5;
2651 const radius = .5;
2652 const fig = new go.PathFigure(w, radius * h, true);
2653 geo.add(fig);
2654 // Circle
2655 fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, h, w, (radius + cpOffset) * h, (radius + cpOffset) * w, h));
2656 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, radius * h, (radius - cpOffset) * w, h, 0, (radius + cpOffset) * h));
2657 fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, 0, 0, (radius - cpOffset) * h, (radius - cpOffset) * w, 0));
2658 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, radius * h, (radius + cpOffset) * w, 0, w, (radius - cpOffset) * h));
2659 const fig2 = new go.PathFigure((small + dist) * w, (small + dist) * h, false);
2660 geo.add(fig2);
2661 // X
2662 fig2.add(new go.PathSegment(go.PathSegment.Line, small * w, small * h));
2663 fig2.add(new go.PathSegment(go.PathSegment.Move, small * w, (small + dist) * h));
2664 fig2.add(new go.PathSegment(go.PathSegment.Line, (small + dist) * w, small * h));
2665 return geo;
2666});
2667go.Shape.defineFigureGenerator('LinedDocument', (shape, w, h) => {
2668 const geo = new go.Geometry();
2669 h = h / .8;
2670 const fig = new go.PathFigure(0, .7 * h, true);
2671 geo.add(fig);
2672 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
2673 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
2674 fig.add(new go.PathSegment(go.PathSegment.Line, w, .7 * h));
2675 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .7 * h, .5 * w, .4 * h, .5 * w, h).close());
2676 const fig2 = new go.PathFigure(.1 * w, 0, false);
2677 geo.add(fig2);
2678 fig2.add(new go.PathSegment(go.PathSegment.Line, .1 * w, .75 * h));
2679 geo.spot1 = new go.Spot(.1, 0);
2680 geo.spot2 = new go.Spot(1, .6);
2681 return geo;
2682});
2683go.Shape.defineFigureGenerator('LoopLimit', (shape, w, h) => {
2684 const geo = new go.Geometry();
2685 const fig = new go.PathFigure(0, h, true);
2686 geo.add(fig);
2687 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .25 * h));
2688 fig.add(new go.PathSegment(go.PathSegment.Line, .25 * w, 0));
2689 fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));
2690 fig.add(new go.PathSegment(go.PathSegment.Line, w, .25 * h));
2691 fig.add(new go.PathSegment(go.PathSegment.Line, w, h).close());
2692 geo.spot1 = new go.Spot(0, .25);
2693 geo.spot2 = go.Spot.BottomRight;
2694 return geo;
2695});
2696go.Shape.defineFigureGenerator('MagneticTape', (shape, w, h) => {
2697 const geo = new go.Geometry();
2698 const cpOffset = KAPPA * .5;
2699 const radius = .5;
2700 const fig = new go.PathFigure(.5 * w, h, true);
2701 geo.add(fig);
2702 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, radius * h, (radius - cpOffset) * w, h, 0, (radius + cpOffset) * h));
2703 fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, 0, 0, (radius - cpOffset) * h, (radius - cpOffset) * w, 0));
2704 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, radius * h, (radius + cpOffset) * w, 0, w, (radius - cpOffset) * h));
2705 fig.add(new go.PathSegment(go.PathSegment.Bezier, (radius + .1) * w, .9 * h, w, (radius + cpOffset) * h, (radius + cpOffset) * w, .9 * h));
2706 fig.add(new go.PathSegment(go.PathSegment.Line, w, .9 * h));
2707 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
2708 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));
2709 geo.spot1 = new go.Spot(.15, .15);
2710 geo.spot2 = new go.Spot(.85, .8);
2711 return geo;
2712});
2713go.Shape.defineFigureGenerator('ManualInput', (shape, w, h) => {
2714 const geo = new go.Geometry();
2715 const fig = new go.PathFigure(w, 0, true);
2716 geo.add(fig);
2717 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
2718 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
2719 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .25 * h).close());
2720 geo.spot1 = new go.Spot(0, .25);
2721 geo.spot2 = go.Spot.BottomRight;
2722 return geo;
2723});
2724go.Shape.defineFigureGenerator('MessageFromUser', (shape, w, h) => {
2725 const geo = new go.Geometry();
2726 let param1 = shape ? shape.parameter1 : NaN;
2727 if (isNaN(param1))
2728 param1 = .7; // How far from the right the point is
2729 const fig = new go.PathFigure(0, 0, true);
2730 geo.add(fig);
2731 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
2732 fig.add(new go.PathSegment(go.PathSegment.Line, param1 * w, .5 * h));
2733 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
2734 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
2735 geo.spot1 = go.Spot.TopLeft;
2736 // ??? geo.spot2 = new go.Spot(param1, 1);
2737 return geo;
2738});
2739go.Shape.defineFigureGenerator('MicroformProcessing', (shape, w, h) => {
2740 const geo = new go.Geometry();
2741 let param1 = shape ? shape.parameter1 : NaN;
2742 if (isNaN(param1))
2743 param1 = .25; // How far from the top/bottom the points are
2744 const fig = new go.PathFigure(0, 0, true);
2745 geo.add(fig);
2746 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, param1 * h));
2747 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
2748 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
2749 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, (1 - param1) * h));
2750 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
2751 // ??? geo.spot1 = new go.Spot(0, param1);
2752 // ??? geo.spot2 = new go.Spot(1, 1 - param1);
2753 return geo;
2754});
2755go.Shape.defineFigureGenerator('MicroformRecording', (shape, w, h) => {
2756 const geo = new go.Geometry();
2757 const fig = new go.PathFigure(0, 0, true);
2758 geo.add(fig);
2759 fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, .25 * h));
2760 fig.add(new go.PathSegment(go.PathSegment.Line, w, .15 * h));
2761 fig.add(new go.PathSegment(go.PathSegment.Line, w, .85 * h));
2762 fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, .75 * h));
2763 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
2764 geo.spot1 = new go.Spot(0, .25);
2765 geo.spot2 = new go.Spot(1, .75);
2766 return geo;
2767});
2768go.Shape.defineFigureGenerator('MultiDocument', (shape, w, h) => {
2769 const geo = new go.Geometry();
2770 h = h / .8;
2771 const fig = new go.PathFigure(w, 0, true);
2772 geo.add(fig);
2773 // Outline
2774 fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
2775 fig.add(new go.PathSegment(go.PathSegment.Bezier, .9 * w, .44 * h, .96 * w, .47 * h, .93 * w, .45 * h));
2776 fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .6 * h));
2777 fig.add(new go.PathSegment(go.PathSegment.Bezier, .8 * w, .54 * h, .86 * w, .57 * h, .83 * w, .55 * h));
2778 fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .7 * h));
2779 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .7 * h, .4 * w, .4 * h, .4 * w, h));
2780 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .2 * h));
2781 fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, .2 * h));
2782 fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, .1 * h));
2783 fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .1 * h));
2784 fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, 0).close());
2785 const fig2 = new go.PathFigure(.1 * w, .2 * h, false);
2786 geo.add(fig2);
2787 // Inside lines
2788 fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .2 * h));
2789 fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .54 * h));
2790 fig2.add(new go.PathSegment(go.PathSegment.Move, .2 * w, .1 * h));
2791 fig2.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .1 * h));
2792 fig2.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .44 * h));
2793 geo.spot1 = new go.Spot(0, .25);
2794 geo.spot2 = new go.Spot(.8, .77);
2795 return geo;
2796});
2797go.Shape.defineFigureGenerator('MultiProcess', (shape, w, h) => {
2798 const geo = new go.Geometry();
2799 const fig = new go.PathFigure(.1 * w, .1 * h, true);
2800 geo.add(fig);
2801 fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .1 * h));
2802 fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, 0));
2803 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
2804 fig.add(new go.PathSegment(go.PathSegment.Line, w, .8 * h));
2805 fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .8 * h));
2806 fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .9 * h));
2807 fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .9 * h));
2808 fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, h));
2809 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
2810 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .2 * h));
2811 fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, .2 * h).close());
2812 const fig2 = new go.PathFigure(.2 * w, .1 * h, false);
2813 geo.add(fig2);
2814 fig2.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .1 * h));
2815 fig2.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .8 * h));
2816 fig2.add(new go.PathSegment(go.PathSegment.Move, .1 * w, .2 * h));
2817 fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .2 * h));
2818 fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .9 * h));
2819 geo.spot1 = new go.Spot(0, .2);
2820 geo.spot2 = new go.Spot(.8, 1);
2821 return geo;
2822});
2823go.Shape.defineFigureGenerator('OfflineStorage', (shape, w, h) => {
2824 const geo = new go.Geometry();
2825 let param1 = shape ? shape.parameter1 : NaN;
2826 if (isNaN(param1))
2827 param1 = .1; // Distance between 2 top lines
2828 const l = 1 - param1; // Length of the top line
2829 const fig = new go.PathFigure(0, 0, true);
2830 geo.add(fig);
2831 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
2832 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h).close());
2833 const fig2 = new go.PathFigure(.5 * param1 * w, param1 * h, false);
2834 geo.add(fig2);
2835 fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - .5 * param1) * w, param1 * h));
2836 // ??? geo.spot1 = new go.Spot(l / 4 + .5 * param1, param1);
2837 // ??? geo.spot2 = new go.Spot(3 * l / 4 + .5 * param1, param1 + .5 * l);
2838 return geo;
2839});
2840go.Shape.defineFigureGenerator('OffPageConnector', (shape, w, h) => {
2841 const geo = new go.Geometry();
2842 const fig = new go.PathFigure(0, 0, true);
2843 geo.add(fig);
2844 fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));
2845 fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
2846 fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, h));
2847 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
2848 geo.spot1 = go.Spot.TopLeft;
2849 geo.spot2 = new go.Spot(.75, 1);
2850 return geo;
2851});
2852go.Shape.defineFigureGenerator('Or', (shape, w, h) => {
2853 const geo = new go.Geometry();
2854 const cpOffset = KAPPA * .5;
2855 const radius = .5;
2856 const fig = new go.PathFigure(w, radius * h, true);
2857 geo.add(fig);
2858 // Circle
2859 fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, h, w, (radius + cpOffset) * h, (radius + cpOffset) * w, h));
2860 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, radius * h, (radius - cpOffset) * w, h, 0, (radius + cpOffset) * h));
2861 fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, 0, 0, (radius - cpOffset) * h, (radius - cpOffset) * w, 0));
2862 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, radius * h, (radius + cpOffset) * w, 0, w, (radius - cpOffset) * h));
2863 const fig2 = new go.PathFigure(w, .5 * h, false);
2864 geo.add(fig2);
2865 // +
2866 fig2.add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h));
2867 fig2.add(new go.PathSegment(go.PathSegment.Move, .5 * w, h));
2868 fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));
2869 return geo;
2870});
2871go.Shape.defineFigureGenerator('PaperTape', (shape, w, h) => {
2872 const geo = new go.Geometry();
2873 h = h / .8;
2874 const fig = new go.PathFigure(0, .7 * h, true);
2875 geo.add(fig);
2876 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .3 * h));
2877 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .3 * h, .5 * w, .6 * h, .5 * w, 0));
2878 fig.add(new go.PathSegment(go.PathSegment.Line, w, .7 * h));
2879 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .7 * h, .5 * w, .4 * h, .5 * w, h).close());
2880 geo.spot1 = new go.Spot(0, .49);
2881 geo.spot2 = new go.Spot(1, .75);
2882 return geo;
2883});
2884go.Shape.defineFigureGenerator('PrimitiveFromCall', (shape, w, h) => {
2885 const geo = new go.Geometry();
2886 let param1 = shape ? shape.parameter1 : NaN;
2887 let param2 = shape ? shape.parameter2 : NaN;
2888 if (isNaN(param1))
2889 param1 = .1; // Distance of left line from left
2890 if (isNaN(param2))
2891 param2 = .3; // Distance of point from right
2892 const fig = new go.PathFigure(0, 0, true);
2893 geo.add(fig);
2894 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
2895 fig.add(new go.PathSegment(go.PathSegment.Line, (1 - param2) * w, .5 * h));
2896 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
2897 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
2898 // ??? geo.spot1 = new go.Spot(param1, 0);
2899 // ??? geo.spot2 = new go.Spot(1 - param2, 1);
2900 return geo;
2901});
2902go.Shape.defineFigureGenerator('PrimitiveToCall', (shape, w, h) => {
2903 const geo = new go.Geometry();
2904 let param1 = shape ? shape.parameter1 : NaN;
2905 let param2 = shape ? shape.parameter2 : NaN;
2906 if (isNaN(param1))
2907 param1 = .1; // Distance of left line from left
2908 if (isNaN(param2))
2909 param2 = .3; // Distance of top and bottom right corners from right
2910 const fig = new go.PathFigure(0, 0, true);
2911 geo.add(fig);
2912 fig.add(new go.PathSegment(go.PathSegment.Line, (1 - param2) * w, 0));
2913 fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
2914 fig.add(new go.PathSegment(go.PathSegment.Line, (1 - param2) * w, h));
2915 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
2916 // ??? geo.spot1 = new go.Spot(param1, 0);
2917 // ??? geo.spot2 = new go.Spot(1 - param2, 1);
2918 return geo;
2919});
2920go.Shape.defineFigureGenerator('Procedure', (shape, w, h) => {
2921 const geo = new go.Geometry();
2922 let param1 = shape ? shape.parameter1 : NaN;
2923 // Distance of left and right lines from edge
2924 if (isNaN(param1))
2925 param1 = .1;
2926 const fig = new go.PathFigure(0, 0, true);
2927 geo.add(fig);
2928 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
2929 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
2930 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
2931 const fig2 = new go.PathFigure((1 - param1) * w, 0, false);
2932 geo.add(fig2);
2933 fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, h));
2934 fig2.add(new go.PathSegment(go.PathSegment.Move, param1 * w, 0));
2935 fig2.add(new go.PathSegment(go.PathSegment.Line, param1 * w, h));
2936 // ??? geo.spot1 = new go.Spot(param1, 0);
2937 // ??? geo.spot2 = new go.Spot(1 - param1, 1);
2938 return geo;
2939});
2940go.Shape.defineFigureGenerator('Process', (shape, w, h) => {
2941 const geo = new go.Geometry();
2942 let param1 = shape ? shape.parameter1 : NaN;
2943 if (isNaN(param1))
2944 param1 = .1; // Distance of left line from left edge
2945 const fig = new go.PathFigure(0, 0, true);
2946 geo.add(fig);
2947 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
2948 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
2949 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
2950 const fig2 = new go.PathFigure(param1 * w, 0, false);
2951 geo.add(fig2);
2952 fig2.add(new go.PathSegment(go.PathSegment.Line, param1 * w, h));
2953 // ??? geo.spot1 = new go.Spot(param1, 0);
2954 geo.spot2 = go.Spot.BottomRight;
2955 return geo;
2956});
2957go.Shape.defineFigureGenerator('Sort', (shape, w, h) => {
2958 const geo = new go.Geometry();
2959 const fig = new go.PathFigure(.5 * w, 0, true);
2960 geo.add(fig);
2961 fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
2962 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));
2963 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h).close());
2964 const fig2 = new go.PathFigure(0, .5 * h, false);
2965 geo.add(fig2);
2966 fig2.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
2967 geo.spot1 = new go.Spot(.25, .25);
2968 geo.spot2 = new go.Spot(.75, .5);
2969 return geo;
2970});
2971go.Shape.defineFigureGenerator('Start', (shape, w, h) => {
2972 const geo = new go.Geometry();
2973 let param1 = shape ? shape.parameter1 : NaN;
2974 if (isNaN(param1))
2975 param1 = 0.25;
2976 const fig = new go.PathFigure(param1 * w, 0, true);
2977 geo.add(fig);
2978 fig.add(new go.PathSegment(go.PathSegment.Arc, 270, 180, .75 * w, 0.5 * h, .25 * w, .5 * h));
2979 fig.add(new go.PathSegment(go.PathSegment.Arc, 90, 180, .25 * w, 0.5 * h, .25 * w, .5 * h));
2980 const fig2 = new go.PathFigure(param1 * w, 0, false);
2981 geo.add(fig2);
2982 fig2.add(new go.PathSegment(go.PathSegment.Line, param1 * w, h));
2983 fig2.add(new go.PathSegment(go.PathSegment.Move, (1 - param1) * w, 0));
2984 fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, h));
2985 geo.spot1 = new go.Spot(param1, 0);
2986 geo.spot2 = new go.Spot((1 - param1), 1);
2987 return geo;
2988});
2989go.Shape.defineFigureGenerator('Terminator', (shape, w, h) => {
2990 const geo = new go.Geometry();
2991 const fig = new go.PathFigure(.25 * w, 0, true);
2992 geo.add(fig);
2993 fig.add(new go.PathSegment(go.PathSegment.Arc, 270, 180, .75 * w, 0.5 * h, .25 * w, .5 * h));
2994 fig.add(new go.PathSegment(go.PathSegment.Arc, 90, 180, .25 * w, 0.5 * h, .25 * w, .5 * h));
2995 geo.spot1 = new go.Spot(.23, 0);
2996 geo.spot2 = new go.Spot(.77, 1);
2997 return geo;
2998});
2999go.Shape.defineFigureGenerator('TransmittalTape', (shape, w, h) => {
3000 const geo = new go.Geometry();
3001 let param1 = shape ? shape.parameter1 : NaN;
3002 if (isNaN(param1))
3003 param1 = .1; // Bottom line's distance from the point on the triangle
3004 const fig = new go.PathFigure(0, 0, true);
3005 geo.add(fig);
3006 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
3007 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
3008 fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, (1 - param1) * h));
3009 fig.add(new go.PathSegment(go.PathSegment.Line, 0, (1 - param1) * h).close());
3010 geo.spot1 = go.Spot.TopLeft;
3011 // ??? geo.spot2 = new go.Spot(1, 1 - param1);
3012 return geo;
3013});
3014go.Shape.defineFigureGenerator('AndGate', (shape, w, h) => {
3015 const geo = new go.Geometry();
3016 const cpOffset = KAPPA * .5;
3017 const fig = new go.PathFigure(0, 0, true);
3018 geo.add(fig);
3019 // The gate body
3020 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));
3021 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, (.5 + cpOffset) * w, 0, w, (.5 - cpOffset) * h));
3022 fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, h, w, (.5 + cpOffset) * h, (.5 + cpOffset) * w, h));
3023 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
3024 geo.spot1 = go.Spot.TopLeft;
3025 geo.spot2 = new go.Spot(.55, 1);
3026 return geo;
3027});
3028go.Shape.defineFigureGenerator('Buffer', (shape, w, h) => {
3029 const geo = new go.Geometry();
3030 const fig = new go.PathFigure(0, 0, true);
3031 geo.add(fig);
3032 fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
3033 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
3034 geo.spot1 = new go.Spot(0, .25);
3035 geo.spot2 = new go.Spot(.5, .75);
3036 return geo;
3037});
3038go.Shape.defineFigureGenerator('Clock', (shape, w, h) => {
3039 const geo = new go.Geometry();
3040 const cpOffset = KAPPA * .5;
3041 const radius = .5;
3042 const fig = new go.PathFigure(w, radius * h, true);
3043 geo.add(fig);
3044 // Ellipse
3045 fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, h, w, (radius + cpOffset) * h, (radius + cpOffset) * w, h));
3046 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, radius * h, (radius - cpOffset) * w, h, 0, (radius + cpOffset) * h));
3047 fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, 0, 0, (radius - cpOffset) * h, (radius - cpOffset) * w, 0));
3048 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, radius * h, (radius + cpOffset) * w, 0, w, (radius - cpOffset) * h));
3049 const fig2 = new go.PathFigure(w, radius * h, false);
3050 geo.add(fig2);
3051 fig2.add(new go.PathSegment(go.PathSegment.Line, w, radius * h));
3052 const fig3 = new go.PathFigure(.8 * w, .75 * h, false);
3053 geo.add(fig3);
3054 // Inside clock
3055 // This first line solves a GDI+ graphical error with
3056 // more complex gradient brushes
3057 fig3.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .25 * h));
3058 fig3.add(new go.PathSegment(go.PathSegment.Line, .6 * w, .25 * h));
3059 fig3.add(new go.PathSegment(go.PathSegment.Line, .6 * w, .75 * h));
3060 fig3.add(new go.PathSegment(go.PathSegment.Line, .4 * w, .75 * h));
3061 fig3.add(new go.PathSegment(go.PathSegment.Line, .4 * w, .25 * h));
3062 fig3.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .25 * h));
3063 fig3.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .75 * h));
3064 return geo;
3065});
3066go.Shape.defineFigureGenerator('Ground', (shape, w, h) => {
3067 const geo = new go.Geometry();
3068 const fig = new go.PathFigure(.5 * w, 0, false);
3069 geo.add(fig);
3070 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .4 * h));
3071 fig.add(new go.PathSegment(go.PathSegment.Move, .2 * w, .6 * h));
3072 fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .6 * h));
3073 fig.add(new go.PathSegment(go.PathSegment.Move, .3 * w, .8 * h));
3074 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, .8 * h));
3075 fig.add(new go.PathSegment(go.PathSegment.Move, .4 * w, h));
3076 fig.add(new go.PathSegment(go.PathSegment.Line, .6 * w, h));
3077 return geo;
3078});
3079go.Shape.defineFigureGenerator('Inverter', (shape, w, h) => {
3080 const geo = new go.Geometry();
3081 const cpOffset = KAPPA * .1;
3082 const radius = .1;
3083 const centerx = .9;
3084 const centery = .5;
3085 const fig = new go.PathFigure(.8 * w, .5 * h, true);
3086 geo.add(fig);
3087 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
3088 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
3089 fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .5 * h));
3090 const fig2 = new go.PathFigure((centerx + radius) * w, centery * h, true);
3091 geo.add(fig2);
3092 fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
3093 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h));
3094 fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - radius) * h));
3095 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h));
3096 geo.spot1 = new go.Spot(0, .25);
3097 geo.spot2 = new go.Spot(.4, .75);
3098 return geo;
3099});
3100go.Shape.defineFigureGenerator('NandGate', (shape, w, h) => {
3101 const geo = new go.Geometry();
3102 const cpxOffset = KAPPA * .5;
3103 const cpyOffset = KAPPA * .4;
3104 const cpOffset = KAPPA * .1;
3105 const radius = .1;
3106 const centerx = .9;
3107 const centery = .5;
3108 const fig = new go.PathFigure(.8 * w, .5 * h, true);
3109 geo.add(fig);
3110 // The gate body
3111 fig.add(new go.PathSegment(go.PathSegment.Bezier, .4 * w, h, .8 * w, (.5 + cpyOffset) * h, (.4 + cpxOffset) * w, h));
3112 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
3113 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
3114 fig.add(new go.PathSegment(go.PathSegment.Line, .4 * w, 0));
3115 fig.add(new go.PathSegment(go.PathSegment.Bezier, .8 * w, .5 * h, (.4 + cpxOffset) * w, 0, .8 * w, (.5 - cpyOffset) * h));
3116 const fig2 = new go.PathFigure((centerx + radius) * w, centery * h, true);
3117 geo.add(fig2);
3118 // Inversion
3119 fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
3120 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h));
3121 fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - radius) * h));
3122 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, (centery) * h, (centerx + cpOffset) * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h));
3123 geo.spot1 = new go.Spot(0, .05);
3124 geo.spot2 = new go.Spot(.55, .95);
3125 return geo;
3126});
3127go.Shape.defineFigureGenerator('NorGate', (shape, w, h) => {
3128 const geo = new go.Geometry();
3129 let radius = .5;
3130 let cpOffset = KAPPA * radius;
3131 let centerx = 0;
3132 let centery = .5;
3133 const fig = new go.PathFigure(.8 * w, .5 * h, true);
3134 geo.add(fig);
3135 // Normal
3136 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, h, .7 * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
3137 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0, .25 * w, .75 * h, .25 * w, .25 * h));
3138 fig.add(new go.PathSegment(go.PathSegment.Bezier, .8 * w, .5 * h, (centerx + cpOffset) * w, (centery - radius) * h, .7 * w, (centery - cpOffset) * h));
3139 radius = .1;
3140 cpOffset = KAPPA * .1;
3141 centerx = .9;
3142 centery = .5;
3143 const fig2 = new go.PathFigure((centerx - radius) * w, centery * h, true);
3144 geo.add(fig2);
3145 // Inversion
3146 fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - radius) * h));
3147 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h));
3148 fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
3149 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h));
3150 geo.spot1 = new go.Spot(.2, .25);
3151 geo.spot2 = new go.Spot(.6, .75);
3152 return geo;
3153});
3154go.Shape.defineFigureGenerator('OrGate', (shape, w, h) => {
3155 const geo = new go.Geometry();
3156 const radius = .5;
3157 const cpOffset = KAPPA * radius;
3158 const centerx = 0;
3159 const centery = .5;
3160 const fig = new go.PathFigure(0, 0, true);
3161 geo.add(fig);
3162 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, (centerx + cpOffset + cpOffset) * w, (centery - radius) * h, .8 * w, (centery - cpOffset) * h));
3163 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, h, .8 * w, (centery + cpOffset) * h, (centerx + cpOffset + cpOffset) * w, (centery + radius) * h));
3164 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0, .25 * w, .75 * h, .25 * w, .25 * h).close());
3165 geo.spot1 = new go.Spot(.2, .25);
3166 geo.spot2 = new go.Spot(.75, .75);
3167 return geo;
3168});
3169go.Shape.defineFigureGenerator('XnorGate', (shape, w, h) => {
3170 const geo = new go.Geometry();
3171 let radius = .5;
3172 let cpOffset = KAPPA * radius;
3173 let centerx = .2;
3174 let centery = .5;
3175 const fig = new go.PathFigure(.1 * w, 0, false);
3176 geo.add(fig);
3177 // Normal
3178 fig.add(new go.PathSegment(go.PathSegment.Bezier, .1 * w, h, .35 * w, .25 * h, .35 * w, .75 * h));
3179 const fig2 = new go.PathFigure(.8 * w, .5 * h, true);
3180 geo.add(fig2);
3181 fig2.add(new go.PathSegment(go.PathSegment.Bezier, .2 * w, h, .7 * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
3182 fig2.add(new go.PathSegment(go.PathSegment.Bezier, .2 * w, 0, .45 * w, .75 * h, .45 * w, .25 * h));
3183 fig2.add(new go.PathSegment(go.PathSegment.Bezier, .8 * w, .5 * h, (centerx + cpOffset) * w, (centery - radius) * h, .7 * w, (centery - cpOffset) * h));
3184 radius = .1;
3185 cpOffset = KAPPA * .1;
3186 centerx = .9;
3187 centery = .5;
3188 const fig3 = new go.PathFigure((centerx - radius) * w, centery * h, true);
3189 geo.add(fig3);
3190 // Inversion
3191 fig3.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - radius) * h));
3192 fig3.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h));
3193 fig3.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
3194 fig3.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h));
3195 geo.spot1 = new go.Spot(.4, .25);
3196 geo.spot2 = new go.Spot(.65, .75);
3197 return geo;
3198});
3199go.Shape.defineFigureGenerator('XorGate', (shape, w, h) => {
3200 const geo = new go.Geometry();
3201 const radius = .5;
3202 const cpOffset = KAPPA * radius;
3203 const centerx = .2;
3204 const centery = .5;
3205 const fig = new go.PathFigure(.1 * w, 0, false);
3206 geo.add(fig);
3207 fig.add(new go.PathSegment(go.PathSegment.Bezier, .1 * w, h, .35 * w, .25 * h, .35 * w, .75 * h));
3208 const fig2 = new go.PathFigure(.2 * w, 0, true);
3209 geo.add(fig2);
3210 fig2.add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, (centerx + cpOffset) * w, (centery - radius) * h, .9 * w, (centery - cpOffset) * h));
3211 fig2.add(new go.PathSegment(go.PathSegment.Bezier, .2 * w, h, .9 * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
3212 fig2.add(new go.PathSegment(go.PathSegment.Bezier, .2 * w, 0, .45 * w, .75 * h, .45 * w, .25 * h).close());
3213 geo.spot1 = new go.Spot(.4, .25);
3214 geo.spot2 = new go.Spot(.8, .75);
3215 return geo;
3216});
3217go.Shape.defineFigureGenerator('Capacitor', (shape, w, h) => {
3218 const geo = new go.Geometry();
3219 const fig = new go.PathFigure(0, 0, false);
3220 geo.add(fig);
3221 // Two vertical lines
3222 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
3223 fig.add(new go.PathSegment(go.PathSegment.Move, w, 0));
3224 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
3225 return geo;
3226});
3227go.Shape.defineFigureGenerator('Resistor', (shape, w, h) => {
3228 const geo = new go.Geometry();
3229 const fig = new go.PathFigure(0, .5 * h, false);
3230 geo.add(fig);
3231 fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, 0));
3232 fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, h));
3233 fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 0));
3234 fig.add(new go.PathSegment(go.PathSegment.Line, .4 * w, h));
3235 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));
3236 fig.add(new go.PathSegment(go.PathSegment.Line, .6 * w, h));
3237 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, .5 * h));
3238 return geo;
3239});
3240go.Shape.defineFigureGenerator('Inductor', (shape, w, h) => {
3241 const geo = new go.Geometry();
3242 const cpOffset = KAPPA * .1;
3243 const radius = .1;
3244 let centerx = .1;
3245 const centery = .5;
3246 // Up
3247 const fig = new go.PathFigure((centerx - cpOffset * .5) * w, h, false);
3248 geo.add(fig);
3249 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, 0, (centerx - cpOffset) * w, h, (centerx - radius) * w, 0));
3250 // Down up
3251 centerx = .3;
3252 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, h, (centerx + radius) * w, 0, (centerx + cpOffset) * w, h));
3253 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, 0, (centerx - cpOffset) * w, h, (centerx - radius) * w, 0));
3254 // Down up
3255 centerx = .5;
3256 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, h, (centerx + radius) * w, 0, (centerx + cpOffset) * w, h));
3257 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, 0, (centerx - cpOffset) * w, h, (centerx - radius) * w, 0));
3258 // Down up
3259 centerx = .7;
3260 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, h, (centerx + radius) * w, 0, (centerx + cpOffset) * w, h));
3261 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, 0, (centerx - cpOffset) * w, h, (centerx - radius) * w, 0));
3262 // Down up
3263 centerx = .9;
3264 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + cpOffset * .5) * w, h, (centerx + radius) * w, 0, (centerx + cpOffset) * w, h));
3265 return geo;
3266});
3267go.Shape.defineFigureGenerator('ACvoltageSource', (shape, w, h) => {
3268 const geo = new go.Geometry();
3269 const cpOffset = KAPPA * .5;
3270 const radius = .5;
3271 const centerx = .5;
3272 const centery = .5;
3273 const fig = new go.PathFigure((centerx - radius) * w, centery * h, false);
3274 geo.add(fig);
3275 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - radius) * h));
3276 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h));
3277 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
3278 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h));
3279 fig.add(new go.PathSegment(go.PathSegment.Move, (centerx - radius + .1) * w, centery * h));
3280 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius - .1) * w, centery * h, centerx * w, (centery - radius) * h, centerx * w, (centery + radius) * h));
3281 return geo;
3282});
3283go.Shape.defineFigureGenerator('DCvoltageSource', (shape, w, h) => {
3284 const geo = new go.Geometry();
3285 const fig = new go.PathFigure(0, .75 * h, false);
3286 geo.add(fig);
3287 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .25 * h));
3288 fig.add(new go.PathSegment(go.PathSegment.Move, w, 0));
3289 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
3290 return geo;
3291});
3292go.Shape.defineFigureGenerator('Diode', (shape, w, h) => {
3293 const geo = new go.Geometry();
3294 const fig = new go.PathFigure(w, 0, false);
3295 geo.add(fig);
3296 fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
3297 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
3298 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
3299 fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
3300 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
3301 geo.spot1 = new go.Spot(0, .25);
3302 geo.spot2 = new go.Spot(.5, .75);
3303 return geo;
3304});
3305go.Shape.defineFigureGenerator('Wifi', (shape, w, h) => {
3306 const geo = new go.Geometry();
3307 const origw = w;
3308 const origh = h;
3309 w = w * .38;
3310 h = h * .6;
3311 let cpOffset = KAPPA * .8;
3312 let radius = .8;
3313 let centerx = 0;
3314 let centery = .5;
3315 const xOffset = (origw - w) / 2;
3316 const yOffset = (origh - h) / 2;
3317 const fig = new go.PathFigure(centerx * w + xOffset, (centery + radius) * h + yOffset, true);
3318 geo.add(fig);
3319 // Left curves
3320 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w + xOffset, centery * h + yOffset, (centerx - cpOffset) * w + xOffset, (centery + radius) * h + yOffset, (centerx - radius) * w + xOffset, (centery + cpOffset) * h + yOffset));
3321 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset, (centery - radius) * h + yOffset, (centerx - radius) * w + xOffset, (centery - cpOffset) * h + yOffset, (centerx - cpOffset) * w + xOffset, (centery - radius) * h + yOffset));
3322 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius + cpOffset * .5) * w + xOffset, centery * h + yOffset, centerx * w + xOffset, (centery - radius) * h + yOffset, (centerx - radius + cpOffset * .5) * w + xOffset, (centery - cpOffset) * h + yOffset));
3323 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset, (centery + radius) * h + yOffset, (centerx - radius + cpOffset * .5) * w + xOffset, (centery + cpOffset) * h + yOffset, centerx * w + xOffset, (centery + radius) * h + yOffset).close());
3324 cpOffset = KAPPA * .4;
3325 radius = .4;
3326 centerx = .2;
3327 centery = .5;
3328 const fig2 = new go.PathFigure(centerx * w + xOffset, (centery + radius) * h + yOffset, true);
3329 geo.add(fig2);
3330 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w + xOffset, centery * h + yOffset, (centerx - cpOffset) * w + xOffset, (centery + radius) * h + yOffset, (centerx - radius) * w + xOffset, (centery + cpOffset) * h + yOffset));
3331 fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset, (centery - radius) * h + yOffset, (centerx - radius) * w + xOffset, (centery - cpOffset) * h + yOffset, (centerx - cpOffset) * w + xOffset, (centery - radius) * h + yOffset));
3332 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius + cpOffset * .5) * w + xOffset, centery * h + yOffset, centerx * w + xOffset, (centery - radius) * h + yOffset, (centerx - radius + cpOffset * .5) * w + xOffset, (centery - cpOffset) * h + yOffset));
3333 fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset, (centery + radius) * h + yOffset, (centerx - radius + cpOffset * .5) * w + xOffset, (centery + cpOffset) * h + yOffset, centerx * w + xOffset, (centery + radius) * h + yOffset).close());
3334 cpOffset = KAPPA * .2;
3335 radius = .2;
3336 centerx = .5;
3337 centery = .5;
3338 const fig3 = new go.PathFigure((centerx - radius) * w + xOffset, centery * h + yOffset, true);
3339 geo.add(fig3);
3340 // Center circle
3341 fig3.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset, (centery - radius) * h + yOffset, (centerx - radius) * w + xOffset, (centery - cpOffset) * h + yOffset, (centerx - cpOffset) * w + xOffset, (centery - radius) * h + yOffset));
3342 fig3.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w + xOffset, centery * h + yOffset, (centerx + cpOffset) * w + xOffset, (centery - radius) * h + yOffset, (centerx + radius) * w + xOffset, (centery - cpOffset) * h + yOffset));
3343 fig3.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset, (centery + radius) * h + yOffset, (centerx + radius) * w + xOffset, (centery + cpOffset) * h + yOffset, (centerx + cpOffset) * w + xOffset, (centery + radius) * h + yOffset));
3344 fig3.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w + xOffset, centery * h + yOffset, (centerx - cpOffset) * w + xOffset, (centery + radius) * h + yOffset, (centerx - radius) * w + xOffset, (centery + cpOffset) * h + yOffset));
3345 cpOffset = KAPPA * .4;
3346 radius = .4;
3347 centerx = .8;
3348 centery = .5;
3349 const fig4 = new go.PathFigure(centerx * w + xOffset, (centery - radius) * h + yOffset, true);
3350 geo.add(fig4);
3351 // Right curves
3352 fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w + xOffset, centery * h + yOffset, (centerx + cpOffset) * w + xOffset, (centery - radius) * h + yOffset, (centerx + radius) * w + xOffset, (centery - cpOffset) * h + yOffset));
3353 fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset, (centery + radius) * h + yOffset, (centerx + radius) * w + xOffset, (centery + cpOffset) * h + yOffset, (centerx + cpOffset) * w + xOffset, (centery + radius) * h + yOffset));
3354 fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius - cpOffset * .5) * w + xOffset, centery * h + yOffset, centerx * w + xOffset, (centery + radius) * h + yOffset, (centerx + radius - cpOffset * .5) * w + xOffset, (centery + cpOffset) * h + yOffset));
3355 fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset, (centery - radius) * h + yOffset, (centerx + radius - cpOffset * .5) * w + xOffset, (centery - cpOffset) * h + yOffset, centerx * w + xOffset, (centery - radius) * h + yOffset).close());
3356 cpOffset = KAPPA * .8;
3357 radius = .8;
3358 centerx = 1;
3359 centery = .5;
3360 const fig5 = new go.PathFigure(centerx * w + xOffset, (centery - radius) * h + yOffset, true);
3361 geo.add(fig5);
3362 fig5.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w + xOffset, centery * h + yOffset, (centerx + cpOffset) * w + xOffset, (centery - radius) * h + yOffset, (centerx + radius) * w + xOffset, (centery - cpOffset) * h + yOffset));
3363 fig5.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset, (centery + radius) * h + yOffset, (centerx + radius) * w + xOffset, (centery + cpOffset) * h + yOffset, (centerx + cpOffset) * w + xOffset, (centery + radius) * h + yOffset));
3364 fig5.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius - cpOffset * .5) * w + xOffset, centery * h + yOffset, centerx * w + xOffset, (centery + radius) * h + yOffset, (centerx + radius - cpOffset * .5) * w + xOffset, (centery + cpOffset) * h + yOffset));
3365 fig5.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset, (centery - radius) * h + yOffset, (centerx + radius - cpOffset * .5) * w + xOffset, (centery - cpOffset) * h + yOffset, centerx * w + xOffset, (centery - radius) * h + yOffset).close());
3366 return geo;
3367});
3368go.Shape.defineFigureGenerator('Email', (shape, w, h) => {
3369 const geo = new go.Geometry();
3370 const fig = new go.PathFigure(0, 0, true);
3371 geo.add(fig);
3372 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
3373 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
3374 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
3375 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0).close());
3376 const fig2 = new go.PathFigure(0, 0, false);
3377 geo.add(fig2);
3378 fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .6 * h));
3379 fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0));
3380 fig2.add(new go.PathSegment(go.PathSegment.Move, 0, h));
3381 fig2.add(new go.PathSegment(go.PathSegment.Line, .45 * w, .54 * h));
3382 fig2.add(new go.PathSegment(go.PathSegment.Move, w, h));
3383 fig2.add(new go.PathSegment(go.PathSegment.Line, .55 * w, .54 * h));
3384 return geo;
3385});
3386go.Shape.defineFigureGenerator('Ethernet', (shape, w, h) => {
3387 const geo = new go.Geometry();
3388 const fig = new go.PathFigure(.35 * w, 0, true);
3389 geo.add(fig);
3390 // Boxes above the wire
3391 fig.add(new go.PathSegment(go.PathSegment.Line, .65 * w, 0));
3392 fig.add(new go.PathSegment(go.PathSegment.Line, .65 * w, .4 * h));
3393 fig.add(new go.PathSegment(go.PathSegment.Line, .35 * w, .4 * h));
3394 fig.add(new go.PathSegment(go.PathSegment.Line, .35 * w, 0).close());
3395 const fig2 = new go.PathFigure(.10 * w, h, true, true);
3396 geo.add(fig2);
3397 // Boxes under the wire
3398 fig2.add(new go.PathSegment(go.PathSegment.Line, .40 * w, h));
3399 fig2.add(new go.PathSegment(go.PathSegment.Line, .40 * w, .6 * h));
3400 fig2.add(new go.PathSegment(go.PathSegment.Line, .10 * w, .6 * h));
3401 fig2.add(new go.PathSegment(go.PathSegment.Line, .10 * w, h).close());
3402 const fig3 = new go.PathFigure(.60 * w, h, true, true);
3403 geo.add(fig3);
3404 fig3.add(new go.PathSegment(go.PathSegment.Line, .90 * w, h));
3405 fig3.add(new go.PathSegment(go.PathSegment.Line, .90 * w, .6 * h));
3406 fig3.add(new go.PathSegment(go.PathSegment.Line, .60 * w, .6 * h));
3407 fig3.add(new go.PathSegment(go.PathSegment.Line, .60 * w, h).close());
3408 const fig4 = new go.PathFigure(0, .5 * h, false);
3409 geo.add(fig4);
3410 // Wire
3411 fig4.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
3412 fig4.add(new go.PathSegment(go.PathSegment.Move, .5 * w, .5 * h));
3413 fig4.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .4 * h));
3414 fig4.add(new go.PathSegment(go.PathSegment.Move, .75 * w, .5 * h));
3415 fig4.add(new go.PathSegment(go.PathSegment.Line, .75 * w, .6 * h));
3416 fig4.add(new go.PathSegment(go.PathSegment.Move, .25 * w, .5 * h));
3417 fig4.add(new go.PathSegment(go.PathSegment.Line, .25 * w, .6 * h));
3418 return geo;
3419});
3420go.Shape.defineFigureGenerator('Power', (shape, w, h) => {
3421 const geo = new go.Geometry();
3422 let cpOffset = KAPPA * .4;
3423 let radius = .4;
3424 const centerx = .5;
3425 const centery = .5;
3426 const unused = tempPoint();
3427 const mid = tempPoint();
3428 const c1 = tempPoint();
3429 const c2 = tempPoint();
3430 // Find the 45 degree midpoint for the first bezier
3431 breakUpBezier(centerx, centery - radius, centerx + cpOffset, centery - radius, centerx + radius, centery - cpOffset, centerx + radius, centery, .5, unused, unused, mid, c1, c2);
3432 const start = tempPointAt(mid.x, mid.y);
3433 let fig = new go.PathFigure(mid.x * w, mid.y * h, true);
3434 geo.add(fig);
3435 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, c1.x * w, c1.y * h, c2.x * w, c2.y * h));
3436 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
3437 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h));
3438 // Find the 45 degree midpoint of for the fourth bezier
3439 breakUpBezier(centerx - radius, centery, centerx - radius, centery - cpOffset, centerx - cpOffset, centery - radius, centerx, centery - radius, .5, c1, c2, mid, unused, unused);
3440 fig.add(new go.PathSegment(go.PathSegment.Bezier, mid.x * w, mid.y * h, c1.x * w, c1.y * h, c2.x * w, c2.y * h));
3441 // now make a smaller circle
3442 cpOffset = KAPPA * .3;
3443 radius = .3;
3444 // Find the 45 degree midpoint for the first bezier
3445 breakUpBezier(centerx - radius, centery, centerx - radius, centery - cpOffset, centerx - cpOffset, centery - radius, centerx, centery - radius, .5, c1, c2, mid, unused, unused);
3446 fig.add(new go.PathSegment(go.PathSegment.Line, mid.x * w, mid.y * h));
3447 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, c2.x * w, c2.y * h, c1.x * w, c1.y * h));
3448 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h, (centerx - cpOffset) * w, (centery + radius) * h));
3449 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h));
3450 // Find the 45 degree midpoint for the fourth bezier
3451 breakUpBezier(centerx, centery - radius, centerx + cpOffset, centery - radius, centerx + radius, centery - cpOffset, centerx + radius, centery, .5, unused, unused, mid, c1, c2);
3452 fig.add(new go.PathSegment(go.PathSegment.Bezier, mid.x * w, mid.y * h, c2.x * w, c2.y * h, c1.x * w, c1.y * h).close());
3453 fig = new go.PathFigure(.45 * w, 0, true);
3454 geo.add(fig);
3455 fig.add(new go.PathSegment(go.PathSegment.Line, .45 * w, .5 * h));
3456 fig.add(new go.PathSegment(go.PathSegment.Line, .55 * w, .5 * h));
3457 fig.add(new go.PathSegment(go.PathSegment.Line, .55 * w, 0).close());
3458 freePoint(unused);
3459 freePoint(mid);
3460 freePoint(c1);
3461 freePoint(c2);
3462 freePoint(start);
3463 geo.spot1 = new go.Spot(.25, .45);
3464 geo.spot2 = new go.Spot(.75, .8);
3465 return geo;
3466});
3467go.Shape.defineFigureGenerator('Fallout', (shape, w, h) => {
3468 const geo = new go.Geometry();
3469 const fig = new go.PathFigure(0, h / 2, true);
3470 geo.add(fig);
3471 // Containing circle
3472 fig.add(new go.PathSegment(go.PathSegment.Arc, 180, 360, w / 2, h / 2, w / 2, h / 2));
3473 function drawTriangle(f, offsetx, offsety) {
3474 f.add(new go.PathSegment(go.PathSegment.Move, (.3 + offsetx) * w, (.8 + offsety) * h));
3475 f.add(new go.PathSegment(go.PathSegment.Line, (.5 + offsetx) * w, (.5 + offsety) * h));
3476 f.add(new go.PathSegment(go.PathSegment.Line, (.1 + offsetx) * w, (.5 + offsety) * h));
3477 f.add(new go.PathSegment(go.PathSegment.Line, (.3 + offsetx) * w, (.8 + offsety) * h).close());
3478 }
3479 // Triangles
3480 drawTriangle(fig, 0, 0);
3481 drawTriangle(fig, 0.4, 0);
3482 drawTriangle(fig, 0.2, -0.3);
3483 return geo;
3484});
3485go.Shape.defineFigureGenerator('IrritationHazard', (shape, w, h) => {
3486 const geo = new go.Geometry();
3487 const fig = new go.PathFigure(.2 * w, 0, true);
3488 geo.add(fig);
3489 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .3 * h));
3490 fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, 0));
3491 fig.add(new go.PathSegment(go.PathSegment.Line, w, .2 * h));
3492 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, .5 * h));
3493 fig.add(new go.PathSegment(go.PathSegment.Line, w, .8 * h));
3494 fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, h));
3495 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .7 * h));
3496 fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, h));
3497 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .8 * h));
3498 fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, .5 * h));
3499 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .2 * h).close());
3500 geo.spot1 = new go.Spot(.3, .3);
3501 geo.spot2 = new go.Spot(.7, .7);
3502 return geo;
3503});
3504go.Shape.defineFigureGenerator('ElectricalHazard', (shape, w, h) => {
3505 const geo = new go.Geometry();
3506 const fig = new go.PathFigure(.37 * w, 0, true);
3507 geo.add(fig);
3508 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .11 * h));
3509 fig.add(new go.PathSegment(go.PathSegment.Line, .77 * w, .04 * h));
3510 fig.add(new go.PathSegment(go.PathSegment.Line, .33 * w, .49 * h));
3511 fig.add(new go.PathSegment(go.PathSegment.Line, w, .37 * h));
3512 fig.add(new go.PathSegment(go.PathSegment.Line, .63 * w, .86 * h));
3513 fig.add(new go.PathSegment(go.PathSegment.Line, .77 * w, .91 * h));
3514 fig.add(new go.PathSegment(go.PathSegment.Line, .34 * w, h));
3515 fig.add(new go.PathSegment(go.PathSegment.Line, .34 * w, .78 * h));
3516 fig.add(new go.PathSegment(go.PathSegment.Line, .44 * w, .8 * h));
3517 fig.add(new go.PathSegment(go.PathSegment.Line, .65 * w, .56 * h));
3518 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .68 * h).close());
3519 return geo;
3520});
3521go.Shape.defineFigureGenerator('FireHazard', (shape, w, h) => {
3522 const geo = new go.Geometry();
3523 const fig = new go.PathFigure(.1 * w, h, true);
3524 geo.add(fig);
3525 fig.add(new go.PathSegment(go.PathSegment.Bezier, .29 * w, 0, -.25 * w, .63 * h, .45 * w, .44 * h));
3526 fig.add(new go.PathSegment(go.PathSegment.Bezier, .51 * w, .42 * h, .48 * w, .17 * h, .54 * w, .35 * h));
3527 fig.add(new go.PathSegment(go.PathSegment.Bezier, .59 * w, .18 * h, .59 * w, .29 * h, .58 * w, .28 * h));
3528 fig.add(new go.PathSegment(go.PathSegment.Bezier, .75 * w, .6 * h, .8 * w, .34 * h, .88 * w, .43 * h));
3529 fig.add(new go.PathSegment(go.PathSegment.Bezier, .88 * w, .31 * h, .87 * w, .48 * h, .88 * w, .43 * h));
3530 fig.add(new go.PathSegment(go.PathSegment.Bezier, .9 * w, h, 1.17 * w, .76 * h, .82 * w, .8 * h).close());
3531 geo.spot1 = new go.Spot(.07, .445);
3532 geo.spot2 = new go.Spot(.884, .958);
3533 return geo;
3534});
3535go.Shape.defineFigureGenerator('BpmnActivityLoop', (shape, w, h) => {
3536 const geo = new go.Geometry();
3537 const r = .5;
3538 const cx = 0; // offset from Center x
3539 const cy = 0; // offset from Center y
3540 const d = r * KAPPA;
3541 const mx1 = (.4 * Math.SQRT2 / 2 + .5);
3542 const my1 = (.5 - .5 * Math.SQRT2 / 2);
3543 const x1 = 1;
3544 const y1 = .5;
3545 const x2 = .5;
3546 const y2 = 0;
3547 const fig = new go.PathFigure(mx1 * w, (1 - my1) * h, false);
3548 geo.add(fig);
3549 fig.add(new go.PathSegment(go.PathSegment.Bezier, x1 * w, y1 * h, x1 * w, .7 * h, x1 * w, y1 * h));
3550 fig.add(new go.PathSegment(go.PathSegment.Bezier, (x2 + cx) * w, (y2 + cx) * h, (.5 + r + cx) * w, (.5 - d + cx) * h, (.5 + d + cx) * w, (.5 - r + cx) * h));
3551 fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 - r + cx) * w, (.5 + cy) * h, (.5 - d + cx) * w, (.5 - r + cy) * h, (.5 - r + cx) * w, (.5 - d + cy) * h));
3552 fig.add(new go.PathSegment(go.PathSegment.Bezier, (.35 + cx) * w, .9 * h, (.5 - r + cx) * w, (.5 + d + cy) * h, (.5 - d + cx) * w, .9 * h));
3553 // Arrowhead
3554 fig.add(new go.PathSegment(go.PathSegment.Move, (.25 + cx) * w, 0.8 * h));
3555 fig.add(new go.PathSegment(go.PathSegment.Line, (.35 + cx) * w, 0.9 * h));
3556 fig.add(new go.PathSegment(go.PathSegment.Line, (.20 + cx) * w, 0.95 * h));
3557 return geo;
3558});
3559go.Shape.defineFigureGenerator('BpmnActivityParallel', (shape, w, h) => {
3560 const geo = new go.Geometry();
3561 const fig = new go.PathFigure(0, 0, false);
3562 geo.add(fig);
3563 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
3564 fig.add(new go.PathSegment(go.PathSegment.Move, .5 * w, 0));
3565 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));
3566 fig.add(new go.PathSegment(go.PathSegment.Move, w, 0));
3567 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
3568 return geo;
3569});
3570go.Shape.defineFigureGenerator('BpmnActivitySequential', (shape, w, h) => {
3571 const geo = new go.Geometry();
3572 const fig = new go.PathFigure(0, 0, false);
3573 geo.add(fig);
3574 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
3575 fig.add(new go.PathSegment(go.PathSegment.Move, 0, .5 * h));
3576 fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));
3577 fig.add(new go.PathSegment(go.PathSegment.Move, 0, h));
3578 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
3579 return geo;
3580});
3581go.Shape.defineFigureGenerator('BpmnActivityAdHoc', (shape, w, h) => {
3582 const geo = new go.Geometry();
3583 const fig = new go.PathFigure(0, 0, false);
3584 geo.add(fig);
3585 const fig2 = new go.PathFigure(w, h, false);
3586 geo.add(fig2);
3587 const fig3 = new go.PathFigure(0, .5 * h, false);
3588 geo.add(fig3);
3589 fig3.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .5 * h, .2 * w, .35 * h, .3 * w, .35 * h));
3590 fig3.add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, .7 * w, .65 * h, .8 * w, .65 * h));
3591 return geo;
3592});
3593go.Shape.defineFigureGenerator('BpmnActivityCompensation', (shape, w, h) => {
3594 const geo = new go.Geometry();
3595 const fig = new go.PathFigure(0, .5 * h, true);
3596 geo.add(fig);
3597 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));
3598 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h));
3599 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
3600 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
3601 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h));
3602 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h).close());
3603 return geo;
3604});
3605go.Shape.defineFigureGenerator('BpmnTaskMessage', (shape, w, h) => {
3606 const geo = new go.Geometry();
3607 let fig = new go.PathFigure(0, .2 * h, true);
3608 geo.add(fig);
3609 fig.add(new go.PathSegment(go.PathSegment.Line, w, .2 * h));
3610 fig.add(new go.PathSegment(go.PathSegment.Line, w, .8 * h));
3611 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .8 * h));
3612 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .8 * h).close());
3613 fig = new go.PathFigure(0, .2 * h, false);
3614 geo.add(fig);
3615 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h));
3616 fig.add(new go.PathSegment(go.PathSegment.Line, w, .2 * h));
3617 return geo;
3618});
3619go.Shape.defineFigureGenerator('BpmnTaskScript', (shape, w, h) => {
3620 const geo = new go.Geometry();
3621 const fig = new go.PathFigure(.7 * w, h, true);
3622 geo.add(fig);
3623 fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, h));
3624 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.3 * w, 0, .6 * w, .5 * h, 0, .5 * h));
3625 fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, 0));
3626 fig.add(new go.PathSegment(go.PathSegment.Bezier, .7 * w, h, .4 * w, .5 * h, w, .5 * h).close());
3627 const fig2 = new go.PathFigure(.45 * w, .73 * h, false);
3628 geo.add(fig2);
3629 // Lines on script
3630 fig2.add(new go.PathSegment(go.PathSegment.Line, .7 * w, .73 * h));
3631 fig2.add(new go.PathSegment(go.PathSegment.Move, .38 * w, .5 * h));
3632 fig2.add(new go.PathSegment(go.PathSegment.Line, .63 * w, .5 * h));
3633 fig2.add(new go.PathSegment(go.PathSegment.Move, .31 * w, .27 * h));
3634 fig2.add(new go.PathSegment(go.PathSegment.Line, .56 * w, .27 * h));
3635 return geo;
3636});
3637go.Shape.defineFigureGenerator('BpmnTaskUser', (shape, w, h) => {
3638 const geo = new go.Geometry();
3639 const fig = new go.PathFigure(0, 0, false);
3640 geo.add(fig);
3641 const fig2 = new go.PathFigure(.335 * w, (1 - .555) * h, true);
3642 geo.add(fig2);
3643 // Shirt
3644 fig2.add(new go.PathSegment(go.PathSegment.Line, .335 * w, (1 - .405) * h));
3645 fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - .335) * w, (1 - .405) * h));
3646 fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - .335) * w, (1 - .555) * h));
3647 fig2.add(new go.PathSegment(go.PathSegment.Bezier, w, .68 * h, (1 - .12) * w, .46 * h, (1 - .02) * w, .54 * h));
3648 fig2.add(new go.PathSegment(go.PathSegment.Line, w, h));
3649 fig2.add(new go.PathSegment(go.PathSegment.Line, 0, h));
3650 fig2.add(new go.PathSegment(go.PathSegment.Line, 0, .68 * h));
3651 fig2.add(new go.PathSegment(go.PathSegment.Bezier, .335 * w, (1 - .555) * h, .02 * w, .54 * h, .12 * w, .46 * h));
3652 // Start of neck
3653 fig2.add(new go.PathSegment(go.PathSegment.Line, .365 * w, (1 - .595) * h));
3654 const radiushead = .5 - .285;
3655 const centerx = .5;
3656 const centery = radiushead;
3657 const alpha2 = Math.PI / 4;
3658 const KAPPA2 = ((4 * (1 - Math.cos(alpha2))) / (3 * Math.sin(alpha2)));
3659 const cpOffset = KAPPA2 * .5;
3660 const radiusw = radiushead;
3661 const radiush = radiushead;
3662 const offsetw = KAPPA2 * radiusw;
3663 const offseth = KAPPA2 * radiush;
3664 // Circle (head)
3665 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radiusw) * w, centery * h, (centerx - ((offsetw + radiusw) / 2)) * w, (centery + ((radiush + offseth) / 2)) * h, (centerx - radiusw) * w, (centery + offseth) * h));
3666 fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radiush) * h, (centerx - radiusw) * w, (centery - offseth) * h, (centerx - offsetw) * w, (centery - radiush) * h));
3667 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radiusw) * w, centery * h, (centerx + offsetw) * w, (centery - radiush) * h, (centerx + radiusw) * w, (centery - offseth) * h));
3668 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (1 - .365) * w, (1 - .595) * h, (centerx + radiusw) * w, (centery + offseth) * h, (centerx + ((offsetw + radiusw) / 2)) * w, (centery + ((radiush + offseth) / 2)) * h));
3669 fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - .365) * w, (1 - .595) * h));
3670 // Neckline
3671 fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - .335) * w, (1 - .555) * h));
3672 fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - .335) * w, (1 - .405) * h));
3673 fig2.add(new go.PathSegment(go.PathSegment.Line, .335 * w, (1 - .405) * h));
3674 const fig3 = new go.PathFigure(.2 * w, h, false);
3675 geo.add(fig3);
3676 // Arm lines
3677 fig3.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .8 * h));
3678 const fig4 = new go.PathFigure(.8 * w, h, false);
3679 geo.add(fig4);
3680 fig4.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .8 * h));
3681 return geo;
3682});
3683go.Shape.defineFigureGenerator('BpmnEventConditional', (shape, w, h) => {
3684 const geo = new go.Geometry();
3685 const fig = new go.PathFigure(.1 * w, 0, true);
3686 geo.add(fig);
3687 // Body
3688 fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, 0));
3689 fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, h));
3690 fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, h).close());
3691 const fig2 = new go.PathFigure(.2 * w, .2 * h, false);
3692 geo.add(fig2);
3693 // Inside lines
3694 fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .2 * h));
3695 fig2.add(new go.PathSegment(go.PathSegment.Move, .2 * w, .4 * h));
3696 fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .4 * h));
3697 fig2.add(new go.PathSegment(go.PathSegment.Move, .2 * w, .6 * h));
3698 fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .6 * h));
3699 fig2.add(new go.PathSegment(go.PathSegment.Move, .2 * w, .8 * h));
3700 fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .8 * h));
3701 return geo;
3702});
3703go.Shape.defineFigureGenerator('BpmnEventError', (shape, w, h) => {
3704 const geo = new go.Geometry();
3705 const fig = new go.PathFigure(0, h, true);
3706 geo.add(fig);
3707 fig.add(new go.PathSegment(go.PathSegment.Line, .33 * w, 0));
3708 fig.add(new go.PathSegment(go.PathSegment.Line, .66 * w, .50 * h));
3709 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
3710 fig.add(new go.PathSegment(go.PathSegment.Line, .66 * w, h));
3711 fig.add(new go.PathSegment(go.PathSegment.Line, .33 * w, .50 * h).close());
3712 return geo;
3713});
3714go.Shape.defineFigureGenerator('BpmnEventEscalation', (shape, w, h) => {
3715 const geo = new go.Geometry();
3716 const fig = new go.PathFigure(0, 0, false);
3717 geo.add(fig);
3718 // Set dimensions
3719 const fig2 = new go.PathFigure(w, h, false);
3720 geo.add(fig2);
3721 const fig3 = new go.PathFigure(.1 * w, h, true);
3722 geo.add(fig3);
3723 fig3.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));
3724 fig3.add(new go.PathSegment(go.PathSegment.Line, .9 * w, h));
3725 fig3.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h).close());
3726 return geo;
3727});
3728go.Shape.defineFigureGenerator('Caution', (shape, w, h) => {
3729 const geo = new go.Geometry();
3730 const fig = new go.PathFigure(0.05 * w, h, true);
3731 geo.add(fig);
3732 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.1 * w, .8 * h, 0, h, 0, h));
3733 fig.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, .1 * h));
3734 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.55 * w, .1 * h, 0.5 * w, 0, 0.5 * w, 0));
3735 fig.add(new go.PathSegment(go.PathSegment.Line, 0.95 * w, 0.9 * h));
3736 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.9 * w, h, w, h, w, h));
3737 fig.add(new go.PathSegment(go.PathSegment.Line, 0.05 * w, h));
3738 const radius = 0.05;
3739 // Bottom circle of exclamation point
3740 fig.add(new go.PathSegment(go.PathSegment.Move, (0.5 - radius) * w, 0.875 * h));
3741 fig.add(new go.PathSegment(go.PathSegment.Arc, 180, -360, 0.5 * w, 0.875 * h, radius * w, radius * h));
3742 // Upper rectangle of exclamation point
3743 fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.75 * h));
3744 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.325 * h, 0.575 * w, 0.725 * h, 0.625 * w, 0.375 * h));
3745 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.75 * h, 0.375 * w, 0.375 * h, 0.425 * w, 0.725 * h));
3746 return geo;
3747});
3748go.Shape.defineFigureGenerator('Recycle', (shape, w, h) => {
3749 const geo = new go.Geometry();
3750 const fig = new go.PathFigure(0.45 * w, 0.95 * h, false);
3751 geo.add(fig);
3752 // Bottom left arrow
3753 fig.add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, 0.95 * h));
3754 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.185 * w, 0.85 * h, 0.17 * w, 0.95 * h, 0.15 * w, 0.9 * h));
3755 fig.add(new go.PathSegment(go.PathSegment.Line, 0.235 * w, 0.75 * h));
3756 fig.add(new go.PathSegment(go.PathSegment.Line, 0.30 * w, 0.625 * h));
3757 fig.add(new go.PathSegment(go.PathSegment.Line, 0.35 * w, 0.65 * h));
3758 fig.add(new go.PathSegment(go.PathSegment.Line, 0.275 * w, 0.45 * h));
3759 fig.add(new go.PathSegment(go.PathSegment.Line, 0.05 * w, 0.45 * h));
3760 fig.add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0.5 * h));
3761 fig.add(new go.PathSegment(go.PathSegment.Line, 0.05 * w, 0.575 * h));
3762 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.1875 * w, 0.95 * h, 0, 0.675 * h, 0, 0.7 * h));
3763 fig.add(new go.PathSegment(go.PathSegment.Move, 0.45 * w, 0.95 * h));
3764 fig.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.775 * h));
3765 fig.add(new go.PathSegment(go.PathSegment.Line, 0.22 * w, 0.775 * h));
3766 const fig2 = new go.PathFigure(0.475 * w, 0.2 * h, false);
3767 geo.add(fig2);
3768 // Top arrow
3769 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0.4 * h));
3770 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.225 * w, 0.3 * h));
3771 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.275 * w, 0.175 * h));
3772 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.325 * w, 0.05 * h));
3773 fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0.4 * w, 0.05 * h, 0.35 * w, 0, 0.375 * w, 0));
3774 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.575 * w, 0.375 * h));
3775 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.525 * w, 0.4 * h));
3776 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.75 * w, 0.475 * h));
3777 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.85 * w, 0.315 * h));
3778 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.32 * h));
3779 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, 0.05 * h));
3780 fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0.575 * w, 0, 0.65 * w, 0.05 * h, 0.625 * w, 0));
3781 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.38 * w, 0.0105 * h));
3782 const fig3 = new go.PathFigure(0.675 * w, 0.575 * h, false);
3783 geo.add(fig3);
3784 // Bottom right arrow
3785 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.875 * w, 0.525 * h));
3786 fig3.add(new go.PathSegment(go.PathSegment.Line, w, 0.775 * h));
3787 fig3.add(new go.PathSegment(go.PathSegment.Bezier, 0.85 * w, 0.95 * h, w, 0.8 * h, w, 0.85 * h));
3788 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, 0.95 * h));
3789 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, h));
3790 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, 0.85 * h));
3791 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, 0.725 * h));
3792 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, 0.775 * h));
3793 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.7 * w, 0.775 * h));
3794 fig3.add(new go.PathSegment(go.PathSegment.Line, w, 0.775 * h));
3795 fig3.add(new go.PathSegment(go.PathSegment.Move, 0.675 * w, 0.575 * h));
3796 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.775 * w, 0.775 * h));
3797 return geo;
3798});
3799go.Shape.defineFigureGenerator('BpmnEventTimer', (shape, w, h) => {
3800 const geo = new go.Geometry();
3801 const radius = .5;
3802 const cpOffset = KAPPA * .5;
3803 const fig = new go.PathFigure(w, radius * h, true);
3804 geo.add(fig);
3805 fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, h, w, (radius + cpOffset) * h, (radius + cpOffset) * w, h));
3806 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, radius * h, (radius - cpOffset) * w, h, 0, (radius + cpOffset) * h));
3807 fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, 0, 0, (radius - cpOffset) * h, (radius - cpOffset) * w, 0));
3808 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, radius * h, (radius + cpOffset) * w, 0, w, (radius - cpOffset) * h));
3809 const fig2 = new go.PathFigure(radius * w, 0, false);
3810 geo.add(fig2);
3811 // Hour lines
3812 fig2.add(new go.PathSegment(go.PathSegment.Line, radius * w, .15 * h));
3813 fig2.add(new go.PathSegment(go.PathSegment.Move, radius * w, h));
3814 fig2.add(new go.PathSegment(go.PathSegment.Line, radius * w, .85 * h));
3815 fig2.add(new go.PathSegment(go.PathSegment.Move, 0, radius * h));
3816 fig2.add(new go.PathSegment(go.PathSegment.Line, .15 * w, radius * h));
3817 fig2.add(new go.PathSegment(go.PathSegment.Move, w, radius * h));
3818 fig2.add(new go.PathSegment(go.PathSegment.Line, .85 * w, radius * h));
3819 // Clock hands
3820 fig2.add(new go.PathSegment(go.PathSegment.Move, radius * w, radius * h));
3821 fig2.add(new go.PathSegment(go.PathSegment.Line, .58 * w, 0.1 * h));
3822 fig2.add(new go.PathSegment(go.PathSegment.Move, radius * w, radius * h));
3823 fig2.add(new go.PathSegment(go.PathSegment.Line, .78 * w, .54 * h));
3824 return geo;
3825});
3826go.Shape.defineFigureGenerator('Package', (shape, w, h) => {
3827 const geo = new go.Geometry();
3828 const fig = new go.PathFigure(0, 0.15 * h, true);
3829 geo.add(fig);
3830 // Package bottom rectangle
3831 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.15 * h));
3832 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
3833 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
3834 const fig2 = new go.PathFigure(0, 0.15 * h, true);
3835 geo.add(fig2);
3836 // Package top flap
3837 fig2.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
3838 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0));
3839 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, 0.15 * h).close());
3840 geo.spot1 = new go.Spot(0, 0.1);
3841 geo.spot2 = new go.Spot(1, 1);
3842 return geo;
3843});
3844go.Shape.defineFigureGenerator('Class', (shape, w, h) => {
3845 const geo = new go.Geometry();
3846 const fig = new go.PathFigure(0, 0, true);
3847 geo.add(fig);
3848 // Class box
3849 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
3850 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
3851 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
3852 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0).close());
3853 const fig2 = new go.PathFigure(0, 0.2 * h, false);
3854 geo.add(fig2);
3855 // Top box separater
3856 fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0.2 * h).close());
3857 const fig3 = new go.PathFigure(0, 0.5 * h, false);
3858 geo.add(fig3);
3859 // Middle box separater
3860 fig3.add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h).close());
3861 return geo;
3862});
3863go.Shape.defineFigureGenerator('Component', (shape, w, h) => {
3864 const geo = new go.Geometry();
3865 const fig = new go.PathFigure(w, h, true);
3866 geo.add(fig);
3867 // Component Box
3868 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
3869 fig.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, 0));
3870 fig.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, h));
3871 fig.add(new go.PathSegment(go.PathSegment.Line, w, h).close());
3872 const fig2 = new go.PathFigure(0, 0.2 * h, true);
3873 geo.add(fig2);
3874 // Component top sub box
3875 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.2 * h));
3876 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.4 * h));
3877 fig2.add(new go.PathSegment(go.PathSegment.Line, 0, 0.4 * h));
3878 fig2.add(new go.PathSegment(go.PathSegment.Line, 0, 0.2 * h).close());
3879 const fig3 = new go.PathFigure(0, 0.6 * h, true);
3880 geo.add(fig3);
3881 // Component bottom sub box
3882 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.6 * h));
3883 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.8 * h));
3884 fig3.add(new go.PathSegment(go.PathSegment.Line, 0, 0.8 * h));
3885 fig3.add(new go.PathSegment(go.PathSegment.Line, 0, 0.6 * h).close());
3886 return geo;
3887});
3888go.Shape.defineFigureGenerator('Boat Shipment', (shape, w, h) => {
3889 const geo = new go.Geometry();
3890 const fig = new go.PathFigure(0.15 * w, 0.6 * h, true);
3891 geo.add(fig);
3892 // Boat shipment flag
3893 fig.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, 0.6 * h));
3894 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.6 * h));
3895 fig.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, h));
3896 fig.add(new go.PathSegment(go.PathSegment.Line, 0.85 * w, h));
3897 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.6 * h));
3898 fig.add(new go.PathSegment(go.PathSegment.Line, 0.85 * w, 0.6 * h));
3899 fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0));
3900 fig.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, 0.6 * h));
3901 const fig2 = new go.PathFigure(0.15 * w, 0.6 * h, false);
3902 geo.add(fig2);
3903 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.85 * w, 0.6 * h));
3904 return geo;
3905});
3906go.Shape.defineFigureGenerator('Customer/Supplier', (shape, w, h) => {
3907 const geo = new go.Geometry();
3908 const fig = new go.PathFigure(w, h, true);
3909 geo.add(fig);
3910 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
3911 fig.add(new go.PathSegment(go.PathSegment.Line, 0.66 * w, 0.33 * h));
3912 fig.add(new go.PathSegment(go.PathSegment.Line, 0.66 * w, 0));
3913 fig.add(new go.PathSegment(go.PathSegment.Line, 0.33 * w, 0.33 * h));
3914 fig.add(new go.PathSegment(go.PathSegment.Line, 0.33 * w, 0));
3915 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.33 * h));
3916 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
3917 fig.add(new go.PathSegment(go.PathSegment.Line, w, h).close());
3918 return geo;
3919});
3920go.Shape.defineFigureGenerator('Workcell', (shape, w, h) => {
3921 const geo = new go.Geometry();
3922 const fig = new go.PathFigure(0, h, true);
3923 geo.add(fig);
3924 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
3925 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
3926 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
3927 fig.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, h));
3928 fig.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, 0.4 * h));
3929 fig.add(new go.PathSegment(go.PathSegment.Line, 0.35 * w, 0.4 * h));
3930 fig.add(new go.PathSegment(go.PathSegment.Line, 0.35 * w, h));
3931 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
3932 return geo;
3933});
3934go.Shape.defineFigureGenerator('Supermarket', (shape, w, h) => {
3935 const geo = new go.Geometry();
3936 const fig = new go.PathFigure(0, 0, false);
3937 geo.add(fig);
3938 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
3939 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.33 * h));
3940 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.33 * h));
3941 fig.add(new go.PathSegment(go.PathSegment.Move, w, 0.33 * h));
3942 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.66 * h));
3943 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.66 * h));
3944 fig.add(new go.PathSegment(go.PathSegment.Move, w, 0.66 * h));
3945 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
3946 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
3947 return geo;
3948});
3949go.Shape.defineFigureGenerator('TruckShipment', (shape, w, h) => {
3950 const geo = new go.Geometry();
3951 const fig = new go.PathFigure(0, 0, true);
3952 geo.add(fig);
3953 // Left rectangle
3954 fig.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0));
3955 fig.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0.8 * h));
3956 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.8 * h));
3957 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0).close());
3958 const fig2 = new go.PathFigure(w, 0.8 * h, true);
3959 geo.add(fig2);
3960 // Right rectangle
3961 fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0.4 * h));
3962 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0.4 * h));
3963 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0.8 * h));
3964 fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0.8 * h).close());
3965 let radius = .1;
3966 let cpOffset = KAPPA * .1;
3967 let centerx = .2;
3968 let centery = .9;
3969 const fig3 = new go.PathFigure((centerx - radius) * w, centery * h, true);
3970 geo.add(fig3);
3971 // Left wheel
3972 fig3.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - radius) * h));
3973 fig3.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h));
3974 fig3.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
3975 fig3.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h).close());
3976 radius = .1;
3977 cpOffset = KAPPA * .1;
3978 centerx = .8;
3979 centery = .9;
3980 const fig4 = new go.PathFigure((centerx - radius) * w, centery * h, true);
3981 geo.add(fig4);
3982 // Right wheel
3983 fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - radius) * h));
3984 fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h));
3985 fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
3986 fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h).close());
3987 return geo;
3988});
3989go.Shape.defineFigureGenerator('KanbanPost', (shape, w, h) => {
3990 const geo = new go.Geometry();
3991 const fig = new go.PathFigure(0.2 * w, 0, false);
3992 geo.add(fig);
3993 fig.add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, .5 * h));
3994 fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.5 * h));
3995 fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0));
3996 fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.5 * h));
3997 fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h));
3998 fig.add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, h));
3999 fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, h));
4000 fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, h));
4001 return geo;
4002});
4003go.Shape.defineFigureGenerator('Forklift', (shape, w, h) => {
4004 const geo = new go.Geometry();
4005 const fig = new go.PathFigure(0, 0, true);
4006 geo.add(fig);
4007 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.5 * h));
4008 fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.5 * h));
4009 fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0));
4010 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
4011 const fig2 = new go.PathFigure(0, 0.5 * h, true);
4012 geo.add(fig2);
4013 fig2.add(new go.PathSegment(go.PathSegment.Line, 0, 0.8 * h));
4014 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.8 * h));
4015 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.5 * h));
4016 fig2.add(new go.PathSegment(go.PathSegment.Line, 0, 0.5 * h));
4017 const fig3 = new go.PathFigure(0.50 * w, 0.8 * h, true);
4018 geo.add(fig3);
4019 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.50 * w, 0.1 * h));
4020 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, 0.1 * h));
4021 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, 0.8 * h));
4022 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.50 * w, 0.8 * h));
4023 const fig4 = new go.PathFigure(0.5 * w, 0.7 * h, false);
4024 geo.add(fig4);
4025 fig4.add(new go.PathSegment(go.PathSegment.Line, w, 0.7 * h));
4026 let radius = .1;
4027 let cpOffset = KAPPA * .1;
4028 let centerx = .1;
4029 let centery = .9;
4030 const fig5 = new go.PathFigure((centerx - radius) * w, centery * h, true);
4031 geo.add(fig5);
4032 fig5.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - radius) * h));
4033 fig5.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h));
4034 fig5.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
4035 fig5.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h));
4036 radius = .1;
4037 cpOffset = KAPPA * .1;
4038 centerx = .4;
4039 centery = .9;
4040 const fig6 = new go.PathFigure((centerx - radius) * w, centery * h, true);
4041 geo.add(fig6);
4042 fig6.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - radius) * h));
4043 fig6.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h));
4044 fig6.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
4045 fig6.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h));
4046 return geo;
4047});
4048go.Shape.defineFigureGenerator('RailShipment', (shape, w, h) => {
4049 const geo = new go.Geometry();
4050 const fig = new go.PathFigure(0.1 * w, 0.4 * h, true);
4051 geo.add(fig);
4052 // Left cart
4053 fig.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.4 * h));
4054 fig.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.9 * h));
4055 fig.add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0.9 * h));
4056 fig.add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0.4 * h).close());
4057 const fig2 = new go.PathFigure(0.45 * w, 0.7 * h, false);
4058 geo.add(fig2);
4059 // Line connecting carts
4060 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, 0.7 * h));
4061 const fig3 = new go.PathFigure(0.55 * w, 0.4 * h, true);
4062 geo.add(fig3);
4063 // Right cart
4064 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.4 * h));
4065 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.9 * h));
4066 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, 0.9 * h));
4067 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, 0.4 * h).close());
4068 let radius = .05;
4069 let cpOffset = KAPPA * .05;
4070 let centerx = .175;
4071 let centery = .95;
4072 const fig4 = new go.PathFigure((centerx - radius) * w, centery * h, true);
4073 geo.add(fig4);
4074 // Wheels
4075 fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - radius) * h));
4076 fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h));
4077 fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
4078 fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h));
4079 radius = .05;
4080 cpOffset = KAPPA * .05;
4081 centerx = .375;
4082 centery = .95;
4083 const fig5 = new go.PathFigure((centerx - radius) * w, centery * h, true);
4084 geo.add(fig5);
4085 fig5.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - radius) * h));
4086 fig5.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h));
4087 fig5.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
4088 fig5.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h));
4089 radius = .05;
4090 cpOffset = KAPPA * .05;
4091 centerx = .625;
4092 centery = .95;
4093 const fig6 = new go.PathFigure((centerx - radius) * w, centery * h, true);
4094 geo.add(fig6);
4095 fig6.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - radius) * h));
4096 fig6.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h));
4097 fig6.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
4098 fig6.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h));
4099 radius = .05;
4100 cpOffset = KAPPA * .05;
4101 centerx = .825;
4102 centery = .95;
4103 const fig7 = new go.PathFigure((centerx - radius) * w, centery * h, true);
4104 geo.add(fig7);
4105 fig7.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - radius) * h));
4106 fig7.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h));
4107 fig7.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
4108 fig7.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h).close());
4109 const fig8 = new go.PathFigure(0, h, false);
4110 geo.add(fig8);
4111 fig8.add(new go.PathSegment(go.PathSegment.Line, w, h).close());
4112 return geo;
4113});
4114go.Shape.defineFigureGenerator('Warehouse', (shape, w, h) => {
4115 const geo = new go.Geometry();
4116 const fig = new go.PathFigure(0, 0, true);
4117 geo.add(fig);
4118 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
4119 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
4120 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
4121 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0).close());
4122 const fig2 = new go.PathFigure(0, 0.2 * h, false);
4123 geo.add(fig2);
4124 fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0.2 * h).close());
4125 const fig3 = new go.PathFigure(0.15 * w, h, true);
4126 geo.add(fig3);
4127 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, 0.5 * h));
4128 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.40 * w, 0.5 * h));
4129 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.40 * w, h));
4130 fig3.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, h).close());
4131 const radius = .05;
4132 const cpOffset = KAPPA * .05;
4133 const centerx = .35;
4134 const centery = .775;
4135 const fig4 = new go.PathFigure((centerx - radius) * w, centery * h, true);
4136 geo.add(fig4);
4137 // Door handle
4138 fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - radius) * h));
4139 fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h));
4140 fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
4141 fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h).close());
4142 return geo;
4143});
4144go.Shape.defineFigureGenerator('ControlCenter', (shape, w, h) => {
4145 const geo = new go.Geometry();
4146 const fig = new go.PathFigure(0, h, true);
4147 geo.add(fig);
4148 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.8 * h));
4149 fig.add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0.8 * h));
4150 fig.add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0));
4151 fig.add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0));
4152 fig.add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.8 * h));
4153 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.8 * h));
4154 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
4155 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
4156 fig.add(new go.PathSegment(go.PathSegment.Move, 0.1 * w, 0.8 * h));
4157 fig.add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.8 * h).close());
4158 return geo;
4159});
4160go.Shape.defineFigureGenerator('Bluetooth', (shape, w, h) => {
4161 const geo = new go.Geometry();
4162 const fig = new go.PathFigure(0, 0.75 * h, false);
4163 geo.add(fig);
4164 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.75 * h));
4165 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.25 * h));
4166 fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0));
4167 fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h));
4168 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.75 * h));
4169 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.25 * h));
4170 return geo;
4171});
4172go.Shape.defineFigureGenerator('Bookmark', (shape, w, h) => {
4173 const geo = new go.Geometry();
4174 const fig = new go.PathFigure(0, 0, true);
4175 geo.add(fig);
4176 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
4177 fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.6 * h));
4178 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
4179 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
4180 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
4181 fig.add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.2 * h));
4182 fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.2 * h));
4183 fig.add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.4 * h));
4184 fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.4 * h));
4185 return geo;
4186});
4187go.Shape.defineFigureGenerator('Bookmark', (shape, w, h) => {
4188 const geo = new go.Geometry();
4189 const fig = new go.PathFigure(0, 0, true);
4190 geo.add(fig);
4191 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
4192 fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.6 * h));
4193 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
4194 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
4195 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));
4196 fig.add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.2 * h));
4197 fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.2 * h));
4198 fig.add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.4 * h));
4199 fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.4 * h));
4200 return geo;
4201});
4202go.Shape.defineFigureGenerator('Globe', (shape, w, h) => {
4203 const geo = new go.Geometry();
4204 const fig = new go.PathFigure(0.5 * w, 0, false);
4205 geo.add(fig);
4206 fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h));
4207 fig.add(new go.PathSegment(go.PathSegment.Move, 0, 0.5 * h));
4208 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h));
4209 fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0));
4210 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, 0.5 * h, 0.75 * w, 0, w, 0.25 * h));
4211 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, h, w, 0.75 * h, 0.75 * w, h));
4212 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0.5 * h, 0.25 * w, h, 0, 0.75 * h));
4213 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0, 0, 0.25 * h, 0.25 * w, 0));
4214 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, h, 0.15 * w, 0.25 * h, 0.15 * w, 0.75 * h));
4215 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0, 0.85 * w, 0.75 * h, 0.85 * w, 0.25 * h));
4216 fig.add(new go.PathSegment(go.PathSegment.Move, 0.1675 * w, 0.15 * h));
4217 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.8325 * w, 0.15 * h, 0.35 * w, 0.3 * h, 0.65 * w, 0.3 * h));
4218 fig.add(new go.PathSegment(go.PathSegment.Move, 0.1675 * w, 0.85 * h));
4219 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.8325 * w, 0.85 * h, 0.35 * w, 0.7 * h, 0.65 * w, 0.7 * h));
4220 return geo;
4221});
4222go.Shape.defineFigureGenerator('Wave', (shape, w, h) => {
4223 const geo = new go.Geometry();
4224 const fig = new go.PathFigure(0, 0.25 * h, false);
4225 geo.add(fig);
4226 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.3 * w, 0.25 * h, 0.10 * w, 0, 0.2 * w, 0));
4227 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.7 * w, 0.25 * h, 0.425 * w, 0.5 * h, 0.575 * w, 0.5 * h));
4228 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, 0.25 * h, 0.8 * w, 0, 0.9 * w, 0));
4229 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.75 * h));
4230 fig.add(new go.PathSegment(go.PathSegment.Move, 0, 0.25 * h));
4231 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.75 * h));
4232 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.3 * w, 0.75 * h, 0.10 * w, 0.5 * h, 0.2 * w, 0.5 * h));
4233 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.7 * w, 0.75 * h, 0.425 * w, h, 0.575 * w, h));
4234 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, 0.75 * h, 0.8 * w, 0.5 * h, 0.9 * w, 0.5 * h));
4235 return geo;
4236});
4237go.Shape.defineFigureGenerator('Operator', (shape, w, h) => {
4238 const geo = new go.Geometry();
4239 const radius = .3;
4240 const cpOffset = KAPPA * .3;
4241 const centerx = .5;
4242 const centery = .7;
4243 const fig = new go.PathFigure((centerx - radius) * w, centery * h, true);
4244 geo.add(fig);
4245 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - radius) * h));
4246 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h));
4247 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
4248 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h));
4249 const fig2 = new go.PathFigure(0, 0.7 * h, false);
4250 geo.add(fig2);
4251 fig2.add(new go.PathSegment(go.PathSegment.Bezier, w, 0.7 * h, 0, 0, w, 0));
4252 return geo;
4253});
4254go.Shape.defineFigureGenerator('TripleFanBlades', (shape, w, h) => {
4255 const geo = new go.Geometry();
4256 const fig = new go.PathFigure(0.5 * w, 0, true);
4257 geo.add(fig);
4258 // Top blade
4259 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.65 * h, 0.65 * w, 0.3 * h, 0.65 * w, 0.5 * h));
4260 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0, 0.35 * w, 0.5 * h, 0.35 * w, 0.3 * h));
4261 // Bottom left blade
4262 fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.65 * h));
4263 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, h, 0.3 * w, 0.6 * h, 0.1 * w, 0.8 * h));
4264 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.65 * h, 0.2 * w, h, 0.35 * w, 0.95 * h));
4265 // Bottom right blade
4266 fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.65 * h));
4267 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, h, 0.7 * w, 0.6 * h, 0.9 * w, 0.8 * h));
4268 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.65 * h, 0.8 * w, h, 0.65 * w, 0.95 * h));
4269 return geo;
4270});
4271go.Shape.defineFigureGenerator('CentrifugalPump', (shape, w, h) => {
4272 const geo = new go.Geometry();
4273 const fig = new go.PathFigure(w, 0, true);
4274 geo.add(fig);
4275 fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0));
4276 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0.5 * h, 0, 0.075 * h, 0, 0.5 * h));
4277 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.4 * w, h, 0, h, 0.4 * w, h));
4278 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.8 * w, 0.4 * h, 0.8 * w, h, 0.85 * w, 0.6 * h));
4279 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.4 * h));
4280 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));
4281 return geo;
4282});
4283go.Shape.defineFigureGenerator('Battery', (shape, w, h) => {
4284 const geo = new go.Geometry();
4285 const fig = new go.PathFigure(0, h, true);
4286 geo.add(fig);
4287 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.1 * h));
4288 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.1 * h));
4289 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
4290 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
4291 fig.add(new go.PathSegment(go.PathSegment.Move, 0.4 * w, 0.1 * h));
4292 fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0));
4293 fig.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0));
4294 fig.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0.1 * h));
4295 const fig2 = new go.PathFigure(0, 0.6 * h, false);
4296 geo.add(fig2);
4297 fig2.add(new go.PathSegment(go.PathSegment.Move, 0, 0.4 * h));
4298 fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0.4 * h));
4299 return geo;
4300});
4301go.Shape.defineFigureGenerator('Delete', (shape, w, h) => {
4302 const geo = new go.Geometry();
4303 const radius = .5;
4304 const cpOffset = KAPPA * .5;
4305 const centerx = .5;
4306 const centery = .5;
4307 const fig = new go.PathFigure((centerx - radius) * w, centery * h, true);
4308 geo.add(fig);
4309 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - radius) * h));
4310 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h));
4311 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
4312 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h));
4313 const fig2 = new go.PathFigure(0.15 * w, 0.5 * h, false);
4314 geo.add(fig2);
4315 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.85 * w, 0.5 * h));
4316 return geo;
4317});
4318go.Shape.defineFigureGenerator('Flag', (shape, w, h) => {
4319 const geo = new go.Geometry();
4320 const fig = new go.PathFigure(0, 0.1 * h, true);
4321 geo.add(fig);
4322 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
4323 fig.add(new go.PathSegment(go.PathSegment.Move, 0, 0.1 * h));
4324 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.1 * h, 0.15 * w, 0, 0.35 * w, 0));
4325 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, 0.1 * h, 0.65 * w, 0.2 * h, 0.85 * w, 0.2 * h));
4326 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h));
4327 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.5 * h, 0.85 * w, 0.6 * h, 0.65 * w, 0.6 * h));
4328 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0.5 * h, 0.35 * w, 0.4 * h, 0.15 * w, 0.4 * h).close());
4329 return geo;
4330});
4331go.Shape.defineFigureGenerator('Help', (shape, w, h) => {
4332 const geo = new go.Geometry();
4333 let radius = .5;
4334 let cpOffset = KAPPA * .5;
4335 let centerx = .5;
4336 let centery = .5;
4337 const fig = new go.PathFigure((centerx - radius) * w, centery * h, false);
4338 geo.add(fig);
4339 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - radius) * h));
4340 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h));
4341 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
4342 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h).close());
4343 radius = .05;
4344 cpOffset = KAPPA * .05;
4345 centerx = .5;
4346 centery = .8;
4347 const fig2 = new go.PathFigure((centerx - radius) * w, centery * h, false);
4348 geo.add(fig2);
4349 fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h, (centerx - cpOffset) * w, (centery - radius) * h));
4350 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h));
4351 fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h, (centerx + cpOffset) * w, (centery + radius) * h));
4352 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h).close());
4353 fig2.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.7 * h));
4354 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.5 * h));
4355 fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.2 * h, 0.75 * w, 0.475 * h, 0.75 * w, 0.225 * h));
4356 fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0.3 * w, 0.35 * h, 0.4 * w, 0.2 * h, 0.3 * w, 0.25 * h));
4357 return geo;
4358});
4359go.Shape.defineFigureGenerator('Location', (shape, w, h) => {
4360 return new go.Geometry()
4361 .add(new go.PathFigure(0.5 * w, h, true)
4362 .add(new go.PathSegment(go.PathSegment.Line, 0.75 * w, 0.5 * h))
4363 .add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0, .975 * w, 0.025 * h, 0.5 * w, 0))
4364 .add(new go.PathSegment(go.PathSegment.Bezier, 0.25 * w, 0.5 * h, 0.5 * w, 0, 0.025 * w, 0.025 * h).close())
4365 .add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.2 * h))
4366 .add(new go.PathSegment(go.PathSegment.Arc, 270, 360, 0.5 * w, 0.3 * h, 0.1 * w, 0.1 * h).close()));
4367});
4368go.Shape.defineFigureGenerator('Lock', (shape, w, h) => {
4369 const geo = new go.Geometry();
4370 const fig = new go.PathFigure(0, 0.5 * h, true);
4371 geo.add(fig);
4372 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
4373 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
4374 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h));
4375 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.5 * h));
4376 const fig2 = new go.PathFigure(0.2 * w, 0.5 * h, false);
4377 geo.add(fig2);
4378 fig2.add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.5 * h));
4379 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, 0.3 * h));
4380 fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0.8 * w, 0.3 * h, 0.25 * w, 0, 0.75 * w, 0));
4381 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.5 * h));
4382 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.3 * h));
4383 return geo;
4384});
4385go.Shape.defineFigureGenerator('Unlocked', (shape, w, h) => {
4386 const geo = new go.Geometry();
4387 const fig = new go.PathFigure(0, 0.5 * h, true);
4388 geo.add(fig);
4389 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));
4390 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
4391 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h));
4392 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.5 * h));
4393 const fig2 = new go.PathFigure(0.2 * w, 0.5 * h, false);
4394 geo.add(fig2);
4395 fig2.add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.5 * h));
4396 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, 0.3 * h));
4397 fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0.8 * w, 0.3 * h, 0.25 * w, 0, 0.75 * w, 0));
4398 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.35 * h));
4399 return geo;
4400});
4401go.Shape.defineFigureGenerator('Gear', (shape, w, h) => {
4402 return new go.Geometry()
4403 .add(new go.PathFigure(0.9375 * w, 0.56246875 * h, true)
4404 .add(new go.PathSegment(go.PathSegment.Line, 0.9375 * w, 0.4375 * h))
4405 .add(new go.PathSegment(go.PathSegment.Line, 0.80621875 * w, 0.4375 * h))
4406 .add(new go.PathSegment(go.PathSegment.Bezier, 0.763 * w, 0.3316875 * h, 0.79840625 * w, 0.39915625 * h, 0.7834375 * w, 0.3635 * h))
4407 .add(new go.PathSegment(go.PathSegment.Line, 0.8566875 * w, 0.23796875 * h))
4408 .add(new go.PathSegment(go.PathSegment.Line, 0.76825 * w, 0.14959375 * h))
4409 .add(new go.PathSegment(go.PathSegment.Line, 0.67596875 * w, 0.24184375 * h))
4410 .add(new go.PathSegment(go.PathSegment.Bezier, 0.5625 * w, 0.19378125 * h, 0.64228125 * w, 0.2188125 * h, 0.603875 * w, 0.2021875 * h))
4411 .add(new go.PathSegment(go.PathSegment.Line, 0.5625 * w, 0.0625 * h))
4412 .add(new go.PathSegment(go.PathSegment.Line, 0.4375 * w, 0.0625 * h))
4413 .add(new go.PathSegment(go.PathSegment.Line, 0.4375 * w, 0.19378125 * h))
4414 .add(new go.PathSegment(go.PathSegment.Bezier, 0.32775 * w, 0.239375 * h, 0.39759375 * w, 0.20190625 * h, 0.36053125 * w, 0.2176875 * h))
4415 .add(new go.PathSegment(go.PathSegment.Line, 0.2379375 * w, 0.14959375 * h))
4416 .add(new go.PathSegment(go.PathSegment.Line, 0.14953125 * w, 0.2379375 * h))
4417 .add(new go.PathSegment(go.PathSegment.Line, 0.23934375 * w, 0.3278125 * h))
4418 .add(new go.PathSegment(go.PathSegment.Bezier, 0.19378125 * w, 0.4375 * h, 0.21765625 * w, 0.36059375 * h, 0.201875 * w, 0.397625 * h))
4419 .add(new go.PathSegment(go.PathSegment.Line, 0.0625 * w, 0.4375 * h))
4420 .add(new go.PathSegment(go.PathSegment.Line, 0.0625 * w, 0.5625 * h))
4421 .add(new go.PathSegment(go.PathSegment.Line, 0.1938125 * w, 0.5625 * h))
4422 .add(new go.PathSegment(go.PathSegment.Bezier, 0.241875 * w, 0.67596875 * h, 0.20221875 * w, 0.603875 * h, 0.21884375 * w, 0.64228125 * h))
4423 .add(new go.PathSegment(go.PathSegment.Line, 0.1495625 * w, 0.76825 * h))
4424 .add(new go.PathSegment(go.PathSegment.Line, 0.238 * w, 0.8566875 * h))
4425 .add(new go.PathSegment(go.PathSegment.Line, 0.3316875 * w, 0.76296875 * h))
4426 .add(new go.PathSegment(go.PathSegment.Bezier, 0.43753125 * w, 0.80621875 * h, 0.36353125 * w, 0.78340625 * h, 0.3991875 * w, 0.79840625 * h))
4427 .add(new go.PathSegment(go.PathSegment.Line, 0.43753125 * w, 0.9375 * h))
4428 .add(new go.PathSegment(go.PathSegment.Line, 0.5625 * w, 0.9375 * h))
4429 .add(new go.PathSegment(go.PathSegment.Line, 0.5625 * w, 0.80621875 * h))
4430 .add(new go.PathSegment(go.PathSegment.Bezier, 0.67225 * w, 0.760625 * h, 0.602375 * w, 0.79809375 * h, 0.63946875 * w, 0.78234375 * h))
4431 .add(new go.PathSegment(go.PathSegment.Line, 0.76828125 * w, 0.8566875 * h))
4432 .add(new go.PathSegment(go.PathSegment.Line, 0.85671875 * w, 0.76825 * h))
4433 .add(new go.PathSegment(go.PathSegment.Line, 0.76065625 * w, 0.67221875 * h))
4434 .add(new go.PathSegment(go.PathSegment.Bezier, 0.80621875 * w, 0.56246875 * h, 0.78234375 * w, 0.63940625 * h, 0.798125 * w, 0.602375 * h))
4435 .add(new go.PathSegment(go.PathSegment.Line, 0.9375 * w, 0.56246875 * h).close())
4436 .add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.6 * h))
4437 .add(new go.PathSegment(go.PathSegment.Arc, 90, 360, 0.5 * w, 0.5 * h, 0.1 * w, 0.1 * h).close()));
4438});
4439go.Shape.defineFigureGenerator('Hand', function (shape, w, h) {
4440 const geo = new go.Geometry();
4441 const fig = new go.PathFigure(0, 0.5 * h, true);
4442 geo.add(fig);
4443 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.1 * w, 0.3 * h, 0, 0.375 * h, 0.05 * w, 0.325 * h));
4444 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.45 * w, 0.075 * h, 0.3 * w, 0.225 * h, 0.4 * w, 0.175 * h));
4445 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.525 * w, 0.075 * h, 0.46 * w, 0.05 * h, 0.525 * w, 0.05 * h));
4446 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.3 * w, 0.4 * h, 0.525 * w, 0.275 * h, 0.475 * w, 0.325 * h));
4447 fig.add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.4 * h));
4448 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.9 * w, 0.55 * h, w, 0.4 * h, w, 0.55 * h));
4449 fig.add(new go.PathSegment(go.PathSegment.Line, 0.425 * w, 0.55 * h));
4450 fig.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0.55 * h));
4451 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.6 * w, 0.7 * h, 0.675 * w, 0.55 * h, 0.675 * w, 0.7 * h));
4452 fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0.7 * h));
4453 fig.add(new go.PathSegment(go.PathSegment.Line, 0.575 * w, 0.7 * h));
4454 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.575 * w, 0.85 * h, 0.65 * w, 0.7 * h, 0.65 * w, 0.85 * h));
4455 fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0.85 * h));
4456 fig.add(new go.PathSegment(go.PathSegment.Line, 0.525 * w, 0.85 * h));
4457 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.535 * w, h, 0.61 * w, 0.85 * h, 0.61 * w, h));
4458 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0.9 * h, 0.435 * w, h, 0, h).close());
4459 return geo;
4460});
4461go.Shape.defineFigureGenerator('Map', (shape, w, h) => {
4462 const geo = new go.Geometry();
4463 const fig = new go.PathFigure(0, 0.2 * h, true);
4464 geo.add(fig);
4465 fig.add(new go.PathSegment(go.PathSegment.Line, 0.25 * w, 0));
4466 fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.2 * h));
4467 fig.add(new go.PathSegment(go.PathSegment.Line, 0.75 * w, 0));
4468 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.2 * h));
4469 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
4470 fig.add(new go.PathSegment(go.PathSegment.Line, 0.75 * w, 0.8 * h));
4471 fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h));
4472 fig.add(new go.PathSegment(go.PathSegment.Line, 0.25 * w, 0.8 * h));
4473 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());
4474 fig.add(new go.PathSegment(go.PathSegment.Move, 0.25 * w, 0));
4475 fig.add(new go.PathSegment(go.PathSegment.Line, 0.25 * w, 0.8 * h));
4476 fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.2 * h));
4477 fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h));
4478 fig.add(new go.PathSegment(go.PathSegment.Move, 0.75 * w, 0));
4479 fig.add(new go.PathSegment(go.PathSegment.Line, 0.75 * w, 0.8 * h));
4480 return geo;
4481});
4482go.Shape.defineFigureGenerator('Eject', (shape, w, h) => {
4483 const geo = new go.Geometry();
4484 const fig = new go.PathFigure(0, h, true);
4485 geo.add(fig);
4486 // bottam rectangle section
4487 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));
4488 fig.add(new go.PathSegment(go.PathSegment.Line, w, h * .7));
4489 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * .7).close());
4490 const fig2 = new go.PathFigure(0, (h * .6), true);
4491 geo.add(fig2);
4492 fig2.add(new go.PathSegment(go.PathSegment.Line, w, (.6 * h)));
4493 fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0).close());
4494 return geo;
4495});
4496go.Shape.defineFigureGenerator('Pencil', (shape, w, h) => {
4497 return new go.Geometry()
4498 .add(new go.PathFigure(0, 0, true)
4499 .add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, 0.1 * h))
4500 .add(new go.PathSegment(go.PathSegment.Line, w, 0.9 * h))
4501 .add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, h))
4502 .add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0.2 * h).close()));
4503});
4504go.Shape.defineFigureGenerator('Building', (shape, w, h) => {
4505 const geo = new go.Geometry();
4506 const fig = new go.PathFigure(w * 1, h * 1, false);
4507 geo.add(fig);
4508 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * 1)); // bottom part
4509 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * .85));
4510 fig.add(new go.PathSegment(go.PathSegment.Line, .046 * w, h * .85));
4511 fig.add(new go.PathSegment(go.PathSegment.Line, .046 * w, h * .45));
4512 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * .45));
4513 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * .30));
4514 fig.add(new go.PathSegment(go.PathSegment.Line, .046 * w, h * .30));
4515 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h * 0));
4516 fig.add(new go.PathSegment(go.PathSegment.Line, (1 - .046) * w, h * .30));
4517 fig.add(new go.PathSegment(go.PathSegment.Line, w, h * .30));
4518 fig.add(new go.PathSegment(go.PathSegment.Line, w, h * .45));
4519 fig.add(new go.PathSegment(go.PathSegment.Line, (1 - .046) * w, h * .45));
4520 fig.add(new go.PathSegment(go.PathSegment.Line, (1 - .046) * w, h * .85));
4521 fig.add(new go.PathSegment(go.PathSegment.Line, w, h * .85).close());
4522 const fig2 = new go.PathFigure(.126 * w, .85 * h, false); // is filled in our not
4523 geo.add(fig2);
4524 fig2.add(new go.PathSegment(go.PathSegment.Line, .126 * w, .45 * h));
4525 fig2.add(new go.PathSegment(go.PathSegment.Line, .322 * w, .45 * h));
4526 fig2.add(new go.PathSegment(go.PathSegment.Line, .322 * w, .85 * h).close());
4527 const fig3 = new go.PathFigure(.402 * w, .85 * h, false); // is filled in our not
4528 geo.add(fig3);
4529 fig3.add(new go.PathSegment(go.PathSegment.Line, .402 * w, .45 * h));
4530 fig3.add(new go.PathSegment(go.PathSegment.Line, .598 * w, .45 * h));
4531 fig3.add(new go.PathSegment(go.PathSegment.Line, .598 * w, .85 * h).close());
4532 const fig4 = new go.PathFigure(.678 * w, .85 * h, false); // is filled in our not
4533 geo.add(fig4);
4534 fig4.add(new go.PathSegment(go.PathSegment.Line, .678 * w, .45 * h));
4535 fig4.add(new go.PathSegment(go.PathSegment.Line, .874 * w, .45 * h));
4536 fig4.add(new go.PathSegment(go.PathSegment.Line, .874 * w, .85 * h).close());
4537 // the top inner triangle
4538 const fig5 = new go.PathFigure(.5 * w, .1 * h, false); // is filled in our not
4539 geo.add(fig5);
4540 fig5.add(new go.PathSegment(go.PathSegment.Line, (.046 + .15) * w, .30 * h));
4541 fig5.add(new go.PathSegment(go.PathSegment.Line, (1 - (.046 + .15)) * w, .30 * h).close());
4542 return geo;
4543});
4544go.Shape.defineFigureGenerator('Staircase', (shape, w, h) => {
4545 const geo = new go.Geometry();
4546 const fig = new go.PathFigure(0, h * 1, true);
4547 geo.add(fig);
4548 // Bottom part
4549 fig.add(new go.PathSegment(go.PathSegment.Line, w * .20, h * 1)); // bottom left part
4550 fig.add(new go.PathSegment(go.PathSegment.Line, w * .20, h * .80));
4551 fig.add(new go.PathSegment(go.PathSegment.Line, w * .40, h * .80));
4552 fig.add(new go.PathSegment(go.PathSegment.Line, w * .40, h * .60));
4553 fig.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * .60));
4554 fig.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * .40));
4555 fig.add(new go.PathSegment(go.PathSegment.Line, w * .80, h * .40));
4556 fig.add(new go.PathSegment(go.PathSegment.Line, w * .80, h * .20));
4557 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .20));
4558 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .15));
4559 fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * .15));
4560 fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * .35));
4561 fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, h * .35));
4562 fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, h * .55));
4563 fig.add(new go.PathSegment(go.PathSegment.Line, w * .35, h * .55));
4564 fig.add(new go.PathSegment(go.PathSegment.Line, w * .35, h * .75));
4565 fig.add(new go.PathSegment(go.PathSegment.Line, w * .15, h * .75));
4566 fig.add(new go.PathSegment(go.PathSegment.Line, w * .15, h * .95));
4567 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * .95).close());
4568 return geo;
4569});
4570go.Shape.defineFigureGenerator('5Bars', (shape, w, h) => {
4571 const geo = new go.Geometry();
4572 const fig = new go.PathFigure(0, h * 1, true); // bottom left
4573 geo.add(fig);
4574 // Width of each bar is .184
4575 // space in between each bar is .2
4576 fig.add(new go.PathSegment(go.PathSegment.Line, w * .184, h * 1)); // bottom left part
4577 fig.add(new go.PathSegment(go.PathSegment.Line, w * .184, h * (1 - .184)).close());
4578 const fig3 = new go.PathFigure(w * .204, h, true); // is filled in our not
4579 geo.add(fig3);
4580 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .204, h * (1 - .184)));
4581 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .388, h * (1 - (.184 * 2))));
4582 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .388, h * 1).close());
4583 const fig4 = new go.PathFigure(w * .408, h, true); // is filled in our not
4584 geo.add(fig4);
4585 fig4.add(new go.PathSegment(go.PathSegment.Line, w * .408, h * (1 - (.184 * 2))));
4586 fig4.add(new go.PathSegment(go.PathSegment.Line, w * .592, h * (1 - (.184 * 3))));
4587 fig4.add(new go.PathSegment(go.PathSegment.Line, w * .592, h * 1).close());
4588 const fig5 = new go.PathFigure(w * .612, h, true); // is filled in our not
4589 geo.add(fig5);
4590 fig5.add(new go.PathSegment(go.PathSegment.Line, w * .612, h * (1 - (.184 * 3))));
4591 fig5.add(new go.PathSegment(go.PathSegment.Line, w * .796, h * (1 - (.184 * 4))));
4592 fig5.add(new go.PathSegment(go.PathSegment.Line, w * .796, h * 1).close());
4593 const fig6 = new go.PathFigure(w * .816, h, true); // is filled in our not
4594 geo.add(fig6);
4595 fig6.add(new go.PathSegment(go.PathSegment.Line, w * .816, h * (1 - (.184 * 4))));
4596 fig6.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * (1 - (.184 * 5))));
4597 fig6.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1).close());
4598 return geo;
4599});
4600// desktop
4601go.Shape.defineFigureGenerator('PC', (shape, w, h) => {
4602 const geo = new go.Geometry();
4603 const fig = new go.PathFigure(0, 0, true); // top right
4604 geo.add(fig);
4605 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * 1));
4606 fig.add(new go.PathSegment(go.PathSegment.Line, w * .3, h * 1));
4607 fig.add(new go.PathSegment(go.PathSegment.Line, w * .3, 0).close());
4608 // Drive looking rectangle 1
4609 const fig2 = new go.PathFigure(w * .055, .07 * h, true); // is filled in our not
4610 geo.add(fig2);
4611 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .245, h * .07));
4612 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .245, h * .1));
4613 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .055, h * .1).close());
4614 // Drive looking rectangle 2
4615 const fig3 = new go.PathFigure(w * .055, .13 * h, true); // is filled in our not
4616 geo.add(fig3);
4617 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .245, h * .13));
4618 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .245, h * .16));
4619 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .055, h * .16).close());
4620 // Drive/cd rom looking rectangle 3
4621 const fig4 = new go.PathFigure(w * .055, .18 * h, true); // is filled in our not
4622 geo.add(fig4);
4623 fig4.add(new go.PathSegment(go.PathSegment.Line, w * .245, h * .18));
4624 fig4.add(new go.PathSegment(go.PathSegment.Line, w * .245, h * .21));
4625 fig4.add(new go.PathSegment(go.PathSegment.Line, w * .055, h * .21).close());
4626 const fig5 = new go.PathFigure(w * 1, 0, true); // is filled in our not
4627 geo.add(fig5);
4628 fig5.add(new go.PathSegment(go.PathSegment.Line, w * .4, 0));
4629 fig5.add(new go.PathSegment(go.PathSegment.Line, w * .4, h * .65));
4630 fig5.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .65).close());
4631 return geo;
4632});
4633go.Shape.defineFigureGenerator('Plane', (shape, w, h) => {
4634 const geo = new go.Geometry();
4635 const fig = new go.PathFigure(0.55 * w, h, true);
4636 geo.add(fig);
4637 fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.6 * h));
4638 fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0.7 * h));
4639 fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, 0.475 * h));
4640 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.35 * w, 0.525 * h, 0, 0.4 * h, 0.225 * w, 0.45 * h));
4641 fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0.475 * h));
4642 fig.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, 0.35 * h));
4643 fig.add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, 0.325 * h));
4644 fig.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0.325 * h));
4645 fig.add(new go.PathSegment(go.PathSegment.Line, 0.85 * w, 0.1 * h));
4646 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.9 * w, 0.2 * h, 0.975 * w, 0, w, .08 * h));
4647 fig.add(new go.PathSegment(go.PathSegment.Line, 0.7 * w, 0.45 * h));
4648 fig.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0.95 * h));
4649 fig.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, h).close());
4650 return geo;
4651});
4652go.Shape.defineFigureGenerator('Key', (shape, w, h) => {
4653 const geo = new go.Geometry();
4654 const fig = new go.PathFigure(w * 1, h * .5, true);
4655 geo.add(fig);
4656 fig.add(new go.PathSegment(go.PathSegment.Line, w * .90, .40 * h));
4657 fig.add(new go.PathSegment(go.PathSegment.Line, w * .50, .40 * h));
4658 fig.add(new go.PathSegment(go.PathSegment.Line, w * .50, .35 * h));
4659 fig.add(new go.PathSegment(go.PathSegment.Line, w * .45, .35 * h));
4660 fig.add(new go.PathSegment(go.PathSegment.Line, w * .30, .20 * h));
4661 fig.add(new go.PathSegment(go.PathSegment.Line, w * .15, .20 * h));
4662 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .35 * h));
4663 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .65 * h));
4664 fig.add(new go.PathSegment(go.PathSegment.Line, w * .15, .80 * h));
4665 fig.add(new go.PathSegment(go.PathSegment.Line, w * .30, .80 * h));
4666 fig.add(new go.PathSegment(go.PathSegment.Line, w * .45, .65 * h));
4667 fig.add(new go.PathSegment(go.PathSegment.Line, w * .50, .65 * h));
4668 fig.add(new go.PathSegment(go.PathSegment.Line, w * .50, .6 * h));
4669 fig.add(new go.PathSegment(go.PathSegment.Line, w * .60, .6 * h));
4670 fig.add(new go.PathSegment(go.PathSegment.Line, w * .65, .55 * h));
4671 fig.add(new go.PathSegment(go.PathSegment.Line, w * .70, .6 * h));
4672 fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, .55 * h));
4673 fig.add(new go.PathSegment(go.PathSegment.Line, w * .80, .6 * h));
4674 fig.add(new go.PathSegment(go.PathSegment.Line, w * .85, .575 * h));
4675 fig.add(new go.PathSegment(go.PathSegment.Line, w * .9, 0.60 * h).close());
4676 fig.add(new go.PathSegment(go.PathSegment.Move, 0.17 * w, 0.425 * h));
4677 fig.add(new go.PathSegment(go.PathSegment.Arc, 270, 360, 0.17 * w, 0.5 * h, 0.075 * w, 0.075 * h).close());
4678 return geo;
4679});
4680// movie like logo
4681go.Shape.defineFigureGenerator('FilmTape', (shape, w, h) => {
4682 const geo = new go.Geometry();
4683 const fig = new go.PathFigure(0, 0, false);
4684 geo.add(fig);
4685 fig.add(new go.PathSegment(go.PathSegment.Arc, 270, 180, w * 0, w * 0.3, w * 0.055)); // left semi-circle
4686 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * 1));
4687 fig.add(new go.PathSegment(go.PathSegment.Line, w * .08, h * 1));
4688 fig.add(new go.PathSegment(go.PathSegment.Line, w * .08, h * .95));
4689 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 1), h * .95));
4690 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 1), h * 1));
4691 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 2), h * 1));
4692 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 2), h * .95));
4693 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 3), h * .95));
4694 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 3), h * 1));
4695 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 4), h * 1));
4696 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 4), h * .95));
4697 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 5), h * .95));
4698 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 5), h * 1));
4699 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 6), h * 1));
4700 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 6), h * .95));
4701 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 7), h * .95));
4702 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 7), h * 1));
4703 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 8), h * 1));
4704 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 8), h * .95));
4705 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 9), h * .95));
4706 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 9), h * 1));
4707 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 10), h * 1));
4708 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 10), h * .95));
4709 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 11), h * .95));
4710 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 11), h * 1));
4711 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 12), h * 1));
4712 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 12), h * .95));
4713 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 13), h * .95));
4714 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 13), h * 1));
4715 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 14), h * 1));
4716 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 14), h * .95));
4717 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 15), h * .95));
4718 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 15), h * 1));
4719 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1));
4720 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1));
4721 const fig2 = new go.PathFigure(0, 0, false); // is filled in our not
4722 geo.add(fig2);
4723 fig2.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 0));
4724 fig2.add(new go.PathSegment(go.PathSegment.Arc, 270, -180, w * 1, w * 0.3, w * 0.055)); // right semi circle
4725 fig2.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1));
4726 // Each of the little square boxes on the tape
4727 const fig3 = new go.PathFigure(w * .11, h * .1, false); // is filled in our not
4728 geo.add(fig3);
4729 fig3.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 1) + (.028 * 0)), h * .1));
4730 fig3.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 1) + (.028 * 0)), h * .8));
4731 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .11, h * .8).close());
4732 const fig4 = new go.PathFigure(w * (.11 + (.24133333 * 1) + (.028 * 1)), h * .1, false); // is filled in our not
4733 geo.add(fig4);
4734 fig4.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 2) + (.028 * 1)), h * .1));
4735 fig4.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 2) + (.028 * 1)), h * .8));
4736 fig4.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 1) + (.028 * 1)), h * .8).close());
4737 const fig5 = new go.PathFigure(w * (.11 + (.24133333 * 2) + (.028 * 2)), h * .1, false); // is filled in our not
4738 geo.add(fig5);
4739 fig5.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 3) + (.028 * 2)), h * .1));
4740 fig5.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 3) + (.028 * 2)), h * .8));
4741 fig5.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 2) + (.028 * 2)), h * .8).close());
4742 return geo;
4743});
4744go.Shape.defineFigureGenerator('FloppyDisk', (shape, w, h) => {
4745 const geo = new go.Geometry();
4746 const roundValue = 8;
4747 const cpOffset = roundValue * KAPPA;
4748 const fig = new go.PathFigure(roundValue, 0, false);
4749 geo.add(fig);
4750 fig.add(new go.PathSegment(go.PathSegment.Line, w * .86, 0));
4751 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .14));
4752 fig.add(new go.PathSegment(go.PathSegment.Line, w, h - roundValue));
4753 fig.add(new go.PathSegment(go.PathSegment.Bezier, w - roundValue, h, w, h - cpOffset, w - cpOffset, h));
4754 fig.add(new go.PathSegment(go.PathSegment.Line, roundValue, h));
4755 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, h - roundValue, cpOffset, h, 0, h - cpOffset));
4756 fig.add(new go.PathSegment(go.PathSegment.Line, 0, roundValue));
4757 fig.add(new go.PathSegment(go.PathSegment.Bezier, roundValue, 0, 0, cpOffset, cpOffset, 0).close());
4758 // interior slightly rectangle
4759 const fig2 = new go.PathFigure(w * .83, 0, false);
4760 geo.add(fig2);
4761 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .83, h * .3));
4762 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .17, h * .3));
4763 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .17, h * 0).close());
4764 const fig3 = new go.PathFigure(w * .83, h * 1, false);
4765 geo.add(fig3);
4766 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .83, h * .5));
4767 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .17, h * .5));
4768 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .17, h * 1).close());
4769 const fig4 = new go.PathFigure(w * .78, h * .05, false);
4770 geo.add(fig4);
4771 fig4.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * .05));
4772 fig4.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * .25));
4773 fig4.add(new go.PathSegment(go.PathSegment.Line, w * .78, h * .25).close());
4774 return geo;
4775});
4776go.Shape.defineFigureGenerator('SpeechBubble', (shape, w, h) => {
4777 let param1 = shape ? shape.parameter1 : NaN;
4778 if (isNaN(param1) || param1 < 0)
4779 param1 = 15; // default corner
4780 param1 = Math.min(param1, w / 3);
4781 param1 = Math.min(param1, h / 3);
4782 const cpOffset = param1 * KAPPA;
4783 const bubbleH = h * .8; // leave some room at bottom for pointer
4784 const geo = new go.Geometry();
4785 const fig = new go.PathFigure(param1, 0, true);
4786 geo.add(fig);
4787 fig.add(new go.PathSegment(go.PathSegment.Line, w - param1, 0));
4788 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, param1, w - cpOffset, 0, w, cpOffset));
4789 fig.add(new go.PathSegment(go.PathSegment.Line, w, bubbleH - param1));
4790 fig.add(new go.PathSegment(go.PathSegment.Bezier, w - param1, bubbleH, w, bubbleH - cpOffset, w - cpOffset, bubbleH));
4791 fig.add(new go.PathSegment(go.PathSegment.Line, w * .70, bubbleH));
4792 fig.add(new go.PathSegment(go.PathSegment.Line, w * .70, h));
4793 fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, bubbleH));
4794 fig.add(new go.PathSegment(go.PathSegment.Line, param1, bubbleH));
4795 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, bubbleH - param1, cpOffset, bubbleH, 0, bubbleH - cpOffset));
4796 fig.add(new go.PathSegment(go.PathSegment.Line, 0, param1));
4797 fig.add(new go.PathSegment(go.PathSegment.Bezier, param1, 0, 0, cpOffset, cpOffset, 0).close());
4798 if (cpOffset > 1) {
4799 geo.spot1 = new go.Spot(0, 0, cpOffset, cpOffset);
4800 geo.spot2 = new go.Spot(1, .8, -cpOffset, -cpOffset);
4801 }
4802 else {
4803 geo.spot1 = go.Spot.TopLeft;
4804 geo.spot2 = new go.Spot(1, .8);
4805 }
4806 return geo;
4807});
4808go.Shape.defineFigureGenerator('Repeat', (shape, w, h) => {
4809 const geo = new go.Geometry();
4810 const fig = new go.PathFigure(w * 0, h * .45, true);
4811 geo.add(fig);
4812 fig.add(new go.PathSegment(go.PathSegment.Line, w * .25, h * 0));
4813 fig.add(new go.PathSegment(go.PathSegment.Line, w * .50, h * .45));
4814 fig.add(new go.PathSegment(go.PathSegment.Line, w * .30, h * .45));
4815 fig.add(new go.PathSegment(go.PathSegment.Line, w * .30, h * .90));
4816 fig.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * .90));
4817 fig.add(new go.PathSegment(go.PathSegment.Line, w * .65, h * 1));
4818 fig.add(new go.PathSegment(go.PathSegment.Line, w * .20, h * 1));
4819 fig.add(new go.PathSegment(go.PathSegment.Line, w * .20, h * .45).close());
4820 const fig2 = new go.PathFigure(w * 1, h * .55, true); // is filled in our not
4821 geo.add(fig2);
4822 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * 1));
4823 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .50, h * .55));
4824 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .70, h * .55));
4825 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .70, h * .10));
4826 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .40, h * .10));
4827 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .35, h * 0));
4828 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .80, h * 0));
4829 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .80, h * .55).close());
4830 return geo;
4831});
4832go.Shape.defineFigureGenerator('Windows', (shape, w, h) => {
4833 return new go.Geometry()
4834 .add(new go.PathFigure(0, 0, true)
4835 .add(new go.PathSegment(go.PathSegment.Line, w, 0))
4836 .add(new go.PathSegment(go.PathSegment.Line, w, h))
4837 .add(new go.PathSegment(go.PathSegment.Line, 0, h).close())
4838 .add(new go.PathSegment(go.PathSegment.Move, 0.4 * w, 0.4 * h))
4839 .add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0.8 * h))
4840 .add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.8 * h))
4841 .add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.4 * h).close())
4842 .add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.1 * h))
4843 .add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, 0.6 * h))
4844 .add(new go.PathSegment(go.PathSegment.Line, 0.7 * w, 0.6 * h))
4845 .add(new go.PathSegment(go.PathSegment.Line, 0.7 * w, 0.1 * h).close())
4846 .add(new go.PathSegment(go.PathSegment.Move, 0.1 * w, 0.6 * h))
4847 .add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0.9 * h))
4848 .add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.9 * h))
4849 .add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.6 * h).close()));
4850});
4851go.Shape.defineFigureGenerator('Terminal', (shape, w, h) => {
4852 const geo = new go.Geometry();
4853 const fig = new go.PathFigure(w * 0, h * .10, false);
4854 geo.add(fig);
4855 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .10));
4856 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .90));
4857 fig.add(new go.PathSegment(go.PathSegment.Line, w * 0, h * .90).close());
4858 const fig2 = new go.PathFigure(w * .10, h * .20, true); // is filled in our not
4859 geo.add(fig2);
4860 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .10, h * .25));
4861 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .22, h * .285)); // midpoint
4862 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .10, h * .32));
4863 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .10, h * .37));
4864 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .275, h * .32));
4865 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .275, h * .25).close());
4866 const fig3 = new go.PathFigure(w * .28, h * .37, true); // is filled in our not
4867 geo.add(fig3);
4868 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .45, h * .37));
4869 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .45, h * .41));
4870 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .28, h * .41).close());
4871 return geo;
4872});
4873go.Shape.defineFigureGenerator('Beaker', (shape, w, h) => {
4874 const geo = new go.Geometry();
4875 const param1 = 15;
4876 const cpOffset = param1 * KAPPA;
4877 const fig = new go.PathFigure(w * .62, h * .475, true);
4878 geo.add(fig);
4879 fig.add(new go.PathSegment(go.PathSegment.Line, w, h - param1));
4880 fig.add(new go.PathSegment(go.PathSegment.Bezier, w - param1, h, w, h - cpOffset, w - cpOffset, h));
4881 fig.add(new go.PathSegment(go.PathSegment.Line, param1, h));
4882 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, h - param1, cpOffset, h, 0, h - cpOffset));
4883 fig.add(new go.PathSegment(go.PathSegment.Line, w * .38, h * .475));
4884 fig.add(new go.PathSegment(go.PathSegment.Line, w * .38, h * .03));
4885 fig.add(new go.PathSegment(go.PathSegment.Line, w * .36, h * 0));
4886 fig.add(new go.PathSegment(go.PathSegment.Line, w * .64, h * 0));
4887 fig.add(new go.PathSegment(go.PathSegment.Line, w * .62, h * .03).close());
4888 if (cpOffset > 1) {
4889 geo.spot1 = new go.Spot(0, 0, cpOffset, cpOffset);
4890 geo.spot2 = new go.Spot(1, 1, -cpOffset, -cpOffset);
4891 }
4892 else {
4893 geo.spot1 = go.Spot.TopLeft;
4894 geo.spot2 = go.Spot.BottomRight;
4895 }
4896 return geo;
4897});
4898go.Shape.defineFigureGenerator('Download', (shape, w, h) => {
4899 const geo = new go.Geometry();
4900 const fig = new go.PathFigure(w * 0, h * 1, true);
4901 geo.add(fig);
4902 const third = .1 / .3; // just to keep values consistent
4903 // outer frame
4904 // starts bottom left
4905 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1));
4906 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * (1 - third)));
4907 fig.add(new go.PathSegment(go.PathSegment.Line, w * .8, h * 0));
4908 fig.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * 0));
4909 fig.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * .055));
4910 fig.add(new go.PathSegment(go.PathSegment.Line, w * .755, h * .055));
4911 fig.add(new go.PathSegment(go.PathSegment.Line, w * .93, h * (1 - third)));
4912 fig.add(new go.PathSegment(go.PathSegment.Line, w * .64, h * (1 - third)));
4913 fig.add(new go.PathSegment(go.PathSegment.Line, w * .61, h * .75));
4914 fig.add(new go.PathSegment(go.PathSegment.Line, w * .5, h * .75));
4915 fig.add(new go.PathSegment(go.PathSegment.Line, w * .39, h * .75));
4916 fig.add(new go.PathSegment(go.PathSegment.Line, w * .36, h * (1 - third)));
4917 fig.add(new go.PathSegment(go.PathSegment.Line, w * .07, h * (1 - third)));
4918 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .755), h * (.055)));
4919 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .66), h * (.055)));
4920 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .66), h * (0)));
4921 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .8), h * (0)));
4922 fig.add(new go.PathSegment(go.PathSegment.Line, w * 0, h * (1 - third)).close());
4923 // arrow pointing down
4924 const fig2 = new go.PathFigure(w * .40, h * 0, true);
4925 geo.add(fig2);
4926 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .40, h * .44));
4927 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .26, h * .44));
4928 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .5, h * .66));
4929 fig2.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .26), h * .44));
4930 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * .44));
4931 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * 0).close());
4932 return geo;
4933});
4934go.Shape.defineFigureGenerator('Bin', (shape, w, h) => {
4935 const geo = new go.Geometry();
4936 const fig = new go.PathFigure(w * 0, h * 1, true);
4937 geo.add(fig);
4938 const third = .1 / .3; // just to keep values consistent
4939 // outer frame
4940 // starts bottom left
4941 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1));
4942 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * (1 - third)));
4943 fig.add(new go.PathSegment(go.PathSegment.Line, w * .8, h * 0));
4944 fig.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * 0));
4945 fig.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * .055));
4946 fig.add(new go.PathSegment(go.PathSegment.Line, w * .755, h * .055));
4947 fig.add(new go.PathSegment(go.PathSegment.Line, w * .93, h * (1 - third)));
4948 fig.add(new go.PathSegment(go.PathSegment.Line, w * .64, h * (1 - third)));
4949 fig.add(new go.PathSegment(go.PathSegment.Line, w * .61, h * .75));
4950 fig.add(new go.PathSegment(go.PathSegment.Line, w * .5, h * .75));
4951 fig.add(new go.PathSegment(go.PathSegment.Line, w * .39, h * .75));
4952 fig.add(new go.PathSegment(go.PathSegment.Line, w * .36, h * (1 - third)));
4953 fig.add(new go.PathSegment(go.PathSegment.Line, w * .07, h * (1 - third)));
4954 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .755), h * (.055)));
4955 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .66), h * (.055)));
4956 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .66), h * (0)));
4957 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .8), h * (0)));
4958 fig.add(new go.PathSegment(go.PathSegment.Line, w * 0, h * (1 - third)).close());
4959 return geo;
4960});
4961go.Shape.defineFigureGenerator('Upload', (shape, w, h) => {
4962 const geo = new go.Geometry();
4963 const fig = new go.PathFigure(w * 0, h * 1, true);
4964 geo.add(fig);
4965 const third = .1 / .3; // just to keep values consistent
4966 // outer frame
4967 // starts bottom left
4968 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1));
4969 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * (1 - third)));
4970 fig.add(new go.PathSegment(go.PathSegment.Line, w * .8, h * 0));
4971 fig.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * 0));
4972 fig.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * .055));
4973 fig.add(new go.PathSegment(go.PathSegment.Line, w * .755, h * .055));
4974 fig.add(new go.PathSegment(go.PathSegment.Line, w * .93, h * (1 - third)));
4975 fig.add(new go.PathSegment(go.PathSegment.Line, w * .64, h * (1 - third)));
4976 fig.add(new go.PathSegment(go.PathSegment.Line, w * .61, h * .75));
4977 fig.add(new go.PathSegment(go.PathSegment.Line, w * .5, h * .75));
4978 fig.add(new go.PathSegment(go.PathSegment.Line, w * .39, h * .75));
4979 fig.add(new go.PathSegment(go.PathSegment.Line, w * .36, h * (1 - third)));
4980 fig.add(new go.PathSegment(go.PathSegment.Line, w * .07, h * (1 - third)));
4981 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .755), h * (.055)));
4982 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .66), h * (.055)));
4983 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .66), h * (0)));
4984 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .8), h * (0)));
4985 fig.add(new go.PathSegment(go.PathSegment.Line, w * 0, h * (1 - third)).close());
4986 const fig2 = new go.PathFigure(w * .5, h * 0, true);
4987 geo.add(fig2);
4988 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .26, h * .25));
4989 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .40, h * .25));
4990 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .40, h * .63));
4991 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * .63));
4992 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * .25));
4993 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .74, h * .25).close());
4994 return geo;
4995});
4996go.Shape.defineFigureGenerator('EmptyDrink', (shape, w, h) => {
4997 const geo = new go.Geometry();
4998 const fig = new go.PathFigure(w * .15, h * 0, false);
4999 geo.add(fig);
5000 fig.add(new go.PathSegment(go.PathSegment.Line, w * .85, h * 0));
5001 fig.add(new go.PathSegment(go.PathSegment.Line, w * .70, h * 1));
5002 fig.add(new go.PathSegment(go.PathSegment.Line, w * .30, h * 1).close());
5003 return geo;
5004});
5005go.Shape.defineFigureGenerator('Drink', (shape, w, h) => {
5006 const geo = new go.Geometry();
5007 const fig = new go.PathFigure(w * .15, h * 0, false);
5008 geo.add(fig);
5009 fig.add(new go.PathSegment(go.PathSegment.Line, w * .85, h * 0));
5010 fig.add(new go.PathSegment(go.PathSegment.Line, w * .70, h * 1));
5011 fig.add(new go.PathSegment(go.PathSegment.Line, w * .30, h * 1).close());
5012 const fig2 = new go.PathFigure(w * .235, h * .28, true);
5013 geo.add(fig2);
5014 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .765, h * .28));
5015 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .655, h * .97));
5016 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .345, h * .97).close());
5017 return geo;
5018});
5019go.Shape.defineFigureGenerator('4Arrows', (shape, w, h) => {
5020 const geo = new go.Geometry();
5021 const fig = new go.PathFigure(w * .5, h * 0, true);
5022 geo.add(fig);
5023 fig.add(new go.PathSegment(go.PathSegment.Line, w * .65, h * .25));
5024 fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, h * .25));
5025 fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, h * .45));
5026 fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * .45));
5027 fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * .35));
5028 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .5));
5029 fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * .65));
5030 fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * .55));
5031 fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, h * .55));
5032 fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, h * .75));
5033 fig.add(new go.PathSegment(go.PathSegment.Line, w * .65, h * .75));
5034 fig.add(new go.PathSegment(go.PathSegment.Line, w * .5, h * 1));
5035 fig.add(new go.PathSegment(go.PathSegment.Line, w * .35, h * .75));
5036 fig.add(new go.PathSegment(go.PathSegment.Line, w * .45, h * .75));
5037 fig.add(new go.PathSegment(go.PathSegment.Line, w * .45, h * .55));
5038 fig.add(new go.PathSegment(go.PathSegment.Line, w * .25, h * .55));
5039 fig.add(new go.PathSegment(go.PathSegment.Line, w * .25, h * .65));
5040 fig.add(new go.PathSegment(go.PathSegment.Line, w * 0, h * .5));
5041 fig.add(new go.PathSegment(go.PathSegment.Line, w * .25, h * .35));
5042 fig.add(new go.PathSegment(go.PathSegment.Line, w * .25, h * .45));
5043 fig.add(new go.PathSegment(go.PathSegment.Line, w * .45, h * .45));
5044 fig.add(new go.PathSegment(go.PathSegment.Line, w * .45, h * .25));
5045 fig.add(new go.PathSegment(go.PathSegment.Line, w * .35, h * .25).close());
5046 return geo;
5047});
5048go.Shape.defineFigureGenerator('Connector', 'Ellipse');
5049go.Shape.defineFigureGenerator('Alternative', 'TriangleUp');
5050go.Shape.defineFigureGenerator('Merge', 'TriangleUp');
5051go.Shape.defineFigureGenerator('Decision', 'Diamond');
5052go.Shape.defineFigureGenerator('DataTransmissions', 'Hexagon');
5053go.Shape.defineFigureGenerator('Gate', 'Crescent');
5054go.Shape.defineFigureGenerator('Delay', 'HalfEllipse');
5055go.Shape.defineFigureGenerator('Input', 'Parallelogram1');
5056go.Shape.defineFigureGenerator('ManualLoop', 'ManualOperation');
5057go.Shape.defineFigureGenerator('ISOProcess', 'Chevron');
5058go.Shape.defineFigureGenerator('MessageToUser', 'SquareArrow');
5059go.Shape.defineFigureGenerator('MagneticData', 'Cylinder1');
5060go.Shape.defineFigureGenerator('DirectData', 'Cylinder4');
5061go.Shape.defineFigureGenerator('StoredData', 'DataStorage');
5062go.Shape.defineFigureGenerator('SequentialData', 'MagneticTape');
5063go.Shape.defineFigureGenerator('Subroutine', 'Procedure');