mxCisco19.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. /**
  2. * Copyright (c) 2006-2020, JGraph Holdings Ltd
  3. */
  4. //**********************************************************************************************************************************************************
  5. //rect
  6. //**********************************************************************************************************************************************************
  7. /**
  8. * Extends mxShape.
  9. */
  10. function mxShapeCisco19Rect(bounds, fill, stroke, strokewidth)
  11. {
  12. mxShape.call(this);
  13. this.bounds = bounds;
  14. this.fill = fill;
  15. this.stroke = stroke;
  16. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  17. };
  18. /**
  19. * Extends mxShape.
  20. */
  21. mxUtils.extend(mxShapeCisco19Rect, mxShape);
  22. mxShapeCisco19Rect.prototype.cst = {
  23. SHAPE_RECT : 'mxgraph.cisco19.rect'
  24. };
  25. /**
  26. * Function: paintVertexShape
  27. *
  28. * Paints the vertex shape.
  29. */
  30. mxShapeCisco19Rect.prototype.paintVertexShape = function(c, x, y, w, h)
  31. {
  32. var prIcon = mxUtils.getValue(this.state.style, 'prIcon', 'l2_switch');
  33. var fillColor = mxUtils.getValue(this.state.style, 'fillColor', '#ffffff');
  34. var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', '#000000');
  35. var bgIcon = 'mxgraph.cisco19.bg1';
  36. var circleBg = ['router', 'csr_1000v', 'wireless_router', 'l3_modular3', 'ucs_express', 'router_with_voice', 'router_with_firewall', 'netflow_router', 'secure_router', 'ip_telephone_router', 'asr_9000', 'clock', 'vbond', 'vmanage', 'vsmart', 'vts2'];
  37. c.translate(x, y);
  38. if (['l2_modular', 'l3_modular', '6500_vss', 'nexus_9500', 'nexus_7k'].includes(prIcon)) // square with 1 hor rect on top
  39. {
  40. bgIcon = 'mxgraph.cisco19.bg2';
  41. }
  42. else if (['l2_switch_with_dual_supervisor', 'l3_switch_with_dual_supervisor'].includes(prIcon)) //square with 2 hor rects on top
  43. {
  44. bgIcon = 'mxgraph.cisco19.bg3';
  45. }
  46. else if (['l2_modular2'].includes(prIcon)) // vert 2 rects
  47. {
  48. bgIcon = 'mxgraph.cisco19.bg4';
  49. }
  50. else if (['l3_modular2', '6500_vss2', 'hypervisor', 'collab1'].includes(prIcon)) // vert rect
  51. {
  52. bgIcon = 'mxgraph.cisco19.bg5';
  53. }
  54. else if (circleBg.includes(prIcon)) // circle
  55. {
  56. c.begin();
  57. if (prIcon == 'wireless_router')
  58. {
  59. c.ellipse(0, h * 0.17, w, h * 0.83);
  60. }
  61. else
  62. {
  63. c.ellipse(0, 0, w, h);
  64. }
  65. c.fill();
  66. }
  67. else if (['content_router', 'router_with_firewall2', 'netflow_router2', 'nam_virtual_service_blade', 'ucs_5108_blade_chassis', 'storage', 'nexus_1kv_vsm', 'nexus_1k', 'nexus_1010', 'dual mode access point', 'wireless_lan_controller', 'primary_codec', 'virtual_desktop_service', 'video_gateway', 'video_analytics', 'telepresence_exchange', 'meeting_scheduling_and_management_server', 'content_recording_streaming_server', 'communications_manager', 'cisco_unified_presence_service', 'cisco_unified_contact_center_enterprise_and_hosted', 'h323', 'monitor', 'telepresence_endpoint_twin_data_display', 'operations_manager', 'transcoder', 'contact_center_express', 'ip_ip_gateway', 'shield', 'set_top', 'da_encoder', 'ad_encoder', 'da_decoder', 'ad_decoder', 'acs', 'email_security', 'vpn_concentrator', 'ssl_terminator', 'cisco_security_manager', 'web_security', 'nac_appliance', 'ironport', 'ips_ids', 'firewall', 'asa_5500', 'flow_collector', 'load_balancer', 'web_application_firewall', 'analysis_correlation', 'flow_analytics', 'virtual_private_network2', 'web_security_services', 'web_security_services2', 'virtual_private_network_connector'].includes(prIcon)) //hor. rect
  68. {
  69. bgIcon = 'mxgraph.cisco19.bg6';
  70. }
  71. else if (['asr_1000'].includes(prIcon)) //hexagon
  72. {
  73. bgIcon = 'mxgraph.cisco19.bg7';
  74. }
  75. else if (['fibre_channel_director_mds_9000', 'fibre_channel_fabric_switch'].includes(prIcon)) // square with 1 hor rect at the bottom
  76. {
  77. bgIcon = 'mxgraph.cisco19.bg8';
  78. }
  79. else if (['ucs_c_series_server'].includes(prIcon)) // narrow hor rect
  80. {
  81. bgIcon = 'mxgraph.cisco19.bg9';
  82. }
  83. else if (['aci'].includes(prIcon) || ['aci2'].includes(prIcon)) // background specific for ACI
  84. {
  85. var frame = mxStencilRegistry.getStencil('mxgraph.cisco19.acibg');
  86. frame.drawShape(c, this, w * 0.195, h * 0.195, w * 0.61, h * 0.61);
  87. }
  88. else if (['immersive_telepresence_endpoint'].includes(prIcon)) // extra wide rect
  89. {
  90. bgIcon = 'mxgraph.cisco19.bg10';
  91. }
  92. if (!circleBg.includes(prIcon) && prIcon != 'aci' && prIcon != 'aci2')
  93. {
  94. var frame = mxStencilRegistry.getStencil(bgIcon);
  95. if (frame != null)
  96. {
  97. frame.drawShape(c, this, 0, 0, w, h);
  98. }
  99. }
  100. c.setShadow(false);
  101. var prStencil = mxStencilRegistry.getStencil('mxgraph.cisco19.' + prIcon);
  102. c.setFillColor(strokeColor);
  103. if (prStencil != null)
  104. {
  105. prStencil.drawShape(c, this, 0, 0, w, h);
  106. }
  107. };
  108. mxCellRenderer.registerShape(mxShapeCisco19Rect.prototype.cst.SHAPE_RECT, mxShapeCisco19Rect);
  109. mxShapeCisco19Rect.prototype.getConstraints = function(style, w, h)
  110. {
  111. var constr = [];
  112. constr.push(new mxConnectionConstraint(new mxPoint(0.825, 0.5), false));
  113. constr.push(new mxConnectionConstraint(new mxPoint(0.175, 0.5), false));
  114. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0.16), false));
  115. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0.84), false));
  116. constr.push(new mxConnectionConstraint(new mxPoint(0.66, 0.17), false));
  117. constr.push(new mxConnectionConstraint(new mxPoint(0.66, 0.83), false));
  118. constr.push(new mxConnectionConstraint(new mxPoint(0.34, 0.17), false));
  119. constr.push(new mxConnectionConstraint(new mxPoint(0.34, 0.83), false));
  120. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0.33), false));
  121. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0.67), false));
  122. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0.33), false));
  123. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0.67), false));
  124. return (constr);
  125. };