mxFloorplan.js 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739
  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. //Wall
  7. //**********************************************************************************************************************************************************
  8. /**
  9. * Extends mxShape.
  10. */
  11. function 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. };
  19. /**
  20. * Extends mxShape.
  21. */
  22. mxUtils.extend(mxFloorplanWall, mxShape);
  23. mxFloorplanWall.prototype.cst = {
  24. WALL : 'mxgraph.floorplan.wall',
  25. WALL_THICKNESS : "wallThickness"
  26. };
  27. /**
  28. * Function: paintVertexShape
  29. *
  30. * Paints the vertex shape.
  31. */
  32. mxFloorplanWall.prototype.paintVertexShape = function(c, x, y, w, h)
  33. {
  34. c.translate(x, y);
  35. this.background(c, x, y, w, h);
  36. };
  37. mxFloorplanWall.prototype.background = function(c, x, y, w, h)
  38. {
  39. var wallTh = parseFloat(mxUtils.getValue(this.style, mxFloorplanWall.prototype.cst.WALL_THICKNESS, '10'));
  40. c.rect(0, h * 0.5 - wallTh * 0.5, w, wallTh);
  41. c.fillAndStroke();
  42. };
  43. mxCellRenderer.registerShape(mxFloorplanWall.prototype.cst.WALL, mxFloorplanWall);
  44. //**********************************************************************************************************************************************************
  45. //Wall Corner
  46. //**********************************************************************************************************************************************************
  47. /**
  48. * Extends mxShape.
  49. */
  50. function mxFloorplanWallCorner(bounds, fill, stroke, strokewidth)
  51. {
  52. mxShape.call(this);
  53. this.bounds = bounds;
  54. this.fill = fill;
  55. this.stroke = stroke;
  56. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  57. };
  58. /**
  59. * Extends mxShape.
  60. */
  61. mxUtils.extend(mxFloorplanWallCorner, mxShape);
  62. mxFloorplanWallCorner.prototype.cst = {
  63. WALL_CORNER : 'mxgraph.floorplan.wallCorner',
  64. WALL_THICKNESS : "wallThickness"
  65. };
  66. /**
  67. * Function: paintVertexShape
  68. *
  69. * Paints the vertex shape.
  70. */
  71. mxFloorplanWallCorner.prototype.paintVertexShape = function(c, x, y, w, h)
  72. {
  73. c.translate(x, y);
  74. this.background(c, x, y, w, h);
  75. };
  76. mxFloorplanWallCorner.prototype.background = function(c, x, y, w, h)
  77. {
  78. var wallTh = parseFloat(mxUtils.getValue(this.style, mxFloorplanWallCorner.prototype.cst.WALL_THICKNESS, '10'));
  79. c.begin();
  80. c.moveTo(0, h);
  81. c.lineTo(0, 0);
  82. c.lineTo(w, 0);
  83. c.lineTo(w, wallTh);
  84. c.lineTo(wallTh, wallTh);
  85. c.lineTo(wallTh, h);
  86. c.close();
  87. c.fillAndStroke();
  88. };
  89. mxCellRenderer.registerShape(mxFloorplanWallCorner.prototype.cst.WALL_CORNER, mxFloorplanWallCorner);
  90. //**********************************************************************************************************************************************************
  91. //Wall U
  92. //**********************************************************************************************************************************************************
  93. /**
  94. * Extends mxShape.
  95. */
  96. function mxFloorplanWallU(bounds, fill, stroke, strokewidth)
  97. {
  98. mxShape.call(this);
  99. this.bounds = bounds;
  100. this.fill = fill;
  101. this.stroke = stroke;
  102. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  103. };
  104. /**
  105. * Extends mxShape.
  106. */
  107. mxUtils.extend(mxFloorplanWallU, mxShape);
  108. mxFloorplanWallU.prototype.cst = {
  109. WALL_U : 'mxgraph.floorplan.wallU',
  110. WALL_THICKNESS : "wallThickness"
  111. };
  112. /**
  113. * Function: paintVertexShape
  114. *
  115. * Paints the vertex shape.
  116. */
  117. mxFloorplanWallU.prototype.paintVertexShape = function(c, x, y, w, h)
  118. {
  119. c.translate(x, y);
  120. this.background(c, x, y, w, h);
  121. };
  122. mxFloorplanWallU.prototype.background = function(c, x, y, w, h)
  123. {
  124. var wallTh = parseFloat(mxUtils.getValue(this.style, mxFloorplanWallU.prototype.cst.WALL_THICKNESS, '10'));
  125. c.begin();
  126. c.moveTo(0, h);
  127. c.lineTo(0, 0);
  128. c.lineTo(w, 0);
  129. c.lineTo(w, h);
  130. c.lineTo(w - wallTh, h);
  131. c.lineTo(w - wallTh, wallTh);
  132. c.lineTo(wallTh, wallTh);
  133. c.lineTo(wallTh, h);
  134. c.close();
  135. c.fillAndStroke();
  136. };
  137. mxCellRenderer.registerShape(mxFloorplanWallU.prototype.cst.WALL_U, mxFloorplanWallU);
  138. //**********************************************************************************************************************************************************
  139. //Room
  140. //**********************************************************************************************************************************************************
  141. /**
  142. * Extends mxShape.
  143. */
  144. function mxFloorplanRoom(bounds, fill, stroke, strokewidth)
  145. {
  146. mxShape.call(this);
  147. this.bounds = bounds;
  148. this.fill = fill;
  149. this.stroke = stroke;
  150. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  151. };
  152. /**
  153. * Extends mxShape.
  154. */
  155. mxUtils.extend(mxFloorplanRoom, mxShape);
  156. mxFloorplanRoom.prototype.cst = {
  157. ROOM : 'mxgraph.floorplan.room',
  158. WALL_THICKNESS : "wallThickness"
  159. };
  160. /**
  161. * Function: paintVertexShape
  162. *
  163. * Paints the vertex shape.
  164. */
  165. mxFloorplanRoom.prototype.paintVertexShape = function(c, x, y, w, h)
  166. {
  167. c.translate(x, y);
  168. this.background(c, x, y, w, h);
  169. };
  170. mxFloorplanRoom.prototype.background = function(c, x, y, w, h)
  171. {
  172. var wallTh = parseFloat(mxUtils.getValue(this.style, mxFloorplanRoom.prototype.cst.WALL_THICKNESS, '10'));
  173. c.begin();
  174. c.moveTo(0, h);
  175. c.lineTo(0, 0);
  176. c.lineTo(w, 0);
  177. c.lineTo(w, h);
  178. c.close();
  179. c.moveTo(wallTh, wallTh);
  180. c.lineTo(wallTh, h - wallTh);
  181. c.lineTo(w - wallTh, h - wallTh);
  182. c.lineTo(w - wallTh, wallTh);
  183. c.close();
  184. c.fillAndStroke();
  185. };
  186. mxCellRenderer.registerShape(mxFloorplanRoom.prototype.cst.ROOM, mxFloorplanRoom);
  187. //**********************************************************************************************************************************************************
  188. //Window
  189. //**********************************************************************************************************************************************************
  190. /**
  191. * Extends mxShape.
  192. */
  193. function mxFloorplanWindow(bounds, fill, stroke, strokewidth)
  194. {
  195. mxShape.call(this);
  196. this.bounds = bounds;
  197. this.fill = fill;
  198. this.stroke = stroke;
  199. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  200. };
  201. /**
  202. * Extends mxShape.
  203. */
  204. mxUtils.extend(mxFloorplanWindow, mxShape);
  205. mxFloorplanWindow.prototype.cst = {
  206. WINDOW : 'mxgraph.floorplan.window',
  207. WALL_THICKNESS : "wallThickness"
  208. };
  209. /**
  210. * Function: paintVertexShape
  211. *
  212. * Paints the vertex shape.
  213. */
  214. mxFloorplanWindow.prototype.paintVertexShape = function(c, x, y, w, h)
  215. {
  216. c.translate(x, y);
  217. this.background(c, x, y, w, h);
  218. };
  219. mxFloorplanWindow.prototype.background = function(c, x, y, w, h)
  220. {
  221. var wallTh = parseFloat(mxUtils.getValue(this.style, mxFloorplanWindow.prototype.cst.WALL_THICKNESS, '10'));
  222. c.rect(0, h * 0.5 - wallTh * 0.5, w, wallTh);
  223. c.fillAndStroke();
  224. c.begin();
  225. c.moveTo(0, h * 0.5);
  226. c.lineTo(w, h * 0.5);
  227. c.stroke();
  228. };
  229. mxCellRenderer.registerShape(mxFloorplanWindow.prototype.cst.WINDOW, mxFloorplanWindow);
  230. //**********************************************************************************************************************************************************
  231. //Dimension
  232. //**********************************************************************************************************************************************************
  233. /**
  234. * Extends mxShape.
  235. */
  236. function mxFloorplanDimension(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. };
  244. /**
  245. * Extends mxShape.
  246. */
  247. mxUtils.extend(mxFloorplanDimension, mxShape);
  248. mxFloorplanDimension.prototype.cst = {
  249. DIMENSION : 'mxgraph.floorplan.dimension'
  250. };
  251. /**
  252. * Function: paintVertexShape
  253. *
  254. * Paints the vertex shape.
  255. */
  256. mxFloorplanDimension.prototype.paintVertexShape = function(c, x, y, w, h)
  257. {
  258. c.translate(x, y);
  259. this.background(c, x, y, w, h);
  260. };
  261. mxFloorplanDimension.prototype.background = function(c, x, y, w, h)
  262. {
  263. c.begin();
  264. c.moveTo(0, 20);
  265. c.lineTo(w, 20);
  266. c.moveTo(10, 15);
  267. c.lineTo(0, 20);
  268. c.lineTo(10, 25);
  269. c.moveTo(w - 10, 15);
  270. c.lineTo(w, 20);
  271. c.lineTo(w - 10, 25);
  272. c.moveTo(0, 15);
  273. c.lineTo(0, h);
  274. c.moveTo(w, 15);
  275. c.lineTo(w, h);
  276. c.stroke();
  277. };
  278. mxCellRenderer.registerShape(mxFloorplanDimension.prototype.cst.DIMENSION, mxFloorplanDimension);
  279. //**********************************************************************************************************************************************************
  280. //Dimension Bottom
  281. //**********************************************************************************************************************************************************
  282. /**
  283. * Extends mxShape.
  284. */
  285. function mxFloorplanDimensionBottom(bounds, fill, stroke, strokewidth)
  286. {
  287. mxShape.call(this);
  288. this.bounds = bounds;
  289. this.fill = fill;
  290. this.stroke = stroke;
  291. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  292. };
  293. /**
  294. * Extends mxShape.
  295. */
  296. mxUtils.extend(mxFloorplanDimensionBottom, mxShape);
  297. mxFloorplanDimensionBottom.prototype.cst = {
  298. DIMENSION : 'mxgraph.floorplan.dimensionBottom'
  299. };
  300. /**
  301. * Function: paintVertexShape
  302. *
  303. * Paints the vertex shape.
  304. */
  305. mxFloorplanDimensionBottom.prototype.paintVertexShape = function(c, x, y, w, h)
  306. {
  307. c.translate(x, y);
  308. this.background(c, x, y, w, h);
  309. };
  310. mxFloorplanDimensionBottom.prototype.background = function(c, x, y, w, h)
  311. {
  312. c.begin();
  313. c.moveTo(0, h - 20);
  314. c.lineTo(w, h - 20);
  315. c.moveTo(10, h - 15);
  316. c.lineTo(0, h - 20);
  317. c.lineTo(10, h - 25);
  318. c.moveTo(w - 10, h - 15);
  319. c.lineTo(w, h - 20);
  320. c.lineTo(w - 10, h - 25);
  321. c.moveTo(0, h - 15);
  322. c.lineTo(0, 0);
  323. c.moveTo(w, h - 15);
  324. c.lineTo(w, 0);
  325. c.stroke();
  326. };
  327. mxCellRenderer.registerShape(mxFloorplanDimensionBottom.prototype.cst.DIMENSION, mxFloorplanDimensionBottom);
  328. //**********************************************************************************************************************************************************
  329. //Stairs
  330. //**********************************************************************************************************************************************************
  331. /**
  332. * Extends mxShape.
  333. */
  334. function mxFloorplanStairs(bounds, fill, stroke, strokewidth)
  335. {
  336. mxShape.call(this);
  337. this.bounds = bounds;
  338. this.fill = fill;
  339. this.stroke = stroke;
  340. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  341. };
  342. /**
  343. * Extends mxShape.
  344. */
  345. mxUtils.extend(mxFloorplanStairs, mxShape);
  346. mxFloorplanStairs.prototype.cst = {
  347. STAIRS : 'mxgraph.floorplan.stairs'
  348. };
  349. /**
  350. * Function: paintVertexShape
  351. *
  352. * Paints the vertex shape.
  353. */
  354. mxFloorplanStairs.prototype.paintVertexShape = function(c, x, y, w, h)
  355. {
  356. c.translate(x, y);
  357. var minW = Math.max(w, 50);
  358. this.background(c, x, y, minW, h);
  359. };
  360. mxFloorplanStairs.prototype.background = function(c, x, y, w, h)
  361. {
  362. c.rect(0, 0, w, h);
  363. c.fillAndStroke();
  364. var step = 25;
  365. c.setShadow(false);
  366. c.begin();
  367. for (var i = 25; i < w; i = i + step)
  368. {
  369. c.moveTo(i, 0);
  370. c.lineTo(i, h);
  371. }
  372. c.stroke();
  373. c.begin();
  374. c.moveTo(0, h * 0.5);
  375. c.lineTo(w, h * 0.5);
  376. c.moveTo(w - step, 0);
  377. c.lineTo(w, h * 0.5);
  378. c.lineTo(w - step, h);
  379. c.stroke();
  380. };
  381. mxCellRenderer.registerShape(mxFloorplanStairs.prototype.cst.STAIRS, mxFloorplanStairs);
  382. //**********************************************************************************************************************************************************
  383. //Stairs Double
  384. //**********************************************************************************************************************************************************
  385. /**
  386. * Extends mxShape.
  387. */
  388. function mxFloorplanStairsRest(bounds, fill, stroke, strokewidth)
  389. {
  390. mxShape.call(this);
  391. this.bounds = bounds;
  392. this.fill = fill;
  393. this.stroke = stroke;
  394. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  395. };
  396. /**
  397. * Extends mxShape.
  398. */
  399. mxUtils.extend(mxFloorplanStairsRest, mxShape);
  400. mxFloorplanStairsRest.prototype.cst = {
  401. STAIRS : 'mxgraph.floorplan.stairsRest'
  402. };
  403. /**
  404. * Function: paintVertexShape
  405. *
  406. * Paints the vertex shape.
  407. */
  408. mxFloorplanStairsRest.prototype.paintVertexShape = function(c, x, y, w, h)
  409. {
  410. c.translate(x, y);
  411. var minW = Math.max(w, 50, h);
  412. var minH = Math.min(w, h);
  413. this.background(c, x, y, minW, h);
  414. };
  415. mxFloorplanStairsRest.prototype.background = function(c, x, y, w, h)
  416. {
  417. c.rect(0, 0, w, h);
  418. c.fillAndStroke();
  419. var step = 25;
  420. c.setShadow(false);
  421. c.begin();
  422. for (var i = 25; i < w - h * 0.5; i = i + step)
  423. {
  424. c.moveTo(i, 0);
  425. c.lineTo(i, h);
  426. }
  427. c.stroke();
  428. c.begin();
  429. c.moveTo(0, h * 0.5);
  430. c.lineTo(w, h * 0.5);
  431. c.moveTo(w, 0);
  432. c.lineTo(w - h * 0.5, h * 0.5);
  433. c.lineTo(w, h);
  434. c.moveTo(w - h * 0.5, 0);
  435. c.lineTo(w - h * 0.5, h);
  436. c.moveTo(0, h * 0.5);
  437. c.lineTo(w, h * 0.5);
  438. c.stroke();
  439. };
  440. mxCellRenderer.registerShape(mxFloorplanStairsRest.prototype.cst.STAIRS, mxFloorplanStairsRest);
  441. //**********************************************************************************************************************************************************
  442. //Stairs
  443. //**********************************************************************************************************************************************************
  444. /**
  445. * Extends mxShape.
  446. */
  447. function mxFloorplanStairsRest(bounds, fill, stroke, strokewidth)
  448. {
  449. mxShape.call(this);
  450. this.bounds = bounds;
  451. this.fill = fill;
  452. this.stroke = stroke;
  453. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  454. };
  455. /**
  456. * Extends mxShape.
  457. */
  458. mxUtils.extend(mxFloorplanStairsRest, mxShape);
  459. mxFloorplanStairsRest.prototype.cst = {
  460. STAIRS : 'mxgraph.floorplan.stairsRest'
  461. };
  462. /**
  463. * Function: paintVertexShape
  464. *
  465. * Paints the vertex shape.
  466. */
  467. mxFloorplanStairsRest.prototype.paintVertexShape = function(c, x, y, w, h)
  468. {
  469. c.translate(x, y);
  470. var minW = Math.max(w, 50, h);
  471. var minH = Math.min(w, h);
  472. this.background(c, x, y, minW, h);
  473. };
  474. mxFloorplanStairsRest.prototype.background = function(c, x, y, w, h)
  475. {
  476. c.rect(0, 0, w, h);
  477. c.fillAndStroke();
  478. var step = 25;
  479. c.setShadow(false);
  480. c.begin();
  481. for (var i = 25; i < w - h * 0.5; i = i + step)
  482. {
  483. c.moveTo(i, 0);
  484. c.lineTo(i, h);
  485. }
  486. c.stroke();
  487. c.begin();
  488. c.moveTo(0, h * 0.5);
  489. c.lineTo(w, h * 0.5);
  490. c.moveTo(w, 0);
  491. c.lineTo(w - h * 0.5, h * 0.5);
  492. c.lineTo(w, h);
  493. c.moveTo(w - h * 0.5, 0);
  494. c.lineTo(w - h * 0.5, h);
  495. c.moveTo(0, h * 0.5);
  496. c.lineTo(w, h * 0.5);
  497. c.stroke();
  498. };
  499. mxCellRenderer.registerShape(mxFloorplanStairsRest.prototype.cst.STAIRS, mxFloorplanStairsRest);
  500. //**********************************************************************************************************************************************************
  501. //Door, Left
  502. //**********************************************************************************************************************************************************
  503. /**
  504. * Extends mxShape.
  505. */
  506. function mxFloorplanDoorLeft(bounds, fill, stroke, strokewidth)
  507. {
  508. mxShape.call(this);
  509. this.bounds = bounds;
  510. this.fill = fill;
  511. this.stroke = stroke;
  512. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  513. };
  514. /**
  515. * Extends mxShape.
  516. */
  517. mxUtils.extend(mxFloorplanDoorLeft, mxShape);
  518. mxFloorplanDoorLeft.prototype.cst = {
  519. DOOR_LEFT : 'mxgraph.floorplan.doorLeft'
  520. };
  521. /**
  522. * Function: paintVertexShape
  523. *
  524. * Paints the vertex shape.
  525. */
  526. mxFloorplanDoorLeft.prototype.paintVertexShape = function(c, x, y, w, h)
  527. {
  528. c.translate(x, y);
  529. this.background(c, x, y, w, h);
  530. };
  531. mxFloorplanDoorLeft.prototype.background = function(c, x, y, w, h)
  532. {
  533. c.rect(0, 0, w, 5);
  534. c.fillAndStroke();
  535. c.begin();
  536. c.moveTo(w, 5);
  537. c.arcTo(w, w, 0, 0, 1, 0, 5 + w);
  538. c.lineTo(0, 5);
  539. c.stroke();
  540. };
  541. mxCellRenderer.registerShape(mxFloorplanDoorLeft.prototype.cst.DOOR_LEFT, mxFloorplanDoorLeft);
  542. //**********************************************************************************************************************************************************
  543. //Door, Right
  544. //**********************************************************************************************************************************************************
  545. /**
  546. * Extends mxShape.
  547. */
  548. function mxFloorplanDoorRight(bounds, fill, stroke, strokewidth)
  549. {
  550. mxShape.call(this);
  551. this.bounds = bounds;
  552. this.fill = fill;
  553. this.stroke = stroke;
  554. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  555. };
  556. /**
  557. * Extends mxShape.
  558. */
  559. mxUtils.extend(mxFloorplanDoorRight, mxShape);
  560. mxFloorplanDoorRight.prototype.cst = {
  561. DOOR_RIGHT : 'mxgraph.floorplan.doorRight'
  562. };
  563. /**
  564. * Function: paintVertexShape
  565. *
  566. * Paints the vertex shape.
  567. */
  568. mxFloorplanDoorRight.prototype.paintVertexShape = function(c, x, y, w, h)
  569. {
  570. c.translate(x, y);
  571. this.background(c, x, y, w, h);
  572. };
  573. mxFloorplanDoorRight.prototype.background = function(c, x, y, w, h)
  574. {
  575. c.rect(0, 0, w, 5);
  576. c.fillAndStroke();
  577. c.begin();
  578. c.moveTo(0, 5);
  579. c.arcTo(w, w, 0, 0, 0, w, 5 + w);
  580. c.lineTo(w, 5);
  581. c.stroke();
  582. };
  583. mxCellRenderer.registerShape(mxFloorplanDoorRight.prototype.cst.DOOR_RIGHT, mxFloorplanDoorRight);
  584. //**********************************************************************************************************************************************************
  585. //Door, Double
  586. //**********************************************************************************************************************************************************
  587. /**
  588. * Extends mxShape.
  589. */
  590. function mxFloorplanDoorDouble(bounds, fill, stroke, strokewidth)
  591. {
  592. mxShape.call(this);
  593. this.bounds = bounds;
  594. this.fill = fill;
  595. this.stroke = stroke;
  596. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  597. };
  598. /**
  599. * Extends mxShape.
  600. */
  601. mxUtils.extend(mxFloorplanDoorDouble, mxShape);
  602. mxFloorplanDoorDouble.prototype.cst = {
  603. DOOR_DOUBLE : 'mxgraph.floorplan.doorDouble'
  604. };
  605. /**
  606. * Function: paintVertexShape
  607. *
  608. * Paints the vertex shape.
  609. */
  610. mxFloorplanDoorDouble.prototype.paintVertexShape = function(c, x, y, w, h)
  611. {
  612. c.translate(x, y);
  613. this.background(c, x, y, w, h);
  614. };
  615. mxFloorplanDoorDouble.prototype.background = function(c, x, y, w, h)
  616. {
  617. var halfW = w * 0.5;
  618. c.rect(0, 0, w, 5);
  619. c.fillAndStroke();
  620. c.begin();
  621. c.moveTo(halfW, 0);
  622. c.lineTo(halfW, 5);
  623. c.moveTo(halfW, 5);
  624. c.arcTo(halfW, halfW, 0, 0, 1, 0, 5 + halfW);
  625. c.lineTo(0, 5);
  626. c.moveTo(halfW, 5);
  627. c.arcTo(halfW, halfW, 0, 0, 0, w, 5 + halfW);
  628. c.lineTo(w, 5);
  629. c.stroke();
  630. };
  631. mxCellRenderer.registerShape(mxFloorplanDoorDouble.prototype.cst.DOOR_DOUBLE, mxFloorplanDoorDouble);