1/**2 * Copyright (c) 2006-2014, JGraph Holdings Ltd3 */45//**********************************************************************************************************************************************************6//Wall7//**********************************************************************************************************************************************************8/**9* Extends mxShape.10*/11function mxFloorplanWall(bounds, fill, stroke, strokewidth)12{13 mxShape.call(this);14 this.bounds = bounds;15 this.fill = fill;16 this.stroke = stroke;17 this.strokewidth = (strokewidth != null) ? strokewidth : 1;18};1920/**21* Extends mxShape.22*/23mxUtils.extend(mxFloorplanWall, mxShape);2425mxFloorplanWall.prototype.cst = {26 WALL : 'mxgraph.floorplan.wall',27 WALL_THICKNESS : "wallThickness"28};2930mxFloorplanWall.prototype.customProperties = [31 {name:'wallThickness', dispName:'Thickness', type:'float', min:0, defVal:10}32];3334/**35* Function: paintVertexShape36* 37* Paints the vertex shape.38*/39mxFloorplanWall.prototype.paintVertexShape = function(c, x, y, w, h)40{41 c.translate(x, y);42 this.background(c, x, y, w, h);43};4445mxFloorplanWall.prototype.background = function(c, x, y, w, h)46{47 var wallTh = parseFloat(mxUtils.getValue(this.style, mxFloorplanWall.prototype.cst.WALL_THICKNESS, '10'));48 c.rect(0, h * 0.5 - wallTh * 0.5, w, wallTh);49 c.fillAndStroke();50};5152mxCellRenderer.registerShape(mxFloorplanWall.prototype.cst.WALL, mxFloorplanWall);5354//**********************************************************************************************************************************************************55//Wall Corner56//**********************************************************************************************************************************************************57/**58* Extends mxShape.59*/60function mxFloorplanWallCorner(bounds, fill, stroke, strokewidth)61{62 mxShape.call(this);63 this.bounds = bounds;64 this.fill = fill;65 this.stroke = stroke;66 this.strokewidth = (strokewidth != null) ? strokewidth : 1;67};6869/**70* Extends mxShape.71*/72mxUtils.extend(mxFloorplanWallCorner, mxShape);7374mxFloorplanWallCorner.prototype.cst = {75 WALL_CORNER : 'mxgraph.floorplan.wallCorner',76 WALL_THICKNESS : "wallThickness"77};7879mxFloorplanWallCorner.prototype.customProperties = [80 {name:'wallThickness', dispName:'Thickness', type:'float', min:0, defVal:10}81];8283/**84* Function: paintVertexShape85* 86* Paints the vertex shape.87*/88mxFloorplanWallCorner.prototype.paintVertexShape = function(c, x, y, w, h)89{90 c.translate(x, y);91 this.background(c, x, y, w, h);92};9394mxFloorplanWallCorner.prototype.background = function(c, x, y, w, h)95{96 var wallTh = parseFloat(mxUtils.getValue(this.style, mxFloorplanWallCorner.prototype.cst.WALL_THICKNESS, '10'));9798 c.begin();99 c.moveTo(0, h);100 c.lineTo(0, 0);101 c.lineTo(w, 0);102 c.lineTo(w, wallTh);103 c.lineTo(wallTh, wallTh);104 c.lineTo(wallTh, h);105 c.close();106 c.fillAndStroke();107};108109mxCellRenderer.registerShape(mxFloorplanWallCorner.prototype.cst.WALL_CORNER, mxFloorplanWallCorner);110111//**********************************************************************************************************************************************************112//Wall U113//**********************************************************************************************************************************************************114/**115* Extends mxShape.116*/117function mxFloorplanWallU(bounds, fill, stroke, strokewidth)118{119 mxShape.call(this);120 this.bounds = bounds;121 this.fill = fill;122 this.stroke = stroke;123 this.strokewidth = (strokewidth != null) ? strokewidth : 1;124};125126/**127* Extends mxShape.128*/129mxUtils.extend(mxFloorplanWallU, mxShape);130131mxFloorplanWallU.prototype.cst = {132 WALL_U : 'mxgraph.floorplan.wallU',133 WALL_THICKNESS : "wallThickness"134};135136mxFloorplanWallU.prototype.customProperties = [137 {name:'wallThickness', dispName:'Thickness', type:'float', min:0, defVal:10}138];139140/**141* Function: paintVertexShape142* 143* Paints the vertex shape.144*/145mxFloorplanWallU.prototype.paintVertexShape = function(c, x, y, w, h)146{147 c.translate(x, y);148 this.background(c, x, y, w, h);149};150151mxFloorplanWallU.prototype.background = function(c, x, y, w, h)152{153 var wallTh = parseFloat(mxUtils.getValue(this.style, mxFloorplanWallU.prototype.cst.WALL_THICKNESS, '10'));154155 c.begin();156 c.moveTo(0, h);157 c.lineTo(0, 0);158 c.lineTo(w, 0);159 c.lineTo(w, h);160 c.lineTo(w - wallTh, h);161 c.lineTo(w - wallTh, wallTh);162 c.lineTo(wallTh, wallTh);163 c.lineTo(wallTh, h);164 c.close();165 c.fillAndStroke();166};167168mxCellRenderer.registerShape(mxFloorplanWallU.prototype.cst.WALL_U, mxFloorplanWallU);169170//**********************************************************************************************************************************************************171//Room172//**********************************************************************************************************************************************************173/**174* Extends mxShape.175*/176function mxFloorplanRoom(bounds, fill, stroke, strokewidth)177{178 mxShape.call(this);179 this.bounds = bounds;180 this.fill = fill;181 this.stroke = stroke;182 this.strokewidth = (strokewidth != null) ? strokewidth : 1;183};184185/**186* Extends mxShape.187*/188mxUtils.extend(mxFloorplanRoom, mxShape);189190mxFloorplanRoom.prototype.cst = {191 ROOM : 'mxgraph.floorplan.room',192 WALL_THICKNESS : "wallThickness"193};194195mxFloorplanRoom.prototype.customProperties = [196 {name:'wallThickness', dispName:'Thickness', type:'float', min:0, defVal:10}197];198199/**200* Function: paintVertexShape201* 202* Paints the vertex shape.203*/204mxFloorplanRoom.prototype.paintVertexShape = function(c, x, y, w, h)205{206 c.translate(x, y);207 this.background(c, x, y, w, h);208};209210mxFloorplanRoom.prototype.background = function(c, x, y, w, h)211{212 var wallTh = parseFloat(mxUtils.getValue(this.style, mxFloorplanRoom.prototype.cst.WALL_THICKNESS, '10'));213214 c.begin();215 c.moveTo(0, h);216 c.lineTo(0, 0);217 c.lineTo(w, 0);218 c.lineTo(w, h);219 c.close();220 c.moveTo(wallTh, wallTh);221 c.lineTo(wallTh, h - wallTh);222 c.lineTo(w - wallTh, h - wallTh);223 c.lineTo(w - wallTh, wallTh);224 c.close();225 c.fillAndStroke();226};227228mxCellRenderer.registerShape(mxFloorplanRoom.prototype.cst.ROOM, mxFloorplanRoom);229230//**********************************************************************************************************************************************************231//Window232//**********************************************************************************************************************************************************233/**234* Extends mxShape.235*/236function mxFloorplanWindow(bounds, fill, stroke, strokewidth)237{238 mxShape.call(this);239 this.bounds = bounds;240 this.fill = fill;241 this.stroke = stroke;242 this.strokewidth = (strokewidth != null) ? strokewidth : 1;243};244245/**246* Extends mxShape.247*/248mxUtils.extend(mxFloorplanWindow, mxShape);249250mxFloorplanWindow.prototype.cst = {251 WINDOW : 'mxgraph.floorplan.window',252 WALL_THICKNESS : "wallThickness"253};254255mxFloorplanWindow.prototype.customProperties = [256 {name:'wallThickness', dispName:'Thickness', type:'float', min:0, defVal:10}257];258259/**260* Function: paintVertexShape261* 262* Paints the vertex shape.263*/264mxFloorplanWindow.prototype.paintVertexShape = function(c, x, y, w, h)265{266 c.translate(x, y);267 this.background(c, x, y, w, h);268};269270mxFloorplanWindow.prototype.background = function(c, x, y, w, h)271{272 var wallTh = parseFloat(mxUtils.getValue(this.style, mxFloorplanWindow.prototype.cst.WALL_THICKNESS, '10'));273 c.rect(0, h * 0.5 - wallTh * 0.5, w, wallTh);274 c.fillAndStroke();275 276 c.begin();277 c.moveTo(0, h * 0.5);278 c.lineTo(w, h * 0.5);279 c.stroke();280};281282mxCellRenderer.registerShape(mxFloorplanWindow.prototype.cst.WINDOW, mxFloorplanWindow);283284//**********************************************************************************************************************************************************285//Dimension286//**********************************************************************************************************************************************************287/**288* Extends mxShape.289*/290function mxFloorplanDimension(bounds, fill, stroke, strokewidth)291{292 mxShape.call(this);293 this.bounds = bounds;294 this.fill = fill;295 this.stroke = stroke;296 this.strokewidth = (strokewidth != null) ? strokewidth : 1;297};298299/**300* Extends mxShape.301*/302mxUtils.extend(mxFloorplanDimension, mxShape);303304mxFloorplanDimension.prototype.cst = {305 DIMENSION : 'mxgraph.floorplan.dimension'306};307308mxFloorplanDimension.prototype.customProperties = [309 {name:'wallThickness', dispName:'Thickness', type:'float', min:0, defVal:10}310];311312/**313* Function: paintVertexShape314* 315* Paints the vertex shape.316*/317mxFloorplanDimension.prototype.paintVertexShape = function(c, x, y, w, h)318{319 c.translate(x, y);320 this.background(c, x, y, w, h);321};322323mxFloorplanDimension.prototype.background = function(c, x, y, w, h)324{325 c.begin();326 c.moveTo(0, 20);327 c.lineTo(w, 20);328 c.moveTo(10, 15);329 c.lineTo(0, 20);330 c.lineTo(10, 25);331 c.moveTo(w - 10, 15);332 c.lineTo(w, 20);333 c.lineTo(w - 10, 25);334 c.moveTo(0, 15);335 c.lineTo(0, h);336 c.moveTo(w, 15);337 c.lineTo(w, h);338 c.stroke();339};340341mxCellRenderer.registerShape(mxFloorplanDimension.prototype.cst.DIMENSION, mxFloorplanDimension);342343//**********************************************************************************************************************************************************344//Dimension Bottom345//**********************************************************************************************************************************************************346/**347* Extends mxShape.348*/349function mxFloorplanDimensionBottom(bounds, fill, stroke, strokewidth)350{351 mxShape.call(this);352 this.bounds = bounds;353 this.fill = fill;354 this.stroke = stroke;355 this.strokewidth = (strokewidth != null) ? strokewidth : 1;356};357358/**359* Extends mxShape.360*/361mxUtils.extend(mxFloorplanDimensionBottom, mxShape);362363mxFloorplanDimensionBottom.prototype.cst = {364 DIMENSION : 'mxgraph.floorplan.dimensionBottom'365};366367/**368* Function: paintVertexShape369* 370* Paints the vertex shape.371*/372mxFloorplanDimensionBottom.prototype.paintVertexShape = function(c, x, y, w, h)373{374 c.translate(x, y);375 this.background(c, x, y, w, h);376};377378mxFloorplanDimensionBottom.prototype.background = function(c, x, y, w, h)379{380 c.begin();381 c.moveTo(0, h - 20);382 c.lineTo(w, h - 20);383 c.moveTo(10, h - 15);384 c.lineTo(0, h - 20);385 c.lineTo(10, h - 25);386 c.moveTo(w - 10, h - 15);387 c.lineTo(w, h - 20);388 c.lineTo(w - 10, h - 25);389 c.moveTo(0, h - 15);390 c.lineTo(0, 0);391 c.moveTo(w, h - 15);392 c.lineTo(w, 0);393 c.stroke();394};395396mxCellRenderer.registerShape(mxFloorplanDimensionBottom.prototype.cst.DIMENSION, mxFloorplanDimensionBottom);397398//**********************************************************************************************************************************************************399//Stairs400//**********************************************************************************************************************************************************401/**402* Extends mxShape.403*/404function mxFloorplanStairs(bounds, fill, stroke, strokewidth)405{406 mxShape.call(this);407 this.bounds = bounds;408 this.fill = fill;409 this.stroke = stroke;410 this.strokewidth = (strokewidth != null) ? strokewidth : 1;411};412413/**414* Extends mxShape.415*/416mxUtils.extend(mxFloorplanStairs, mxShape);417418mxFloorplanStairs.prototype.cst = {419 STAIRS : 'mxgraph.floorplan.stairs'420};421422/**423* Function: paintVertexShape424* 425* Paints the vertex shape.426*/427mxFloorplanStairs.prototype.paintVertexShape = function(c, x, y, w, h)428{429 c.translate(x, y);430 var minW = Math.max(w, 50);431 this.background(c, x, y, minW, h);432};433434mxFloorplanStairs.prototype.background = function(c, x, y, w, h)435{436 c.rect(0, 0, w, h);437 c.fillAndStroke();438 439 var step = 25;440 c.setShadow(false);441 442 c.begin();443 444 for (var i = 25; i < w; i = i + step)445 {446 c.moveTo(i, 0);447 c.lineTo(i, h);448 }449 450 c.stroke();451 452 c.begin();453 c.moveTo(0, h * 0.5);454 c.lineTo(w, h * 0.5);455 c.moveTo(w - step, 0);456 c.lineTo(w, h * 0.5);457 c.lineTo(w - step, h);458 c.stroke();459};460461mxCellRenderer.registerShape(mxFloorplanStairs.prototype.cst.STAIRS, mxFloorplanStairs);462463////**********************************************************************************************************************************************************464////Stairs Double465////**********************************************************************************************************************************************************466///**467//* Extends mxShape.468//*/469//function mxFloorplanStairsRest(bounds, fill, stroke, strokewidth)470//{471// mxShape.call(this);472// this.bounds = bounds;473// this.fill = fill;474// this.stroke = stroke;475// this.strokewidth = (strokewidth != null) ? strokewidth : 1;476//};477//478///**479//* Extends mxShape.480//*/481//mxUtils.extend(mxFloorplanStairsRest, mxShape);482//483//mxFloorplanStairsRest.prototype.cst = {484// STAIRS : 'mxgraph.floorplan.stairsRest'485//};486//487//488//489///**490//* Function: paintVertexShape491//* 492//* Paints the vertex shape.493//*/494//mxFloorplanStairsRest.prototype.paintVertexShape = function(c, x, y, w, h)495//{496// c.translate(x, y);497// var minW = Math.max(w, 50, h);498// var minH = Math.min(w, h);499// this.background(c, x, y, minW, h);500//};501//502//mxFloorplanStairsRest.prototype.background = function(c, x, y, w, h)503//{504// c.rect(0, 0, w, h);505// c.fillAndStroke();506// 507// var step = 25;508// c.setShadow(false);509// 510// c.begin();511// 512// for (var i = 25; i < w - h * 0.5; i = i + step)513// {514// c.moveTo(i, 0);515// c.lineTo(i, h);516// }517// 518// c.stroke();519// 520// c.begin();521// c.moveTo(0, h * 0.5);522// c.lineTo(w, h * 0.5);523// 524// c.moveTo(w, 0);525// c.lineTo(w - h * 0.5, h * 0.5);526// c.lineTo(w, h);527// 528// c.moveTo(w - h * 0.5, 0);529// c.lineTo(w - h * 0.5, h);530// 531// c.moveTo(0, h * 0.5);532// c.lineTo(w, h * 0.5);533// c.stroke();534//};535//536//mxCellRenderer.registerShape(mxFloorplanStairsRest.prototype.cst.STAIRS, mxFloorplanStairsRest);537538//**********************************************************************************************************************************************************539//Stairs540//**********************************************************************************************************************************************************541/**542* Extends mxShape.543*/544function mxFloorplanStairsRest(bounds, fill, stroke, strokewidth)545{546 mxShape.call(this);547 this.bounds = bounds;548 this.fill = fill;549 this.stroke = stroke;550 this.strokewidth = (strokewidth != null) ? strokewidth : 1;551};552553/**554* Extends mxShape.555*/556mxUtils.extend(mxFloorplanStairsRest, mxShape);557558mxFloorplanStairsRest.prototype.cst = {559 STAIRS : 'mxgraph.floorplan.stairsRest'560};561562/**563* Function: paintVertexShape564* 565* Paints the vertex shape.566*/567mxFloorplanStairsRest.prototype.paintVertexShape = function(c, x, y, w, h)568{569 c.translate(x, y);570 var minW = Math.max(w, 50, h);571 var minH = Math.min(w, h);572 this.background(c, x, y, minW, h);573};574575mxFloorplanStairsRest.prototype.background = function(c, x, y, w, h)576{577 c.rect(0, 0, w, h);578 c.fillAndStroke();579 580 var step = 25;581 c.setShadow(false);582 583 c.begin();584 585 for (var i = 25; i < w - h * 0.5; i = i + step)586 {587 c.moveTo(i, 0);588 c.lineTo(i, h);589 }590 591 c.stroke();592 593 c.begin();594 c.moveTo(0, h * 0.5);595 c.lineTo(w, h * 0.5);596 597 c.moveTo(w, 0);598 c.lineTo(w - h * 0.5, h * 0.5);599 c.lineTo(w, h);600 601 c.moveTo(w - h * 0.5, 0);602 c.lineTo(w - h * 0.5, h);603 604 c.moveTo(0, h * 0.5);605 c.lineTo(w, h * 0.5);606 c.stroke();607};608609mxCellRenderer.registerShape(mxFloorplanStairsRest.prototype.cst.STAIRS, mxFloorplanStairsRest);610611//**********************************************************************************************************************************************************612//Door, Left613//**********************************************************************************************************************************************************614/**615* Extends mxShape.616*/617function mxFloorplanDoorLeft(bounds, fill, stroke, strokewidth)618{619 mxShape.call(this);620 this.bounds = bounds;621 this.fill = fill;622 this.stroke = stroke;623 this.strokewidth = (strokewidth != null) ? strokewidth : 1;624};625626/**627* Extends mxShape.628*/629mxUtils.extend(mxFloorplanDoorLeft, mxShape);630631mxFloorplanDoorLeft.prototype.cst = {632 DOOR_LEFT : 'mxgraph.floorplan.doorLeft'633};634635/**636* Function: paintVertexShape637* 638* Paints the vertex shape.639*/640mxFloorplanDoorLeft.prototype.paintVertexShape = function(c, x, y, w, h)641{642 c.translate(x, y);643 this.background(c, x, y, w, h);644};645646mxFloorplanDoorLeft.prototype.background = function(c, x, y, w, h)647{648 c.rect(0, 0, w, 5);649 c.fillAndStroke();650 651 c.begin();652 c.moveTo(w, 5);653 c.arcTo(w, w, 0, 0, 1, 0, 5 + w);654 c.lineTo(0, 5);655 c.stroke();656};657658mxCellRenderer.registerShape(mxFloorplanDoorLeft.prototype.cst.DOOR_LEFT, mxFloorplanDoorLeft);659660//**********************************************************************************************************************************************************661//Door, Right662//**********************************************************************************************************************************************************663/**664* Extends mxShape.665*/666function mxFloorplanDoorRight(bounds, fill, stroke, strokewidth)667{668 mxShape.call(this);669 this.bounds = bounds;670 this.fill = fill;671 this.stroke = stroke;672 this.strokewidth = (strokewidth != null) ? strokewidth : 1;673};674675/**676* Extends mxShape.677*/678mxUtils.extend(mxFloorplanDoorRight, mxShape);679680mxFloorplanDoorRight.prototype.cst = {681 DOOR_RIGHT : 'mxgraph.floorplan.doorRight'682};683684/**685* Function: paintVertexShape686* 687* Paints the vertex shape.688*/689mxFloorplanDoorRight.prototype.paintVertexShape = function(c, x, y, w, h)690{691 c.translate(x, y);692 this.background(c, x, y, w, h);693};694695mxFloorplanDoorRight.prototype.background = function(c, x, y, w, h)696{697 c.rect(0, 0, w, 5);698 c.fillAndStroke();699 700 c.begin();701 c.moveTo(0, 5);702 c.arcTo(w, w, 0, 0, 0, w, 5 + w);703 c.lineTo(w, 5);704 c.stroke();705};706707mxCellRenderer.registerShape(mxFloorplanDoorRight.prototype.cst.DOOR_RIGHT, mxFloorplanDoorRight);708709//**********************************************************************************************************************************************************710//Door, Double711//**********************************************************************************************************************************************************712/**713* Extends mxShape.714*/715function mxFloorplanDoorDouble(bounds, fill, stroke, strokewidth)716{717 mxShape.call(this);718 this.bounds = bounds;719 this.fill = fill;720 this.stroke = stroke;721 this.strokewidth = (strokewidth != null) ? strokewidth : 1;722};723724/**725* Extends mxShape.726*/727mxUtils.extend(mxFloorplanDoorDouble, mxShape);728729mxFloorplanDoorDouble.prototype.cst = {730 DOOR_DOUBLE : 'mxgraph.floorplan.doorDouble'731};732733/**734* Function: paintVertexShape735* 736* Paints the vertex shape.737*/738mxFloorplanDoorDouble.prototype.paintVertexShape = function(c, x, y, w, h)739{740 c.translate(x, y);741 this.background(c, x, y, w, h);742};743744mxFloorplanDoorDouble.prototype.background = function(c, x, y, w, h)745{746 var halfW = w * 0.5; 747 c.rect(0, 0, w, 5);748 c.fillAndStroke();749 750 c.begin();751 c.moveTo(halfW, 0);752 c.lineTo(halfW, 5);753 c.moveTo(halfW, 5);754 c.arcTo(halfW, halfW, 0, 0, 1, 0, 5 + halfW);755 c.lineTo(0, 5);756 c.moveTo(halfW, 5);757 c.arcTo(halfW, halfW, 0, 0, 0, w, 5 + halfW);758 c.lineTo(w, 5);759 c.stroke();760};761762mxCellRenderer.registerShape(mxFloorplanDoorDouble.prototype.cst.DOOR_DOUBLE, mxFloorplanDoorDouble);763764//**********************************************************************************************************************************************************765//Door, Uneven766//**********************************************************************************************************************************************************767/**768* Extends mxShape.769*/770function mxFloorplanDoorUneven(bounds, fill, stroke, strokewidth)771{772 mxShape.call(this);773 this.bounds = bounds;774 this.fill = fill;775 this.stroke = stroke;776 this.strokewidth = (strokewidth != null) ? strokewidth : 1;777 this.dx = 0.3;778};779780/**781* Extends mxShape.782*/783mxUtils.extend(mxFloorplanDoorUneven, mxShape);784785mxFloorplanDoorUneven.prototype.customProperties = [786 {name: 'dx', dispName: 'Door size', type: 'float', min:0, max:1, defVal:0.3}787];788789mxFloorplanDoorUneven.prototype.cst = {790 DOOR_UNEVEN : 'mxgraph.floorplan.doorUneven'791};792793/**794* Function: paintVertexShape795* 796* Paints the vertex shape.797*/798mxFloorplanDoorUneven.prototype.paintVertexShape = function(c, x, y, w, h)799{800 c.translate(x, y);801 this.background(c, x, y, w, h);802};803804mxFloorplanDoorUneven.prototype.background = function(c, x, y, w, h)805{806 var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));807 808 c.rect(0, 0, w, 5);809 c.fillAndStroke();810 811 c.begin();812 c.moveTo(dx, 0);813 c.lineTo(dx, 5);814 c.arcTo(dx, dx, 0, 0, 1, 0, 5 + dx);815 c.lineTo(0, 5);816 c.moveTo(dx, 5);817 c.arcTo(w - dx, w - dx, 0, 0, 0, w, 5 + w - dx);818 c.lineTo(w, 5);819 c.stroke();820};821822mxCellRenderer.registerShape(mxFloorplanDoorUneven.prototype.cst.DOOR_UNEVEN, mxFloorplanDoorUneven);823824Graph.handleFactory[mxFloorplanDoorUneven.prototype.cst.DOOR_UNEVEN] = function(state)825{826 var handles = [Graph.createHandle(state, ['dx'], function(bounds)827 {828 var dx = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));829830 return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 5);831 }, function(bounds, pt)832 {833 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;834 })];835836 return handles;837}838839//**********************************************************************************************************************************************************840//Door, Opposing841//**********************************************************************************************************************************************************842/**843* Extends mxShape.844*/845function mxFloorplanDoorOpposing(bounds, fill, stroke, strokewidth)846{847 mxShape.call(this);848 this.bounds = bounds;849 this.fill = fill;850 this.stroke = stroke;851 this.strokewidth = (strokewidth != null) ? strokewidth : 1;852 this.dx = 0.3;853};854855/**856* Extends mxShape.857*/858mxUtils.extend(mxFloorplanDoorOpposing, mxShape);859860mxFloorplanDoorOpposing.prototype.customProperties = [861 {name: 'dx', dispName: 'Door size', type: 'float', min:0, max:1, defVal:0.3}862];863864mxFloorplanDoorOpposing.prototype.cst = {865 DOOR_OPPOSING : 'mxgraph.floorplan.doorOpposing'866};867868/**869* Function: paintVertexShape870* 871* Paints the vertex shape.872*/873mxFloorplanDoorOpposing.prototype.paintVertexShape = function(c, x, y, w, h)874{875 c.translate(x, y);876 this.background(c, x, y, w, h);877};878879mxFloorplanDoorOpposing.prototype.background = function(c, x, y, w, h)880{881 var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));882 883 c.rect(0, dx, w, 5);884 c.fillAndStroke();885 886 c.begin();887 c.moveTo(dx, dx);888 c.lineTo(dx, dx + 5);889 c.arcTo(dx, dx, 0, 0, 0, 0, 0);890 c.lineTo(0, dx);891 c.moveTo(dx, dx + 5);892 c.arcTo(w - dx, w - dx, 0, 0, 0, w, 5 + w);893 c.lineTo(w, dx + 5);894 c.stroke();895};896897mxCellRenderer.registerShape(mxFloorplanDoorOpposing.prototype.cst.DOOR_OPPOSING, mxFloorplanDoorOpposing);898899Graph.handleFactory[mxFloorplanDoorOpposing.prototype.cst.DOOR_OPPOSING] = function(state)900{901 var handles = [Graph.createHandle(state, ['dx'], function(bounds)902 {903 var dx = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));904905 return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 5);906 }, function(bounds, pt)907 {908 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;909 })];910911 return handles;912}913914//**********************************************************************************************************************************************************915//Door, Revolving916//**********************************************************************************************************************************************************917/**918* Extends mxShape.919*/920function mxFloorplanDoorRevolving(bounds, fill, stroke, strokewidth)921{922 mxShape.call(this);923 this.bounds = bounds;924 this.fill = fill;925 this.stroke = stroke;926 this.strokewidth = (strokewidth != null) ? strokewidth : 1;927};928929/**930* Extends mxShape.931*/932mxUtils.extend(mxFloorplanDoorRevolving, mxShape);933934mxFloorplanDoorRevolving.prototype.cst = {935 DOOR_REVOLVING : 'mxgraph.floorplan.doorRevolving'936};937938/**939* Function: paintVertexShape940* 941* Paints the vertex shape.942*/943mxFloorplanDoorRevolving.prototype.paintVertexShape = function(c, x, y, w, h)944{945 c.translate(x, y);946 this.background(c, x, y, w, h);947};948949mxFloorplanDoorRevolving.prototype.background = function(c, x, y, w, h)950{951 var d = Math.min(w, h);952 c.rect((w - d) * 0.5 , h * 0.5 - 2.5, d, 5);953 c.fillAndStroke();954955 c.rect(w * 0.5 - 2.5, (h - d) * 0.5, 5, d);956 c.fillAndStroke();957 958 c.begin();959 c.ellipse((w - d) * 0.5, (h - d) * 0.5, d, d);960 c.stroke();961};962963mxCellRenderer.registerShape(mxFloorplanDoorRevolving.prototype.cst.DOOR_REVOLVING, mxFloorplanDoorRevolving);964965//**********************************************************************************************************************************************************966//Door, Pocket967//**********************************************************************************************************************************************************968/**969* Extends mxShape.970*/971function mxFloorplanDoorPocket(bounds, fill, stroke, strokewidth)972{973 mxShape.call(this);974 this.bounds = bounds;975 this.fill = fill;976 this.stroke = stroke;977 this.strokewidth = (strokewidth != null) ? strokewidth : 1;978 this.dx = 0.5;979};980981/**982* Extends mxShape.983*/984mxUtils.extend(mxFloorplanDoorPocket, mxShape);985986mxFloorplanDoorPocket.prototype.customProperties = [987 {name: 'dx', dispName: 'Door size', type: 'float', min:0, max:1, defVal:0.3}988];989990mxFloorplanDoorPocket.prototype.cst = {991 DOOR_POCKET : 'mxgraph.floorplan.doorPocket'992};993994/**995* Function: paintVertexShape996* 997* Paints the vertex shape.998*/999mxFloorplanDoorPocket.prototype.paintVertexShape = function(c, x, y, w, h)1000{1001 var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));1002 1003 c.translate(x, y);10041005 c.rect(dx, h * 0.5 - 5, 5, 10);1006 c.fillAndStroke();10071008 c.rect(w - 5, h * 0.5 - 5, 5, 10);1009 c.fillAndStroke();1010 1011 c.rect(0, h * 0.5 - 2.5, w - dx, 5);1012 c.fillAndStroke();1013};10141015mxCellRenderer.registerShape(mxFloorplanDoorPocket.prototype.cst.DOOR_POCKET, mxFloorplanDoorPocket);10161017Graph.handleFactory[mxFloorplanDoorPocket.prototype.cst.DOOR_POCKET] = function(state)1018{1019 var handles = [Graph.createHandle(state, ['dx'], function(bounds)1020 {1021 var dx = Math.max(0, Math.min(0.5, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));10221023 return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 5);1024 }, function(bounds, pt)1025 {1026 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(0.5, (pt.x - bounds.x) / bounds.width))) / 100;1027 })];10281029 return handles;1030}10311032//**********************************************************************************************************************************************************1033//Door, Double Pocket1034//**********************************************************************************************************************************************************1035/**1036* Extends mxShape.1037*/1038function mxFloorplanDoorDoublePocket(bounds, fill, stroke, strokewidth)1039{1040 mxShape.call(this);1041 this.bounds = bounds;1042 this.fill = fill;1043 this.stroke = stroke;1044 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1045 this.dx = 0.5;1046};10471048/**1049* Extends mxShape.1050*/1051mxUtils.extend(mxFloorplanDoorDoublePocket, mxShape);10521053mxFloorplanDoorDoublePocket.prototype.customProperties = [1054 {name: 'dx', dispName: 'Door size', type: 'float', min:0, max:1, defVal:0.3}1055];10561057mxFloorplanDoorDoublePocket.prototype.cst = {1058 DOOR_DOUBLE_POCKET : 'mxgraph.floorplan.doorDoublePocket'1059};10601061/**1062* Function: paintVertexShape1063* 1064* Paints the vertex shape.1065*/1066mxFloorplanDoorDoublePocket.prototype.paintVertexShape = function(c, x, y, w, h)1067{1068 var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));1069 1070 c.translate(x, y);10711072 c.rect(dx, h * 0.5 - 5, 5, 10);1073 c.fillAndStroke();10741075 c.rect(w - dx - 5, h * 0.5 - 5, 5, 10);1076 c.fillAndStroke();1077 1078 c.rect(0, h * 0.5 - 2.5, w * 0.5 - dx, 5);1079 c.fillAndStroke();1080 1081 c.rect(w * 0.5 + dx, h * 0.5 - 2.5, w * 0.5 - dx, 5);1082 c.fillAndStroke();1083};10841085mxCellRenderer.registerShape(mxFloorplanDoorDoublePocket.prototype.cst.DOOR_DOUBLE_POCKET, mxFloorplanDoorDoublePocket);10861087Graph.handleFactory[mxFloorplanDoorDoublePocket.prototype.cst.DOOR_DOUBLE_POCKET] = function(state)1088{1089 var handles = [Graph.createHandle(state, ['dx'], function(bounds)1090 {1091 var dx = Math.max(0, Math.min(0.25, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));10921093 return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 5);1094 }, function(bounds, pt)1095 {1096 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(0.25, (pt.x - bounds.x) / bounds.width))) / 100;1097 })];10981099 return handles;1100}11011102//**********************************************************************************************************************************************************1103//Door, By-Pass1104//**********************************************************************************************************************************************************1105/**1106* Extends mxShape.1107*/1108function mxFloorplanDoorBypass(bounds, fill, stroke, strokewidth)1109{1110 mxShape.call(this);1111 this.bounds = bounds;1112 this.fill = fill;1113 this.stroke = stroke;1114 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1115 this.dx = 0.5;1116};11171118/**1119* Extends mxShape.1120*/1121mxUtils.extend(mxFloorplanDoorBypass, mxShape);11221123mxFloorplanDoorBypass.prototype.customProperties = [1124 {name: 'dx', dispName: 'Door size', type: 'float', min:0, max:1, defVal:0.3}1125];11261127mxFloorplanDoorBypass.prototype.cst = {1128 DOOR_BYPASS : 'mxgraph.floorplan.doorBypass'1129};11301131/**1132* Function: paintVertexShape1133* 1134* Paints the vertex shape.1135*/1136mxFloorplanDoorBypass.prototype.paintVertexShape = function(c, x, y, w, h)1137{1138 var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));1139 1140 c.translate(x, y);11411142 c.rect(0, h * 0.5 - 5, 5, 10);1143 c.fillAndStroke();11441145 c.rect(w - 5, h * 0.5 - 5, 5, 10);1146 c.fillAndStroke();1147 1148 c.rect(0, h * 0.5, w * 0.5, 5);1149 c.fillAndStroke();11501151 c.rect(dx, h * 0.5 - 5, w * 0.5, 5);1152 c.fillAndStroke();1153};11541155mxCellRenderer.registerShape(mxFloorplanDoorBypass.prototype.cst.DOOR_BYPASS, mxFloorplanDoorBypass);11561157Graph.handleFactory[mxFloorplanDoorBypass.prototype.cst.DOOR_BYPASS] = function(state)1158{1159 var handles = [Graph.createHandle(state, ['dx'], function(bounds)1160 {1161 var dx = Math.max(0, Math.min(0.5, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));11621163 return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 5);1164 }, function(bounds, pt)1165 {1166 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(0.5, (pt.x - bounds.x) / bounds.width))) / 100;1167 })];11681169 return handles;1170}11711172//**********************************************************************************************************************************************************1173//Door, Bi-fold1174//**********************************************************************************************************************************************************1175/**1176* Extends mxShape.1177*/1178function mxFloorplanDoorBifold(bounds, fill, stroke, strokewidth)1179{1180 mxShape.call(this);1181 this.bounds = bounds;1182 this.fill = fill;1183 this.stroke = stroke;1184 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1185 this.dx = 0.5;1186};11871188/**1189* Extends mxShape.1190*/1191mxUtils.extend(mxFloorplanDoorBifold, mxShape);11921193mxFloorplanDoorBifold.prototype.customProperties = [1194 {name: 'dx', dispName: 'Door size', type: 'float', min:0, max:1, defVal:0.3}1195];11961197mxFloorplanDoorBifold.prototype.cst = {1198 DOOR_BIFOLD : 'mxgraph.floorplan.doorBifold'1199};12001201/**1202* Function: paintVertexShape1203* 1204* Paints the vertex shape.1205*/1206mxFloorplanDoorBifold.prototype.paintVertexShape = function(c, x, y, w, h)1207{1208 var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));1209 var strokeWidth = parseFloat(mxUtils.getValue(this.style, 'strokeWidth', this.dx));1210 1211 c.translate(x, y);12121213 c.rect(0, h - 10, 5, 10);1214 c.fillAndStroke();12151216 c.rect(w - 5, h - 10, 5, 10);1217 c.fillAndStroke();1218 1219 c.setStrokeWidth(strokeWidth * 3);1220 1221 c.begin();1222 c.moveTo(5, h - 10);1223 c.lineTo(Math.max((dx - 10) * 0.5 + 5, 5), 0);1224 c.lineTo(Math.max(dx, 5), h - 10);1225 c.moveTo(w - 5, h - 10);1226 c.lineTo(w - Math.max((dx - 10) * 0.5 + 5, 5), 0);1227 c.lineTo(w - Math.max(dx, 5), h - 10);1228 c.stroke();1229};12301231mxCellRenderer.registerShape(mxFloorplanDoorBifold.prototype.cst.DOOR_BIFOLD, mxFloorplanDoorBifold);12321233Graph.handleFactory[mxFloorplanDoorBifold.prototype.cst.DOOR_BIFOLD] = function(state)1234{1235 var handles = [Graph.createHandle(state, ['dx'], function(bounds)1236 {1237 var dx = Math.max(0, Math.min(0.5, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));12381239 return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 5);1240 }, function(bounds, pt)1241 {1242 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(0.5, (pt.x - bounds.x) / bounds.width))) / 100;1243 })];12441245 return handles;1246}12471248//**********************************************************************************************************************************************************1249//Door, Sliding Glass1250//**********************************************************************************************************************************************************1251/**1252* Extends mxShape.1253*/1254function mxFloorplanDoorSlidingGlass(bounds, fill, stroke, strokewidth)1255{1256 mxShape.call(this);1257 this.bounds = bounds;1258 this.fill = fill;1259 this.stroke = stroke;1260 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1261 this.dx = 0.5;1262};12631264/**1265* Extends mxShape.1266*/1267mxUtils.extend(mxFloorplanDoorSlidingGlass, mxShape);12681269mxFloorplanDoorSlidingGlass.prototype.customProperties = [1270 {name: 'dx', dispName: 'Door size', type: 'float', min:0, max:1, defVal:0.3}1271];12721273mxFloorplanDoorSlidingGlass.prototype.cst = {1274 DOOR_SLIDING_GLASS : 'mxgraph.floorplan.doorSlidingGlass'1275};12761277/**1278* Function: paintVertexShape1279* 1280* Paints the vertex shape.1281*/1282mxFloorplanDoorSlidingGlass.prototype.paintVertexShape = function(c, x, y, w, h)1283{1284 var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));1285 1286 c.translate(x, y);12871288 c.rect(0, h * 0.5 - 5, 5, 10);1289 c.fillAndStroke();12901291 c.rect(w - 5, h * 0.5 - 5, 5, 10);1292 c.fillAndStroke();1293 1294 c.rect(0, h * 0.5, w * 0.5, 2);1295 c.fillAndStroke();12961297 c.rect(dx, h * 0.5 - 2, w * 0.5, 2);1298 c.fillAndStroke();1299};13001301mxCellRenderer.registerShape(mxFloorplanDoorSlidingGlass.prototype.cst.DOOR_SLIDING_GLASS, mxFloorplanDoorSlidingGlass);13021303Graph.handleFactory[mxFloorplanDoorSlidingGlass.prototype.cst.DOOR_SLIDING_GLASS] = function(state)1304{1305 var handles = [Graph.createHandle(state, ['dx'], function(bounds)1306 {1307 var dx = Math.max(0, Math.min(0.5, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));13081309 return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 5);1310 }, function(bounds, pt)1311 {1312 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(0.5, (pt.x - bounds.x) / bounds.width))) / 100;1313 })];13141315 return handles;1316}13171318//**********************************************************************************************************************************************************1319//Door, Overhead1320//**********************************************************************************************************************************************************1321/**1322* Extends mxShape.1323*/1324function mxFloorplanOverhead(bounds, fill, stroke, strokewidth)1325{1326 mxShape.call(this);1327 this.bounds = bounds;1328 this.fill = fill;1329 this.stroke = stroke;1330 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1331 this.dx = 0.5;1332};13331334/**1335* Extends mxShape.1336*/1337mxUtils.extend(mxFloorplanOverhead, mxShape);13381339mxFloorplanOverhead.prototype.cst = {1340 DOOR_OVERHEAD : 'mxgraph.floorplan.doorOverhead'1341};13421343/**1344* Function: paintVertexShape1345* 1346* Paints the vertex shape.1347*/1348mxFloorplanOverhead.prototype.paintVertexShape = function(c, x, y, w, h)1349{1350 c.translate(x, y);13511352 c.rect(0, h - 10, 5, 10);1353 c.fillAndStroke();13541355 c.rect(w - 5, h - 10, 5, 10);1356 c.fillAndStroke();1357 1358 c.rect(5, 0, w - 10, h - 5);1359 c.fillAndStroke();13601361};13621363mxCellRenderer.registerShape(mxFloorplanOverhead.prototype.cst.DOOR_OVERHEAD, mxFloorplanOverhead);13641365//**********************************************************************************************************************************************************1366//Opening1367//**********************************************************************************************************************************************************1368/**1369* Extends mxShape.1370*/1371function mxFloorplanOpening(bounds, fill, stroke, strokewidth)1372{1373 mxShape.call(this);1374 this.bounds = bounds;1375 this.fill = fill;1376 this.stroke = stroke;1377 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1378 this.dx = 0.5;1379};13801381/**1382* Extends mxShape.1383*/1384mxUtils.extend(mxFloorplanOpening, mxShape);13851386mxFloorplanOpening.prototype.cst = {1387 OPENING : 'mxgraph.floorplan.opening'1388};13891390/**1391* Function: paintVertexShape1392* 1393* Paints the vertex shape.1394*/1395mxFloorplanOpening.prototype.paintVertexShape = function(c, x, y, w, h)1396{1397 c.translate(x, y);13981399 c.rect(0, 0, 5, h);1400 c.fillAndStroke();14011402 c.rect(w - 5, 0, 5, h);1403 c.fillAndStroke();1404 1405};14061407mxCellRenderer.registerShape(mxFloorplanOpening.prototype.cst.OPENING, mxFloorplanOpening);14081409//**********************************************************************************************************************************************************1410//Window, Glider1411//**********************************************************************************************************************************************************1412/**1413* Extends mxShape.1414*/1415function mxFloorplanWindowGlider(bounds, fill, stroke, strokewidth)1416{1417 mxShape.call(this);1418 this.bounds = bounds;1419 this.fill = fill;1420 this.stroke = stroke;1421 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1422 this.dx = 0.5;1423};14241425/**1426* Extends mxShape.1427*/1428mxUtils.extend(mxFloorplanWindowGlider, mxShape);14291430mxFloorplanWindowGlider.prototype.customProperties = [1431 {name: 'dx', dispName: 'Window size', type: 'float', min:0, max:1, defVal:0.3}1432];14331434mxFloorplanWindowGlider.prototype.cst = {1435 WINDOW_GLIDER : 'mxgraph.floorplan.windowGlider'1436};14371438/**1439* Function: paintVertexShape1440* 1441* Paints the vertex shape.1442*/1443mxFloorplanWindowGlider.prototype.paintVertexShape = function(c, x, y, w, h)1444{1445 var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));1446 1447 c.translate(x, y);14481449 c.rect(0, h * 0.5 - 5, w, 10);1450 c.fillAndStroke();14511452 c.rect(0, h * 0.5, w * 0.5, 1);1453 c.fillAndStroke();14541455 c.rect(dx, h * 0.5 - 1, w * 0.5, 1);1456 c.fillAndStroke();1457};14581459mxCellRenderer.registerShape(mxFloorplanWindowGlider.prototype.cst.WINDOW_GLIDER, mxFloorplanWindowGlider);14601461Graph.handleFactory[mxFloorplanWindowGlider.prototype.cst.WINDOW_GLIDER] = function(state)1462{1463 var handles = [Graph.createHandle(state, ['dx'], function(bounds)1464 {1465 var dx = Math.max(0, Math.min(0.5, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));14661467 return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 5);1468 }, function(bounds, pt)1469 {1470 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(0.5, (pt.x - bounds.x) / bounds.width))) / 100;1471 })];14721473 return handles;1474}14751476//**********************************************************************************************************************************************************1477//Window, Garden1478//**********************************************************************************************************************************************************1479/**1480* Extends mxShape.1481*/1482function mxFloorplanWindowGarden(bounds, fill, stroke, strokewidth)1483{1484 mxShape.call(this);1485 this.bounds = bounds;1486 this.fill = fill;1487 this.stroke = stroke;1488 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1489 this.windowPanes = 3;1490};14911492/**1493* Extends mxShape.1494*/1495mxUtils.extend(mxFloorplanWindowGarden, mxShape);14961497mxFloorplanWindowGarden.prototype.customProperties = [1498 {name: 'windowPanes', dispName: 'Panes', type: 'int', min:0, max:20, defVal:3}1499];15001501mxFloorplanWindowGarden.prototype.cst = {1502 WINDOW_GARDEN : 'mxgraph.floorplan.windowGarden'1503};15041505/**1506* Function: paintVertexShape1507* 1508* Paints the vertex shape.1509*/1510mxFloorplanWindowGarden.prototype.paintVertexShape = function(c, x, y, w, h)1511{1512 var windowPanes = Math.min(mxUtils.getValue(this.style, 'windowPanes', this.windowPanes), 20);1513 1514 var d = 2;1515 var paneW = (w - 14 - (windowPanes - 1) * d) / windowPanes;1516 c.translate(x, y);15171518 c.rect(0, h - 10, 5, 10);1519 c.fillAndStroke();1520 c.rect(w - 5, h - 10, 5, 10);1521 c.fillAndStroke();15221523 c.begin();1524 c.moveTo(5, h);1525 c.lineTo(5, 0);1526 c.lineTo(w - 5, 0);1527 c.lineTo(w - 5, h);1528 c.lineTo(w - 5 - d, h);1529 c.lineTo(w - 5 - d, d);1530 1531 for (var i = 1; i < windowPanes; i++)1532 {1533 c.lineTo(w - 5 - d - i * paneW - (i - 1) * d, d);1534 c.lineTo(w - 5 - d - i * paneW - (i - 1) * d, h);1535 c.lineTo(w - 5 - 2 * d - (i - 1) * d - i * paneW, h);1536 c.lineTo(w - 5 - 2 * d - (i - 1) * d - i * paneW, d);1537 }1538 1539 c.lineTo(5 + d, d);1540 c.lineTo(5 + d, h);1541 c.close();1542 c.fillAndStroke();1543};15441545mxCellRenderer.registerShape(mxFloorplanWindowGarden.prototype.cst.WINDOW_GARDEN, mxFloorplanWindowGarden);15461547//**********************************************************************************************************************************************************1548//Window, Bow1549//**********************************************************************************************************************************************************1550/**1551* Extends mxShape.1552*/1553function mxFloorplanWindowBow(bounds, fill, stroke, strokewidth)1554{1555 mxShape.call(this);1556 this.bounds = bounds;1557 this.fill = fill;1558 this.stroke = stroke;1559 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1560 this.windowPanes = 3;1561};15621563/**1564* Extends mxShape.1565*/1566mxUtils.extend(mxFloorplanWindowBow, mxShape);15671568mxFloorplanWindowBow.prototype.cst = {1569 WINDOW_BOW : 'mxgraph.floorplan.windowBow'1570};15711572/**1573* Function: paintVertexShape1574* 1575* Paints the vertex shape.1576*/1577mxFloorplanWindowBow.prototype.paintVertexShape = function(c, x, y, w, h)1578{1579 c.translate(x, y);15801581 var d = Math.min(w * 0.5, h);1582 1583 c.begin();1584 c.moveTo(0, (h - d) * 0.5);1585 c.lineTo(d, (h + d) * 0.5);1586 c.lineTo(w - d, (h + d) * 0.5);1587 c.lineTo(w, (h - d) * 0.5);1588 c.stroke();1589};15901591mxCellRenderer.registerShape(mxFloorplanWindowBow.prototype.cst.WINDOW_BOW, mxFloorplanWindowBow);15921593//**********************************************************************************************************************************************************1594//Window, Bay1595//**********************************************************************************************************************************************************1596/**1597* Extends mxShape.1598*/1599function mxFloorplanWindowBay(bounds, fill, stroke, strokewidth)1600{1601 mxShape.call(this);1602 this.bounds = bounds;1603 this.fill = fill;1604 this.stroke = stroke;1605 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1606 this.windowPanes = 3;1607};16081609/**1610* Extends mxShape.1611*/1612mxUtils.extend(mxFloorplanWindowBay, mxShape);16131614mxFloorplanWindowBay.prototype.cst = {1615 WINDOW_BAY : 'mxgraph.floorplan.windowBay'1616};16171618/**1619* Function: paintVertexShape1620* 1621* Paints the vertex shape.1622*/1623mxFloorplanWindowBay.prototype.paintVertexShape = function(c, x, y, w, h)1624{1625 c.translate(x, y);16261627 var d = Math.min(w * 0.5, h);1628 1629 c.begin();1630 c.moveTo(0, 0);1631 c.lineTo(w * 0.15, h * 0.6);1632 c.lineTo(w * 0.35, h);1633 c.lineTo(w * 0.65, h);1634 c.lineTo(w * 0.85, h * 0.6);1635 c.lineTo(w, 0);1636 c.stroke();1637};16381639mxCellRenderer.registerShape(mxFloorplanWindowBay.prototype.cst.WINDOW_BAY, mxFloorplanWindowBay);16401641//**********************************************************************************************************************************************************1642//Door, Accordion1643//**********************************************************************************************************************************************************1644/**1645* Extends mxShape.1646*/1647function mxFloorplanDoorAccordion(bounds, fill, stroke, strokewidth)1648{1649 mxShape.call(this);1650 this.bounds = bounds;1651 this.fill = fill;1652 this.stroke = stroke;1653 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1654 this.dx = 0.5;1655};16561657/**1658* Extends mxShape.1659*/1660mxUtils.extend(mxFloorplanDoorAccordion, mxShape);16611662mxFloorplanDoorAccordion.prototype.customProperties = [1663 {name: 'dx', dispName: 'Door size', type: 'float', min:0, max:1, defVal:0.3}1664];16651666mxFloorplanDoorAccordion.prototype.cst = {1667 DOOR_ACCORDION : 'mxgraph.floorplan.doorAccordion'1668};16691670/**1671* Function: paintVertexShape1672* 1673* Paints the vertex shape.1674*/1675mxFloorplanDoorAccordion.prototype.paintVertexShape = function(c, x, y, w, h)1676{1677 var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));1678 var dx = Math.max(5, dx);1679 var dx = Math.min(w - 5, dx);1680 1681 var strokeWidth = parseFloat(mxUtils.getValue(this.style, 'strokeWidth', this.dx));1682 1683 c.translate(x, y);16841685 c.rect(0, h * 0.5 - 5, 5, 10);1686 c.fillAndStroke();16871688 c.rect(w - 5, h * 0.5 - 5, 5, 10);1689 c.fillAndStroke();1690 1691 c.setStrokeWidth(strokeWidth * 3);1692 1693 var l = dx - 5;1694 1695 c.begin();1696 c.moveTo(5, h * 0.5);1697 c.lineTo(5 + l * 0.1, 0);1698 c.lineTo(5 + l * 0.3, h);1699 c.lineTo(5 + l * 0.5, 0);1700 c.lineTo(5 + l * 0.7, h);1701 c.lineTo(5 + l * 0.9, 0);1702 c.lineTo(5 + l, h * 0.5);1703 c.stroke();1704};17051706mxCellRenderer.registerShape(mxFloorplanDoorAccordion.prototype.cst.DOOR_ACCORDION, mxFloorplanDoorAccordion);17071708Graph.handleFactory[mxFloorplanDoorAccordion.prototype.cst.DOOR_ACCORDION] = function(state)1709{1710 var handles = [Graph.createHandle(state, ['dx'], function(bounds)1711 {1712 var dx = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));17131714 return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 5);1715 }, function(bounds, pt)1716 {1717 this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;1718 })];17191720 return handles;1721}17221723//**********************************************************************************************************************************************************1724//Door, Double-action1725//**********************************************************************************************************************************************************1726/**1727* Extends mxShape.1728*/1729function mxFloorplanDoorDoubleAction(bounds, fill, stroke, strokewidth)1730{1731 mxShape.call(this);1732 this.bounds = bounds;1733 this.fill = fill;1734 this.stroke = stroke;1735 this.strokewidth = (strokewidth != null) ? strokewidth : 1;1736};17371738/**1739* Extends mxShape.1740*/1741mxUtils.extend(mxFloorplanDoorDoubleAction, mxShape);17421743mxFloorplanDoorDoubleAction.prototype.cst = {1744 DOOR_DOUBLE_ACTION : 'mxgraph.floorplan.doorDoubleAction'1745};17461747/**1748* Function: paintVertexShape1749* 1750* Paints the vertex shape.1751*/1752mxFloorplanDoorDoubleAction.prototype.paintVertexShape = function(c, x, y, w, h)1753{1754 c.translate(x, y);1755 this.background(c, x, y, w, h);1756};17571758mxFloorplanDoorDoubleAction.prototype.background = function(c, x, y, w, h)1759{1760 c.rect(0, h * 0.5 - 2.5, w, 5);1761 c.fillAndStroke();1762 1763 c.begin();1764 c.moveTo(w, h * 0.5 + 2.5);1765 c.arcTo(w, w, 0, 0, 1, 0, h * 0.5 + 2.5 + w);1766 c.lineTo(0, h * 0.5 + 2.5);1767 c.stroke();17681769 c.setDashed(true);1770 1771 c.begin();1772 c.moveTo(w, h * 0.5 - 2.5);1773 c.arcTo(w, w, 0, 0, 0, 0, h * 0.5 - 2.5 - w);1774 c.lineTo(0, h * 0.5 - 2.5);1775 c.stroke();1776};17771778mxCellRenderer.registerShape(mxFloorplanDoorDoubleAction.prototype.cst.DOOR_DOUBLE_ACTION, mxFloorplanDoorDoubleAction);1779