1/**2 * Copyright (c) 2006-2018, JGraph Holdings Ltd3 */4//**********************************************************************************************************************************************************5// Person6//**********************************************************************************************************************************************************7/**8* Extends mxShape.9*/10function mxShapeC4Person(bounds, fill, stroke, strokewidth)11{12 mxShape.call(this);13 this.bounds = bounds;14 this.fill = fill;15 this.stroke = stroke;16 this.strokewidth = (strokewidth != null) ? strokewidth : 1;17};1819/**20* Extends mxShape.21*/22mxUtils.extend(mxShapeC4Person, mxShape);2324mxShapeC4Person.prototype.cst = {PERSONSHAPE : 'mxgraph.c4.person'};2526/**27* Function: paintVertexShape28* 29* Paints the vertex shape.30*/31mxShapeC4Person.prototype.paintVertexShape = function(c, x, y, w, h)32{33 c.translate(x, y);34 var headSize = Math.min(w / 2, h / 3);35 var r = headSize / 2;36 37 c.ellipse(w * 0.5 - headSize * 0.5, 0, headSize, headSize);38 c.fillAndStroke();39 40 c.begin();41 c.moveTo(0, headSize * 0.8 + r);42 c.arcTo(r, r, 0, 0, 1, r, headSize * 0.8);43 c.lineTo(w - r, headSize * 0.8);44 c.arcTo(r, r, 0, 0, 1, w, headSize * 0.8 + r);45 c.lineTo(w, h - r);46 c.arcTo(r, r, 0, 0, 1, w - r, h);47 c.lineTo(r, h);48 c.arcTo(r, r, 0, 0, 1, 0, h -r);49 c.close();50 c.fillAndStroke();5152 c.setShadow(false);53 54 c.ellipse(w * 0.5 - headSize * 0.5, 0, headSize, headSize);55 c.fillAndStroke();5657};5859mxShapeC4Person.prototype.getLabelMargins = function(rect)60{61 var headSize = Math.min(rect.width / 2, rect.height / 3);62 63 return new mxRectangle(0, headSize * 0.8, 0, 0);64};6566mxCellRenderer.registerShape(mxShapeC4Person.prototype.cst.PERSONSHAPE, mxShapeC4Person);6768//**********************************************************************************************************************************************************69// Person70//**********************************************************************************************************************************************************71/**72* Extends mxShape.73*/74function mxShapeC4Person2(bounds, fill, stroke, strokewidth)75{76 mxShape.call(this);77 this.bounds = bounds;78 this.fill = fill;79 this.stroke = stroke;80 this.strokewidth = (strokewidth != null) ? strokewidth : 1;81};8283/**84* Extends mxShape.85*/86mxUtils.extend(mxShapeC4Person2, mxShape);8788mxShapeC4Person2.prototype.cst = {PERSONSHAPE : 'mxgraph.c4.person2'};8990/**91* Function: paintVertexShape92* 93* Paints the vertex shape.94*/95mxShapeC4Person2.prototype.paintVertexShape = function(c, x, y, w, h)96{97 c.translate(x, y);98 var headSize = Math.min(w * 0.45, h * 0.45);99 var r = headSize / 2;100 101 c.ellipse(w * 0.5 - headSize * 0.5, 0, headSize, headSize);102 c.fillAndStroke();103 104 c.begin();105 c.moveTo(0, headSize * 0.8 + r);106 c.arcTo(r, r, 0, 0, 1, r, headSize * 0.8);107 c.lineTo(w - r, headSize * 0.8);108 c.arcTo(r, r, 0, 0, 1, w, headSize * 0.8 + r);109 c.lineTo(w, h - r);110 c.arcTo(r, r, 0, 0, 1, w - r, h);111 c.lineTo(r, h);112 c.arcTo(r, r, 0, 0, 1, 0, h -r);113 c.close();114 c.fillAndStroke();115116 c.setShadow(false);117 118 c.ellipse(w * 0.5 - headSize * 0.5, 0, headSize, headSize);119 c.fillAndStroke();120121};122123mxShapeC4Person2.prototype.getLabelMargins = function(rect)124{125 var headSize = Math.min(rect.width * 0.45, rect.height * 0.45);126 127 return new mxRectangle(0, headSize * 0.8, 0, 0);128};129130mxCellRenderer.registerShape(mxShapeC4Person2.prototype.cst.PERSONSHAPE , mxShapeC4Person2);131132//**********************************************************************************************************************************************************133// Web Browser Container134//**********************************************************************************************************************************************************135/**136* Extends mxShape.137*/138function mxShapeC4WebBrowserContainer(bounds, fill, stroke, strokewidth)139{140 mxShape.call(this);141 this.bounds = bounds;142 this.fill = fill;143 this.stroke = stroke;144 this.strokewidth = (strokewidth != null) ? strokewidth : 1;145};146147/**148* Extends mxShape.149*/150mxUtils.extend(mxShapeC4WebBrowserContainer, mxShape);151152mxShapeC4WebBrowserContainer.prototype.cst = {WEB_BROWSER_CONTAINER_SHAPE : 'mxgraph.c4.webBrowserContainer'};153154/**155* Function: paintVertexShape156* 157* Paints the vertex shape.158*/159mxShapeC4WebBrowserContainer.prototype.paintVertexShape = function(c, x, y, w, h)160{161 c.translate(x, y);162 var r = 8;163 164 c.begin();165 c.moveTo(0, r);166 c.arcTo(r, r, 0, 0, 1, r, 0);167 c.lineTo(w - r, 0);168 c.arcTo(r, r, 0, 0, 1, w, r);169 c.lineTo(w, h - r);170 c.arcTo(r, r, 0, 0, 1, w - r, h);171 c.lineTo(r, h);172 c.arcTo(r, r, 0, 0, 1, 0, h - r);173 c.close();174 c.fillAndStroke();175176 c.setShadow(false);177 178 var ins = 5;179 var r2 = 3;180 var h2 = 12;181 182 if (w > (ins * 5 + h2 * 3) && h > (2 * h2 + 3 * ins))183 {184 c.setFillColor('#23A2D9');185 186 c.begin();187 c.moveTo(ins, ins + r2);188 c.arcTo(r2, r2, 0, 0, 1, ins + r2, ins);189 c.lineTo(w - 3 * h2 - 4 * ins - r2, ins);190 c.arcTo(r2, r2, 0, 0, 1, w - 3 * h2 - 4 * ins, ins + r2);191 c.lineTo(w - 3 * h2 - 4 * ins, ins + h2 - r2);192 c.arcTo(r2, r2, 0, 0, 1, w - 3 * h2 - 4 * ins - r2, ins + h2);193 c.lineTo(ins + r2, ins + h2);194 c.arcTo(r2, r2, 0, 0, 1, ins, ins + h2 - r2);195 c.close();196 197 c.moveTo(w - 3 * h2 - 3 * ins, ins + r2);198 c.arcTo(r2, r2, 0, 0, 1, w - 3 * h2 - 3 * ins + r2, ins);199 c.lineTo(w - 2 * h2 - 3 * ins - r2, ins);200 c.arcTo(r2, r2, 0, 0, 1, w - 2 * h2 - 3 * ins, ins + r2);201 c.lineTo(w - 2 * h2 - 3 * ins, ins + h2 - r2);202 c.arcTo(r2, r2, 0, 0, 1, w - 2 * h2 - 3 * ins - r2, ins + h2);203 c.lineTo(w - 3 * h2 - 3 * ins + r2, ins + h2);204 c.arcTo(r2, r2, 0, 0, 1, w - 3 * h2 - 3 * ins, ins + h2 - r2);205 c.close();206 207 c.moveTo(w - 2 * h2 - 2 * ins, ins + r2);208 c.arcTo(r2, r2, 0, 0, 1, w - 2 * h2 - 2 * ins + r2, ins);209 c.lineTo(w - h2 - 2 * ins - r2, ins);210 c.arcTo(r2, r2, 0, 0, 1, w - h2 - 2 * ins, ins + r2);211 c.lineTo(w - h2 - 2 * ins, ins + h2 - r2);212 c.arcTo(r2, r2, 0, 0, 1, w - h2 - 2 * ins - r2, ins + h2);213 c.lineTo(w - 2 * h2 - 2 * ins + r2, ins + h2);214 c.arcTo(r2, r2, 0, 0, 1, w - 2 * h2 - 2 * ins, ins + h2 - r2);215 c.close();216 217 c.moveTo(w - h2 - ins, ins + r2);218 c.arcTo(r2, r2, 0, 0, 1, w - h2 - ins + r2, ins);219 c.lineTo(w - ins - r2, ins);220 c.arcTo(r2, r2, 0, 0, 1, w - ins, ins + r2);221 c.lineTo(w - ins, ins + h2 - r2);222 c.arcTo(r2, r2, 0, 0, 1, w - ins - r2, ins + h2);223 c.lineTo(w - h2 - ins + r2, ins + h2);224 c.arcTo(r2, r2, 0, 0, 1, w - h2 - ins, ins + h2 - r2);225 c.close();226227 c.moveTo(ins, h2 + 2 * ins + r);228 c.arcTo(r, r, 0, 0, 1, ins + r, h2 + 2 * ins);229 c.lineTo(w - r - ins, h2 + 2 * ins);230 c.arcTo(r, r, 0, 0, 1, w - ins, h2 + 2 * ins + r);231 c.lineTo(w - ins, h - r - ins);232 c.arcTo(r, r, 0, 0, 1, w - r - ins, h - ins);233 c.lineTo(ins + r, h - ins);234 c.arcTo(r, r, 0, 0, 1, ins, h - r - ins);235 c.close();236 c.fill();237 238 c.fill();239 }240};241242mxCellRenderer.registerShape(mxShapeC4WebBrowserContainer.prototype.cst.WEB_BROWSER_CONTAINER_SHAPE, mxShapeC4WebBrowserContainer);243244//**********************************************************************************************************************************************************245// Web Browser Container v2246//**********************************************************************************************************************************************************247/**248* Extends mxShape.249*/250function mxShapeC4WebBrowserContainer2(bounds, fill, stroke, strokewidth)251{252 mxShape.call(this);253 this.bounds = bounds;254 this.fill = fill;255 this.stroke = stroke;256 this.strokewidth = (strokewidth != null) ? strokewidth : 1;257};258259/**260* Extends mxShape.261*/262mxUtils.extend(mxShapeC4WebBrowserContainer2, mxShape);263264mxShapeC4WebBrowserContainer2.prototype.cst = {WEB_BROWSER_CONTAINER2_SHAPE : 'mxgraph.c4.webBrowserContainer2'};265266mxShapeC4WebBrowserContainer2.prototype.customProperties = [267 {name: 'strokeColor2', dispName: 'Outline color', type: 'color', defVal: '#0E7DAD'}268];269270/**271* Function: paintVertexShape272* 273* Paints the vertex shape.274*/275mxShapeC4WebBrowserContainer2.prototype.paintVertexShape = function(c, x, y, w, h)276{277 c.translate(x, y);278 var r = 8;279 var fillColor = mxUtils.getValue(this.state.style, 'fillColor', '#ffffff');280 var strokeColor = mxUtils.getValue(this.state.style, 'strokeColor', '#000000');281 var strokeColor2 = mxUtils.getValue(this.state.style, 'strokeColor2', '#0E7DAD');282283 c.setStrokeColor(strokeColor2);284 c.setFillColor(strokeColor);285 286 c.begin();287 c.moveTo(0, r);288 c.arcTo(r, r, 0, 0, 1, r, 0);289 c.lineTo(w - r, 0);290 c.arcTo(r, r, 0, 0, 1, w, r);291 c.lineTo(w, h - r);292 c.arcTo(r, r, 0, 0, 1, w - r, h);293 c.lineTo(r, h);294 c.arcTo(r, r, 0, 0, 1, 0, h - r);295 c.close();296 c.fillAndStroke();297298 c.setShadow(false);299 300 var ins = 5;301 var r2 = 3;302 var h2 = 12;303 304 if (w > (ins * 5 + h2 * 3) && h > (2 * h2 + 3 * ins))305 {306 //set fill color to fill color307 c.setFillColor(fillColor);308 309 c.begin();310 c.moveTo(ins, ins + r2);311 c.arcTo(r2, r2, 0, 0, 1, ins + r2, ins);312 c.lineTo(w - 3 * h2 - 4 * ins - r2, ins);313 c.arcTo(r2, r2, 0, 0, 1, w - 3 * h2 - 4 * ins, ins + r2);314 c.lineTo(w - 3 * h2 - 4 * ins, ins + h2 - r2);315 c.arcTo(r2, r2, 0, 0, 1, w - 3 * h2 - 4 * ins - r2, ins + h2);316 c.lineTo(ins + r2, ins + h2);317 c.arcTo(r2, r2, 0, 0, 1, ins, ins + h2 - r2);318 c.close();319 320 c.moveTo(w - 3 * h2 - 3 * ins, ins + r2);321 c.arcTo(r2, r2, 0, 0, 1, w - 3 * h2 - 3 * ins + r2, ins);322 c.lineTo(w - 2 * h2 - 3 * ins - r2, ins);323 c.arcTo(r2, r2, 0, 0, 1, w - 2 * h2 - 3 * ins, ins + r2);324 c.lineTo(w - 2 * h2 - 3 * ins, ins + h2 - r2);325 c.arcTo(r2, r2, 0, 0, 1, w - 2 * h2 - 3 * ins - r2, ins + h2);326 c.lineTo(w - 3 * h2 - 3 * ins + r2, ins + h2);327 c.arcTo(r2, r2, 0, 0, 1, w - 3 * h2 - 3 * ins, ins + h2 - r2);328 c.close();329 330 c.moveTo(w - 2 * h2 - 2 * ins, ins + r2);331 c.arcTo(r2, r2, 0, 0, 1, w - 2 * h2 - 2 * ins + r2, ins);332 c.lineTo(w - h2 - 2 * ins - r2, ins);333 c.arcTo(r2, r2, 0, 0, 1, w - h2 - 2 * ins, ins + r2);334 c.lineTo(w - h2 - 2 * ins, ins + h2 - r2);335 c.arcTo(r2, r2, 0, 0, 1, w - h2 - 2 * ins - r2, ins + h2);336 c.lineTo(w - 2 * h2 - 2 * ins + r2, ins + h2);337 c.arcTo(r2, r2, 0, 0, 1, w - 2 * h2 - 2 * ins, ins + h2 - r2);338 c.close();339 340 c.moveTo(w - h2 - ins, ins + r2);341 c.arcTo(r2, r2, 0, 0, 1, w - h2 - ins + r2, ins);342 c.lineTo(w - ins - r2, ins);343 c.arcTo(r2, r2, 0, 0, 1, w - ins, ins + r2);344 c.lineTo(w - ins, ins + h2 - r2);345 c.arcTo(r2, r2, 0, 0, 1, w - ins - r2, ins + h2);346 c.lineTo(w - h2 - ins + r2, ins + h2);347 c.arcTo(r2, r2, 0, 0, 1, w - h2 - ins, ins + h2 - r2);348 c.close();349350 c.moveTo(ins, h2 + 2 * ins + r);351 c.arcTo(r, r, 0, 0, 1, ins + r, h2 + 2 * ins);352 c.lineTo(w - r - ins, h2 + 2 * ins);353 c.arcTo(r, r, 0, 0, 1, w - ins, h2 + 2 * ins + r);354 c.lineTo(w - ins, h - r - ins);355 c.arcTo(r, r, 0, 0, 1, w - r - ins, h - ins);356 c.lineTo(ins + r, h - ins);357 c.arcTo(r, r, 0, 0, 1, ins, h - r - ins);358 c.close();359 c.fill();360 361 c.fill();362 }363};364365mxCellRenderer.registerShape(mxShapeC4WebBrowserContainer2.prototype.cst.WEB_BROWSER_CONTAINER2_SHAPE, mxShapeC4WebBrowserContainer2);366