1/** 2 * $Id: mxAws4.js,v 1.0 2018/16/11 07:05:39 mate Exp $ 3 * Copyright (c) 2006-2018, JGraph Ltd 4 */ 5 6//********************************************************************************************************************************************************** 7//Product Icon 8//********************************************************************************************************************************************************** 9/** 10* Extends mxShape. 11*/ 12function mxShapeAws4ProductIcon(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(mxShapeAws4ProductIcon, mxShape); 25 26mxShapeAws4ProductIcon.prototype.cst = { 27 PRODUCT_ICON : 'mxgraph.aws4.productIcon' 28}; 29 30/** 31* Function: paintVertexShape 32* 33* Paints the vertex shape. 34*/ 35mxShapeAws4ProductIcon.prototype.paintVertexShape = function(c, x, y, w, h) 36{ 37 c.translate(x, y); 38 39 var opacity = parseFloat(mxUtils.getValue(this.style, 'opacity', '100')); 40 var op1 = opacity; 41 var op2 = opacity; 42 43 if (fillColor == 'none') 44 { 45 op1 = 0; 46 } 47 48 if (gradientColor == 'none') 49 { 50 op2 = 0; 51 } 52 53 var ind = 1; 54 var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', 'none'); 55 c.setFillColor(strokeColor); 56 57 c.begin(); 58 c.moveTo(0, 0); 59 c.lineTo(w, 0); 60 c.lineTo(w, h); 61 c.lineTo(0, h); 62 c.close(); 63 c.fill(); 64 65 c.setShadow(false); 66 var fillColor = mxUtils.getValue(this.state.style, 'fillColor', '#ffffff'); 67 var gradientColor = mxUtils.getValue(this.state.style, 'gradientColor', fillColor); 68 var gradientDir = mxUtils.getValue(this.state.style, 'gradientDirection', 'south'); 69 70 c.setFillColor(fillColor); 71 c.setGradient(fillColor, gradientColor, 0, 0, w, h, gradientDir, op1, op2); 72 73 c.begin(); 74 c.moveTo(ind, ind); 75 c.lineTo(w - ind, ind); 76 c.lineTo(w - ind, w - ind); 77 c.lineTo(ind, w - ind); 78 c.close(); 79 c.fill(); 80 81 82 var prIcon = mxUtils.getValue(this.state.style, 'prIcon', ''); 83 var stencil = mxStencilRegistry.getStencil(prIcon); 84 85 if (stencil != null) 86 { 87 c.setFillColor(strokeColor); 88 c.setStrokeColor('none'); 89// stencil.drawShape(c, this, w * 0.1, h * 0.1, w * 0.8, h * 0.8); 90 stencil.drawShape(c, this, ind + w * 0.15, ind + w * 0.15, w * 0.7 - 2 * ind, w * 0.7 - 2 * ind); 91 } 92 93}; 94 95mxCellRenderer.registerShape(mxShapeAws4ProductIcon.prototype.cst.PRODUCT_ICON, mxShapeAws4ProductIcon); 96 97//********************************************************************************************************************************************************** 98//Resource Icon 99//********************************************************************************************************************************************************** 100/** 101* Extends mxShape. 102*/ 103function mxShapeAws4ResourceIcon(bounds, fill, stroke, strokewidth) 104{ 105 mxShape.call(this); 106 this.bounds = bounds; 107 this.fill = fill; 108 this.stroke = stroke; 109 this.strokewidth = (strokewidth != null) ? strokewidth : 1; 110}; 111 112/** 113* Extends mxShape. 114*/ 115mxUtils.extend(mxShapeAws4ResourceIcon, mxShape); 116 117mxShapeAws4ResourceIcon.prototype.cst = { 118 RESOURCE_ICON : 'mxgraph.aws4.resourceIcon' 119}; 120 121/** 122* Function: paintVertexShape 123* 124* Paints the vertex shape. 125*/ 126mxShapeAws4ResourceIcon.prototype.paintVertexShape = function(c, x, y, w, h) 127{ 128 c.translate(x, y); 129 130 c.begin(); 131 c.moveTo(0, 0); 132 c.lineTo(w, 0); 133 c.lineTo(w, h); 134 c.lineTo(0, h); 135 c.close(); 136 c.fill(); 137 138 c.setShadow(false); 139 140 var prIcon = mxUtils.getValue(this.state.style, 'resIcon', ''); 141 var stencil = mxStencilRegistry.getStencil(prIcon); 142 143 if (stencil != null) 144 { 145 var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', '#000000'); 146 c.setFillColor(strokeColor); 147 c.setStrokeColor('none'); 148 stencil.drawShape(c, this, w * 0.1, h * 0.1, w * 0.8, h * 0.8); 149 } 150 151}; 152 153mxCellRenderer.registerShape(mxShapeAws4ResourceIcon.prototype.cst.RESOURCE_ICON, mxShapeAws4ResourceIcon); 154 155//********************************************************************************************************************************************************** 156//Group 157//********************************************************************************************************************************************************** 158/** 159* Extends mxShape. 160*/ 161function mxShapeAws4Group(bounds, fill, stroke, strokewidth) 162{ 163 mxShape.call(this); 164 this.bounds = bounds; 165 this.fill = fill; 166 this.stroke = stroke; 167 this.strokewidth = (strokewidth != null) ? strokewidth : 1; 168}; 169 170/** 171* Extends mxShape. 172*/ 173mxUtils.extend(mxShapeAws4Group, mxShape); 174 175mxShapeAws4Group.prototype.cst = { 176 GROUP : 'mxgraph.aws4.group' 177}; 178 179/** 180* Function: paintVertexShape 181* 182* Paints the vertex shape. 183*/ 184mxShapeAws4Group.prototype.paintVertexShape = function(c, x, y, w, h) 185{ 186 c.translate(x, y); 187 var grStroke = mxUtils.getValue(this.state.style, 'grStroke', '1'); 188 189 var size = 25; 190 191 if (this.style != null && mxUtils.getValue(this.style, mxConstants.STYLE_POINTER_EVENTS, '1') == '0') 192 { 193 c.pointerEvents = false; 194 } 195 196 c.begin(); 197 c.moveTo(0, 0); 198 c.lineTo(w, 0); 199 c.lineTo(w, h); 200 c.lineTo(0, h); 201 c.close(); 202 203 if (grStroke == '1') 204 { 205 c.fillAndStroke(); 206 } 207 else 208 { 209 c.fill(); 210 } 211 212 c.pointerEvents = true; 213 c.setShadow(false); 214 215 var grIcon = mxUtils.getValue(this.state.style, 'grIcon', ''); 216 var stencil = mxStencilRegistry.getStencil(grIcon); 217 218 if (stencil != null) 219 { 220 var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', '#000000'); 221 c.setFillColor(strokeColor); 222 c.setStrokeColor('none'); 223 stencil.drawShape(c, this, 0, 0, size, size); 224 } 225 226}; 227 228mxCellRenderer.registerShape(mxShapeAws4Group.prototype.cst.GROUP, mxShapeAws4Group); 229 230//********************************************************************************************************************************************************** 231//Group Center 232//********************************************************************************************************************************************************** 233/** 234* Extends mxShape. 235*/ 236function mxShapeAws4GroupCenter(bounds, fill, stroke, strokewidth) 237{ 238 mxShape.call(this); 239 this.bounds = bounds; 240 this.fill = fill; 241 this.stroke = stroke; 242 this.strokewidth = (strokewidth != null) ? strokewidth : 1; 243}; 244 245/** 246* Extends mxShape. 247*/ 248mxUtils.extend(mxShapeAws4GroupCenter, mxShape); 249 250mxShapeAws4GroupCenter.prototype.cst = { 251 GROUP_CENTER : 'mxgraph.aws4.groupCenter' 252}; 253 254/** 255* Function: paintVertexShape 256* 257* Paints the vertex shape. 258*/ 259mxShapeAws4GroupCenter.prototype.paintVertexShape = function(c, x, y, w, h) 260{ 261 c.translate(x, y); 262 var grStroke = mxUtils.getValue(this.state.style, 'grStroke', '1'); 263 264 var size = 25; 265 266 c.begin(); 267 c.moveTo(0, 0); 268 c.lineTo(w, 0); 269 c.lineTo(w, h); 270 c.lineTo(0, h); 271 c.close(); 272 273 if (grStroke == '1') 274 { 275 c.fillAndStroke(); 276 } 277 else 278 { 279 c.fill(); 280 } 281 282 c.setShadow(false); 283 var grIcon = mxUtils.getValue(this.state.style, 'grIcon', ''); 284 var stencil = mxStencilRegistry.getStencil(grIcon); 285 286 if (stencil != null) 287 { 288 var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', '#000000'); 289 c.setFillColor(strokeColor); 290 c.setStrokeColor('none'); 291 stencil.drawShape(c, this, (w - size) * 0.5, 0, size, size); 292 } 293 294}; 295 296mxCellRenderer.registerShape(mxShapeAws4GroupCenter.prototype.cst.GROUP_CENTER, mxShapeAws4GroupCenter); 297 298////********************************************************************************************************************************************************** 299////Resource Icon 300////********************************************************************************************************************************************************** 301///** 302//* Extends mxShape. 303//*/ 304//function mxShapeAws4ResourceIcon(bounds, fill, stroke, strokewidth) 305//{ 306// mxShape.call(this); 307// this.bounds = bounds; 308// this.fill = fill; 309// this.stroke = stroke; 310// this.strokewidth = (strokewidth != null) ? strokewidth : 1; 311//}; 312// 313///** 314//* Extends mxShape. 315//*/ 316//mxUtils.extend(mxShapeAws4ResourceIcon, mxShape); 317// 318//mxShapeAws4ResourceIcon.prototype.cst = { 319// RESOURCE_ICON : 'mxgraph.aws4.resourceIcon' 320//}; 321// 322///** 323//* Function: paintVertexShape 324//* 325//* Paints the vertex shape. 326//*/ 327//mxShapeAws4ResourceIcon.prototype.paintVertexShape = function(c, x, y, w, h) 328//{ 329// c.translate(x, y); 330// 331// c.begin(); 332// c.moveTo(0, 0); 333// c.lineTo(w, 0); 334// c.lineTo(w, h); 335// c.lineTo(0, h); 336// c.close(); 337// c.fillAndStroke(); 338// 339// var prIcon = mxUtils.getValue(this.state.style, 'resIcon', ''); 340// var stencil = mxStencilRegistry.getStencil(prIcon); 341// 342// if (stencil != null) 343// { 344// var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', '#000000'); 345// c.setFillColor(strokeColor); 346// c.setStrokeColor('none'); 347// stencil.drawShape(c, this, w * 0.1, h * 0.1, w * 0.8, h * 0.8); 348// } 349// 350//}; 351 352//********************************************************************************************************************************************************** 353//Group2 354//********************************************************************************************************************************************************** 355/** 356* Extends mxShape. 357*/ 358function mxShapeAws4Group2(bounds, fill, stroke, strokewidth) 359{ 360 mxShape.call(this); 361 this.bounds = bounds; 362 this.fill = fill; 363 this.stroke = stroke; 364 this.strokewidth = (strokewidth != null) ? strokewidth : 1; 365}; 366 367/** 368* Extends mxShape. 369*/ 370mxUtils.extend(mxShapeAws4Group2, mxShape); 371 372mxShapeAws4Group2.prototype.cst = { 373 GROUP2 : 'mxgraph.aws4.group2' 374}; 375 376/** 377* Function: paintVertexShape 378* 379* Paints the vertex shape. 380*/ 381mxShapeAws4Group2.prototype.paintVertexShape = function(c, x, y, w, h) 382{ 383 c.translate(x, y); 384 385 var size = 25; 386 387 c.begin(); 388 c.moveTo(0, 0); 389 c.lineTo(w, 0); 390 c.lineTo(w, h); 391 c.lineTo(0, h); 392 c.close(); 393 c.fillAndStroke(); 394 395 c.setShadow(false); 396 397 var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', '#000000'); 398 c.setFillColor(strokeColor); 399 400 c.begin(); 401 c.moveTo(0, 0); 402 c.lineTo(size, 0); 403 c.lineTo(size, size); 404 c.lineTo(0, size); 405 c.close(); 406 c.fill(); 407 408 var grIcon = mxUtils.getValue(this.state.style, 'grIcon', ''); 409 var stencil = mxStencilRegistry.getStencil(grIcon); 410 411 if (stencil != null) 412 { 413 c.setFillColor('#ffffff'); 414 c.setStrokeColor('none'); 415 stencil.drawShape(c, this, size * 0.1, size * 0.1, size * 0.8, size * 0.8); 416 } 417 418}; 419 420mxCellRenderer.registerShape(mxShapeAws4Group2.prototype.cst.GROUP2, mxShapeAws4Group2); 421 422