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