mxCisco19.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /**
  2. * $Id: mxCisco19.js,v 1.0 2019/12/10 13:05:39 mate Exp $
  3. * Copyright (c) 2006-2020, JGraph Ltd
  4. */
  5. //**********************************************************************************************************************************************************
  6. //rect
  7. //**********************************************************************************************************************************************************
  8. /**
  9. * Extends mxShape.
  10. */
  11. function mxShapeCisco19Rect(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(mxShapeCisco19Rect, mxShape);
  23. mxShapeCisco19Rect.prototype.cst = {
  24. SHAPE_RECT : 'mxgraph.cisco19.rect'
  25. };
  26. /**
  27. * Function: paintVertexShape
  28. *
  29. * Paints the vertex shape.
  30. */
  31. mxShapeCisco19Rect.prototype.paintVertexShape = function(c, x, y, w, h)
  32. {
  33. var prIcon = mxUtils.getValue(this.state.style, 'prIcon', 'l2_switch');
  34. var fillColor = mxUtils.getValue(this.state.style, 'fillColor', '#ffffff');
  35. var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', '#000000');
  36. var bgIcon = 'mxgraph.cisco19.bg1';
  37. 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'];
  38. c.translate(x, y);
  39. if (['l2_modular', 'l3_modular', '6500_vss', 'nexus_9500', 'nexus_7k'].includes(prIcon)) // square with 1 hor rect on top
  40. {
  41. bgIcon = 'mxgraph.cisco19.bg2';
  42. }
  43. else if (['l2_switch_with_dual_supervisor', 'l3_switch_with_dual_supervisor'].includes(prIcon)) //square with 2 hor rects on top
  44. {
  45. bgIcon = 'mxgraph.cisco19.bg3';
  46. }
  47. else if (['l2_modular2'].includes(prIcon)) // vert 2 rects
  48. {
  49. bgIcon = 'mxgraph.cisco19.bg4';
  50. }
  51. else if (['l3_modular2', '6500_vss2', 'hypervisor', 'collab1'].includes(prIcon)) // vert rect
  52. {
  53. bgIcon = 'mxgraph.cisco19.bg5';
  54. }
  55. else if (circleBg.includes(prIcon)) // circle
  56. {
  57. c.begin();
  58. if (prIcon == 'wireless_router')
  59. {
  60. c.ellipse(0, h * 0.17, w, h * 0.83);
  61. }
  62. else
  63. {
  64. c.ellipse(0, 0, w, h);
  65. }
  66. c.fill();
  67. }
  68. 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
  69. {
  70. bgIcon = 'mxgraph.cisco19.bg6';
  71. }
  72. else if (['asr_1000'].includes(prIcon)) //hexagon
  73. {
  74. bgIcon = 'mxgraph.cisco19.bg7';
  75. }
  76. else if (['fibre_channel_director_mds_9000', 'fibre_channel_fabric_switch'].includes(prIcon)) // square with 1 hor rect at the bottom
  77. {
  78. bgIcon = 'mxgraph.cisco19.bg8';
  79. }
  80. else if (['ucs_c_series_server'].includes(prIcon)) // narrow hor rect
  81. {
  82. bgIcon = 'mxgraph.cisco19.bg9';
  83. }
  84. else if (['aci'].includes(prIcon)) // background specific for ACI
  85. {
  86. var frame = mxStencilRegistry.getStencil('mxgraph.cisco19.acibg');
  87. frame.drawShape(c, this, w * 0.195, h * 0.195, w * 0.61, h * 0.61);
  88. }
  89. else if (['immersive_telepresence_endpoint'].includes(prIcon)) // extra wide rect
  90. {
  91. bgIcon = 'mxgraph.cisco19.bg10';
  92. }
  93. if (!circleBg.includes(prIcon) && prIcon != 'aci')
  94. {
  95. var frame = mxStencilRegistry.getStencil(bgIcon);
  96. if (frame != null)
  97. {
  98. frame.drawShape(c, this, 0, 0, w, h);
  99. }
  100. }
  101. c.setShadow(false);
  102. var prStencil = mxStencilRegistry.getStencil('mxgraph.cisco19.' + prIcon);
  103. c.setFillColor(strokeColor);
  104. if (prStencil != null)
  105. {
  106. prStencil.drawShape(c, this, 0, 0, w, h);
  107. }
  108. };
  109. mxCellRenderer.registerShape(mxShapeCisco19Rect.prototype.cst.SHAPE_RECT, mxShapeCisco19Rect);
  110. mxShapeCisco19Rect.prototype.getConstraints = function(style, w, h)
  111. {
  112. var constr = [];
  113. constr.push(new mxConnectionConstraint(new mxPoint(0.825, 0.5), false));
  114. constr.push(new mxConnectionConstraint(new mxPoint(0.175, 0.5), false));
  115. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0.16), false));
  116. constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0.84), false));
  117. constr.push(new mxConnectionConstraint(new mxPoint(0.66, 0.17), false));
  118. constr.push(new mxConnectionConstraint(new mxPoint(0.66, 0.83), false));
  119. constr.push(new mxConnectionConstraint(new mxPoint(0.34, 0.17), false));
  120. constr.push(new mxConnectionConstraint(new mxPoint(0.34, 0.83), false));
  121. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0.33), false));
  122. constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0.67), false));
  123. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0.33), false));
  124. constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0.67), false));
  125. return (constr);
  126. };