1/**2 * Copyright (c) 2006-2020, JGraph Holdings Ltd3 */45//**********************************************************************************************************************************************************6//rect7//**********************************************************************************************************************************************************8/**9* Extends mxShape.10*/11function 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};1920/**21* Extends mxShape.22*/23mxUtils.extend(mxShapeCisco19Rect, mxShape);2425mxShapeCisco19Rect.prototype.cst = {26 SHAPE_RECT : 'mxgraph.cisco19.rect'27};2829/**30* Function: paintVertexShape31* 32* Paints the vertex shape.33*/34mxShapeCisco19Rect.prototype.paintVertexShape = function(c, x, y, w, h)35{36 var prIcon = mxUtils.getValue(this.state.style, 'prIcon', 'l2_switch');37 38 var fillColor = mxUtils.getValue(this.state.style, 'fillColor', '#ffffff');39 var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', '#000000');4041 var bgIcon = 'mxgraph.cisco19.bg1';42 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'];43 44 c.translate(x, y);4546 if (['l2_modular', 'l3_modular', '6500_vss', 'nexus_9500', 'nexus_7k'].includes(prIcon)) // square with 1 hor rect on top47 {48 bgIcon = 'mxgraph.cisco19.bg2';49 }50 else if (['l2_switch_with_dual_supervisor', 'l3_switch_with_dual_supervisor'].includes(prIcon)) //square with 2 hor rects on top51 {52 bgIcon = 'mxgraph.cisco19.bg3';53 }54 else if (['l2_modular2'].includes(prIcon)) // vert 2 rects55 {56 bgIcon = 'mxgraph.cisco19.bg4';57 }58 else if (['l3_modular2', '6500_vss2', 'hypervisor', 'collab1'].includes(prIcon)) // vert rect59 {60 bgIcon = 'mxgraph.cisco19.bg5';61 }62 else if (circleBg.includes(prIcon)) // circle63 {64 c.begin();6566 if (prIcon == 'wireless_router')67 {68 c.ellipse(0, h * 0.17, w, h * 0.83);69 }70 else71 {72 c.ellipse(0, 0, w, h);73 }7475 c.fill();76 }77 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. rect78 {79 bgIcon = 'mxgraph.cisco19.bg6';80 }81 else if (['asr_1000'].includes(prIcon)) //hexagon82 {83 bgIcon = 'mxgraph.cisco19.bg7';84 }85 else if (['fibre_channel_director_mds_9000', 'fibre_channel_fabric_switch'].includes(prIcon)) // square with 1 hor rect at the bottom86 {87 bgIcon = 'mxgraph.cisco19.bg8';88 }89 else if (['ucs_c_series_server'].includes(prIcon)) // narrow hor rect90 {91 bgIcon = 'mxgraph.cisco19.bg9';92 }93 else if (['aci'].includes(prIcon) || ['aci2'].includes(prIcon)) // background specific for ACI94 {95 var frame = mxStencilRegistry.getStencil('mxgraph.cisco19.acibg');96 frame.drawShape(c, this, w * 0.195, h * 0.195, w * 0.61, h * 0.61);97 }98 else if (['immersive_telepresence_endpoint'].includes(prIcon)) // extra wide rect99 {100 bgIcon = 'mxgraph.cisco19.bg10';101 }102103104 if (!circleBg.includes(prIcon) && prIcon != 'aci' && prIcon != 'aci2')105 {106 var frame = mxStencilRegistry.getStencil(bgIcon);107108 if (frame != null)109 {110 frame.drawShape(c, this, 0, 0, w, h);111 }112 }113114 c.setShadow(false);115116 117 var prStencil = mxStencilRegistry.getStencil('mxgraph.cisco19.' + prIcon);118119 c.setFillColor(strokeColor);120 121 if (prStencil != null)122 {123 prStencil.drawShape(c, this, 0, 0, w, h);124 }125};126127mxCellRenderer.registerShape(mxShapeCisco19Rect.prototype.cst.SHAPE_RECT, mxShapeCisco19Rect);128129mxShapeCisco19Rect.prototype.getConstraints = function(style, w, h)130{131 var constr = [];132133 constr.push(new mxConnectionConstraint(new mxPoint(0.825, 0.5), false));134 constr.push(new mxConnectionConstraint(new mxPoint(0.175, 0.5), false));135 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0.16), false));136 constr.push(new mxConnectionConstraint(new mxPoint(0.5, 0.84), false));137 constr.push(new mxConnectionConstraint(new mxPoint(0.66, 0.17), false));138 constr.push(new mxConnectionConstraint(new mxPoint(0.66, 0.83), false));139 constr.push(new mxConnectionConstraint(new mxPoint(0.34, 0.17), false));140 constr.push(new mxConnectionConstraint(new mxPoint(0.34, 0.83), false));141 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0.33), false));142 constr.push(new mxConnectionConstraint(new mxPoint(0.75, 0.67), false));143 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0.33), false));144 constr.push(new mxConnectionConstraint(new mxPoint(0.25, 0.67), false));145146 return (constr);147};148