How to use go method in Cypress

Best JavaScript code snippet using cypress

Figures.js

Source:Figures.js Github

copy

Full Screen

1'use strict';2/*3*  Copyright (C) 1998-2020 by Northwoods Software Corporation. All Rights Reserved.4*/5// This file holds definitions of all standard shape figures -- string values for Shape.figure.6// You do not need to load this file in order to use named Shape figure.7// The following figures are built-in to the go.js library and thus do not need to be redefined:8//   Rectangle, Square, RoundedRectangle, Border, Ellipse, Circle,9//   TriangleRight, TriangleDown, TriangleLeft, TriangleUp, Triangle,10//   LineH, LineV, None, BarH, BarV, MinusLine, PlusLine, XLine11// If you need any of the other figures that are defined in this file, we suggest that you copy12// just those definitions into your own code.  Do not load this file unless you really want to13// define a lot of code that your app does not use and will not get garbage-collected.14// The following functions and variables are used throughout this file:15/**16* @constructor17* @param {string} name18* @param {number} def19* @param {number=} min defaults to zero20* @param {number=} max defaults to Infinity21* @class22* This FigureParameter class describes various properties each parameter uses in figures.23*/24function FigureParameter(name, def, min, max) {25  if (min === undefined/*notpresent*/) min = 0.0;26  if (max === undefined/*notpresent*/) max = Infinity;27  /** @type {string} */28  this._name = name;29  /** @type {number} */30  this._defaultValue = def;31  /** @type {number} */32  this._minimum = min;33  /** @type {number} */34  this._maximum = max;35};36// Public properties37/**38* Gets or sets the name of the figure.39* @name FigureParamater#name40* @function.41* @return {string}42*/43Object.defineProperty(FigureParameter.prototype, "name", {44  get: function() { return this._name; },45  set: function(val) {46    if (typeof val !== "string" || val === "") throw new Error("Shape name must be a valid string.");47    this._name = val;48  }49});50/**51* Gets or sets the default value for the parameter.52* @name FigureParameter#defaultValue53* @function54* @return {number}55*/56Object.defineProperty(FigureParameter.prototype, "defaultValue", {57  get: function() { return this._defaultValue; },58  set: function(val) {59    if (typeof val !== "number" || isNaN(val)) throw new Error("The default value must be a real number, not: " + val);60    this._defaultValue = val;61  }62});63/**64* Gets or sets the minimum value allowed for the figure parameter.65* @name FigureParameter#minimum66* @function.67* @return {number}68*/69Object.defineProperty(FigureParameter.prototype, "minimum", {70  get: function() { return this._minimum; },71  set: function(val) {72    if (typeof val !== "number" || isNaN(val)) throw new Error("Minimum must be a real number, not: " + val);73    this._minimum = val;74  }75});76/**77* Gets or sets the maximum value allowed for the figure parameter.78* @name FigureParameter#maximum79* @function.80* @return {number}81*/82Object.defineProperty(FigureParameter.prototype, "maximum", {83  get: function() { return this._maximum; },84  set: function(val) {85    if (typeof val !== "number" || isNaN(val)) throw new Error("Maximum must be a real number, not: " + val);86    this._maximum = val;87  }88});89go.Shape._FigureParameters = {};90/*91* This static function gets a FigureParameter for a particular figure name.92* @param {String} figurename93* @param {number} index, currently must be either 0 or 194* @return {FigureParameter}95*/96go.Shape.getFigureParameter = function(figurename, index) {97  var arr = go.Shape._FigureParameters[figurename];98  if (!arr) return null;99  return /** @type {FigureParmeter} */ (arr[index]);100};101/*102* This static function sets a FigureParameter for a particular figure name.103* @param {String} figurename104* @param {number} index, currently must be either 0 or 1105* @param {FigureParameter} figparam106*/107go.Shape.setFigureParameter = function(figurename, index, figparam) {108  if (!(figparam instanceof FigureParameter)) throw new Error("Third argument to Shape.setFigureParameter is not FigureParameter: " + figparam);109  if (figparam.defaultValue < figparam.minimum || figparam.defaultValue > figparam.maximum) throw new Error("defaultValue must be between minimum and maximum, not: " + figparam.defaultValue);110  var arr = go.Shape._FigureParameters[figurename];111  if (!arr) {112    arr = [];113    go.Shape._FigureParameters[figurename] = arr;114  }115  arr[index] = figparam;116};117/** @ignore */118var _CachedPoints = [];119/**120* @ignore121* @param {number} x122* @param {number} y123* @return {Point}124*/125function tempPointAt(x, y) {126  var temp = _CachedPoints.pop();127  if (temp === undefined) return new go.Point(x, y);128  temp.x = x;129  temp.y = y;130  return temp;131};132/**133* @ignore134* @return {Point}135*/136function tempPoint() {137  var temp = _CachedPoints.pop();138  if (temp === undefined) return new go.Point();139  return temp;140};141/**142  * @ignore143  * @param {Point} temp144  */145function freePoint(temp) {146  _CachedPoints.push(temp);147};148/**149* @ignore150* @param {number} p1x151* @param {number} p1y152* @param {number} p2x153* @param {number} p2y154* @param {number} q1x155* @param {number} q1y156* @param {number} q2x157* @param {number} q2y158* @param {Point} result159* @return {Point}160*/161function getIntersection(p1x, p1y, p2x, p2y, q1x, q1y, q2x, q2y, result) {162  var dx1 = p1x - p2x;163  var dx2 = q1x - q2x;164  var x;165  var y;166  if (dx1 === 0 || dx2 === 0) {167    if (dx1 === 0) {168      var m2 = (q1y - q2y) / dx2;169      var b2 = q1y - m2 * q1x;170      x = p1x;171      y = m2 * x + b2;172    }173    else {174      var m1 = (p1y - p2y) / dx1;175      var b1 = p1y - m1 * p1x;176      x = q1x;177      y = m1 * x + b1;178    }179  }180  else {181    var m1 = (p1y - p2y) / dx1;182    var m2 = (q1y - q2y) / dx2;183    var b1 = p1y - m1 * p1x;184    var b2 = q1y - m2 * q1x;185    x = (b2 - b1) / (m1 - m2);186    y = m1 * x + b1;187  }188  result.x = x;189  result.y = y;190  return result;191};192/**193* @ignore194* @param {number} startx195* @param {number} starty196* @param {number} c1x197* @param {number} c1y198* @param {number} c2x199* @param {number} c2y200* @param {number} endx201* @param {number} endy202* @pararm {number} fraction203* @param {Point} curve1cp1  // modified result control point204* @param {Point} curve1cp2  // modified result control point205* @param {Point} midpoint  // modified result206* @param {Point} curve2cp1  // modified result control point207* @param {Point} curve2cp2  // modified result control point208*/209function breakUpBezier(startx, starty, c1x, c1y, c2x, c2y, endx, endy, fraction,210                       curve1cp1, curve1cp2, midpoint, curve2cp1, curve2cp2) {211  var fo = 1 - fraction;212  var so = fraction;213  var m1x = (startx * fo + c1x * so);214  var m1y = (starty * fo + c1y * so);215  var m2x = (c1x * fo + c2x * so);216  var m2y = (c1y * fo + c2y * so);217  var m3x = (c2x * fo + endx * so);218  var m3y = (c2y * fo + endy * so);219  var m12x = (m1x * fo + m2x * so);220  var m12y = (m1y * fo + m2y * so);221  var m23x = (m2x * fo + m3x * so);222  var m23y = (m2y * fo + m3y * so);223  var m123x = (m12x * fo + m23x * so);224  var m123y = (m12y * fo + m23y * so);225  curve1cp1.x = m1x;226  curve1cp1.y = m1y;227  curve1cp2.x = m12x;228  curve1cp2.y = m12y;229  midpoint.x = m123x;230  midpoint.y = m123y;231  curve2cp1.x = m23x;232  curve2cp1.y = m23y;233  curve2cp2.x = m3x;234  curve2cp2.y = m3y;235};236var GeneratorEllipseSpot1 = new go.Spot(0.156, 0.156);237var GeneratorEllipseSpot2 = new go.Spot(0.844, 0.844);238var KAPPA = 4 * ((Math.sqrt(2) - 1) / 3);239// PREDEFINED figures, built into the v2.0 library:240// These first few are commented out due to optimizations in the built-in definitions.241//go.Shape.defineFigureGenerator("Rectangle", function(shape, w, h) {  // predefined in 2.0242//  var geo = new go.Geometry(go.Geometry.Rectangle);243//  geo.startX = 0;244//  geo.startY = 0;245//  geo.endX = w;246//  geo.endY = h;247//  return geo;248//});249//go.Shape.defineFigureGenerator("Square", function(shape, w, h) {  // predefined in 2.0250//  var geo = new go.Geometry(go.Geometry.Rectangle);251//  geo.startX = 0;252//  geo.startY = 0;253//  geo.endX = w;254//  geo.endY = h;255//  geo.defaultStretch = go.GraphObject.Uniform;256//  return geo;257//});258go.Shape.setFigureParameter("RoundedRectangle", 0, new FigureParameter("CornerRounding", 5));259go.Shape.defineFigureGenerator("RoundedRectangle", function(shape, w, h) {  // predefined in 2.0260  var param1 = shape ? shape.parameter1 : NaN;261  if (isNaN(param1) || param1 < 0) param1 = 5;  // default corner262  param1 = Math.min(param1, w / 3);263  param1 = Math.min(param1, h / 3);264  var cpOffset = param1 * KAPPA;265  var geo = new go.Geometry()266         .add(new go.PathFigure(param1, 0, true)267              .add(new go.PathSegment(go.PathSegment.Line, w - param1, 0))268              .add(new go.PathSegment(go.PathSegment.Bezier, w, param1, w - cpOffset, 0, w, cpOffset))269              .add(new go.PathSegment(go.PathSegment.Line, w, h - param1))270              .add(new go.PathSegment(go.PathSegment.Bezier, w - param1, h, w, h - cpOffset, w - cpOffset, h))271              .add(new go.PathSegment(go.PathSegment.Line, param1, h))272              .add(new go.PathSegment(go.PathSegment.Bezier, 0, h - param1, cpOffset, h, 0, h - cpOffset))273              .add(new go.PathSegment(go.PathSegment.Line, 0, param1))274              .add(new go.PathSegment(go.PathSegment.Bezier, param1, 0, 0, cpOffset, cpOffset, 0).close()));275  if (cpOffset > 1) {276    geo.spot1 = new go.Spot(0, 0, cpOffset, cpOffset);277    geo.spot2 = new go.Spot(1, 1, -cpOffset, -cpOffset);278  }279  return geo;280});281go.Shape.defineFigureGenerator("Border", "RoundedRectangle");  // predefined in 2.0282//go.Shape.defineFigureGenerator("Ellipse", function(shape, w, h) {  // predefined in 2.0283//  var 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//  return geo;291//});292//go.Shape.defineFigureGenerator("Circle", function(shape, w, h) {  // predefined in 2.0293//  var geo = new go.Geometry(go.Geometry.Ellipse);294//  geo.startX = 0;295//  geo.startY = 0;296//  geo.endX = w;297//  geo.endY = h;298//  geo.spot1 = GeneratorEllipseSpot1;299//  geo.spot2 = GeneratorEllipseSpot2;300//  geo.defaultStretch = go.GraphObject.Uniform;301//  return geo;302//});303go.Shape.defineFigureGenerator("TriangleRight", function(shape, w, h) {  // predefined in 2.0304  return new go.Geometry()305         .add(new go.PathFigure(0, 0)306              .add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h))307              .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()))308         .setSpots(0, 0.25, 0.5, 0.75);309});310go.Shape.defineFigureGenerator("TriangleDown", function(shape, w, h) {  // predefined in 2.0311  return new go.Geometry()312         .add(new go.PathFigure(0, 0)313              .add(new go.PathSegment(go.PathSegment.Line, w, 0))314              .add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h).close()))315         .setSpots(0.25, 0, 0.75, 0.5);316});317go.Shape.defineFigureGenerator("TriangleLeft", function(shape, w, h) {  // predefined in 2.0318  return new go.Geometry()319         .add(new go.PathFigure(w, h)320              .add(new go.PathSegment(go.PathSegment.Line, 0, 0.5 * h))321              .add(new go.PathSegment(go.PathSegment.Line, w, 0).close()))322         .setSpots(0.5, 0.25, 1, 0.75);323});324go.Shape.defineFigureGenerator("TriangleUp", function(shape, w, h) {  // predefined in 2.0325  return new go.Geometry()326         .add(new go.PathFigure(w, h)327              .add(new go.PathSegment(go.PathSegment.Line, 0, h))328              .add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0).close()))329         .setSpots(0.25, 0.5, 0.75, 1);330});331go.Shape.defineFigureGenerator("Triangle", "TriangleUp");  // predefined in 2.0332go.Shape.defineFigureGenerator("Diamond", function(shape, w, h) {  // predefined in 2.0333  return new go.Geometry()334         .add(new go.PathFigure(0.5 * w, 0)335              .add(new go.PathSegment(go.PathSegment.Line, 0, 0.5 * h))336              .add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h))337              .add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h).close()))338         .setSpots(0.25, 0.25, 0.75, 0.75);339});340go.Shape.defineFigureGenerator("LineH", function(shape, w, h) {  // predefined in 2.0341  var geo = new go.Geometry(go.Geometry.Line);342  geo.startX = 0;343  geo.startY = h / 2;344  geo.endX = w;345  geo.endY = h / 2;346  return geo;347});348go.Shape.defineFigureGenerator("LineV", function(shape, w, h) {  // predefined in 2.0349  var geo = new go.Geometry(go.Geometry.Line);350  geo.startX = w / 2;351  geo.startY = 0;352  geo.endX = w / 2;353  geo.endY = h;354  return geo;355});356go.Shape.defineFigureGenerator("BarH", "Rectangle");  // predefined in 2.0357go.Shape.defineFigureGenerator("BarV", "Rectangle");  // predefined in 2.0358go.Shape.defineFigureGenerator("MinusLine", "LineH");  // predefined in 2.0359go.Shape.defineFigureGenerator("PlusLine", function(shape, w, h) {  // predefined in 2.0360  return new go.Geometry()361         .add(new go.PathFigure(0, h/2, false)362              .add(new go.PathSegment(go.PathSegment.Line, w, h/2))363              .add(new go.PathSegment(go.PathSegment.Move, w/2, 0))364              .add(new go.PathSegment(go.PathSegment.Line, w/2, h)));365});366go.Shape.defineFigureGenerator("XLine", function(shape, w, h) {  // predefined in 2.0367  return new go.Geometry()368         .add(new go.PathFigure(0, h, false)369              .add(new go.PathSegment(go.PathSegment.Line, w, 0))370              .add(new go.PathSegment(go.PathSegment.Move, 0, 0))371              .add(new go.PathSegment(go.PathSegment.Line, w, h)));372});373// OPTIONAL figures, not predefined in the v2.0 library:374go.Shape.defineFigureGenerator("AsteriskLine", function(shape, w, h) {375  var offset = .2 / Math.SQRT2;376  return new go.Geometry()377         .add(new go.PathFigure(offset * w, (1 - offset) * h, false)378              .add(new go.PathSegment(go.PathSegment.Line, (1 - offset) * w, offset * h))379              .add(new go.PathSegment(go.PathSegment.Move, offset * w, offset * h))380              .add(new go.PathSegment(go.PathSegment.Line, (1 - offset) * w, (1 - offset) * h))381              .add(new go.PathSegment(go.PathSegment.Move, 0, h / 2))382              .add(new go.PathSegment(go.PathSegment.Line, w, h / 2))383              .add(new go.PathSegment(go.PathSegment.Move, w / 2, 0))384              .add(new go.PathSegment(go.PathSegment.Line, w / 2, h)));385});386go.Shape.defineFigureGenerator("CircleLine", function(shape, w, h) {387  var rad = w/2;388  var geo = new go.Geometry()389         .add(new go.PathFigure(w, w / 2, false)  // clockwise390              .add(new go.PathSegment(go.PathSegment.Arc, 0, 360, rad, rad, rad, rad).close()));391  geo.spot1 = GeneratorEllipseSpot1;392  geo.spot2 = GeneratorEllipseSpot2;393  geo.defaultStretch = go.GraphObject.Uniform;394  return geo;395});396go.Shape.defineFigureGenerator("Line1", function(shape, w, h) {397  var geo = new go.Geometry(go.Geometry.Line);398  geo.startX = 0;399  geo.startY = 0;400  geo.endX = w;401  geo.endY = h;402  return geo;403});404go.Shape.defineFigureGenerator("Line2", function(shape, w, h) {405  var geo = new go.Geometry(go.Geometry.Line);406  geo.startX = w;407  geo.startY = 0;408  geo.endX = 0;409  geo.endY = h;410  return geo;411});412go.Shape.defineFigureGenerator("Curve1", function(shape, w, h) {413  return new go.Geometry()414         .add(new go.PathFigure(0, 0, false)415              .add(new go.PathSegment(go.PathSegment.Bezier, w, h, KAPPA * w, 0, w, (1 - KAPPA) * h)));416});417go.Shape.defineFigureGenerator("Curve2", function(shape, w, h) {418  return new go.Geometry()419         .add(new go.PathFigure(0, 0, false)420              .add(new go.PathSegment(go.PathSegment.Bezier, w, h, 0, KAPPA * h, (1 - KAPPA) * w, h)));421});422go.Shape.defineFigureGenerator("Curve3", function(shape, w, h) {423  return new go.Geometry()424         .add(new go.PathFigure(w, 0, false)425              .add(new go.PathSegment(go.PathSegment.Bezier, 0, h, w, KAPPA * h, KAPPA * w, h)));426});427go.Shape.defineFigureGenerator("Curve4", function(shape, w, h) {428  return new go.Geometry()429         .add(new go.PathFigure(w, 0, false)430              .add(new go.PathSegment(go.PathSegment.Bezier, 0, h, (1 - KAPPA) * w, 0, 0, (1 - KAPPA) * h)));431});432go.Shape.defineFigureGenerator("TriangleDownLeft", function(shape, w, h) {433  return new go.Geometry()434         .add(new go.PathFigure(0, 0, true)435              .add(new go.PathSegment(go.PathSegment.Line, w, h))436              .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()))437         .setSpots(0, 0.5, 0.5, 1);438});439go.Shape.defineFigureGenerator("TriangleDownRight", function(shape, w, h) {440  return new go.Geometry()441         .add(new go.PathFigure(w, 0, true)442              .add(new go.PathSegment(go.PathSegment.Line, w, h))443              .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()))444         .setSpots(0.5, 0.5, 1, 1);445});446go.Shape.defineFigureGenerator("TriangleUpLeft", function(shape, w, h) {447  return new go.Geometry()448         .add(new go.PathFigure(0, 0, true)449              .add(new go.PathSegment(go.PathSegment.Line, w, 0))450              .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()))451         .setSpots(0, 0, 0.5, 0.5);452});453go.Shape.defineFigureGenerator("TriangleUpRight", function(shape, w, h) {454  return new go.Geometry()455         .add(new go.PathFigure(0, 0, true)456              .add(new go.PathSegment(go.PathSegment.Line, w, 0))457              .add(new go.PathSegment(go.PathSegment.Line, w, h).close()))458         .setSpots(0.5, 0, 1, 0.5);459});460go.Shape.defineFigureGenerator("RightTriangle", "TriangleDownLeft");461go.Shape.setFigureParameter("Parallelogram1", 0, new FigureParameter("Indent", .1, -.99, .99));462go.Shape.defineFigureGenerator("Parallelogram1", function(shape, w, h) {463  var param1 = shape ? shape.parameter1 : NaN; // indent's percent distance464  if (isNaN(param1)) param1 = 0.1;465  else if (param1 < -1) param1 = -1;466  else if (param1 > 1) param1 = 1;467  var indent = Math.abs(param1) * w;468  if (param1 === 0) {469    var geo = new go.Geometry(go.Geometry.Rectangle);470    geo.startX = 0;471    geo.startY = 0;472    geo.endX = w;473    geo.endY = h;474    return geo;475  } else {476    var geo = new go.Geometry();477    if (param1 > 0) {478      geo.add(new go.PathFigure(indent, 0)479                  .add(new go.PathSegment(go.PathSegment.Line, w, 0))480                  .add(new go.PathSegment(go.PathSegment.Line, w - indent, h))481                  .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()));482    } else {  // param1 < 0483      geo.add(new go.PathFigure(0, 0)484                  .add(new go.PathSegment(go.PathSegment.Line, w - indent, 0))485                  .add(new go.PathSegment(go.PathSegment.Line, w, h))486                  .add(new go.PathSegment(go.PathSegment.Line, indent, h).close()));487    }488    if (indent < w / 2) {489      geo.setSpots(indent / w, 0, (w - indent) / w, 1);490    }491    return geo;492  }493});494go.Shape.defineFigureGenerator("Parallelogram", "Parallelogram1"); // alias495// Parallelogram with absolutes instead of scaling496go.Shape.setFigureParameter("Parallelogram2", 0, new FigureParameter("Indent", 10, -Infinity, Infinity));497go.Shape.defineFigureGenerator("Parallelogram2", function(shape, w, h) {498  var param1 = shape ? shape.parameter1 : NaN; // indent's x distance499  if (isNaN(param1)) param1 = 10;500  else if (param1 < -w) param1 = -w;501  else if (param1 > w) param1 = w;502  var indent = Math.abs(param1);503  if (param1 === 0) {504    var geo = new go.Geometry(go.Geometry.Rectangle);505    geo.startX = 0;506    geo.startY = 0;507    geo.endX = w;508    geo.endY = h;509    return geo;510  } else {511    var geo = new go.Geometry();512    if (param1 > 0) {513      geo.add(new go.PathFigure(indent, 0)514                  .add(new go.PathSegment(go.PathSegment.Line, w, 0))515                  .add(new go.PathSegment(go.PathSegment.Line, w - indent, h))516                  .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()));517    } else {  // param1 < 0518      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});529go.Shape.setFigureParameter("Trapezoid1", 0, new FigureParameter("Indent", .2, -.99, .99));530go.Shape.defineFigureGenerator("Trapezoid1", function(shape, w, h) {531  var param1 = shape ? shape.parameter1 : NaN; // indent's percent distance532  if (isNaN(param1)) param1 = 0.2;533  else if (param1 < 0.5) param1 = -0.5;534  else if (param1 > 0.5) param1 = 0.5;535  var indent = Math.abs(param1) * w;536  if (param1 === 0) {537    var geo = new go.Geometry(go.Geometry.Rectangle);538    geo.startX = 0;539    geo.startY = 0;540    geo.endX = w;541    geo.endY = h;542    return geo;543  } else {544    var geo = new go.Geometry();545    if (param1 > 0) {546      geo.add(new go.PathFigure(indent, 0)547                  .add(new go.PathSegment(go.PathSegment.Line, w - indent, 0))548                  .add(new go.PathSegment(go.PathSegment.Line, w, h))549                  .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()));550    } else {  // param1 < 0551      geo.add(new go.PathFigure(0, 0)552                  .add(new go.PathSegment(go.PathSegment.Line, w, 0))553                  .add(new go.PathSegment(go.PathSegment.Line, w - indent, h))554                  .add(new go.PathSegment(go.PathSegment.Line, indent, h).close()));555    }556    if (indent < w / 2) {557      geo.setSpots(indent / w, 0, (w - indent) / w, 1);558    }559    return geo;560  }561});562go.Shape.defineFigureGenerator("Trapezoid", "Trapezoid1"); // alias563// Trapezoid with absolutes instead of scaling564go.Shape.setFigureParameter("Trapezoid2", 0, new FigureParameter("Indent", 20, -Infinity, Infinity));565go.Shape.defineFigureGenerator("Trapezoid2", function(shape, w, h) {566  var param1 = shape ? shape.parameter1 : NaN; // indent's x distance567  if (isNaN(param1)) param1 = 20; // default value568  else if (param1 < -w) param1 = -w / 2;569  else if (param1 > w) param1 = w / 2;570  var indent = Math.abs(param1);571  if (param1 === 0) {572    var geo = new go.Geometry(go.Geometry.Rectangle);573    geo.startX = 0;574    geo.startY = 0;575    geo.endX = w;576    geo.endY = h;577    return geo;578  } else {579    var geo = new go.Geometry();580    if (param1 > 0) {581      geo.add(new go.PathFigure(indent, 0)582                  .add(new go.PathSegment(go.PathSegment.Line, w - indent, 0))583                  .add(new go.PathSegment(go.PathSegment.Line, w, h))584                  .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()));585    } else {  // param1 < 0586      geo.add(new go.PathFigure(0, 0)587                  .add(new go.PathSegment(go.PathSegment.Line, w, 0))588                  .add(new go.PathSegment(go.PathSegment.Line, w - indent, h))589                  .add(new go.PathSegment(go.PathSegment.Line, indent, h).close()));590    }591    if (indent < w / 2) {592      geo.setSpots(indent / w, 0, (w - indent) / w, 1);593    }594    return geo;595  }596});597go.Shape.setFigureParameter("ManualOperation", 0, new FigureParameter("Indent", 10, -Infinity, Infinity));598go.Shape.defineFigureGenerator("ManualOperation", function(shape, w, h) {599  var param1 = shape ? shape.parameter1 : NaN;600  // Distance from topleft of bounding rectangle,601  // in % of the total width, of the topleft corner602  if (isNaN(param1)) param1 = 10; // default value603  else if (param1 < -w) param1 = -w / 2;604  else if (param1 > w) param1 = w / 2;605  var indent = Math.abs(param1);606  if (param1 === 0) {607    var geo = new go.Geometry(go.Geometry.Rectangle);608    geo.startX = 0;609    geo.startY = 0;610    geo.endX = w;611    geo.endY = h;612    return geo;613  } else {614    var geo = new go.Geometry();615    if (param1 > 0) {616      geo.add(new go.PathFigure(0, 0)617                  .add(new go.PathSegment(go.PathSegment.Line, w, 0))618                  .add(new go.PathSegment(go.PathSegment.Line, w - indent, h))619                  .add(new go.PathSegment(go.PathSegment.Line, indent, h).close()));620    } else {  // param1 < 0621      geo.add(new go.PathFigure(indent, 0)622                  .add(new go.PathSegment(go.PathSegment.Line, w - indent, 0))623                  .add(new go.PathSegment(go.PathSegment.Line, w, h))624                  .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()));625    }626    if (indent < w / 2) {627      geo.setSpots(indent / w, 0, (w - indent) / w, 1);628    }629    return geo;630  }631});632// The following functions are used by a group of regular figures that are defined below:633/** @ignore */634var _CachedArrays = [];635/**636  * @ignore637  * @return {Array}638  */639function tempArray() {640  var temp = _CachedArrays.pop();641  if (temp === undefined) return [];642  return temp;643};644/**645  * @ignore646  * @param {Array} a647  */648function freeArray(a) {649  a.length = 0;  // clear any references to objects650  _CachedArrays.push(a);651};652/**653* @ignore654* This allocates a temporary Array that should be freeArray()'ed by the caller.655* @param {number} sides656* @return {Array}657*/658function createPolygon(sides) {659  // Point[] points = new Point[sides + 1];660  var points = tempArray();661  var radius = .5;662  var center = .5;663  var offsetAngle = Math.PI * 1.5;664  var angle = 0;665  // Loop through each side of the polygon666  for (var i = 0; i < sides; i++) {667    angle = 2 * Math.PI / sides * i + offsetAngle;668    points[i] = new go.Point((center + radius * Math.cos(angle)), (center + radius * Math.sin(angle)));669  }670  // Add the last line671  // points[points.length - 1] = points[0];672  points.push(points[0]);673  return points;674};675/**676* @ignore677* This allocates a temporary Array that should be freeArray()'ed by the caller.678* @param {number} points679* @return {Array}680*/681function createBurst(points) {682  var star = createStar(points);683  var pts = tempArray(); // new Point[points * 3 + 1];684  pts[0] = star[0];685  for (var i = 1, count = 1; i < star.length; i += 2, count += 3) {686    pts[count] = star[i];687    pts[count + 1] = star[i];688    pts[count + 2] = star[i + 1];689  }690  freeArray(star);691  return pts;692};693/**694* @ignore695* This allocates a temporary Array that should be freeArray()'ed by the caller.696* @param {number} points697* @return {Array}698*/699function createStar(points) {700  // First, create a regular polygon701  var polygon = createPolygon(points);702  // Calculate the points inbetween703  var pts = tempArray(); // new Point[points * 2 + 1];704  var half = Math.floor(polygon.length / 2);705  var count = polygon.length - 1;706  var offset = (points % 2 === 0) ? 2 : 1;707  for (var i = 0; i < count; i++) {708    // Get the intersection of two lines709    var p0 = polygon[i];710    var p1 = polygon[i + 1];711    var q21 = polygon[(half + i - 1) % count];712    var q2off = polygon[(half + i + offset) % count];713    pts[i * 2] = p0;714    pts[i * 2 + 1] = getIntersection(p0.x, p0.y,715      q21.x, q21.y,716      p1.x, p1.y,717      q2off.x, q2off.y, new go.Point());  // ?? not currently managed718  }719  pts[pts.length] = pts[0];720  freeArray(polygon);721  return pts;722};723go.Shape.defineFigureGenerator("Pentagon", function(shape, w, h) {724  var points = createPolygon(5);725  var geo = new go.Geometry();726  var fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);727  geo.add(fig);728  for (var i = 1; i < 5; i++) {729    fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));730  }731  fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());732  freeArray(points);733  geo.spot1 = new go.Spot(.2, .22);734  geo.spot2 = new go.Spot(.8, .9);735  return geo;736});737go.Shape.defineFigureGenerator("Hexagon", function(shape, w, h) {738  var points = createPolygon(6);739  var geo = new go.Geometry();740  var fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);741  geo.add(fig);742  for (var i = 1; i < 6; i++) {743    fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));744  }745  fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());746  freeArray(points);747  geo.spot1 = new go.Spot(.07, .25);748  geo.spot2 = new go.Spot(.93, .75);749  return geo;750});751go.Shape.defineFigureGenerator("Heptagon", function(shape, w, h) {752  var points = createPolygon(7);753  var geo = new go.Geometry();754  var fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);755  geo.add(fig);756  for (var i = 1; i < 7; i++) {757    fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));758  }759  fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());760  freeArray(points);761  geo.spot1 = new go.Spot(.2, .15);762  geo.spot2 = new go.Spot(.8, .85);763  return geo;764});765go.Shape.defineFigureGenerator("Octagon", function(shape, w, h) {766  var points = createPolygon(8);767  var geo = new go.Geometry();768  var fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);769  geo.add(fig);770  for (var i = 1; i < 8; i++) {771    fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));772  }773  fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());774  freeArray(points);775  geo.spot1 = new go.Spot(.15, .15);776  geo.spot2 = new go.Spot(.85, .85);777  return geo;778});779go.Shape.defineFigureGenerator("Nonagon", function(shape, w, h) {780  var points = createPolygon(9);781  var geo = new go.Geometry();782  var fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);783  geo.add(fig);784  for (var i = 1; i < 9; i++) {785    fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));786  }787  fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());788  freeArray(points);789  geo.spot1 = new go.Spot(.17, .13);790  geo.spot2 = new go.Spot(.82, .82);791  return geo;792});793go.Shape.defineFigureGenerator("Decagon", function(shape, w, h) {794  var points = createPolygon(10);795  var geo = new go.Geometry();796  var fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);797  geo.add(fig);798  for (var i = 1; i < 10; i++) {799    fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));800  }801  fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());802  freeArray(points);803  geo.spot1 = new go.Spot(.16, .16);804  geo.spot2 = new go.Spot(.84, .84);805  return geo;806});807go.Shape.defineFigureGenerator("Dodecagon", function(shape, w, h) {808  var points = createPolygon(12);809  var geo = new go.Geometry();810  var fig = new go.PathFigure(points[0].x * w, points[0].y * h, true);811  geo.add(fig);812  for (var i = 1; i < 12; i++) {813    fig.add(new go.PathSegment(go.PathSegment.Line, points[i].x * w, points[i].y * h));814  }815  fig.add(new go.PathSegment(go.PathSegment.Line, points[0].x * w, points[0].y * h).close());816  freeArray(points);817  geo.spot1 = new go.Spot(.16, .16);818  geo.spot2 = new go.Spot(.84, .84);819  return geo;820});821go.Shape.defineFigureGenerator("FivePointedStar", function(shape, w, h) {822  var starPoints = createStar(5);823  var geo = new go.Geometry();824  var fig = new go.PathFigure(starPoints[0].x * w, starPoints[0].y * h, true);825  geo.add(fig);826  for (var i = 1; i < 10; i++) {827    fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[i].x * w, starPoints[i].y * h));828  }829  fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[0].x * w, starPoints[0].y * h).close());830  freeArray(starPoints);831  geo.spot1 = new go.Spot(.266, .333);832  geo.spot2 = new go.Spot(.733, .733);833  return geo;834});835go.Shape.defineFigureGenerator("SixPointedStar", function(shape, w, h) {836  var starPoints = createStar(6);837  var geo = new go.Geometry();838  var fig = new go.PathFigure(starPoints[0].x * w, starPoints[0].y * h, true);839  geo.add(fig);840  for (var i = 1; i < 12; i++) {841    fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[i].x * w, starPoints[i].y * h));842  }843  fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[0].x * w, starPoints[0].y * h).close());844  freeArray(starPoints);845  geo.spot1 = new go.Spot(.17, .25);846  geo.spot2 = new go.Spot(.83, .75);847  return geo;848});849go.Shape.defineFigureGenerator("SevenPointedStar", function(shape, w, h) {850  var starPoints = createStar(7);851  var geo = new go.Geometry();852  var fig = new go.PathFigure(starPoints[0].x * w, starPoints[0].y * h, true);853  geo.add(fig);854  for (var i = 1; i < 14; i++) {855    fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[i].x * w, starPoints[i].y * h));856  }857  fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[0].x * w, starPoints[0].y * h).close());858  freeArray(starPoints);859  geo.spot1 = new go.Spot(.222, .277);860  geo.spot2 = new go.Spot(.777, .666);861  return geo;862});863go.Shape.defineFigureGenerator("EightPointedStar", function(shape, w, h) {864  var starPoints = createStar(8);865  var geo = new go.Geometry();866  var fig = new go.PathFigure(starPoints[0].x * w, starPoints[0].y * h, true);867  geo.add(fig);868  for (var i = 1; i < 16; i++) {869    fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[i].x * w, starPoints[i].y * h));870  }871  fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[0].x * w, starPoints[0].y * h).close());872  freeArray(starPoints);873  geo.spot1 = new go.Spot(.25, .25);874  geo.spot2 = new go.Spot(.75, .75);875  return geo;876});877go.Shape.defineFigureGenerator("NinePointedStar", function(shape, w, h) {878  var starPoints = createStar(9);879  var geo = new go.Geometry();880  var fig = new go.PathFigure(starPoints[0].x * w, starPoints[0].y * h, true);881  geo.add(fig);882  for (var i = 1; i < 18; i++) {883    fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[i].x * w, starPoints[i].y * h));884  }885  fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[0].x * w, starPoints[0].y * h).close());886  freeArray(starPoints);887  geo.spot1 = new go.Spot(.222, .277);888  geo.spot2 = new go.Spot(.777, .666);889  return geo;890});891go.Shape.defineFigureGenerator("TenPointedStar", function(shape, w, h) {892  var starPoints = createStar(10);893  var geo = new go.Geometry();894  var fig = new go.PathFigure(starPoints[0].x * w, starPoints[0].y * h, true);895  geo.add(fig);896  for (var i = 1; i < 20; i++) {897    fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[i].x * w, starPoints[i].y * h));898  }899  fig.add(new go.PathSegment(go.PathSegment.Line, starPoints[0].x * w, starPoints[0].y * h).close());900  freeArray(starPoints);901  geo.spot1 = new go.Spot(.281, .261);902  geo.spot2 = new go.Spot(.723, .748);903  return geo;904});905go.Shape.defineFigureGenerator("FivePointedBurst", function(shape, w, h) {906  var burstPoints = createBurst(5);907  var geo = new go.Geometry();908  var fig = new go.PathFigure(burstPoints[0].x * w, burstPoints[0].y * h, true);909  geo.add(fig);910  for (var i = 1; i < burstPoints.length; i += 3) {911    fig.add(new go.PathSegment(go.PathSegment.Bezier, burstPoints[i + 2].x * w,912      burstPoints[i + 2].y * h, burstPoints[i].x * w,913      burstPoints[i].y * h, burstPoints[i + 1].x * w,914      burstPoints[i + 1].y * h));915  }916  fig.segments.last().close();917  freeArray(burstPoints);918  geo.spot1 = new go.Spot(.222, .277);919  geo.spot2 = new go.Spot(.777, .777);920  return geo;921});922go.Shape.defineFigureGenerator("SixPointedBurst", function(shape, w, h) {923  var burstPoints = createBurst(6);924  var geo = new go.Geometry();925  var fig = new go.PathFigure(burstPoints[0].x * w, burstPoints[0].y * h, true);926  geo.add(fig);927  for (var i = 1; i < burstPoints.length; i += 3) {928    fig.add(new go.PathSegment(go.PathSegment.Bezier, burstPoints[i + 2].x * w,929      burstPoints[i + 2].y * h, burstPoints[i].x * w,930      burstPoints[i].y * h, burstPoints[i + 1].x * w,931      burstPoints[i + 1].y * h));932  }933  fig.segments.last().close();934  freeArray(burstPoints);935  geo.spot1 = new go.Spot(.170, .222);936  geo.spot2 = new go.Spot(.833, .777);937  return geo;938});939go.Shape.defineFigureGenerator("SevenPointedBurst", function(shape, w, h) {940  var burstPoints = createBurst(7);941  var geo = new go.Geometry();942  var fig = new go.PathFigure(burstPoints[0].x * w, burstPoints[0].y * h, true);943  geo.add(fig);944  for (var i = 1; i < burstPoints.length; i += 3) {945    fig.add(new go.PathSegment(go.PathSegment.Bezier, burstPoints[i + 2].x * w,946      burstPoints[i + 2].y * h, burstPoints[i].x * w,947      burstPoints[i].y * h, burstPoints[i + 1].x * w,948      burstPoints[i + 1].y * h));949  }950  fig.segments.last().close();951  freeArray(burstPoints);952  geo.spot1 = new go.Spot(.222, .222);953  geo.spot2 = new go.Spot(.777, .777);954  return geo;955});956go.Shape.defineFigureGenerator("EightPointedBurst", function(shape, w, h) {957  var burstPoints = createBurst(8);958  var geo = new go.Geometry();959  var fig = new go.PathFigure(burstPoints[0].x * w, burstPoints[0].y * h, true);960  geo.add(fig);961  for (var i = 1; i < burstPoints.length; i += 3) {962    fig.add(new go.PathSegment(go.PathSegment.Bezier, burstPoints[i + 2].x * w,963      burstPoints[i + 2].y * h, burstPoints[i].x * w,964      burstPoints[i].y * h, burstPoints[i + 1].x * w,965      burstPoints[i + 1].y * h));966  }967  fig.segments.last().close();968  freeArray(burstPoints);969  geo.spot1 = new go.Spot(.222, .222);970  geo.spot2 = new go.Spot(.777, .777);971  return geo;972});973go.Shape.defineFigureGenerator("NinePointedBurst", function(shape, w, h) {974  var burstPoints = createBurst(9);975  var geo = new go.Geometry();976  var fig = new go.PathFigure(burstPoints[0].x * w, burstPoints[0].y * h, true);977  geo.add(fig);978  for (var i = 1; i < burstPoints.length; i += 3) {979    fig.add(new go.PathSegment(go.PathSegment.Bezier, burstPoints[i + 2].x * w,980      burstPoints[i + 2].y * h, burstPoints[i].x * w,981      burstPoints[i].y * h, burstPoints[i + 1].x * w,982      burstPoints[i + 1].y * h));983  }984  fig.segments.last().close();985  freeArray(burstPoints);986  geo.spot1 = new go.Spot(.222, .222);987  geo.spot2 = new go.Spot(.777, .777);988  return geo;989});990go.Shape.defineFigureGenerator("TenPointedBurst", function(shape, w, h) {991  var burstPoints = createBurst(10);992  var geo = new go.Geometry();993  var fig = new go.PathFigure(burstPoints[0].x * w, burstPoints[0].y * h, true);994  geo.add(fig);995  for (var i = 1; i < burstPoints.length; i += 3) {996    fig.add(new go.PathSegment(go.PathSegment.Bezier, burstPoints[i + 2].x * w,997      burstPoints[i + 2].y * h, burstPoints[i].x * w,998      burstPoints[i].y * h, burstPoints[i + 1].x * w,999      burstPoints[i + 1].y * h));1000  }1001  fig.segments.last().close();1002  freeArray(burstPoints);1003  geo.spot1 = new go.Spot(.222, .222);1004  geo.spot2 = new go.Spot(.777, .777);1005  return geo;1006});1007go.Shape.setFigureParameter("FramedRectangle", 0, new FigureParameter("ThicknessX", 8));1008go.Shape.setFigureParameter("FramedRectangle", 1, new FigureParameter("ThicknessY", 8));1009go.Shape.defineFigureGenerator("FramedRectangle", function(shape, w, h) {1010  var param1 = shape ? shape.parameter1 : NaN;1011  var param2 = shape ? shape.parameter2 : NaN;1012  if (isNaN(param1)) param1 = 8; // default values PARAMETER 1 is for WIDTH1013  if (isNaN(param2)) param2 = 8; // default values PARAMETER 2 is for HEIGHT1014  var geo = new go.Geometry();1015  var fig = new go.PathFigure(0, 0, true);1016  geo.add(fig);1017  // outer rectangle, clockwise1018  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));1019  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));1020  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());1021  if (param1 < w/2 && param2 < h/2) {1022    // inner rectangle, counter-clockwise1023    fig.add(new go.PathSegment(go.PathSegment.Move, param1, param2));  // subpath1024    fig.add(new go.PathSegment(go.PathSegment.Line, param1, h - param2));1025    fig.add(new go.PathSegment(go.PathSegment.Line, w - param1, h - param2));1026    fig.add(new go.PathSegment(go.PathSegment.Line, w - param1, param2).close());1027  }1028  geo.setSpots(0, 0, 1, 1, param1, param2, -param1, -param2);1029  return geo;1030});1031go.Shape.setFigureParameter("Ring", 0, new FigureParameter("Thickness", 8));1032go.Shape.defineFigureGenerator("Ring", function(shape, w, h) {1033  var param1 = shape ? shape.parameter1 : NaN;1034  if (isNaN(param1) || param1 < 0) param1 = 8;1035  var rad = w / 2;1036  var geo = new go.Geometry();1037  var fig = new go.PathFigure(w, w / 2, true);  // clockwise1038  geo.add(fig);1039  fig.add(new go.PathSegment(go.PathSegment.Arc, 0, 360, rad, rad, rad, rad).close());1040  var rad2 = Math.max(rad - param1, 0);1041  if (rad2 > 0) {  // counter-clockwise1042    fig.add(new go.PathSegment(go.PathSegment.Move, w / 2 + rad2, w / 2))1043    fig.add(new go.PathSegment(go.PathSegment.Arc, 0, -360, rad, rad, rad2, rad2).close());1044  }1045  geo.spot1 = GeneratorEllipseSpot1;1046  geo.spot2 = GeneratorEllipseSpot2;1047  geo.defaultStretch = go.GraphObject.Uniform;1048  return geo;1049});1050go.Shape.defineFigureGenerator("Cloud", function(shape, w, h) {1051  return new go.Geometry()1052         .add(new go.PathFigure(.08034461 * w, .1944299 * h, true)1053              .add(new go.PathSegment(go.PathSegment.Bezier,1054                                      .2008615 * w, .05349299 * h, -.09239631 * w, .07836421 * h, .1406031 * w, -.0542823 * h))1055              .add(new go.PathSegment(go.PathSegment.Bezier,1056                                      .4338609 * w, .074219 * h, .2450511 * w, -.00697547 * h, .3776197 * w, -.01112067 * h))1057              .add(new go.PathSegment(go.PathSegment.Bezier,1058                                      .6558228 * w, .07004196 * h, .4539471 * w, 0, .6066018 * w, -.02526587 * h))1059              .add(new go.PathSegment(go.PathSegment.Bezier,1060                                      .8921095 * w, .08370865 * h, .6914277 * w, -.01904177 * h, .8921095 * w, -.01220843 * h))1061              .add(new go.PathSegment(go.PathSegment.Bezier,1062                                      .9147671 * w, .3194596 * h, 1.036446 * w, .04105738 * h, 1.020377 * w, .3022052 * h))1063              .add(new go.PathSegment(go.PathSegment.Bezier,1064                                      .9082935 * w, .562044 * h, 1.04448 * w, .360238 * h, .992256 * w, .5219009 * h))1065              .add(new go.PathSegment(go.PathSegment.Bezier,1066                                      .9212406 * w, .8217117 * h, 1.032337 * w, .5771781 * h, 1.018411 * w, .8120651 * h))1067              .add(new go.PathSegment(go.PathSegment.Bezier,1068                                      .7592566 * w, .9156953 * h, 1.028411 * w, .9571472 * h, .8556702 * w, 1.052487 * h))1069              .add(new go.PathSegment(go.PathSegment.Bezier,1070                                      .5101666 * w, .9310455 * h, .7431877 * w, 1.009325 * h, .5624123 * w, 1.021761 * h))1071              .add(new go.PathSegment(go.PathSegment.Bezier,1072                                      .2609328 * w, .9344623 * h, .4820677 * w, 1.031761 * h, .3030112 * w, 1.002796 * h))1073              .add(new go.PathSegment(go.PathSegment.Bezier,1074                                      .08034461 * w, .870098 * h, .2329994 * w, 1.01518 * h, .03213784 * w, 1.01518 * h))1075              .add(new go.PathSegment(go.PathSegment.Bezier,1076                                      .06829292 * w, .6545475 * h, -.02812061 * w, .9032597 * h, -.01205169 * w, .6835638 * h))1077              .add(new go.PathSegment(go.PathSegment.Bezier,1078                                      .06427569 * w, .4265613 * h, -.01812061 * w, .6089503 * h, -.00606892 * w, .4555777 * h))1079              .add(new go.PathSegment(go.PathSegment.Bezier,1080                                      .08034461 * w, .1944299 * h, -.01606892 * w, .3892545 * h, -.01205169 * w, .1944299 * h)))1081         .setSpots(.1, .1, .9, .9);1082});1083go.Shape.defineFigureGenerator("StopSign", function(shape, w, h) {1084  var part = 1 / (Math.SQRT2 + 2);1085  return new go.Geometry()1086         .add(new go.PathFigure(part * w, 0, true)1087              .add(new go.PathSegment(go.PathSegment.Line, (1 - part) * w, 0))1088              .add(new go.PathSegment(go.PathSegment.Line, w, part * h))1089              .add(new go.PathSegment(go.PathSegment.Line, w, (1 - part) * h))1090              .add(new go.PathSegment(go.PathSegment.Line, (1 - part) * w, h))1091              .add(new go.PathSegment(go.PathSegment.Line, part * w, h))1092              .add(new go.PathSegment(go.PathSegment.Line, 0, (1 - part) * h))1093              .add(new go.PathSegment(go.PathSegment.Line, 0, part * h).close()))1094         .setSpots(part / 2, part / 2, 1 - part / 2, 1 - part / 2);1095});1096go.Shape.setFigureParameter("Pie", 0, new FigureParameter("Start", 0, -360, 360));1097go.Shape.setFigureParameter("Pie", 1, new FigureParameter("Sweep", 315, -360, 360));1098go.Shape.defineFigureGenerator("Pie", function(shape, w, h) {1099  var param1 = shape ? shape.parameter1 : NaN;1100  var param2 = shape ? shape.parameter2 : NaN;1101  if (isNaN(param1)) param1 = 0; // default values PARAMETER 1 is for Start Angle1102  if (isNaN(param2)) param2 = 315; // default values PARAMETER 2 is for Sweep Angle1103  var start = param1 % 360;1104  if (start < 0) start += 360;1105  var sweep = param2 % 360;1106  var rad = Math.min(w, h) / 2;1107  return new go.Geometry()1108        .add(new go.PathFigure(rad, rad)  // start point1109             .add(new go.PathSegment(go.PathSegment.Arc,1110                                     start, sweep,  // angles1111                                     rad, rad,  // center1112                                     rad, rad)  // radius1113                  .close()));1114});1115go.Shape.defineFigureGenerator("PiePiece", function(shape, w, h) {1116  var factor = KAPPA / Math.SQRT2 * .5;1117  var x1 = Math.SQRT2 / 2;1118  var y1 = 1 - Math.SQRT2 / 2;1119  return new go.Geometry()1120    .add(new go.PathFigure(w, h, true)1121      .add(new go.PathSegment(go.PathSegment.Bezier,  x1 * w, y1 * h, w, (1 - factor) * h, (x1 + factor) * w, (y1 + factor) * h))1122      .add(new go.PathSegment(go.PathSegment.Line, 0, h).close()));1123});1124go.Shape.setFigureParameter("ThickCross", 0, new FigureParameter("Thickness", 30));1125go.Shape.defineFigureGenerator("ThickCross", function(shape, w, h) {1126  var param1 = shape ? shape.parameter1 : NaN;1127  if (isNaN(param1) || param1 < 0) param1 = 30;1128  var t = Math.min(param1, w) / 2;1129  var mx = w / 2;1130  var my = h / 2;1131  return new go.Geometry()1132         .add(new go.PathFigure(mx - t, 0, true)1133              .add(new go.PathSegment(go.PathSegment.Line, mx + t, 0))1134              .add(new go.PathSegment(go.PathSegment.Line, mx + t, my - t))1135              .add(new go.PathSegment(go.PathSegment.Line, w, my - t))1136              .add(new go.PathSegment(go.PathSegment.Line, w, my + t))1137              .add(new go.PathSegment(go.PathSegment.Line, mx + t, my + t))1138              .add(new go.PathSegment(go.PathSegment.Line, mx + t, h))1139              .add(new go.PathSegment(go.PathSegment.Line, mx - t, h))1140              .add(new go.PathSegment(go.PathSegment.Line, mx - t, my + t))1141              .add(new go.PathSegment(go.PathSegment.Line, 0, my + t))1142              .add(new go.PathSegment(go.PathSegment.Line, 0, my - t))1143              .add(new go.PathSegment(go.PathSegment.Line, mx - t, my - t).close()));1144});1145go.Shape.setFigureParameter("ThinCross", 0, new FigureParameter("Thickness", 10));1146go.Shape.defineFigureGenerator("ThinCross", function(shape, w, h) {1147  var param1 = shape ? shape.parameter1 : NaN;1148  if (isNaN(param1) || param1 < 0) param1 = 10;1149  var t = Math.min(param1, w) / 2;1150  var mx = w / 2;1151  var 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});1166go.Shape.setFigureParameter("ThickX", 0, new FigureParameter("Thickness", 30));1167go.Shape.defineFigureGenerator("ThickX", function(shape, w, h) {1168  var param1 = shape ? shape.parameter1 : NaN;1169  if (isNaN(param1) || param1 < 0) param1 = 30;1170  if (w === 0 || h === 0) {1171    var geo = new go.Geometry(go.Geometry.Rectangle);1172    geo.startX = 0;1173    geo.startY = 0;1174    geo.endX = w;1175    geo.endY = h;1176    return geo;1177  } else {1178    var w2 = w / 2;1179    var h2 = h / 2;1180    var a2 = Math.atan2(h, w);1181    var dx = param1 - Math.min(Math.cos(a2) * param1/2, w2);1182    var dy = param1 - Math.min(Math.sin(a2) * param1/2, h2);1183    var geo = new go.Geometry();1184    var fig = new go.PathFigure(dx, 0, true);1185    geo.add(fig);1186    fig.add(new go.PathSegment(go.PathSegment.Line, w2, .2 * h));1187    fig.add(new go.PathSegment(go.PathSegment.Line, w-dx, 0));1188    fig.add(new go.PathSegment(go.PathSegment.Line, w, dy));1189    fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, h2));1190    fig.add(new go.PathSegment(go.PathSegment.Line, w, h-dy));1191    fig.add(new go.PathSegment(go.PathSegment.Line, w-dx, h));1192    fig.add(new go.PathSegment(go.PathSegment.Line, w2, .8 * h));1193    fig.add(new go.PathSegment(go.PathSegment.Line, dx, h));1194    fig.add(new go.PathSegment(go.PathSegment.Line, 0, h-dy));1195    fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, h2));1196    fig.add(new go.PathSegment(go.PathSegment.Line, 0, dy).close());1197    return geo;1198  }1199});1200go.Shape.setFigureParameter("ThinX", 0, new FigureParameter("Thickness", 10));1201go.Shape.defineFigureGenerator("ThinX", function(shape, w, h) {1202  var param1 = shape ? shape.parameter1 : NaN;1203  if (isNaN(param1) || param1 < 0) param1 = 10;1204  var geo = new go.Geometry();1205  var fig = new go.PathFigure(.1 * w, 0, true);1206  geo.add(fig);1207  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .4 * h));1208  fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, 0));1209  fig.add(new go.PathSegment(go.PathSegment.Line, w, .1 * h));1210  fig.add(new go.PathSegment(go.PathSegment.Line, .6 * w, .5 * h));1211  fig.add(new go.PathSegment(go.PathSegment.Line, w, .9 * h));1212  fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, h));1213  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .6 * h));1214  fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, h));1215  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .9 * h));1216  fig.add(new go.PathSegment(go.PathSegment.Line, .4 * w, .5 * h));1217  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .1 * h).close());1218  return geo;1219});1220go.Shape.setFigureParameter("SquareIBeam", 0, new FigureParameter("BeamWidth", 0.2, 0.1, 0.9));1221go.Shape.defineFigureGenerator("SquareIBeam", function(shape, w, h) {1222  var param1 = shape ? shape.parameter1 : NaN; // width of the ibeam in % of the total width1223  if (isNaN(param1)) param1 = .2;1224  var geo = new go.Geometry();1225  var fig = new go.PathFigure(0, 0, true);1226  geo.add(fig);1227  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));1228  fig.add(new go.PathSegment(go.PathSegment.Line, w, param1 * h));1229  fig.add(new go.PathSegment(go.PathSegment.Line, (.5 + param1 / 2) * w, param1 * h));1230  fig.add(new go.PathSegment(go.PathSegment.Line, (.5 + param1 / 2) * w, (1 - param1) * h));1231  fig.add(new go.PathSegment(go.PathSegment.Line, w, (1 - param1) * h));1232  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));1233  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));1234  fig.add(new go.PathSegment(go.PathSegment.Line, 0, (1 - 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, (.5 - param1 / 2) * w, param1 * h));1237  fig.add(new go.PathSegment(go.PathSegment.Line, 0, param1 * h).close());1238  return geo;1239});1240go.Shape.setFigureParameter("RoundedIBeam", 0, new FigureParameter("Curviness", .5, .05, .65));1241go.Shape.defineFigureGenerator("RoundedIBeam", function(shape, w, h) {1242  var param1 = shape ? shape.parameter1 : NaN; // curviness of the ibeam relative to total width1243  if (isNaN(param1)) param1 = .5;1244  var geo = new go.Geometry();1245  var fig = new go.PathFigure(0, 0, true);1246  geo.add(fig);1247  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));1248  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, h, Math.abs((1 - param1)) * w, .25 * h, Math.abs((1 - param1)) * w, .75 * h));1249  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));1250  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0, param1 * w, .75 * h,1251  param1 * w, .25 * h).close());1252  return geo;1253});1254go.Shape.defineFigureGenerator("HalfEllipse", function(shape, w, h) {1255  return new go.Geometry()1256         .add(new go.PathFigure(0, 0, true)1257              .add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, KAPPA * w, 0, w, (.5 - KAPPA / 2) * h))1258              .add(new go.PathSegment(go.PathSegment.Bezier, 0, h, w, (.5 + KAPPA / 2) * h, KAPPA * w, h).close()))1259         .setSpots(0, 0.156, 0.844, 0.844);1260});1261go.Shape.defineFigureGenerator("Crescent", function(shape, w, h) {1262  return new go.Geometry()1263         .add(new go.PathFigure(0, 0, true)1264              .add(new go.PathSegment(go.PathSegment.Bezier,1265                                      0, h, w, 0, w, h))1266              .add(new go.PathSegment(go.PathSegment.Bezier,1267                                      0, 0, 0.5 * w, 0.75 * h, 0.5 * w, 0.25 * h).close()))1268         .setSpots(.311, 0.266, 0.744, 0.744);1269});1270go.Shape.defineFigureGenerator("Heart", function(shape, w, h) {1271  return new go.Geometry()1272         .add(new go.PathFigure(.5 * w, h, true)1273              .add(new go.PathSegment(go.PathSegment.Bezier, 0, .3 * h, .1 * w, .8 * h, 0, .5 * h))1274              .add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .3 * h, 0, 0, .45 * w, 0))1275              .add(new go.PathSegment(go.PathSegment.Bezier, w, .3 * h, .55 * w, 0, w, 0))1276              .add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, h, w, .5 * h, .9 * w, .8 * h).close()))1277         .setSpots(.14, .29, .86, .78);1278});1279go.Shape.defineFigureGenerator("Spade", function(shape, w, h) {1280  return new go.Geometry()1281         .add(new go.PathFigure(.5 * w, 0, true)1282              .add(new go.PathSegment(go.PathSegment.Line, .51 * w, .01 * h))1283              .add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, .6 * w, .2 * h, w, .25 * h))1284              .add(new go.PathSegment(go.PathSegment.Bezier, .55 * w, .7 * h, w, .8 * h, .6 * w, .8 * h))1285              .add(new go.PathSegment(go.PathSegment.Bezier, .75 * w, h, .5 * w, .75 * h, .55 * w, .95 * h))1286              .add(new go.PathSegment(go.PathSegment.Line, .25 * w, h))1287              .add(new go.PathSegment(go.PathSegment.Bezier, .45 * w, .7 * h, .45 * w, .95 * h, .5 * w, .75 * h))1288              .add(new go.PathSegment(go.PathSegment.Bezier, 0, .5 * h, .4 * w, .8 * h, 0, .8 * h))1289              .add(new go.PathSegment(go.PathSegment.Bezier, .49 * w, .01 * h, 0, .25 * h, .4 * w, .2 * h).close()))1290         .setSpots(.14, .26, .86, .78);1291});1292go.Shape.defineFigureGenerator("Club", function(shape, w, h) {1293  var geo = new go.Geometry()1294  var fig = new go.PathFigure(.4 * w, .6 * h, true);1295  geo.add(fig);1296  // Start the base1297  fig.add(new go.PathSegment(go.PathSegment.Bezier, .15 * w, h, .5 * w, .75 * h, .45 * w, .95 * h));1298  fig.add(new go.PathSegment(go.PathSegment.Line, .85 * w, h));1299  fig.add(new go.PathSegment(go.PathSegment.Bezier, .6 * w, .6 * h, .55 * w, .95 * h, .5 * w, .75 * h));1300  // First circle:1301  var r = .2; // radius1302  var cx = .3; // offset from Center x1303  var cy = 0; // offset from Center y1304  var d = r * KAPPA;1305  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 + r + cy) * h,1306    (.5 - r + cx) * w, (.5 + d + cy) * h,1307    (.5 - d + cx) * w, (.5 + r + cy) * h));1308  fig.add(new go.PathSegment(go.PathSegment.Bezier, (1 - .5 + r + cx) * w, (.5 + cy) * h,1309    (.5 + d + cx) * w, (.5 + r + cy) * h,1310    (.5 + r + cx) * w, (.5 + d + cy) * h));1311  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 - r + cy) * h,1312    (1 - .5 + r + cx) * w, (.5 - d + cy) * h,1313    (.5 + d + cx) * w, (.5 - r + cy) * h));1314  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.65) * w, (0.36771243) * h,1315    (.5 - d + cx) * w, (.5 - r + cy) * h,1316    (.5 - r + cx + .05) * w, (.5 - d + cy - .02) * h));1317  r = .2; // radius1318  cx = 0; // offset from Center x1319  cy = -.3; // offset from Center y1320  d = r * KAPPA;1321  fig.add(new go.PathSegment(go.PathSegment.Bezier, (1 - .5 + r + cx) * w, (.5 + cy) * h,1322    (.5 + d + cx) * w, (.5 + r + cy) * h,1323    (.5 + r + cx) * w, (.5 + d + cy) * h));1324  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 - r + cy) * h,1325    (1 - .5 + r + cx) * w, (.5 - d + cy) * h,1326    (.5 + d + cx) * w, (.5 - r + cy) * h));1327  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 - r + cx) * w, (.5 + cy) * h,1328    (.5 - d + cx) * w, (.5 - r + cy) * h,1329    (.5 - r + cx) * w, (.5 - d + cy) * h));1330  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 - d + cx) * w, (.5 + r + cy) * h,1331    (.5 - r + cx) * w, (.5 + d + cy) * h,1332    (.5 - d + cx) * w, (.5 + r + cy) * h));1333  r = .2; // radius1334  cx = -.3; // offset from Center x1335  cy = 0; // offset from Center y1336  d = r * KAPPA;1337  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 - r + cy) * h,1338    (1 - .5 + r + cx - .05) * w, (.5 - d + cy - .02) * h,1339    (.5 + d + cx) * w, (.5 - r + cy) * h));1340  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 - r + cx) * w, (.5 + cy) * h,1341    (.5 - d + cx) * w, (.5 - r + cy) * h,1342    (.5 - r + cx) * w, (.5 - d + cy) * h));1343  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 + r + cy) * h,1344    (.5 - r + cx) * w, (.5 + d + cy) * h,1345    (.5 - d + cx) * w, (.5 + r + cy) * h));1346  fig.add(new go.PathSegment(go.PathSegment.Bezier, .4 * w, .6 * h,1347    (.5 + d + cx) * w, (.5 + r + cy) * h,1348    (.5 + r + cx) * w, (.5 + d + cy) * h).close());1349  geo.setSpots(.06, .33, .93, .68);1350  return geo;1351});1352go.Shape.defineFigureGenerator("YinYang", function(shape, w, h) {1353  var geo = new go.Geometry();1354  var fig = new go.PathFigure(w * 0.5, 0, true);1355  geo.add(fig);1356  // Right semi-circle1357  fig.add(new go.PathSegment(go.PathSegment.Arc, 270, 180, w * 0.5, w * 0.5, w * 0.5, w * 0.5));1358  // bottom semi-circle1359  fig.add(new go.PathSegment(go.PathSegment.Arc, 90, -180, w * 0.5, w * 0.75, w * 0.25, w * 0.25));1360  // top semi-circle1361  fig.add(new go.PathSegment(go.PathSegment.Arc, 90, 180, w * 0.5, w * 0.25, w * 0.25, w * 0.25));1362  var radius = .1;  // of the small circles1363  var centerx = .5;1364  var centery = .25;1365  // Top small circle, goes counter-clockwise1366  fig.add(new go.PathSegment(go.PathSegment.Move, (centerx + radius) * w, (centery) * h));1367  fig.add(new go.PathSegment(go.PathSegment.Arc, 0, -360, w * centerx, h * centery, radius * w, radius * w).close()); // Right semi-circle1368  // Left semi-circle1369  fig = new go.PathFigure(w * 0.5, 0, false);1370  geo.add(fig);1371  fig.add(new go.PathSegment(go.PathSegment.Arc, 270, -180, w * 0.5, w * 0.5, w * 0.5, w * 0.5));1372  centery = .75;1373  // Bottom small circle1374  fig = new go.PathFigure((centerx + radius) * w, (centery) * h, true); // Not a subpath1375  geo.add(fig);1376  fig.add(new go.PathSegment(go.PathSegment.Arc, 0, 360, w * centerx, h * centery, radius * w, radius * w).close()); // Right semi-circle1377  geo.defaultStretch = go.GraphObject.Uniform;1378  return geo;1379});1380go.Shape.defineFigureGenerator("Peace", function(shape, w, h) {1381  var a = 1.0 - 0.1464466094067262;  // at 45 degrees1382  var w2 = 0.5 * w;1383  var h2 = 0.5 * h;1384  return new go.Geometry()1385         .add(new go.PathFigure(w2, 0, false)1386              .add(new go.PathSegment(go.PathSegment.Arc, 270, 360, w2, h2, w2, h2))1387              .add(new go.PathSegment(go.PathSegment.Line, w2, h))1388              .add(new go.PathSegment(go.PathSegment.Move, w2, h2))1389              .add(new go.PathSegment(go.PathSegment.Line, (1.0-a) * w, a * h))1390              .add(new go.PathSegment(go.PathSegment.Move, w2, h2))1391              .add(new go.PathSegment(go.PathSegment.Line, a * w, a * h)));1392});1393go.Shape.defineFigureGenerator("NotAllowed", function(shape, w, h) {1394  var geo = new go.Geometry();1395  var cpOffset = KAPPA * .5;1396  var radius = .5;1397  var centerx = .5;1398  var centery = .5;1399  var fig = new go.PathFigure(centerx * w, (centery - radius) * h);1400  geo.add(fig);1401  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery - radius) * h,1402      (centerx - radius) * w, (centery - cpOffset) * h));1403  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h,1404      (centerx - cpOffset) * w, (centery + radius) * h));1405  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery + radius) * h,1406      (centerx + radius) * w, (centery + cpOffset) * h));1407  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h,1408      (centerx + cpOffset) * w, (centery - radius) * h));1409  // Inner circle, composed of two parts, separated by1410  // a beam across going from top-right to bottom-left.1411  radius = .40;1412  cpOffset = KAPPA * .40;1413  // First we cut up the top right 90 degree curve into two smaller1414  // curves.1415  // Since its clockwise, StartOfArrow is the first of the two points1416  // on the circle. EndOfArrow is the other one.1417  var startOfArrowc1 = tempPoint();1418  var startOfArrowc2 = tempPoint();1419  var startOfArrow = tempPoint();1420  var unused = tempPoint();1421  breakUpBezier(centerx, centery - radius,1422      centerx + cpOffset, centery - radius,1423      centerx + radius, centery - cpOffset,1424      centerx + radius, centery, .42, startOfArrowc1,1425      startOfArrowc2, startOfArrow, unused, unused);1426  var endOfArrowc1 = tempPoint();1427  var endOfArrowc2 = tempPoint();1428  var endOfArrow = tempPoint();1429  breakUpBezier(centerx, centery - radius,1430      centerx + cpOffset, centery - radius,1431      centerx + radius, centery - cpOffset,1432      centerx + radius, centery, .58, unused,1433      unused, endOfArrow, endOfArrowc1, endOfArrowc2);1434  // Cut up the bottom left 90 degree curve into two smaller curves.1435  var startOfArrow2c1 = tempPoint();1436  var startOfArrow2c2 = tempPoint();1437  var startOfArrow2 = tempPoint();1438  breakUpBezier(centerx, centery + radius,1439      centerx - cpOffset, centery + radius,1440      centerx - radius, centery + cpOffset,1441      centerx - radius, centery, .42, startOfArrow2c1,1442      startOfArrow2c2, startOfArrow2, unused, unused);1443  var endOfArrow2c1 = tempPoint();1444  var endOfArrow2c2 = tempPoint();1445  var endOfArrow2 = tempPoint();1446  breakUpBezier(centerx, centery + radius,1447      centerx - cpOffset, centery + radius,1448      centerx - radius, centery + cpOffset,1449      centerx - radius, centery, .58, unused,1450      unused, endOfArrow2, endOfArrow2c1, endOfArrow2c2);1451  fig.add(new go.PathSegment(go.PathSegment.Move, endOfArrow2.x * w, endOfArrow2.y * h));1452  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, endOfArrow2c1.x * w, endOfArrow2c1.y * h,1453      endOfArrow2c2.x * w, endOfArrow2c2.y * h));1454  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,1455      (centerx - cpOffset) * w, (centery - radius) * h));1456  fig.add(new go.PathSegment(go.PathSegment.Bezier, startOfArrow.x * w, startOfArrow.y * h, startOfArrowc1.x * w, startOfArrowc1.y * h,1457      startOfArrowc2.x * w, startOfArrowc2.y * h));1458  fig.add(new go.PathSegment(go.PathSegment.Line, endOfArrow2.x * w, endOfArrow2.y * h).close());1459  fig.add(new go.PathSegment(go.PathSegment.Move, startOfArrow2.x * w, startOfArrow2.y * h));1460  fig.add(new go.PathSegment(go.PathSegment.Line, endOfArrow.x * w, endOfArrow.y * h));1461  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, endOfArrowc1.x * w, endOfArrowc1.y * h,1462      endOfArrowc2.x * w, endOfArrowc2.y * h));1463  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,1464      (centerx + cpOffset) * w, (centery + radius) * h));1465  fig.add(new go.PathSegment(go.PathSegment.Bezier, startOfArrow2.x * w, startOfArrow2.y * h, startOfArrow2c1.x * w, startOfArrow2c1.y * h,1466      startOfArrow2c2.x * w, startOfArrow2c2.y * h).close());1467  freePoint(startOfArrowc1);1468  freePoint(startOfArrowc2);1469  freePoint(startOfArrow);1470  freePoint(unused);1471  freePoint(endOfArrowc1);1472  freePoint(endOfArrowc2);1473  freePoint(endOfArrow);1474  freePoint(startOfArrow2c1);1475  freePoint(startOfArrow2c2);1476  freePoint(startOfArrow2);1477  freePoint(endOfArrow2c1);1478  freePoint(endOfArrow2c2);1479  freePoint(endOfArrow2);1480  geo.defaultStretch = go.GraphObject.Uniform;1481  return geo;1482});1483go.Shape.defineFigureGenerator("Fragile", function(shape, w, h) {1484  return new go.Geometry()1485         .add(new go.PathFigure(0, 0, true)1486              .add(new go.PathSegment(go.PathSegment.Line, .25 * w, 0))1487              .add(new go.PathSegment(go.PathSegment.Line, .2 * w, .15 * h))1488              .add(new go.PathSegment(go.PathSegment.Line, .3 * w, .25 * h))1489              .add(new go.PathSegment(go.PathSegment.Line, .29 * w, .33 * h))1490              .add(new go.PathSegment(go.PathSegment.Line, .35 * w, .25 * h))1491              .add(new go.PathSegment(go.PathSegment.Line, .3 * w, .15 * h))1492              .add(new go.PathSegment(go.PathSegment.Line, .4 * w, 0))1493              .add(new go.PathSegment(go.PathSegment.Line, w, 0))1494              // Left Side1495              .add(new go.PathSegment(go.PathSegment.Bezier, .55 * w, .5 * h, w, .25 * h, .75 * w, .5 * h))1496              .add(new go.PathSegment(go.PathSegment.Line, .55 * w, .9 * h))1497              // The base1498              .add(new go.PathSegment(go.PathSegment.Line, .7 * w, .9 * h))1499              .add(new go.PathSegment(go.PathSegment.Line, .7 * w, h))1500              .add(new go.PathSegment(go.PathSegment.Line, .3 * w, h))1501              .add(new go.PathSegment(go.PathSegment.Line, .3 * w, .9 * h))1502              // Right side1503              .add(new go.PathSegment(go.PathSegment.Line, .45 * w, .9 * h))1504              .add(new go.PathSegment(go.PathSegment.Line, .45 * w, .5 * h))1505              .add(new go.PathSegment(go.PathSegment.Bezier, 0, 0, .25 * w, .5 * h, 0, .25 * h).close()));1506});1507go.Shape.setFigureParameter("HourGlass", 0, new FigureParameter("Thickness", 30));1508go.Shape.defineFigureGenerator("HourGlass", function(shape, w, h) {1509  var param1 = shape ? shape.parameter1 : NaN; // width at middle of hourglass1510  if (isNaN(param1) || param1 < 0) param1 = 30;1511  if (param1 > w) param1 = w;1512  var x1 = (w - param1) / 2;1513  var x2 = x1 + param1;1514  return new go.Geometry()1515         .add(new go.PathFigure(x2, 0.5 * h)1516              .add(new go.PathSegment(go.PathSegment.Line, w, h))1517              .add(new go.PathSegment(go.PathSegment.Line, 0, h))1518              .add(new go.PathSegment(go.PathSegment.Line, x1, 0.5 * h))1519              .add(new go.PathSegment(go.PathSegment.Line, 0, 0))1520              .add(new go.PathSegment(go.PathSegment.Line, w, 0).close()));1521});1522go.Shape.defineFigureGenerator("Lightning", function(shape, w, h) {1523  return new go.Geometry()1524         .add(new go.PathFigure(0, 0.55 * h)1525              .add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0))1526              .add(new go.PathSegment(go.PathSegment.Line, 0.3 * w, 0.45 * h))1527              .add(new go.PathSegment(go.PathSegment.Line, w, 0.45 * h))1528              .add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, h))1529              .add(new go.PathSegment(go.PathSegment.Line, 0.7 * w, 0.55 * h).close()));1530});1531go.Shape.defineFigureGenerator("GenderMale", function(shape, w, h) {1532  var geo = new go.Geometry();1533  var cpOffset = KAPPA * .4;1534  var radius = .4;1535  var centerx = .5;1536  var centery = .5;1537  var unused = tempPoint();1538  var mid = tempPoint();1539  var c1 = tempPoint();1540  var c2 = tempPoint();1541  var fig = new go.PathFigure((centerx - radius) * w, centery * h, false);1542  geo.add(fig);1543  // Outer circle1544  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,1545    (centerx - cpOffset) * w, (centery - radius) * h));1546  breakUpBezier(centerx, centery - radius,1547       centerx + cpOffset, centery - radius,1548       centerx + radius, centery - cpOffset,1549       centerx + radius, centery, .44, c1,1550       c2, mid, unused, unused);1551  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));1552  var startOfArrow = tempPointAt(mid.x, mid.y);1553  breakUpBezier(centerx, centery - radius,1554      centerx + cpOffset, centery - radius,1555      centerx + radius, centery - cpOffset,1556      centerx + radius, centery, .56, unused,1557      unused, mid, c1, c2);1558  var endOfArrow = tempPointAt(mid.x, mid.y);1559  fig.add(new go.PathSegment(go.PathSegment.Line, (startOfArrow.x * .1 + .95 * .9) * w,1560    (startOfArrow.y * .1) * h));1561  fig.add(new go.PathSegment(go.PathSegment.Line, .85 * w, (startOfArrow.y * .1) * h));1562  fig.add(new go.PathSegment(go.PathSegment.Line, .85 * w, 0));1563  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));1564  fig.add(new go.PathSegment(go.PathSegment.Line, w, .15 * h));1565  fig.add(new go.PathSegment(go.PathSegment.Line, (endOfArrow.x * .1 + .9) * w, .15 * h));1566  fig.add(new go.PathSegment(go.PathSegment.Line, (endOfArrow.x * .1 + .9) * w,1567    (endOfArrow.y * .1 + .05 * .9) * h));1568  fig.add(new go.PathSegment(go.PathSegment.Line, endOfArrow.x * w, endOfArrow.y * h));1569  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));1570  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,1571    (centerx + cpOffset) * w, (centery + radius) * h));1572  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,1573    (centerx - radius) * w, (centery + cpOffset) * h));1574  // Inner circle1575  radius = .35;1576  cpOffset = KAPPA * .35;1577  var fig2 = new go.PathFigure(centerx * w, (centery - radius) * h, false);1578  geo.add(fig2);1579  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery - radius) * h,1580    (centerx - radius) * w, (centery - cpOffset) * h));1581  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h,1582    (centerx - cpOffset) * w, (centery + radius) * h));1583  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery + radius) * h,1584    (centerx + radius) * w, (centery + cpOffset) * h));1585  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx + radius) * w, (centery - cpOffset) * h,1586    (centerx + cpOffset) * w, (centery - radius) * h));1587  var fig3 = new go.PathFigure((centerx - radius) * w, centery * h, false);1588  geo.add(fig3);1589  freePoint(unused);1590  freePoint(mid);1591  freePoint(c1);1592  freePoint(c2);1593  freePoint(startOfArrow);1594  freePoint(endOfArrow);1595  geo.spot1 = new go.Spot(.202, .257);1596  geo.spot2 = new go.Spot(.792, .739);1597  geo.defaultStretch = go.GraphObject.Uniform;1598  return geo;1599});1600go.Shape.defineFigureGenerator("GenderFemale", function(shape, w, h) {1601  var geo = new go.Geometry();1602  // Outer Circle1603  var r = .375; // radius1604  var cx = 0; // offset from Center x1605  var cy = -.125; // offset from Center y1606  var d = r * KAPPA;1607  var fig = new go.PathFigure((.525 + cx) * w, (.5 + r + cy) * h, false);1608  geo.add(fig);1609  fig.add(new go.PathSegment(go.PathSegment.Bezier, (1 - .5 + r + cx) * w, (.5 + cy) * h, (.5 + d + cx) * w, (.5 + r + cy) * h,1610    (.5 + r + cx) * w, (.5 + d + cy) * h));1611  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 - r + cy) * h, (1 - .5 + r + cx) * w, (.5 - d + cy) * h,1612    (.5 + d + cx) * w, (.5 - r + cy) * h));1613  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 - r + cx) * w, (.5 + cy) * h, (.5 - d + cx) * w, (.5 - r + cy) * h,1614    (.5 - r + cx) * w, (.5 - d + cy) * h));1615  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.475 + cx) * w, (.5 + r + cy) * h, (.5 - r + cx) * w, (.5 + d + cy) * h,1616    (.5 - d + cx) * w, (.5 + r + cy) * h));1617  // Legs1618  fig.add(new go.PathSegment(go.PathSegment.Line, .475 * w, .85 * h));1619  fig.add(new go.PathSegment(go.PathSegment.Line, .425 * w, .85 * h));1620  fig.add(new go.PathSegment(go.PathSegment.Line, .425 * w, .9 * h));1621  fig.add(new go.PathSegment(go.PathSegment.Line, .475 * w, .9 * h));1622  fig.add(new go.PathSegment(go.PathSegment.Line, .475 * w, h));1623  fig.add(new go.PathSegment(go.PathSegment.Line, .525 * w, h));1624  fig.add(new go.PathSegment(go.PathSegment.Line, .525 * w, .9 * h));1625  fig.add(new go.PathSegment(go.PathSegment.Line, .575 * w, .9 * h));1626  fig.add(new go.PathSegment(go.PathSegment.Line, .575 * w, .85 * h));1627  fig.add(new go.PathSegment(go.PathSegment.Line, .525 * w, .85 * h).close());1628  // Inner circle1629  r = .325; // radius1630  cx = 0; // offset from Center x1631  cy = -.125; // offset from Center y1632  d = r * KAPPA;1633  var fig = new go.PathFigure((1 - .5 + r + cx) * w, (.5 + cy) * h, false);1634  geo.add(fig);1635  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 + r + cy) * h, (.5 + r + cx) * w, (.5 + d + cy) * h,1636    (.5 + d + cx) * w, (.5 + r + cy) * h));1637  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 - r + cx) * w, (.5 + cy) * h, (.5 - d + cx) * w, (.5 + r + cy) * h,1638    (.5 - r + cx) * w, (.5 + d + cy) * h));1639  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 + cx) * w, (.5 - r + cy) * h, (.5 - r + cx) * w, (.5 - d + cy) * h,1640    (.5 - d + cx) * w, (.5 - r + cy) * h));1641  fig.add(new go.PathSegment(go.PathSegment.Bezier, (1 - .5 + r + cx) * w, (.5 + cy) * h, (.5 + d + cx) * w, (.5 - r + cy) * h,1642    (1 - .5 + r + cx) * w, (.5 - d + cy) * h));1643  var fig = new go.PathFigure((.525 + cx) * w, (.5 + r + cy) * h, false);1644  geo.add(fig);1645  geo.spot1 = new go.Spot(.232, .136);1646  geo.spot2 = new go.Spot(.682, .611);1647  geo.defaultStretch = go.GraphObject.Uniform;1648  return geo;1649});1650go.Shape.defineFigureGenerator("LogicImplies", function(shape, w, h) {1651  var param1 = shape ? shape.parameter1 : NaN;1652  if (isNaN(param1)) param1 = .2;  // Distance the arrow folds from the right1653  return new go.Geometry()1654         .add(new go.PathFigure((1 - param1) * w, 0, false)1655              .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h))1656              .add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, h))1657              .add(new go.PathSegment(go.PathSegment.Move, 0, .5 * h))1658              .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h)))1659         .setSpots(0, 0, 0.8, 0.5);1660});1661go.Shape.defineFigureGenerator("LogicIff", function(shape, w, h) {1662  var param1 = shape ? shape.parameter1 : NaN;1663  if (isNaN(param1)) param1 = .2; // Distance the arrow folds from the right1664  return new go.Geometry()1665         .add(new go.PathFigure((1 - param1) * w, 0, false)1666              .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h))1667              .add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, h))1668              .add(new go.PathSegment(go.PathSegment.Move, 0, .5 * h))1669              .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h))1670              .add(new go.PathSegment(go.PathSegment.Move, param1 * w, 0))1671              .add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h))1672              .add(new go.PathSegment(go.PathSegment.Line, param1 * w, h)))1673         .setSpots(0.2, 0, 0.8, 0.5);1674});1675go.Shape.defineFigureGenerator("LogicNot", function(shape, w, h) {1676  return new go.Geometry()1677         .add(new go.PathFigure(0, 0, false)1678              .add(new go.PathSegment(go.PathSegment.Line, w, 0))1679              .add(new go.PathSegment(go.PathSegment.Line, w, h)));1680});1681go.Shape.defineFigureGenerator("LogicAnd", function(shape, w, h) {1682  return new go.Geometry()1683         .add(new go.PathFigure(0, h, false)1684              .add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0))1685              .add(new go.PathSegment(go.PathSegment.Line, w, h)))1686         .setSpots(0.25, 0.5, 0.75, 1);1687});1688go.Shape.defineFigureGenerator("LogicOr", function(shape, w, h) {1689  return new go.Geometry()1690         .add(new go.PathFigure(0, 0, false)1691              .add(new go.PathSegment(go.PathSegment.Line, .5 * w, h))1692              .add(new go.PathSegment(go.PathSegment.Line, w, 0)))1693         .setSpots(0.219, 0, 0.78, 0.409);1694});1695go.Shape.defineFigureGenerator("LogicXor", function(shape, w, h) {1696  var geo = new go.Geometry()1697         .add(new go.PathFigure(.5 * w, 0, false)1698              .add(new go.PathSegment(go.PathSegment.Line, .5 * w, h))1699              .add(new go.PathSegment(go.PathSegment.Move, 0, .5 * h))1700              .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h))1701              .add(new go.PathSegment(go.PathSegment.Arc, 0, 360, .5 * w, .5 * h, .5 * w, .5 * h)));1702  geo.defaultStretch = go.GraphObject.Uniform;1703  return geo;1704});1705go.Shape.defineFigureGenerator("LogicTruth", function(shape, w, h) {1706  return new go.Geometry()1707         .add(new go.PathFigure(0, 0, false)1708              .add(new go.PathSegment(go.PathSegment.Line, w, 0))1709              .add(new go.PathSegment(go.PathSegment.Move, .5 * w, 0))1710              .add(new go.PathSegment(go.PathSegment.Line, .5 * w, h)));1711});1712go.Shape.defineFigureGenerator("LogicFalsity", function(shape, w, h) {1713  return new go.Geometry()1714         .add(new go.PathFigure(0, h, false)1715              .add(new go.PathSegment(go.PathSegment.Line, w, h))1716              .add(new go.PathSegment(go.PathSegment.Move, .5 * w, h))1717              .add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0)));1718});1719go.Shape.defineFigureGenerator("LogicThereExists", function(shape, w, h) {1720  return new go.Geometry()1721         .add(new go.PathFigure(0, 0, false)1722              .add(new go.PathSegment(go.PathSegment.Line, w, 0))1723              .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h))1724              .add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h))1725              .add(new go.PathSegment(go.PathSegment.Move, w, .5 * h))1726              .add(new go.PathSegment(go.PathSegment.Line, w, h))1727              .add(new go.PathSegment(go.PathSegment.Line, 0, h)));1728});1729go.Shape.defineFigureGenerator("LogicForAll", function(shape, w, h) {1730  return new go.Geometry()1731         .add(new go.PathFigure(0, 0, false)1732              .add(new go.PathSegment(go.PathSegment.Line, .5 * w, h))1733              .add(new go.PathSegment(go.PathSegment.Line, w, 0))1734              .add(new go.PathSegment(go.PathSegment.Move, .25 * w, .5 * h))1735              .add(new go.PathSegment(go.PathSegment.Line, .75 * w, .5 * h)))1736         .setSpots(0.25, 0, 0.75, 0.5);1737});1738go.Shape.defineFigureGenerator("LogicIsDefinedAs", function(shape, w, h) {1739  return new go.Geometry()1740         .add(new go.PathFigure(0, 0, false)1741              .add(new go.PathSegment(go.PathSegment.Line, w, 0))1742              .add(new go.PathSegment(go.PathSegment.Move, 0, .5 * h))1743              .add(new go.PathSegment(go.PathSegment.Line, w, .5 * h))1744              .add(new go.PathSegment(go.PathSegment.Move, 0, h))1745              .add(new go.PathSegment(go.PathSegment.Line, w, h)))1746         .setSpots(0.01, 0.01, 0.99, 0.49);1747});1748go.Shape.defineFigureGenerator("LogicIntersect", function(shape, w, h) {1749  var radius = 0.5;1750  return new go.Geometry()1751         .add(new go.PathFigure(0, h, false)1752              .add(new go.PathSegment(go.PathSegment.Line, 0, radius * h))1753              .add(new go.PathSegment(go.PathSegment.Arc, 180, 180, radius * w, radius * h, radius * w, radius * h))1754              .add(new go.PathSegment(go.PathSegment.Line, w, h)))1755         .setSpots(0, 0.5, 1, 1);1756});1757go.Shape.defineFigureGenerator("LogicUnion", function(shape, w, h) {1758  var radius = 0.5;1759  return new go.Geometry()1760         .add(new go.PathFigure(w, 0, false)1761              .add(new go.PathSegment(go.PathSegment.Line, w, radius * h))1762              .add(new go.PathSegment(go.PathSegment.Arc, 0, 180, radius * w, radius * h, radius * w, radius * h))1763              .add(new go.PathSegment(go.PathSegment.Line, 0, 0)))1764         .setSpots(0, 0, 1, 0.5);1765});1766go.Shape.setFigureParameter("Arrow", 0, new FigureParameter("ArrowheadWidth", .3, .01, .99));1767go.Shape.setFigureParameter("Arrow", 1, new FigureParameter("TailHeight", .3, .01, .99));1768go.Shape.defineFigureGenerator("Arrow", function(shape, w, h) {1769  var param1 = shape ? shape.parameter1 : NaN; // % width of arrowhead1770  if (isNaN(param1)) param1 = .3;1771  var param2 = shape ? shape.parameter2 : NaN; // % height of tail1772  if (isNaN(param2)) param2 = .3;1773  var x = (1 - param1) * w;1774  var y1 = (.5 - param2 / 2) * h;1775  var y2 = (.5 + param2 / 2) * h;1776  var geo = new go.Geometry();1777  var fig = new go.PathFigure(0, y1, true);1778  geo.add(fig);1779  fig.add(new go.PathSegment(go.PathSegment.Line, x, y1));1780  fig.add(new go.PathSegment(go.PathSegment.Line, x, 0));1781  fig.add(new go.PathSegment(go.PathSegment.Line, x, 0));1782  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));1783  fig.add(new go.PathSegment(go.PathSegment.Line, x, h));1784  fig.add(new go.PathSegment(go.PathSegment.Line, x, y2));1785  fig.add(new go.PathSegment(go.PathSegment.Line, 0, y2).close());1786  geo.spot1 = new go.Spot(0, y1 / h);1787  var temp = getIntersection(0, y2 / h,1788      1, y2 / h,1789      x / w, 1,1790      1, .5,1791      tempPoint());1792  geo.spot2 = new go.Spot(temp.x, temp.y);1793  freePoint(temp);1794  return geo;1795});1796// Arrow with absolutes instead of scaling1797go.Shape.setFigureParameter("Arrow2", 0, new FigureParameter("ArrowheadWidth", 30));1798go.Shape.setFigureParameter("Arrow2", 0, new FigureParameter("TailHeight", 30));1799go.Shape.defineFigureGenerator("Arrow2", function(shape, w, h) {1800  var param1 = shape ? shape.parameter1 : NaN; // width of arrowhead1801  if (isNaN(param1)) param1 = 30;1802  if (param1 > w) param1 = w;1803  var param2 = shape ? shape.parameter2 : NaN; // height of tail1804  if (isNaN(param2)) param2 = 30;1805  param2 = Math.min(param2, h / 2);1806  var x = w - param1;1807  var y1 = (h - param2) / 2;1808  var y2 = y1 + param2;1809  var geo = new go.Geometry();1810  var fig = new go.PathFigure(0, y1, true);1811  geo.add(fig);1812  fig.add(new go.PathSegment(go.PathSegment.Line, x, y1));1813  fig.add(new go.PathSegment(go.PathSegment.Line, x, 0));1814  fig.add(new go.PathSegment(go.PathSegment.Line, x, 0));1815  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));1816  fig.add(new go.PathSegment(go.PathSegment.Line, x, h));1817  fig.add(new go.PathSegment(go.PathSegment.Line, x, y2));1818  fig.add(new go.PathSegment(go.PathSegment.Line, 0, y2).close());1819  geo.spot1 = new go.Spot(0, y1 / h);1820  var temp = getIntersection(0, y2 / h,1821      1, y2 / h,1822      x / w, 1,1823      1, .5,1824      tempPoint());1825  geo.spot2 = new go.Spot(temp.x, temp.y);1826  freePoint(temp);1827  return geo;1828});1829go.Shape.defineFigureGenerator("Chevron", function(shape, w, h) {1830  var geo = new go.Geometry();1831  var fig = new go.PathFigure(0, 0, true);1832  geo.add(fig);1833  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));1834  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));1835  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));1836  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));1837  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h).close());1838  return geo;1839});1840go.Shape.defineFigureGenerator("DoubleArrow", function(shape, w, h) {1841  var geo = new go.Geometry();1842  var fig = new go.PathFigure(0, 0, true);1843  geo.add(fig);1844  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 0.214 * h));1845  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 0));1846  fig.add(new go.PathSegment(go.PathSegment.Line, 1.0 * w, .5 * h));1847  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 1.0 * h));1848  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 0.786 * h));1849  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 1.0 * h).close());1850  return geo;1851});1852go.Shape.setFigureParameter("DoubleEndArrow", 0, new FigureParameter("ConnecterHeight", .3, .01, .99));1853go.Shape.defineFigureGenerator("DoubleEndArrow", function(shape, w, h) {1854  var param1 = shape ? shape.parameter1 : NaN; // height of midsection1855  if (isNaN(param1)) param1 = .3;1856  var y1 = (.5 - param1 / 2) * h;1857  var y2 = (.5 + param1 / 2) * h;1858  var geo = new go.Geometry();1859  var fig = new go.PathFigure(w, .5 * h, true);1860  geo.add(fig);1861  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h));1862  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y2));1863  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, y2));1864  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, h));1865  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h));1866  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 0));1867  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, y1));1868  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y1));1869  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, 0).close());1870  var temp = getIntersection(0, .5,1871    .3, 0,1872    0, y1 / h,1873    .1, y1 / h,1874    tempPoint());1875  geo.spot1 = new go.Spot(temp.x, temp.y);1876  temp = getIntersection(.7, 1,1877    1, .5,1878    0, y2 / h,1879    1, y2 / h,1880    temp);1881  geo.spot2 = new go.Spot(temp.x, temp.y);1882  freePoint(temp);1883  return geo;1884});1885// DoubleEndArrow with absolutes instead of scaling1886go.Shape.setFigureParameter("DoubleEndArrow2", 0, new FigureParameter("ConnecterHeight", 40));1887go.Shape.setFigureParameter("DoubleEndArrow2", 1, new FigureParameter("ArrowHeight", 100));1888go.Shape.defineFigureGenerator("DoubleEndArrow2", function(shape, w, h) {1889  var param1 = shape ? shape.parameter1 : NaN; // height of midsection1890  if (isNaN(param1)) param1 = 40;1891  var param2 = shape ? shape.parameter2 : NaN; // height of arrows1892  if (isNaN(param2)) param2 = 100;1893  /*1894    y1outer1895      /|     |\1896     / |     | \1897    /  y1----   \1898   /             \1899   \             /1900    \  y2----   /1901     \ |     | /1902      \|     |/1903    y2outer1904  */1905  var y1 = (h - param1) / 2;1906  var y2 = y1 + param1;1907  var y1outer = (h - param2) / 2;1908  var y2outer = y1outer + param2;1909  if (param1 > h || param2 > h) {1910    if (param2 > param1) {1911      param1 = param1 * h / param2; // use similar ratio1912      y1 = (h - param1) / 2;1913      y2 = y1 + param1;1914      y1outer = 0;1915      y2outer = h;1916    } else {1917      y1 = 0;1918      y2 = h;1919      y1outer = 0;1920      y2outer = h;1921    }1922  }1923  var geo = new go.Geometry();1924  var 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, .3 * w, y2));1929  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, y2outer));1930  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h));1931  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, y1outer));1932  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, y1));1933  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y1));1934  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y1outer).close());1935  var temp = getIntersection(0, .5,1936    .3, y1outer / h,1937    0, y1 / h,1938    1, y1 / h,1939    tempPoint());1940  geo.spot1 = new go.Spot(temp.x, temp.y);1941  temp = getIntersection(.7, y2outer / h,1942    1, .5,1943    0, y2 / h,1944    1, y2 / h,1945    temp);1946  geo.spot2 = new go.Spot(temp.x, temp.y);1947  freePoint(temp);1948  return geo;1949});1950go.Shape.setFigureParameter("IBeamArrow", 0, new FigureParameter("ConnectorHeight", .7, .51, .97));1951go.Shape.defineFigureGenerator("IBeamArrow", function(shape, w, h) {1952  var param1 = shape ? shape.parameter1 : NaN; // height of midsection1953  if (isNaN(param1)) param1 = .3;1954  var y1 = (.5 - param1 / 2) * h;1955  var y2 = (.5 + param1 / 2) * h;1956  var geo = new go.Geometry();1957  var fig = new go.PathFigure(w, .5 * h, true);1958  geo.add(fig);1959  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h));1960  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y2));1961  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, y2));1962  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, h));1963  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));1964  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));1965  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, 0));1966  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, y1));1967  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y1));1968  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, 0).close());1969  geo.spot1 = new go.Spot(0, y1 / h);1970  var temp = getIntersection(.7, 1,1971    1, .5,1972    0, y2 / h,1973    1, y2 / h,1974    tempPoint());1975  geo.spot2 = new go.Spot(temp.x, temp.y);1976  freePoint(temp);1977  return geo;1978});1979// IBeamArrow with absolutes instead of scaling1980go.Shape.setFigureParameter("IBeamArrow2", 0, new FigureParameter("ConnectorHeight", 40));1981go.Shape.setFigureParameter("IBeamArrow2", 1, new FigureParameter("BeamArrowHeight", 100));1982go.Shape.defineFigureGenerator("IBeamArrow2", function(shape, w, h) {1983  var param1 = shape ? shape.parameter1 : NaN; // height of midsection1984  if (isNaN(param1)) param1 = 40;1985  var param2 = shape ? shape.parameter2 : NaN; // height of beam and arrow1986  if (isNaN(param2)) param2 = 100;1987  var y1 = (h - param1) / 2;1988  var y2 = y1 + param1;1989  var y1outer = (h - param2) / 2;1990  var y2outer = y1outer + param2;1991  if (param1 > h || param2 > h) {1992    if (param2 > param1) {1993      param1 = param1 * h / param2; // use similar ratio1994      y1 = (h - param1) / 2;1995      y2 = y1 + param1;1996      y1outer = 0;1997      y2outer = h;1998    } else {1999      y1 = 0;2000      y2 = h;2001      y1outer = 0;2002      y2outer = h;2003    }2004  }2005  var geo = new go.Geometry();2006  var fig = new go.PathFigure(w, .5 * h, true);2007  geo.add(fig);2008  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y2outer));2009  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y2));2010  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, y2));2011  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, y2outer));2012  fig.add(new go.PathSegment(go.PathSegment.Line, 0, y2outer));2013  fig.add(new go.PathSegment(go.PathSegment.Line, 0, y1outer));2014  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, y1outer));2015  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, y1));2016  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y1));2017  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y1outer).close());2018  geo.spot1 = new go.Spot(0, y1 / h);2019  var temp = getIntersection(.7, y2outer / h,2020    1, .5,2021    0, y2 / h,2022    1, y2 / h,2023    tempPoint());2024  geo.spot2 = new go.Spot(temp.x, temp.y);2025  freePoint(temp);2026  return geo;2027});2028go.Shape.setFigureParameter("Pointer", 0, new FigureParameter("BackPoint", .1, 0, .2));2029go.Shape.defineFigureGenerator("Pointer", function(shape, w, h) {2030  var param1 = shape ? shape.parameter1 : NaN; // how much the back of the pointer comes in2031  if (isNaN(param1)) param1 = .1;2032  var geo = new go.Geometry();2033  var fig = new go.PathFigure(w, .5 * h, true);2034  geo.add(fig);2035  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));2036  fig.add(new go.PathSegment(go.PathSegment.Line, param1 * w, .5 * h));2037  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0).close());2038  geo.spot1 = new go.Spot(param1, .35);2039  var temp = getIntersection(.2, .65, 1, .65, 0, 1, 1, .5, tempPoint());  // ?? constant2040  geo.spot2 = new go.Spot(temp.x, temp.y);2041  freePoint(temp);2042  return geo;2043});2044go.Shape.setFigureParameter("RoundedPointer", 0, new FigureParameter("RoundedEdge", .3, 0, .5));2045go.Shape.defineFigureGenerator("RoundedPointer", function(shape, w, h) {2046  var param1 = shape ? shape.parameter1 : NaN; // how much the curved back of the pointer comes in2047  if (isNaN(param1)) param1 = .3;2048  var geo = new go.Geometry();2049  var fig = new go.PathFigure(w, .5 * h, true);2050  geo.add(fig);2051  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));2052  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0, param1 * w, .75 * h,2053      param1 * w, .25 * h).close());2054  geo.spot1 = new go.Spot(param1, .35);2055  var temp = getIntersection(0, .65, 1, .65, 0, 1, 1, .5, tempPoint());  // ?? constant2056  geo.spot2 = new go.Spot(temp.x, temp.y);2057  freePoint(temp);2058  return geo;2059});2060go.Shape.setFigureParameter("SplitEndArrow", 0, new FigureParameter("TailHeight", 0.4, 0.01, .99));2061go.Shape.defineFigureGenerator("SplitEndArrow", function(shape, w, h) {2062  var param1 = shape ? shape.parameter1 : NaN; // % height of arrow tail2063  if (isNaN(param1)) param1 = .4;2064  var y1 = (.5 - param1 / 2) * h;2065  var y2 = (.5 + param1 / 2) * h;2066  var geo = new go.Geometry();2067  var fig = new go.PathFigure(w, .5 * h, true);2068  geo.add(fig);2069  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h));2070  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y2));2071  fig.add(new go.PathSegment(go.PathSegment.Line, 0, y2));2072  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .5 * h));2073  fig.add(new go.PathSegment(go.PathSegment.Line, 0, y1));2074  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y1));2075  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, 0).close());2076  geo.spot1 = new go.Spot(.2, .3);2077  var temp = getIntersection(.7, 1,2078    1, .5,2079    0, y2 / h,2080    1, y2 / h,2081    tempPoint());2082  geo.spot2 = new go.Spot(temp.x, temp.y);2083  freePoint(temp);2084  return geo;2085});2086// SplitEndArrow with absolutes instead of scaling2087go.Shape.setFigureParameter("SplitEndArrow2", 0, new FigureParameter("TailThickness", 50));2088go.Shape.defineFigureGenerator("SplitEndArrow2", function(shape, w, h) {2089  var param1 = shape ? shape.parameter1 : NaN;  // height of arrow tail2090  if (isNaN(param1)) param1 = 50;2091  var y1 = (h - param1) / 2;2092  var y2 = y1 + param1;2093  if (param1 > h) {2094    y1 = 0;2095    y2 = h;2096  }2097  var geo = new go.Geometry();2098  var fig = new go.PathFigure(w, .5 * h, true);2099  geo.add(fig);2100  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h));2101  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y2));2102  fig.add(new go.PathSegment(go.PathSegment.Line, 0, y2));2103  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .5 * h));2104  fig.add(new go.PathSegment(go.PathSegment.Line, 0, y1));2105  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, y1));2106  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, 0).close());2107  geo.spot1 = new go.Spot(.2, y1 / h);2108  var temp = getIntersection(.7, 1,2109    1, .5,2110    0, y2 / h,2111    1, y2 / h,2112    tempPoint());2113  geo.spot2 = new go.Spot(temp.x, temp.y);2114  freePoint(temp);2115  return geo;2116});2117go.Shape.setFigureParameter("SquareArrow", 0, new FigureParameter("ArrowPoint", .7, .2, .9));2118go.Shape.defineFigureGenerator("SquareArrow", function(shape, w, h) {2119  var param1 = shape ? shape.parameter1 : NaN; // pointiness of arrow, lower is more pointy2120  if (isNaN(param1)) param1 = .7;2121  var geo = new go.Geometry();2122  var fig = new go.PathFigure(w, .5 * h, true);2123  geo.add(fig);2124  fig.add(new go.PathSegment(go.PathSegment.Line, param1 * w, h));2125  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));2126  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));2127  fig.add(new go.PathSegment(go.PathSegment.Line, param1 * w, 0).close());2128  geo.spot1 = go.Spot.TopLeft;2129  geo.spot2 = new go.Spot(param1, 1);2130  return geo;2131});2132go.Shape.defineFigureGenerator("Cone1", function(shape, w, h) {2133  var geo = new go.Geometry();2134  var cpxOffset = KAPPA * .5;2135  var cpyOffset = KAPPA * .1;2136  var fig = new go.PathFigure(0, .9 * h, true);2137  geo.add(fig);2138  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));2139  fig.add(new go.PathSegment(go.PathSegment.Line, w, .9 * h));2140  fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, h, w, (.9 + cpyOffset) * h,2141    (.5 + cpxOffset) * w, h));2142  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .9 * h, (.5 - cpxOffset) * w, h,2143    0, (.9 + cpyOffset) * h).close());2144  geo.spot1 = new go.Spot(.25, .5);2145  geo.spot2 = new go.Spot(.75, .97);2146  return geo;2147});2148go.Shape.defineFigureGenerator("Cone2", function(shape, w, h) {2149  var geo = new go.Geometry();2150  var fig = new go.PathFigure(0, .9 * h, true);2151  geo.add(fig);2152  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .9 * h, (1 - .85 / .9) * w, h,2153    (.85 / .9) * w, h));2154  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));2155  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .9 * h).close());2156  var fig2 = new go.PathFigure(0, .9 * h, false);2157  geo.add(fig2);2158  fig2.add(new go.PathSegment(go.PathSegment.Bezier, w, .9 * h, (1 - .85 / .9) * w, .8 * h,2159    (.85 / .9) * w, .8 * h));2160  geo.spot1 = new go.Spot(.25, .5);2161  geo.spot2 = new go.Spot(.75, .82);2162  return geo;2163});2164go.Shape.defineFigureGenerator("Cube1", function(shape, w, h) {2165  var geo = new go.Geometry();2166  var fig = new go.PathFigure(.5 * w, h, true);2167  geo.add(fig);2168  fig.add(new go.PathSegment(go.PathSegment.Line, w, .85 * h));2169  fig.add(new go.PathSegment(go.PathSegment.Line, w, .15 * h));2170  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));2171  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .15 * h));2172  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .85 * h).close());2173  var fig2 = new go.PathFigure(.5 * w, h, false);2174  geo.add(fig2);2175  fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .3 * h));2176  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, .15 * h));2177  fig2.add(new go.PathSegment(go.PathSegment.Move, .5 * w, .3 * h));2178  fig2.add(new go.PathSegment(go.PathSegment.Line, w, .15 * h));2179  geo.spot1 = new go.Spot(0, .3);2180  geo.spot2 = new go.Spot(.5, .85);2181  return geo;2182});2183go.Shape.defineFigureGenerator("Cube2", function(shape, w, h) {2184  var geo = new go.Geometry();2185  var fig = new go.PathFigure(0, .3 * h, true);2186  geo.add(fig);2187  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));2188  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h));2189  fig.add(new go.PathSegment(go.PathSegment.Line, w, .7 * h));2190  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));2191  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 0).close());2192  var fig2 = new go.PathFigure(0, .3 * h, false);2193  geo.add(fig2);2194  fig2.add(new go.PathSegment(go.PathSegment.Line, .7 * w, .3 * h));2195  fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0));2196  fig2.add(new go.PathSegment(go.PathSegment.Move, .7 * w, .3 * h));2197  fig2.add(new go.PathSegment(go.PathSegment.Line, .7 * w, h));2198  geo.spot1 = new go.Spot(0, .3);2199  geo.spot2 = new go.Spot(.7, 1);2200  return geo;2201});2202go.Shape.defineFigureGenerator("Cylinder1", function(shape, w, h) {2203  var param1 = shape ? shape.parameter1 : NaN;  // half the height of the ellipse2204  if (isNaN(param1)) param1 = 5; // default value2205  param1 = Math.min(param1, h / 3);2206  var geo = new go.Geometry();2207  var cpxOffset = KAPPA * .5;2208  var fig = new go.PathFigure(0, param1, true);2209  geo.add(fig);2210  // The base (top)2211  fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, 0, 0, KAPPA * param1,2212    (.5 - cpxOffset) * w, 0));2213  fig.add(new go.PathSegment(go.PathSegment.Bezier, 1.0 * w, param1, (.5 + cpxOffset) * w, 0,2214    1.0 * w, KAPPA * param1));2215  fig.add(new go.PathSegment(go.PathSegment.Line, w, h - param1));2216  // Bottom curve2217  fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, 1.0 * h, 1.0 * w, h - KAPPA * param1,2218    (.5 + cpxOffset) * w, 1.0 * h));2219  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, h - param1, (.5 - cpxOffset) * w, 1.0 * h,2220    0, h - KAPPA * param1));2221  fig.add(new go.PathSegment(go.PathSegment.Line, 0, param1));2222  var fig2 = new go.PathFigure(w, param1, false);2223  geo.add(fig2);2224  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, 2 * param1, 1.0 * w, 2 * param1 - KAPPA * param1,2225    (.5 + cpxOffset) * w, 2 * param1));2226  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0, param1, (.5 - cpxOffset) * w, 2 * param1,2227    0, 2 * param1 - KAPPA * param1));2228  geo.spot1 = new go.Spot(0, 0, 0, 2 * param1);2229  geo.spot2 = new go.Spot(1, 1);2230  return geo;2231});2232go.Shape.defineFigureGenerator("Cylinder2", function(shape, w, h) {2233  var param1 = shape ? shape.parameter1 : NaN;  // half the height of the ellipse2234  if (isNaN(param1)) param1 = 5; // default value2235  param1 = Math.min(param1, h / 3);2236  var geo = new go.Geometry();2237  var cpxOffset = KAPPA * .5;2238  var fig = new go.PathFigure(0, h - param1, true);2239  geo.add(fig);2240  // The body, starting and ending bottom left2241  fig.add(new go.PathSegment(go.PathSegment.Line, 0, param1));2242  fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, 0, 0, KAPPA * param1,2243    (.5 - cpxOffset) * w, 0));2244  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, param1, (.5 + cpxOffset) * w, 0,2245    w, KAPPA * param1));2246  fig.add(new go.PathSegment(go.PathSegment.Line, w, h - param1));2247  fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, h, w, h - KAPPA * param1,2248    (.5 + cpxOffset) * w, h));2249  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, h - param1, (.5 - cpxOffset) * w, h,2250    0, h - KAPPA * param1));2251  var fig2 = new go.PathFigure(0, h - param1, false);2252  geo.add(fig2);2253  // The base (bottom)2254  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, h - 2 * param1, 0, h - param1 - KAPPA * param1,2255    (.5 - cpxOffset) * w, h - 2 * param1));2256  fig2.add(new go.PathSegment(go.PathSegment.Bezier, w, h - param1, (.5 + cpxOffset) * w, h - 2 * param1,2257    w, h - param1 - KAPPA * param1));2258  geo.spot1 = new go.Spot(0, 0);2259  geo.spot2 = new go.Spot(1, 1, 0, -2 * param1);2260  return geo;2261});2262go.Shape.defineFigureGenerator("Cylinder3", function(shape, w, h) {2263  var param1 = shape ? shape.parameter1 : NaN;  // half the width of the ellipse2264  if (isNaN(param1)) param1 = 5; // default value2265  param1 = Math.min(param1, w / 3);2266  var geo = new go.Geometry();2267  var cpyOffset = KAPPA * .5;2268  var fig = new go.PathFigure(param1, 0, true);2269  geo.add(fig);2270  // The body, starting and ending top left2271  fig.add(new go.PathSegment(go.PathSegment.Line, w - param1, 0));2272  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, w - KAPPA * param1, 0,2273    w, (.5 - cpyOffset) * h));2274  fig.add(new go.PathSegment(go.PathSegment.Bezier, w - param1, h, w, (.5 + cpyOffset) * h,2275    w - KAPPA * param1, h));2276  fig.add(new go.PathSegment(go.PathSegment.Line, param1, h));2277  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .5 * h, KAPPA * param1, h,2278    0, (.5 + cpyOffset) * h));2279  fig.add(new go.PathSegment(go.PathSegment.Bezier, param1, 0, 0, (.5 - cpyOffset) * h,2280    KAPPA * param1, 0));2281  var fig2 = new go.PathFigure(param1, 0, false);2282  geo.add(fig2);2283  // Cylinder line (left)2284  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 2 * param1, .5 * h, param1 + KAPPA * param1, 0,2285    2 * param1, (.5 - cpyOffset) * h));2286  fig2.add(new go.PathSegment(go.PathSegment.Bezier, param1, h, 2 * param1, (.5 + cpyOffset) * h,2287    param1 + KAPPA * param1, h));2288  geo.spot1 = new go.Spot(0, 0, 2 * param1, 0);2289  geo.spot2 = new go.Spot(1, 1);2290  return geo;2291});2292go.Shape.defineFigureGenerator("Cylinder4", function(shape, w, h) {2293  var param1 = shape ? shape.parameter1 : NaN;  // half the width of the ellipse2294  if (isNaN(param1)) param1 = 5; // default value2295  param1 = Math.min(param1, w / 3);2296  var geo = new go.Geometry();2297  var cpyOffset = KAPPA * .5;2298  var fig = new go.PathFigure(w - param1, 0, true);2299  geo.add(fig);2300  // The body, starting and ending top right2301  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, w - KAPPA * param1, 0,2302    w, (.5 - cpyOffset) * h));2303  fig.add(new go.PathSegment(go.PathSegment.Bezier, w - param1, h, w, (.5 + cpyOffset) * h,2304    w - KAPPA * param1, h));2305  fig.add(new go.PathSegment(go.PathSegment.Line, param1, h));2306  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .5 * h, KAPPA * param1, h,2307    0, (.5 + cpyOffset) * h));2308  fig.add(new go.PathSegment(go.PathSegment.Bezier, param1, 0, 0, (.5 - cpyOffset) * h,2309    KAPPA * param1, 0));2310  fig.add(new go.PathSegment(go.PathSegment.Line, w - param1, 0));2311  var fig2 = new go.PathFigure(w - param1, 0, false);2312  geo.add(fig2);2313  // Cylinder line (right)2314  fig2.add(new go.PathSegment(go.PathSegment.Bezier, w - 2 * param1, .5 * h, w - param1 - KAPPA * param1, 0,2315    w - 2 * param1, (.5 - cpyOffset) * h));2316  fig2.add(new go.PathSegment(go.PathSegment.Bezier, w - param1, h, w - 2 * param1, (.5 + cpyOffset) * h,2317    w - param1 - KAPPA * param1, h));2318  geo.spot1 = new go.Spot(0, 0);2319  geo.spot2 = new go.Spot(1, 1, -2 * param1, 0);2320  return geo;2321});2322go.Shape.defineFigureGenerator("Prism1", function(shape, w, h) {2323  var geo = new go.Geometry();2324  var fig = new go.PathFigure(.25 * w, .25 * h, true);2325  geo.add(fig);2326  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));2327  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));2328  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));2329  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());2330  var fig2 = new go.PathFigure(.25 * w, .25 * h, false);2331  geo.add(fig2);2332  // Inner prism line2333  fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));2334  geo.spot1 = new go.Spot(.408, .172);2335  geo.spot2 = new go.Spot(.833, .662);2336  return geo;2337});2338go.Shape.defineFigureGenerator("Prism2", function(shape, w, h) {2339  var geo = new go.Geometry();2340  var fig = new go.PathFigure(0, .25 * h, true);2341  geo.add(fig);2342  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));2343  fig.add(new go.PathSegment(go.PathSegment.Line, w, .25 * h));2344  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, .75 * h));2345  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());2346  var fig2 = new go.PathFigure(0, h, false);2347  geo.add(fig2);2348  // Inner prism lines2349  fig2.add(new go.PathSegment(go.PathSegment.Line, .25 * w, .5 * h));2350  fig2.add(new go.PathSegment(go.PathSegment.Line, w, .25 * h));2351  fig2.add(new go.PathSegment(go.PathSegment.Move, 0, .25 * h));2352  fig2.add(new go.PathSegment(go.PathSegment.Line, .25 * w, .5 * h));2353  geo.spot1 = new go.Spot(.25, .5);2354  geo.spot2 = new go.Spot(.75, .75);2355  return geo;2356});2357go.Shape.defineFigureGenerator("Pyramid1", function(shape, w, h) {2358  var geo = new go.Geometry();2359  var fig = new go.PathFigure(.5 * w, 0, true);2360  geo.add(fig);2361  fig.add(new go.PathSegment(go.PathSegment.Line, w, .75 * h));2362  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));2363  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .75 * h).close());2364  var fig2 = new go.PathFigure(.5 * w, 0, false);2365  geo.add(fig2);2366  // Inner pyramind line2367  fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));2368  geo.spot1 = new go.Spot(.25, .367);2369  geo.spot2 = new go.Spot(.75, .875);2370  return geo;2371});2372go.Shape.defineFigureGenerator("Pyramid2", function(shape, w, h) {2373  var geo = new go.Geometry();2374  var fig = new go.PathFigure(.5 * w, 0, true);2375  geo.add(fig);2376  fig.add(new go.PathSegment(go.PathSegment.Line, w, .85 * h));2377  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));2378  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .85 * h).close());2379  var fig2 = new go.PathFigure(.5 * w, 0, false);2380  geo.add(fig2);2381  // Inner pyramid lines2382  fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .7 * h));2383  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, .85 * h));2384  fig2.add(new go.PathSegment(go.PathSegment.Move, .5 * w, .7 * h));2385  fig2.add(new go.PathSegment(go.PathSegment.Line, w, .85 * h));2386  geo.spot1 = new go.Spot(.25, .367);2387  geo.spot2 = new go.Spot(.75, .875);2388  return geo;2389});2390go.Shape.defineFigureGenerator("Actor", function(shape, w, h) {2391  var geo = new go.Geometry();2392  var radiusw = .2;2393  var radiush = .1;2394  var offsetw = KAPPA * radiusw;2395  var offseth = KAPPA * radiush;2396  var centerx = .5;2397  var centery = .1;2398  var fig = new go.PathFigure(centerx * w, (centery + radiush) * h, true);2399  geo.add(fig);2400  // Head2401  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radiusw) * w, centery * h, (centerx - offsetw) * w, (centery + radiush) * h,2402  (centerx - radiusw) * w, (centery + offseth) * h));2403  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radiush) * h, (centerx - radiusw) * w, (centery - offseth) * h,2404  (centerx - offsetw) * w, (centery - radiush) * h));2405  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radiusw) * w, centery * h, (centerx + offsetw) * w, (centery - radiush) * h,2406  (centerx + radiusw) * w, (centery - offseth) * h));2407  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radiush) * h, (centerx + radiusw) * w, (centery + offseth) * h,2408  (centerx + offsetw) * w, (centery + radiush) * h));2409  var r = .05;2410  var cpOffset = KAPPA * r;2411  centerx = .05;2412  centery = .25;2413  var fig2 = new go.PathFigure(.5 * w, .2 * h, true);2414  geo.add(fig2);2415  // Body2416  fig2.add(new go.PathSegment(go.PathSegment.Line, .95 * w, .2 * h));2417  centerx = .95;2418  centery = .25;2419  // Right arm2420  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + r) * w, centery * h, (centerx + cpOffset) * w, (centery - r) * h,2421  (centerx + r) * w, (centery - cpOffset) * h));2422  fig2.add(new go.PathSegment(go.PathSegment.Line, w, .6 * h));2423  fig2.add(new go.PathSegment(go.PathSegment.Line, .85 * w, .6 * h));2424  fig2.add(new go.PathSegment(go.PathSegment.Line, .85 * w, .35 * h));2425  r = .025;2426  cpOffset = KAPPA * r;2427  centerx = .825;2428  centery = .35;2429  // Right under arm2430  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - r) * h, (centerx + r) * w, (centery - cpOffset) * h,2431  (centerx + cpOffset) * w, (centery - r) * h));2432  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - r) * w, centery * h, (centerx - cpOffset) * w, (centery - r) * h,2433  (centerx - r) * w, (centery - cpOffset) * h));2434  // Right side/leg2435  fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, h));2436  fig2.add(new go.PathSegment(go.PathSegment.Line, .55 * w, h));2437  fig2.add(new go.PathSegment(go.PathSegment.Line, .55 * w, .7 * h));2438  // Right in between2439  r = .05;2440  cpOffset = KAPPA * r;2441  centerx = .5;2442  centery = .7;2443  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - r) * h, (centerx + r) * w, (centery - cpOffset) * h,2444  (centerx + cpOffset) * w, (centery - r) * h));2445  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - r) * w, centery * h, (centerx - cpOffset) * w, (centery - r) * h,2446  (centerx - r) * w, (centery - cpOffset) * h));2447  // Left side/leg2448  fig2.add(new go.PathSegment(go.PathSegment.Line, .45 * w, h));2449  fig2.add(new go.PathSegment(go.PathSegment.Line, .2 * w, h));2450  fig2.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .35 * h));2451  r = .025;2452  cpOffset = KAPPA * r;2453  centerx = .175;2454  centery = .35;2455  // Left under arm2456  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - r) * h, (centerx + r) * w, (centery - cpOffset) * h,2457  (centerx + cpOffset) * w, (centery - r) * h));2458  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - r) * w, centery * h, (centerx - cpOffset) * w, (centery - r) * h,2459  (centerx - r) * w, (centery - cpOffset) * h));2460  // Left arm2461  fig2.add(new go.PathSegment(go.PathSegment.Line, .15 * w, .6 * h));2462  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, .6 * h));2463  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, .25 * h));2464  r = .05;2465  cpOffset = KAPPA * r;2466  centerx = .05;2467  centery = .25;2468  // Left shoulder2469  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - r) * h, (centerx - r) * w, (centery - cpOffset) * h,2470  (centerx - cpOffset) * w, (centery - r) * h));2471  fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .2 * h));2472  geo.spot1 = new go.Spot(.2, .2);2473  geo.spot2 = new go.Spot(.8, .65);2474  return geo;2475});2476go.Shape.setFigureParameter("Card", 0, new FigureParameter("CornerCutoutSize", .2, .1, .9));2477go.Shape.defineFigureGenerator("Card", function(shape, w, h) {2478  var param1 = shape ? shape.parameter1 : NaN; // size of corner cutout2479  if (isNaN(param1)) param1 = .2;2480  var geo = new go.Geometry();2481  var fig = new go.PathFigure(w, 0, true);2482  geo.add(fig);2483  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));2484  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));2485  fig.add(new go.PathSegment(go.PathSegment.Line, 0, param1 * h));2486  fig.add(new go.PathSegment(go.PathSegment.Line, param1 * w, 0).close());2487  geo.spot1 = new go.Spot(0, param1);2488  geo.spot2 = go.Spot.BottomRight;2489  return geo;2490});2491go.Shape.defineFigureGenerator("Collate", function(shape, w, h) {2492  var geo = new go.Geometry();2493  var fig = new go.PathFigure(.5 * w, .5 * h, true);2494  geo.add(fig);2495  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));2496  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));2497  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h));2498  var fig2 = new go.PathFigure(.5 * w, .5 * h, true);2499  geo.add(fig2);2500  fig2.add(new go.PathSegment(go.PathSegment.Line, w, h));2501  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, h));2502  fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h));2503  geo.spot1 = new go.Spot(.25, 0);2504  geo.spot2 = new go.Spot(.75, .25);2505  return geo;2506});2507go.Shape.defineFigureGenerator("CreateRequest", function(shape, w, h) {2508  var geo = new go.Geometry();2509  var param1 = shape ? shape.parameter1 : NaN;2510  if (isNaN(param1)) param1 = .1;2511  var fig = new go.PathFigure(0, 0, true);2512  geo.add(fig);2513  // Body2514  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));2515  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));2516  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());2517  var fig2 = new go.PathFigure(0, param1 * h, false);2518  geo.add(fig2);2519  // Inside lines2520  fig2.add(new go.PathSegment(go.PathSegment.Line, w, param1 * h));2521  fig2.add(new go.PathSegment(go.PathSegment.Move, 0, (1 - param1) * h));2522  fig2.add(new go.PathSegment(go.PathSegment.Line, w, (1 - param1) * h));2523  //??? geo.spot1 = new go.Spot(0, param1);2524  //??? geo.spot2 = new go.Spot(1, 1 - param1);2525  return geo;2526});2527go.Shape.defineFigureGenerator("Database", function(shape, w, h) {2528  var geo = new go.Geometry();2529  var cpxOffset = KAPPA * .5;2530  var cpyOffset = KAPPA * .1;2531  var fig = new go.PathFigure(w, .1 * h, true);2532  geo.add(fig);2533  // Body2534  fig.add(new go.PathSegment(go.PathSegment.Line, w, .9 * h));2535  fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, h, w, (.9 + cpyOffset) * h,2536    (.5 + cpxOffset) * w, h));2537  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .9 * h, (.5 - cpxOffset) * w, h,2538    0, (.9 + cpyOffset) * h));2539  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .1 * h));2540  fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, 0, 0, (.1 - cpyOffset) * h,2541    (.5 - cpxOffset) * w, 0));2542  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .1 * h, (.5 + cpxOffset) * w, 0,2543    w, (.1 - cpyOffset) * h));2544  var fig2 = new go.PathFigure(w, .1 * h, false);2545  geo.add(fig2);2546  // Rings2547  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .2 * h, w, (.1 + cpyOffset) * h,2548    (.5 + cpxOffset) * w, .2 * h));2549  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0, .1 * h, (.5 - cpxOffset) * w, .2 * h,2550    0, (.1 + cpyOffset) * h));2551  fig2.add(new go.PathSegment(go.PathSegment.Move, w, .2 * h));2552  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .3 * h, w, (.2 + cpyOffset) * h,2553    (.5 + cpxOffset) * w, .3 * h));2554  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0, .2 * h, (.5 - cpxOffset) * w, .3 * h,2555    0, (.2 + cpyOffset) * h));2556  fig2.add(new go.PathSegment(go.PathSegment.Move, w, .3 * h));2557  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .4 * h, w, (.3 + cpyOffset) * h,2558    (.5 + cpxOffset) * w, .4 * h));2559  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0, .3 * h, (.5 - cpxOffset) * w, .4 * h,2560    0, (.3 + cpyOffset) * h));2561  geo.spot1 = new go.Spot(0, .4);2562  geo.spot2 = new go.Spot(1, .9);2563  return geo;2564});2565go.Shape.defineFigureGenerator("DataStorage", function(shape, w, h) {2566  var geo = new go.Geometry();2567  var fig = new go.PathFigure(0, 0, true);2568  geo.add(fig);2569  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));2570  fig.add(new go.PathSegment(go.PathSegment.Bezier, .75 * w, h, w, 0, w, h));2571  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));2572  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0, .25 * w, .9 * h, .25 * w, .1 * h).close());2573  geo.spot1 = new go.Spot(.226, 0);2574  geo.spot2 = new go.Spot(.81, 1);2575  return geo;2576});2577go.Shape.defineFigureGenerator("DiskStorage", function(shape, w, h) {2578  var geo = new go.Geometry();2579  var cpxOffset = KAPPA * .5;2580  var cpyOffset = KAPPA * .1;2581  var fig = new go.PathFigure(w, .1 * h, true);2582  geo.add(fig);2583  // Body2584  fig.add(new go.PathSegment(go.PathSegment.Line, w, .9 * h));2585  fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, h, w, (.9 + cpyOffset) * h,2586    (.5 + cpxOffset) * w, h));2587  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .9 * h, (.5 - cpxOffset) * w, h,2588    0, (.9 + cpyOffset) * h));2589  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .1 * h));2590  fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, 0, 0, (.1 - cpyOffset) * h,2591    (.5 - cpxOffset) * w, 0));2592  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .1 * h, (.5 + cpxOffset) * w, 0,2593    w, (.1 - cpyOffset) * h));2594  var fig2 = new go.PathFigure(w, .1 * h, false);2595  geo.add(fig2);2596  // Rings2597  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .2 * h, w, (.1 + cpyOffset) * h,2598    (.5 + cpxOffset) * w, .2 * h));2599  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0, .1 * h, (.5 - cpxOffset) * w, .2 * h,2600    0, (.1 + cpyOffset) * h));2601  fig2.add(new go.PathSegment(go.PathSegment.Move, w, .2 * h));2602  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .3 * h, w, (.2 + cpyOffset) * h,2603    (.5 + cpxOffset) * w, .3 * h));2604  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0, .2 * h, (.5 - cpxOffset) * w, .3 * h,2605    0, (.2 + cpyOffset) * h));2606  geo.spot1 = new go.Spot(0, .3);2607  geo.spot2 = new go.Spot(1, .9);2608  return geo;2609});2610go.Shape.defineFigureGenerator("Display", function(shape, w, h) {2611  var geo = new go.Geometry();2612  var fig = new go.PathFigure(.25 * w, 0, true);2613  geo.add(fig);2614  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));2615  fig.add(new go.PathSegment(go.PathSegment.Bezier, .75 * w, h, w, 0, w, h));2616  fig.add(new go.PathSegment(go.PathSegment.Line, .25 * w, h));2617  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h).close());2618  geo.spot1 = new go.Spot(.25, 0);2619  geo.spot2 = new go.Spot(.75, 1);2620  return geo;2621});2622go.Shape.defineFigureGenerator("DividedEvent", function(shape, w, h) {2623  var geo = new go.Geometry();2624  var param1 = shape ? shape.parameter1 : NaN;2625  if (isNaN(param1)) param1 = .2;2626  else if (param1 < .15) param1 = .15; // Minimum2627  var cpOffset = KAPPA * .2;2628  var fig = new go.PathFigure(0, .2 * h, true);2629  geo.add(fig);2630  fig.add(new go.PathSegment(go.PathSegment.Bezier, .2 * w, 0, 0, (.2 - cpOffset) * h,2631    (.2 - cpOffset) * w, 0));2632  fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, 0));2633  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .2 * h, (.8 + cpOffset) * w, 0,2634    w, (.2 - cpOffset) * h));2635  fig.add(new go.PathSegment(go.PathSegment.Line, w, .8 * h));2636  fig.add(new go.PathSegment(go.PathSegment.Bezier, .8 * w, h, w, (.8 + cpOffset) * h,2637    (.8 + cpOffset) * w, h));2638  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, h));2639  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .8 * h, (.2 - cpOffset) * w, h,2640    0, (.8 + cpOffset) * h));2641  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .2 * h));2642  var fig2 = new go.PathFigure(0, param1 * h, false);2643  geo.add(fig2);2644  fig2.add(new go.PathSegment(go.PathSegment.Line, w, param1 * h));2645  //??? geo.spot1 = new go.Spot(0, param1);2646  //??? geo.spot2 = new go.Spot(1, 1 - param1);2647  return geo;2648});2649go.Shape.defineFigureGenerator("DividedProcess", function(shape, w, h) {2650  var geo = new go.Geometry();2651  var param1 = shape ? shape.parameter1 : NaN;2652  if (isNaN(param1) || param1 < .1) param1 = .1; // Minimum2653  var fig = new go.PathFigure(0, 0, true);2654  geo.add(fig);2655  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));2656  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));2657  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());2658  var fig2 = new go.PathFigure(0, param1 * h, false);2659  geo.add(fig2);2660  fig2.add(new go.PathSegment(go.PathSegment.Line, w, param1 * h));2661  //??? geo.spot1 = new go.Spot(0, param1);2662  //??? geo.spot2 = go.Spot.BottomRight;2663  return geo;2664});2665go.Shape.defineFigureGenerator("Document", function(shape, w, h) {2666  var geo = new go.Geometry();2667  h = h / .8;2668  var fig = new go.PathFigure(0, .7 * h, true);2669  geo.add(fig);2670  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));2671  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));2672  fig.add(new go.PathSegment(go.PathSegment.Line, w, .7 * h));2673  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .7 * h, .5 * w, .4 * h, .5 * w, h).close());2674  geo.spot1 = go.Spot.TopLeft;2675  geo.spot2 = new go.Spot(1, .6);2676  return geo;2677});2678go.Shape.defineFigureGenerator("ExternalOrganization", function(shape, w, h) {2679  var geo = new go.Geometry();2680  var param1 = shape ? shape.parameter1 : NaN;2681  if (isNaN(param1) || param1 < .2) param1 = .2; // Minimum2682  var fig = new go.PathFigure(0, 0, true);2683  geo.add(fig);2684  // Body2685  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));2686  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));2687  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());2688  var fig2 = new go.PathFigure(param1 * w, 0, false);2689  geo.add(fig2);2690  // Top left triangle2691  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, param1 * h));2692  // Top right triangle2693  fig2.add(new go.PathSegment(go.PathSegment.Move, w, param1 * h));2694  fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, 0));2695  // Bottom left triangle2696  fig2.add(new go.PathSegment(go.PathSegment.Move, 0, (1 - param1) * h));2697  fig2.add(new go.PathSegment(go.PathSegment.Line, param1 * w, h));2698  // Bottom right triangle2699  fig2.add(new go.PathSegment(go.PathSegment.Move, (1 - param1) * w, h));2700  fig2.add(new go.PathSegment(go.PathSegment.Line, w, (1 - param1) * h));2701  //??? geo.spot1 = new go.Spot(param1 / 2, param1 / 2);2702  //??? geo.spot2 = new go.Spot(1 - param1 / 2, 1 - param1 / 2);2703  return geo;2704});2705go.Shape.defineFigureGenerator("ExternalProcess", function(shape, w, h) {2706  var geo = new go.Geometry();2707  var fig = new go.PathFigure(.5 * w, 0, true);2708  geo.add(fig);2709  // Body2710  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));2711  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));2712  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h).close());2713  var fig2 = new go.PathFigure(.1 * w, .4 * h, false);2714  geo.add(fig2);2715  // Top left triangle2716  fig2.add(new go.PathSegment(go.PathSegment.Line, .1 * w, .6 * h));2717  // Top right triangle2718  fig2.add(new go.PathSegment(go.PathSegment.Move, .9 * w, .6 * h));2719  fig2.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .4 * h));2720  // Bottom left triangle2721  fig2.add(new go.PathSegment(go.PathSegment.Move, .6 * w, .1 * h));2722  fig2.add(new go.PathSegment(go.PathSegment.Line, .4 * w, .1 * h));2723  // Bottom right triangle2724  fig2.add(new go.PathSegment(go.PathSegment.Move, .4 * w, .9 * h));2725  fig2.add(new go.PathSegment(go.PathSegment.Line, .6 * w, .9 * h));2726  geo.spot1 = new go.Spot(.25, .25);2727  geo.spot2 = new go.Spot(.75, .75);2728  return geo;2729});2730go.Shape.defineFigureGenerator("File", function(shape, w, h) {2731  var geo = new go.Geometry();2732  var fig = new go.PathFigure(0, 0, true); // starting point2733  geo.add(fig);2734  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));2735  fig.add(new go.PathSegment(go.PathSegment.Line, w, .25 * h));2736  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));2737  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());2738  var fig2 = new go.PathFigure(.75 * w, 0, false);2739  geo.add(fig2);2740  // The Fold2741  fig2.add(new go.PathSegment(go.PathSegment.Line, .75 * w, .25 * h));2742  fig2.add(new go.PathSegment(go.PathSegment.Line, w, .25 * h));2743  geo.spot1 = new go.Spot(0, .25);2744  geo.spot2 = go.Spot.BottomRight;2745  return geo;2746});2747go.Shape.defineFigureGenerator("Interrupt", function(shape, w, h) {2748  var geo = new go.Geometry();2749  var fig = new go.PathFigure(w, .5 * h, true);2750  geo.add(fig);2751  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));2752  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));2753  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));2754  var fig2 = new go.PathFigure(w, .5 * h, false);2755  geo.add(fig2);2756  fig2.add(new go.PathSegment(go.PathSegment.Line, w, h));2757  var fig3 = new go.PathFigure(w, .5 * h, false);2758  geo.add(fig3);2759  fig3.add(new go.PathSegment(go.PathSegment.Line, w, 0));2760  geo.spot1 = new go.Spot(0, .25);2761  geo.spot2 = new go.Spot(.5, .75);2762  return geo;2763});2764go.Shape.defineFigureGenerator("InternalStorage", function(shape, w, h) {2765  var geo = new go.Geometry();2766  var param1 = shape ? shape.parameter1 : NaN;2767  var param2 = shape ? shape.parameter2 : NaN;2768  if (isNaN(param1)) param1 = .1; // Distance from left2769  if (isNaN(param2)) param2 = .1; // Distance from top2770  var fig = new go.PathFigure(0, 0, true);2771  geo.add(fig);2772  // The main body2773  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));2774  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));2775  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());2776  var fig2 = new go.PathFigure(param1 * w, 0, false);2777  geo.add(fig2);2778  // Two lines2779  fig2.add(new go.PathSegment(go.PathSegment.Line, param1 * w, h));2780  fig2.add(new go.PathSegment(go.PathSegment.Move, 0, param2 * h));2781  fig2.add(new go.PathSegment(go.PathSegment.Line, w, param2 * h));2782  //??? geo.spot1 = new go.Spot(param1, param2);2783  //??? geo.spot2 = go.Spot.BottomRight;2784  return geo;2785});2786go.Shape.defineFigureGenerator("Junction", function(shape, w, h) {2787  var geo = new go.Geometry();2788  var dist = (1 / Math.SQRT2);2789  var small = ((1 - 1 / Math.SQRT2) / 2);2790  var cpOffset = KAPPA * .5;2791  var radius = .5;2792  var fig = new go.PathFigure(w, radius * h, true);2793  geo.add(fig);2794  // Circle2795  fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, h, w, (radius + cpOffset) * h,2796    (radius + cpOffset) * w, h));2797  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, radius * h, (radius - cpOffset) * w, h,2798    0, (radius + cpOffset) * h));2799  fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, 0, 0, (radius - cpOffset) * h,2800    (radius - cpOffset) * w, 0));2801  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, radius * h, (radius + cpOffset) * w, 0,2802    w, (radius - cpOffset) * h));2803  var fig2 = new go.PathFigure((small + dist) * w, (small + dist) * h, false);2804  geo.add(fig2);2805  // X2806  fig2.add(new go.PathSegment(go.PathSegment.Line, small * w, small * h));2807  fig2.add(new go.PathSegment(go.PathSegment.Move, small * w, (small + dist) * h));2808  fig2.add(new go.PathSegment(go.PathSegment.Line, (small + dist) * w, small * h));2809  return geo;2810});2811go.Shape.defineFigureGenerator("LinedDocument", function(shape, w, h) {2812  var geo = new go.Geometry();2813  h = h / .8;2814  var fig = new go.PathFigure(0, .7 * h, true);2815  geo.add(fig);2816  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));2817  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));2818  fig.add(new go.PathSegment(go.PathSegment.Line, w, .7 * h));2819  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .7 * h, .5 * w, .4 * h, .5 * w, h).close());2820  var fig2 = new go.PathFigure(.1 * w, 0, false);2821  geo.add(fig2);2822  fig2.add(new go.PathSegment(go.PathSegment.Line, .1 * w, .75 * h));2823  geo.spot1 = new go.Spot(.1, 0);2824  geo.spot2 = new go.Spot(1, .6);2825  return geo;2826});2827go.Shape.defineFigureGenerator("LoopLimit", function(shape, w, h) {2828  var geo = new go.Geometry();2829  var fig = new go.PathFigure(0, h, true);2830  geo.add(fig);2831  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .25 * h));2832  fig.add(new go.PathSegment(go.PathSegment.Line, .25 * w, 0));2833  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));2834  fig.add(new go.PathSegment(go.PathSegment.Line, w, .25 * h));2835  fig.add(new go.PathSegment(go.PathSegment.Line, w, h).close());2836  geo.spot1 = new go.Spot(0, .25);2837  geo.spot2 = go.Spot.BottomRight;2838  return geo;2839});2840go.Shape.defineFigureGenerator("MagneticTape", function(shape, w, h) {2841  var geo = new go.Geometry();2842  var cpOffset = KAPPA * .5;2843  var radius = .5;2844  var fig = new go.PathFigure(.5 * w, h, true);2845  geo.add(fig);2846  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, radius * h, (radius - cpOffset) * w, h,2847               0, (radius + cpOffset) * h));2848  fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, 0, 0, (radius - cpOffset) * h,2849               (radius - cpOffset) * w, 0));2850  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, radius * h, (radius + cpOffset) * w, 0,2851               w, (radius - cpOffset) * h));2852  fig.add(new go.PathSegment(go.PathSegment.Bezier, (radius + .1) * w, .9 * h, w, (radius + cpOffset) * h,2853               (radius + cpOffset) * w, .9 * h));2854  fig.add(new go.PathSegment(go.PathSegment.Line, w, .9 * h));2855  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));2856  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));2857  geo.spot1 = new go.Spot(.15, .15);2858  geo.spot2 = new go.Spot(.85, .8);2859  return geo;2860});2861go.Shape.defineFigureGenerator("ManualInput", function(shape, w, h) {2862  var geo = new go.Geometry();2863  var fig = new go.PathFigure(w, 0, true);2864  geo.add(fig);2865  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));2866  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));2867  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .25 * h).close());2868  geo.spot1 = new go.Spot(0, .25);2869  geo.spot2 = go.Spot.BottomRight;2870  return geo;2871});2872go.Shape.defineFigureGenerator("MessageFromUser", function(shape, w, h) {2873  var geo = new go.Geometry();2874  var param1 = shape ? shape.parameter1 : NaN;2875  if (isNaN(param1)) param1 = .7; // How far from the right the point is2876  var fig = new go.PathFigure(0, 0, true);2877  geo.add(fig);2878  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));2879  fig.add(new go.PathSegment(go.PathSegment.Line, param1 * w, .5 * h));2880  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));2881  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());2882  geo.spot1 = go.Spot.TopLeft;2883  //??? geo.spot2 = new go.Spot(param1, 1);2884  return geo;2885});2886go.Shape.defineFigureGenerator("MicroformProcessing", function(shape, w, h) {2887  var geo = new go.Geometry();2888  var param1 = shape ? shape.parameter1 : NaN;2889  if (isNaN(param1)) param1 = .25; // How far from the top/bottom the points are2890  var fig = new go.PathFigure(0, 0, true);2891  geo.add(fig);2892  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, param1 * h));2893  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));2894  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));2895  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, (1 - param1) * h));2896  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());2897  //??? geo.spot1 = new go.Spot(0, param1);2898  //??? geo.spot2 = new go.Spot(1, 1 - param1);2899  return geo;2900});2901go.Shape.defineFigureGenerator("MicroformRecording", function(shape, w, h) {2902  var geo = new go.Geometry();2903  var fig = new go.PathFigure(0, 0, true);2904  geo.add(fig);2905  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, .25 * h));2906  fig.add(new go.PathSegment(go.PathSegment.Line, w, .15 * h));2907  fig.add(new go.PathSegment(go.PathSegment.Line, w, .85 * h));2908  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, .75 * h));2909  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());2910  geo.spot1 = new go.Spot(0, .25);2911  geo.spot2 = new go.Spot(1, .75);2912  return geo;2913});2914go.Shape.defineFigureGenerator("MultiDocument", function(shape, w, h) {2915  var geo = new go.Geometry();2916  h = h / .8;2917  var fig = new go.PathFigure(w, 0, true);2918  geo.add(fig);2919  // Outline2920  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));2921  fig.add(new go.PathSegment(go.PathSegment.Bezier, .9 * w, .44 * h, .96 * w, .47 * h, .93 * w, .45 * h));2922  fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .6 * h));2923  fig.add(new go.PathSegment(go.PathSegment.Bezier, .8 * w, .54 * h, .86 * w, .57 * h, .83 * w, .55 * h));2924  fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .7 * h));2925  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .7 * h, .4 * w, .4 * h, .4 * w, h));2926  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .2 * h));2927  fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, .2 * h));2928  fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, .1 * h));2929  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .1 * h));2930  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, 0).close());2931  var fig2 = new go.PathFigure(.1 * w, .2 * h, false);2932  geo.add(fig2);2933  // Inside lines2934  fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .2 * h));2935  fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .54 * h));2936  fig2.add(new go.PathSegment(go.PathSegment.Move, .2 * w, .1 * h));2937  fig2.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .1 * h));2938  fig2.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .44 * h));2939  geo.spot1 = new go.Spot(0, .25);2940  geo.spot2 = new go.Spot(.8, .77);2941  return geo;2942});2943go.Shape.defineFigureGenerator("MultiProcess", function(shape, w, h) {2944  var geo = new go.Geometry();2945  var fig = new go.PathFigure(.1 * w, .1 * h, true);2946  geo.add(fig);2947  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .1 * h));2948  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, 0));2949  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));2950  fig.add(new go.PathSegment(go.PathSegment.Line, w, .8 * h));2951  fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .8 * h));2952  fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .9 * h));2953  fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .9 * h));2954  fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, h));2955  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));2956  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .2 * h));2957  fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, .2 * h).close());2958  var fig2 = new go.PathFigure(.2 * w, .1 * h, false);2959  geo.add(fig2);2960  fig2.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .1 * h));2961  fig2.add(new go.PathSegment(go.PathSegment.Line, .9 * w, .8 * h));2962  fig2.add(new go.PathSegment(go.PathSegment.Move, .1 * w, .2 * h));2963  fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .2 * h));2964  fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .9 * h));2965  geo.spot1 = new go.Spot(0, .2);2966  geo.spot2 = new go.Spot(.8, 1);2967  return geo;2968});2969go.Shape.defineFigureGenerator("OfflineStorage", function(shape, w, h) {2970  var geo = new go.Geometry();2971  var param1 = shape ? shape.parameter1 : NaN;2972  if (isNaN(param1)) param1 = .1; // Distance between 2 top lines2973  var l = 1 - param1; // Length of the top line2974  var fig = new go.PathFigure(0, 0, true);2975  geo.add(fig);2976  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));2977  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h).close());2978  var fig2 = new go.PathFigure(.5 * param1 * w, param1 * h, false);2979  geo.add(fig2);2980  fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - .5 * param1) * w, param1 * h));2981  //??? geo.spot1 = new go.Spot(l / 4 + .5 * param1, param1);2982  //??? geo.spot2 = new go.Spot(3 * l / 4 + .5 * param1, param1 + .5 * l);2983  return geo;2984});2985go.Shape.defineFigureGenerator("OffPageConnector", function(shape, w, h) {2986  var geo = new go.Geometry();2987  var fig = new go.PathFigure(0, 0, true);2988  geo.add(fig);2989  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, 0));2990  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));2991  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, h));2992  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());2993  geo.spot1 = go.Spot.TopLeft;2994  geo.spot2 = new go.Spot(.75, 1);2995  return geo;2996});2997go.Shape.defineFigureGenerator("Or", function(shape, w, h) {2998  var geo = new go.Geometry();2999  var cpOffset = KAPPA * .5;3000  var radius = .5;3001  var fig = new go.PathFigure(w, radius * h, true);3002  geo.add(fig);3003  // Circle3004  fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, h, w, (radius + cpOffset) * h,3005    (radius + cpOffset) * w, h));3006  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, radius * h, (radius - cpOffset) * w, h,3007    0, (radius + cpOffset) * h));3008  fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, 0, 0, (radius - cpOffset) * h,3009    (radius - cpOffset) * w, 0));3010  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, radius * h, (radius + cpOffset) * w, 0,3011    w, (radius - cpOffset) * h));3012  var fig2 = new go.PathFigure(w, .5 * h, false);3013  geo.add(fig2);3014  // +3015  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h));3016  fig2.add(new go.PathSegment(go.PathSegment.Move, .5 * w, h));3017  fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));3018  return geo;3019});3020go.Shape.defineFigureGenerator("PaperTape", function(shape, w, h) {3021  var geo = new go.Geometry();3022  h = h / .8;3023  var fig = new go.PathFigure(0, .7 * h, true);3024  geo.add(fig);3025  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .3 * h));3026  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .3 * h, .5 * w, .6 * h,3027    .5 * w, 0));3028  fig.add(new go.PathSegment(go.PathSegment.Line, w, .7 * h));3029  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, .7 * h, .5 * w, .4 * h,3030    .5 * w, h).close());3031  geo.spot1 = new go.Spot(0, .49);3032  geo.spot2 = new go.Spot(1, .75);3033  return geo;3034});3035go.Shape.defineFigureGenerator("PrimitiveFromCall", function(shape, w, h) {3036  var geo = new go.Geometry();3037  var param1 = shape ? shape.parameter1 : NaN;3038  var param2 = shape ? shape.parameter2 : NaN;3039  if (isNaN(param1)) param1 = .1; // Distance of left line from left3040  if (isNaN(param2)) param2 = .3; // Distance of point from right3041  var fig = new go.PathFigure(0, 0, true);3042  geo.add(fig);3043  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));3044  fig.add(new go.PathSegment(go.PathSegment.Line, (1 - param2) * w, .5 * h));3045  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));3046  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());3047  //??? geo.spot1 = new go.Spot(param1, 0);3048  //??? geo.spot2 = new go.Spot(1 - param2, 1);3049  return geo;3050});3051go.Shape.defineFigureGenerator("PrimitiveToCall", function(shape, w, h) {3052  var geo = new go.Geometry();3053  var param1 = shape ? shape.parameter1 : NaN;3054  var param2 = shape ? shape.parameter2 : NaN;3055  if (isNaN(param1)) param1 = .1; // Distance of left line from left3056  if (isNaN(param2)) param2 = .3; // Distance of top and bottom right corners from right3057  var fig = new go.PathFigure(0, 0, true);3058  geo.add(fig);3059  fig.add(new go.PathSegment(go.PathSegment.Line, (1 - param2) * w, 0));3060  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));3061  fig.add(new go.PathSegment(go.PathSegment.Line, (1 - param2) * w, h));3062  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());3063  //??? geo.spot1 = new go.Spot(param1, 0);3064  //??? geo.spot2 = new go.Spot(1 - param2, 1);3065  return geo;3066});3067go.Shape.defineFigureGenerator("Procedure", function(shape, w, h) {3068  var geo = new go.Geometry();3069  var param1 = shape ? shape.parameter1 : NaN;3070  // Distance of left  and right lines from edge3071  if (isNaN(param1)) param1 = .1;3072  var fig = new go.PathFigure(0, 0, true);3073  geo.add(fig);3074  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));3075  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));3076  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());3077  var fig2 = new go.PathFigure((1 - param1) * w, 0, false);3078  geo.add(fig2);3079  fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, h));3080  fig2.add(new go.PathSegment(go.PathSegment.Move, param1 * w, 0));3081  fig2.add(new go.PathSegment(go.PathSegment.Line, param1 * w, h));3082  //??? geo.spot1 = new go.Spot(param1, 0);3083  //??? geo.spot2 = new go.Spot(1 - param1, 1);3084  return geo;3085});3086go.Shape.defineFigureGenerator("Process", function(shape, w, h) {3087  var geo = new go.Geometry();3088  var param1 = shape ? shape.parameter1 : NaN;3089  if (isNaN(param1)) param1 = .1; // Distance of left  line from left edge3090  var fig = new go.PathFigure(0, 0, true);3091  geo.add(fig);3092  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));3093  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));3094  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());3095  var fig2 = new go.PathFigure(param1 * w, 0, false);3096  geo.add(fig2);3097  fig2.add(new go.PathSegment(go.PathSegment.Line, param1 * w, h));3098  //??? geo.spot1 = new go.Spot(param1, 0);3099  geo.spot2 = go.Spot.BottomRight;3100  return geo;3101});3102go.Shape.defineFigureGenerator("Sort", function(shape, w, h) {3103  var geo = new go.Geometry();3104  var fig = new go.PathFigure(.5 * w, 0, true);3105  geo.add(fig);3106  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));3107  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));3108  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .5 * h).close());3109  var fig2 = new go.PathFigure(0, .5 * h, false);3110  geo.add(fig2);3111  fig2.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));3112  geo.spot1 = new go.Spot(.25, .25);3113  geo.spot2 = new go.Spot(.75, .5);3114  return geo;3115});3116go.Shape.defineFigureGenerator("Start", function(shape, w, h) {3117  var geo = new go.Geometry();3118  var param1 = shape ? shape.parameter1 : NaN;3119  if (isNaN(param1)) param1 = 0.25;3120  var fig = new go.PathFigure(param1 * w, 0, true);3121  geo.add(fig);3122  fig.add(new go.PathSegment(go.PathSegment.Arc, 270, 180, .75 * w, 0.5 * h, .25 * w, .5 * h));3123  fig.add(new go.PathSegment(go.PathSegment.Arc, 90, 180, .25 * w, 0.5 * h, .25 * w, .5 * h));3124  var fig2 = new go.PathFigure(param1 * w, 0, false);3125  geo.add(fig2);3126  fig2.add(new go.PathSegment(go.PathSegment.Line, param1 * w, h));3127  fig2.add(new go.PathSegment(go.PathSegment.Move, (1 - param1) * w, 0));3128  fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - param1) * w, h));3129  geo.spot1 = new go.Spot(param1, 0);3130  geo.spot2 = new go.Spot((1 - param1), 1);3131  return geo;3132});3133go.Shape.defineFigureGenerator("Terminator", function(shape, w, h) {3134  var geo = new go.Geometry();3135  var fig = new go.PathFigure(.25 * w, 0, true);3136  geo.add(fig);3137  fig.add(new go.PathSegment(go.PathSegment.Arc, 270, 180, .75 * w, 0.5 * h, .25 * w, .5 * h));3138  fig.add(new go.PathSegment(go.PathSegment.Arc, 90, 180, .25 * w, 0.5 * h, .25 * w, .5 * h));3139  geo.spot1 = new go.Spot(.23, 0);3140  geo.spot2 = new go.Spot(.77, 1);3141  return geo;3142});3143go.Shape.defineFigureGenerator("TransmittalTape", function(shape, w, h) {3144  var geo = new go.Geometry();3145  var param1 = shape ? shape.parameter1 : NaN;3146  if (isNaN(param1)) param1 = .1; // Bottom line's distance from the point on the triangle3147  var fig = new go.PathFigure(0, 0, true);3148  geo.add(fig);3149  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));3150  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));3151  fig.add(new go.PathSegment(go.PathSegment.Line, .75 * w, (1 - param1) * h));3152  fig.add(new go.PathSegment(go.PathSegment.Line, 0, (1 - param1) * h).close());3153  geo.spot1 = go.Spot.TopLeft;3154  //??? geo.spot2 = new go.Spot(1, 1 - param1);3155  return geo;3156});3157go.Shape.defineFigureGenerator("AndGate", function(shape, w, h) {3158  var geo = new go.Geometry();3159  var cpOffset = KAPPA * .5;3160  var fig = new go.PathFigure(0, 0, true);3161  geo.add(fig);3162  // The gate body3163  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));3164  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, (.5 + cpOffset) * w, 0,3165    w, (.5 - cpOffset) * h));3166  fig.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, h, w, (.5 + cpOffset) * h,3167    (.5 + cpOffset) * w, h));3168  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());3169  geo.spot1 = go.Spot.TopLeft;3170  geo.spot2 = new go.Spot(.55, 1);3171  return geo;3172});3173go.Shape.defineFigureGenerator("Buffer", function(shape, w, h) {3174  var geo = new go.Geometry();3175  var fig = new go.PathFigure(0, 0, true);3176  geo.add(fig);3177  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));3178  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());3179  geo.spot1 = new go.Spot(0, .25);3180  geo.spot2 = new go.Spot(.5, .75);3181  return geo;3182});3183go.Shape.defineFigureGenerator("Clock", function(shape, w, h) {3184  var geo = new go.Geometry();3185  var cpOffset = KAPPA * .5;3186  var radius = .5;3187  var fig = new go.PathFigure(w, radius * h, true);3188  geo.add(fig);3189  // Ellipse3190  fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, h, w, (radius + cpOffset) * h,3191    (radius + cpOffset) * w, h));3192  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, radius * h, (radius - cpOffset) * w, h,3193    0, (radius + cpOffset) * h));3194  fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, 0, 0, (radius - cpOffset) * h,3195    (radius - cpOffset) * w, 0));3196  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, radius * h, (radius + cpOffset) * w, 0,3197    w, (radius - cpOffset) * h));3198  var fig2 = new go.PathFigure(w, radius * h, false);3199  geo.add(fig2);3200  fig2.add(new go.PathSegment(go.PathSegment.Line, w, radius * h));3201  var fig3 = new go.PathFigure(.8 * w, .75 * h, false);3202  geo.add(fig3);3203  // Inside clock3204  // This first line solves a GDI+ graphical error with3205  // more complex gradient brushes3206  fig3.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .25 * h));3207  fig3.add(new go.PathSegment(go.PathSegment.Line, .6 * w, .25 * h));3208  fig3.add(new go.PathSegment(go.PathSegment.Line, .6 * w, .75 * h));3209  fig3.add(new go.PathSegment(go.PathSegment.Line, .4 * w, .75 * h));3210  fig3.add(new go.PathSegment(go.PathSegment.Line, .4 * w, .25 * h));3211  fig3.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .25 * h));3212  fig3.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .75 * h));3213  return geo;3214});3215go.Shape.defineFigureGenerator("Ground", function(shape, w, h) {3216  var geo = new go.Geometry();3217  var fig = new go.PathFigure(.5 * w, 0, false);3218  geo.add(fig);3219  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .4 * h));3220  fig.add(new go.PathSegment(go.PathSegment.Move, .2 * w, .6 * h));3221  fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .6 * h));3222  fig.add(new go.PathSegment(go.PathSegment.Move, .3 * w, .8 * h));3223  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, .8 * h));3224  fig.add(new go.PathSegment(go.PathSegment.Move, .4 * w, h));3225  fig.add(new go.PathSegment(go.PathSegment.Line, .6 * w, h));3226  return geo;3227});3228go.Shape.defineFigureGenerator("Inverter", function(shape, w, h) {3229  var geo = new go.Geometry();3230  var cpOffset = KAPPA * .1;3231  var radius = .1;3232  var centerx = .9;3233  var centery = .5;3234  var fig = new go.PathFigure(.8 * w, .5 * h, true);3235  geo.add(fig);3236  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));3237  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));3238  fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .5 * h));3239  var fig2 = new go.PathFigure((centerx + radius) * w, centery * h, true);3240  geo.add(fig2);3241  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,3242    (centerx + cpOffset) * w, (centery + radius) * h));3243  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,3244    (centerx - radius) * w, (centery + cpOffset) * h));3245  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,3246    (centerx - cpOffset) * w, (centery - radius) * h));3247  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,3248    (centerx + radius) * w, (centery - cpOffset) * h));3249  geo.spot1 = new go.Spot(0, .25);3250  geo.spot2 = new go.Spot(.4, .75);3251  return geo;3252});3253go.Shape.defineFigureGenerator("NandGate", function(shape, w, h) {3254  var geo = new go.Geometry();3255  var cpxOffset = KAPPA * .5;3256  var cpyOffset = KAPPA * .4;3257  var cpOffset = KAPPA * .1;3258  var radius = .1;3259  var centerx = .9;3260  var centery = .5;3261  var fig = new go.PathFigure(.8 * w, .5 * h, true);3262  geo.add(fig);3263  // The gate body3264  fig.add(new go.PathSegment(go.PathSegment.Bezier, .4 * w, h, .8 * w, (.5 + cpyOffset) * h,3265    (.4 + cpxOffset) * w, h));3266  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));3267  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));3268  fig.add(new go.PathSegment(go.PathSegment.Line, .4 * w, 0));3269  fig.add(new go.PathSegment(go.PathSegment.Bezier, .8 * w, .5 * h, (.4 + cpxOffset) * w, 0,3270    .8 * w, (.5 - cpyOffset) * h));3271  var fig2 = new go.PathFigure((centerx + radius) * w, centery * h, true);3272  geo.add(fig2);3273  // Inversion3274  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,3275    (centerx + cpOffset) * w, (centery + radius) * h));3276  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,3277    (centerx - radius) * w, (centery + cpOffset) * h));3278  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,3279    (centerx - cpOffset) * w, (centery - radius) * h));3280  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, (centery) * h, (centerx + cpOffset) * w, (centery - radius) * h,3281    (centerx + radius) * w, (centery - cpOffset) * h));3282  geo.spot1 = new go.Spot(0, .05);3283  geo.spot2 = new go.Spot(.55, .95);3284  return geo;3285});3286go.Shape.defineFigureGenerator("NorGate", function(shape, w, h) {3287  var geo = new go.Geometry();3288  var radius = .5;3289  var cpOffset = KAPPA * radius;3290  var centerx = 0;3291  var centery = .5;3292  var fig = new go.PathFigure(.8 * w, .5 * h, true);3293  geo.add(fig);3294  // Normal3295  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, h, .7 * w, (centery + cpOffset) * h,3296    (centerx + cpOffset) * w, (centery + radius) * h));3297  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0, .25 * w, .75 * h,3298    .25 * w, .25 * h));3299  fig.add(new go.PathSegment(go.PathSegment.Bezier, .8 * w, .5 * h, (centerx + cpOffset) * w, (centery - radius) * h,3300    .7 * w, (centery - cpOffset) * h));3301  radius = .1;3302  cpOffset = KAPPA * .1;3303  centerx = .9;3304  centery = .5;3305  var fig2 = new go.PathFigure((centerx - radius) * w, centery * h, true);3306  geo.add(fig2);3307  // Inversion3308  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,3309    (centerx - cpOffset) * w, (centery - radius) * h));3310  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,3311    (centerx + radius) * w, (centery - cpOffset) * h));3312  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,3313    (centerx + cpOffset) * w, (centery + radius) * h));3314  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,3315    (centerx - radius) * w, (centery + cpOffset) * h));3316  geo.spot1 = new go.Spot(.2, .25);3317  geo.spot2 = new go.Spot(.6, .75);3318  return geo;3319});3320go.Shape.defineFigureGenerator("OrGate", function(shape, w, h) {3321  var geo = new go.Geometry();3322  var radius = .5;3323  var cpOffset = KAPPA * radius;3324  var centerx = 0;3325  var centery = .5;3326  var fig = new go.PathFigure(0, 0, true);3327  geo.add(fig);3328  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, (centerx + cpOffset + cpOffset) * w, (centery - radius) * h,3329    .8 * w, (centery - cpOffset) * h));3330  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, h, .8 * w, (centery + cpOffset) * h,3331    (centerx + cpOffset + cpOffset) * w, (centery + radius) * h));3332  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0, .25 * w, .75 * h, .25 * w, .25 * h).close());3333  geo.spot1 = new go.Spot(.2, .25);3334  geo.spot2 = new go.Spot(.75, .75);3335  return geo;3336});3337go.Shape.defineFigureGenerator("XnorGate", function(shape, w, h) {3338  var geo = new go.Geometry();3339  var radius = .5;3340  var cpOffset = KAPPA * radius;3341  var centerx = .2;3342  var centery = .5;3343  var fig = new go.PathFigure(.1 * w, 0, false);3344  geo.add(fig);3345  // Normal3346  fig.add(new go.PathSegment(go.PathSegment.Bezier, .1 * w, h, .35 * w, .25 * h, .35 * w, .75 * h));3347  var fig2 = new go.PathFigure(.8 * w, .5 * h, true);3348  geo.add(fig2);3349  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .2 * w, h, .7 * w, (centery + cpOffset) * h,3350    (centerx + cpOffset) * w, (centery + radius) * h));3351  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .2 * w, 0, .45 * w, .75 * h, .45 * w, .25 * h));3352  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .8 * w, .5 * h, (centerx + cpOffset) * w, (centery - radius) * h,3353    .7 * w, (centery - cpOffset) * h));3354  radius = .1;3355  cpOffset = KAPPA * .1;3356  centerx = .9;3357  centery = .5;3358  var fig3 = new go.PathFigure((centerx - radius) * w, centery * h, true);3359  geo.add(fig3);3360  // Inversion3361  fig3.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,3362    (centerx - cpOffset) * w, (centery - radius) * h));3363  fig3.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,3364    (centerx + radius) * w, (centery - cpOffset) * h));3365  fig3.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,3366    (centerx + cpOffset) * w, (centery + radius) * h));3367  fig3.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,3368    (centerx - radius) * w, (centery + cpOffset) * h));3369  geo.spot1 = new go.Spot(.4, .25);3370  geo.spot2 = new go.Spot(.65, .75);3371  return geo;3372});3373go.Shape.defineFigureGenerator("XorGate", function(shape, w, h) {3374  var geo = new go.Geometry();3375  var radius = .5;3376  var cpOffset = KAPPA * radius;3377  var centerx = .2;3378  var centery = .5;3379  var fig = new go.PathFigure(.1 * w, 0, false);3380  geo.add(fig);3381  fig.add(new go.PathSegment(go.PathSegment.Bezier, .1 * w, h, .35 * w, .25 * h, .35 * w, .75 * h));3382  var fig2 = new go.PathFigure(.2 * w, 0, true);3383  geo.add(fig2);3384  fig2.add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, (centerx + cpOffset) * w, (centery - radius) * h,3385    .9 * w, (centery - cpOffset) * h));3386  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .2 * w, h, .9 * w, (centery + cpOffset) * h,3387    (centerx + cpOffset) * w, (centery + radius) * h));3388  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .2 * w, 0, .45 * w, .75 * h, .45 * w, .25 * h).close());3389  geo.spot1 = new go.Spot(.4, .25);3390  geo.spot2 = new go.Spot(.8, .75);3391  return geo;3392});3393go.Shape.defineFigureGenerator("Capacitor", function(shape, w, h) {3394  var geo = new go.Geometry();3395  var fig = new go.PathFigure(0, 0, false);3396  geo.add(fig);3397  // Two vertical lines3398  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));3399  fig.add(new go.PathSegment(go.PathSegment.Move, w, 0));3400  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));3401  return geo;3402});3403go.Shape.defineFigureGenerator("Resistor", function(shape, w, h) {3404  var geo = new go.Geometry();3405  var fig = new go.PathFigure(0, .5 * h, false);3406  geo.add(fig);3407  fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, 0));3408  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, h));3409  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, 0));3410  fig.add(new go.PathSegment(go.PathSegment.Line, .4 * w, h));3411  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));3412  fig.add(new go.PathSegment(go.PathSegment.Line, .6 * w, h));3413  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, .5 * h));3414  return geo;3415});3416go.Shape.defineFigureGenerator("Inductor", function(shape, w, h) {3417  var geo = new go.Geometry();3418  var cpOffset = KAPPA * .1;3419  var radius = .1;3420  var centerx = .1;3421  var centery = .5;3422  // Up3423  var fig = new go.PathFigure((centerx - cpOffset * .5) * w, h, false);3424  geo.add(fig);3425  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, 0, (centerx - cpOffset) * w, h, (centerx - radius) * w, 0));3426  // Down up3427  centerx = .3;3428  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, h, (centerx + radius) * w, 0, (centerx + cpOffset) * w, h));3429  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, 0, (centerx - cpOffset) * w, h, (centerx - radius) * w, 0));3430  // Down up3431  centerx = .5;3432  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, h, (centerx + radius) * w, 0, (centerx + cpOffset) * w, h));3433  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, 0, (centerx - cpOffset) * w, h, (centerx - radius) * w, 0));3434  // Down up3435  centerx = .7;3436  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, h, (centerx + radius) * w, 0, (centerx + cpOffset) * w, h));3437  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, 0, (centerx - cpOffset) * w, h, (centerx - radius) * w, 0));3438  // Down up3439  centerx = .9;3440  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + cpOffset * .5) * w, h, (centerx + radius) * w, 0, (centerx + cpOffset) * w, h));3441  return geo;3442});3443go.Shape.defineFigureGenerator("ACvoltageSource", function(shape, w, h) {3444  var geo = new go.Geometry();3445  var cpOffset = KAPPA * .5;3446  var radius = .5;3447  var centerx = .5;3448  var centery = .5;3449  var fig = new go.PathFigure((centerx - radius) * w, centery * h, false);3450  geo.add(fig);3451  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,3452  (centerx - cpOffset) * w, (centery - radius) * h));3453  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,3454  (centerx + radius) * w, (centery - cpOffset) * h));3455  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,3456  (centerx + cpOffset) * w, (centery + radius) * h));3457  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,3458  (centerx - radius) * w, (centery + cpOffset) * h));3459  fig.add(new go.PathSegment(go.PathSegment.Move, (centerx - radius + .1) * w, centery * h));3460  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius - .1) * w, centery * h, centerx * w, (centery - radius) * h,3461  centerx * w, (centery + radius) * h));3462  return geo;3463});3464go.Shape.defineFigureGenerator("DCvoltageSource", function(shape, w, h) {3465  var geo = new go.Geometry();3466  var fig = new go.PathFigure(0, .75 * h, false);3467  geo.add(fig);3468  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .25 * h));3469  fig.add(new go.PathSegment(go.PathSegment.Move, w, 0));3470  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));3471  return geo;3472});3473go.Shape.defineFigureGenerator("Diode", function(shape, w, h) {3474  var geo = new go.Geometry();3475  var fig = new go.PathFigure(w, 0, false);3476  geo.add(fig);3477  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));3478  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));3479  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));3480  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));3481  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));3482  geo.spot1 = new go.Spot(0, .25);3483  geo.spot2 = new go.Spot(.5, .75);3484  return geo;3485});3486go.Shape.defineFigureGenerator("Wifi", function(shape, w, h) {3487  var geo = new go.Geometry();3488  var origw = w;3489  var origh = h;3490  w = w * .38;3491  h = h * .6;3492  var cpOffset = KAPPA * .8;3493  var radius = .8;3494  var centerx = 0;3495  var centery = .5;3496  var xOffset = (origw - w) / 2;3497  var yOffset = (origh - h) / 2;3498  var fig = new go.PathFigure(centerx * w + xOffset, (centery + radius) * h + yOffset, true);3499  geo.add(fig);3500  // Left curves3501  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w + xOffset,3502      centery * h + yOffset, (centerx - cpOffset) * w + xOffset,3503      (centery + radius) * h + yOffset,3504      (centerx - radius) * w + xOffset,3505      (centery + cpOffset) * h + yOffset));3506  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset,3507      (centery - radius) * h + yOffset, (centerx - radius) * w + xOffset,3508      (centery - cpOffset) * h + yOffset,3509      (centerx - cpOffset) * w + xOffset,3510      (centery - radius) * h + yOffset));3511  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius + cpOffset * .5) * w + xOffset,3512      centery * h + yOffset, centerx * w + xOffset,3513      (centery - radius) * h + yOffset,3514      (centerx - radius + cpOffset * .5) * w + xOffset,3515      (centery - cpOffset) * h + yOffset));3516  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset,3517      (centery + radius) * h + yOffset, (centerx - radius + cpOffset * .5) * w + xOffset,3518      (centery + cpOffset) * h + yOffset,3519      centerx * w + xOffset,3520      (centery + radius) * h + yOffset).close());3521  cpOffset = KAPPA * .4;3522  radius = .4;3523  centerx = .2;3524  centery = .5;3525  var fig2 = new go.PathFigure(centerx * w + xOffset, (centery + radius) * h + yOffset, true);3526  geo.add(fig2);3527  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w + xOffset,3528      centery * h + yOffset, (centerx - cpOffset) * w + xOffset,3529      (centery + radius) * h + yOffset,3530      (centerx - radius) * w + xOffset,3531      (centery + cpOffset) * h + yOffset));3532  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset,3533      (centery - radius) * h + yOffset, (centerx - radius) * w + xOffset,3534      (centery - cpOffset) * h + yOffset,3535      (centerx - cpOffset) * w + xOffset,3536      (centery - radius) * h + yOffset));3537  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius + cpOffset * .5) * w + xOffset,3538      centery * h + yOffset, centerx * w + xOffset,3539      (centery - radius) * h + yOffset,3540      (centerx - radius + cpOffset * .5) * w + xOffset,3541      (centery - cpOffset) * h + yOffset));3542  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset,3543      (centery + radius) * h + yOffset, (centerx - radius + cpOffset * .5) * w + xOffset,3544      (centery + cpOffset) * h + yOffset,3545      centerx * w + xOffset,3546      (centery + radius) * h + yOffset).close());3547  cpOffset = KAPPA * .2;3548  radius = .2;3549  centerx = .5;3550  centery = .5;3551  var fig3 = new go.PathFigure((centerx - radius) * w + xOffset, centery * h + yOffset, true);3552  geo.add(fig3);3553  // Center circle3554  fig3.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset,3555      (centery - radius) * h + yOffset, (centerx - radius) * w + xOffset,3556      (centery - cpOffset) * h + yOffset,3557      (centerx - cpOffset) * w + xOffset,3558      (centery - radius) * h + yOffset));3559  fig3.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w + xOffset,3560      centery * h + yOffset, (centerx + cpOffset) * w + xOffset,3561      (centery - radius) * h + yOffset,3562      (centerx + radius) * w + xOffset,3563      (centery - cpOffset) * h + yOffset));3564  fig3.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset,3565      (centery + radius) * h + yOffset, (centerx + radius) * w + xOffset,3566      (centery + cpOffset) * h + yOffset,3567      (centerx + cpOffset) * w + xOffset,3568      (centery + radius) * h + yOffset));3569  fig3.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w + xOffset,3570      centery * h + yOffset, (centerx - cpOffset) * w + xOffset,3571      (centery + radius) * h + yOffset,3572      (centerx - radius) * w + xOffset,3573      (centery + cpOffset) * h + yOffset));3574  cpOffset = KAPPA * .4;3575  radius = .4;3576  centerx = .8;3577  centery = .5;3578  var fig4 = new go.PathFigure(centerx * w + xOffset, (centery - radius) * h + yOffset, true);3579  geo.add(fig4);3580  // Right curves3581  fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w + xOffset,3582      centery * h + yOffset, (centerx + cpOffset) * w + xOffset,3583      (centery - radius) * h + yOffset,3584      (centerx + radius) * w + xOffset,3585      (centery - cpOffset) * h + yOffset));3586  fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset,3587      (centery + radius) * h + yOffset, (centerx + radius) * w + xOffset,3588      (centery + cpOffset) * h + yOffset,3589      (centerx + cpOffset) * w + xOffset,3590      (centery + radius) * h + yOffset));3591  fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius - cpOffset * .5) * w + xOffset,3592      centery * h + yOffset, centerx * w + xOffset,3593      (centery + radius) * h + yOffset,3594      (centerx + radius - cpOffset * .5) * w + xOffset,3595      (centery + cpOffset) * h + yOffset));3596  fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset,3597      (centery - radius) * h + yOffset, (centerx + radius - cpOffset * .5) * w + xOffset,3598      (centery - cpOffset) * h + yOffset,3599      centerx * w + xOffset,3600      (centery - radius) * h + yOffset).close());3601  cpOffset = KAPPA * .8;3602  radius = .8;3603  centerx = 1;3604  centery = .5;3605  var fig5 = new go.PathFigure(centerx * w + xOffset, (centery - radius) * h + yOffset, true);3606  geo.add(fig5);3607  fig5.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w + xOffset,3608      centery * h + yOffset, (centerx + cpOffset) * w + xOffset,3609      (centery - radius) * h + yOffset,3610      (centerx + radius) * w + xOffset,3611      (centery - cpOffset) * h + yOffset));3612  fig5.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset,3613      (centery + radius) * h + yOffset, (centerx + radius) * w + xOffset,3614      (centery + cpOffset) * h + yOffset,3615      (centerx + cpOffset) * w + xOffset,3616      (centery + radius) * h + yOffset));3617  fig5.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius - cpOffset * .5) * w + xOffset,3618      centery * h + yOffset, centerx * w + xOffset,3619      (centery + radius) * h + yOffset,3620      (centerx + radius - cpOffset * .5) * w + xOffset,3621      (centery + cpOffset) * h + yOffset));3622  fig5.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w + xOffset,3623      (centery - radius) * h + yOffset, (centerx + radius - cpOffset * .5) * w + xOffset,3624      (centery - cpOffset) * h + yOffset,3625      centerx * w + xOffset,3626      (centery - radius) * h + yOffset).close());3627  return geo;3628});3629go.Shape.defineFigureGenerator("Email", function(shape, w, h) {3630  var geo = new go.Geometry();3631  var fig = new go.PathFigure(0, 0, true);3632  geo.add(fig);3633  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));3634  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));3635  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));3636  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0).close());3637  var fig2 = new go.PathFigure(0, 0, false);3638  geo.add(fig2);3639  fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .6 * h));3640  fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0));3641  fig2.add(new go.PathSegment(go.PathSegment.Move, 0, h));3642  fig2.add(new go.PathSegment(go.PathSegment.Line, .45 * w, .54 * h));3643  fig2.add(new go.PathSegment(go.PathSegment.Move, w, h));3644  fig2.add(new go.PathSegment(go.PathSegment.Line, .55 * w, .54 * h));3645  return geo;3646});3647go.Shape.defineFigureGenerator("Ethernet", function(shape, w, h) {3648  var geo = new go.Geometry();3649  var fig = new go.PathFigure(.35 * w, 0, true);3650  geo.add(fig);3651  // Boxes above the wire3652  fig.add(new go.PathSegment(go.PathSegment.Line, .65 * w, 0));3653  fig.add(new go.PathSegment(go.PathSegment.Line, .65 * w, .4 * h));3654  fig.add(new go.PathSegment(go.PathSegment.Line, .35 * w, .4 * h));3655  fig.add(new go.PathSegment(go.PathSegment.Line, .35 * w, 0).close());3656  var fig2 = new go.PathFigure(.10 * w, h, true, true);3657  geo.add(fig2);3658  // Boxes under the wire3659  fig2.add(new go.PathSegment(go.PathSegment.Line, .40 * w, h));3660  fig2.add(new go.PathSegment(go.PathSegment.Line, .40 * w, .6 * h));3661  fig2.add(new go.PathSegment(go.PathSegment.Line, .10 * w, .6 * h));3662  fig2.add(new go.PathSegment(go.PathSegment.Line, .10 * w, h).close());3663  var fig3 = new go.PathFigure(.60 * w, h, true, true);3664  geo.add(fig3);3665  fig3.add(new go.PathSegment(go.PathSegment.Line, .90 * w, h));3666  fig3.add(new go.PathSegment(go.PathSegment.Line, .90 * w, .6 * h));3667  fig3.add(new go.PathSegment(go.PathSegment.Line, .60 * w, .6 * h));3668  fig3.add(new go.PathSegment(go.PathSegment.Line, .60 * w, h).close());3669  var fig4 = new go.PathFigure(0, .5 * h, false);3670  geo.add(fig4);3671  // Wire3672  fig4.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));3673  fig4.add(new go.PathSegment(go.PathSegment.Move, .5 * w, .5 * h));3674  fig4.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .4 * h));3675  fig4.add(new go.PathSegment(go.PathSegment.Move, .75 * w, .5 * h));3676  fig4.add(new go.PathSegment(go.PathSegment.Line, .75 * w, .6 * h));3677  fig4.add(new go.PathSegment(go.PathSegment.Move, .25 * w, .5 * h));3678  fig4.add(new go.PathSegment(go.PathSegment.Line, .25 * w, .6 * h));3679  return geo;3680});3681go.Shape.defineFigureGenerator("Power", function(shape, w, h) {3682  var geo = new go.Geometry();3683  var cpOffset = KAPPA * .4;3684  var radius = .4;3685  var centerx = .5;3686  var centery = .5;3687  var unused = tempPoint();3688  var mid = tempPoint();3689  var c1 = tempPoint();3690  var c2 = tempPoint();3691  // Find the 45 degree midpoint for the first bezier3692  breakUpBezier(centerx, centery - radius,3693      centerx + cpOffset, centery - radius,3694      centerx + radius, centery - cpOffset,3695      centerx + radius, centery, .5, unused,3696      unused, mid, c1, c2);3697  var start = tempPointAt(mid.x, mid.y);3698  var fig = new go.PathFigure(mid.x * w, mid.y * h, true);3699  geo.add(fig);3700  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));3701  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,3702    (centerx + cpOffset) * w, (centery + radius) * h));3703  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,3704    (centerx - radius) * w, (centery + cpOffset) * h));3705  // Find the 45 degree midpoint of for the fourth bezier3706  breakUpBezier(centerx - radius, centery,3707      centerx - radius, centery - cpOffset,3708      centerx - cpOffset, centery - radius,3709      centerx, centery - radius, .5, c1,3710      c2, mid, unused, unused);3711  fig.add(new go.PathSegment(go.PathSegment.Bezier, mid.x * w, mid.y * h, c1.x * w, c1.y * h,3712    c2.x * w, c2.y * h));3713  // now make a smaller circle3714  cpOffset = KAPPA * .3;3715  radius = .3;3716  // Find the 45 degree midpoint for the first bezier3717  breakUpBezier(centerx - radius, centery,3718      centerx - radius, centery - cpOffset,3719      centerx - cpOffset, centery - radius,3720      centerx, centery - radius, .5, c1,3721      c2, mid, unused, unused);3722  fig.add(new go.PathSegment(go.PathSegment.Line, mid.x * w, mid.y * h));3723  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));3724  fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx - radius) * w, (centery + cpOffset) * h,3725    (centerx - cpOffset) * w, (centery + radius) * h));3726  fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery + radius) * h,3727    (centerx + radius) * w, (centery + cpOffset) * h));3728  // Find the 45 degree midpoint for the fourth bezier3729  breakUpBezier(centerx, centery - radius,3730      centerx + cpOffset, centery - radius,3731      centerx + radius, centery - cpOffset,3732      centerx + radius, centery, .5, unused,3733      unused, mid, c1, c2);3734  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());3735  var fig = new go.PathFigure(.45 * w, 0, true);3736  geo.add(fig);3737  fig.add(new go.PathSegment(go.PathSegment.Line, .45 * w, .5 * h));3738  fig.add(new go.PathSegment(go.PathSegment.Line, .55 * w, .5 * h));3739  fig.add(new go.PathSegment(go.PathSegment.Line, .55 * w, 0).close());3740  freePoint(unused);3741  freePoint(mid);3742  freePoint(c1);3743  freePoint(c2);3744  freePoint(start);3745  geo.spot1 = new go.Spot(.25, .45);3746  geo.spot2 = new go.Spot(.75, .8);3747  return geo;3748});3749go.Shape.defineFigureGenerator("Fallout", function(shape, w, h) {3750  var geo = new go.Geometry();3751  var fig = new go.PathFigure(0, h/2, true);3752  geo.add(fig);3753  // Containing circle3754  fig.add(new go.PathSegment(go.PathSegment.Arc, 180, 360, w/2, h/2, w/2, h/2))3755  function drawTriangle(fig, offsetx, offsety) {3756    fig.add(new go.PathSegment(go.PathSegment.Move, (.3 + offsetx) * w, (.8 + offsety) * h));3757    fig.add(new go.PathSegment(go.PathSegment.Line, (.5 + offsetx) * w, (.5 + offsety) * h));3758    fig.add(new go.PathSegment(go.PathSegment.Line, (.1 + offsetx) * w, (.5 + offsety) * h));3759    fig.add(new go.PathSegment(go.PathSegment.Line, (.3 + offsetx) * w, (.8 + offsety) * h).close());3760  }3761  // Triangles3762  drawTriangle(fig, 0, 0);3763  drawTriangle(fig, 0.4, 0);3764  drawTriangle(fig, 0.2, -0.3);3765  return geo;3766});3767go.Shape.defineFigureGenerator("IrritationHazard", function(shape, w, h) {3768  var geo = new go.Geometry();3769  var fig = new go.PathFigure(.2 * w, 0, true);3770  geo.add(fig);3771  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .3 * h));3772  fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, 0));3773  fig.add(new go.PathSegment(go.PathSegment.Line, w, .2 * h));3774  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, .5 * h));3775  fig.add(new go.PathSegment(go.PathSegment.Line, w, .8 * h));3776  fig.add(new go.PathSegment(go.PathSegment.Line, .8 * w, h));3777  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .7 * h));3778  fig.add(new go.PathSegment(go.PathSegment.Line, .2 * w, h));3779  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .8 * h));3780  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, .5 * h));3781  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .2 * h).close());3782  geo.spot1 = new go.Spot(.3, .3);3783  geo.spot2 = new go.Spot(.7, .7);3784  return geo;3785});3786go.Shape.defineFigureGenerator("ElectricalHazard", function(shape, w, h) {3787  var geo = new go.Geometry();3788  var fig = new go.PathFigure(.37 * w, 0, true);3789  geo.add(fig);3790  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .11 * h));3791  fig.add(new go.PathSegment(go.PathSegment.Line, .77 * w, .04 * h));3792  fig.add(new go.PathSegment(go.PathSegment.Line, .33 * w, .49 * h));3793  fig.add(new go.PathSegment(go.PathSegment.Line, w, .37 * h));3794  fig.add(new go.PathSegment(go.PathSegment.Line, .63 * w, .86 * h));3795  fig.add(new go.PathSegment(go.PathSegment.Line, .77 * w, .91 * h));3796  fig.add(new go.PathSegment(go.PathSegment.Line, .34 * w, h));3797  fig.add(new go.PathSegment(go.PathSegment.Line, .34 * w, .78 * h));3798  fig.add(new go.PathSegment(go.PathSegment.Line, .44 * w, .8 * h));3799  fig.add(new go.PathSegment(go.PathSegment.Line, .65 * w, .56 * h));3800  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .68 * h).close());3801  return geo;3802});3803go.Shape.defineFigureGenerator("FireHazard", function(shape, w, h) {3804  var geo = new go.Geometry();3805  var fig = new go.PathFigure(.1 * w, h, true);3806  geo.add(fig);3807  fig.add(new go.PathSegment(go.PathSegment.Bezier, .29 * w, 0, -.25 * w, .63 * h,3808  .45 * w, .44 * h));3809  fig.add(new go.PathSegment(go.PathSegment.Bezier, .51 * w, .42 * h, .48 * w, .17 * h,3810  .54 * w, .35 * h));3811  fig.add(new go.PathSegment(go.PathSegment.Bezier, .59 * w, .18 * h, .59 * w, .29 * h,3812  .58 * w, .28 * h));3813  fig.add(new go.PathSegment(go.PathSegment.Bezier, .75 * w, .6 * h, .8 * w, .34 * h,3814  .88 * w, .43 * h));3815  fig.add(new go.PathSegment(go.PathSegment.Bezier, .88 * w, .31 * h, .87 * w, .48 * h,3816  .88 * w, .43 * h));3817  fig.add(new go.PathSegment(go.PathSegment.Bezier, .9 * w, h, 1.17 * w, .76 * h,3818  .82 * w, .8 * h).close());3819  geo.spot1 = new go.Spot(.07, .445);3820  geo.spot2 = new go.Spot(.884, .958);3821  return geo;3822});3823go.Shape.defineFigureGenerator("BpmnActivityLoop", function(shape, w, h) {3824  var geo = new go.Geometry();3825  var r = .5;3826  var cx = 0; // offset from Center x3827  var cy = 0; // offset from Center y3828  var d = r * KAPPA;3829  var mx1 = (.4 * Math.SQRT2 / 2 + .5);3830  var my1 = (.5 - .5 * Math.SQRT2 / 2);3831  var x1 = 1;3832  var y1 = .5;3833  var x2 = .5;3834  var y2 = 0;3835  var fig = new go.PathFigure(mx1 * w, (1 - my1) * h, false);3836  geo.add(fig);3837  fig.add(new go.PathSegment(go.PathSegment.Bezier, x1 * w, y1 * h, x1 * w, .7 * h,3838  x1 * w, y1 * h));3839  fig.add(new go.PathSegment(go.PathSegment.Bezier, (x2 + cx) * w, (y2 + cx) * h, (.5 + r + cx) * w, (.5 - d + cx) * h,3840  (.5 + d + cx) * w, (.5 - r + cx) * h));3841  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.5 - r + cx) * w, (.5 + cy) * h, (.5 - d + cx) * w, (.5 - r + cy) * h,3842  (.5 - r + cx) * w, (.5 - d + cy) * h));3843  fig.add(new go.PathSegment(go.PathSegment.Bezier, (.35 + cx) * w, .9 * h, (.5 - r + cx) * w, (.5 + d + cy) * h,3844  (.5 - d + cx) * w, .9 * h));3845  // Arrowhead3846  fig.add(new go.PathSegment(go.PathSegment.Move, (.25 + cx) * w, 0.8 * h));3847  fig.add(new go.PathSegment(go.PathSegment.Line, (.35 + cx) * w, 0.9 * h));3848  fig.add(new go.PathSegment(go.PathSegment.Line, (.20 + cx) * w, 0.95 * h));3849  return geo;3850});3851go.Shape.defineFigureGenerator("BpmnActivityParallel", function(shape, w, h) {3852  var geo = new go.Geometry();3853  var fig = new go.PathFigure(0, 0, false);3854  geo.add(fig);3855  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));3856  fig.add(new go.PathSegment(go.PathSegment.Move, .5 * w, 0));3857  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h));3858  fig.add(new go.PathSegment(go.PathSegment.Move, w, 0));3859  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));3860  return geo;3861});3862go.Shape.defineFigureGenerator("BpmnActivitySequential", function(shape, w, h) {3863  var geo = new go.Geometry();3864  var fig = new go.PathFigure(0, 0, false);3865  geo.add(fig);3866  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));3867  fig.add(new go.PathSegment(go.PathSegment.Move, 0, .5 * h));3868  fig.add(new go.PathSegment(go.PathSegment.Line, w, .5 * h));3869  fig.add(new go.PathSegment(go.PathSegment.Move, 0, h));3870  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));3871  return geo;3872});3873go.Shape.defineFigureGenerator("BpmnActivityAdHoc", function(shape, w, h) {3874  var geo = new go.Geometry();3875  var fig = new go.PathFigure(0, 0, false);3876  geo.add(fig);3877  var fig2 = new go.PathFigure(w, h, false);3878  geo.add(fig2);3879  var fig3 = new go.PathFigure(0, .5 * h, false);3880  geo.add(fig3);3881  fig3.add(new go.PathSegment(go.PathSegment.Bezier, .5 * w, .5 * h, .2 * w, .35 * h,3882    .3 * w, .35 * h));3883  fig3.add(new go.PathSegment(go.PathSegment.Bezier, w, .5 * h, .7 * w, .65 * h,3884    .8 * w, .65 * h));3885  return geo;3886});3887go.Shape.defineFigureGenerator("BpmnActivityCompensation", function(shape, w, h) {3888  var geo = new go.Geometry();3889  var fig = new go.PathFigure(0, .5 * h, true);3890  geo.add(fig);3891  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));3892  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h));3893  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));3894  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));3895  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h));3896  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h).close());3897  return geo;3898});3899go.Shape.defineFigureGenerator("BpmnTaskMessage", function(shape, w, h) {3900  var geo = new go.Geometry();3901  var fig = new go.PathFigure(0, .2 * h, true);3902  geo.add(fig);3903  fig.add(new go.PathSegment(go.PathSegment.Line, w, .2 * h));3904  fig.add(new go.PathSegment(go.PathSegment.Line, w, .8 * h));3905  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .8 * h));3906  fig.add(new go.PathSegment(go.PathSegment.Line, 0, .8 * h).close());3907  var fig = new go.PathFigure(0, .2 * h, false);3908  geo.add(fig);3909  fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h));3910  fig.add(new go.PathSegment(go.PathSegment.Line, w, .2 * h));3911  return geo;3912});3913go.Shape.defineFigureGenerator("BpmnTaskScript", function(shape, w, h) {3914  var geo = new go.Geometry();3915  var fig = new go.PathFigure(.7 * w, h, true);3916  geo.add(fig);3917  fig.add(new go.PathSegment(go.PathSegment.Line, .3 * w, h));3918  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.3 * w, 0, .6 * w, .5 * h,3919  0, .5 * h));3920  fig.add(new go.PathSegment(go.PathSegment.Line, .7 * w, 0));3921  fig.add(new go.PathSegment(go.PathSegment.Bezier, .7 * w, h, .4 * w, .5 * h,3922  w, .5 * h).close());3923  var fig2 = new go.PathFigure(.45 * w, .73 * h, false);3924  geo.add(fig2);3925  // Lines on script3926  fig2.add(new go.PathSegment(go.PathSegment.Line, .7 * w, .73 * h));3927  fig2.add(new go.PathSegment(go.PathSegment.Move, .38 * w, .5 * h));3928  fig2.add(new go.PathSegment(go.PathSegment.Line, .63 * w, .5 * h));3929  fig2.add(new go.PathSegment(go.PathSegment.Move, .31 * w, .27 * h));3930  fig2.add(new go.PathSegment(go.PathSegment.Line, .56 * w, .27 * h));3931  return geo;3932});3933go.Shape.defineFigureGenerator("BpmnTaskUser", function(shape, w, h) {3934  var geo = new go.Geometry();3935  var fig = new go.PathFigure(0, 0, false);3936  geo.add(fig);3937  var fig2 = new go.PathFigure(.335 * w, (1 - .555) * h, true);3938  geo.add(fig2);3939  // Shirt3940  fig2.add(new go.PathSegment(go.PathSegment.Line, .335 * w, (1 - .405) * h));3941  fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - .335) * w, (1 - .405) * h));3942  fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - .335) * w, (1 - .555) * h));3943  fig2.add(new go.PathSegment(go.PathSegment.Bezier, w, .68 * h, (1 - .12) * w, .46 * h,3944    (1 - .02) * w, .54 * h));3945  fig2.add(new go.PathSegment(go.PathSegment.Line, w, h));3946  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, h));3947  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, .68 * h));3948  fig2.add(new go.PathSegment(go.PathSegment.Bezier, .335 * w, (1 - .555) * h, .02 * w, .54 * h,3949    .12 * w, .46 * h));3950  // Start of neck3951  fig2.add(new go.PathSegment(go.PathSegment.Line, .365 * w, (1 - .595) * h));3952  var radiushead = .5 - .285;3953  var centerx = .5;3954  var centery = radiushead;3955  var alpha2 = Math.PI / 4;3956  var KAPPA = ((4 * (1 - Math.cos(alpha2))) / (3 * Math.sin(alpha2)));3957  var cpOffset = KAPPA * .5;3958  var radiusw = radiushead;3959  var radiush = radiushead;3960  var offsetw = KAPPA * radiusw;3961  var offseth = KAPPA * radiush;3962  // Circle (head)3963  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radiusw) * w, centery * h, (centerx - ((offsetw + radiusw) / 2)) * w, (centery + ((radiush + offseth) / 2)) * h,3964    (centerx - radiusw) * w, (centery + offseth) * h));3965  fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radiush) * h, (centerx - radiusw) * w, (centery - offseth) * h,3966    (centerx - offsetw) * w, (centery - radiush) * h));3967  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radiusw) * w, centery * h, (centerx + offsetw) * w, (centery - radiush) * h,3968    (centerx + radiusw) * w, (centery - offseth) * h));3969  fig2.add(new go.PathSegment(go.PathSegment.Bezier, (1 - .365) * w, (1 - .595) * h, (centerx + radiusw) * w, (centery + offseth) * h,3970    (centerx + ((offsetw + radiusw) / 2)) * w, (centery + ((radiush + offseth) / 2)) * h));3971  fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - .365) * w, (1 - .595) * h));3972  // Neckline3973  fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - .335) * w, (1 - .555) * h));3974  fig2.add(new go.PathSegment(go.PathSegment.Line, (1 - .335) * w, (1 - .405) * h));3975  fig2.add(new go.PathSegment(go.PathSegment.Line, .335 * w, (1 - .405) * h));3976  var fig3 = new go.PathFigure(.2 * w, h, false);3977  geo.add(fig3);3978  // Arm lines3979  fig3.add(new go.PathSegment(go.PathSegment.Line, .2 * w, .8 * h));3980  var fig4 = new go.PathFigure(.8 * w, h, false);3981  geo.add(fig4);3982  fig4.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .8 * h));3983  return geo;3984});3985go.Shape.defineFigureGenerator("BpmnEventConditional", function(shape, w, h) {3986  var geo = new go.Geometry();3987  var fig = new go.PathFigure(.1 * w, 0, true);3988  geo.add(fig);3989  // Body3990  fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, 0));3991  fig.add(new go.PathSegment(go.PathSegment.Line, .9 * w, h));3992  fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, h).close());3993  var fig2 = new go.PathFigure(.2 * w, .2 * h, false);3994  geo.add(fig2);3995  // Inside lines3996  fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .2 * h));3997  fig2.add(new go.PathSegment(go.PathSegment.Move, .2 * w, .4 * h));3998  fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .4 * h));3999  fig2.add(new go.PathSegment(go.PathSegment.Move, .2 * w, .6 * h));4000  fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .6 * h));4001  fig2.add(new go.PathSegment(go.PathSegment.Move, .2 * w, .8 * h));4002  fig2.add(new go.PathSegment(go.PathSegment.Line, .8 * w, .8 * h));4003  return geo;4004});4005go.Shape.defineFigureGenerator("BpmnEventError", function(shape, w, h) {4006  var geo = new go.Geometry();4007  var fig = new go.PathFigure(0, h, true);4008  geo.add(fig);4009  fig.add(new go.PathSegment(go.PathSegment.Line, .33 * w, 0));4010  fig.add(new go.PathSegment(go.PathSegment.Line, .66 * w, .50 * h));4011  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));4012  fig.add(new go.PathSegment(go.PathSegment.Line, .66 * w, h));4013  fig.add(new go.PathSegment(go.PathSegment.Line, .33 * w, .50 * h).close());4014  return geo;4015});4016go.Shape.defineFigureGenerator("BpmnEventEscalation", function(shape, w, h) {4017  var geo = new go.Geometry();4018  var fig = new go.PathFigure(0, 0, false);4019  geo.add(fig);4020  // Set dimensions4021  var fig2 = new go.PathFigure(w, h, false);4022  geo.add(fig2);4023  var fig3 = new go.PathFigure(.1 * w, h, true);4024  geo.add(fig3);4025  fig3.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0));4026  fig3.add(new go.PathSegment(go.PathSegment.Line, .9 * w, h));4027  fig3.add(new go.PathSegment(go.PathSegment.Line, .5 * w, .5 * h).close());4028  return geo;4029});4030go.Shape.defineFigureGenerator("Caution", function(shape, w, h) {4031  var geo = new go.Geometry();4032  var fig = new go.PathFigure(0.05 * w, h, true);4033  geo.add(fig);4034  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.1 * w, .8 * h, 0, h, 0, h));4035  fig.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, .1 * h));4036  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.55 * w, .1 * h, 0.5 * w, 0, 0.5 * w, 0));4037  fig.add(new go.PathSegment(go.PathSegment.Line, 0.95 * w, 0.9 * h));4038  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.9 * w, h, w, h, w, h));4039  fig.add(new go.PathSegment(go.PathSegment.Line, 0.05 * w, h));4040  var radius = 0.05;4041  // Bottom circle of exclamation point4042  fig.add(new go.PathSegment(go.PathSegment.Move, (0.5 - radius) * w, 0.875 * h));4043  fig.add(new go.PathSegment(go.PathSegment.Arc, 180, -360, 0.5 * w, 0.875 * h, radius * w, radius * h));4044  // Upper rectangle of exclamation point4045  fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.75 * h));4046  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));4047  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));4048  return geo;4049});4050go.Shape.defineFigureGenerator("Recycle", function(shape, w, h) {4051  var geo = new go.Geometry();4052  var fig = new go.PathFigure(0.45 * w, 0.95 * h, false);4053  geo.add(fig);4054  // Bottom left arrow4055  fig.add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, 0.95 * h));4056  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));4057  fig.add(new go.PathSegment(go.PathSegment.Line, 0.235 * w, 0.75 * h));4058  fig.add(new go.PathSegment(go.PathSegment.Line, 0.30 * w, 0.625 * h));4059  fig.add(new go.PathSegment(go.PathSegment.Line, 0.35 * w, 0.65 * h));4060  fig.add(new go.PathSegment(go.PathSegment.Line, 0.275 * w, 0.45 * h));4061  fig.add(new go.PathSegment(go.PathSegment.Line, 0.05 * w, 0.45 * h));4062  fig.add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0.5 * h));4063  fig.add(new go.PathSegment(go.PathSegment.Line, 0.05 * w, 0.575 * h));4064  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.1875 * w, 0.95 * h, 0, 0.675 * h, 0, 0.7 * h));4065  fig.add(new go.PathSegment(go.PathSegment.Move, 0.45 * w, 0.95 * h));4066  fig.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.775 * h));4067  fig.add(new go.PathSegment(go.PathSegment.Line, 0.22 * w, 0.775 * h));4068  var fig2 = new go.PathFigure(0.475 * w, 0.2 * h, false);4069  geo.add(fig2);4070  // Top arrow4071  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0.4 * h));4072  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.225 * w, 0.3 * h));4073  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.275 * w, 0.175 * h));4074  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.325 * w, 0.05 * h));4075  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0.4 * w, 0.05 * h, 0.35 * w, 0, 0.375 * w, 0));4076  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.575 * w, 0.375 * h));4077  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.525 * w, 0.4 * h));4078  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.75 * w, 0.475 * h));4079  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.85 * w, 0.315 * h));4080  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.32 * h));4081  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, 0.05 * h));4082  fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0.575 * w, 0, 0.65 * w, 0.05 * h, 0.625 * w, 0));4083  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.38 * w, 0.0105 * h));4084  var fig3 = new go.PathFigure(0.675 * w, 0.575 * h, false);4085  geo.add(fig3);4086  // Bottom right arrow4087  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.875 * w, 0.525 * h));4088  fig3.add(new go.PathSegment(go.PathSegment.Line, w, 0.775 * h));4089  fig3.add(new go.PathSegment(go.PathSegment.Bezier, 0.85 * w, 0.95 * h, w, 0.8 * h, w, 0.85 * h));4090  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, 0.95 * h));4091  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, h));4092  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, 0.85 * h));4093  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, 0.725 * h));4094  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, 0.775 * h));4095  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.7 * w, 0.775 * h));4096  fig3.add(new go.PathSegment(go.PathSegment.Line, w, 0.775 * h));4097  fig3.add(new go.PathSegment(go.PathSegment.Move, 0.675 * w, 0.575 * h));4098  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.775 * w, 0.775 * h));4099  return geo;4100});4101go.Shape.defineFigureGenerator("BpmnEventTimer", function(shape, w, h) {4102  var geo = new go.Geometry();4103  var radius = .5;4104  var cpOffset = KAPPA * .5;4105  var fig = new go.PathFigure(w, radius * h, true);4106  geo.add(fig);4107  fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, h, w, (radius + cpOffset) * h,4108    (radius + cpOffset) * w, h));4109  fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, radius * h, (radius - cpOffset) * w, h,4110    0, (radius + cpOffset) * h));4111  fig.add(new go.PathSegment(go.PathSegment.Bezier, radius * w, 0, 0, (radius - cpOffset) * h,4112    (radius - cpOffset) * w, 0));4113  fig.add(new go.PathSegment(go.PathSegment.Bezier, w, radius * h, (radius + cpOffset) * w, 0,4114    w, (radius - cpOffset) * h));4115  var fig2 = new go.PathFigure(radius * w, 0, false);4116  geo.add(fig2);4117  // Hour lines4118  fig2.add(new go.PathSegment(go.PathSegment.Line, radius * w, .15 * h));4119  fig2.add(new go.PathSegment(go.PathSegment.Move, radius * w, h));4120  fig2.add(new go.PathSegment(go.PathSegment.Line, radius * w, .85 * h));4121  fig2.add(new go.PathSegment(go.PathSegment.Move, 0, radius * h));4122  fig2.add(new go.PathSegment(go.PathSegment.Line, .15 * w, radius * h));4123  fig2.add(new go.PathSegment(go.PathSegment.Move, w, radius * h));4124  fig2.add(new go.PathSegment(go.PathSegment.Line, .85 * w, radius * h));4125  // Clock hands4126  fig2.add(new go.PathSegment(go.PathSegment.Move, radius * w, radius * h));4127  fig2.add(new go.PathSegment(go.PathSegment.Line, .58 * w, 0.1 * h));4128  fig2.add(new go.PathSegment(go.PathSegment.Move, radius * w, radius * h));4129  fig2.add(new go.PathSegment(go.PathSegment.Line, .78 * w, .54 * h));4130  return geo;4131});4132go.Shape.defineFigureGenerator("Package", function(shape, w, h) {4133  var geo = new go.Geometry();4134  var fig = new go.PathFigure(0, 0.15 * h, true);4135  geo.add(fig);4136  // Package bottom rectangle4137  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.15 * h));4138  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));4139  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());4140  var fig2 = new go.PathFigure(0, 0.15 * h, true);4141  geo.add(fig2);4142  // Package top flap4143  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, 0));4144  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0));4145  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, 0.15 * h).close());4146  geo.spot1 = new go.Spot(0, 0.1);4147  geo.spot2 = new go.Spot(1, 1);4148  return geo;4149});4150go.Shape.defineFigureGenerator("Class", function(shape, w, h) {4151  var geo = new go.Geometry();4152  var fig = new go.PathFigure(0, 0, true);4153  geo.add(fig);4154  // Class box4155  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));4156  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));4157  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));4158  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0).close());4159  var fig2 = new go.PathFigure(0, 0.2 * h, false);4160  geo.add(fig2);4161  // Top box separater4162  fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0.2 * h).close());4163  var fig3 = new go.PathFigure(0, 0.5 * h, false);4164  geo.add(fig3);4165  // Middle box separater4166  fig3.add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h).close());4167  return geo;4168});4169go.Shape.defineFigureGenerator("Component", function(shape, w, h) {4170  var geo = new go.Geometry();4171  var fig = new go.PathFigure(w, h, true);4172  geo.add(fig);4173  // Component Box4174  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));4175  fig.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, 0));4176  fig.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, h));4177  fig.add(new go.PathSegment(go.PathSegment.Line, w, h).close());4178  var fig2 = new go.PathFigure(0, 0.2 * h, true);4179  geo.add(fig2);4180  // Component top sub box4181  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.2 * h));4182  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.4 * h));4183  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, 0.4 * h));4184  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, 0.2 * h).close());4185  var fig3 = new go.PathFigure(0, 0.6 * h, true);4186  geo.add(fig3);4187  // Component bottom sub box4188  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.6 * h));4189  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.8 * h));4190  fig3.add(new go.PathSegment(go.PathSegment.Line, 0, 0.8 * h));4191  fig3.add(new go.PathSegment(go.PathSegment.Line, 0, 0.6 * h).close());4192  return geo;4193});4194go.Shape.defineFigureGenerator("Boat Shipment", function(shape, w, h) {4195  var geo = new go.Geometry();4196  var fig = new go.PathFigure(0.15 * w, 0.6 * h, true);4197  geo.add(fig);4198  // Boat shipment flag4199  fig.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, 0.6 * h));4200  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.6 * h));4201  fig.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, h));4202  fig.add(new go.PathSegment(go.PathSegment.Line, 0.85 * w, h));4203  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.6 * h));4204  fig.add(new go.PathSegment(go.PathSegment.Line, 0.85 * w, 0.6 * h));4205  fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0));4206  fig.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, 0.6 * h));4207  var fig2 = new go.PathFigure(0.15 * w, 0.6 * h, false);4208  geo.add(fig2);4209  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.85 * w, 0.6 * h));4210  return geo;4211});4212go.Shape.defineFigureGenerator("Customer/Supplier", function(shape, w, h) {4213  var geo = new go.Geometry();4214  var fig = new go.PathFigure(w, h, true);4215  geo.add(fig);4216  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));4217  fig.add(new go.PathSegment(go.PathSegment.Line, 0.66 * w, 0.33 * h));4218  fig.add(new go.PathSegment(go.PathSegment.Line, 0.66 * w, 0));4219  fig.add(new go.PathSegment(go.PathSegment.Line, 0.33 * w, 0.33 * h));4220  fig.add(new go.PathSegment(go.PathSegment.Line, 0.33 * w, 0));4221  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.33 * h));4222  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));4223  fig.add(new go.PathSegment(go.PathSegment.Line, w, h).close());4224  return geo;4225});4226go.Shape.defineFigureGenerator("Workcell", function(shape, w, h) {4227  var geo = new go.Geometry();4228  var fig = new go.PathFigure(0, h, true);4229  geo.add(fig);4230  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));4231  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));4232  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));4233  fig.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, h));4234  fig.add(new go.PathSegment(go.PathSegment.Line, 0.65 * w, 0.4 * h));4235  fig.add(new go.PathSegment(go.PathSegment.Line, 0.35 * w, 0.4 * h));4236  fig.add(new go.PathSegment(go.PathSegment.Line, 0.35 * w, h));4237  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());4238  return geo;4239});4240go.Shape.defineFigureGenerator("Supermarket", function(shape, w, h) {4241  var geo = new go.Geometry();4242  var fig = new go.PathFigure(0, 0, false);4243  geo.add(fig);4244  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));4245  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.33 * h));4246  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.33 * h));4247  fig.add(new go.PathSegment(go.PathSegment.Move, w, 0.33 * h));4248  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.66 * h));4249  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.66 * h));4250  fig.add(new go.PathSegment(go.PathSegment.Move, w, 0.66 * h));4251  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));4252  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));4253  return geo;4254});4255go.Shape.defineFigureGenerator("TruckShipment", function(shape, w, h) {4256  var geo = new go.Geometry();4257  var fig = new go.PathFigure(0, 0, true);4258  geo.add(fig);4259  // Left rectangle4260  fig.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0));4261  fig.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0.8 * h));4262  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.8 * h));4263  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0).close());4264  var fig2 = new go.PathFigure(w, 0.8 * h, true);4265  geo.add(fig2);4266  // Right rectangle4267  fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0.4 * h));4268  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0.4 * h));4269  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0.8 * h));4270  fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0.8 * h).close());4271  var radius = .1;4272  var cpOffset = KAPPA * .1;4273  var centerx = .2;4274  var centery = .9;4275  var fig3 = new go.PathFigure((centerx - radius) * w, centery * h, true);4276  geo.add(fig3);4277  // Left wheel4278  fig3.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,4279      (centerx - cpOffset) * w, (centery - radius) * h));4280  fig3.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,4281      (centerx + radius) * w, (centery - cpOffset) * h));4282  fig3.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,4283      (centerx + cpOffset) * w, (centery + radius) * h));4284  fig3.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,4285      (centerx - radius) * w, (centery + cpOffset) * h).close());4286  radius = .1;4287  cpOffset = KAPPA * .1;4288  centerx = .8;4289  centery = .9;4290  var fig4 = new go.PathFigure((centerx - radius) * w, centery * h, true);4291  geo.add(fig4);4292  // Right wheel4293  fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,4294      (centerx - cpOffset) * w, (centery - radius) * h));4295  fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,4296      (centerx + radius) * w, (centery - cpOffset) * h));4297  fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,4298      (centerx + cpOffset) * w, (centery + radius) * h));4299  fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,4300      (centerx - radius) * w, (centery + cpOffset) * h).close());4301  return geo;4302});4303go.Shape.defineFigureGenerator("KanbanPost", function(shape, w, h) {4304  var geo = new go.Geometry();4305  var fig = new go.PathFigure(0.2 * w, 0, false);4306  geo.add(fig);4307  fig.add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, .5 * h));4308  fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.5 * h));4309  fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0));4310  fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.5 * h));4311  fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h));4312  fig.add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, h));4313  fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, h));4314  fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, h));4315  return geo;4316});4317go.Shape.defineFigureGenerator("Forklift", function(shape, w, h) {4318  var geo = new go.Geometry();4319  var fig = new go.PathFigure(0, 0, true);4320  geo.add(fig);4321  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.5 * h));4322  fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.5 * h));4323  fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0));4324  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));4325  var fig2 = new go.PathFigure(0, 0.5 * h, true);4326  geo.add(fig2);4327  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, 0.8 * h));4328  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.8 * h));4329  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.5 * h));4330  fig2.add(new go.PathSegment(go.PathSegment.Line, 0, 0.5 * h));4331  var fig3 = new go.PathFigure(0.50 * w, 0.8 * h, true);4332  geo.add(fig3);4333  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.50 * w, 0.1 * h));4334  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, 0.1 * h));4335  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, 0.8 * h));4336  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.50 * w, 0.8 * h));4337  var fig4 = new go.PathFigure(0.5 * w, 0.7 * h, false);4338  geo.add(fig4);4339  fig4.add(new go.PathSegment(go.PathSegment.Line, w, 0.7 * h));4340  var radius = .1;4341  var cpOffset = KAPPA * .1;4342  var centerx = .1;4343  var centery = .94344  var fig5 = new go.PathFigure((centerx - radius) * w, centery * h, true);4345  geo.add(fig5);4346  fig5.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,4347    (centerx - cpOffset) * w, (centery - radius) * h));4348  fig5.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,4349    (centerx + radius) * w, (centery - cpOffset) * h));4350  fig5.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,4351    (centerx + cpOffset) * w, (centery + radius) * h));4352  fig5.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,4353    (centerx - radius) * w, (centery + cpOffset) * h));4354  radius = .1;4355  cpOffset = KAPPA * .1;4356  centerx = .4;4357  centery = .9;4358  var fig6 = new go.PathFigure((centerx - radius) * w, centery * h, true);4359  geo.add(fig6);4360  fig6.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,4361    (centerx - cpOffset) * w, (centery - radius) * h));4362  fig6.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,4363    (centerx + radius) * w, (centery - cpOffset) * h));4364  fig6.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,4365    (centerx + cpOffset) * w, (centery + radius) * h));4366  fig6.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,4367    (centerx - radius) * w, (centery + cpOffset) * h));4368  return geo;4369});4370go.Shape.defineFigureGenerator("RailShipment", function(shape, w, h) {4371  var geo = new go.Geometry();4372  var fig = new go.PathFigure(0.1 * w, 0.4 * h, true);4373  geo.add(fig);4374  // Left cart4375  fig.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.4 * h));4376  fig.add(new go.PathSegment(go.PathSegment.Line, 0.45 * w, 0.9 * h));4377  fig.add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0.9 * h));4378  fig.add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0.4 * h).close());4379  var fig2 = new go.PathFigure(0.45 * w, 0.7 * h, false);4380  geo.add(fig2);4381  // Line connecting carts4382  fig2.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, 0.7 * h));4383  var fig3 = new go.PathFigure(0.55 * w, 0.4 * h, true);4384  geo.add(fig3);4385  // Right cart4386  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.4 * h));4387  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.9 * h));4388  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, 0.9 * h));4389  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, 0.4 * h).close());4390  var radius = .05;4391  var cpOffset = KAPPA * .05;4392  var centerx = .175;4393  var centery = .95;4394  var fig4 = new go.PathFigure((centerx - radius) * w, centery * h, true);4395  geo.add(fig4);4396  // Wheels4397  fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,4398    (centerx - cpOffset) * w, (centery - radius) * h));4399  fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,4400    (centerx + radius) * w, (centery - cpOffset) * h));4401  fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,4402    (centerx + cpOffset) * w, (centery + radius) * h));4403  fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,4404    (centerx - radius) * w, (centery + cpOffset) * h));4405  var radius = .05;4406  var cpOffset = KAPPA * .05;4407  var centerx = .375;4408  var centery = .95;4409  var fig5 = new go.PathFigure((centerx - radius) * w, centery * h, true);4410  geo.add(fig5);4411  fig5.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,4412    (centerx - cpOffset) * w, (centery - radius) * h));4413  fig5.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,4414    (centerx + radius) * w, (centery - cpOffset) * h));4415  fig5.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,4416    (centerx + cpOffset) * w, (centery + radius) * h));4417  fig5.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,4418    (centerx - radius) * w, (centery + cpOffset) * h));4419  var radius = .05;4420  var cpOffset = KAPPA * .05;4421  var centerx = .625;4422  var centery = .95;4423  var fig6 = new go.PathFigure((centerx - radius) * w, centery * h, true);4424  geo.add(fig6);4425  fig6.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,4426    (centerx - cpOffset) * w, (centery - radius) * h));4427  fig6.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,4428    (centerx + radius) * w, (centery - cpOffset) * h));4429  fig6.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,4430    (centerx + cpOffset) * w, (centery + radius) * h));4431  fig6.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,4432    (centerx - radius) * w, (centery + cpOffset) * h));4433  var radius = .05;4434  var cpOffset = KAPPA * .05;4435  var centerx = .825;4436  var centery = .95;4437  var fig7 = new go.PathFigure((centerx - radius) * w, centery * h, true);4438  geo.add(fig7);4439  fig7.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,4440    (centerx - cpOffset) * w, (centery - radius) * h));4441  fig7.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,4442    (centerx + radius) * w, (centery - cpOffset) * h));4443  fig7.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,4444    (centerx + cpOffset) * w, (centery + radius) * h));4445  fig7.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,4446    (centerx - radius) * w, (centery + cpOffset) * h).close());4447  var fig8 = new go.PathFigure(0, h, false);4448  geo.add(fig8);4449  fig8.add(new go.PathSegment(go.PathSegment.Line, w, h).close());4450  return geo;4451});4452go.Shape.defineFigureGenerator("Warehouse", function(shape, w, h) {4453  var geo = new go.Geometry();4454  var fig = new go.PathFigure(0, 0, true);4455  geo.add(fig);4456  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));4457  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));4458  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));4459  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0).close());4460  var fig2 = new go.PathFigure(0, 0.2 * h, false);4461  geo.add(fig2);4462  fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0.2 * h).close());4463  var fig3 = new go.PathFigure(0.15 * w, h, true);4464  geo.add(fig3);4465  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, 0.5 * h));4466  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.40 * w, 0.5 * h));4467  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.40 * w, h));4468  fig3.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, h).close());4469  var radius = .05;4470  var cpOffset = KAPPA * .05;4471  var centerx = .35;4472  var centery = .775;4473  var fig4 = new go.PathFigure((centerx - radius) * w, centery * h, true);4474  geo.add(fig4);4475  // Door handle4476  fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,4477  (centerx - cpOffset) * w, (centery - radius) * h));4478  fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,4479  (centerx + radius) * w, (centery - cpOffset) * h));4480  fig4.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,4481  (centerx + cpOffset) * w, (centery + radius) * h));4482  fig4.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,4483  (centerx - radius) * w, (centery + cpOffset) * h).close());;4484  return geo;4485});4486go.Shape.defineFigureGenerator("ControlCenter", function(shape, w, h) {4487  var geo = new go.Geometry();4488  var fig = new go.PathFigure(0, h, true);4489  geo.add(fig);4490  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.8 * h));4491  fig.add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0.8 * h));4492  fig.add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0));4493  fig.add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0));4494  fig.add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.8 * h));4495  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.8 * h));4496  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));4497  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));4498  fig.add(new go.PathSegment(go.PathSegment.Move, 0.1 * w, 0.8 * h));4499  fig.add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.8 * h).close());4500  return geo;4501});4502go.Shape.defineFigureGenerator("Bluetooth", function(shape, w, h) {4503  var geo = new go.Geometry();4504  var fig = new go.PathFigure(0, 0.75 * h, false);4505  geo.add(fig);4506  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.75 * h));4507  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.25 * h));4508  fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0));4509  fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h));4510  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.75 * h));4511  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.25 * h));4512  return geo;4513});4514go.Shape.defineFigureGenerator("Bookmark", function(shape, w, h) {4515  var geo = new go.Geometry();4516  var fig = new go.PathFigure(0, 0, true);4517  geo.add(fig);4518  fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));4519  fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.6 * h));4520  fig.add(new go.PathSegment(go.PathSegment.Line, w, h));4521  fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));4522  fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));4523  fig.add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.2 * h));4524  fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.2 * h));