Sidebar-Cabinet.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239
  1. (function()
  2. {
  3. // Adds Cabinets shapes
  4. Sidebar.prototype.addCabinetsPalette = function()
  5. {
  6. var s = mxConstants.STYLE_VERTICAL_LABEL_POSITION + '=bottom;dashed=0;shadow=0;strokeColor=#000000;fillColor=#ffffff;html=1;align=center;' + mxConstants.STYLE_VERTICAL_ALIGN + '=top;' + mxConstants.STYLE_STROKEWIDTH + '=1;shape=mxgraph.cabinets.';
  7. var s2 = mxConstants.STYLE_VERTICAL_LABEL_POSITION + '=middle;dashed=0;shadow=0;strokeColor=#000000;fillColor=#ffffff;html=1;' + mxConstants.STYLE_STROKEWIDTH + '=1;shape=mxgraph.cabinets.';
  8. var w = 50;
  9. var h = 50;
  10. var gn = 'mxgraph.cabinets';
  11. var dt = 'cabinet ';
  12. var sb = this;
  13. var fns =
  14. [
  15. this.createVertexTemplateEntry(s + 'cabinet;hasStand=1',
  16. w * 5, h * 10, '', 'Cabinet', null, null, this.getTagsForStencil(gn, 'cabinet', dt).join(' ')),
  17. this.createVertexTemplateEntry(s2 + 'dimension;verticalAlign=top;align=center;',
  18. w * 5, 40, '100', 'Dimension', null, null, this.getTagsForStencil(gn, 'dimension', dt).join(' ')),
  19. this.createVertexTemplateEntry(s2 + 'dimensionBottom;verticalAlign=bottom;align=center;',
  20. w * 5, 40, '100', 'Dimension', null, null, this.getTagsForStencil(gn, 'dimensionBottom', dt).join(' ')),
  21. this.createVertexTemplateEntry(s + 'coverPlate',
  22. w * 4.4, h * 2.5, '', 'Cover Plate', null, null, this.getTagsForStencil(gn, 'coverPlate', dt).join(' ')),
  23. this.createVertexTemplateEntry('shape=rect;dashed=0;shadow=0;html=1;whiteSpace=wrap;',
  24. w * 4.4, h * 0.25, '25x40', 'Panel Wiring System 25x40mm', null, null, this.getTagsForStencil(gn, '', dt + 'panel wiring system').join(' ')),
  25. this.createVertexTemplateEntry('shape=rect;dashed=0;shadow=0;html=1;whiteSpace=wrap;',
  26. w * 4.4, h * 0.4, '40x40', 'Panel Wiring System 40x40mm', null, null, this.getTagsForStencil(gn, '', dt + 'panel wiring system').join(' ')),
  27. this.createVertexTemplateEntry('shape=rect;dashed=0;shadow=0;html=1;whiteSpace=wrap;',
  28. w * 4.4, h * 0.6, '60x40', 'Panel Wiring System 60x40mm', null, null, this.getTagsForStencil(gn, '', dt + 'panel wiring system').join(' ')),
  29. this.createVertexTemplateEntry('shape=rect;dashed=0;shadow=0;html=1;whiteSpace=wrap;',
  30. w * 4.4, h * 0.8, '80x40', 'Panel Wiring System 80x40mm', null, null, this.getTagsForStencil(gn, '', dt + 'panel wiring system').join(' ')),
  31. this.createVertexTemplateEntry('shape=rect;dashed=0;shadow=0;html=1;whiteSpace=wrap;',
  32. w * 4.4, h, '100x40', 'Panel Wiring System 100x40mm', null, null, this.getTagsForStencil(gn, '', dt + 'panel wiring system').join(' ')),
  33. this.createVertexTemplateEntry('shape=rect;dashed=0;shadow=0;html=1;whiteSpace=wrap;rotation=270',
  34. w * 7, h * 0.25, '25x40', 'Panel Wiring System 25x40mm (Vertical)', null, null, this.getTagsForStencil(gn, '', dt + 'panel wiring system').join(' ')),
  35. this.createVertexTemplateEntry('shape=rect;dashed=0;shadow=0;html=1;whiteSpace=wrap;rotation=270',
  36. w * 7, h * 0.4, '40x40', 'Panel Wiring System 40x40mm (Vertical)', null, null, this.getTagsForStencil(gn, '', dt + 'panel wiring system').join(' ')),
  37. this.createVertexTemplateEntry('shape=rect;dashed=0;shadow=0;html=1;whiteSpace=wrap;rotation=270',
  38. w * 7, h * 0.6, '60x40', 'Panel Wiring System 60x40mm (Vertical)', null, null, this.getTagsForStencil(gn, '', dt + 'panel wiring system').join(' ')),
  39. this.createVertexTemplateEntry('shape=rect;dashed=0;shadow=0;html=1;whiteSpace=wrap;rotation=270',
  40. w * 7, h * 0.8, '80x40', 'Panel Wiring System 80x40mm (Vertical)', null, null, this.getTagsForStencil(gn, '', dt + 'panel wiring system').join(' ')),
  41. this.createVertexTemplateEntry('shape=rect;dashed=0;shadow=0;html=1;whiteSpace=wrap;rotation=270',
  42. w * 7, h, '100x40', 'Panel Wiring System 100x40mm (Vertical)', null, null, this.getTagsForStencil(gn, '', dt + 'panel wiring system').join(' ')),
  43. this.createVertexTemplateEntry(s + 'cb_1p;',
  44. w * 0.18, h, '', 'Circuit Breaker (1P)', null, null, this.getTagsForStencil(gn, 'cb_1p', dt).join(' ')),
  45. this.addEntry(dt + 'circuit breaker row', function()
  46. {
  47. var bg1 = new mxCell('', new mxGeometry(0, 0, w * 0.18, h), s + 'cb_1p;');
  48. bg1.vertex = true;
  49. var bg2 = new mxCell('', new mxGeometry(w * 0.18, 0, w * 0.18, h), s + 'cb_1p;');
  50. bg2.vertex = true;
  51. var bg3 = new mxCell('', new mxGeometry(w * 0.36, 0, w * 0.18, h), s + 'cb_1p;');
  52. bg3.vertex = true;
  53. var bg4 = new mxCell('', new mxGeometry(w * 0.54, 0, w * 0.18, h), s + 'cb_1p;');
  54. bg4.vertex = true;
  55. var bg5 = new mxCell('', new mxGeometry(w * 0.72, 0, w * 0.18, h), s + 'cb_1p;');
  56. bg5.vertex = true;
  57. var bg6 = new mxCell('', new mxGeometry(w * 0.9, 0, w * 0.18, h), s + 'cb_1p;');
  58. bg6.vertex = true;
  59. var bg7 = new mxCell('', new mxGeometry(w * 1.08, 0, w * 0.18, h), s + 'cb_1p;');
  60. bg7.vertex = true;
  61. var bg8 = new mxCell('', new mxGeometry(w * 1.26, 0, w * 0.18, h), s + 'cb_1p;');
  62. bg8.vertex = true;
  63. var bg9 = new mxCell('', new mxGeometry(w * 1.44, 0, w * 0.18, h), s + 'cb_1p;');
  64. bg9.vertex = true;
  65. var bg10 = new mxCell('', new mxGeometry(w * 1.62, 0, w * 0.18, h), s + 'cb_1p;');
  66. bg10.vertex = true;
  67. return sb.createVertexTemplateFromCells([bg1, bg2, bg3, bg4, bg5, bg6, bg7, bg8, bg9, bg10], w * 1.8, h, 'Circuit Breaker (1P x 10)');
  68. }),
  69. this.createVertexTemplateEntry(s + 'cb_2p;', w * 0.36, h, '', 'Circuit Breaker (2P)', null, null, this.getTagsForStencil(gn, 'cb_2p', dt).join(' ')),
  70. this.addEntry(dt + 'circuit breaker row', function()
  71. {
  72. var bg1 = new mxCell('', new mxGeometry(0, 0, w * 0.36, h), s + 'cb_2p;');
  73. bg1.vertex = true;
  74. var bg2 = new mxCell('', new mxGeometry(w * 0.36, 0, w * 0.36, h), s + 'cb_2p;');
  75. bg2.vertex = true;
  76. var bg3 = new mxCell('', new mxGeometry(w * 0.72, 0, w * 0.36, h), s + 'cb_2p;');
  77. bg3.vertex = true;
  78. var bg4 = new mxCell('', new mxGeometry(w * 1.08, 0, w * 0.36, h), s + 'cb_2p;');
  79. bg4.vertex = true;
  80. var bg5 = new mxCell('', new mxGeometry(w * 1.44, 0, w * 0.36, h), s + 'cb_2p;');
  81. bg5.vertex = true;
  82. var bg6 = new mxCell('', new mxGeometry(w * 1.8, 0, w * 0.36, h), s + 'cb_2p;');
  83. bg6.vertex = true;
  84. var bg7 = new mxCell('', new mxGeometry(w * 2.16, 0, w * 0.36, h), s + 'cb_2p;');
  85. bg7.vertex = true;
  86. var bg8 = new mxCell('', new mxGeometry(w * 2.52, 0, w * 0.36, h), s + 'cb_2p;');
  87. bg8.vertex = true;
  88. var bg9 = new mxCell('', new mxGeometry(w * 2.88, 0, w * 0.36, h), s + 'cb_2p;');
  89. bg9.vertex = true;
  90. var bg10 = new mxCell('', new mxGeometry(w * 3.24, 0, w * 0.36, h), s + 'cb_2p;');
  91. bg10.vertex = true;
  92. return sb.createVertexTemplateFromCells([bg1, bg2, bg3, bg4, bg5, bg6, bg7, bg8, bg9, bg10], w * 3.6, h, 'Circuit Breaker (2P x 10)');
  93. }),
  94. this.createVertexTemplateEntry(s + 'cb_3p;', w * 0.54, h, '', 'Circuit Breaker (3P)', null, null, this.getTagsForStencil(gn, 'cb_3p', dt).join(' ')),
  95. this.addEntry(dt + 'circuit breaker row', function()
  96. {
  97. var bg1 = new mxCell('', new mxGeometry(0, 0, w * 0.54, h), s + 'cb_3p;');
  98. bg1.vertex = true;
  99. var bg2 = new mxCell('', new mxGeometry(w * 0.54, 0, w * 0.54, h), s + 'cb_3p;');
  100. bg2.vertex = true;
  101. var bg3 = new mxCell('', new mxGeometry(w * 1.08, 0, w * 0.54, h), s + 'cb_3p;');
  102. bg3.vertex = true;
  103. var bg4 = new mxCell('', new mxGeometry(w * 1.62, 0, w * 0.54, h), s + 'cb_3p;');
  104. bg4.vertex = true;
  105. var bg5 = new mxCell('', new mxGeometry(w * 2.16, 0, w * 0.54, h), s + 'cb_3p;');
  106. bg5.vertex = true;
  107. return sb.createVertexTemplateFromCells([bg1, bg2, bg3, bg4, bg5], w * 2.7, h, 'Circuit Breaker (3P x 5)');
  108. }),
  109. this.createVertexTemplateEntry(s + 'cb_4p;', w * 0.72, h, '', 'Circuit Breaker (4P)', null, null, this.getTagsForStencil(gn, 'cb_4p', dt).join(' ')),
  110. this.addEntry(dt + 'circuit breaker row', function()
  111. {
  112. var bg1 = new mxCell('', new mxGeometry(0, 0, w * 0.72, h), s + 'cb_4p;');
  113. bg1.vertex = true;
  114. var bg2 = new mxCell('', new mxGeometry(w * 0.72, 0, w * 0.72, h), s + 'cb_4p;');
  115. bg2.vertex = true;
  116. var bg3 = new mxCell('', new mxGeometry(w * 1.44, 0, w * 0.72, h), s + 'cb_4p;');
  117. bg3.vertex = true;
  118. var bg4 = new mxCell('', new mxGeometry(w * 2.16, 0, w * 0.72, h), s + 'cb_4p;');
  119. bg4.vertex = true;
  120. var bg5 = new mxCell('', new mxGeometry(w * 2.88, 0, w * 0.72, h), s + 'cb_4p;');
  121. bg5.vertex = true;
  122. return sb.createVertexTemplateFromCells([bg1, bg2, bg3, bg4, bg5], w * 3.6, h, 'Circuit Breaker (4P x 5)');
  123. }),
  124. this.createVertexTemplateEntry(s + 'cb_auxiliary_contact;',
  125. w * 0.09, h, '', 'Auxiliary Contact (Circuit Breaker)', null, null, this.getTagsForStencil(gn, 'cb_auxiliary_contact', dt).join(' ')),
  126. this.createVertexTemplateEntry(s + 'contactor_1_32a;',
  127. w * 0.54, h * 0.86, '', 'Contactor (1-32A)', null, null, this.getTagsForStencil(gn, 'contactor_1_32a', dt).join(' ')),
  128. this.createVertexTemplateEntry(s + 'auxiliary_contact_contactor_1_32a;',
  129. w * 0.09, h * 0.86, '', 'Auxiliary Contact (Contactor 1-32A)', null, null, this.getTagsForStencil(gn, 'auxiliary_contact_contactor_1_32a', dt).join(' ')),
  130. this.createVertexTemplateEntry(s + 'contactor_32_125a;',
  131. w * 0.6, h, '', 'Contactor 32 to 125A', null, null, this.getTagsForStencil(gn, 'contactor_32_125a', dt).join(' ')),
  132. this.createVertexTemplateEntry(s + 'auxiliary_contact_contactor_32_125a;',
  133. w * 0.09, h, '', 'Auxiliary Contact (Contactor 32-125A)', null, null, this.getTagsForStencil(gn, 'auxiliary_contact_contactor_32_125a', dt).join(' ')),
  134. this.createVertexTemplateEntry(s + 'contactor_125_400a;',
  135. w * 1.1, h * 1.8, '', 'Contactor 125 to 400A', null, null, this.getTagsForStencil(gn, 'contactor_125_400a', dt).join(' ')),
  136. this.createVertexTemplateEntry(s + 'distribution_block_4p_125a_11_connections;',
  137. w * 2, h * 1.2, '', 'Distribution Block 4P 125A 11 Connections', null, null, this.getTagsForStencil(gn, 'distribution_block_4p_125a_11_connections', dt).join(' ')),
  138. this.createVertexTemplateEntry(s + 'distribution_block_4p_125a_11_connections_2;',
  139. w * 2, h, '', 'Distribution Block 4P 125A 11 Connections', null, null, this.getTagsForStencil(gn, 'distribution_block_4p_125a_11_connections_2', dt).join(' ')),
  140. this.createVertexTemplateEntry(s + 'mccb_25_63a_3p;',
  141. w * 1.2, h * 1.8, '', 'MCCB 25-63A 3P', null, null, this.getTagsForStencil(gn, 'mccb_25_63a_3p', dt).join(' ')),
  142. this.createVertexTemplateEntry(s + 'mccb_25_63a_4p;',
  143. w * 1.6, h * 1.8, '', 'MCCB 25-63A 4P', null, null, this.getTagsForStencil(gn, 'mccb_25_63a_4p', dt).join(' ')),
  144. this.createVertexTemplateEntry(s + 'mccb_63_250a_3p;',
  145. w * 1.4, h * 2.1, '', 'MCCB 63-250A 3P', null, null, this.getTagsForStencil(gn, 'mccb_63_250a_3p', dt).join(' ')),
  146. this.createVertexTemplateEntry(s + 'mccb_63_250a_4p;',
  147. w * 1.9, h * 2.1, '', 'MCCB 63-250A 4P', null, null, this.getTagsForStencil(gn, 'mccb_63_250a_4p', dt).join(' ')),
  148. this.createVertexTemplateEntry(s + 'motorized_switch_3p;',
  149. w * 1.7, h * 1.4, '', 'Motorized Switch 3P', null, null, this.getTagsForStencil(gn, 'motorized_switch_3p', dt).join(' ')),
  150. this.createVertexTemplateEntry(s + 'motorized_switch_4p;',
  151. w * 2, h * 1.4, '', 'Motorized Switch 4P', null, null, this.getTagsForStencil(gn, 'motorized_switch_4p', dt).join(' ')),
  152. this.createVertexTemplateEntry(s + 'motor_cb_1_32a;',
  153. w * 0.54, h * 0.86, '', 'Motor Circuit Breaker 1-32A', null, null, this.getTagsForStencil(gn, 'motor_cb_1_32a', dt).join(' ')),
  154. this.createVertexTemplateEntry(s + 'motor_cb_32_125a;',
  155. w * 0.6, h, '', 'Motor Circuit Breaker 32-125A', null, null, this.getTagsForStencil(gn, 'motor_cb_32_125a', dt).join(' ')),
  156. this.createVertexTemplateEntry(s + 'motor_cb_125_400a;',
  157. w * 1.1, h * 1.8, '', 'Motor Circuit Breaker 125-400A', null, null, this.getTagsForStencil(gn, 'motor_cb_125_400a', dt).join(' ')),
  158. this.createVertexTemplateEntry(s + 'motor_protection_cb;',
  159. w * 0.54, h, '', 'Motor Protection CB', null, null, this.getTagsForStencil(gn, 'motor_protection_cb', dt).join(' ')),
  160. this.createVertexTemplateEntry(s + 'motor_starter_1_32a;',
  161. w * 0.54, h * 0.86, '', 'Motor Circuit Breaker 1-32A', null, null, this.getTagsForStencil(gn, 'motor_starter_1_32a', dt).join(' ')),
  162. this.createVertexTemplateEntry(s + 'motor_starter_32_125a;',
  163. w * 0.6, h, '', 'Motor Circuit Breaker 32-125A', null, null, this.getTagsForStencil(gn, 'motor_starter_32_125a', dt).join(' ')),
  164. this.createVertexTemplateEntry(s + 'motor_starter_125_400a;',
  165. w * 1.1, h * 1.8, '', 'Motor Circuit Breaker 125-400A', null, null, this.getTagsForStencil(gn, 'motor_starter_125_400a', dt).join(' ')),
  166. this.createVertexTemplateEntry(s + 'overcurrent_relay_1_32a;',
  167. w * 0.54, h * 0.3, '', 'Overcurrent Relay 1-32A', null, null, this.getTagsForStencil(gn, 'overcurrent_relay_1_32a', dt).join(' ')),
  168. this.createVertexTemplateEntry(s + 'overcurrent_relay_32_125a;',
  169. w * 0.6, h * 0.33, '', 'Overcurrent Relay 32-125A', null, null, this.getTagsForStencil(gn, 'overcurrent_relay_32_125a', dt).join(' ')),
  170. this.createVertexTemplateEntry(s + 'overcurrent_relay_125_400a;',
  171. w * 1.1, h * 0.6, '', 'Overcurrent Relay 125-400A', null, null, this.getTagsForStencil(gn, 'overcurrent_relay_125_400a', dt).join(' ')),
  172. this.createVertexTemplateEntry(s + 'plugin_relay_1;',
  173. w * 0.06, h * 0.8, '', 'Plugin Relay', null, null, this.getTagsForStencil(gn, 'plugin_relay_1', dt).join(' ')),
  174. this.createVertexTemplateEntry(s + 'plugin_relay_2;',
  175. w * 0.24, h * 0.8, '', 'Plugin Relay', null, null, this.getTagsForStencil(gn, 'plugin_relay_2', dt).join(' ')),
  176. this.createVertexTemplateEntry(s + 'din_rail;',
  177. w * 10, h * 0.5, '', 'DIN Rail', null, null, this.getTagsForStencil(gn, 'din_rail', dt).join(' ')),
  178. this.createVertexTemplateEntry(s + 'residual_current_device_2p;',
  179. w * 0.36, h, '', 'Residual Current Device 2p', null, null, this.getTagsForStencil(gn, 'residual_current_device_2p', dt).join(' ')),
  180. this.createVertexTemplateEntry(s + 'residual_current_device_4p;',
  181. w * 0.72, h, '', 'Residual Current Device 4p', null, null, this.getTagsForStencil(gn, 'residual_current_device_4p', dt).join(' ')),
  182. this.createVertexTemplateEntry(s + 'surge_protection_1p;',
  183. w * 0.18, h, '', 'Surge Protection 1p', null, null, this.getTagsForStencil(gn, 'surge_protection_1p', dt).join(' ')),
  184. this.createVertexTemplateEntry(s + 'surge_protection_2p;',
  185. w * 0.36, h, '', 'Surge Protection 2p', null, null, this.getTagsForStencil(gn, 'surge_protection_2p', dt).join(' ')),
  186. this.createVertexTemplateEntry(s + 'surge_protection_3p;',
  187. w * 0.54, h, '', 'Surge Protection 3p', null, null, this.getTagsForStencil(gn, 'surge_protection_3p', dt).join(' ')),
  188. this.createVertexTemplateEntry(s + 'surge_protection_4p;',
  189. w * 0.72, h, '', 'Surge Protection 4p', null, null, this.getTagsForStencil(gn, 'surge_protection_4p', dt).join(' ')),
  190. this.createVertexTemplateEntry(s + 'terminal_4mm2;',
  191. w * 0.05, h * 0.5, '', 'Terminal 4mm2', null, null, this.getTagsForStencil(gn, 'terminal_4mm2', dt).join(' ')),
  192. this.createVertexTemplateEntry(s + 'terminal_4mm2_x10;',
  193. w * 0.5, h * 0.5, '', 'Terminal 4mm2 x10', null, null, this.getTagsForStencil(gn, 'terminal_4mm2_x10', dt).join(' ')),
  194. this.createVertexTemplateEntry(s + 'terminal_4_6mm2;',
  195. w * 0.05, h * 0.6, '', 'Terminal 4-6mm2', null, null, this.getTagsForStencil(gn, 'terminal_4_6mm2', dt).join(' ')),
  196. this.createVertexTemplateEntry(s + 'terminal_4_6mm2_x10;',
  197. w * 0.5, h * 0.6, '', 'Terminal 4-6mm2 x10', null, null, this.getTagsForStencil(gn, 'terminal_4_6mm2_x10', dt).join(' ')),
  198. this.createVertexTemplateEntry(s + 'terminal_6_25mm2;',
  199. w * 0.1, h * 0.75, '', 'Terminal 6-25mm2', null, null, this.getTagsForStencil(gn, 'terminal_6_25mm2', dt).join(' ')),
  200. this.createVertexTemplateEntry(s + 'terminal_6_25mm2_x10;',
  201. w, h * 0.75, '', 'Terminal 6-25mm2 x10', null, null, this.getTagsForStencil(gn, 'terminal_6_25mm2_x10', dt).join(' ')),
  202. this.createVertexTemplateEntry(s + 'terminal_40mm2;',
  203. w * 0.22, h, '', 'Terminal 40mm2', null, null, this.getTagsForStencil(gn, 'terminal_40mm2', dt).join(' ')),
  204. this.createVertexTemplateEntry(s + 'terminal_40mm2_x10;',
  205. w * 2.2, h, '', 'Terminal 40mm2 x10', null, null, this.getTagsForStencil(gn, 'terminal_40mm2_x10', dt).join(' ')),
  206. this.createVertexTemplateEntry(s + 'terminal_50mm2;',
  207. w * 0.25, h * 1.1, '', 'Terminal 50mm2', null, null, this.getTagsForStencil(gn, 'terminal_50mm2', dt).join(' ')),
  208. this.createVertexTemplateEntry(s + 'terminal_50mm2_x10;',
  209. w * 2.5, h * 1.1, '', 'Terminal 50mm2 x10', null, null, this.getTagsForStencil(gn, 'terminal_50mm2_x10', dt).join(' ')),
  210. this.createVertexTemplateEntry(s + 'terminal_75mm2;',
  211. w * 0.3, h * 1.4, '', 'Terminal 75mm2', null, null, this.getTagsForStencil(gn, 'terminal_75mm2', dt).join(' ')),
  212. this.createVertexTemplateEntry(s + 'terminal_75mm2_x10;',
  213. w * 3, h * 1.4, '', 'Terminal 75mm2 x10', null, null, this.getTagsForStencil(gn, 'terminal_75mm2_x10', dt).join(' '))
  214. ];
  215. this.addPalette('cabinets', mxResources.get('cabinets'), false, mxUtils.bind(this, function(content)
  216. {
  217. for (var i = 0; i < fns.length; i++)
  218. {
  219. content.appendChild(fns[i](content));
  220. }
  221. }));
  222. };
  223. })();