1/**2 * Copyright (c) 2006-2018, JGraph Holdings Ltd3 */45//**********************************************************************************************************************************************************6//Product Icon7//**********************************************************************************************************************************************************8/**9* Extends mxShape.10*/11function mxShapeAws4ProductIcon(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(mxShapeAws4ProductIcon, mxShape);2425mxShapeAws4ProductIcon.prototype.cst = {26 PRODUCT_ICON : 'mxgraph.aws4.productIcon'27};2829/**30* Function: paintVertexShape31* 32* Paints the vertex shape.33*/34mxShapeAws4ProductIcon.prototype.paintVertexShape = function(c, x, y, w, h)35{36 c.translate(x, y);3738 var opacity = parseFloat(mxUtils.getValue(this.style, 'opacity', '100'));39 var op1 = opacity;40 var op2 = opacity;41 42 if (fillColor == 'none')43 {44 op1 = 0;45 }46 47 if (gradientColor == 'none')48 {49 op2 = 0;50 }5152 var ind = 1;53 var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', 'none');54 c.setFillColor(strokeColor);5556 c.begin();57 c.moveTo(0, 0);58 c.lineTo(w, 0);59 c.lineTo(w, h);60 c.lineTo(0, h);61 c.close();62 c.fill();6364 c.setShadow(false);65 var fillColor = mxUtils.getValue(this.state.style, 'fillColor', '#ffffff');66 var gradientColor = mxUtils.getValue(this.state.style, 'gradientColor', fillColor);67 var gradientDir = mxUtils.getValue(this.state.style, 'gradientDirection', 'south');68 69 c.setFillColor(fillColor);70 c.setGradient(fillColor, gradientColor, 0, 0, w, h, gradientDir, op1, op2); 7172 c.begin();73 c.moveTo(ind, ind);74 c.lineTo(w - ind, ind);75 c.lineTo(w - ind, w - ind);76 c.lineTo(ind, w - ind);77 c.close();78 c.fill();79 8081 var prIcon = mxUtils.getValue(this.state.style, 'prIcon', '');82 var stencil = mxStencilRegistry.getStencil(prIcon);8384 if (stencil != null)85 {86 c.setFillColor(strokeColor);87 c.setStrokeColor('none');88// stencil.drawShape(c, this, w * 0.1, h * 0.1, w * 0.8, h * 0.8);89 stencil.drawShape(c, this, ind + w * 0.15, ind + w * 0.15, w * 0.7 - 2 * ind, w * 0.7 - 2 * ind);90 }9192};9394mxCellRenderer.registerShape(mxShapeAws4ProductIcon.prototype.cst.PRODUCT_ICON, mxShapeAws4ProductIcon);9596//**********************************************************************************************************************************************************97//Resource Icon98//**********************************************************************************************************************************************************99/**100* Extends mxShape.101*/102function mxShapeAws4ResourceIcon(bounds, fill, stroke, strokewidth)103{104 mxShape.call(this);105 this.bounds = bounds;106 this.fill = fill;107 this.stroke = stroke;108 this.strokewidth = (strokewidth != null) ? strokewidth : 1;109};110111/**112* Extends mxShape.113*/114mxUtils.extend(mxShapeAws4ResourceIcon, mxShape);115116mxShapeAws4ResourceIcon.prototype.cst = {117 RESOURCE_ICON : 'mxgraph.aws4.resourceIcon'118};119120/**121* Function: paintVertexShape122* 123* Paints the vertex shape.124*/125mxShapeAws4ResourceIcon.prototype.paintVertexShape = function(c, x, y, w, h)126{127 c.translate(x, y);128129 c.begin();130 c.moveTo(0, 0);131 c.lineTo(w, 0);132 c.lineTo(w, h);133 c.lineTo(0, h);134 c.close();135 c.fill();136137 c.setShadow(false);138 139 var prIcon = mxUtils.getValue(this.state.style, 'resIcon', '');140 var stencil = mxStencilRegistry.getStencil(prIcon);141142 if (stencil != null)143 {144 var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', '#000000');145 c.setFillColor(strokeColor);146 c.setStrokeColor('none');147 stencil.drawShape(c, this, w * 0.1, h * 0.1, w * 0.8, h * 0.8);148 }149150};151152mxCellRenderer.registerShape(mxShapeAws4ResourceIcon.prototype.cst.RESOURCE_ICON, mxShapeAws4ResourceIcon);153154//**********************************************************************************************************************************************************155//Group156//**********************************************************************************************************************************************************157/**158* Extends mxShape.159*/160function mxShapeAws4Group(bounds, fill, stroke, strokewidth)161{162 mxShape.call(this);163 this.bounds = bounds;164 this.fill = fill;165 this.stroke = stroke;166 this.strokewidth = (strokewidth != null) ? strokewidth : 1;167};168169/**170* Extends mxShape.171*/172mxUtils.extend(mxShapeAws4Group, mxShape);173174mxShapeAws4Group.prototype.cst = {175 GROUP : 'mxgraph.aws4.group'176};177178/**179* Function: paintVertexShape180* 181* Paints the vertex shape.182*/183mxShapeAws4Group.prototype.paintVertexShape = function(c, x, y, w, h)184{185 c.translate(x, y);186 var grStroke = mxUtils.getValue(this.state.style, 'grStroke', '1');187 188 var size = 25;189190 if (this.style != null && mxUtils.getValue(this.style, mxConstants.STYLE_POINTER_EVENTS, '1') == '0')191 {192 c.pointerEvents = false;193 }194195 c.begin();196 c.moveTo(0, 0);197 c.lineTo(w, 0);198 c.lineTo(w, h);199 c.lineTo(0, h);200 c.close();201202 if (grStroke == '1' || this.outline)203 {204 c.fillAndStroke();205 }206 else207 {208 c.fill();209 }210 211 c.pointerEvents = true;212 c.setShadow(false);213214 var grIcon = mxUtils.getValue(this.state.style, 'grIcon', '');215 var stencil = mxStencilRegistry.getStencil(grIcon);216217 if (stencil != null)218 {219 var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', '#000000');220 size = mxUtils.getValue(this.state.style, 'grIconSize', size);221 c.setFillAlpha(this.strokeOpacity / 100);222 c.setFillColor(strokeColor);223 c.setStrokeColor('none');224 stencil.drawShape(c, this, 0, 0, size, size);225 }226227};228229mxCellRenderer.registerShape(mxShapeAws4Group.prototype.cst.GROUP, mxShapeAws4Group);230231//**********************************************************************************************************************************************************232//Group Center233//**********************************************************************************************************************************************************234/**235* Extends mxShape.236*/237function mxShapeAws4GroupCenter(bounds, fill, stroke, strokewidth)238{239 mxShape.call(this);240 this.bounds = bounds;241 this.fill = fill;242 this.stroke = stroke;243 this.strokewidth = (strokewidth != null) ? strokewidth : 1;244};245246/**247* Extends mxShape.248*/249mxUtils.extend(mxShapeAws4GroupCenter, mxShape);250251mxShapeAws4GroupCenter.prototype.cst = {252 GROUP_CENTER : 'mxgraph.aws4.groupCenter'253};254255/**256* Function: paintVertexShape257* 258* Paints the vertex shape.259*/260mxShapeAws4GroupCenter.prototype.paintVertexShape = function(c, x, y, w, h)261{262 c.translate(x, y);263 var grStroke = mxUtils.getValue(this.state.style, 'grStroke', '1');264265 var size = 25;266267 c.begin();268 c.moveTo(0, 0);269 c.lineTo(w, 0);270 c.lineTo(w, h);271 c.lineTo(0, h);272 c.close();273 274 if (grStroke == '1' || this.outline)275 {276 c.fillAndStroke();277 }278 else279 {280 c.fill();281 }282 283 c.setShadow(false);284 var grIcon = mxUtils.getValue(this.state.style, 'grIcon', '');285 var stencil = mxStencilRegistry.getStencil(grIcon);286287 if (stencil != null)288 {289 var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', '#000000');290 size = mxUtils.getValue(this.state.style, 'grIconSize', size);291 c.setFillAlpha(this.strokeOpacity / 100);292 c.setFillColor(strokeColor);293 c.setStrokeColor('none');294 stencil.drawShape(c, this, (w - size) * 0.5, 0, size, size);295 }296297};298299mxCellRenderer.registerShape(mxShapeAws4GroupCenter.prototype.cst.GROUP_CENTER, mxShapeAws4GroupCenter);300301////**********************************************************************************************************************************************************302////Resource Icon303////**********************************************************************************************************************************************************304///**305//* Extends mxShape.306//*/307//function mxShapeAws4ResourceIcon(bounds, fill, stroke, strokewidth)308//{309// mxShape.call(this);310// this.bounds = bounds;311// this.fill = fill;312// this.stroke = stroke;313// this.strokewidth = (strokewidth != null) ? strokewidth : 1;314//};315//316///**317//* Extends mxShape.318//*/319//mxUtils.extend(mxShapeAws4ResourceIcon, mxShape);320//321//mxShapeAws4ResourceIcon.prototype.cst = {322// RESOURCE_ICON : 'mxgraph.aws4.resourceIcon'323//};324//325///**326//* Function: paintVertexShape327//* 328//* Paints the vertex shape.329//*/330//mxShapeAws4ResourceIcon.prototype.paintVertexShape = function(c, x, y, w, h)331//{332// c.translate(x, y);333//334// c.begin();335// c.moveTo(0, 0);336// c.lineTo(w, 0);337// c.lineTo(w, h);338// c.lineTo(0, h);339// c.close();340// c.fillAndStroke();341//342// var prIcon = mxUtils.getValue(this.state.style, 'resIcon', '');343// var stencil = mxStencilRegistry.getStencil(prIcon);344//345// if (stencil != null)346// {347// var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', '#000000');348// c.setFillColor(strokeColor);349// c.setStrokeColor('none');350// stencil.drawShape(c, this, w * 0.1, h * 0.1, w * 0.8, h * 0.8);351// }352//353//};354355//**********************************************************************************************************************************************************356//Group2357//**********************************************************************************************************************************************************358/**359* Extends mxShape.360*/361function mxShapeAws4Group2(bounds, fill, stroke, strokewidth)362{363 mxShape.call(this);364 this.bounds = bounds;365 this.fill = fill;366 this.stroke = stroke;367 this.strokewidth = (strokewidth != null) ? strokewidth : 1;368};369370/**371* Extends mxShape.372*/373mxUtils.extend(mxShapeAws4Group2, mxShape);374375mxShapeAws4Group2.prototype.cst = {376 GROUP2 : 'mxgraph.aws4.group2'377};378379/**380* Function: paintVertexShape381* 382* Paints the vertex shape.383*/384mxShapeAws4Group2.prototype.paintVertexShape = function(c, x, y, w, h)385{386 c.translate(x, y);387388 var size = 25;389390 c.begin();391 c.moveTo(0, 0);392 c.lineTo(w, 0);393 c.lineTo(w, h);394 c.lineTo(0, h);395 c.close();396 c.fillAndStroke();397398 c.setShadow(false);399400 var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', '#000000');401 c.setFillColor(strokeColor);402403 c.begin();404 c.moveTo(0, 0);405 c.lineTo(size, 0);406 c.lineTo(size, size);407 c.lineTo(0, size);408 c.close();409 c.fill();410411 var grIcon = mxUtils.getValue(this.state.style, 'grIcon', '');412 var stencil = mxStencilRegistry.getStencil(grIcon);413414 if (stencil != null)415 {416 size = mxUtils.getValue(this.state.style, 'grIconSize', size);417 c.setFillAlpha(this.strokeOpacity / 100);418 c.setFillColor('#ffffff');419 c.setStrokeColor('none');420 stencil.drawShape(c, this, size * 0.1, size * 0.1, size * 0.8, size * 0.8);421 }422423};424425mxCellRenderer.registerShape(mxShapeAws4Group2.prototype.cst.GROUP2, mxShapeAws4Group2);426