Best JavaScript code snippet using wpt
Figures.js
Source:Figures.js
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));4525 fig.add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.4 * h));4526 fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.4 * h));4527 return geo;4528});4529go.Shape.defineFigureGenerator("Bookmark", function(shape, w, h) {4530 var geo = new go.Geometry();4531 var fig = new go.PathFigure(0, 0, true);4532 geo.add(fig);4533 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));4534 fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.6 * h));4535 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));4536 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));4537 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0));4538 fig.add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.2 * h));4539 fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.2 * h));4540 fig.add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.4 * h));4541 fig.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.4 * h));4542 return geo;4543});4544go.Shape.defineFigureGenerator("Globe", function(shape, w, h) {4545 var geo = new go.Geometry();4546 var fig = new go.PathFigure(0.5 * w, 0, false);4547 geo.add(fig);4548 fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h));4549 fig.add(new go.PathSegment(go.PathSegment.Move, 0, 0.5 * h));4550 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h));4551 fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0));4552 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, 0.5 * h, 0.75 * w, 0, w, 0.25 * h));4553 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, h, w, 0.75 * h, 0.75 * w, h));4554 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0.5 * h, 0.25 * w, h, 0, 0.75 * h));4555 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0, 0, 0.25 * h, 0.25 * w, 0));4556 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, h, 0.15 * w, 0.25 * h, 0.15 * w, 0.75 * h));4557 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0, 0.85 * w, 0.75 * h, 0.85 * w, 0.25 * h));4558 fig.add(new go.PathSegment(go.PathSegment.Move, 0.1675 * w, 0.15 * h));4559 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.8325 * w, 0.15 * h, 0.35 * w, 0.3 * h, 0.65 * w, 0.3 * h));4560 fig.add(new go.PathSegment(go.PathSegment.Move, 0.1675 * w, 0.85 * h));4561 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.8325 * w, 0.85 * h, 0.35 * w, 0.7 * h, 0.65 * w, 0.7 * h));4562 return geo;4563});4564go.Shape.defineFigureGenerator("Wave", function(shape, w, h) {4565 var geo = new go.Geometry();4566 var fig = new go.PathFigure(0, 0.25 * h, false);4567 geo.add(fig);4568 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.3 * w, 0.25 * h, 0.10 * w, 0, 0.2 * w, 0));4569 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.7 * w, 0.25 * h, 0.425 * w, 0.5 * h, 0.575 * w, 0.5 * h));4570 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, 0.25 * h, 0.8 * w, 0, 0.9 * w, 0));4571 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.75 * h));4572 fig.add(new go.PathSegment(go.PathSegment.Move, 0, 0.25 * h));4573 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.75 * h));4574 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.3 * w, 0.75 * h, 0.10 * w, 0.5 * h, 0.2 * w, 0.5 * h));4575 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.7 * w, 0.75 * h, 0.425 * w, h, 0.575 * w, h));4576 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, 0.75 * h, 0.8 * w, 0.5 * h, 0.9 * w, 0.5 * h));4577 return geo;4578});4579go.Shape.defineFigureGenerator("Operator", function(shape, w, h) {4580 var geo = new go.Geometry();4581 var radius = .3;4582 var cpOffset = KAPPA * .3;4583 var centerx = .5;4584 var centery = .7;4585 var fig = new go.PathFigure((centerx - radius) * w, centery * h, true);4586 geo.add(fig);4587 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,4588 (centerx - cpOffset) * w, (centery - radius) * h));4589 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,4590 (centerx + radius) * w, (centery - cpOffset) * h));4591 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,4592 (centerx + cpOffset) * w, (centery + radius) * h));4593 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,4594 (centerx - radius) * w, (centery + cpOffset) * h));4595 var fig2 = new go.PathFigure(0, 0.7 * h, false);4596 geo.add(fig2);4597 fig2.add(new go.PathSegment(go.PathSegment.Bezier, w, 0.7 * h, 0, 0, w, 0));4598 return geo;4599});4600go.Shape.defineFigureGenerator("TripleFanBlades", function(shape, w, h) {4601 var geo = new go.Geometry();4602 var fig = new go.PathFigure(0.5 * w, 0, true);4603 geo.add(fig);4604 // Top blade4605 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.65 * h, 0.65 * w, 0.3 * h, 0.65 * w, 0.5 * h));4606 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0, 0.35 * w, 0.5 * h, 0.35 * w, 0.3 * h));4607 // Bottom left blade4608 fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.65 * h));4609 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, h, 0.3 * w, 0.6 * h, 0.1 * w, 0.8 * h));4610 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.65 * h, 0.2 * w, h, 0.35 * w, 0.95 * h));4611 // Bottom right blade4612 fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.65 * h));4613 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, h, 0.7 * w, 0.6 * h, 0.9 * w, 0.8 * h));4614 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.65 * h, 0.8 * w, h, 0.65 * w, 0.95 * h));4615 return geo;4616});4617go.Shape.defineFigureGenerator("CentrifugalPump", function(shape, w, h) {4618 var geo = new go.Geometry();4619 var fig = new go.PathFigure(w, 0, true);4620 geo.add(fig);4621 fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0));4622 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0.5 * h, 0, 0.075 * h, 0, 0.5 * h));4623 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.4 * w, h, 0, h, 0.4 * w, h));4624 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.8 * w, 0.4 * h, 0.8 * w, h, 0.85 * w, 0.6 * h));4625 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.4 * h));4626 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0));4627 return geo;4628});4629go.Shape.defineFigureGenerator("Battery", function(shape, w, h) {4630 var geo = new go.Geometry();4631 var fig = new go.PathFigure(0, h, true);4632 geo.add(fig);4633 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.1 * h));4634 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.1 * h));4635 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));4636 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));4637 fig.add(new go.PathSegment(go.PathSegment.Move, 0.4 * w, 0.1 * h));4638 fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0));4639 fig.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0));4640 fig.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0.1 * h));4641 var fig2 = new go.PathFigure(0, 0.6 * h, false);4642 geo.add(fig2);4643 fig2.add(new go.PathSegment(go.PathSegment.Move, 0, 0.4 * h));4644 fig2.add(new go.PathSegment(go.PathSegment.Line, w, 0.4 * h));4645 return geo;4646});4647go.Shape.defineFigureGenerator("Delete", function(shape, w, h) {4648 var geo = new go.Geometry();4649 var radius = .5;4650 var cpOffset = KAPPA * .5;4651 var centerx = .5;4652 var centery = .5;4653 var fig = new go.PathFigure((centerx - radius) * w, centery * h, true);4654 geo.add(fig);4655 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,4656 (centerx - cpOffset) * w, (centery - radius) * h));4657 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,4658 (centerx + radius) * w, (centery - cpOffset) * h));4659 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,4660 (centerx + cpOffset) * w, (centery + radius) * h));4661 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,4662 (centerx - radius) * w, (centery + cpOffset) * h));4663 var fig2 = new go.PathFigure(0.15 * w, 0.5 * h, false);4664 geo.add(fig2);4665 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.85 * w, 0.5 * h));4666 return geo;4667});4668go.Shape.defineFigureGenerator("Flag", function(shape, w, h) {4669 var geo = new go.Geometry();4670 var fig = new go.PathFigure(0, 0.1 * h, true);4671 geo.add(fig);4672 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));4673 fig.add(new go.PathSegment(go.PathSegment.Move, 0, 0.1 * h));4674 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.1 * h, 0.15 * w, 0, 0.35 * w, 0));4675 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, 0.1 * h, 0.65 * w, 0.2 * h, 0.85 * w, 0.2 * h));4676 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h));4677 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.5 * h, 0.85 * w, 0.6 * h, 0.65 * w, 0.6 * h));4678 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0.5 * h, 0.35 * w, 0.4 * h, 0.15 * w, 0.4 * h).close());4679 return geo;4680});4681go.Shape.defineFigureGenerator("Help", function(shape, w, h) {4682 var geo = new go.Geometry();4683 var radius = .5;4684 var cpOffset = KAPPA * .5;4685 var centerx = .5;4686 var centery = .5;4687 var fig = new go.PathFigure((centerx - radius) * w, centery * h, false);4688 geo.add(fig);4689 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,4690 (centerx - cpOffset) * w, (centery - radius) * h));4691 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,4692 (centerx + radius) * w, (centery - cpOffset) * h));4693 fig.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,4694 (centerx + cpOffset) * w, (centery + radius) * h));4695 fig.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,4696 (centerx - radius) * w, (centery + cpOffset) * h).close());4697 radius = .05;4698 cpOffset = KAPPA * .05;4699 centerx = .5;4700 centery = .8;4701 var fig2 = new go.PathFigure((centerx - radius) * w, centery * h, false);4702 geo.add(fig2);4703 fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery - radius) * h, (centerx - radius) * w, (centery - cpOffset) * h,4704 (centerx - cpOffset) * w, (centery - radius) * h));4705 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx + radius) * w, centery * h, (centerx + cpOffset) * w, (centery - radius) * h,4706 (centerx + radius) * w, (centery - cpOffset) * h));4707 fig2.add(new go.PathSegment(go.PathSegment.Bezier, centerx * w, (centery + radius) * h, (centerx + radius) * w, (centery + cpOffset) * h,4708 (centerx + cpOffset) * w, (centery + radius) * h));4709 fig2.add(new go.PathSegment(go.PathSegment.Bezier, (centerx - radius) * w, centery * h, (centerx - cpOffset) * w, (centery + radius) * h,4710 (centerx - radius) * w, (centery + cpOffset) * h).close());4711 fig2.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.7 * h));4712 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.5 * h));4713 fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0.2 * h, 0.75 * w, 0.475 * h, 0.75 * w, 0.225 * h));4714 fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0.3 * w, 0.35 * h, 0.4 * w, 0.2 * h, 0.3 * w, 0.25 * h));4715 return geo;4716});4717go.Shape.defineFigureGenerator("Location", function(shape, w, h) {4718 return new go.Geometry()4719 .add(new go.PathFigure(0.5 * w, h, true)4720 .add(new go.PathSegment(go.PathSegment.Line, 0.75 * w, 0.5 * h))4721 .add(new go.PathSegment(go.PathSegment.Bezier, 0.5 * w, 0, .975 * w, 0.025 * h, 0.5 * w, 0))4722 .add(new go.PathSegment(go.PathSegment.Bezier, 0.25 * w, 0.5 * h, 0.5 * w, 0, 0.025 * w, 0.025 * h).close())4723 .add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.2 * h))4724 .add(new go.PathSegment(go.PathSegment.Arc, 270, 360, 0.5 * w, 0.3 * h, 0.1 * w, 0.1 * h).close()));4725});4726go.Shape.defineFigureGenerator("Lock", function(shape, w, h) {4727 var geo = new go.Geometry();4728 var fig = new go.PathFigure(0, 0.5 * h, true);4729 geo.add(fig);4730 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));4731 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));4732 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h));4733 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.5 * h));4734 var fig2 = new go.PathFigure(0.2 * w, 0.5 * h, false);4735 geo.add(fig2);4736 fig2.add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.5 * h));4737 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, 0.3 * h));4738 fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0.8 * w, 0.3 * h, 0.25 * w, 0, 0.75 * w, 0));4739 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.5 * h));4740 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.3 * h));4741 return geo;4742});4743go.Shape.defineFigureGenerator("Unlocked", function(shape, w, h) {4744 var geo = new go.Geometry();4745 var fig = new go.PathFigure(0, 0.5 * h, true);4746 geo.add(fig);4747 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h));4748 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));4749 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.5 * h));4750 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.5 * h));4751 var fig2 = new go.PathFigure(0.2 * w, 0.5 * h, false);4752 geo.add(fig2);4753 fig2.add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.5 * h));4754 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, 0.3 * h));4755 fig2.add(new go.PathSegment(go.PathSegment.Bezier, 0.8 * w, 0.3 * h, 0.25 * w, 0, 0.75 * w, 0));4756 fig2.add(new go.PathSegment(go.PathSegment.Line, 0.8 * w, 0.35 * h));4757 return geo;4758});4759go.Shape.defineFigureGenerator("Gear", function(shape, w, h) {4760 return new go.Geometry()4761 .add(new go.PathFigure(0.9375 * w, 0.56246875 * h, true)4762 .add(new go.PathSegment(go.PathSegment.Line, 0.9375 * w, 0.4375 * h))4763 .add(new go.PathSegment(go.PathSegment.Line, 0.80621875 * w, 0.4375 * h))4764 .add(new go.PathSegment(go.PathSegment.Bezier, 0.763 * w, 0.3316875 * h, 0.79840625 * w, 0.39915625 * h, 0.7834375 * w, 0.3635 * h))4765 .add(new go.PathSegment(go.PathSegment.Line, 0.8566875 * w, 0.23796875 * h))4766 .add(new go.PathSegment(go.PathSegment.Line, 0.76825 * w, 0.14959375 * h))4767 .add(new go.PathSegment(go.PathSegment.Line, 0.67596875 * w, 0.24184375 * h))4768 .add(new go.PathSegment(go.PathSegment.Bezier, 0.5625 * w, 0.19378125 * h, 0.64228125 * w, 0.2188125 * h, 0.603875 * w, 0.2021875 * h))4769 .add(new go.PathSegment(go.PathSegment.Line, 0.5625 * w, 0.0625 * h))4770 .add(new go.PathSegment(go.PathSegment.Line, 0.4375 * w, 0.0625 * h))4771 .add(new go.PathSegment(go.PathSegment.Line, 0.4375 * w, 0.19378125 * h))4772 .add(new go.PathSegment(go.PathSegment.Bezier, 0.32775 * w, 0.239375 * h, 0.39759375 * w, 0.20190625 * h, 0.36053125 * w, 0.2176875 * h))4773 .add(new go.PathSegment(go.PathSegment.Line, 0.2379375 * w, 0.14959375 * h))4774 .add(new go.PathSegment(go.PathSegment.Line, 0.14953125 * w, 0.2379375 * h))4775 .add(new go.PathSegment(go.PathSegment.Line, 0.23934375 * w, 0.3278125 * h))4776 .add(new go.PathSegment(go.PathSegment.Bezier, 0.19378125 * w, 0.4375 * h, 0.21765625 * w, 0.36059375 * h, 0.201875 * w, 0.397625 * h))4777 .add(new go.PathSegment(go.PathSegment.Line, 0.0625 * w, 0.4375 * h))4778 .add(new go.PathSegment(go.PathSegment.Line, 0.0625 * w, 0.5625 * h))4779 .add(new go.PathSegment(go.PathSegment.Line, 0.1938125 * w, 0.5625 * h))4780 .add(new go.PathSegment(go.PathSegment.Bezier, 0.241875 * w, 0.67596875 * h, 0.20221875 * w, 0.603875 * h, 0.21884375 * w, 0.64228125 * h))4781 .add(new go.PathSegment(go.PathSegment.Line, 0.1495625 * w, 0.76825 * h))4782 .add(new go.PathSegment(go.PathSegment.Line, 0.238 * w, 0.8566875 * h))4783 .add(new go.PathSegment(go.PathSegment.Line, 0.3316875 * w, 0.76296875 * h))4784 .add(new go.PathSegment(go.PathSegment.Bezier, 0.43753125 * w, 0.80621875 * h, 0.36353125 * w, 0.78340625 * h, 0.3991875 * w, 0.79840625 * h))4785 .add(new go.PathSegment(go.PathSegment.Line, 0.43753125 * w, 0.9375 * h))4786 .add(new go.PathSegment(go.PathSegment.Line, 0.5625 * w, 0.9375 * h))4787 .add(new go.PathSegment(go.PathSegment.Line, 0.5625 * w, 0.80621875 * h))4788 .add(new go.PathSegment(go.PathSegment.Bezier, 0.67225 * w, 0.760625 * h, 0.602375 * w, 0.79809375 * h, 0.63946875 * w, 0.78234375 * h))4789 .add(new go.PathSegment(go.PathSegment.Line, 0.76828125 * w, 0.8566875 * h))4790 .add(new go.PathSegment(go.PathSegment.Line, 0.85671875 * w, 0.76825 * h))4791 .add(new go.PathSegment(go.PathSegment.Line, 0.76065625 * w, 0.67221875 * h))4792 .add(new go.PathSegment(go.PathSegment.Bezier, 0.80621875 * w, 0.56246875 * h, 0.78234375 * w, 0.63940625 * h, 0.798125 * w, 0.602375 * h))4793 .add(new go.PathSegment(go.PathSegment.Line, 0.9375 * w, 0.56246875 * h).close())4794 .add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.6 * h))4795 .add(new go.PathSegment(go.PathSegment.Arc, 90, 360, 0.5 * w, 0.5 * h, 0.1 * w, 0.1 * h).close()));4796});4797go.Shape.defineFigureGenerator("Hand", function(shape, w, h) {4798 var geo = new go.Geometry();4799 var fig = new go.PathFigure(0, 0.5 * h, false);4800 geo.add(fig);4801 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.1 * w, 0.3 * h, 0, 0.375 * h, 0.05 * w, 0.325 * h));4802 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.45 * w, 0.075 * h, 0.3 * w, 0.225 * h, 0.4 * w, 0.175 * h));4803 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.525 * w, 0.075 * h, 0.46 * w, 0.05 * h, 0.525 * w, 0.05 * h));4804 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.3 * w, 0.4 * h, 0.525 * w, 0.275 * h, 0.475 * w, 0.325 * h));4805 fig.add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.4 * h));4806 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.9 * w, 0.55 * h, w, 0.4 * h, w, 0.55 * h));4807 fig.add(new go.PathSegment(go.PathSegment.Line, 0.425 * w, 0.55 * h));4808 fig.add(new go.PathSegment(go.PathSegment.Move, 0.6 * w, 0.55 * h));4809 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.6 * w, 0.7 * h, 0.675 * w, 0.55 * h, 0.675 * w, 0.7 * h));4810 fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0.7 * h));4811 fig.add(new go.PathSegment(go.PathSegment.Move, 0.575 * w, 0.7 * h));4812 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.575 * w, 0.85 * h, 0.65 * w, 0.7 * h, 0.65 * w, 0.85 * h));4813 fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0.85 * h));4814 fig.add(new go.PathSegment(go.PathSegment.Move, 0.525 * w, 0.85 * h));4815 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.535 * w, h, 0.61 * w, 0.85 * h, 0.61 * w, h));4816 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, 0.9 * h, 0.435 * w, h, 0, h));4817 fig.add(new go.PathSegment(go.PathSegment.Line, 0, 0.5 * h));4818 return geo;4819});4820go.Shape.defineFigureGenerator("Map", function(shape, w, h) {4821 var geo = new go.Geometry();4822 var fig = new go.PathFigure(0, 0.2 * h, true);4823 geo.add(fig);4824 fig.add(new go.PathSegment(go.PathSegment.Line, 0.25 * w, 0));4825 fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.2 * h));4826 fig.add(new go.PathSegment(go.PathSegment.Line, 0.75 * w, 0));4827 fig.add(new go.PathSegment(go.PathSegment.Line, w, 0.2 * h));4828 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));4829 fig.add(new go.PathSegment(go.PathSegment.Line, 0.75 * w, 0.8 * h));4830 fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h));4831 fig.add(new go.PathSegment(go.PathSegment.Line, 0.25 * w, 0.8 * h));4832 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h).close());4833 fig.add(new go.PathSegment(go.PathSegment.Move, 0.25 * w, 0));4834 fig.add(new go.PathSegment(go.PathSegment.Line, 0.25 * w, 0.8 * h));4835 fig.add(new go.PathSegment(go.PathSegment.Move, 0.5 * w, 0.2 * h));4836 fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, h));4837 fig.add(new go.PathSegment(go.PathSegment.Move, 0.75 * w, 0));4838 fig.add(new go.PathSegment(go.PathSegment.Line, 0.75 * w, 0.8 * h));4839 return geo;4840});4841go.Shape.defineFigureGenerator("Eject", function(shape, w, h) {4842 var geo = new go.Geometry();4843 var fig = new go.PathFigure(0, h, true);4844 geo.add(fig);4845 // bottam rectangle section4846 fig.add(new go.PathSegment(go.PathSegment.Line, w, h));4847 fig.add(new go.PathSegment(go.PathSegment.Line, w, h * .7));4848 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * .7).close());4849 var fig2 = new go.PathFigure(0, (h * .6), true);4850 geo.add(fig2);4851 fig2.add(new go.PathSegment(go.PathSegment.Line, w, (.6 * h)));4852 fig2.add(new go.PathSegment(go.PathSegment.Line, .5 * w, 0).close());4853 return geo;4854});4855go.Shape.defineFigureGenerator("Pencil", function(shape, w, h) {4856 return new go.Geometry()4857 .add(new go.PathFigure(0, 0, true)4858 .add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, 0.1 * h))4859 .add(new go.PathSegment(go.PathSegment.Line, w, 0.9 * h))4860 .add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, h))4861 .add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0.2 * h).close()));4862 });4863go.Shape.defineFigureGenerator("Building", function(shape, w, h) {4864 var geo = new go.Geometry();4865 var fig = new go.PathFigure(w * 1, h * 1, false);4866 geo.add(fig);4867 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * 1)); // bottom part4868 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * .85));4869 fig.add(new go.PathSegment(go.PathSegment.Line, .046 * w, h * .85));4870 fig.add(new go.PathSegment(go.PathSegment.Line, .046 * w, h * .45));4871 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * .45));4872 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * .30));4873 fig.add(new go.PathSegment(go.PathSegment.Line, .046 * w, h * .30));4874 fig.add(new go.PathSegment(go.PathSegment.Line, .5 * w, h * 0));4875 fig.add(new go.PathSegment(go.PathSegment.Line, (1 - .046) * w, h * .30));4876 fig.add(new go.PathSegment(go.PathSegment.Line, w, h * .30));4877 fig.add(new go.PathSegment(go.PathSegment.Line, w, h * .45));4878 fig.add(new go.PathSegment(go.PathSegment.Line, (1 - .046) * w, h * .45));4879 fig.add(new go.PathSegment(go.PathSegment.Line, (1 - .046) * w, h * .85));4880 fig.add(new go.PathSegment(go.PathSegment.Line, w, h * .85).close());4881 var fig2 = new go.PathFigure(.126 * w, .85 * h, false); // is filled in our not4882 geo.add(fig2);4883 fig2.add(new go.PathSegment(go.PathSegment.Line, .126 * w, .45 * h));4884 fig2.add(new go.PathSegment(go.PathSegment.Line, .322 * w, .45 * h));4885 fig2.add(new go.PathSegment(go.PathSegment.Line, .322 * w, .85 * h).close());4886 var fig3 = new go.PathFigure(.402 * w, .85 * h, false); // is filled in our not4887 geo.add(fig3);4888 fig3.add(new go.PathSegment(go.PathSegment.Line, .402 * w, .45 * h));4889 fig3.add(new go.PathSegment(go.PathSegment.Line, .598 * w, .45 * h));4890 fig3.add(new go.PathSegment(go.PathSegment.Line, .598 * w, .85 * h).close());4891 var fig4 = new go.PathFigure(.678 * w, .85 * h, false); // is filled in our not4892 geo.add(fig4);4893 fig4.add(new go.PathSegment(go.PathSegment.Line, .678 * w, .45 * h));4894 fig4.add(new go.PathSegment(go.PathSegment.Line, .874 * w, .45 * h));4895 fig4.add(new go.PathSegment(go.PathSegment.Line, .874 * w, .85 * h).close());4896 // the top inner triangle4897 var fig5 = new go.PathFigure(.5 * w, .1 * h, false); // is filled in our not4898 geo.add(fig5);4899 fig5.add(new go.PathSegment(go.PathSegment.Line, (.046 + .15) * w, .30 * h));4900 fig5.add(new go.PathSegment(go.PathSegment.Line, (1 - (.046 + .15)) * w, .30 * h).close());4901 return geo;4902});4903go.Shape.defineFigureGenerator("Staircase", function(shape, w, h) {4904 var geo = new go.Geometry();4905 var fig = new go.PathFigure(0, h * 1, true);4906 geo.add(fig);4907 // Bottom part4908 fig.add(new go.PathSegment(go.PathSegment.Line, w * .20, h * 1)); // bottom left part4909 fig.add(new go.PathSegment(go.PathSegment.Line, w * .20, h * .80));4910 fig.add(new go.PathSegment(go.PathSegment.Line, w * .40, h * .80));4911 fig.add(new go.PathSegment(go.PathSegment.Line, w * .40, h * .60));4912 fig.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * .60));4913 fig.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * .40));4914 fig.add(new go.PathSegment(go.PathSegment.Line, w * .80, h * .40));4915 fig.add(new go.PathSegment(go.PathSegment.Line, w * .80, h * .20));4916 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .20));4917 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .15));4918 fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * .15));4919 fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * .35));4920 fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, h * .35));4921 fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, h * .55));4922 fig.add(new go.PathSegment(go.PathSegment.Line, w * .35, h * .55));4923 fig.add(new go.PathSegment(go.PathSegment.Line, w * .35, h * .75));4924 fig.add(new go.PathSegment(go.PathSegment.Line, w * .15, h * .75));4925 fig.add(new go.PathSegment(go.PathSegment.Line, w * .15, h * .95));4926 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * .95).close());4927 return geo;4928});4929go.Shape.defineFigureGenerator("5Bars", function(shape, w, h) {4930 var geo = new go.Geometry();4931 var fig = new go.PathFigure(0, h * 1, true); // bottom left4932 geo.add(fig);4933 // Width of each bar is .1844934 // space in between each bar is .24935 fig.add(new go.PathSegment(go.PathSegment.Line, w * .184, h * 1)); // bottom left part4936 fig.add(new go.PathSegment(go.PathSegment.Line, w * .184, h * (1 - .184)).close());4937 var fig3 = new go.PathFigure(w * .204, h, true); // is filled in our not4938 geo.add(fig3);4939 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .204, h * (1 - .184)));4940 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .388, h * (1 - (.184 * 2))));4941 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .388, h * 1).close());4942 var fig4 = new go.PathFigure(w * .408, h, true); // is filled in our not4943 geo.add(fig4);4944 fig4.add(new go.PathSegment(go.PathSegment.Line, w * .408, h * (1 - (.184 * 2))));4945 fig4.add(new go.PathSegment(go.PathSegment.Line, w * .592, h * (1 - (.184 * 3))));4946 fig4.add(new go.PathSegment(go.PathSegment.Line, w * .592, h * 1).close());4947 var fig5 = new go.PathFigure(w * .612, h, true); // is filled in our not4948 geo.add(fig5);4949 fig5.add(new go.PathSegment(go.PathSegment.Line, w * .612, h * (1 - (.184 * 3))));4950 fig5.add(new go.PathSegment(go.PathSegment.Line, w * .796, h * (1 - (.184 * 4))));4951 fig5.add(new go.PathSegment(go.PathSegment.Line, w * .796, h * 1).close());4952 var fig6 = new go.PathFigure(w * .816, h, true); // is filled in our not4953 geo.add(fig6);4954 fig6.add(new go.PathSegment(go.PathSegment.Line, w * .816, h * (1 - (.184 * 4))));4955 fig6.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * (1 - (.184 * 5))));4956 fig6.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1).close());4957 return geo;4958});4959go.Shape.defineFigureGenerator("PC", function(shape, w, h) {4960 var geo = new go.Geometry();4961 var fig = new go.PathFigure(0, 0, true); // top right4962 geo.add(fig);4963 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * 1));4964 fig.add(new go.PathSegment(go.PathSegment.Line, w * .3, h * 1));4965 fig.add(new go.PathSegment(go.PathSegment.Line, w * .3, 0).close());4966 // Drive looking rectangle 14967 var fig2 = new go.PathFigure(w * .055, .07 * h, true); // is filled in our not4968 geo.add(fig2);4969 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .245, h * .07));4970 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .245, h * .1));4971 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .055, h * .1).close());4972 // Drive looking rectangle 24973 var fig3 = new go.PathFigure(w * .055, .13 * h, true); // is filled in our not4974 geo.add(fig3);4975 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .245, h * .13));4976 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .245, h * .16));4977 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .055, h * .16).close());4978 // Drive/cd rom looking rectangle 34979 var fig4 = new go.PathFigure(w * .055, .18 * h, true); // is filled in our not4980 geo.add(fig4);4981 fig4.add(new go.PathSegment(go.PathSegment.Line, w * .245, h * .18));4982 fig4.add(new go.PathSegment(go.PathSegment.Line, w * .245, h * .21));4983 fig4.add(new go.PathSegment(go.PathSegment.Line, w * .055, h * .21).close());4984 var fig5 = new go.PathFigure(w * 1, 0, true); // is filled in our not4985 geo.add(fig5);4986 fig5.add(new go.PathSegment(go.PathSegment.Line, w * .4, 0));4987 fig5.add(new go.PathSegment(go.PathSegment.Line, w * .4, h * .65));4988 fig5.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .65).close());4989 return geo;4990});4991go.Shape.defineFigureGenerator("Plane", function(shape, w, h) {4992 var geo = new go.Geometry();4993 var fig = new go.PathFigure(0.55 * w, h, true);4994 geo.add(fig);4995 fig.add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.6 * h));4996 fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0.7 * h));4997 fig.add(new go.PathSegment(go.PathSegment.Line, .1 * w, 0.475 * h));4998 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.35 * w, 0.525 * h, 0, 0.4 * h, 0.225 * w, 0.45 * h));4999 fig.add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0.475 * h));5000 fig.add(new go.PathSegment(go.PathSegment.Line, 0.15 * w, 0.35 * h));5001 fig.add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, 0.325 * h));5002 fig.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0.325 * h));5003 fig.add(new go.PathSegment(go.PathSegment.Line, 0.85 * w, 0.1 * h));5004 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0.9 * w, 0.2 * h, 0.975 * w, 0, w, .08 * h));5005 fig.add(new go.PathSegment(go.PathSegment.Line, 0.7 * w, 0.45 * h));5006 fig.add(new go.PathSegment(go.PathSegment.Line, 0.6 * w, 0.95 * h));5007 fig.add(new go.PathSegment(go.PathSegment.Line, 0.55 * w, h).close());5008 return geo;5009});5010go.Shape.defineFigureGenerator("Key", function(shape, w, h) {5011 var geo = new go.Geometry();5012 var fig = new go.PathFigure(w * 1, h * .5, true);5013 geo.add(fig);5014 fig.add(new go.PathSegment(go.PathSegment.Line, w * .90, .40 * h));5015 fig.add(new go.PathSegment(go.PathSegment.Line, w * .50, .40 * h));5016 fig.add(new go.PathSegment(go.PathSegment.Line, w * .50, .35 * h));5017 fig.add(new go.PathSegment(go.PathSegment.Line, w * .45, .35 * h));5018 fig.add(new go.PathSegment(go.PathSegment.Line, w * .30, .20 * h));5019 fig.add(new go.PathSegment(go.PathSegment.Line, w * .15, .20 * h));5020 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .35 * h));5021 fig.add(new go.PathSegment(go.PathSegment.Line, 0, .65 * h));5022 fig.add(new go.PathSegment(go.PathSegment.Line, w * .15, .80 * h));5023 fig.add(new go.PathSegment(go.PathSegment.Line, w * .30, .80 * h));5024 fig.add(new go.PathSegment(go.PathSegment.Line, w * .45, .65 * h));5025 fig.add(new go.PathSegment(go.PathSegment.Line, w * .50, .65 * h));5026 fig.add(new go.PathSegment(go.PathSegment.Line, w * .50, .6 * h));5027 fig.add(new go.PathSegment(go.PathSegment.Line, w * .60, .6 * h));5028 fig.add(new go.PathSegment(go.PathSegment.Line, w * .65, .55 * h));5029 fig.add(new go.PathSegment(go.PathSegment.Line, w * .70, .6 * h));5030 fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, .55 * h));5031 fig.add(new go.PathSegment(go.PathSegment.Line, w * .80, .6 * h));5032 fig.add(new go.PathSegment(go.PathSegment.Line, w * .85, .575 * h));5033 fig.add(new go.PathSegment(go.PathSegment.Line, w * .9, 0.60 * h).close());5034 fig.add(new go.PathSegment(go.PathSegment.Move, 0.17 * w, 0.425 * h));5035 fig.add(new go.PathSegment(go.PathSegment.Arc, 270, 360, 0.17 * w, 0.5 * h, 0.075 * w, 0.075 * h).close());5036 return geo;5037});5038// movie like logo5039go.Shape.defineFigureGenerator("FilmTape", function(shape, w, h) {5040 var geo = new go.Geometry();5041 var fig = new go.PathFigure(0, 0, false);5042 geo.add(fig);5043 fig.add(new go.PathSegment(go.PathSegment.Arc, 270, 180, w * 0, w * 0.3, w * 0.055)); // left semi-circle5044 fig.add(new go.PathSegment(go.PathSegment.Line, 0, h * 1));5045 fig.add(new go.PathSegment(go.PathSegment.Line, w * .08, h * 1));5046 fig.add(new go.PathSegment(go.PathSegment.Line, w * .08, h * .95));5047 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 1), h * .95));5048 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 1), h * 1));5049 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 2), h * 1));5050 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 2), h * .95));5051 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 3), h * .95));5052 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 3), h * 1));5053 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 4), h * 1));5054 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 4), h * .95));5055 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 5), h * .95));5056 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 5), h * 1));5057 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 6), h * 1));5058 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 6), h * .95));5059 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 7), h * .95));5060 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 7), h * 1));5061 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 8), h * 1));5062 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 8), h * .95));5063 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 9), h * .95));5064 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 9), h * 1));5065 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 10), h * 1));5066 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 10), h * .95));5067 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 11), h * .95));5068 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 11), h * 1));5069 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 12), h * 1));5070 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 12), h * .95));5071 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 13), h * .95));5072 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 13), h * 1));5073 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 14), h * 1));5074 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 14), h * .95));5075 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 15), h * .95));5076 fig.add(new go.PathSegment(go.PathSegment.Line, w * (.08 + .056 * 15), h * 1));5077 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1));5078 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1));5079 var fig2 = new go.PathFigure(0, 0, false); // is filled in our not5080 geo.add(fig2);5081 fig2.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 0));5082 fig2.add(new go.PathSegment(go.PathSegment.Arc, 270, -180, w * 1, w * 0.3, w * 0.055)); // right semi circle5083 fig2.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1));5084 // Each of the little square boxes on the tape5085 var fig3 = new go.PathFigure(w * .11, h * .1, false); // is filled in our not5086 geo.add(fig3);5087 fig3.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 1) + (.028 * 0)), h * .1));5088 fig3.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 1) + (.028 * 0)), h * .8));5089 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .11, h * .8).close());5090 var fig4 = new go.PathFigure(w * (.11 + (.24133333 * 1) + (.028 * 1)), h * .1, false); // is filled in our not5091 geo.add(fig4);5092 fig4.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 2) + (.028 * 1)), h * .1));5093 fig4.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 2) + (.028 * 1)), h * .8));5094 fig4.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 1) + (.028 * 1)), h * .8).close());5095 var fig5 = new go.PathFigure(w * (.11 + (.24133333 * 2) + (.028 * 2)), h * .1, false); // is filled in our not5096 geo.add(fig5);5097 fig5.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 3) + (.028 * 2)), h * .1));5098 fig5.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 3) + (.028 * 2)), h * .8));5099 fig5.add(new go.PathSegment(go.PathSegment.Line, w * (.11 + (.24133333 * 2) + (.028 * 2)), h * .8).close());5100 return geo;5101});5102go.Shape.defineFigureGenerator("FloppyDisk", function(shape, w, h) {5103 var geo = new go.Geometry();5104 var roundValue = 8;5105 var cpOffset = roundValue * KAPPA;5106 var fig = new go.PathFigure(roundValue, 0, false);5107 geo.add(fig);5108 fig.add(new go.PathSegment(go.PathSegment.Line, w * .86, 0));5109 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .14));5110 fig.add(new go.PathSegment(go.PathSegment.Line, w, h - roundValue));5111 fig.add(new go.PathSegment(go.PathSegment.Bezier, w - roundValue, h, w, h - cpOffset, w - cpOffset, h));5112 fig.add(new go.PathSegment(go.PathSegment.Line, roundValue, h));5113 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, h - roundValue, cpOffset, h, 0, h - cpOffset));5114 fig.add(new go.PathSegment(go.PathSegment.Line, 0, roundValue));5115 fig.add(new go.PathSegment(go.PathSegment.Bezier, roundValue, 0, 0, cpOffset, cpOffset, 0).close());5116 // interior slightly rectangle5117 var fig2 = new go.PathFigure(w * .83, 0, false);5118 geo.add(fig2);5119 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .83, h * .3));5120 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .17, h * .3));5121 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .17, h * 0).close());5122 var fig3 = new go.PathFigure(w * .83, h * 1, false);5123 geo.add(fig3);5124 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .83, h * .5));5125 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .17, h * .5));5126 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .17, h * 1).close());5127 var fig4 = new go.PathFigure(w * .78, h * .05, false);5128 geo.add(fig4);5129 fig4.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * .05));5130 fig4.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * .25));5131 fig4.add(new go.PathSegment(go.PathSegment.Line, w * .78, h * .25).close());5132 return geo;5133});5134go.Shape.defineFigureGenerator("SpeechBubble", function(shape, w, h) {5135 var param1 = shape ? shape.parameter1 : NaN;5136 if (isNaN(param1) || param1 < 0) param1 = 15; // default corner5137 param1 = Math.min(param1, w / 3);5138 param1 = Math.min(param1, h / 3);5139 var cpOffset = param1 * KAPPA;5140 var bubbleH = h * .8; // leave some room at bottom for pointer5141 var geo = new go.Geometry();5142 var fig = new go.PathFigure(param1, 0, true);5143 geo.add(fig);5144 fig.add(new go.PathSegment(go.PathSegment.Line, w - param1, 0));5145 fig.add(new go.PathSegment(go.PathSegment.Bezier, w, param1, w - cpOffset, 0, w, cpOffset));5146 fig.add(new go.PathSegment(go.PathSegment.Line, w, bubbleH - param1));5147 fig.add(new go.PathSegment(go.PathSegment.Bezier, w - param1, bubbleH, w, bubbleH - cpOffset, w - cpOffset, bubbleH));5148 fig.add(new go.PathSegment(go.PathSegment.Line, w * .70, bubbleH));5149 fig.add(new go.PathSegment(go.PathSegment.Line, w * .70, h));5150 fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, bubbleH));5151 fig.add(new go.PathSegment(go.PathSegment.Line, param1, bubbleH));5152 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, bubbleH - param1, cpOffset, bubbleH, 0, bubbleH - cpOffset));5153 fig.add(new go.PathSegment(go.PathSegment.Line, 0, param1));5154 fig.add(new go.PathSegment(go.PathSegment.Bezier, param1, 0, 0, cpOffset, cpOffset, 0).close());5155 if (cpOffset > 1) {5156 geo.spot1 = new go.Spot(0, 0, cpOffset, cpOffset);5157 geo.spot2 = new go.Spot(1, .8, -cpOffset, -cpOffset);5158 } else {5159 geo.spot1 = go.Spot.TopLeft;5160 geo.spot2 = new go.Spot(1, .8);5161 }5162 return geo;5163});5164go.Shape.defineFigureGenerator("Repeat", function(shape, w, h) {5165 var geo = new go.Geometry();5166 var fig = new go.PathFigure(w * 0, h * .45, true);5167 geo.add(fig);5168 fig.add(new go.PathSegment(go.PathSegment.Line, w * .25, h * 0));5169 fig.add(new go.PathSegment(go.PathSegment.Line, w * .50, h * .45));5170 fig.add(new go.PathSegment(go.PathSegment.Line, w * .30, h * .45));5171 fig.add(new go.PathSegment(go.PathSegment.Line, w * .30, h * .90));5172 fig.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * .90));5173 fig.add(new go.PathSegment(go.PathSegment.Line, w * .65, h * 1));5174 fig.add(new go.PathSegment(go.PathSegment.Line, w * .20, h * 1));5175 fig.add(new go.PathSegment(go.PathSegment.Line, w * .20, h * .45).close());5176 var fig2 = new go.PathFigure(w * 1, h * .55, true); // is filled in our not5177 geo.add(fig2);5178 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * 1));5179 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .50, h * .55));5180 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .70, h * .55));5181 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .70, h * .10));5182 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .40, h * .10));5183 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .35, h * 0));5184 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .80, h * 0));5185 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .80, h * .55).close());5186 return geo;5187});5188go.Shape.defineFigureGenerator("Windows", function(shape, w, h) {5189 return new go.Geometry()5190 .add(new go.PathFigure(0, 0, true)5191 .add(new go.PathSegment(go.PathSegment.Line, w, 0))5192 .add(new go.PathSegment(go.PathSegment.Line, w, h))5193 .add(new go.PathSegment(go.PathSegment.Line, 0, h).close())5194 .add(new go.PathSegment(go.PathSegment.Move, 0.4 * w, 0.4 * h))5195 .add(new go.PathSegment(go.PathSegment.Line, 0.4 * w, 0.8 * h))5196 .add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.8 * h))5197 .add(new go.PathSegment(go.PathSegment.Line, 0.9 * w, 0.4 * h).close())5198 .add(new go.PathSegment(go.PathSegment.Move, 0.2 * w, 0.1 * h))5199 .add(new go.PathSegment(go.PathSegment.Line, 0.2 * w, 0.6 * h))5200 .add(new go.PathSegment(go.PathSegment.Line, 0.7 * w, 0.6 * h))5201 .add(new go.PathSegment(go.PathSegment.Line, 0.7 * w, 0.1 * h).close())5202 .add(new go.PathSegment(go.PathSegment.Move, 0.1 * w, 0.6 * h))5203 .add(new go.PathSegment(go.PathSegment.Line, 0.1 * w, 0.9 * h))5204 .add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.9 * h))5205 .add(new go.PathSegment(go.PathSegment.Line, 0.5 * w, 0.6 * h).close()));5206});5207go.Shape.defineFigureGenerator("Terminal", function(shape, w, h) {5208 var geo = new go.Geometry();5209 var fig = new go.PathFigure(w * 0, h * .10, false);5210 geo.add(fig);5211 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .10));5212 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .90));5213 fig.add(new go.PathSegment(go.PathSegment.Line, w * 0, h * .90).close());5214 var fig2 = new go.PathFigure(w * .10, h * .20, true); // is filled in our not5215 geo.add(fig2);5216 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .10, h * .25));5217 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .22, h * .285)); // midpoint5218 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .10, h * .32));5219 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .10, h * .37));5220 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .275, h * .32));5221 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .275, h * .25).close());5222 var fig3 = new go.PathFigure(w * .28, h * .37, true); // is filled in our not5223 geo.add(fig3);5224 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .45, h * .37));5225 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .45, h * .41));5226 fig3.add(new go.PathSegment(go.PathSegment.Line, w * .28, h * .41).close());5227 return geo;5228});5229go.Shape.defineFigureGenerator("Beaker", function(shape, w, h) {5230 var geo = new go.Geometry();5231 var param1 = 15;5232 var cpOffset = param1 * KAPPA;5233 var fig = new go.PathFigure(w * .62, h * .475, true);5234 geo.add(fig);5235 fig.add(new go.PathSegment(go.PathSegment.Line, w, h - param1));5236 fig.add(new go.PathSegment(go.PathSegment.Bezier, w - param1, h, w, h - cpOffset, w - cpOffset, h));5237 fig.add(new go.PathSegment(go.PathSegment.Line, param1, h));5238 fig.add(new go.PathSegment(go.PathSegment.Bezier, 0, h - param1, cpOffset, h, 0, h - cpOffset));5239 fig.add(new go.PathSegment(go.PathSegment.Line, w * .38, h * .475));5240 fig.add(new go.PathSegment(go.PathSegment.Line, w * .38, h * .03));5241 fig.add(new go.PathSegment(go.PathSegment.Line, w * .36, h * 0));5242 fig.add(new go.PathSegment(go.PathSegment.Line, w * .64, h * 0));5243 fig.add(new go.PathSegment(go.PathSegment.Line, w * .62, h * .03).close());5244 if (cpOffset > 1) {5245 geo.spot1 = new go.Spot(0, 0, cpOffset, cpOffset);5246 geo.spot2 = new go.Spot(1, 1, -cpOffset, -cpOffset);5247 } else {5248 geo.spot1 = go.Spot.TopLeft;5249 geo.spot2 = go.Spot.BottomRight;5250 }5251 return geo;5252});5253go.Shape.defineFigureGenerator("Download", function(shape, w, h) {5254 var geo = new go.Geometry();5255 var fig = new go.PathFigure(w * 0, h * 1, true);5256 geo.add(fig);5257 var third = .1 / .3; // just to keep values consistent5258 // outer frame5259 // starts bottom left5260 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1));5261 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * (1 - third)));5262 fig.add(new go.PathSegment(go.PathSegment.Line, w * .8, h * 0));5263 fig.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * 0));5264 fig.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * .055));5265 fig.add(new go.PathSegment(go.PathSegment.Line, w * .755, h * .055));5266 fig.add(new go.PathSegment(go.PathSegment.Line, w * .93, h * (1 - third)));5267 fig.add(new go.PathSegment(go.PathSegment.Line, w * .64, h * (1 - third)));5268 fig.add(new go.PathSegment(go.PathSegment.Line, w * .61, h * .75));5269 fig.add(new go.PathSegment(go.PathSegment.Line, w * .5, h * .75));5270 fig.add(new go.PathSegment(go.PathSegment.Line, w * .39, h * .75));5271 fig.add(new go.PathSegment(go.PathSegment.Line, w * .36, h * (1 - third)));5272 fig.add(new go.PathSegment(go.PathSegment.Line, w * .07, h * (1 - third)));5273 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .755), h * (.055)));5274 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .66), h * (.055)));5275 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .66), h * (0)));5276 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .8), h * (0)));5277 fig.add(new go.PathSegment(go.PathSegment.Line, w * 0, h * (1 - third)).close());5278 // arrow pointing down5279 var fig2 = new go.PathFigure(w * .40, h * 0, true);5280 geo.add(fig2);5281 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .40, h * .44));5282 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .26, h * .44));5283 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .5, h * .66));5284 fig2.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .26), h * .44));5285 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * .44));5286 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * 0).close());5287 return geo;5288});5289go.Shape.defineFigureGenerator("Bin", function(shape, w, h) {5290 var geo = new go.Geometry();5291 var fig = new go.PathFigure(w * 0, h * 1, true);5292 geo.add(fig);5293 var third = .1 / .3; // just to keep values consistent5294 // outer frame5295 // starts bottom left5296 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1));5297 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * (1 - third)));5298 fig.add(new go.PathSegment(go.PathSegment.Line, w * .8, h * 0));5299 fig.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * 0));5300 fig.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * .055));5301 fig.add(new go.PathSegment(go.PathSegment.Line, w * .755, h * .055));5302 fig.add(new go.PathSegment(go.PathSegment.Line, w * .93, h * (1 - third)));5303 fig.add(new go.PathSegment(go.PathSegment.Line, w * .64, h * (1 - third)));5304 fig.add(new go.PathSegment(go.PathSegment.Line, w * .61, h * .75));5305 fig.add(new go.PathSegment(go.PathSegment.Line, w * .5, h * .75));5306 fig.add(new go.PathSegment(go.PathSegment.Line, w * .39, h * .75));5307 fig.add(new go.PathSegment(go.PathSegment.Line, w * .36, h * (1 - third)));5308 fig.add(new go.PathSegment(go.PathSegment.Line, w * .07, h * (1 - third)));5309 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .755), h * (.055)));5310 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .66), h * (.055)));5311 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .66), h * (0)));5312 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .8), h * (0)));5313 fig.add(new go.PathSegment(go.PathSegment.Line, w * 0, h * (1 - third)).close());5314 return geo;5315});5316go.Shape.defineFigureGenerator("Upload", function(shape, w, h) {5317 var geo = new go.Geometry();5318 var fig = new go.PathFigure(w * 0, h * 1, true);5319 geo.add(fig);5320 var third = .1 / .3; // just to keep values consistent5321 // outer frame5322 // starts bottom left5323 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * 1));5324 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * (1 - third)));5325 fig.add(new go.PathSegment(go.PathSegment.Line, w * .8, h * 0));5326 fig.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * 0));5327 fig.add(new go.PathSegment(go.PathSegment.Line, w * .66, h * .055));5328 fig.add(new go.PathSegment(go.PathSegment.Line, w * .755, h * .055));5329 fig.add(new go.PathSegment(go.PathSegment.Line, w * .93, h * (1 - third)));5330 fig.add(new go.PathSegment(go.PathSegment.Line, w * .64, h * (1 - third)));5331 fig.add(new go.PathSegment(go.PathSegment.Line, w * .61, h * .75));5332 fig.add(new go.PathSegment(go.PathSegment.Line, w * .5, h * .75));5333 fig.add(new go.PathSegment(go.PathSegment.Line, w * .39, h * .75));5334 fig.add(new go.PathSegment(go.PathSegment.Line, w * .36, h * (1 - third)));5335 fig.add(new go.PathSegment(go.PathSegment.Line, w * .07, h * (1 - third)));5336 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .755), h * (.055)));5337 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .66), h * (.055)));5338 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .66), h * (0)));5339 fig.add(new go.PathSegment(go.PathSegment.Line, w * (1 - .8), h * (0)));5340 fig.add(new go.PathSegment(go.PathSegment.Line, w * 0, h * (1 - third)).close());5341 var fig2 = new go.PathFigure(w * .5, h * 0, true);5342 geo.add(fig2);5343 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .26, h * .25));5344 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .40, h * .25));5345 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .40, h * .63));5346 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * .63));5347 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .60, h * .25));5348 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .74, h * .25).close());5349 return geo;5350});5351go.Shape.defineFigureGenerator("EmptyDrink", function(shape, w, h) {5352 var geo = new go.Geometry();5353 var fig = new go.PathFigure(w * .15, h * 0, false);5354 geo.add(fig);5355 fig.add(new go.PathSegment(go.PathSegment.Line, w * .85, h * 0));5356 fig.add(new go.PathSegment(go.PathSegment.Line, w * .70, h * 1));5357 fig.add(new go.PathSegment(go.PathSegment.Line, w * .30, h * 1).close());5358 return geo;5359});5360go.Shape.defineFigureGenerator("Drink", function(shape, w, h) {5361 var geo = new go.Geometry();5362 var fig = new go.PathFigure(w * .15, h * 0, false);5363 geo.add(fig);5364 fig.add(new go.PathSegment(go.PathSegment.Line, w * .85, h * 0));5365 fig.add(new go.PathSegment(go.PathSegment.Line, w * .70, h * 1));5366 fig.add(new go.PathSegment(go.PathSegment.Line, w * .30, h * 1).close());5367 var fig2 = new go.PathFigure(w * .235, h * .28, true);5368 geo.add(fig2);5369 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .765, h * .28));5370 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .655, h * .97));5371 fig2.add(new go.PathSegment(go.PathSegment.Line, w * .345, h * .97).close());5372 return geo;5373});5374go.Shape.defineFigureGenerator("4Arrows", function(shape, w, h) {5375 var geo = new go.Geometry();5376 var fig = new go.PathFigure(w * .5, h * 0, true);5377 geo.add(fig);5378 fig.add(new go.PathSegment(go.PathSegment.Line, w * .65, h * .25));5379 fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, h * .25));5380 fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, h * .45));5381 fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * .45));5382 fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * .35));5383 fig.add(new go.PathSegment(go.PathSegment.Line, w * 1, h * .5));5384 fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * .65));5385 fig.add(new go.PathSegment(go.PathSegment.Line, w * .75, h * .55));5386 fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, h * .55));5387 fig.add(new go.PathSegment(go.PathSegment.Line, w * .55, h * .75));5388 fig.add(new go.PathSegment(go.PathSegment.Line, w * .65, h * .75));5389 fig.add(new go.PathSegment(go.PathSegment.Line, w * .5, h * 1));5390 fig.add(new go.PathSegment(go.PathSegment.Line, w * .35, h * .75));5391 fig.add(new go.PathSegment(go.PathSegment.Line, w * .45, h * .75));5392 fig.add(new go.PathSegment(go.PathSegment.Line, w * .45, h * .55));5393 fig.add(new go.PathSegment(go.PathSegment.Line, w * .25, h * .55));5394 fig.add(new go.PathSegment(go.PathSegment.Line, w * .25, h * .65));5395 fig.add(new go.PathSegment(go.PathSegment.Line, w * 0, h * .5));5396 fig.add(new go.PathSegment(go.PathSegment.Line, w * .25, h * .35));5397 fig.add(new go.PathSegment(go.PathSegment.Line, w * .25, h * .45));5398 fig.add(new go.PathSegment(go.PathSegment.Line, w * .45, h * .45));5399 fig.add(new go.PathSegment(go.PathSegment.Line, w * .45, h * .25));5400 fig.add(new go.PathSegment(go.PathSegment.Line, w * .35, h * .25).close());5401 return geo;5402});5403go.Shape.defineFigureGenerator("Connector", "Ellipse");5404go.Shape.defineFigureGenerator("Alternative", "TriangleUp");5405go.Shape.defineFigureGenerator("Merge", "TriangleUp");5406go.Shape.defineFigureGenerator("Decision", "Diamond");5407go.Shape.defineFigureGenerator("DataTransmissions", "Hexagon");5408go.Shape.defineFigureGenerator("Gate", "Crescent");5409go.Shape.defineFigureGenerator("Delay", "HalfEllipse");5410go.Shape.defineFigureGenerator("Input", "Parallelogram1");5411go.Shape.defineFigureGenerator("ManualLoop", "ManualOperation");5412go.Shape.defineFigureGenerator("ISOProcess", "Chevron");5413go.Shape.defineFigureGenerator("MessageToUser", "SquareArrow");5414go.Shape.defineFigureGenerator("MagneticData", "Cylinder1");5415go.Shape.defineFigureGenerator("DirectData", "Cylinder4");5416go.Shape.defineFigureGenerator("StoredData", "DataStorage");5417go.Shape.defineFigureGenerator("SequentialData", "MagneticTape");...
wikipedia.js
Source:wikipedia.js
1/**2 * (C) Copyright 2009 Deniz Dogan3 * (C) Copyright 2009-2010 John J. Foerch4 *5 * Use, modification, and distribution are subject to the terms specified in the6 * COPYING file.7 *8 * Main features:9 * - "Did you mean", automatic following of spelling suggestions by MediaWiki.10 * - Changes the behavior of previous-heading and next-heading to better suit11 * MediaWiki pages.12 * - Quick moving between different language versions of the same article using13 * `wikipedia-other-language' (C-c C-o by default).14 * - Probably more to come.15 **/16/*** VARIABLES ***/17define_variable("wikipedia_didyoumean_follow_first_hit", false,18 "When true, follows the first hit in the result list"19 + "unless a \"did you mean\" in shown.");20define_variable("wikipedia_enable_didyoumean", false,21 "When true, enables \"did you mean\".");22define_variable('wikipedia_webjumps_format', 'wikipedia-%s',23 "This variable controls the names of the webjumps defined "+24 "by the wikipedia-webjumps module. It is a simple string "+25 "format spec. The format code `%s' will be replaced by the "+26 "language code for the webjump.");27/**28 * Given the buffer, searches the document for a "did you mean" suggestion box,29 * which suggests some word that the user might have meant. If such a suggestion30 * is found, it immediately follows it. If the new page didn't exist either, and31 * just so happens to have another suggestion, follows that, and so on, until no32 * more suggestions are found.33 *34 * If the user variable "wikipedia_didyoumean_follow_first_hit" is set to35 * anything which is "true" in a JavaScript condition, when no more suggestions36 * are found, follows the first match in the search results, if there are any.37 *38 * @param buffer The buffer containing the document.39 */40function wikipedia_didyoumean(buffer) {41 let doc = buffer.document;42 let didyoumean_xpath = '//div[@class="searchdidyoumean"]/a[1]';43 let didyoumean = xpath_find_any(doc, didyoumean_xpath);44 let found = didyoumean.iterateNext();45 if (found) {46 // "Did you mean" found.47 doc.location = found.href;48 } else {49 // Follow the first hit if wikipedia_didyoumean_follow_first_hit.50 if (wikipedia_didyoumean_follow_first_hit) {51 let firsthit_xpath = '//ul[@class="mw-search-results"]/li[1]/a';52 let firsthit = xpath_find_any(doc, firsthit_xpath);53 found = firsthit.iterateNext();54 if (found) {55 doc.location = found.href;56 }57 }58 }59}60/**61 * define_wikipedia_webjumps defines webjumps for wikipedia in various62 * languages. If called with no args, it will define webjumps for all63 * known languages. When called with any number of language codes, it64 * will define webjumps for those language. The language codes65 * correspond to the subdomains of wikipedia.com for each language.66 *67 * Examples:68 * define_wikipedia_webjumps("en"); // Makes a webjump to the English WP.69 * define_wikipedia_webjumps("en", "de", "fr"); // English, German and French70 * define_wikipedia_webjumps(); // All of the available Wikipedias.71 */72function define_wikipedia_webjumps() {73 var prefixes;74 if (arguments.length == 0)75 prefixes = [i for (i in wikipedia_versions)];76 else77 prefixes = Array.slice(arguments);78 for each (let i in prefixes) {79 var rest = wikipedia_versions[i];80 var name = string_format(wikipedia_webjumps_format, {s: i});81 define_webjump(name, "http://" + i + ".wikipedia.org/wiki/" + rest.search);82 }83}84function wikipedia_other_language (doc) {85 var regexp = new RegExp("//([^\\.]+)\\.wikipedia\\.org");86 var links = doc.querySelectorAll('#p-lang li a');87 var options = {};88 for (let [_, link] in Iterator(links)) {89 var href = link.getAttribute("href");90 if (! href)91 continue;92 var matched = href.match(regexp);93 if (! matched)94 continue;95 if (wikipedia_versions[matched[1]] != undefined)96 options[wikipedia_versions[matched[1]]["language"]] = link.href;97 else98 dumpln("Found unknown language: " + matched[1] + "... Please, report a bug.");99 }100 return options;101}102interactive("wikipedia-other-language",103 "Queries the user for another language to view the current article in.",104 function (I) {105 var options = wikipedia_other_language(I.buffer.document);106 var chosen = yield I.minibuffer.read_object_property(107 $prompt = "Languages:",108 $object = options);109 I.buffer.document.location = options[chosen];110 });111define_keymap("wikipedia_keymap", $display_name = "wikipedia");112define_key(wikipedia_keymap, "C-c C-o", "wikipedia-other-language");113var wikipedia_modality = {114 normal: wikipedia_keymap115};116/*** MAIN LOADING FUNCTIONALITY ***/117define_page_mode("wikipedia-mode",118 /wikipedia/, // TODO: Better regular expression119 function enable (buffer) {120 if (wikipedia_enable_didyoumean) {121 do_when("buffer_dom_content_loaded_hook", buffer, wikipedia_didyoumean);122 }123 buffer.page.local.headings_xpath = '//h1[@id="firstHeading"] | //span[@class="mw-headline"] | //div[@id="toctitle"]';124 buffer.content_modalities.push(wikipedia_modality);125 },126 function disable (buffer) {127 remove_hook.call(buffer, "buffer_dom_content_loaded_hook", wikipedia_didyoumean);128 var i = buffer.content_modalities.indexOf(wikipedia_modality);129 if (i > -1)130 buffer.content_modalities.splice(i, 1);131 },132 $display_name = "Wikipedia");133page_mode_activate(wikipedia_mode);134/*** HERE BE DRAGONS ***/135/* No, here is really just "data" which is cumbersome to scroll through. */136define_variable("wikipedia_versions", {137 "aa" : { language: "Afar", search: "Special:Search?search=%s&go=Go" },138 "ab" : { language: "Abkhazian", search: "%D0%A1%D0%BB%D1%83%D0%B6%D0%B5%D0%B1%D0%BD%D0%B0%D1%8F:Search?search=%s&go=%D0%9F%D0%B5%D1%80%D0%B5%D0%B9%D1%82%D0%B8" },139 "af" : { language: "Afrikaans", search: "Spesiaal:Soek?search=%s&go=Wys" },140 "ak" : { language: "Akan", search: "Special:Search?search=%s&go=K%C9%94" },141 "als" : { language: "Alemannic", search: "Spezial:Suche?search=%s&go=Artikel" },142 "am" : { language: "Amharic", search: "%E1%88%8D%E1%8B%A9:Search?search=%s&go=%E1%8A%A5%E1%8A%95%E1%88%82%E1%8B%B5%21" },143 "an" : { language: "Aragonese", search: "Espezial:Mirar?search=%s&go=Ir-ie" },144 "ang" : { language: "Anglo-Saxon", search: "Special:Search?search=%s&go=G%C4%81n" },145 "ar" : { language: "Arabic", search: "%D8%AE%D8%A7%D8%B5:%D8%A8%D8%AD%D8%AB?search=%s&go=%D8%A7%D8%B0%D9%87%D8%A8" },146 // TODO: arz - Egyptian Arabic147 "arc" : { language: "Assyrian Neo-Aramaic", search: "Special:Search?search=%s&go=%DC%99%DC%A0" },148 "as" : { language: "Assamese", search: "%E0%A6%AC%E0%A6%BF%E0%A6%B6%E0%A7%87%E0%A6%B7:Search?search=%s&go=%E0%A6%AF%E0%A6%BE%E0%A6%93%E0%A6%81%E0%A6%95" },149 "ast" : { language: "Asturian", search: "Especial:Search?search=%s&go=Dir" },150 "av" : { language: "Avar", search: "%D0%A1%D0%BB%D1%83%D0%B6%D0%B5%D0%B1%D0%BD%D0%B0%D1%8F:Search?search=%s&go=%D0%9F%D0%B5%D1%80%D0%B5%D0%B9%D1%82%D0%B8" },151 "ay" : { language: "Aymara", search: "Especial:Buscar?search=%s&go=Sara%C3%B1a" },152 "az" : { language: "Azeri", search: "X%C3%BCsusi:Search?search=%s&go=G%C9%99tir" },153 "ba" : { language: "Bashkir", search: "%D0%AF%D1%80%D2%99%D0%B0%D0%BC%D1%81%D1%8B:Search?search=%s&go=%D0%9A%D2%AF%D1%81%D0%B5%D2%AF" },154 "bar" : { language: "Bavarian", search: "Spezial:Suche?search=%s&go=Artikl" },155 // TODO:t-smg - Samogitian156 "bcl" : { language: "Central Bicolano", search: "Espesyal:Hanapon?search=%s&go=Duman%C3%A1n" },157 "be" : { language: "Belarusian", search: "%D0%90%D0%B4%D0%BC%D1%8B%D1%81%D0%BB%D0%BE%D0%B2%D0%B0%D0%B5:Search?search=%s&go=%D0%90%D1%80%D1%82%D1%8B%D0%BA%D1%83%D0%BB" },158 // TODO: be-x-old - Belarusian (Tarashkevitsa)159 "bg" : { language: "Bulgarian", search: "%D0%A1%D0%BF%D0%B5%D1%86%D0%B8%D0%B0%D0%BB%D0%BD%D0%B8:%D0%A2%D1%8A%D1%80%D1%81%D0%B5%D0%BD%D0%B5?search=%s&go=%D0%9E%D1%82%D0%B2%D0%B0%D1%80%D1%8F%D0%BD%D0%B5" },160 "bh" : { language: "Bihari", search: "Special:Search?search=%s&go=Go" },161 "bi" : { language: "Bislama", search: "Special:Search?search=%s&go=Go" },162 "bm" : { language: "Bambara", search: "Special:Recherche?search=%s&go=Taa" },163 "bn" : { language: "Bengali", search: "%E0%A6%AC%E0%A6%BF%E0%A6%B6%E0%A7%87%E0%A6%B7:Search?search=%s&go=%E0%A6%9A%E0%A6%B2%E0%A7%8B" },164 "bo" : { language: "Tibetan", search: "Special:Search?search=%s&go=%E0%BD%A6%E0%BD%BC%E0%BD%84%E0%BC%8B%E0%BC%8D" },165 "bpy" : { language: "Bishnupriya Manipuri", search: "%E0%A6%AC%E0%A6%BF%E0%A6%B6%E0%A7%87%E0%A6%B7:Search?search=%s&go=%E0%A6%B9%E0%A6%BE%E0%A6%A4" },166 "br" : { language: "Breton", search: "Dibar:Klask?search=%s&go=Mont" },167 "bs" : { language: "Bosnian", search: "Posebno:Pretraga?search=%s&go=Idi" },168 "bug" : { language: "Buginese", search: "Istimewa:Pencarian?search=%s&go=%E1%A8%92%E1%A8%95%E1%A8%9A" },169 "bxr" : { language: "Buryat (Russia)", search: "Special:Search?search=%s&go=Go" },170 "ca" : { language: "Catalan", search: "Especial:Cerca?search=%s&go=V%C3%A9s-hi" },171 "cdo" : { language: "Min Dong", search: "Special:Search?search=%s&go=K%C3%B3%CC%A4" },172 "ce" : { language: "Chechen", search: "%D0%91%D0%B0%D1%88%D1%85%D0%BE:Search?search=%s&go=%D0%94%D0%B5%D1%85%D1%8C%D0%B0%D0%B4%D0%BE%D1%85%D1%83" },173 "ceb" : { language: "Cebuano", search: "Special:Pangita?search=%s&go=Sige%21" },174 "ch" : { language: "Chamorro", search: "Special:Search?search=%s&go=H%C3%A5nao" },175 "cho" : { language: "Choctaw", search: "Special:Search?search=%s&go=Go" },176 "chr" : { language: "Cherokee", search: "Special:Search?search=%s&go=Go" },177 "chy" : { language: "Cheyenne", search: "Special:Search?search=%s&go=Go" },178 "co" : { language: "Corsican", search: "Special:Search?search=%s&go=And%C3%A0" },179 "cr" : { language: "Cree", search: "Special:Search?search=%s&go=Go" },180 "crh" : { language: "Crimean Tatar", search: "Mahsus:Search?search=%s&go=Bar" },181 "cs" : { language: "Czech", search: "Speci%C3%A1ln%C3%AD:Search?search=%s&go=J%C3%ADt+na" },182 "csb" : { language: "Kashubian", search: "Specjaln%C3%B4:Search?search=%s&go=Bi%C3%B4j%21" },183 "cu" : { language: "Old Church Slavonic", search: "%D0%9D%D0%B0%D1%80%D0%BE%CC%81%D1%87%D1%8C%D0%BD%D0%B0:Search?search=%s&go=%D0%BF%D1%80%D1%A3%D0%B8%D0%B4%D0%B8%CC%81" },184 "cv" : { language: "Chuvash", search: "%D0%AF%D1%82%D0%B0%D1%80%D0%BB%C4%83:Search?search=%s&go=%D0%9A%D1%83%C3%A7" },185 "cy" : { language: "Welsh", search: "Arbennig:Search?search=%s&go=Mynd" },186 "da" : { language: "Danish", search: "Speciel:S%C3%B8gning?search=%s&go=G%C3%A5+til" },187 "de" : { language: "German", search: "Spezial:Suche?search=%s&go=Artikel" },188 "diq" : { language: "Zazaki", search: "Special:Search?search=%s&go=%C5%9Eo" },189 "dsb" : { language: "Lower Sorbian", search: "Specialne:Pyta%C5%9B?search=%s&go=Nastawk" },190 "dv" : { language: "Divehi", search: "Special:Search?search=%s&go=Go" },191 "dz" : { language: "Dzongkha", search: "Special:Search?search=%s&go=%E0%BD%A0%E0%BD%82%E0%BE%B1%E0%BD%BC%E0%BC%8D" },192 "ee" : { language: "Ewe", search: "Special:Search?search=%s&go=Yi" },193 "el" : { language: "Greek", search: "%CE%95%CE%B9%CE%B4%CE%B9%CE%BA%CF%8C:%CE%91%CE%BD%CE%B1%CE%B6%CE%AE%CF%84%CE%B7%CF%83%CE%B7?search=%s&go=%CE%9C%CE%B5%CF%84%CE%AC%CE%B2%CE%B1%CF%83%CE%B7" },194 "eml" : { language: "Emilian-Romagnol", search: "Speciale:Ricerca?search=%s&go=Vai" },195 "en" : { language: "English", search: "Special:Search?search=%s&go=Go" },196 "eo" : { language: "Esperanto", search: "Speciala:Ser%C4%89i?search=%s&go=Ek%21" },197 "es" : { language: "Spanish", search: "Especial:Buscar?search=%s&go=Ir" },198 "et" : { language: "Estonian", search: "Eri:Search?search=%s&go=Mine" },199 "eu" : { language: "Basque", search: "Berezi:Search?search=%s&go=Joan" },200 "fa" : { language: "Farsi", search: "%D9%88%DB%8C%DA%98%D9%87:%D8%AC%D8%B3%D8%AA%D8%AC%D9%88?search=%s&go=%D8%A8%D8%B1%D9%88" },201 "ff" : { language: "Fula", search: "Special:Recherche?search=%s&go=Consulter" },202 "fi" : { language: "Finnish", search: "Toiminnot:Haku?search=%s&go=Siirry" },203 // TODO: fiu-vro - Võro204 "fj" : { language: "Fijian", search: "Special:Search?search=%s&go=Lako" },205 "fo" : { language: "Faroese", search: "Serstakur:Leita?search=%s&go=Far" },206 "fr" : { language: "French", search: "Special:Recherche?search=%s&go=Consulter" },207 "frp" : { language: "Franco-Provençal/Arpitan", search: "Sp%C3%A8ci%C3%A2l:Recherche?search=%s&go=Alar" },208 "fur" : { language: "Friulian", search: "Speci%C3%A2l:Ricercje?search=%s&go=Va" },209 "fy" : { language: "West Frisian", search: "Wiki:Sykje?search=%s&go=Side" },210 "ga" : { language: "Irish", search: "Speisialta:Search?search=%s&go=Gabh" },211 "gd" : { language: "Scottish Gaelic", search: "Special:Search?search=%s&go=Go" },212 "gl" : { language: "Galician", search: "Especial:Procurar?search=%s&go=Artigo" },213 "glk" : { language: "Gilaki", search: "%D9%88%DB%8C%DA%98%D9%87:%D8%AC%D8%B3%D8%AA%D8%AC%D9%88?search=%s&go=%D8%A8%D9%88%D8%B4%D9%88" },214 "gn" : { language: "Guarani", search: "Mba%27ech%C4%A9ch%C4%A9:Buscar?search=%s&go=Ha" },215 "got" : { language: "Gothic", search: "Special:Search?search=%s&go=%F0%90%8C%B0%F0%90%8D%86%F0%90%8C%B2%F0%90%8C%B0%F0%90%8C%B2%F0%90%8C%B2%F0%90%8C%B0%F0%90%8C%BD" },216 "gu" : { language: "Gujarati", search: "Special:Search?search=%s&go=%E0%AA%9C%E0%AA%BE%E0%AA%93" },217 "gv" : { language: "Manx", search: "Special:Search?search=%s&go=Gow" },218 "ha" : { language: "Hausa", search: "Special:Search?search=%s&go=Go" },219 "hak" : { language: "Hakka", search: "Special:Search?search=%s&go=Chin-ngi%CC%8Dp" },220 "haw" : { language: "Hawaiian", search: "Special:Search?search=%s&go=Hele" },221 "he" : { language: "Hebrew", search: "%D7%9E%D7%99%D7%95%D7%97%D7%93:%D7%97%D7%99%D7%A4%D7%95%D7%A9?search=%s&go=%D7%9C%D7%A2%D7%A8%D7%9A" },222 "hi" : { language: "Hindi", search: "%E0%A4%B5%E0%A4%BF%E0%A4%B6%E0%A5%87%E0%A4%B7:Search?search=%s&go=%E0%A4%9C%E0%A4%BE%E0%A4%8F%E0%A4%81" },223 "ho" : { language: "Hiri Motu", search: "Special:Search?search=%s&go=Go" },224 "hr" : { language: "Croatian", search: "Posebno:Tra%C5%BEi?search=%s&go=Kreni" },225 "hsb" : { language: "Upper Sorbian", search: "Specialnje:Pyta%C4%87?search=%s&go=Nastawk" },226 "ht" : { language: "Haitian", search: "Espesyal:Chache?search=%s&go=Ale" },227 "hu" : { language: "Hungarian", search: "Speci%C3%A1lis:Keres%C3%A9s?search=%s&go=Menj" },228 "hy" : { language: "Armenian", search: "%D5%8D%D5%BA%D5%A1%D5%BD%D5%A1%D6%80%D5%AF%D5%B8%D5%B2:%D5%88%D6%80%D5%B8%D5%B6%D5%A5%D5%AC?search=%s&go=%D4%B1%D5%B6%D6%81%D5%B6%D5%A5%D5%AC" },229 "hz" : { language: "Herero", search: "Special:Search?search=%s&go=Go" },230 "ia" : { language: "Interlingua", search: "Special:Cercar?search=%s&go=Ir" },231 "id" : { language: "Indonesian", search: "Istimewa:Pencarian?search=%s&go=Tuju+ke" },232 "ie" : { language: "Interlingue", search: "Special:Search?search=%s&go=Vade" },233 "ig" : { language: "Igbo", search: "Special:Search?search=%s&go=Go" },234 "ii" : { language: "Sichuan Yi", search: "Special:Search?search=%s&go=%E8%BF%9B%E5%85%A5" },235 "ik" : { language: "Inupiak", search: "Special:Search?search=%s&go=Go" },236 "ilo" : { language: "Ilokano", search: "Special:Search?search=%s&go=Inkan" },237 "io" : { language: "Ido", search: "Specala:Search?search=%s&go=Irez" },238 "is" : { language: "Icelandic", search: "Kerfiss%C3%AD%C3%B0a:Leit?search=%s&go=%C3%81fram" },239 "it" : { language: "Italian", search: "Speciale:Ricerca?search=%s&go=Vai" },240 "iu" : { language: "Inuktitut", search: "Special:Search?search=%s&go=%E1%90%8A%E1%90%83%E1%95%97%E1%96%85" },241 "ja" : { language: "Japanese", search: "%E7%89%B9%E5%88%A5:%E6%A4%9C%E7%B4%A2?search=%s&go=%E8%A1%A8%E7%A4%BA" },242 "jbo" : { language: "Lojban", search: "Special:Search?search=%s&go=jarco" },243 "jv" : { language: "Javanese", search: "Astamiwa:Pencarian?search=%s&go=Tumuju" },244 "ka" : { language: "Georgian", search: "%E1%83%A1%E1%83%9E%E1%83%94%E1%83%AA%E1%83%98%E1%83%90%E1%83%9A%E1%83%A3%E1%83%A0%E1%83%98:%E1%83%AB%E1%83%98%E1%83%94%E1%83%91%E1%83%90?search=%s&go=%E1%83%A1%E1%83%A2%E1%83%90%E1%83%A2%E1%83%98%E1%83%90" },245 "kab" : { language: "Kabyle", search: "Uslig:Search?search=%s&go=%E1%BA%92er" },246 "kg" : { language: "Kongo", search: "Special:Search?search=%s&go=Kuenda" },247 "ki" : { language: "Kikuyu", search: "Special:Search?search=%s&go=Go" },248 "kj" : { language: "Kuanyama", search: "Special:Search?search=%s&go=Go" },249 "kk" : { language: "Kazakh", search: "%D0%90%D1%80%D0%BD%D0%B0%D0%B9%D1%8B:%D0%86%D0%B7%D0%B4%D0%B5%D1%83?search=%s&go=%D3%A8%D1%82%21" },250 "kl" : { language: "Greenlandic", search: "Speciel:S%C3%B8gning?search=%s&go=Pisuppoq" },251 "km" : { language: "Khmer", search: "%E1%9E%96%E1%9E%B7%E1%9E%9F%E1%9F%81%E1%9E%9F:%E1%9E%9F%E1%9F%92%E1%9E%9C%E1%9F%82%E1%9E%84%E1%9E%9A%E1%9E%80?search=%s&go=%E1%9E%91%E1%9F%85" },252 "kn" : { language: "Kannada", search: "%E0%B2%B5%E0%B2%BF%E0%B2%B6%E0%B3%87%E0%B2%B7:Search?search=%s&go=%E0%B2%B9%E0%B3%8B%E0%B2%97%E0%B3%81" },253 "ko" : { language: "Korean", search: "%ED%8A%B9%EC%88%98%EA%B8%B0%EB%8A%A5:%EC%B0%BE%EA%B8%B0?search=%s&go=%EA%B0%80%EA%B8%B0" },254 "kr" : { language: "Kanuri", search: "Special:Search?search=%s&go=Go" },255 "ks" : { language: "Kashmiri", search: "Special:Search?search=%s&go=Go" },256 "ksh" : { language: "Riuparian", search: "Spezial:S%C3%B6k?search=%s&go=Sigg" },257 "ku" : { language: "Kurdish", search: "Taybet:Search?search=%s&go=Gotar" },258 "kv" : { language: "Komi", search: "%D0%A1%D0%BB%D1%83%D0%B6%D0%B5%D0%B1%D0%BD%D0%B0%D1%8F:Search?search=%s&go=%D0%92%D1%83%D0%B4%D0%B6%D0%BD%D1%8B" },259 "kw" : { language: "Cornish", search: "Special:Search?search=%s&go=Ke" },260 "ky" : { language: "Kirghiz", search: "Special:Search?search=%s&go=Go" },261 "la" : { language: "Latin", search: "Specialis:Quaerere?search=%s&go=Ire" },262 "lad" : { language: "Ladino", search: "Especial:Buscar?search=%s&go=Yir" },263 "lb" : { language: "Luxembourgish", search: "Spezial:Sichen?search=%s&go=S%C3%A4it" },264 "lbe" : { language: "Lak", search: "%D0%9A%D1%8A%D1%83%D0%BB%D0%BB%D1%83%D0%B3%D1%8A%D0%B8%D1%80%D0%B0%D0%BB_%D0%BB%D0%B0%D0%B6%D0%B8%D0%BD:Search?search=%s&go=%D0%9F%D0%B5%D1%80%D0%B5%D0%B9%D1%82%D0%B8" },265 "lg" : { language: "Luganda", search: "Special:Search?search=%s&go=Nona" },266 "li" : { language: "Limburgish", search: "Speciaal:Zeuke?search=%s&go=Artikel" },267 "lij" : { language: "Ligurian", search: "Speciale:Ri%C3%A7erca?search=%s&go=Vanni" },268 "lmo" : { language: "Lombard", search: "Speciale:Ricerca?search=%s&go=V%C3%A0" },269 "ln" : { language: "Lingala", search: "Special:Recherche?search=%s&go=K%C9%9Bnd%C9%9B%CC%81" },270 "lo" : { language: "Lao", search: "%E0%BA%9E%E0%BA%B4%E0%BB%80%E0%BA%AA%E0%BA%94:%E0%BA%8A%E0%BA%AD%E0%BA%81%E0%BA%AB%E0%BA%B2?search=%s&go=%E0%BB%84%E0%BA%9B" },271 "lt" : { language: "Lithuanian", search: "Specialus:Paie%C5%A1ka?search=%s&go=Rodyti" },272 "lv" : { language: "Latvian", search: "Special:Search?search=%s&go=Aiziet%21" },273 // TODO: map-bms - Banyumasan274 "mg" : { language: "Malagasy", search: "Special:Recherche?search=%s&go=Tsidiho" },275 "mh" : { language: "Marshallese", search: "Special:Search?search=%s&go=Go" },276 "mi" : { language: "Maori", search: "Special:Search?search=%s&go=Haere" },277 "mk" : { language: "Macedonian", search: "%D0%A1%D0%BF%D0%B5%D1%86%D0%B8%D1%98%D0%B0%D0%BB%D0%BD%D0%B8:%D0%91%D0%B0%D1%80%D0%B0%D1%98?search=%s&go=%D0%9E%D0%B4%D0%B8" },278 "ml" : { language: "Malayalam", search: "%E0%B4%AA%E0%B5%8D%E0%B4%B0%E0%B4%A4%E0%B5%8D%E0%B4%AF%E0%B5%87%E0%B4%95%E0%B4%82:Search?search=%s&go=%E0%B4%AA%E0%B5%8B%E0%B4%95%E0%B5%82" },279 "mn" : { language: "Mongolian", search: "Special:Search?search=%s&go=%D0%AF%D0%B2%D0%B0%D1%85" },280 "mo" : { language: "Moldovan", search: "Special:C%C4%83utare?search=%s&go=%D0%94%D1%83%D1%87%D0%B5" },281 "mr" : { language: "Marathi", search: "%E0%A4%B5%E0%A4%BF%E0%A4%B6%E0%A5%87%E0%A4%B7:%E0%A4%B6%E0%A5%8B%E0%A4%A7%E0%A4%BE?search=%s&go=%E0%A4%B2%E0%A5%87%E0%A4%96" },282 "ms" : { language: "Malay", search: "Khas:Gelintar?search=%s&go=Pergi" },283 "mt" : { language: "Maltese", search: "Special:Fittex?search=%s&go=Mur" },284 "mus" : { language: "Muscogee", search: "Special:Search?search=%s&go=Go" },285 "my" : { language: "Burmese", search: "Special:Search?search=%s&go=%E1%80%9E%E1%80%BD%E1%80%AC%E1%80%B8%E2%80%8B%E1%80%95%E1%80%AB%E2%80%8B" },286 "mzn" : { language: "Mazandarani", search: "%D9%88%DB%8C%DA%98%D9%87:%D8%AC%D8%B3%D8%AA%D8%AC%D9%88?search=%s&go=%D8%A8%D9%88%D8%B1" },287 "na" : { language: "Nauruan", search: "Special:Search?search=%s&go=Go" },288 "nah" : { language: "Nahuatl", search: "N%C5%8Dncuahqu%C4%ABzqui:Tlat%C4%93m%C5%8Dz?search=%s&go=Y%C4%81uh" },289 "nap" : { language: "Neapolitan", search: "Speci%C3%A0le:Ricerca?search=%s&go=Vaje" },290 "nds" : { language: "Low Saxon", search: "Spezial:S%C3%B6%C3%B6k?search=%s&go=Los" },291 "ne" : { language: "Nepali", search: "Special:Search?search=%s&go=%E0%A4%9C%E0%A4%BE%E0%A4%89" },292 "new" : { language: "Newar/Nepal Bhasa", search: "%E0%A4%B5%E0%A4%BF%E0%A4%B6%E0%A5%87%E0%A4%B7:Search?search=%s&go=%E0%A4%A5%E0%A5%8D%E0%A4%B5+%E0%A4%9A%E0%A5%8D%E0%A4%B5%E0%A4%B8%E0%A5%81" },293 "ng" : { language: "Ndonga", search: "Special:Search?search=%s&go=Go" },294 "nl" : { language: "Dutch", search: "Speciaal:Zoeken?search=%s&go=Artikel" },295 "nn" : { language: "Norwegian (nynorsk)", search: "Spesial:S%C3%B8k?search=%s&go=Vis" },296 "no" : { language: "Norwegian (bokmål)", search: "Spesial:S%C3%B8k?search=%s&go=G%C3%A5" },297 "nov" : { language: "Novial", search: "Special:Search?search=%s&go=Vada" },298 "nrm" : { language: "Norman", search: "Special:Search?search=%s&go=Lanchiz" },299 "nv" : { language: "Navajo", search: "Special:Search?search=%s&go=Go" },300 "ny" : { language: "Chichewa", search: "Special:Search?search=%s&go=Pitani" },301 "oc" : { language: "Occitan", search: "Especial:Rec%C3%A8rca?search=%s&go=Consultar" },302 "om" : { language: "Oromo", search: "Special:Search?search=%s&go=Fufi" },303 "or" : { language: "Oriya", search: "Special:Search?search=%s&go=Go" },304 "os" : { language: "Ossetian", search: "%D0%A1%C3%A6%D1%80%D0%BC%D0%B0%D0%B3%D0%BE%D0%BD%D0%B4:Search?search=%s&go=%D0%A1%D1%82%D0%B0%D1%82%D1%8C%D1%8F%D0%BC%C3%A6" },305 "pa" : { language: "Punjabi", search: "%E0%A8%96%E0%A8%BE%E0%A8%B8:Search?search=%s&go=%E0%A8%9C%E0%A8%BE%E0%A8%93" },306 "pag" : { language: "Pangasinan", search: "Special:Search?search=%s&go=Ula" },307 "pam" : { language: "Kapampangan", search: "Special:Search?search=%s&go=Sulung" },308 "pap" : { language: "Papiamentu", search: "Special:Search?search=%s&go=Go" },309 "pdc" : { language: "Pennsylvania German", search: "Spezial:Suche?search=%s&go=Seite" },310 "pi" : { language: "Pali", search: "Special:Search?search=%s&go=%E0%A4%97%E0%A4%9A%E0%A5%8D%E0%A4%9B%E0%A4%BE%E0%A4%AE%E0%A4%BF" },311 "pih" : { language: "Norfolk", search: "Special:Search?search=%s&go=Go" },312 "pl" : { language: "Polish", search: "Specjalna:Szukaj?search=%s&go=Przejd%C5%BA" },313 "pms" : { language: "Piedmontese", search: "Special:Ricerca?search=%s&go=Va" },314 "ps" : { language: "Pashto", search: "%DA%81%D8%A7%D9%86%DA%AB%DA%93%DB%8C:%D9%84%D9%BC%D9%88%D9%86?search=%s&go=%D9%88%D8%B1%DA%81%D9%87" },315 "pt" : { language: "Portuguese", search: "Especial:Busca?search=%s&go=Ir" },316 "qu" : { language: "Quechua", search: "Sapaq:Maskay?search=%s&go=Riy" },317 "rm" : { language: "Romansh", search: "Special:Search?search=%s&go=dai%21" },318 "rmy" : { language: "Vlax Romani", search: "Uzalutno:C%C4%83utare?search=%s&go=Ja" },319 "rn" : { language: "Kirundi", search: "Special:Search?search=%s&go=Go" },320 "ro" : { language: "Romanian", search: "Special:C%C4%83utare?search=%s&go=Salt" },321 // TODO: roa-rup - Aromanian322 // TODO: roa-tara - Tarantino323 "ru" : { language: "Russian", search: "%D0%A1%D0%BB%D1%83%D0%B6%D0%B5%D0%B1%D0%BD%D0%B0%D1%8F:Search?search=%s&go=%D0%9F%D0%B5%D1%80%D0%B5%D0%B9%D1%82%D0%B8" },324 "rw" : { language: "Kinyarwanda", search: "Special:Search?search=%s&go=Go" },325 "sa" : { language: "Sanskrit", search: "Special:Search?search=%s&go=%E0%A4%9C%E0%A4%BE%E0%A4%AF%E0%A5%87%E0%A4%82" },326 "sah" : { language: "Sakha", search: "%D0%90%D0%BD%D0%B0%D0%BB%D0%BB%D0%B0%D0%B0%D1%85:Search?search=%s&go=%D0%9A%D3%A9%D1%80%D0%B4%D3%A9%D1%80" },327 "sc" : { language: "Sardinian", search: "Speciale:Search?search=%s&go=Bae" },328 "scn" : { language: "Sicilian", search: "Spiciali:Ricerca?search=%s&go=Vai" },329 "sco" : { language: "Scots", search: "Special:Search?search=%s&go=Gang" },330 "sd" : { language: "Sindhi", search: "Special:%DA%B3%D9%88%D9%84%D8%A7?search=%s&go=%DA%A9%D9%88%D9%84%D9%8A%D9%88" },331 "se" : { language: "Nortern Sami", search: "Special:Search?search=%s&go=Mana" },332 "sg" : { language: "Sango", search: "Special:Search?search=%s&go=Go" },333 "sh" : { language: "Serbo-Croatian", search: "Special:Search?search=%s&go=Go" },334 "si" : { language: "Sinhalese", search: "%E0%B7%80%E0%B7%92%E0%B7%81%E0%B7%9A%E0%B7%82:%E0%B6%9C%E0%B7%80%E0%B7%9A%E0%B7%82%E0%B6%AB%E0%B6%BA?search=%s&go=%E0%B6%BA%E0%B6%B1%E0%B7%8A%E0%B6%B1" },335 "simple" : { language: "Simple English", search: "Special:Search?search=%s&go=Go" },336 "sk" : { language: "Slovak", search: "%C5%A0peci%C3%A1lne:Search?search=%s&go=%C3%8Ds%C5%A5+na" },337 "sl" : { language: "Slovenian", search: "Posebno:Search?search=%s&go=Pojdi+na" },338 "sm" : { language: "Samoan", search: "Special:Search?search=%s&go=Alu" },339 "sn" : { language: "Shona", search: "Special:Search?search=%s&go=Enda" },340 "so" : { language: "Somali", search: "Special:Search?search=%s&go=Soco" },341 "sq" : { language: "Albanian", search: "Speciale:K%C3%ABrkim?search=%s&go=Shko" },342 "sr" : { language: "Serbian", search: "%D0%9F%D0%BE%D1%81%D0%B5%D0%B1%D0%BD%D0%BE:Search?search=%s&go=%D0%98%D0%B4%D0%B8" },343 "ss" : { language: "Swati", search: "Special:Search?search=%s&go=K%C3%BAh%C3%A1mba" },344 "st" : { language: "Sesotho", search: "Special:Search?search=%s&go=Go" },345 "stq" : { language: "Saterland Frisian", search: "Spezial:Suche?search=%s&go=Siede" },346 "su" : { language: "Sundanese", search: "Husus:Sungsi?search=%s&go=Jung" },347 "sv" : { language: "Swedish", search: "Special:S%C3%B6k?search=%s&go=G%C3%A5+till" },348 "sw" : { language: "Swahili", search: "Special:Search?search=%s&go=Nenda" },349 "szl" : { language: "Silesian", search: "Specjalna:Szukaj?search=%s&go=P%C5%99y%C5%84d%C5%BA" },350 "ta" : { language: "Tamil", search: "%E0%AE%9A%E0%AE%BF%E0%AE%B1%E0%AE%AA%E0%AF%8D%E0%AE%AA%E0%AF%81:Search?search=%s&go=%E0%AE%9A%E0%AF%86%E0%AE%B2%E0%AF%8D" },351 "te" : { language: "Telugu", search: "%E0%B0%AA%E0%B1%8D%E0%B0%B0%E0%B0%A4%E0%B1%8D%E0%B0%AF%E0%B1%87%E0%B0%95:%E0%B0%85%E0%B0%A8%E0%B1%8D%E0%B0%B5%E0%B1%87%E0%B0%B7%E0%B0%A3?search=%s&go=%E0%B0%B5%E0%B1%86%E0%B0%B3%E0%B1%8D%E0%B0%B2%E0%B1%81" },352 "tet" : { language: "Tetum", search: "Espesi%C3%A1l:Buka?search=%s&go=P%C3%A1jina" },353 "tg" : { language: "Tajik", search: "%D0%92%D0%B8%D0%B6%D0%B0:Search?search=%s&go=%D0%91%D0%B8%D1%80%D0%B0%D0%B2" },354 "th" : { language: "Thai", search: "%E0%B8%9E%E0%B8%B4%E0%B9%80%E0%B8%A8%E0%B8%A9:%E0%B8%84%E0%B9%89%E0%B8%99%E0%B8%AB%E0%B8%B2?search=%s&go=%E0%B9%84%E0%B8%9B" },355 "ti" : { language: "Tigrinya", search: "Special:Search?search=%s&go=Go" },356 "tk" : { language: "Turkmen", search: "Special:Search?search=%s&go=Git" },357 "tl" : { language: "Tagalog", search: "Natatangi:Search?search=%s&go=Punta" },358 "tn" : { language: "Tswana", search: "Special:Search?search=%s&go=Tsamaya" },359 "to" : { language: "Tongan", search: "Special:Search?search=%s&go=Fai+%C4%81" },360 "tokipona" : { language: "Tokipona", search: "Special:Search?search=%s&go=Go" },361 "tpi" : { language: "Tok Pisin", search: "Special:Search?search=%s&go=Go" },362 "tr" : { language: "Turkish", search: "%C3%96zel:Ara?search=%s&go=Git" },363 "ts" : { language: "Tsonga", search: "Special:Search?search=%s&go=Nghena" },364 "tt" : { language: "Tatar", search: "Maxsus:Search?search=%s&go=K%C3%BC%C3%A7" },365 "tum" : { language: "Tumbuka", search: "Special:Search?search=%s&go=Go" },366 "tw" : { language: "Twi", search: "Special:Search?search=%s&go=Go" },367 "ty" : { language: "Tahitian", search: "Special:Recherche?search=%s&go=Haere" },368 "udm" : { language: "Udmurt", search: "%D0%9F%D0%B0%D0%BD%D0%B5%D0%BB%D1%8C:Search?search=%s&go=%D0%9F%D0%B5%D1%80%D0%B5%D0%B9%D1%82%D0%B8" },369 "ug" : { language: "Uyghur", search: "Special:Search?search=%s&go=Kuchush" },370 "uk" : { language: "Ukranian", search: "%D0%A1%D0%BF%D0%B5%D1%86%D1%96%D0%B0%D0%BB%D1%8C%D0%BD%D0%B0:Search?search=%s&go=%D0%9F%D0%B5%D1%80%D0%B5%D0%B9%D1%82%D0%B8" },371 "ur" : { language: "Urdu", search: "%D8%AE%D8%A7%D8%B5:Search?search=%s&go=%D8%AD%D8%B1%DA%A9%D8%AA" },372 "uz" : { language: "Uzbek", search: "Maxsus:Search?search=%s&go=O%27tish" },373 "ve" : { language: "Venda", search: "Special:Search?search=%s&go=Go" },374 "vec" : { language: "Venetian", search: "Speciale:Serca?search=%s&go=V%C3%A0" },375 "vi" : { language: "Vietnamese", search: "%C4%90%E1%BA%B7c_bi%E1%BB%87t:T%C3%ACm_ki%E1%BA%BFm?search=%s&go=Xem" },376 "vls" : { language: "West Flemish", search: "Specioal:Zoeken?search=%s&go=OK" },377 "vo" : { language: "Volapük", search: "Patikos:Suk?search=%s&go=Getol%C3%B6d" },378 "wa" : { language: "Walloon", search: "Sipeci%C3%A5s:Recherche?search=%s&go=Potch%C3%AE" },379 "war" : { language: "Waray-Waray", search: "Special:Bilnga?search=%s&go=Kadto-a" },380 "wo" : { language: "Wolof", search: "Special:Ceet?search=%s&go=Ayca" },381 "wuu" : { language: "Wu", search: "Special:Search?search=%s&go=%E8%BF%9B%E5%85%A5" },382 "xal" : { language: "Kalmyk", search: "%D0%9A%D3%A9%D0%B4%D0%BB%D1%85%D0%BD%C9%99:Search?search=%s&go=Go" },383 "xh" : { language: "Xhosa", search: "Special:Search?search=%s&go=Hamba" },384 "yi" : { language: "Yiddish", search: "%D7%91%D7%90%D6%B7%D7%96%D7%95%D7%A0%D7%93%D7%A2%D7%A8:%D7%96%D7%95%D7%9B%D7%9F?search=%s&go=%D7%92%D7%99%D7%99" },385 "yo" : { language: "Yoruba", search: "P%C3%A0t%C3%A0k%C3%AC:Search?search=%s&go=%C3%93+y%C3%A1%21" },386 "za" : { language: "Zhuang", search: "Special:Search?search=%s&go=Bei" },387 "zea" : { language: "Zealandic", search: "Speciaol:Zoeken?search=%s&go=Bladzie" },388 "zh" : { language: "Chinese", search: "Special:Search?search=%s&go=%E8%BF%9B%E5%85%A5" },389 // TODO: zh-classical - Classical Chinese390 // TODO: zh-min-nan - Min Nan391 "zu" : { language: "Zulu", search: "Special:Search?search=%s&go=Go" }392}, "Wikipedia version information. The key is the language code for the Wikipedia.");...
json_maps-6f5497ddfbc232d204a0897eb23c61e9e35bb5d4888850c2cad0f55bb58f098c.js
Source:json_maps-6f5497ddfbc232d204a0897eb23c61e9e35bb5d4888850c2cad0f55bb58f098c.js
1var currCenter = "";2function goFullScreen()3{4 currCenter = $EoLMap.map.getCenter();5 var elem = document.getElementById("gmap"); // gmap or map-container6 if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement )7 {8 $('#goFullText')[0].innerHTML = "Fullscreen ON";9 if ($('#goPanelText')[0].innerHTML == "Panel ON") {10 $('#panel')[0].style.height = "100%";11 $('#panel')[0].style.width = "17%";12 $('#map-canvas')[0].style.height = "100%";13 $('#map-canvas')[0].style.width = "83%";14 }15 else {16 $('#panel')[0].style.height = "0px";17 $('#panel')[0].style.width = "0px";18 $('#map-canvas')[0].style.height = "100%";19 $('#map-canvas')[0].style.width = "100%";20 }21 if (elem.requestFullscreen) {elem.requestFullscreen();}22 else if (elem.msRequestFullscreen) {elem.msRequestFullscreen();}23 else if (elem.mozRequestFullScreen) {elem.mozRequestFullScreen();}24 else if (elem.webkitRequestFullscreen) {25 elem.style.width = "100%";26 elem.style.height = "100%";27 elem.webkitRequestFullscreen(); //Element.ALLOW_KEYBOARD_INPUT28 }29 }30 else31 {32 $('#goFullText')[0].innerHTML = "Fullscreen OFF";33 if ($('#goPanelText')[0].innerHTML == "Panel ON")34 {35 $('#panel')[0].style.height = "500px";36 $('#panel')[0].style.width = "200px"; //40037 $('#map-canvas')[0].style.height = "500px";38 $('#map-canvas')[0].style.width = "700px"; //80039 }40 else41 {42 $('#panel')[0].style.height = "0px";43 $('#panel')[0].style.width = "0px";44 $('#map-canvas')[0].style.height = "500px";45 $('#map-canvas')[0].style.width = "900px"; //120046 }47 if (document.exitFullscreen) {document.exitFullscreen();}48 else if (document.msExitFullscreen) {document.msExitFullscreen();}49 else if (document.mozCancelFullScreen) {document.mozCancelFullScreen();}50 else if (document.webkitExitFullscreen) {51 elem.style.width = "";52 document.webkitExitFullscreen();53 }54 }55 google.maps.event.trigger(EoLMap.map, 'resize');56 EoLMap.map.setCenter(currCenter);57}58// start: listeners for fullscreenchanges59if (document.addEventListener) {60 document.addEventListener('webkitfullscreenchange', exitHandler, false);61 document.addEventListener('mozfullscreenchange', exitHandler, false);62 document.addEventListener('fullscreenchange', exitHandler, false);63 document.addEventListener('MSFullscreenChange', exitHandler, false);64}65function exitHandler() {66 if(is_full_screen)67 {68 if(!document.webkitIsFullScreen) {69 $('#goFullText')[0].innerHTML = "Fullscreen OFF";70 var elem = document.getElementById("gmap"); //gmap or map-container71 elem.style.width = "";72 }73 if(document.mozFullScreen) $('#goFullText')[0].innerHTML = "Fullscreen ON";74 }75 if(!is_full_screen()) {76 if ($('#goPanelText')[0].innerHTML == "Panel ON") {77 $('#panel')[0].style.height = "500px";78 $('#panel')[0].style.width = "200px"; //40079 $('#map-canvas')[0].style.height = "500px";80 $('#map-canvas')[0].style.width = "700px"; //80081 }82 else {83 $('#map-canvas')[0].style.height = "500px";84 $('#map-canvas')[0].style.width = "900px"; //120085 }86 }87 google.maps.event.trigger(EoLMap.map, 'resize');88 EoLMap.map.setCenter(currCenter);89}90// end: listeners for fullscreenchanges91function is_full_screen()92{93 var elem = document.getElementById("gmap"); //gmap or map-container94 if (elem.requestFullscreen) {}95 else if (elem.msRequestFullscreen) {96 if (document.msFullscreenElement == true) return true;97 }98 else if (elem.mozRequestFullScreen) {99 if (document.mozFullScreen == true) return true;100 }101 else if (elem.webkitRequestFullscreen) {102 if (document.webkitIsFullScreen == true) return true;103 }104 return false;105}106function panelShowHide()107{108 if ($('#goPanelText')[0].innerHTML == "Panel ON") $('#goPanelText')[0].innerHTML = "Panel OFF";109 else $('#goPanelText')[0].innerHTML = "Panel ON";110 if (is_full_screen())111 {112 $('#map-canvas')[0].style.height = "100%";113 if ($('#goPanelText')[0].innerHTML == "Panel ON")114 {115 $('#panel')[0].style.width = "17%";116 $('#panel')[0].style.height = "100%";117 $('#map-canvas')[0].style.width = "83%";118 }119 else120 {121 $('#panel')[0].style.width = "0px";122 $('#panel')[0].style.height = "0px";123 $('#map-canvas')[0].style.width = "100%";124 }125 }126 else //not full screen127 {128 $('#map-canvas')[0].style.height = "500px";129 if ($('#goPanelText')[0].innerHTML == "Panel ON")130 {131 $('#panel')[0].style.width = "200px"; //400132 $('#panel')[0].style.height = "500px";133 $('#map-canvas')[0].style.width = "700px"; //800134 }135 else136 {137 $('#panel')[0].style.width = "0px";138 $('#panel')[0].style.height = "0px";139 $('#map-canvas')[0].style.width = "900px"; //1200140 }141 }142 currCenter = EoLMap.map.getCenter();143 google.maps.event.trigger(EoLMap.map, 'resize');144 EoLMap.map.setCenter(currCenter);145}146//start back button147function record_history()148{149 var current = {};150 current.center = EoLMap.map.getCenter();151 current.zoom = EoLMap.map.getZoom();152 current.mapTypeId = EoLMap.map.getMapTypeId();153 statuz.push(current);154 statuz_all.push(current);155 if(!initial_map) initial_map = current;156 currCenter = EoLMap.map.getCenter();157}158// EoLMap.back = function()159// {160 // if(statuz.length > 1) {161 // statuz.pop();162 // var current = statuz.pop();163 // EoLMap.map.setOptions(current);164 // if(JSON.stringify(current) == JSON.stringify(initial_map)){165 // statuz = [];166 // statuz_all = [];167 // }168 // }169// }170// EoLMap.next = function()171// {172 // if(statuz_all.length > 1) {173 // statuz_all.pop();174 // var current = statuz_all.pop();175 // EoLMap.map.setOptions(current);176 // if(JSON.stringify(current) == JSON.stringify(initial_map)){177 // statuz = [];178 // statuz_all = [];179 // }180 // }181// }182//end back button183//start customized controls184function CenterControl(controlDiv, map, ctrl_type) {185 // Set GO BACK button186 var goBackUI = document.createElement('div');187 goBackUI.id = 'goBackUI'; //.id here is used in HTML <style>188 goBackUI.title = 'Go back one step';189 controlDiv.appendChild(goBackUI);190 // CSS for text191 var goBackText = document.createElement('div');192 goBackText.id = 'goBackText';193 goBackText.innerHTML = 'Go Back';194 goBackUI.appendChild(goBackText);195 // Set MOVE NEXT button196 var goNextUI = document.createElement('div');197 goNextUI.id = "goNextUI";198 goNextUI.title = 'Move forward one step';199 controlDiv.appendChild(goNextUI);200 // CSS for text201 var goNextText = document.createElement('div');202 goNextText.id = 'goNextText';203 goNextText.innerHTML = 'Move Next';204 goNextUI.appendChild(goNextText);205 // Set Original pos button206 var goOrigUI = document.createElement('div');207 goOrigUI.id = "goOrigUI";208 goOrigUI.title = 'Back to original map';209 controlDiv.appendChild(goOrigUI);210 // CSS for text211 var goOrigText = document.createElement('div');212 goOrigText.id = 'goOrigText';213 goOrigText.innerHTML = 'Initial Map';214 goOrigUI.appendChild(goOrigText);215 if(ctrl_type == 1) //for Cluster maps216 {217 // Set Cluster button218 var goRadioUI = document.createElement('div');219 goRadioUI.id = "goRadioUI";220 goRadioUI.title = 'Toggle Clustering';221 controlDiv.appendChild(goRadioUI);222 // CSS for text223 var goRadioText = document.createElement('div');224 goRadioText.id = 'goRadioText';225 goRadioText.innerHTML = 'Clusters ON';226 goRadioUI.appendChild(goRadioText);227 // Set up the click event listener228 goRadioUI.addEventListener('click', function() {clustersOnOff();});229 }230 // Set Panel button231 var goPanelUI = document.createElement('div');232 goPanelUI.id = "goPanelUI";233 goPanelUI.title = 'Toggle Panel';234 controlDiv.appendChild(goPanelUI);235 // CSS for text236 var goPanelText = document.createElement('div');237 goPanelText.id = 'goPanelText';238 goPanelText.innerHTML = 'Panel OFF';239 goPanelUI.appendChild(goPanelText);240 // Set Fullscreen button241 var goFullUI = document.createElement('div');242 goFullUI.id = "goFullUI";243 goFullUI.title = 'Toggle Fullscreen';244 controlDiv.appendChild(goFullUI);245 // CSS for text246 var goFullText = document.createElement('div');247 goFullText.id = 'goFullText';248 goFullText.innerHTML = 'Fullscreen OFF';249 goFullUI.appendChild(goFullText);250 // Set up the click event listener251 goBackUI.addEventListener('click', function() {EoLMap.back();});252 goNextUI.addEventListener('click', function() {EoLMap.next();});253 goOrigUI.addEventListener('click', function() {EoLMap.map.setOptions(initial_map);254 statuz = [];255 statuz_all = [];256 });257 goPanelUI.addEventListener('click', function() {panelShowHide();});258 goFullUI.addEventListener('click', function() {goFullScreen();});259}260//end customized controls...
json_maps.js
Source:json_maps.js
1var currCenter = "";2function goFullScreen()3{4 currCenter = $EoLMap.map.getCenter();5 var elem = document.getElementById("gmap"); // gmap or map-container6 if (!document.fullscreenElement && !document.mozFullScreenElement && !document.webkitFullscreenElement && !document.msFullscreenElement )7 {8 $('#goFullText')[0].innerHTML = "Fullscreen ON";9 if ($('#goPanelText')[0].innerHTML == "Panel ON") {10 $('#panel')[0].style.height = "100%";11 $('#panel')[0].style.width = "17%";12 $('#map-canvas')[0].style.height = "100%";13 $('#map-canvas')[0].style.width = "83%";14 }15 else {16 $('#panel')[0].style.height = "0px";17 $('#panel')[0].style.width = "0px";18 $('#map-canvas')[0].style.height = "100%";19 $('#map-canvas')[0].style.width = "100%";20 }21 if (elem.requestFullscreen) {elem.requestFullscreen();}22 else if (elem.msRequestFullscreen) {elem.msRequestFullscreen();}23 else if (elem.mozRequestFullScreen) {elem.mozRequestFullScreen();}24 else if (elem.webkitRequestFullscreen) {25 elem.style.width = "100%";26 elem.style.height = "100%";27 elem.webkitRequestFullscreen(); //Element.ALLOW_KEYBOARD_INPUT28 }29 }30 else31 {32 $('#goFullText')[0].innerHTML = "Fullscreen OFF";33 if ($('#goPanelText')[0].innerHTML == "Panel ON")34 {35 $('#panel')[0].style.height = "500px";36 $('#panel')[0].style.width = "200px"; //40037 $('#map-canvas')[0].style.height = "500px";38 $('#map-canvas')[0].style.width = "700px"; //80039 }40 else41 {42 $('#panel')[0].style.height = "0px";43 $('#panel')[0].style.width = "0px";44 $('#map-canvas')[0].style.height = "500px";45 $('#map-canvas')[0].style.width = "900px"; //120046 }47 if (document.exitFullscreen) {document.exitFullscreen();}48 else if (document.msExitFullscreen) {document.msExitFullscreen();}49 else if (document.mozCancelFullScreen) {document.mozCancelFullScreen();}50 else if (document.webkitExitFullscreen) {51 elem.style.width = "";52 document.webkitExitFullscreen();53 }54 }55 google.maps.event.trigger(EoLMap.map, 'resize');56 EoLMap.map.setCenter(currCenter);57}58// start: listeners for fullscreenchanges59if (document.addEventListener) {60 document.addEventListener('webkitfullscreenchange', exitHandler, false);61 document.addEventListener('mozfullscreenchange', exitHandler, false);62 document.addEventListener('fullscreenchange', exitHandler, false);63 document.addEventListener('MSFullscreenChange', exitHandler, false);64}65function exitHandler() {66 if(is_full_screen)67 {68 if(!document.webkitIsFullScreen) {69 $('#goFullText')[0].innerHTML = "Fullscreen OFF";70 var elem = document.getElementById("gmap"); //gmap or map-container71 elem.style.width = "";72 }73 if(document.mozFullScreen) $('#goFullText')[0].innerHTML = "Fullscreen ON";74 }75 if(!is_full_screen()) {76 if ($('#goPanelText')[0].innerHTML == "Panel ON") {77 $('#panel')[0].style.height = "500px";78 $('#panel')[0].style.width = "200px"; //40079 $('#map-canvas')[0].style.height = "500px";80 $('#map-canvas')[0].style.width = "700px"; //80081 }82 else {83 $('#map-canvas')[0].style.height = "500px";84 $('#map-canvas')[0].style.width = "900px"; //120085 }86 }87 google.maps.event.trigger(EoLMap.map, 'resize');88 EoLMap.map.setCenter(currCenter);89}90// end: listeners for fullscreenchanges91function is_full_screen()92{93 var elem = document.getElementById("gmap"); //gmap or map-container94 if (elem.requestFullscreen) {}95 else if (elem.msRequestFullscreen) {96 if (document.msFullscreenElement == true) return true;97 }98 else if (elem.mozRequestFullScreen) {99 if (document.mozFullScreen == true) return true;100 }101 else if (elem.webkitRequestFullscreen) {102 if (document.webkitIsFullScreen == true) return true;103 }104 return false;105}106function panelShowHide()107{108 if ($('#goPanelText')[0].innerHTML == "Panel ON") $('#goPanelText')[0].innerHTML = "Panel OFF";109 else $('#goPanelText')[0].innerHTML = "Panel ON";110 if (is_full_screen())111 {112 $('#map-canvas')[0].style.height = "100%";113 if ($('#goPanelText')[0].innerHTML == "Panel ON")114 {115 $('#panel')[0].style.width = "17%";116 $('#panel')[0].style.height = "100%";117 $('#map-canvas')[0].style.width = "83%";118 }119 else120 {121 $('#panel')[0].style.width = "0px";122 $('#panel')[0].style.height = "0px";123 $('#map-canvas')[0].style.width = "100%";124 }125 }126 else //not full screen127 {128 $('#map-canvas')[0].style.height = "500px";129 if ($('#goPanelText')[0].innerHTML == "Panel ON")130 {131 $('#panel')[0].style.width = "200px"; //400132 $('#panel')[0].style.height = "500px";133 $('#map-canvas')[0].style.width = "700px"; //800134 }135 else136 {137 $('#panel')[0].style.width = "0px";138 $('#panel')[0].style.height = "0px";139 $('#map-canvas')[0].style.width = "900px"; //1200140 }141 }142 currCenter = EoLMap.map.getCenter();143 google.maps.event.trigger(EoLMap.map, 'resize');144 EoLMap.map.setCenter(currCenter);145}146//start back button147function record_history()148{149 var current = {};150 current.center = EoLMap.map.getCenter();151 current.zoom = EoLMap.map.getZoom();152 current.mapTypeId = EoLMap.map.getMapTypeId();153 statuz.push(current);154 statuz_all.push(current);155 if(!initial_map) initial_map = current;156 currCenter = EoLMap.map.getCenter();157}158// EoLMap.back = function()159// {160 // if(statuz.length > 1) {161 // statuz.pop();162 // var current = statuz.pop();163 // EoLMap.map.setOptions(current);164 // if(JSON.stringify(current) == JSON.stringify(initial_map)){165 // statuz = [];166 // statuz_all = [];167 // }168 // }169// }170// EoLMap.next = function()171// {172 // if(statuz_all.length > 1) {173 // statuz_all.pop();174 // var current = statuz_all.pop();175 // EoLMap.map.setOptions(current);176 // if(JSON.stringify(current) == JSON.stringify(initial_map)){177 // statuz = [];178 // statuz_all = [];179 // }180 // }181// }182//end back button183//start customized controls184function CenterControl(controlDiv, map, ctrl_type) {185 // Set GO BACK button186 var goBackUI = document.createElement('div');187 goBackUI.id = 'goBackUI'; //.id here is used in HTML <style>188 goBackUI.title = 'Go back one step';189 controlDiv.appendChild(goBackUI);190 // CSS for text191 var goBackText = document.createElement('div');192 goBackText.id = 'goBackText';193 goBackText.innerHTML = 'Go Back';194 goBackUI.appendChild(goBackText);195 // Set MOVE NEXT button196 var goNextUI = document.createElement('div');197 goNextUI.id = "goNextUI";198 goNextUI.title = 'Move forward one step';199 controlDiv.appendChild(goNextUI);200 // CSS for text201 var goNextText = document.createElement('div');202 goNextText.id = 'goNextText';203 goNextText.innerHTML = 'Move Next';204 goNextUI.appendChild(goNextText);205 // Set Original pos button206 var goOrigUI = document.createElement('div');207 goOrigUI.id = "goOrigUI";208 goOrigUI.title = 'Back to original map';209 controlDiv.appendChild(goOrigUI);210 // CSS for text211 var goOrigText = document.createElement('div');212 goOrigText.id = 'goOrigText';213 goOrigText.innerHTML = 'Initial Map';214 goOrigUI.appendChild(goOrigText);215 if(ctrl_type == 1) //for Cluster maps216 {217 // Set Cluster button218 var goRadioUI = document.createElement('div');219 goRadioUI.id = "goRadioUI";220 goRadioUI.title = 'Toggle Clustering';221 controlDiv.appendChild(goRadioUI);222 // CSS for text223 var goRadioText = document.createElement('div');224 goRadioText.id = 'goRadioText';225 goRadioText.innerHTML = 'Clusters ON';226 goRadioUI.appendChild(goRadioText);227 // Set up the click event listener228 goRadioUI.addEventListener('click', function() {clustersOnOff();});229 }230 // Set Panel button231 var goPanelUI = document.createElement('div');232 goPanelUI.id = "goPanelUI";233 goPanelUI.title = 'Toggle Panel';234 controlDiv.appendChild(goPanelUI);235 // CSS for text236 var goPanelText = document.createElement('div');237 goPanelText.id = 'goPanelText';238 goPanelText.innerHTML = 'Panel OFF';239 goPanelUI.appendChild(goPanelText);240 // Set Fullscreen button241 var goFullUI = document.createElement('div');242 goFullUI.id = "goFullUI";243 goFullUI.title = 'Toggle Fullscreen';244 controlDiv.appendChild(goFullUI);245 // CSS for text246 var goFullText = document.createElement('div');247 goFullText.id = 'goFullText';248 goFullText.innerHTML = 'Fullscreen OFF';249 goFullUI.appendChild(goFullText);250 // Set up the click event listener251 goBackUI.addEventListener('click', function() {EoLMap.back();});252 goNextUI.addEventListener('click', function() {EoLMap.next();});253 goOrigUI.addEventListener('click', function() {EoLMap.map.setOptions(initial_map);254 statuz = [];255 statuz_all = [];256 });257 goPanelUI.addEventListener('click', function() {panelShowHide();});258 goFullUI.addEventListener('click', function() {goFullScreen();});259}...
Navigation.js
Source:Navigation.js
1/* @flow */2/* This Source Code Form is subject to the terms of the Mozilla Public3 * License, v. 2.0. If a copy of the MPL was not distributed with this4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */5import {always} from '../../../../Common/Prelude';6import {ok, error} from '../../../../Common/Result';7import {Effects, Task} from 'reflex';8import * as Unknown from '../../../../Common/Unknown'9import * as Ref from '../../../../Common/Ref';10import type {Never} from "reflex";11import type {Result} from '../../../../Common/Result';12import type {ID, URI, Time} from "../../../../Common/Prelude"13export type Action =14 | { type: "NoOp" }15 | { type: "LocationChanged"16 , uri: URI17 , canGoBack: ?boolean18 , canGoForward: ?boolean19 }20 | { type: "Load"21 , uri: URI22 }23 | { type: "Stop" }24 | { type: "Reload" }25 | { type: "GoBack" }26 | { type: "GoForward" }27 // When the model is updated with the above action, effects with the following28 // response actions are triggered.29 | { type: "CanGoBackChanged"30 , canGoBackChanged: Result<Error, boolean>31 }32 | { type: "CanGoForwardChanged"33 , canGoForwardChanged: Result<Error, boolean>34 }35 | { type: "Stopped"36 , stopped: Result<Error, void>37 }38 | { type: "Reloaded"39 , reloaded: Result<Error, void>40 }41 | { type: "WentBack"42 , wentBack: Result<Error, void>43 }44 | { type: "WentForward"45 , wentForward: Result<Error, void>46 }47export class Model {48 ref: Ref.Model;49 canGoBack: boolean;50 canGoForward: boolean;51 url: URI;52 constructor(53 ref: Ref.Model54 , canGoBack: boolean55 , canGoForward: boolean56 , url: URI57 ) {58 this.ref = ref59 this.canGoBack = canGoBack60 this.canGoForward = canGoForward61 this.url = url62 }63}64// User interaction interaction may also triggered following actions:65export const Stop:Action = {type: "Stop"};66export const Reload:Action = {type: "Reload"};67export const GoBack:Action = {type: "GoBack"};68export const GoForward:Action = {type: "GoForward"};69const NoOp = always({type: "NoOp"});70export const Load =71 (uri:URI):Action =>72 ({type: "Load", uri});73export const LocationChanged =74 (uri:URI, canGoBack:?boolean, canGoForward:?boolean):Action =>75 ({type: "LocationChanged", uri, canGoBack, canGoForward});76const CanGoBackChanged =77 result =>78 ( { type: "CanGoBackChanged"79 , canGoBackChanged: result80 }81 );82const CanGoForwardChanged =83 result =>84 ( { type: "CanGoForwardChanged"85 , canGoForwardChanged: result86 }87 );88const Stopped =89 result =>90 ( { type: "Stopped"91 , stopped: result92 }93 );94const Reloaded =95 result =>96 ( { type: "Reloaded"97 , reloaded: result98 }99 );100const WentBack = result =>101 ( { type: "WentBack"102 , wentBack: result103 }104 );105const WentForward = result =>106 ( { type: "WentForward"107 , wentForward: result108 }109 );110export const canGoBack =111 (ref:Ref.Model):Task<Never, Result<Error, boolean>> =>112 Ref113 .deref(ref)114 .chain(elementCanGoBack);115const elementCanGoBack =116 target =>117 new Task((succeed, fail) => {118 if (typeof(target.getCanGoBack) !== "function") {119 succeed(error(Error(`.getCanGoBack is not supported by runtime`)));120 }121 else {122 target.getCanGoBack().onsuccess = request => {123 succeed(ok(request.target.result));124 };125 }126 });127export const canGoForward =128 (ref:Ref.Model):Task<Never, Result<Error, boolean>> =>129 Ref130 .deref(ref)131 .chain(elementCanGoForward);132const elementCanGoForward =133 target =>134 new Task((succeed, fail) => {135 if (typeof(target.getCanGoForward) !== "function") {136 succeed(error(Error(`.getCanGoForward is not supported by runtime`)))137 }138 else {139 target.getCanGoForward().onsuccess = request => {140 succeed(ok(request.target.result));141 }142 }143 });144const invoke =145 name => {146 const elementInvoke = <value>147 (element:HTMLElement):Task<Never, Result<Error, value>> =>148 new Task((succeed, fail) => {149 try {150 // @FlowIgnore: We know that method may not exist.151 element[name]();152 } catch (exception) {153 succeed(error(exception))154 }155 })156 const task = <value>157 (ref:Ref.Model):Task<Never, Result<Error, value>> =>158 Ref159 .deref(ref)160 .chain(elementInvoke)161 return task162 }163export const stop = invoke('stop');164export const reload = invoke('reload');165export const goBack = invoke('goBack');166export const goForward = invoke('goForward');167const report =168 error =>169 new Task((succeed, fail) => {170 console.warn(error);171 });172export const init =173 ( ref:Ref.Model=Ref.create()174 , uri:URI='about:blank'175 , canGoBack: boolean = false176 , canGoForward: boolean = false177 ):[Model, Effects<Action>] =>178 [ new Model179 ( ref180 , canGoBack181 , canGoForward182 , uri183 )184 , Effects.none185 ]186const updateCanGoBack =187 ( model, canGoBack ) =>188 [ new Model189 ( model.ref190 , canGoBack191 , model.canGoForward192 , model.url193 )194 , Effects.none195 ]196const updateCanGoForward =197 ( model, canGoForward ) =>198 [ new Model199 ( model.ref200 , model.canGoBack201 , canGoForward202 , model.url203 )204 , Effects.none205 ]206const updateResponse =207 (model, result) =>208 ( result.isOk209 ? [model, Effects.none]210 : [model, Effects.perform(report(result.error)).map(NoOp)]211 );212const updateLocation =213 (model, url, canGoBackValue, canGoForwardValue) =>214 // In the case where LocationChanged carries information about215 // canGoBack and canGoForward, we update the model with the new info.216 // This scenario will be hit in Servo.217 ( ( canGoBackValue != null && canGoForwardValue != null )218 ? [ new Model219 ( model.ref220 , canGoBackValue221 , canGoForwardValue222 , url223 )224 , Effects.none225 ]226 // Otherwise, update the currentURI and create a task to read227 // canGoBack, canGoForward from the iframe.228 // This scenario will be hit in Gecko.229 : [ new Model230 ( model.ref231 , model.canGoBack232 , model.canGoForward233 , url234 )235 , Effects.batch236 ( [ Effects237 .perform(canGoBack(model.ref))238 .map(CanGoBackChanged)239 , Effects240 .perform(canGoForward(model.ref))241 .map(CanGoForwardChanged)242 ]243 )244 ]245 );246export const load =247 ( model:Model248 , url:URI='about:blank'249 ):[Model, Effects<Action>] =>250 [ ( model.url === url251 ? model252 : new Model253 ( model.ref254 , model.canGoBack255 , false256 , url257 )258 )259 , Effects.none260 ]261export const update =262 (model:Model, action:Action):[Model, Effects<Action>] => {263 switch (action.type) {264 case "CanGoForwardChanged":265 return (266 action.canGoForwardChanged.isOk267 ? updateCanGoForward(model, action.canGoForwardChanged.value)268 : [ model269 , Effects.perform(report(action.canGoForwardChanged.error))270 ]271 );272 case "CanGoBackChanged":273 return (274 action.canGoBackChanged.isOk275 ? updateCanGoBack(model, action.canGoBackChanged.value)276 : [ model277 , Effects.perform(report(action.canGoBackChanged.error))278 ]279 );280 case "LocationChanged":281 return updateLocation(model, action.uri, action.canGoBack, action.canGoForward)282 case "Load":283 return load(model, action.uri)284 case "Stop":285 return [ model286 , Effects287 .perform(stop(model.ref))288 .map(Stopped)289 ];290 case "Reload":291 return [ model292 , Effects293 .perform(reload(model.ref))294 .map(Reloaded)295 ];296 case "GoBack":297 return [ model298 , Effects299 .perform(goBack(model.ref))300 .map(WentBack)301 ];302 case "GoForward":303 return [ model304 , Effects305 .perform(goForward(model.ref))306 .map(WentForward)307 ];308 case "Stopped":309 return updateResponse(model, action.stopped);310 case "Reloaded":311 return updateResponse(model, action.reloaded);312 case "WentBack":313 return updateResponse(model, action.wentBack);314 case "WentForward":315 return updateResponse(model, action.wentForward);316 default:317 return Unknown.update(model, action);318 }...
game.js
Source:game.js
1const cheerio = require('cheerio')2const fetch = require('node-fetch')3const axios = require('axios')4const fs = require('fs')5function asahotak() {6 return new Promise((resolve, reject) => {7 fetch('https://www.cademedia.com/jawaban-tebak-tebakan-asah-otak')8 .then(res => res.text())9 .then(res => {10 const $ = cheerio.load(res)11 data = []12 go = $('body').find('div.entry-content').text().split('P:')13 for (let i = 2; i < go.length; i++) {14 x = (go[i].split('J:')[0]).trim()15 switch (i) {16 case 229: y = (go[i].split('J:')[1].split('Level')[0].split('Demikian')[0]).trim()17 break; default: y = (go[i].split('J:')[1].split('Level')[0]).trim()18 } data.push({ pertanyaan: x, jawaban: y })19 }20 // save json21 // fs.writeFileSync('./asahotak.json', JSON.stringify(data))22 resolve(data)23 }).catch(reject)24 })25}26function family100() {27 return new Promise((resolve, reject) => {28 fetch('https://teknologital.com/kunci-jawaban-ica-ica')29 .then(res => res.text())30 .then(res => {31 const $ = cheerio.load(res)32 data = []33 go = $('body').find('div.entry-content').text().split('Jawaban :')34 for (let i = 1; i < go.length; i++) {35 y = (go[i - 1].split('\n')[1]).trim()36 z = (go[i].split('\n')[0]).trim()37 if (i !== 1) {38 data.push({ pertanyaan: y, jawaban: z })39 }40 }41 // save json42 // fs.writeFileSync('./ica.json', JSON.stringify(data))43 resolve(data)44 }).catch(reject)45 })46}47function siapakah() {48 return new Promise((resolve, reject) => {49 fetch('https://tutorialaplikasi.com/kunci-jawaban-tebak-siapakah-aku/')50 .then(res => res.text())51 .then(res => {52 const $ = cheerio.load(res)53 let data = []54 $('body').find('li').each(function (index, element) {55 let x = $(this).html().split('<strong>')[0]56 let y = $(this).find('strong').text()57 data.push({ pertanyaan: x, jawaban: y })58 })59 data.splice(0, 11)60 data.splice(100, 131)61 resolve(data)62 }).catch(reject)63 })64}65function siapakah2() {66 return new Promise((resolve, reject) => {67 fetch('https://jagat-nusantara.blogspot.com/2018/01/kunci-jawaban-tebak-siapakah-aku-m.html')68 .then(res => res.text())69 .then(res => {70 const $ = cheerio.load(res)71 data = []72 go = $('article').find('div[id="adsmiddle27044024372030888142"]').text()73 for (let i = 0; i < 534; i++) {74 x = go.split(i + '.')[1].split('\n')[0].trim()75 y = go.split(i + '.')[1].split('Answer:')[1].split('\n')[0].trim()76 data.push({ pertanyaan: x, jawaban: y })77 } resolve(data)78 }).catch(reject)79 })80}81function susunkata() {82 return new Promise((resolve, reject) => {83 fetch('https://www.cademedia.com/jawaban-tebak-tebakan-susun-kata')84 .then(res => res.text())85 .then(res => {86 const $ = cheerio.load(res)87 data = []88 go = $('body').find('article').text()89 for (let i = 2; i < 350; i++) {90 v = go.split('Level ' + i)[1].split(':')[0]91 x = go.split('Level ' + i)[1].split(':')[1]92 if (i !== 21 && i !== 51 && i !== 101 && i !== 151 && i !== 201 && i !== 251 && i !== 301) {93 if (i == 50 || i == 100 || i == 150 || i == 200 || i == 250 || i == 250 || i == 300) {94 y = go.split('Level ' + i)[1].split('Jawaban')[1].split('Susun')[0]95 } else {96 y = go.split('Level ' + i)[1].split('Jawaban')[1].split('Level')[0]97 }98 data.push({ tipe: v.trim(), acak: x.replace(/(Jawaban)/gi, '').trim(), jawaban: y.replace(/:/g, '').trim() })99 // save json100 // fs.writeFileSync('./susunkata.json', JSON.stringify(data))101 }102 }103 data.splice(0, 2)104 resolve(data)105 }).catch(reject)106 })107}108function tekateki() {109 return new Promise((resolve, reject) => {110 fetch('https://www.kabargames.id/kunci-jawaban-tebak-tebakan-2020')111 .then(res => res.text())112 .then(res => {113 const $ = cheerio.load(res)114 data = []115 go = $('body').find('div.post__content').text()116 for (let i = 1; i < 201; i++) {117 v = (go.split('Level ' + i + 'Pertanyaan:')[1].split('Jawaban')[0]).trim()118 switch (i) {119 case 1: x = go.split('Level ' + i + ' â 20Level ' + i)[1].split('Answer:')[1]120 break121 case 21: x = go.split('Level ' + i + ' â 40Level ' + i)[1].split('Answer:')[1]122 break123 case 41: x = go.split('Level ' + i + ' â 60Level ' + i)[1].split('Answer:')[1]124 break125 case 61: x = go.split('Level ' + i + ' â 80Level ' + i)[1].split('Answer:')[1]126 break127 case 81: x = go.split('Level ' + i + ' â 100Level ' + i)[1].split('Answer:')[1]128 break129 case 101: x = go.split('Level ' + i + ' â 120Level ' + i)[1].split('Answer:')[1]130 break131 case 121: x = go.split('Level ' + i + ' â 140Level ' + i)[1].split('Answer:')[1]132 break133 case 141: x = go.split('Level ' + i + ' â 160Level ' + i)[1].split('Answer:')[1]134 break135 case 161: x = go.split('Level ' + i + ' â 180Level ' + i)[1].split('Answer:')[1]136 break137 case 181: x = go.split('Level ' + i + ' â 200Level ' + i)[1].split('Answer:')[1]138 break139 default: x = go.split('Level ' + i)[1].split('Answer:')[1]140 }141 if (i == 20 || i == 40 || i == 60 || i == 80 || i == 100 || i == 120 || i == 140 || i == 160 || i == 180) {142 y = (x.split('Key')[0]).trim()143 } else if (i == 200) {144 y = (x.split('now')[0]).trim()145 } else {146 y = (x.split('Level')[0]).trim()147 }148 data.push({ pertanyaan: v, jawaban: y })149 // save json150 // fs.writeFileSync('./tekateki.json', JSON.stringify(data))151 } resolve(data)152 }).catch(reject)153 })154}...
demo05.js
Source:demo05.js
1/**2 * Created by qile on 2017/8/14.3 */4// 使ç¨Chormeç Watchçªå£ï¼è¿½è¸ªxï¼yï¼zï¼å5// Scopeçªä½ï¼è§å¯ä½ç¨åé¾çååï¼6console.log("å
¨å±ä¸ä¸æ-start");7var x = "家ä¸ç¯å¢-";8function goToStore_A(){9 console.log("goToStore_A ä¸ä¸æ-start");//设置æç¹10 var y = "æå
·åºAç¯å¢-1111";11 goToBank_C();//设置æç¹12 // goToBank_D();//设置æç¹13 console.log("goToStore_A ä¸ä¸æ-end");//设置æç¹14}15function goToStore_B(){16 console.log("goToStore_B ä¸ä¸æ-start");//设置æç¹17 var y = "æå
·åºBç¯å¢-";18 goToBank_C();//设置æç¹19 // goToBank_D();//设置æç¹20 console.log("goToStore_B ä¸ä¸æ-end");//设置æç¹21}22var y = "2222";//23function goToBank_C(){24 console.log("goToBank_C ä¸ä¸æ-start");//设置æç¹25 var z = "é¶è¡Cç¯å¢-";26 console.log(x+y+z);//éµå¾ªéæè¯æ³ä½ç¨å y 为2222èé 111127 console.log("goToBank_C ä¸ä¸æ-end");//设置æç¹28}29function goToBank_D(){30 console.log("goToBank_D ä¸ä¸æ-start");//设置æç¹31 var z = "é¶è¡Dç¯å¢-";32 //console.log(x+y+z);33 console.log("goToBank_D ä¸ä¸æ-end");//设置æç¹34}35goToStore_A();//设置æç¹36// goToStore_B();//设置æç¹37console.log("å
¨å±ä¸ä¸æ-end");//设置æç¹38/*39// å°goToBankå½æ°åµå¥å°goToStoreå½æ°ä¸ï¼3å±çé¾ï¼åææ¤æ¶çä½ç¨åé¾40console.log("å
¨å±ä¸ä¸æ-start");41var x = "家ä¸ç¯å¢-";42function goToStore_A(){43 console.log("goToStore_A ä¸ä¸æ-start");//设置æç¹44 var y = "æå
·åºAç¯å¢-";45 function goToBank_C(){46 console.log("goToBank_C ä¸ä¸æ-start");//设置æç¹47 var z = "é¶è¡Cç¯å¢-";48 console.log(x+y+z);49 console.log("goToBank_C ä¸ä¸æ-end");//设置æç¹50 }51 function goToBank_D(){52 console.log("goToBank_D ä¸ä¸æ-start");//设置æç¹53 var z = "é¶è¡Dç¯å¢-";54 console.log(x+y+z);55 console.log("goToBank_D ä¸ä¸æ-end");//设置æç¹56 }57 goToBank_C();//设置æç¹58 // goToBank_D();//设置æç¹59 console.log("goToStore_A ä¸ä¸æ-end");//设置æç¹60}61function goToStore_B(){62 console.log("goToStore_B ä¸ä¸æ-start");//设置æç¹63 var y = "æå
·åºBç¯å¢-";64 function goToBank_C(){65 console.log("goToBank_C ä¸ä¸æ-start");//设置æç¹66 var z = "é¶è¡Cç¯å¢-";67 console.log(x+y+z);68 console.log("goToBank_C ä¸ä¸æ-end");//设置æç¹69 }70 function goToBank_D(){71 console.log("goToBank_D ä¸ä¸æ-start");//设置æç¹72 var z = "é¶è¡Dç¯å¢-";73 console.log(x+y+z);74 console.log("goToBank_D ä¸ä¸æ-end");//设置æç¹75 }76 goToBank_C();//设置æç¹77 // goToBank_D();//设置æç¹78 console.log("goToStore_B ä¸ä¸æ-end");//设置æç¹79}80goToStore_A();//设置æç¹81// goToStore_B();//设置æç¹82console.log("å
¨å±ä¸ä¸æ-end");//设置æç¹...
auth.js
Source:auth.js
...5exports.go = go;6var GO_AUTH_REQUEST = exports.GO_AUTH_REQUEST = 'auth/GO_AUTH_REQUEST';7var GO_AUTH_SUCCESS = exports.GO_AUTH_SUCCESS = 'auth/GO_AUTH_SUCCESS';8var GO_AUTH_ERROR = exports.GO_AUTH_ERROR = 'auth/GO_AUTH_ERROR';9function go(jwt) {10 return {11 types: [GO_AUTH_REQUEST, GO_AUTH_SUCCESS, GO_AUTH_ERROR],12 promise: function promise(client) {13 return client.get('/api/1.0/auth/' + jwt + '.json');14 }15 };...
Using AI Code Generation
1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org', 'A.12345678901234567890123456789012');3 if (err) {4 console.log(err);5 } else {6 console.log(data);7 }8});
Using AI Code Generation
1var wpt = require('webpagetest');2var wpt = new WebPageTest('www.webpagetest.org', 'A.1b2c3d4e5f6g7h8i9j0');3 if (err) return console.error(err);4 console.log('Test Results: %j', data);5});6var wpt = require('webpagetest');7var wpt = new WebPageTest('www.webpagetest.org', 'A.1b2c3d4e5f6g7h8i9j0');8 if (err) return console.error(err);9 console.log('Test Results: %j', data);10});11var wpt = require('webpagetest');12var wpt = new WebPageTest('www.webpagetest.org', 'A.1b2c3d4e5f6g7h8i9j0');13 if (err) return console.error(err);14 console.log('Test Results: %j', data);15});16var wpt = require('webpagetest');17var wpt = new WebPageTest('www.webpagetest.org', 'A.1b2c3d4e5f6g7h8i9j0');18 if (err) return console.error(err);19 console.log('Test Results: %j', data);20});21var wpt = require('webpagetest');22var wpt = new WebPageTest('www.webpagetest.org', 'A.1b2c3d4e5f6g7h8i9j0');23 if (err) return
Using AI Code Generation
1 if (err) {2 console.log(err);3 } else {4 console.log(data);5 }6});7 if (err) {8 console.log(err);9 } else {10 console.log(data);11 }12});13 if (err) {14 console.log(err);15 } else {16 console.log(data);17 }18});19 if (err) {20 console.log(err);21 } else {22 console.log(data);23 }24});25 if (err) {26 console.log(err);27 } else {28 console.log(data);29 }30});31 if (err) {32 console.log(err);33 } else {34 console.log(data);35 }36});37 if (err) {38 console.log(err);39 } else {40 console.log(data);41 }42});43 if (err) {44 console.log(err);45 } else {46 console.log(data);47 }48});49 if (err) {50 console.log(err);51 } else {
Using AI Code Generation
1var wpt = require('webpagetest');2var options = {3};4var test = new wpt('www.webpagetest.org', options);5 if (err) return console.error(err);6 console.log('Test status:', data.statusText);7 console.log('Test ID:', data.data.testId);8 test.getTestResults(data.data.testId, function(err, data) {9 if (err) return console.error(err);10 console.log('Test results:', data);11 });12});13Test results: { statusCode: 200,14 { testId: '161004_3E_3',15var wpt = require('webpagetest');16var options = {17};18var test = new wpt('www.webpagetest.org', options);19 if (err) return console.error(err);
Using AI Code Generation
1wpt.click('button');2page.click('button');3frame.click('button');4wpt.query('button');5page.query('button');6frame.query('button');7wpt.queryAll('button');8page.queryAll('button');9frame.queryAll('button');10wpt.waitFor('button');11page.waitFor('button');12frame.waitFor('button');13wpt.waitForFunction('button');14page.waitForFunction('button');15frame.waitForFunction('button');16wpt.waitForNavigation('button');17page.waitForNavigation('button');18frame.waitForNavigation('button');19wpt.type('button');20page.type('button');21frame.type('button');22wpt.fill('button');23page.fill('button');24frame.fill('button');
Using AI Code Generation
1var page = require('webpage').create();2page.open(url, function(status) {3 console.log('opened site? ', status);4 page.evaluate(function() {5 $('form').submit();6 });7 setTimeout(function() {8 page.render('google.png');9 phantom.exit();10 }, 200);11 });12});13I am trying to get the html content of a page which is loaded using the submit() method of a form. I am using the following code:14var page = require('webpage').create();15page.open(url, function(status) {16 console.log('opened site? ', status);17 page.evaluate(function() {18 $('form').submit();19 });20 setTimeout(function() {21 console.log(page.content);22 phantom.exit();23 }, 200);24 });25});26page.evaluate(function() {27 var form = document.getElementById('myform');28 form.submit();29});30page.evaluate(function() {31 var form = document.getElementById('myform');32 form.submit.click();33});34page.evaluate(function() {35 var form = document.getElementById('myform');36 form.submit();37});
Using AI Code Generation
1var wpt = require('webpagetest');2var options = {3};4var test = wpt('www.webpagetest.org', options);5 if (err) {6 console.log(err);7 } else {8 console.log(data);9 }10});11 if (err) {12 console.log(err);13 } else {14 console.log(data);15 }16});17 if (err) {18 console.log(err);19 } else {20 console.log(data);21 }22});23 if (err) {24 console.log(err);25 } else {26 console.log(data);27 }28});29 if (err) {30 console.log(err);31 } else {32 console.log(data);33 }34});35 if (err) {36 console.log(err);37 } else {38 console.log(data);39 }40});41 if (err) {42 console.log(err);43 } else {44 console.log(data);45 }46});47 if (err) {48 console.log(err);49 } else {50 console.log(data);51 }52});53 if (err) {54 console.log(err);55 } else {56 console.log(data);57 }58});59 if (err)
Using AI Code Generation
1var wpt = require('webpagetest');2var test = new wpt('API_KEY');3 console.log(data);4});5var wpt = require('webpagetest');6var test = new wpt('API_KEY');7 console.log(data);8});9var wpt = require('webpagetest');10var test = new wpt('API_KEY');11 console.log(data);12});13var wpt = require('webpagetest');14var test = new wpt('API_KEY');15 console.log(data);16});17var wpt = require('webpagetest');18var test = new wpt('API_KEY');19 console.log(data);20});21var wpt = require('webpagetest');22var test = new wpt('API_KEY');23 console.log(data);24});25var wpt = require('webpagetest');26var test = new wpt('API_KEY');
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!