1/**2 * Copyright (c) 2006-2020, JGraph Holdings Ltd3 */45//**********************************************************************************************************************************************************6//Composite Icon7//**********************************************************************************************************************************************************8/**9* Extends mxShape.10*/11function mxShapeCiscoSafeCompositeIcon(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(mxShapeCiscoSafeCompositeIcon, mxShape);2425mxShapeCiscoSafeCompositeIcon.prototype.cst = {26 SHAPE_COMPOSITE_ICON : 'mxgraph.cisco_safe.compositeIcon'27};2829/**30* Function: paintVertexShape31* 32* Paints the vertex shape.33*/34mxShapeCiscoSafeCompositeIcon.prototype.paintVertexShape = function(c, x, y, w, h)35{36 var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', 'none');37 var bgColor = mxUtils.getValue(this.state.style, 'bgColor', '#C2E0AE');38 var fillColor = mxUtils.getValue(this.state.style, 'fillColor', 'none');39 var shadow = mxUtils.getValue(this.state.style, 'shadow', false);40 var opacity = parseFloat(mxUtils.getValue(this.state.style, 'opacity', false));41 42 c.translate(x, y);43 44 var bgIcon = mxUtils.getValue(this.state.style, 'bgIcon', '');45 var prIcon = mxUtils.getValue(this.state.style, 'resIcon', '');46 stencil = mxStencilRegistry.getStencil(prIcon);4748 if (stencil != null && bgIcon != 'mxgraph.cisco_safe.architecture.generic_appliance')49 {50 stencil.drawShape(c, this, 0, 0, w, h);51 }52 53 c.setFillColor(strokeColor);54 c.setStrokeColor('none');55 c.setShadow(false);56 57 58 if (bgIcon == 'ellipse')59 {60 c.begin();61 62 (w < 100) ? c.ellipse(w * 0.01, h * 0.01, w * 0.98, h * 0.98) : c.ellipse(1, 1, w - 2, h - 2);63 64 c.fill();65 }66 else if (bgIcon == 'threat1')67 {68 c.begin();69 c.ellipse(w * 0.18, h * 0.16, w * 0.66, h * 0.65);70 c.fill();71 }72 else if (bgIcon == 'threat2')73 {74 c.begin();75 c.ellipse(w * 0.01, h * 0.01, w * 0.98, h * 0.6);76 c.fill();77 }78 else if (bgIcon == 'threat3')79 {80 c.begin();81 c.ellipse(w * 0.18, h * 0.2, w * 0.64, h * 0.79);82 c.fill();83 }84 else if (bgIcon == 'threat4')85 {86 c.begin();87 c.ellipse(w * 0.09, h * 0.03, w * 0.82, h * 0.77);88 c.fill();89 }90 else if (bgIcon == 'threat5')91 {92 c.begin();93 c.ellipse(w * 0.16, h * 0.01, w * 0.67, h * 0.72);94 c.fill();95 }96 else if (bgIcon == 'mxgraph.cisco_safe.architecture.generic_appliance')97 {98 c.setShadow(shadow);99 c.setFillColor(bgColor);100 101 c.begin();102 c.moveTo(0, h * 0.3);103 c.arcTo(w * 0.3, h * 0.3, 0, 0, 1, w * 0.3, 0);104 c.lineTo(w * 0.7, 0);105 c.arcTo(w * 0.3, h * 0.3, 0, 0, 1, w, h * 0.3);106 c.lineTo(w, h * 0.7);107 c.arcTo(w * 0.3, h * 0.3, 0, 0, 1, w * 0.7, h);108 c.lineTo(w * 0.3, h);109 c.arcTo(w * 0.3, h * 0.3, 0, 0, 1, 0, h * 0.7);110 c.close();111 c.fill();112 113 c.setShadow(false);114115 c.setFillColor(strokeColor);116117 var stencil = mxStencilRegistry.getStencil(bgIcon);118 119 if (stencil != null)120 {121 stencil.drawShape(c, this, w * 0.26, h * 0.26, w * 0.48, h * 0.48)122 }123 124 c.setAlpha(0.5);125 c.setFillColor('#ffffff');126 127 c.ellipse(w * 0.105, h * 0.48, w * 0.04, h * 0.04);128 c.fill();129 c.ellipse(w * 0.855, h * 0.48, w * 0.04, h * 0.04);130 c.fill();131 c.ellipse(w * 0.48, h * 0.105, w * 0.04, h * 0.04);132 c.fill();133 c.ellipse(w * 0.48, h * 0.855, w * 0.04, h * 0.04);134 c.fill();135 136 c.ellipse(w * 0.17, h * 0.17, w * 0.04, h * 0.04);137 c.fill();138 c.ellipse(w * 0.79, h * 0.17, w * 0.04, h * 0.04);139 c.fill();140 c.ellipse(w * 0.79, h * 0.79, w * 0.04, h * 0.04);141 c.fill();142 c.ellipse(w * 0.17, h * 0.79, w * 0.04, h * 0.04);143 c.fill();144 145 c.setAlpha(opacity / 100);146147 }148 else149 {150 var stencil = mxStencilRegistry.getStencil(bgIcon);151 152 if (stencil != null)153 {154 (w < 100) ? stencil.drawShape(c, this, w * 0.01, h * 0.01, w * 0.98, h * 0.98) : stencil.drawShape(c, this, 1, 1, w - 2, h - 2);155 }156 }157158 stencil = mxStencilRegistry.getStencil(prIcon);159160 if (stencil != null )161 {162 c.setFillColor(fillColor);163 164 if (bgIcon == 'mxgraph.cisco_safe.architecture.generic_appliance')165 {166 stencil.drawShape(c, this, w * 0.25, h * 0.25, w * 0.5, h * 0.5)167 }168 else169 {170 stencil.drawShape(c, this, 0, 0, w, h);171 }172 }173174};175176mxCellRenderer.registerShape(mxShapeCiscoSafeCompositeIcon.prototype.cst.SHAPE_COMPOSITE_ICON, mxShapeCiscoSafeCompositeIcon);