1/**
2 * $Id: mxFloorplan.js,v 1.3 2014/02/17 17:05:39 mate Exp $
3 * Copyright (c) 2006-2014, JGraph Ltd
4 */
5
6//**********************************************************************************************************************************************************
7//Wall
8//**********************************************************************************************************************************************************
9/**
10* Extends mxShape.
11*/
12function mxFloorplanWall(bounds, fill, stroke, strokewidth)
13{
14	mxShape.call(this);
15	this.bounds = bounds;
16	this.fill = fill;
17	this.stroke = stroke;
18	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
19};
20
21/**
22* Extends mxShape.
23*/
24mxUtils.extend(mxFloorplanWall, mxShape);
25
26mxFloorplanWall.prototype.cst = {
27		WALL : 'mxgraph.floorplan.wall',
28		WALL_THICKNESS : "wallThickness"
29};
30
31mxFloorplanWall.prototype.customProperties = [
32	{name:'wallThickness', dispName:'Thickness', type:'float', min:0, defVal:10}
33];
34
35/**
36* Function: paintVertexShape
37*
38* Paints the vertex shape.
39*/
40mxFloorplanWall.prototype.paintVertexShape = function(c, x, y, w, h)
41{
42	c.translate(x, y);
43	this.background(c, x, y, w, h);
44};
45
46mxFloorplanWall.prototype.background = function(c, x, y, w, h)
47{
48	var wallTh = parseFloat(mxUtils.getValue(this.style, mxFloorplanWall.prototype.cst.WALL_THICKNESS, '10'));
49	c.rect(0, h * 0.5 - wallTh * 0.5, w, wallTh);
50	c.fillAndStroke();
51};
52
53mxCellRenderer.registerShape(mxFloorplanWall.prototype.cst.WALL, mxFloorplanWall);
54
55//**********************************************************************************************************************************************************
56//Wall Corner
57//**********************************************************************************************************************************************************
58/**
59* Extends mxShape.
60*/
61function mxFloorplanWallCorner(bounds, fill, stroke, strokewidth)
62{
63	mxShape.call(this);
64	this.bounds = bounds;
65	this.fill = fill;
66	this.stroke = stroke;
67	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
68};
69
70/**
71* Extends mxShape.
72*/
73mxUtils.extend(mxFloorplanWallCorner, mxShape);
74
75mxFloorplanWallCorner.prototype.cst = {
76		WALL_CORNER : 'mxgraph.floorplan.wallCorner',
77		WALL_THICKNESS : "wallThickness"
78};
79
80mxFloorplanWallCorner.prototype.customProperties = [
81	{name:'wallThickness', dispName:'Thickness', type:'float', min:0, defVal:10}
82];
83
84/**
85* Function: paintVertexShape
86*
87* Paints the vertex shape.
88*/
89mxFloorplanWallCorner.prototype.paintVertexShape = function(c, x, y, w, h)
90{
91	c.translate(x, y);
92	this.background(c, x, y, w, h);
93};
94
95mxFloorplanWallCorner.prototype.background = function(c, x, y, w, h)
96{
97	var wallTh = parseFloat(mxUtils.getValue(this.style, mxFloorplanWallCorner.prototype.cst.WALL_THICKNESS, '10'));
98
99	c.begin();
100	c.moveTo(0, h);
101	c.lineTo(0, 0);
102	c.lineTo(w, 0);
103	c.lineTo(w, wallTh);
104	c.lineTo(wallTh, wallTh);
105	c.lineTo(wallTh, h);
106	c.close();
107	c.fillAndStroke();
108};
109
110mxCellRenderer.registerShape(mxFloorplanWallCorner.prototype.cst.WALL_CORNER, mxFloorplanWallCorner);
111
112//**********************************************************************************************************************************************************
113//Wall U
114//**********************************************************************************************************************************************************
115/**
116* Extends mxShape.
117*/
118function mxFloorplanWallU(bounds, fill, stroke, strokewidth)
119{
120	mxShape.call(this);
121	this.bounds = bounds;
122	this.fill = fill;
123	this.stroke = stroke;
124	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
125};
126
127/**
128* Extends mxShape.
129*/
130mxUtils.extend(mxFloorplanWallU, mxShape);
131
132mxFloorplanWallU.prototype.cst = {
133		WALL_U : 'mxgraph.floorplan.wallU',
134		WALL_THICKNESS : "wallThickness"
135};
136
137mxFloorplanWallU.prototype.customProperties = [
138	{name:'wallThickness', dispName:'Thickness', type:'float', min:0, defVal:10}
139];
140
141/**
142* Function: paintVertexShape
143*
144* Paints the vertex shape.
145*/
146mxFloorplanWallU.prototype.paintVertexShape = function(c, x, y, w, h)
147{
148	c.translate(x, y);
149	this.background(c, x, y, w, h);
150};
151
152mxFloorplanWallU.prototype.background = function(c, x, y, w, h)
153{
154	var wallTh = parseFloat(mxUtils.getValue(this.style, mxFloorplanWallU.prototype.cst.WALL_THICKNESS, '10'));
155
156	c.begin();
157	c.moveTo(0, h);
158	c.lineTo(0, 0);
159	c.lineTo(w, 0);
160	c.lineTo(w, h);
161	c.lineTo(w - wallTh, h);
162	c.lineTo(w - wallTh, wallTh);
163	c.lineTo(wallTh, wallTh);
164	c.lineTo(wallTh, h);
165	c.close();
166	c.fillAndStroke();
167};
168
169mxCellRenderer.registerShape(mxFloorplanWallU.prototype.cst.WALL_U, mxFloorplanWallU);
170
171//**********************************************************************************************************************************************************
172//Room
173//**********************************************************************************************************************************************************
174/**
175* Extends mxShape.
176*/
177function mxFloorplanRoom(bounds, fill, stroke, strokewidth)
178{
179	mxShape.call(this);
180	this.bounds = bounds;
181	this.fill = fill;
182	this.stroke = stroke;
183	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
184};
185
186/**
187* Extends mxShape.
188*/
189mxUtils.extend(mxFloorplanRoom, mxShape);
190
191mxFloorplanRoom.prototype.cst = {
192		ROOM : 'mxgraph.floorplan.room',
193		WALL_THICKNESS : "wallThickness"
194};
195
196mxFloorplanRoom.prototype.customProperties = [
197	{name:'wallThickness', dispName:'Thickness', type:'float', min:0, defVal:10}
198];
199
200/**
201* Function: paintVertexShape
202*
203* Paints the vertex shape.
204*/
205mxFloorplanRoom.prototype.paintVertexShape = function(c, x, y, w, h)
206{
207	c.translate(x, y);
208	this.background(c, x, y, w, h);
209};
210
211mxFloorplanRoom.prototype.background = function(c, x, y, w, h)
212{
213	var wallTh = parseFloat(mxUtils.getValue(this.style, mxFloorplanRoom.prototype.cst.WALL_THICKNESS, '10'));
214
215	c.begin();
216	c.moveTo(0, h);
217	c.lineTo(0, 0);
218	c.lineTo(w, 0);
219	c.lineTo(w, h);
220	c.close();
221	c.moveTo(wallTh, wallTh);
222	c.lineTo(wallTh, h - wallTh);
223	c.lineTo(w - wallTh, h - wallTh);
224	c.lineTo(w - wallTh, wallTh);
225	c.close();
226	c.fillAndStroke();
227};
228
229mxCellRenderer.registerShape(mxFloorplanRoom.prototype.cst.ROOM, mxFloorplanRoom);
230
231//**********************************************************************************************************************************************************
232//Window
233//**********************************************************************************************************************************************************
234/**
235* Extends mxShape.
236*/
237function mxFloorplanWindow(bounds, fill, stroke, strokewidth)
238{
239	mxShape.call(this);
240	this.bounds = bounds;
241	this.fill = fill;
242	this.stroke = stroke;
243	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
244};
245
246/**
247* Extends mxShape.
248*/
249mxUtils.extend(mxFloorplanWindow, mxShape);
250
251mxFloorplanWindow.prototype.cst = {
252		WINDOW : 'mxgraph.floorplan.window',
253		WALL_THICKNESS : "wallThickness"
254};
255
256mxFloorplanWindow.prototype.customProperties = [
257	{name:'wallThickness', dispName:'Thickness', type:'float', min:0, defVal:10}
258];
259
260/**
261* Function: paintVertexShape
262*
263* Paints the vertex shape.
264*/
265mxFloorplanWindow.prototype.paintVertexShape = function(c, x, y, w, h)
266{
267	c.translate(x, y);
268	this.background(c, x, y, w, h);
269};
270
271mxFloorplanWindow.prototype.background = function(c, x, y, w, h)
272{
273	var wallTh = parseFloat(mxUtils.getValue(this.style, mxFloorplanWindow.prototype.cst.WALL_THICKNESS, '10'));
274	c.rect(0, h * 0.5 - wallTh * 0.5, w, wallTh);
275	c.fillAndStroke();
276
277	c.begin();
278	c.moveTo(0, h * 0.5);
279	c.lineTo(w, h * 0.5);
280	c.stroke();
281};
282
283mxCellRenderer.registerShape(mxFloorplanWindow.prototype.cst.WINDOW, mxFloorplanWindow);
284
285//**********************************************************************************************************************************************************
286//Dimension
287//**********************************************************************************************************************************************************
288/**
289* Extends mxShape.
290*/
291function mxFloorplanDimension(bounds, fill, stroke, strokewidth)
292{
293	mxShape.call(this);
294	this.bounds = bounds;
295	this.fill = fill;
296	this.stroke = stroke;
297	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
298};
299
300/**
301* Extends mxShape.
302*/
303mxUtils.extend(mxFloorplanDimension, mxShape);
304
305mxFloorplanDimension.prototype.cst = {
306		DIMENSION : 'mxgraph.floorplan.dimension'
307};
308
309mxFloorplanDimension.prototype.customProperties = [
310	{name:'wallThickness', dispName:'Thickness', type:'float', min:0, defVal:10}
311];
312
313/**
314* Function: paintVertexShape
315*
316* Paints the vertex shape.
317*/
318mxFloorplanDimension.prototype.paintVertexShape = function(c, x, y, w, h)
319{
320	c.translate(x, y);
321	this.background(c, x, y, w, h);
322};
323
324mxFloorplanDimension.prototype.background = function(c, x, y, w, h)
325{
326	c.begin();
327	c.moveTo(0, 20);
328	c.lineTo(w, 20);
329	c.moveTo(10, 15);
330	c.lineTo(0, 20);
331	c.lineTo(10, 25);
332	c.moveTo(w - 10, 15);
333	c.lineTo(w, 20);
334	c.lineTo(w - 10, 25);
335	c.moveTo(0, 15);
336	c.lineTo(0, h);
337	c.moveTo(w, 15);
338	c.lineTo(w, h);
339	c.stroke();
340};
341
342mxCellRenderer.registerShape(mxFloorplanDimension.prototype.cst.DIMENSION, mxFloorplanDimension);
343
344//**********************************************************************************************************************************************************
345//Dimension Bottom
346//**********************************************************************************************************************************************************
347/**
348* Extends mxShape.
349*/
350function mxFloorplanDimensionBottom(bounds, fill, stroke, strokewidth)
351{
352	mxShape.call(this);
353	this.bounds = bounds;
354	this.fill = fill;
355	this.stroke = stroke;
356	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
357};
358
359/**
360* Extends mxShape.
361*/
362mxUtils.extend(mxFloorplanDimensionBottom, mxShape);
363
364mxFloorplanDimensionBottom.prototype.cst = {
365		DIMENSION : 'mxgraph.floorplan.dimensionBottom'
366};
367
368/**
369* Function: paintVertexShape
370*
371* Paints the vertex shape.
372*/
373mxFloorplanDimensionBottom.prototype.paintVertexShape = function(c, x, y, w, h)
374{
375	c.translate(x, y);
376	this.background(c, x, y, w, h);
377};
378
379mxFloorplanDimensionBottom.prototype.background = function(c, x, y, w, h)
380{
381	c.begin();
382	c.moveTo(0, h - 20);
383	c.lineTo(w, h - 20);
384	c.moveTo(10, h - 15);
385	c.lineTo(0, h - 20);
386	c.lineTo(10, h - 25);
387	c.moveTo(w - 10, h - 15);
388	c.lineTo(w, h - 20);
389	c.lineTo(w - 10, h - 25);
390	c.moveTo(0, h - 15);
391	c.lineTo(0, 0);
392	c.moveTo(w, h - 15);
393	c.lineTo(w, 0);
394	c.stroke();
395};
396
397mxCellRenderer.registerShape(mxFloorplanDimensionBottom.prototype.cst.DIMENSION, mxFloorplanDimensionBottom);
398
399//**********************************************************************************************************************************************************
400//Stairs
401//**********************************************************************************************************************************************************
402/**
403* Extends mxShape.
404*/
405function mxFloorplanStairs(bounds, fill, stroke, strokewidth)
406{
407	mxShape.call(this);
408	this.bounds = bounds;
409	this.fill = fill;
410	this.stroke = stroke;
411	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
412};
413
414/**
415* Extends mxShape.
416*/
417mxUtils.extend(mxFloorplanStairs, mxShape);
418
419mxFloorplanStairs.prototype.cst = {
420		STAIRS : 'mxgraph.floorplan.stairs'
421};
422
423/**
424* Function: paintVertexShape
425*
426* Paints the vertex shape.
427*/
428mxFloorplanStairs.prototype.paintVertexShape = function(c, x, y, w, h)
429{
430	c.translate(x, y);
431	var minW = Math.max(w, 50);
432	this.background(c, x, y, minW, h);
433};
434
435mxFloorplanStairs.prototype.background = function(c, x, y, w, h)
436{
437	c.rect(0, 0, w, h);
438	c.fillAndStroke();
439
440	var step = 25;
441	c.setShadow(false);
442
443	c.begin();
444
445	for (var i = 25; i < w; i = i + step)
446	{
447		c.moveTo(i, 0);
448		c.lineTo(i, h);
449	}
450
451	c.stroke();
452
453	c.begin();
454	c.moveTo(0, h * 0.5);
455	c.lineTo(w, h * 0.5);
456	c.moveTo(w - step, 0);
457	c.lineTo(w, h * 0.5);
458	c.lineTo(w - step, h);
459	c.stroke();
460};
461
462mxCellRenderer.registerShape(mxFloorplanStairs.prototype.cst.STAIRS, mxFloorplanStairs);
463
464////**********************************************************************************************************************************************************
465////Stairs Double
466////**********************************************************************************************************************************************************
467///**
468//* Extends mxShape.
469//*/
470//function mxFloorplanStairsRest(bounds, fill, stroke, strokewidth)
471//{
472//	mxShape.call(this);
473//	this.bounds = bounds;
474//	this.fill = fill;
475//	this.stroke = stroke;
476//	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
477//};
478//
479///**
480//* Extends mxShape.
481//*/
482//mxUtils.extend(mxFloorplanStairsRest, mxShape);
483//
484//mxFloorplanStairsRest.prototype.cst = {
485//		STAIRS : 'mxgraph.floorplan.stairsRest'
486//};
487//
488//
489//
490///**
491//* Function: paintVertexShape
492//*
493//* Paints the vertex shape.
494//*/
495//mxFloorplanStairsRest.prototype.paintVertexShape = function(c, x, y, w, h)
496//{
497//	c.translate(x, y);
498//	var minW = Math.max(w, 50, h);
499//	var minH = Math.min(w, h);
500//	this.background(c, x, y, minW, h);
501//};
502//
503//mxFloorplanStairsRest.prototype.background = function(c, x, y, w, h)
504//{
505//	c.rect(0, 0, w, h);
506//	c.fillAndStroke();
507//
508//	var step = 25;
509//	c.setShadow(false);
510//
511//	c.begin();
512//
513//	for (var i = 25; i < w - h * 0.5; i = i + step)
514//	{
515//		c.moveTo(i, 0);
516//		c.lineTo(i, h);
517//	}
518//
519//	c.stroke();
520//
521//	c.begin();
522//	c.moveTo(0, h * 0.5);
523//	c.lineTo(w, h * 0.5);
524//
525//	c.moveTo(w, 0);
526//	c.lineTo(w - h * 0.5, h * 0.5);
527//	c.lineTo(w, h);
528//
529//	c.moveTo(w - h * 0.5, 0);
530//	c.lineTo(w - h * 0.5, h);
531//
532//	c.moveTo(0, h * 0.5);
533//	c.lineTo(w, h * 0.5);
534//	c.stroke();
535//};
536//
537//mxCellRenderer.registerShape(mxFloorplanStairsRest.prototype.cst.STAIRS, mxFloorplanStairsRest);
538
539//**********************************************************************************************************************************************************
540//Stairs
541//**********************************************************************************************************************************************************
542/**
543* Extends mxShape.
544*/
545function mxFloorplanStairsRest(bounds, fill, stroke, strokewidth)
546{
547	mxShape.call(this);
548	this.bounds = bounds;
549	this.fill = fill;
550	this.stroke = stroke;
551	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
552};
553
554/**
555* Extends mxShape.
556*/
557mxUtils.extend(mxFloorplanStairsRest, mxShape);
558
559mxFloorplanStairsRest.prototype.cst = {
560		STAIRS : 'mxgraph.floorplan.stairsRest'
561};
562
563/**
564* Function: paintVertexShape
565*
566* Paints the vertex shape.
567*/
568mxFloorplanStairsRest.prototype.paintVertexShape = function(c, x, y, w, h)
569{
570	c.translate(x, y);
571	var minW = Math.max(w, 50, h);
572	var minH = Math.min(w, h);
573	this.background(c, x, y, minW, h);
574};
575
576mxFloorplanStairsRest.prototype.background = function(c, x, y, w, h)
577{
578	c.rect(0, 0, w, h);
579	c.fillAndStroke();
580
581	var step = 25;
582	c.setShadow(false);
583
584	c.begin();
585
586	for (var i = 25; i < w - h * 0.5; i = i + step)
587	{
588		c.moveTo(i, 0);
589		c.lineTo(i, h);
590	}
591
592	c.stroke();
593
594	c.begin();
595	c.moveTo(0, h * 0.5);
596	c.lineTo(w, h * 0.5);
597
598	c.moveTo(w, 0);
599	c.lineTo(w - h * 0.5, h * 0.5);
600	c.lineTo(w, h);
601
602	c.moveTo(w - h * 0.5, 0);
603	c.lineTo(w - h * 0.5, h);
604
605	c.moveTo(0, h * 0.5);
606	c.lineTo(w, h * 0.5);
607	c.stroke();
608};
609
610mxCellRenderer.registerShape(mxFloorplanStairsRest.prototype.cst.STAIRS, mxFloorplanStairsRest);
611
612//**********************************************************************************************************************************************************
613//Door, Left
614//**********************************************************************************************************************************************************
615/**
616* Extends mxShape.
617*/
618function mxFloorplanDoorLeft(bounds, fill, stroke, strokewidth)
619{
620	mxShape.call(this);
621	this.bounds = bounds;
622	this.fill = fill;
623	this.stroke = stroke;
624	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
625};
626
627/**
628* Extends mxShape.
629*/
630mxUtils.extend(mxFloorplanDoorLeft, mxShape);
631
632mxFloorplanDoorLeft.prototype.cst = {
633		DOOR_LEFT : 'mxgraph.floorplan.doorLeft'
634};
635
636/**
637* Function: paintVertexShape
638*
639* Paints the vertex shape.
640*/
641mxFloorplanDoorLeft.prototype.paintVertexShape = function(c, x, y, w, h)
642{
643	c.translate(x, y);
644	this.background(c, x, y, w, h);
645};
646
647mxFloorplanDoorLeft.prototype.background = function(c, x, y, w, h)
648{
649		c.rect(0, 0, w, 5);
650		c.fillAndStroke();
651
652		c.begin();
653		c.moveTo(w, 5);
654		c.arcTo(w, w, 0, 0, 1, 0, 5 + w);
655		c.lineTo(0, 5);
656		c.stroke();
657};
658
659mxCellRenderer.registerShape(mxFloorplanDoorLeft.prototype.cst.DOOR_LEFT, mxFloorplanDoorLeft);
660
661//**********************************************************************************************************************************************************
662//Door, Right
663//**********************************************************************************************************************************************************
664/**
665* Extends mxShape.
666*/
667function mxFloorplanDoorRight(bounds, fill, stroke, strokewidth)
668{
669	mxShape.call(this);
670	this.bounds = bounds;
671	this.fill = fill;
672	this.stroke = stroke;
673	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
674};
675
676/**
677* Extends mxShape.
678*/
679mxUtils.extend(mxFloorplanDoorRight, mxShape);
680
681mxFloorplanDoorRight.prototype.cst = {
682		DOOR_RIGHT : 'mxgraph.floorplan.doorRight'
683};
684
685/**
686* Function: paintVertexShape
687*
688* Paints the vertex shape.
689*/
690mxFloorplanDoorRight.prototype.paintVertexShape = function(c, x, y, w, h)
691{
692	c.translate(x, y);
693	this.background(c, x, y, w, h);
694};
695
696mxFloorplanDoorRight.prototype.background = function(c, x, y, w, h)
697{
698		c.rect(0, 0, w, 5);
699		c.fillAndStroke();
700
701		c.begin();
702		c.moveTo(0, 5);
703		c.arcTo(w, w, 0, 0, 0, w, 5 + w);
704		c.lineTo(w, 5);
705		c.stroke();
706};
707
708mxCellRenderer.registerShape(mxFloorplanDoorRight.prototype.cst.DOOR_RIGHT, mxFloorplanDoorRight);
709
710//**********************************************************************************************************************************************************
711//Door, Double
712//**********************************************************************************************************************************************************
713/**
714* Extends mxShape.
715*/
716function mxFloorplanDoorDouble(bounds, fill, stroke, strokewidth)
717{
718	mxShape.call(this);
719	this.bounds = bounds;
720	this.fill = fill;
721	this.stroke = stroke;
722	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
723};
724
725/**
726* Extends mxShape.
727*/
728mxUtils.extend(mxFloorplanDoorDouble, mxShape);
729
730mxFloorplanDoorDouble.prototype.cst = {
731		DOOR_DOUBLE : 'mxgraph.floorplan.doorDouble'
732};
733
734/**
735* Function: paintVertexShape
736*
737* Paints the vertex shape.
738*/
739mxFloorplanDoorDouble.prototype.paintVertexShape = function(c, x, y, w, h)
740{
741	c.translate(x, y);
742	this.background(c, x, y, w, h);
743};
744
745mxFloorplanDoorDouble.prototype.background = function(c, x, y, w, h)
746{
747	var halfW = w * 0.5;
748	c.rect(0, 0, w, 5);
749	c.fillAndStroke();
750
751	c.begin();
752	c.moveTo(halfW, 0);
753	c.lineTo(halfW, 5);
754	c.moveTo(halfW, 5);
755	c.arcTo(halfW, halfW, 0, 0, 1, 0, 5 + halfW);
756	c.lineTo(0, 5);
757	c.moveTo(halfW, 5);
758	c.arcTo(halfW, halfW, 0, 0, 0, w, 5 + halfW);
759	c.lineTo(w, 5);
760	c.stroke();
761};
762
763mxCellRenderer.registerShape(mxFloorplanDoorDouble.prototype.cst.DOOR_DOUBLE, mxFloorplanDoorDouble);
764
765//**********************************************************************************************************************************************************
766//Door, Uneven
767//**********************************************************************************************************************************************************
768/**
769* Extends mxShape.
770*/
771function mxFloorplanDoorUneven(bounds, fill, stroke, strokewidth)
772{
773	mxShape.call(this);
774	this.bounds = bounds;
775	this.fill = fill;
776	this.stroke = stroke;
777	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
778	this.dx = 0.3;
779};
780
781/**
782* Extends mxShape.
783*/
784mxUtils.extend(mxFloorplanDoorUneven, mxShape);
785
786mxFloorplanDoorUneven.prototype.customProperties = [
787	{name: 'dx', dispName: 'Door size', type: 'float', min:0, max:1, defVal:0.3}
788];
789
790mxFloorplanDoorUneven.prototype.cst = {
791		DOOR_UNEVEN : 'mxgraph.floorplan.doorUneven'
792};
793
794/**
795* Function: paintVertexShape
796*
797* Paints the vertex shape.
798*/
799mxFloorplanDoorUneven.prototype.paintVertexShape = function(c, x, y, w, h)
800{
801	c.translate(x, y);
802	this.background(c, x, y, w, h);
803};
804
805mxFloorplanDoorUneven.prototype.background = function(c, x, y, w, h)
806{
807	var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
808
809	c.rect(0, 0, w, 5);
810	c.fillAndStroke();
811
812	c.begin();
813	c.moveTo(dx, 0);
814	c.lineTo(dx, 5);
815	c.arcTo(dx, dx, 0, 0, 1, 0, 5 + dx);
816	c.lineTo(0, 5);
817	c.moveTo(dx, 5);
818	c.arcTo(w - dx, w - dx, 0, 0, 0, w, 5 + w - dx);
819	c.lineTo(w, 5);
820	c.stroke();
821};
822
823mxCellRenderer.registerShape(mxFloorplanDoorUneven.prototype.cst.DOOR_UNEVEN, mxFloorplanDoorUneven);
824
825Graph.handleFactory[mxFloorplanDoorUneven.prototype.cst.DOOR_UNEVEN] = function(state)
826{
827	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
828			{
829				var dx = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
830
831				return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 5);
832			}, function(bounds, pt)
833			{
834				this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;
835			})];
836
837	return handles;
838}
839
840//**********************************************************************************************************************************************************
841//Door, Opposing
842//**********************************************************************************************************************************************************
843/**
844* Extends mxShape.
845*/
846function mxFloorplanDoorOpposing(bounds, fill, stroke, strokewidth)
847{
848	mxShape.call(this);
849	this.bounds = bounds;
850	this.fill = fill;
851	this.stroke = stroke;
852	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
853	this.dx = 0.3;
854};
855
856/**
857* Extends mxShape.
858*/
859mxUtils.extend(mxFloorplanDoorOpposing, mxShape);
860
861mxFloorplanDoorOpposing.prototype.customProperties = [
862	{name: 'dx', dispName: 'Door size', type: 'float', min:0, max:1, defVal:0.3}
863];
864
865mxFloorplanDoorOpposing.prototype.cst = {
866		DOOR_OPPOSING : 'mxgraph.floorplan.doorOpposing'
867};
868
869/**
870* Function: paintVertexShape
871*
872* Paints the vertex shape.
873*/
874mxFloorplanDoorOpposing.prototype.paintVertexShape = function(c, x, y, w, h)
875{
876	c.translate(x, y);
877	this.background(c, x, y, w, h);
878};
879
880mxFloorplanDoorOpposing.prototype.background = function(c, x, y, w, h)
881{
882	var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
883
884	c.rect(0, dx, w, 5);
885	c.fillAndStroke();
886
887	c.begin();
888	c.moveTo(dx, dx);
889	c.lineTo(dx, dx + 5);
890	c.arcTo(dx, dx, 0, 0, 0, 0, 0);
891	c.lineTo(0, dx);
892	c.moveTo(dx, dx + 5);
893	c.arcTo(w - dx, w - dx, 0, 0, 0, w, 5 + w);
894	c.lineTo(w, dx + 5);
895	c.stroke();
896};
897
898mxCellRenderer.registerShape(mxFloorplanDoorOpposing.prototype.cst.DOOR_OPPOSING, mxFloorplanDoorOpposing);
899
900Graph.handleFactory[mxFloorplanDoorOpposing.prototype.cst.DOOR_OPPOSING] = function(state)
901{
902	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
903			{
904				var dx = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
905
906				return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 5);
907			}, function(bounds, pt)
908			{
909				this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;
910			})];
911
912	return handles;
913}
914
915//**********************************************************************************************************************************************************
916//Door, Revolving
917//**********************************************************************************************************************************************************
918/**
919* Extends mxShape.
920*/
921function mxFloorplanDoorRevolving(bounds, fill, stroke, strokewidth)
922{
923	mxShape.call(this);
924	this.bounds = bounds;
925	this.fill = fill;
926	this.stroke = stroke;
927	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
928};
929
930/**
931* Extends mxShape.
932*/
933mxUtils.extend(mxFloorplanDoorRevolving, mxShape);
934
935mxFloorplanDoorRevolving.prototype.cst = {
936		DOOR_REVOLVING : 'mxgraph.floorplan.doorRevolving'
937};
938
939/**
940* Function: paintVertexShape
941*
942* Paints the vertex shape.
943*/
944mxFloorplanDoorRevolving.prototype.paintVertexShape = function(c, x, y, w, h)
945{
946	c.translate(x, y);
947	this.background(c, x, y, w, h);
948};
949
950mxFloorplanDoorRevolving.prototype.background = function(c, x, y, w, h)
951{
952		var d = Math.min(w, h);
953		c.rect((w - d) * 0.5 , h * 0.5 - 2.5, d, 5);
954		c.fillAndStroke();
955
956		c.rect(w * 0.5 - 2.5, (h - d) * 0.5, 5, d);
957		c.fillAndStroke();
958
959		c.begin();
960		c.ellipse((w - d) * 0.5, (h - d) * 0.5, d, d);
961		c.stroke();
962};
963
964mxCellRenderer.registerShape(mxFloorplanDoorRevolving.prototype.cst.DOOR_REVOLVING, mxFloorplanDoorRevolving);
965
966//**********************************************************************************************************************************************************
967//Door, Pocket
968//**********************************************************************************************************************************************************
969/**
970* Extends mxShape.
971*/
972function mxFloorplanDoorPocket(bounds, fill, stroke, strokewidth)
973{
974	mxShape.call(this);
975	this.bounds = bounds;
976	this.fill = fill;
977	this.stroke = stroke;
978	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
979	this.dx = 0.5;
980};
981
982/**
983* Extends mxShape.
984*/
985mxUtils.extend(mxFloorplanDoorPocket, mxShape);
986
987mxFloorplanDoorPocket.prototype.customProperties = [
988	{name: 'dx', dispName: 'Door size', type: 'float', min:0, max:1, defVal:0.3}
989];
990
991mxFloorplanDoorPocket.prototype.cst = {
992		DOOR_POCKET : 'mxgraph.floorplan.doorPocket'
993};
994
995/**
996* Function: paintVertexShape
997*
998* Paints the vertex shape.
999*/
1000mxFloorplanDoorPocket.prototype.paintVertexShape = function(c, x, y, w, h)
1001{
1002	var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
1003
1004	c.translate(x, y);
1005
1006	c.rect(dx, h * 0.5 - 5, 5, 10);
1007	c.fillAndStroke();
1008
1009	c.rect(w - 5, h * 0.5 - 5, 5, 10);
1010	c.fillAndStroke();
1011
1012	c.rect(0, h * 0.5 - 2.5, w - dx, 5);
1013	c.fillAndStroke();
1014};
1015
1016mxCellRenderer.registerShape(mxFloorplanDoorPocket.prototype.cst.DOOR_POCKET, mxFloorplanDoorPocket);
1017
1018Graph.handleFactory[mxFloorplanDoorPocket.prototype.cst.DOOR_POCKET] = function(state)
1019{
1020	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
1021			{
1022				var dx = Math.max(0, Math.min(0.5, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
1023
1024				return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 5);
1025			}, function(bounds, pt)
1026			{
1027				this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(0.5, (pt.x - bounds.x) / bounds.width))) / 100;
1028			})];
1029
1030	return handles;
1031}
1032
1033//**********************************************************************************************************************************************************
1034//Door, Double Pocket
1035//**********************************************************************************************************************************************************
1036/**
1037* Extends mxShape.
1038*/
1039function mxFloorplanDoorDoublePocket(bounds, fill, stroke, strokewidth)
1040{
1041	mxShape.call(this);
1042	this.bounds = bounds;
1043	this.fill = fill;
1044	this.stroke = stroke;
1045	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1046	this.dx = 0.5;
1047};
1048
1049/**
1050* Extends mxShape.
1051*/
1052mxUtils.extend(mxFloorplanDoorDoublePocket, mxShape);
1053
1054mxFloorplanDoorDoublePocket.prototype.customProperties = [
1055	{name: 'dx', dispName: 'Door size', type: 'float', min:0, max:1, defVal:0.3}
1056];
1057
1058mxFloorplanDoorDoublePocket.prototype.cst = {
1059		DOOR_DOUBLE_POCKET : 'mxgraph.floorplan.doorDoublePocket'
1060};
1061
1062/**
1063* Function: paintVertexShape
1064*
1065* Paints the vertex shape.
1066*/
1067mxFloorplanDoorDoublePocket.prototype.paintVertexShape = function(c, x, y, w, h)
1068{
1069	var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
1070
1071	c.translate(x, y);
1072
1073	c.rect(dx, h * 0.5 - 5, 5, 10);
1074	c.fillAndStroke();
1075
1076	c.rect(w - dx - 5, h * 0.5 - 5, 5, 10);
1077	c.fillAndStroke();
1078
1079	c.rect(0, h * 0.5 - 2.5, w * 0.5 - dx, 5);
1080	c.fillAndStroke();
1081
1082	c.rect(w * 0.5 + dx, h * 0.5 - 2.5, w * 0.5 - dx, 5);
1083	c.fillAndStroke();
1084};
1085
1086mxCellRenderer.registerShape(mxFloorplanDoorDoublePocket.prototype.cst.DOOR_DOUBLE_POCKET, mxFloorplanDoorDoublePocket);
1087
1088Graph.handleFactory[mxFloorplanDoorDoublePocket.prototype.cst.DOOR_DOUBLE_POCKET] = function(state)
1089{
1090	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
1091			{
1092				var dx = Math.max(0, Math.min(0.25, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
1093
1094				return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 5);
1095			}, function(bounds, pt)
1096			{
1097				this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(0.25, (pt.x - bounds.x) / bounds.width))) / 100;
1098			})];
1099
1100	return handles;
1101}
1102
1103//**********************************************************************************************************************************************************
1104//Door, By-Pass
1105//**********************************************************************************************************************************************************
1106/**
1107* Extends mxShape.
1108*/
1109function mxFloorplanDoorBypass(bounds, fill, stroke, strokewidth)
1110{
1111	mxShape.call(this);
1112	this.bounds = bounds;
1113	this.fill = fill;
1114	this.stroke = stroke;
1115	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1116	this.dx = 0.5;
1117};
1118
1119/**
1120* Extends mxShape.
1121*/
1122mxUtils.extend(mxFloorplanDoorBypass, mxShape);
1123
1124mxFloorplanDoorBypass.prototype.customProperties = [
1125	{name: 'dx', dispName: 'Door size', type: 'float', min:0, max:1, defVal:0.3}
1126];
1127
1128mxFloorplanDoorBypass.prototype.cst = {
1129		DOOR_BYPASS : 'mxgraph.floorplan.doorBypass'
1130};
1131
1132/**
1133* Function: paintVertexShape
1134*
1135* Paints the vertex shape.
1136*/
1137mxFloorplanDoorBypass.prototype.paintVertexShape = function(c, x, y, w, h)
1138{
1139	var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
1140
1141	c.translate(x, y);
1142
1143	c.rect(0, h * 0.5 - 5, 5, 10);
1144	c.fillAndStroke();
1145
1146	c.rect(w - 5, h * 0.5 - 5, 5, 10);
1147	c.fillAndStroke();
1148
1149	c.rect(0, h * 0.5, w * 0.5, 5);
1150	c.fillAndStroke();
1151
1152	c.rect(dx, h * 0.5 - 5, w * 0.5, 5);
1153	c.fillAndStroke();
1154};
1155
1156mxCellRenderer.registerShape(mxFloorplanDoorBypass.prototype.cst.DOOR_BYPASS, mxFloorplanDoorBypass);
1157
1158Graph.handleFactory[mxFloorplanDoorBypass.prototype.cst.DOOR_BYPASS] = function(state)
1159{
1160	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
1161			{
1162				var dx = Math.max(0, Math.min(0.5, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
1163
1164				return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 5);
1165			}, function(bounds, pt)
1166			{
1167				this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(0.5, (pt.x - bounds.x) / bounds.width))) / 100;
1168			})];
1169
1170	return handles;
1171}
1172
1173//**********************************************************************************************************************************************************
1174//Door, Bi-fold
1175//**********************************************************************************************************************************************************
1176/**
1177* Extends mxShape.
1178*/
1179function mxFloorplanDoorBifold(bounds, fill, stroke, strokewidth)
1180{
1181	mxShape.call(this);
1182	this.bounds = bounds;
1183	this.fill = fill;
1184	this.stroke = stroke;
1185	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1186	this.dx = 0.5;
1187};
1188
1189/**
1190* Extends mxShape.
1191*/
1192mxUtils.extend(mxFloorplanDoorBifold, mxShape);
1193
1194mxFloorplanDoorBifold.prototype.customProperties = [
1195	{name: 'dx', dispName: 'Door size', type: 'float', min:0, max:1, defVal:0.3}
1196];
1197
1198mxFloorplanDoorBifold.prototype.cst = {
1199		DOOR_BIFOLD : 'mxgraph.floorplan.doorBifold'
1200};
1201
1202/**
1203* Function: paintVertexShape
1204*
1205* Paints the vertex shape.
1206*/
1207mxFloorplanDoorBifold.prototype.paintVertexShape = function(c, x, y, w, h)
1208{
1209	var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
1210	var strokeWidth = parseFloat(mxUtils.getValue(this.style, 'strokeWidth', this.dx));
1211
1212	c.translate(x, y);
1213
1214	c.rect(0, h - 10, 5, 10);
1215	c.fillAndStroke();
1216
1217	c.rect(w - 5, h - 10, 5, 10);
1218	c.fillAndStroke();
1219
1220	c.setStrokeWidth(strokeWidth * 3);
1221
1222	c.begin();
1223	c.moveTo(5, h - 10);
1224	c.lineTo(Math.max((dx - 10) * 0.5 + 5, 5), 0);
1225	c.lineTo(Math.max(dx, 5), h - 10);
1226	c.moveTo(w - 5, h - 10);
1227	c.lineTo(w - Math.max((dx - 10) * 0.5 + 5, 5), 0);
1228	c.lineTo(w - Math.max(dx, 5), h - 10);
1229	c.stroke();
1230};
1231
1232mxCellRenderer.registerShape(mxFloorplanDoorBifold.prototype.cst.DOOR_BIFOLD, mxFloorplanDoorBifold);
1233
1234Graph.handleFactory[mxFloorplanDoorBifold.prototype.cst.DOOR_BIFOLD] = function(state)
1235{
1236	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
1237			{
1238				var dx = Math.max(0, Math.min(0.5, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
1239
1240				return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 5);
1241			}, function(bounds, pt)
1242			{
1243				this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(0.5, (pt.x - bounds.x) / bounds.width))) / 100;
1244			})];
1245
1246	return handles;
1247}
1248
1249//**********************************************************************************************************************************************************
1250//Door, Sliding Glass
1251//**********************************************************************************************************************************************************
1252/**
1253* Extends mxShape.
1254*/
1255function mxFloorplanDoorSlidingGlass(bounds, fill, stroke, strokewidth)
1256{
1257	mxShape.call(this);
1258	this.bounds = bounds;
1259	this.fill = fill;
1260	this.stroke = stroke;
1261	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1262	this.dx = 0.5;
1263};
1264
1265/**
1266* Extends mxShape.
1267*/
1268mxUtils.extend(mxFloorplanDoorSlidingGlass, mxShape);
1269
1270mxFloorplanDoorSlidingGlass.prototype.customProperties = [
1271	{name: 'dx', dispName: 'Door size', type: 'float', min:0, max:1, defVal:0.3}
1272];
1273
1274mxFloorplanDoorSlidingGlass.prototype.cst = {
1275		DOOR_SLIDING_GLASS : 'mxgraph.floorplan.doorSlidingGlass'
1276};
1277
1278/**
1279* Function: paintVertexShape
1280*
1281* Paints the vertex shape.
1282*/
1283mxFloorplanDoorSlidingGlass.prototype.paintVertexShape = function(c, x, y, w, h)
1284{
1285	var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
1286
1287	c.translate(x, y);
1288
1289	c.rect(0, h * 0.5 - 5, 5, 10);
1290	c.fillAndStroke();
1291
1292	c.rect(w - 5, h * 0.5 - 5, 5, 10);
1293	c.fillAndStroke();
1294
1295	c.rect(0, h * 0.5, w * 0.5, 2);
1296	c.fillAndStroke();
1297
1298	c.rect(dx, h * 0.5 - 2, w * 0.5, 2);
1299	c.fillAndStroke();
1300};
1301
1302mxCellRenderer.registerShape(mxFloorplanDoorSlidingGlass.prototype.cst.DOOR_SLIDING_GLASS, mxFloorplanDoorSlidingGlass);
1303
1304Graph.handleFactory[mxFloorplanDoorSlidingGlass.prototype.cst.DOOR_SLIDING_GLASS] = function(state)
1305{
1306	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
1307			{
1308				var dx = Math.max(0, Math.min(0.5, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
1309
1310				return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 5);
1311			}, function(bounds, pt)
1312			{
1313				this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(0.5, (pt.x - bounds.x) / bounds.width))) / 100;
1314			})];
1315
1316	return handles;
1317}
1318
1319//**********************************************************************************************************************************************************
1320//Door, Overhead
1321//**********************************************************************************************************************************************************
1322/**
1323* Extends mxShape.
1324*/
1325function mxFloorplanOverhead(bounds, fill, stroke, strokewidth)
1326{
1327	mxShape.call(this);
1328	this.bounds = bounds;
1329	this.fill = fill;
1330	this.stroke = stroke;
1331	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1332	this.dx = 0.5;
1333};
1334
1335/**
1336* Extends mxShape.
1337*/
1338mxUtils.extend(mxFloorplanOverhead, mxShape);
1339
1340mxFloorplanOverhead.prototype.cst = {
1341		DOOR_OVERHEAD : 'mxgraph.floorplan.doorOverhead'
1342};
1343
1344/**
1345* Function: paintVertexShape
1346*
1347* Paints the vertex shape.
1348*/
1349mxFloorplanOverhead.prototype.paintVertexShape = function(c, x, y, w, h)
1350{
1351	c.translate(x, y);
1352
1353	c.rect(0, h - 10, 5, 10);
1354	c.fillAndStroke();
1355
1356	c.rect(w - 5, h - 10, 5, 10);
1357	c.fillAndStroke();
1358
1359	c.rect(5, 0, w - 10, h - 5);
1360	c.fillAndStroke();
1361
1362};
1363
1364mxCellRenderer.registerShape(mxFloorplanOverhead.prototype.cst.DOOR_OVERHEAD, mxFloorplanOverhead);
1365
1366//**********************************************************************************************************************************************************
1367//Opening
1368//**********************************************************************************************************************************************************
1369/**
1370* Extends mxShape.
1371*/
1372function mxFloorplanOpening(bounds, fill, stroke, strokewidth)
1373{
1374	mxShape.call(this);
1375	this.bounds = bounds;
1376	this.fill = fill;
1377	this.stroke = stroke;
1378	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1379	this.dx = 0.5;
1380};
1381
1382/**
1383* Extends mxShape.
1384*/
1385mxUtils.extend(mxFloorplanOpening, mxShape);
1386
1387mxFloorplanOpening.prototype.cst = {
1388		OPENING : 'mxgraph.floorplan.opening'
1389};
1390
1391/**
1392* Function: paintVertexShape
1393*
1394* Paints the vertex shape.
1395*/
1396mxFloorplanOpening.prototype.paintVertexShape = function(c, x, y, w, h)
1397{
1398	c.translate(x, y);
1399
1400	c.rect(0, 0, 5, h);
1401	c.fillAndStroke();
1402
1403	c.rect(w - 5, 0, 5, h);
1404	c.fillAndStroke();
1405
1406};
1407
1408mxCellRenderer.registerShape(mxFloorplanOpening.prototype.cst.OPENING, mxFloorplanOpening);
1409
1410//**********************************************************************************************************************************************************
1411//Window, Glider
1412//**********************************************************************************************************************************************************
1413/**
1414* Extends mxShape.
1415*/
1416function mxFloorplanWindowGlider(bounds, fill, stroke, strokewidth)
1417{
1418	mxShape.call(this);
1419	this.bounds = bounds;
1420	this.fill = fill;
1421	this.stroke = stroke;
1422	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1423	this.dx = 0.5;
1424};
1425
1426/**
1427* Extends mxShape.
1428*/
1429mxUtils.extend(mxFloorplanWindowGlider, mxShape);
1430
1431mxFloorplanWindowGlider.prototype.customProperties = [
1432	{name: 'dx', dispName: 'Window size', type: 'float', min:0, max:1, defVal:0.3}
1433];
1434
1435mxFloorplanWindowGlider.prototype.cst = {
1436		WINDOW_GLIDER : 'mxgraph.floorplan.windowGlider'
1437};
1438
1439/**
1440* Function: paintVertexShape
1441*
1442* Paints the vertex shape.
1443*/
1444mxFloorplanWindowGlider.prototype.paintVertexShape = function(c, x, y, w, h)
1445{
1446	var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
1447
1448	c.translate(x, y);
1449
1450	c.rect(0, h * 0.5 - 5, w, 10);
1451	c.fillAndStroke();
1452
1453	c.rect(0, h * 0.5, w * 0.5, 1);
1454	c.fillAndStroke();
1455
1456	c.rect(dx, h * 0.5 - 1, w * 0.5, 1);
1457	c.fillAndStroke();
1458};
1459
1460mxCellRenderer.registerShape(mxFloorplanWindowGlider.prototype.cst.WINDOW_GLIDER, mxFloorplanWindowGlider);
1461
1462Graph.handleFactory[mxFloorplanWindowGlider.prototype.cst.WINDOW_GLIDER] = function(state)
1463{
1464	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
1465			{
1466				var dx = Math.max(0, Math.min(0.5, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
1467
1468				return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 5);
1469			}, function(bounds, pt)
1470			{
1471				this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(0.5, (pt.x - bounds.x) / bounds.width))) / 100;
1472			})];
1473
1474	return handles;
1475}
1476
1477//**********************************************************************************************************************************************************
1478//Window, Garden
1479//**********************************************************************************************************************************************************
1480/**
1481* Extends mxShape.
1482*/
1483function mxFloorplanWindowGarden(bounds, fill, stroke, strokewidth)
1484{
1485	mxShape.call(this);
1486	this.bounds = bounds;
1487	this.fill = fill;
1488	this.stroke = stroke;
1489	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1490	this.windowPanes = 3;
1491};
1492
1493/**
1494* Extends mxShape.
1495*/
1496mxUtils.extend(mxFloorplanWindowGarden, mxShape);
1497
1498mxFloorplanWindowGarden.prototype.customProperties = [
1499	{name: 'windowPanes', dispName: 'Panes', type: 'int', min:0, max:20, defVal:3}
1500];
1501
1502mxFloorplanWindowGarden.prototype.cst = {
1503		WINDOW_GARDEN : 'mxgraph.floorplan.windowGarden'
1504};
1505
1506/**
1507* Function: paintVertexShape
1508*
1509* Paints the vertex shape.
1510*/
1511mxFloorplanWindowGarden.prototype.paintVertexShape = function(c, x, y, w, h)
1512{
1513	var windowPanes = Math.min(mxUtils.getValue(this.style, 'windowPanes', this.windowPanes), 20);
1514
1515	var d = 2;
1516	var paneW = (w - 14 - (windowPanes - 1) * d) / windowPanes;
1517	c.translate(x, y);
1518
1519	c.rect(0, h - 10, 5, 10);
1520	c.fillAndStroke();
1521	c.rect(w  - 5, h - 10, 5, 10);
1522	c.fillAndStroke();
1523
1524	c.begin();
1525	c.moveTo(5, h);
1526	c.lineTo(5, 0);
1527	c.lineTo(w - 5, 0);
1528	c.lineTo(w - 5, h);
1529	c.lineTo(w - 5 - d, h);
1530	c.lineTo(w - 5 - d, d);
1531
1532	for (var i = 1; i < windowPanes; i++)
1533	{
1534		c.lineTo(w - 5 - d - i * paneW - (i - 1) * d, d);
1535		c.lineTo(w - 5 - d - i * paneW - (i - 1) * d, h);
1536		c.lineTo(w - 5 - 2 * d - (i - 1) * d - i * paneW, h);
1537		c.lineTo(w - 5 - 2 * d - (i - 1) * d - i * paneW, d);
1538	}
1539
1540	c.lineTo(5 + d, d);
1541	c.lineTo(5 + d, h);
1542	c.close();
1543	c.fillAndStroke();
1544};
1545
1546mxCellRenderer.registerShape(mxFloorplanWindowGarden.prototype.cst.WINDOW_GARDEN, mxFloorplanWindowGarden);
1547
1548//**********************************************************************************************************************************************************
1549//Window, Bow
1550//**********************************************************************************************************************************************************
1551/**
1552* Extends mxShape.
1553*/
1554function mxFloorplanWindowBow(bounds, fill, stroke, strokewidth)
1555{
1556	mxShape.call(this);
1557	this.bounds = bounds;
1558	this.fill = fill;
1559	this.stroke = stroke;
1560	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1561	this.windowPanes = 3;
1562};
1563
1564/**
1565* Extends mxShape.
1566*/
1567mxUtils.extend(mxFloorplanWindowBow, mxShape);
1568
1569mxFloorplanWindowBow.prototype.cst = {
1570		WINDOW_BOW : 'mxgraph.floorplan.windowBow'
1571};
1572
1573/**
1574* Function: paintVertexShape
1575*
1576* Paints the vertex shape.
1577*/
1578mxFloorplanWindowBow.prototype.paintVertexShape = function(c, x, y, w, h)
1579{
1580	c.translate(x, y);
1581
1582	var d = Math.min(w * 0.5, h);
1583
1584	c.begin();
1585	c.moveTo(0, (h - d) * 0.5);
1586	c.lineTo(d, (h + d) * 0.5);
1587	c.lineTo(w - d, (h + d) * 0.5);
1588	c.lineTo(w, (h - d) * 0.5);
1589	c.stroke();
1590};
1591
1592mxCellRenderer.registerShape(mxFloorplanWindowBow.prototype.cst.WINDOW_BOW, mxFloorplanWindowBow);
1593
1594//**********************************************************************************************************************************************************
1595//Window, Bay
1596//**********************************************************************************************************************************************************
1597/**
1598* Extends mxShape.
1599*/
1600function mxFloorplanWindowBay(bounds, fill, stroke, strokewidth)
1601{
1602	mxShape.call(this);
1603	this.bounds = bounds;
1604	this.fill = fill;
1605	this.stroke = stroke;
1606	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1607	this.windowPanes = 3;
1608};
1609
1610/**
1611* Extends mxShape.
1612*/
1613mxUtils.extend(mxFloorplanWindowBay, mxShape);
1614
1615mxFloorplanWindowBay.prototype.cst = {
1616		WINDOW_BAY : 'mxgraph.floorplan.windowBay'
1617};
1618
1619/**
1620* Function: paintVertexShape
1621*
1622* Paints the vertex shape.
1623*/
1624mxFloorplanWindowBay.prototype.paintVertexShape = function(c, x, y, w, h)
1625{
1626	c.translate(x, y);
1627
1628	var d = Math.min(w * 0.5, h);
1629
1630	c.begin();
1631	c.moveTo(0, 0);
1632	c.lineTo(w * 0.15, h * 0.6);
1633	c.lineTo(w * 0.35, h);
1634	c.lineTo(w * 0.65, h);
1635	c.lineTo(w * 0.85, h * 0.6);
1636	c.lineTo(w, 0);
1637	c.stroke();
1638};
1639
1640mxCellRenderer.registerShape(mxFloorplanWindowBay.prototype.cst.WINDOW_BAY, mxFloorplanWindowBay);
1641
1642//**********************************************************************************************************************************************************
1643//Door, Accordion
1644//**********************************************************************************************************************************************************
1645/**
1646* Extends mxShape.
1647*/
1648function mxFloorplanDoorAccordion(bounds, fill, stroke, strokewidth)
1649{
1650	mxShape.call(this);
1651	this.bounds = bounds;
1652	this.fill = fill;
1653	this.stroke = stroke;
1654	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1655	this.dx = 0.5;
1656};
1657
1658/**
1659* Extends mxShape.
1660*/
1661mxUtils.extend(mxFloorplanDoorAccordion, mxShape);
1662
1663mxFloorplanDoorAccordion.prototype.customProperties = [
1664	{name: 'dx', dispName: 'Door size', type: 'float', min:0, max:1, defVal:0.3}
1665];
1666
1667mxFloorplanDoorAccordion.prototype.cst = {
1668		DOOR_ACCORDION : 'mxgraph.floorplan.doorAccordion'
1669};
1670
1671/**
1672* Function: paintVertexShape
1673*
1674* Paints the vertex shape.
1675*/
1676mxFloorplanDoorAccordion.prototype.paintVertexShape = function(c, x, y, w, h)
1677{
1678	var dx = w * Math.max(0, Math.min(w, parseFloat(mxUtils.getValue(this.style, 'dx', this.dx))));
1679	var dx = Math.max(5, dx);
1680	var dx = Math.min(w - 5, dx);
1681
1682	var strokeWidth = parseFloat(mxUtils.getValue(this.style, 'strokeWidth', this.dx));
1683
1684	c.translate(x, y);
1685
1686	c.rect(0, h * 0.5 - 5, 5, 10);
1687	c.fillAndStroke();
1688
1689	c.rect(w - 5, h * 0.5 - 5, 5, 10);
1690	c.fillAndStroke();
1691
1692	c.setStrokeWidth(strokeWidth * 3);
1693
1694	var l = dx - 5;
1695
1696	c.begin();
1697	c.moveTo(5, h * 0.5);
1698	c.lineTo(5 + l * 0.1, 0);
1699	c.lineTo(5 + l * 0.3, h);
1700	c.lineTo(5 + l * 0.5, 0);
1701	c.lineTo(5 + l * 0.7, h);
1702	c.lineTo(5 + l * 0.9, 0);
1703	c.lineTo(5 + l, h * 0.5);
1704	c.stroke();
1705};
1706
1707mxCellRenderer.registerShape(mxFloorplanDoorAccordion.prototype.cst.DOOR_ACCORDION, mxFloorplanDoorAccordion);
1708
1709Graph.handleFactory[mxFloorplanDoorAccordion.prototype.cst.DOOR_ACCORDION] = function(state)
1710{
1711	var handles = [Graph.createHandle(state, ['dx'], function(bounds)
1712			{
1713				var dx = Math.max(0, Math.min(1, parseFloat(mxUtils.getValue(this.state.style, 'dx', this.dx))));
1714
1715				return new mxPoint(bounds.x + dx * bounds.width, bounds.y + 5);
1716			}, function(bounds, pt)
1717			{
1718				this.state.style['dx'] = Math.round(100 * Math.max(0, Math.min(1, (pt.x - bounds.x) / bounds.width))) / 100;
1719			})];
1720
1721	return handles;
1722}
1723
1724//**********************************************************************************************************************************************************
1725//Door, Double-action
1726//**********************************************************************************************************************************************************
1727/**
1728* Extends mxShape.
1729*/
1730function mxFloorplanDoorDoubleAction(bounds, fill, stroke, strokewidth)
1731{
1732	mxShape.call(this);
1733	this.bounds = bounds;
1734	this.fill = fill;
1735	this.stroke = stroke;
1736	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
1737};
1738
1739/**
1740* Extends mxShape.
1741*/
1742mxUtils.extend(mxFloorplanDoorDoubleAction, mxShape);
1743
1744mxFloorplanDoorDoubleAction.prototype.cst = {
1745		DOOR_DOUBLE_ACTION : 'mxgraph.floorplan.doorDoubleAction'
1746};
1747
1748/**
1749* Function: paintVertexShape
1750*
1751* Paints the vertex shape.
1752*/
1753mxFloorplanDoorDoubleAction.prototype.paintVertexShape = function(c, x, y, w, h)
1754{
1755	c.translate(x, y);
1756	this.background(c, x, y, w, h);
1757};
1758
1759mxFloorplanDoorDoubleAction.prototype.background = function(c, x, y, w, h)
1760{
1761		c.rect(0, h * 0.5 - 2.5, w, 5);
1762		c.fillAndStroke();
1763
1764		c.begin();
1765		c.moveTo(w, h * 0.5 + 2.5);
1766		c.arcTo(w, w, 0, 0, 1, 0, h * 0.5 + 2.5 + w);
1767		c.lineTo(0, h * 0.5 + 2.5);
1768		c.stroke();
1769
1770		c.setDashed(true);
1771
1772		c.begin();
1773		c.moveTo(w, h * 0.5 - 2.5);
1774		c.arcTo(w, w, 0, 0, 0, 0, h * 0.5 - 2.5 - w);
1775		c.lineTo(0, h * 0.5 - 2.5);
1776		c.stroke();
1777};
1778
1779mxCellRenderer.registerShape(mxFloorplanDoorDoubleAction.prototype.cst.DOOR_DOUBLE_ACTION, mxFloorplanDoorDoubleAction);
1780
1781