mxMockupGraphics.js 33 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187
  1. /**
  2. * $Id: mxMockupGraphics.js,v 1.5 2013/05/22 12:28:49 mate Exp $
  3. * Copyright (c) 2006-2010, JGraph Ltd
  4. */
  5. //**********************************************************************************************************************************************************
  6. //Bar Chart
  7. //**********************************************************************************************************************************************************
  8. /**
  9. * Extends mxShape.
  10. */
  11. function mxShapeMockupBarChart(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. };
  19. /**
  20. * Extends mxShape.
  21. */
  22. mxUtils.extend(mxShapeMockupBarChart, mxShape);
  23. mxShapeMockupBarChart.prototype.cst = {
  24. STROKE_COLOR2 : 'strokeColor2',
  25. STROKE_COLOR3 : 'strokeColor3',
  26. FILL_COLOR2 : 'fillColor2',
  27. FILL_COLOR3 : 'fillColor3',
  28. SHAPE_BAR_CHART : 'mxgraph.mockup.graphics.barChart'
  29. };
  30. /**
  31. * Function: paintVertexShape
  32. *
  33. * Paints the vertex shape.
  34. */
  35. mxShapeMockupBarChart.prototype.paintVertexShape = function(c, x, y, w, h)
  36. {
  37. c.translate(x, y);
  38. this.background(c, x, y, w, h);
  39. var bgFill = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, 'none');
  40. if (bgFill !== 'none')
  41. {
  42. c.setShadow(false);
  43. }
  44. this.bars(c, x, y, w, h);
  45. };
  46. mxShapeMockupBarChart.prototype.background = function(c, x, y, w, h, bgColor, frameColor)
  47. {
  48. c.rect(0, 0, w, h);
  49. c.fillAndStroke();
  50. };
  51. mxShapeMockupBarChart.prototype.bars = function(c, x, y, w, h)
  52. {
  53. var barStroke = mxUtils.getValue(this.style, mxShapeMockupBarChart.prototype.cst.STROKE_COLOR2, 'none');
  54. var coordStroke = mxUtils.getValue(this.style, mxShapeMockupBarChart.prototype.cst.STROKE_COLOR3, '#666666');
  55. var barFill1 = mxUtils.getValue(this.style, mxShapeMockupBarChart.prototype.cst.FILL_COLOR2, '#008cff');
  56. var barFill2 = mxUtils.getValue(this.style, mxShapeMockupBarChart.prototype.cst.FILL_COLOR3, '#dddddd');
  57. var strokeWidth = mxUtils.getValue(this.style, mxConstants.STYLE_STROKEWIDTH, '1');
  58. c.setStrokeColor(barStroke);
  59. c.setFillColor(barFill1);
  60. c.rect(0, h * 0.2, w * 0.75, h * 0.05);
  61. c.fillAndStroke();
  62. c.rect(0, h * 0.45, w * 0.6, h * 0.05);
  63. c.fillAndStroke();
  64. c.rect(0, h * 0.7, w * 0.95, h * 0.05);
  65. c.fillAndStroke();
  66. c.setFillColor(barFill2);
  67. c.rect(0, h * 0.25, w * 0.85, h * 0.05);
  68. c.fillAndStroke();
  69. c.rect(0, h * 0.5, w * 0.65, h * 0.05);
  70. c.fillAndStroke();
  71. c.rect(0, h * 0.75, w * 0.8, h * 0.05);
  72. c.fillAndStroke();
  73. c.setStrokeWidth(strokeWidth * 2);
  74. c.setStrokeColor(coordStroke);
  75. c.setShadow(false);
  76. c.begin();
  77. c.moveTo(0,0);
  78. c.lineTo(0, h);
  79. c.lineTo(w, h);
  80. c.stroke();
  81. };
  82. mxCellRenderer.prototype.defaultShapes[mxShapeMockupBarChart.prototype.cst.SHAPE_BAR_CHART] = mxShapeMockupBarChart;
  83. //**********************************************************************************************************************************************************
  84. //Column Chart
  85. //**********************************************************************************************************************************************************
  86. /**
  87. * Extends mxShape.
  88. */
  89. function mxShapeMockupColumnChart(bounds, fill, stroke, strokewidth)
  90. {
  91. mxShape.call(this);
  92. this.bounds = bounds;
  93. this.fill = fill;
  94. this.stroke = stroke;
  95. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  96. };
  97. /**
  98. * Extends mxShape.
  99. */
  100. mxUtils.extend(mxShapeMockupColumnChart, mxShape);
  101. mxShapeMockupColumnChart.prototype.cst = {
  102. STROKE_COLOR2 : 'strokeColor2',
  103. STROKE_COLOR3 : 'strokeColor3',
  104. FILL_COLOR2 : 'fillColor2',
  105. FILL_COLOR3 : 'fillColor3',
  106. SHAPE_COLUMN_CHART : 'mxgraph.mockup.graphics.columnChart'
  107. };
  108. /**
  109. * Function: paintVertexShape
  110. *
  111. * Paints the vertex shape.
  112. */
  113. mxShapeMockupColumnChart.prototype.paintVertexShape = function(c, x, y, w, h)
  114. {
  115. c.translate(x, y);
  116. this.background(c, x, y, w, h);
  117. var bgFill = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, 'none');
  118. if (bgFill !== 'none')
  119. {
  120. c.setShadow(false);
  121. }
  122. this.bars(c, x, y, w, h);
  123. };
  124. mxShapeMockupColumnChart.prototype.background = function(c, x, y, w, h, bgColor, frameColor)
  125. {
  126. c.rect(0, 0, w, h);
  127. c.fillAndStroke();
  128. };
  129. mxShapeMockupColumnChart.prototype.bars = function(c, x, y, w, h)
  130. {
  131. var barStroke = mxUtils.getValue(this.style, mxShapeMockupColumnChart.prototype.cst.STROKE_COLOR2, 'none');
  132. var coordStroke = mxUtils.getValue(this.style, mxShapeMockupColumnChart.prototype.cst.STROKE_COLOR3, '#666666');
  133. var barFill1 = mxUtils.getValue(this.style, mxShapeMockupColumnChart.prototype.cst.FILL_COLOR2, '#008cff');
  134. var barFill2 = mxUtils.getValue(this.style, mxShapeMockupColumnChart.prototype.cst.FILL_COLOR3, '#dddddd');
  135. var strokeWidth = mxUtils.getValue(this.style, mxConstants.STYLE_STROKEWIDTH, '1');
  136. c.setStrokeColor(barStroke);
  137. c.setFillColor(barFill1);
  138. c.rect(w * 0.2, h * 0.25, w * 0.05, h * 0.75);
  139. c.fillAndStroke();
  140. c.rect(w * 0.45, h * 0.4, w * 0.05, h * 0.6);
  141. c.fillAndStroke();
  142. c.rect(w * 0.7, h * 0.05, w * 0.05, h * 0.95);
  143. c.fillAndStroke();
  144. c.setFillColor(barFill2);
  145. c.rect(w * 0.25, h * 0.15, w * 0.05, h * 0.85);
  146. c.fillAndStroke();
  147. c.rect(w * 0.5, h * 0.35, w * 0.05, h * 0.65);
  148. c.fillAndStroke();
  149. c.rect(w * 0.75, h * 0.2, w * 0.05, h * 0.8);
  150. c.fillAndStroke();
  151. c.setStrokeWidth(strokeWidth * 2);
  152. c.setStrokeColor(coordStroke);
  153. c.setShadow(false);
  154. c.begin();
  155. c.moveTo(0,0);
  156. c.lineTo(0, h);
  157. c.lineTo(w, h);
  158. c.stroke();
  159. };
  160. mxCellRenderer.prototype.defaultShapes[mxShapeMockupColumnChart.prototype.cst.SHAPE_COLUMN_CHART] = mxShapeMockupColumnChart;
  161. //**********************************************************************************************************************************************************
  162. //Line Chart
  163. //**********************************************************************************************************************************************************
  164. /**
  165. * Extends mxShape.
  166. */
  167. function mxShapeMockupLineChart(bounds, fill, stroke, strokewidth)
  168. {
  169. mxShape.call(this);
  170. this.bounds = bounds;
  171. this.fill = fill;
  172. this.stroke = stroke;
  173. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  174. };
  175. /**
  176. * Extends mxShape.
  177. */
  178. mxUtils.extend(mxShapeMockupLineChart, mxShape);
  179. mxShapeMockupLineChart.prototype.cst = {
  180. STROKE_COLOR2 : 'strokeColor2',
  181. STROKE_COLOR3 : 'strokeColor3',
  182. STROKE_COLOR4 : 'strokeColor4',
  183. SHAPE_LINE_CHART : 'mxgraph.mockup.graphics.lineChart'
  184. };
  185. /**
  186. * Function: paintVertexShape
  187. *
  188. * Paints the vertex shape.
  189. */
  190. mxShapeMockupLineChart.prototype.paintVertexShape = function(c, x, y, w, h)
  191. {
  192. c.translate(x, y);
  193. this.background(c, x, y, w, h);
  194. var bgFill = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, 'none');
  195. if (bgFill !== 'none')
  196. {
  197. c.setShadow(false);
  198. }
  199. this.bars(c, x, y, w, h);
  200. };
  201. mxShapeMockupLineChart.prototype.background = function(c, x, y, w, h, bgColor, frameColor)
  202. {
  203. c.rect(0, 0, w, h);
  204. c.fillAndStroke();
  205. };
  206. mxShapeMockupLineChart.prototype.bars = function(c, x, y, w, h)
  207. {
  208. var coordStroke = mxUtils.getValue(this.style, mxShapeMockupLineChart.prototype.cst.STROKE_COLOR2, '#666666');
  209. var line1Stroke = mxUtils.getValue(this.style, mxShapeMockupLineChart.prototype.cst.STROKE_COLOR3, '#008cff');
  210. var line2Stroke = mxUtils.getValue(this.style, mxShapeMockupLineChart.prototype.cst.STROKE_COLOR4, '#dddddd');
  211. var strokeWidth = mxUtils.getValue(this.style, mxConstants.STYLE_STROKEWIDTH, '1');
  212. c.setStrokeWidth(strokeWidth * 2);
  213. c.setStrokeColor(line2Stroke);
  214. c.begin();
  215. c.moveTo(0, h);
  216. c.lineTo(w * 0.3, h * 0.5);
  217. c.lineTo(w * 0.6, h * 0.74);
  218. c.lineTo(w * 0.9, h * 0.24);
  219. c.stroke();
  220. c.setStrokeColor(line1Stroke);
  221. c.begin();
  222. c.moveTo(0, h);
  223. c.lineTo(w * 0.3, h * 0.65);
  224. c.lineTo(w * 0.6, h * 0.6);
  225. c.lineTo(w * 0.9, h * 0.35);
  226. c.stroke();
  227. c.setStrokeColor(coordStroke);
  228. c.setShadow(false);
  229. c.begin();
  230. c.moveTo(0,0);
  231. c.lineTo(0, h);
  232. c.lineTo(w, h);
  233. c.stroke();
  234. };
  235. mxCellRenderer.prototype.defaultShapes[mxShapeMockupLineChart.prototype.cst.SHAPE_LINE_CHART] = mxShapeMockupLineChart;
  236. //**********************************************************************************************************************************************************
  237. //Pie Chart
  238. //**********************************************************************************************************************************************************
  239. /**
  240. * Extends mxShape.
  241. */
  242. function mxShapeMockupPieChart(bounds, fill, stroke, strokewidth)
  243. {
  244. mxShape.call(this);
  245. this.bounds = bounds;
  246. this.fill = fill;
  247. this.stroke = stroke;
  248. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  249. };
  250. /**
  251. * Extends mxShape.
  252. */
  253. mxUtils.extend(mxShapeMockupPieChart, mxShape);
  254. mxShapeMockupPieChart.prototype.cst = {
  255. PARTS : 'parts',
  256. PART_COLORS : 'partColors',
  257. SHAPE_PIE_CHART : 'mxgraph.mockup.graphics.pieChart'
  258. };
  259. /**
  260. * Function: paintVertexShape
  261. *
  262. * Paints the vertex shape.
  263. */
  264. mxShapeMockupPieChart.prototype.paintVertexShape = function(c, x, y, w, h)
  265. {
  266. c.translate(x, y);
  267. this.background(c, x, y, w, h);
  268. c.setShadow(false);
  269. this.foreground(c, x, y, w, h);
  270. };
  271. mxShapeMockupPieChart.prototype.background = function(c, x, y, w, h, bgColor, frameColor)
  272. {
  273. c.ellipse(0, 0, w, h);
  274. c.fillAndStroke();
  275. };
  276. mxShapeMockupPieChart.prototype.foreground = function(c, x, y, w, h)
  277. {
  278. var parts = mxUtils.getValue(this.style, mxShapeMockupPieChart.prototype.cst.PARTS, '10,20,30').toString().split(',');
  279. var partNum = parts.length;
  280. var partColors = mxUtils.getValue(this.style, mxShapeMockupPieChart.prototype.cst.PART_COLORS, '#333333,#666666,#999999').toString().split(',');
  281. var total = 0;
  282. for (var i = 0; i < partNum; i++)
  283. {
  284. total = total + parseInt(parts[i], 10);
  285. }
  286. for (var i = 0; i < partNum; i++)
  287. {
  288. if (partColors.length > i)
  289. {
  290. c.setFillColor(partColors[i]);
  291. }
  292. else
  293. {
  294. c.setFillColor('#ff0000');
  295. }
  296. var beginPerc = 0;
  297. var endPerc = 0;
  298. var currPerc = parseInt(parts[i], 10) / total;
  299. if (currPerc === 0.5)
  300. {
  301. currPerc = 0.501;
  302. }
  303. for (var j = 0; j < i; j++)
  304. {
  305. beginPerc = beginPerc + parseInt(parts[j], 10) / total;
  306. }
  307. endPerc = currPerc + beginPerc;
  308. var startAngle = 2 * Math.PI * beginPerc;
  309. var endAngle = 2 * Math.PI * endPerc;
  310. var x1 = w * 0.5 - w * Math.sin(startAngle) * 0.5;
  311. var y1 = h * 0.5 - h * Math.cos(startAngle) * 0.5;
  312. var x2 = w * 0.5 - w * Math.sin(endAngle) * 0.5;
  313. var y2 = h * 0.5 - h * Math.cos(endAngle) * 0.5;
  314. var largeArc = 1;
  315. var sweep = 1;
  316. if (endPerc - beginPerc < 0.5)
  317. {
  318. largeArc = 0;
  319. }
  320. c.begin();
  321. c.moveTo(w * 0.5, h * 0.5);
  322. c.lineTo(x2, y2);
  323. c.arcTo(w * 0.5, h * 0.5, 0, largeArc, 1, x1, y1);
  324. c.close();
  325. c.fillAndStroke();
  326. }
  327. };
  328. mxCellRenderer.prototype.defaultShapes[mxShapeMockupPieChart.prototype.cst.SHAPE_PIE_CHART] = mxShapeMockupPieChart;
  329. //**********************************************************************************************************************************************************
  330. //Icon Grid (LEGACY)
  331. //**********************************************************************************************************************************************************
  332. /**
  333. * Extends mxShape.
  334. */
  335. function mxShapeMockupIconGrid(bounds, fill, stroke, strokewidth)
  336. {
  337. mxShape.call(this);
  338. this.bounds = bounds;
  339. this.fill = fill;
  340. this.stroke = stroke;
  341. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  342. };
  343. /**
  344. * Extends mxShape.
  345. */
  346. mxUtils.extend(mxShapeMockupIconGrid, mxShape);
  347. mxShapeMockupIconGrid.prototype.cst = {
  348. GRID_SIZE : 'gridSize',
  349. SHAPE_ICON_GRID : 'mxgraph.mockup.graphics.iconGrid'
  350. };
  351. /**
  352. * Function: paintVertexShape
  353. *
  354. * Paints the vertex shape.
  355. */
  356. mxShapeMockupIconGrid.prototype.paintVertexShape = function(c, x, y, w, h)
  357. {
  358. c.translate(x, y);
  359. var gridSize = mxUtils.getValue(this.style, mxShapeMockupIconGrid.prototype.cst.GRID_SIZE, '3,3').toString().split(',');
  360. this.background(c, w, h, gridSize);
  361. c.setShadow(false);
  362. this.foreground(c, w, h, gridSize);
  363. };
  364. mxShapeMockupIconGrid.prototype.background = function(c, w, h, gridSize)
  365. {
  366. var boxSizeX = w / (parseInt(gridSize[0],10) + (gridSize[0]-1) * 0.5);
  367. var boxSizeY = h / (parseInt(gridSize[1],10) + (gridSize[1]-1) * 0.5);
  368. for (var i = 0; i < gridSize[0]; i++)
  369. {
  370. for (var j = 0; j < gridSize[1]; j++)
  371. {
  372. c.rect(boxSizeX * 1.5 * i, boxSizeY * 1.5 * j, boxSizeX, boxSizeY);
  373. c.fillAndStroke();
  374. }
  375. }
  376. };
  377. mxShapeMockupIconGrid.prototype.foreground = function(c, w, h, gridSize)
  378. {
  379. var boxSizeX = w / (parseInt(gridSize[0],10) + (gridSize[0]-1) * 0.5);
  380. var boxSizeY = h / (parseInt(gridSize[1],10) + (gridSize[1]-1) * 0.5);
  381. for (var i = 0; i < gridSize[0]; i++)
  382. {
  383. for (var j = 0; j < gridSize[1]; j++)
  384. {
  385. c.begin();
  386. c.moveTo(boxSizeX * 1.5 * i, boxSizeY * 1.5 * j);
  387. c.lineTo(boxSizeX * 1.5 * i + boxSizeX, boxSizeY * 1.5 * j + boxSizeY);
  388. c.moveTo(boxSizeX * 1.5 * i + boxSizeX, boxSizeY * 1.5 * j);
  389. c.lineTo(boxSizeX * 1.5 * i, boxSizeY * 1.5 * j + boxSizeY);
  390. c.stroke();
  391. }
  392. }
  393. };
  394. mxCellRenderer.prototype.defaultShapes[mxShapeMockupIconGrid.prototype.cst.SHAPE_ICON_GRID] = mxShapeMockupIconGrid;
  395. //**********************************************************************************************************************************************************
  396. //Bubble Chart
  397. //**********************************************************************************************************************************************************
  398. /**
  399. * Extends mxShape.
  400. */
  401. function mxShapeMockupBubbleChart(bounds, fill, stroke, strokewidth)
  402. {
  403. mxShape.call(this);
  404. this.bounds = bounds;
  405. this.fill = fill;
  406. this.stroke = stroke;
  407. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  408. };
  409. /**
  410. * Extends mxShape.
  411. */
  412. mxUtils.extend(mxShapeMockupBubbleChart, mxShape);
  413. mxShapeMockupBubbleChart.prototype.cst = {
  414. STROKE_COLOR2 : 'strokeColor2',
  415. STROKE_COLOR3 : 'strokeColor3',
  416. FILL_COLOR2 : 'fillColor2',
  417. FILL_COLOR3 : 'fillColor3',
  418. SHAPE_BUBBLE_CHART : 'mxgraph.mockup.graphics.bubbleChart'
  419. };
  420. /**
  421. * Function: paintVertexShape
  422. *
  423. * Paints the vertex shape.
  424. */
  425. mxShapeMockupBubbleChart.prototype.paintVertexShape = function(c, x, y, w, h)
  426. {
  427. c.translate(x, y);
  428. this.background(c, x, y, w, h);
  429. var bgFill = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, 'none');
  430. if (bgFill !== 'none')
  431. {
  432. c.setShadow(false);
  433. }
  434. this.bars(c, x, y, w, h);
  435. };
  436. mxShapeMockupBubbleChart.prototype.background = function(c, x, y, w, h, bgColor, frameColor)
  437. {
  438. c.rect(0, 0, w, h);
  439. c.fillAndStroke();
  440. };
  441. mxShapeMockupBubbleChart.prototype.bars = function(c, x, y, w, h)
  442. {
  443. var barStroke = mxUtils.getValue(this.style, mxShapeMockupBubbleChart.prototype.cst.STROKE_COLOR2, 'none');
  444. var coordStroke = mxUtils.getValue(this.style, mxShapeMockupBubbleChart.prototype.cst.STROKE_COLOR3, '#666666');
  445. var barFill1 = mxUtils.getValue(this.style, mxShapeMockupBubbleChart.prototype.cst.FILL_COLOR2, '#008cff');
  446. var barFill2 = mxUtils.getValue(this.style, mxShapeMockupBubbleChart.prototype.cst.FILL_COLOR3, '#dddddd');
  447. var strokeWidth = mxUtils.getValue(this.style, mxConstants.STYLE_STROKEWIDTH, '1');
  448. c.setStrokeColor(barStroke);
  449. c.setFillColor(barFill1);
  450. var cx = w * 0.4;
  451. var cy = h * 0.45;
  452. var r = Math.min(h, w) * 0.14;
  453. c.ellipse(cx - r, cy - r, 2 * r, 2 * r);
  454. c.fillAndStroke();
  455. cx = w * 0.1;
  456. cy = h * 0.8;
  457. r = Math.min(h, w) * 0.1;
  458. c.ellipse(cx - r, cy - r, 2 * r, 2 * r);
  459. c.fillAndStroke();
  460. cx = w * 0.7;
  461. cy = h * 0.7;
  462. r = Math.min(h, w) * 0.22;
  463. c.ellipse(cx - r, cy - r, 2 * r, 2 * r);
  464. c.fillAndStroke();
  465. c.setFillColor(barFill2);
  466. cx = w * 0.15;
  467. cy = h * 0.25;
  468. r = Math.min(h, w) * 0.19;
  469. c.ellipse(cx - r, cy - r, 2 * r, 2 * r);
  470. c.fillAndStroke();
  471. cx = w * 0.48;
  472. cy = h * 0.7;
  473. r = Math.min(h, w) * 0.12;
  474. c.ellipse(cx - r, cy - r, 2 * r, 2 * r);
  475. c.fillAndStroke();
  476. cx = w * 0.74;
  477. cy = h * 0.17;
  478. r = Math.min(h, w) * 0.1;
  479. c.ellipse(cx - r, cy - r, 2 * r, 2 * r);
  480. c.fillAndStroke();
  481. c.setStrokeWidth(strokeWidth * 2);
  482. c.setStrokeColor(coordStroke);
  483. c.setShadow(false);
  484. c.begin();
  485. c.moveTo(0,0);
  486. c.lineTo(0, h);
  487. c.lineTo(w, h);
  488. c.stroke();
  489. };
  490. mxCellRenderer.prototype.defaultShapes[mxShapeMockupBubbleChart.prototype.cst.SHAPE_BUBBLE_CHART] = mxShapeMockupBubbleChart;
  491. //**********************************************************************************************************************************************************
  492. //Gauge
  493. //**********************************************************************************************************************************************************
  494. /**
  495. * Extends mxShape.
  496. */
  497. function mxShapeMockupGauge(bounds, fill, stroke, strokewidth)
  498. {
  499. mxShape.call(this);
  500. this.bounds = bounds;
  501. this.fill = fill;
  502. this.stroke = stroke;
  503. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  504. this.gaugePos = 25;
  505. };
  506. /**
  507. * Extends mxShape.
  508. */
  509. mxUtils.extend(mxShapeMockupGauge, mxShape);
  510. mxShapeMockupGauge.prototype.cst = {
  511. SCALE_COLORS : 'scaleColors',
  512. GAUGE_LABELS : 'gaugeLabels',
  513. NEEDLE_COLOR : 'needleColor',
  514. TEXT_COLOR : 'textColor',
  515. TEXT_SIZE : 'textSize',
  516. GAUGE_POS : 'gaugePos',
  517. SHAPE_GAUGE : 'mxgraph.mockup.graphics.gauge'
  518. };
  519. /**
  520. * Function: paintVertexShape
  521. *
  522. * Paints the vertex shape.
  523. */
  524. mxShapeMockupGauge.prototype.paintVertexShape = function(c, x, y, w, h)
  525. {
  526. c.translate(x, y);
  527. this.background(c, w, h);
  528. c.setShadow(false);
  529. this.foreground(c, w, h);
  530. };
  531. mxShapeMockupGauge.prototype.background = function(c, w, h)
  532. {
  533. c.ellipse(0, 0, w, h);
  534. c.fillAndStroke();
  535. };
  536. mxShapeMockupGauge.prototype.foreground = function(c, w, h)
  537. {
  538. var gaugePos = mxUtils.getValue(this.style, mxShapeMockupGauge.prototype.cst.GAUGE_POS, '0');
  539. var scaleColors = mxUtils.getValue(this.style, mxShapeMockupGauge.prototype.cst.SCALE_COLORS, '#888888,#aaaaaa,#444444').toString().split(',');
  540. var gaugeLabels = mxUtils.getValue(this.style, mxShapeMockupGauge.prototype.cst.GAUGE_LABELS, 'CPU[%],0,100').toString().split(',');
  541. var needleColor = mxUtils.getValue(this.style, mxShapeMockupGauge.prototype.cst.NEEDLE_COLOR, '#008cff');
  542. var fillColor = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, '#ffffff');
  543. var textColor = mxUtils.getValue(this.style, mxShapeMockupGauge.prototype.cst.TEXT_COLOR, '#666666');
  544. var textSize = mxUtils.getValue(this.style, mxShapeMockupGauge.prototype.cst.TEXT_SIZE, '12');
  545. gaugePos = Math.max(0, gaugePos);
  546. gaugePos = Math.min(100, gaugePos);
  547. c.setFillColor(scaleColors[1]);
  548. c.begin();
  549. c.moveTo(w * 0.05, h * 0.5);
  550. c.arcTo(w * 0.4, h * 0.4, 0, 0, 1, w * 0.95, h * 0.5);
  551. c.lineTo(w, h * 0.5);
  552. c.arcTo(w * 0.5, h * 0.5, 0, 0, 0, 0, h * 0.5);
  553. c.close();
  554. c.fill();
  555. c.setFillColor(scaleColors[0]);
  556. c.begin();
  557. c.moveTo(w * 0.05, h * 0.5);
  558. c.arcTo(w * 0.45, h * 0.45, 0, 0, 0, w * 0.182, h * 0.818);
  559. c.lineTo(w * 0.146, h * 0.854);
  560. c.arcTo(w * 0.5, h * 0.5, 0, 0, 1, 0, h * 0.5);
  561. c.close();
  562. c.fill();
  563. c.setFillColor(scaleColors[2]);
  564. c.begin();
  565. c.moveTo(w, h * 0.5);
  566. c.arcTo(w * 0.5, h * 0.5, 0, 0, 1, w * 0.854, h * 0.854);
  567. c.lineTo(w * 0.818, h * 0.818);
  568. c.arcTo(w * 0.45, h * 0.45, 0, 0, 0, w * 0.95, h * 0.5);
  569. c.close();
  570. c.fill();
  571. c.setFontSize(textSize);
  572. c.setFontColor(textColor);
  573. c.text(w * 0.5, h * 0.3, 0, 0, gaugeLabels[0], mxConstants.ALIGN_CENTER, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  574. c.text(w * 0.2, h * 0.85, 0, 0, gaugeLabels[1], mxConstants.ALIGN_LEFT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  575. c.text(w * 0.8, h * 0.85, 0, 0, gaugeLabels[2], mxConstants.ALIGN_RIGHT, mxConstants.ALIGN_MIDDLE, 0, null, 0, 0, 0);
  576. var needlePos = (0.75 * (2 * Math.PI * parseFloat(gaugePos) / 100) + 1.25 * Math.PI);
  577. var x1 = w * 0.5 + w * 0.38 * Math.sin(needlePos);
  578. var y1 = h * 0.5 - h * 0.38 * Math.cos(needlePos);
  579. var x2 = 0;
  580. var y2 = 0;
  581. c.setFillColor(needleColor);
  582. c.begin();
  583. c.moveTo(x1, y1);
  584. x1 = w * 0.5 + w * 0.05 * Math.cos(needlePos);
  585. y1 = h * 0.5 + h * 0.05 * Math.sin(needlePos);
  586. c.lineTo(x1, y1);
  587. x2 = w * 0.5 + w * (-0.05) * Math.sin(needlePos);
  588. y2 = h * 0.5 - h * (-0.05) * Math.cos(needlePos);
  589. c.arcTo(w * 0.05, h * 0.05, 0, 0, 1, x2, y2);
  590. x1 = x2;
  591. y1 = y2;
  592. x2 = w * 0.5 - w * 0.05 * Math.cos(needlePos);
  593. y2 = h * 0.5 - h * 0.05 * Math.sin(needlePos);
  594. c.arcTo(w * 0.05, h * 0.05, 0, 0, 1, x2, y2);
  595. c.close();
  596. c.fill();
  597. c.setFillColor(fillColor);
  598. c.begin();
  599. c.moveTo(w * 0.49, h * 0.49);
  600. c.lineTo(w * 0.51, h * 0.49);
  601. c.lineTo(w * 0.51, h * 0.51);
  602. c.lineTo(w * 0.49, h * 0.51);
  603. c.close();
  604. c.fill();
  605. c.begin();
  606. c.ellipse(0, 0, w, h);
  607. c.stroke();
  608. c.begin();
  609. c.moveTo(w * 0.146, h * 0.854);
  610. c.lineTo(w * 0.219, h * 0.781);
  611. c.moveTo(w * 0.854, h * 0.854);
  612. c.lineTo(w * 0.781, h * 0.781);
  613. c.stroke();
  614. };
  615. mxCellRenderer.prototype.defaultShapes[mxShapeMockupGauge.prototype.cst.SHAPE_GAUGE] = mxShapeMockupGauge;
  616. Graph.handleFactory[mxShapeMockupGauge.prototype.cst.SHAPE_GAUGE] = function(state)
  617. {
  618. var handles = [Graph.createHandle(state, ['gaugePos'], function(bounds)
  619. {
  620. var gaugePos = Math.max(0, Math.min(100, parseFloat(mxUtils.getValue(this.state.style, 'gaugePos', this.gaugePos))));
  621. return new mxPoint(bounds.x + bounds.width * 0.2 + gaugePos * 0.6 * bounds.width / 100, bounds.y + bounds.height * 0.8);
  622. }, function(bounds, pt)
  623. {
  624. this.state.style['gaugePos'] = Math.round(1000 * Math.max(0, Math.min(100, (pt.x - bounds.x) * 100 / bounds.width))) / 1000;
  625. })];
  626. return handles;
  627. }
  628. //**********************************************************************************************************************************************************
  629. //Plot Chart
  630. //**********************************************************************************************************************************************************
  631. /**
  632. * Extends mxShape.
  633. */
  634. function mxShapeMockupPlotChart(bounds, fill, stroke, strokewidth)
  635. {
  636. mxShape.call(this);
  637. this.bounds = bounds;
  638. this.fill = fill;
  639. this.stroke = stroke;
  640. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  641. };
  642. /**
  643. * Extends mxShape.
  644. */
  645. mxUtils.extend(mxShapeMockupPlotChart, mxShape);
  646. mxShapeMockupPlotChart.prototype.cst = {
  647. STROKE_COLOR2 : 'strokeColor2',
  648. STROKE_COLOR3 : 'strokeColor3',
  649. SHAPES_COLORS : 'fillColor2',
  650. SHAPE_PLOT_CHART : 'mxgraph.mockup.graphics.plotChart'
  651. };
  652. /**
  653. * Function: paintVertexShape
  654. *
  655. * Paints the vertex shape.
  656. */
  657. mxShapeMockupPlotChart.prototype.paintVertexShape = function(c, x, y, w, h)
  658. {
  659. c.translate(x, y);
  660. this.background(c, x, y, w, h);
  661. var bgFill = mxUtils.getValue(this.style, mxConstants.STYLE_FILLCOLOR, 'none');
  662. if (bgFill !== 'none')
  663. {
  664. c.setShadow(false);
  665. }
  666. this.foreground(c, x, y, w, h);
  667. };
  668. mxShapeMockupPlotChart.prototype.background = function(c, x, y, w, h, bgColor, frameColor)
  669. {
  670. c.rect(0, 0, w, h);
  671. c.fillAndStroke();
  672. };
  673. mxShapeMockupPlotChart.prototype.foreground = function(c, x, y, w, h)
  674. {
  675. var shapeStroke = mxUtils.getValue(this.style, mxShapeMockupPlotChart.prototype.cst.STROKE_COLOR2, '#dddddd');
  676. var coordStroke = mxUtils.getValue(this.style, mxShapeMockupPlotChart.prototype.cst.STROKE_COLOR3, '#666666');
  677. var shapesColors = mxUtils.getValue(this.style, mxShapeMockupPlotChart.prototype.cst.SHAPES_COLORS, '#00aaff,#0044ff,#008cff').toString().split(',');
  678. var strokeWidth = mxUtils.getValue(this.style, mxConstants.STYLE_STROKEWIDTH, '1');
  679. var shapeSize = Math.min(w, h) * 0.03;
  680. c.setStrokeColor(shapeStroke);
  681. c.setFillColor(shapesColors[0]);
  682. var cx = w * 0.2;
  683. var cy = h * 0.8;
  684. c.begin();
  685. c.moveTo(cx - shapeSize * 0.5, cy - shapeSize * 0.5);
  686. c.lineTo(cx + shapeSize * 0.5, cy - shapeSize * 0.5);
  687. c.lineTo(cx + shapeSize * 0.5, cy + shapeSize * 0.5);
  688. c.lineTo(cx - shapeSize * 0.5, cy + shapeSize * 0.5);
  689. c.close();
  690. c.fillAndStroke();
  691. cx = w * 0.3;
  692. cy = h * 0.65;
  693. c.begin();
  694. c.moveTo(cx - shapeSize * 0.5, cy - shapeSize * 0.5);
  695. c.lineTo(cx + shapeSize * 0.5, cy - shapeSize * 0.5);
  696. c.lineTo(cx + shapeSize * 0.5, cy + shapeSize * 0.5);
  697. c.lineTo(cx - shapeSize * 0.5, cy + shapeSize * 0.5);
  698. c.close();
  699. c.fillAndStroke();
  700. cx = w * 0.6;
  701. cy = h * 0.44;
  702. c.begin();
  703. c.moveTo(cx - shapeSize * 0.5, cy - shapeSize * 0.5);
  704. c.lineTo(cx + shapeSize * 0.5, cy - shapeSize * 0.5);
  705. c.lineTo(cx + shapeSize * 0.5, cy + shapeSize * 0.5);
  706. c.lineTo(cx - shapeSize * 0.5, cy + shapeSize * 0.5);
  707. c.close();
  708. c.fillAndStroke();
  709. cx = w * 0.85;
  710. cy = h * 0.9;
  711. c.begin();
  712. c.moveTo(cx - shapeSize * 0.5, cy - shapeSize * 0.5);
  713. c.lineTo(cx + shapeSize * 0.5, cy - shapeSize * 0.5);
  714. c.lineTo(cx + shapeSize * 0.5, cy + shapeSize * 0.5);
  715. c.lineTo(cx - shapeSize * 0.5, cy + shapeSize * 0.5);
  716. c.close();
  717. c.fillAndStroke();
  718. c.setFillColor(shapesColors[1]);
  719. cx = w * 0.08;
  720. cy = h * 0.65;
  721. c.begin();
  722. c.moveTo(cx, cy - shapeSize * 0.5);
  723. c.lineTo(cx + shapeSize * 0.5, cy + shapeSize * 0.5);
  724. c.lineTo(cx - shapeSize * 0.5, cy + shapeSize * 0.5);
  725. c.close();
  726. c.fillAndStroke();
  727. cx = w * 0.58;
  728. cy = h * 0.85;
  729. c.begin();
  730. c.moveTo(cx, cy - shapeSize * 0.5);
  731. c.lineTo(cx + shapeSize * 0.5, cy + shapeSize * 0.5);
  732. c.lineTo(cx - shapeSize * 0.5, cy + shapeSize * 0.5);
  733. c.close();
  734. c.fillAndStroke();
  735. cx = w * 0.72;
  736. cy = h * 0.92;
  737. c.begin();
  738. c.moveTo(cx, cy - shapeSize * 0.5);
  739. c.lineTo(cx + shapeSize * 0.5, cy + shapeSize * 0.5);
  740. c.lineTo(cx - shapeSize * 0.5, cy + shapeSize * 0.5);
  741. c.close();
  742. c.fillAndStroke();
  743. c.setFillColor(shapesColors[2]);
  744. cx = w * 0.32;
  745. cy = h * 0.28;
  746. c.begin();
  747. c.moveTo(cx, cy - shapeSize * 0.75);
  748. c.lineTo(cx + shapeSize * 0.75, cy);
  749. c.lineTo(cx, cy + shapeSize * 0.75);
  750. c.lineTo(cx - shapeSize * 0.75, cy);
  751. c.close();
  752. c.fillAndStroke();
  753. cx = w * 0.92;
  754. cy = h * 0.45;
  755. c.begin();
  756. c.moveTo(cx, cy - shapeSize * 0.75);
  757. c.lineTo(cx + shapeSize * 0.75, cy);
  758. c.lineTo(cx, cy + shapeSize * 0.75);
  759. c.lineTo(cx - shapeSize * 0.75, cy);
  760. c.close();
  761. c.fillAndStroke();
  762. cx = w * 0.81;
  763. cy = h * 0.37;
  764. c.begin();
  765. c.moveTo(cx, cy - shapeSize * 0.75);
  766. c.lineTo(cx + shapeSize * 0.75, cy);
  767. c.lineTo(cx, cy + shapeSize * 0.75);
  768. c.lineTo(cx - shapeSize * 0.75, cy);
  769. c.close();
  770. c.fillAndStroke();
  771. cx = w * 0.51;
  772. cy = h * 0.7;
  773. c.begin();
  774. c.moveTo(cx, cy - shapeSize * 0.75);
  775. c.lineTo(cx + shapeSize * 0.75, cy);
  776. c.lineTo(cx, cy + shapeSize * 0.75);
  777. c.lineTo(cx - shapeSize * 0.75, cy);
  778. c.close();
  779. c.fillAndStroke();
  780. c.setStrokeWidth(strokeWidth * 2);
  781. c.setStrokeColor(coordStroke);
  782. c.setShadow(false);
  783. c.begin();
  784. c.moveTo(0,0);
  785. c.lineTo(0, h);
  786. c.lineTo(w, h);
  787. c.stroke();
  788. };
  789. mxCellRenderer.prototype.defaultShapes[mxShapeMockupPlotChart.prototype.cst.SHAPE_PLOT_CHART] = mxShapeMockupPlotChart;
  790. //**********************************************************************************************************************************************************
  791. //Gantt Chart
  792. //**********************************************************************************************************************************************************
  793. /**
  794. * Extends mxShape.
  795. */
  796. function mxShapeMockupGanttChart(bounds, fill, stroke, strokewidth)
  797. {
  798. mxShape.call(this);
  799. this.bounds = bounds;
  800. this.fill = fill;
  801. this.stroke = stroke;
  802. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  803. };
  804. /**
  805. * Extends mxShape.
  806. */
  807. mxUtils.extend(mxShapeMockupGanttChart, mxShape);
  808. mxShapeMockupGanttChart.prototype.cst = {
  809. STROKE_COLOR2 : 'strokeColor2',
  810. STROKE_COLOR3 : 'strokeColor3',
  811. SHAPES_COLORS : 'fillColor2',
  812. TEXT_COLOR : 'textColor',
  813. TEXT_SIZE : 'textSize',
  814. SHAPE_GANTT_CHART : 'mxgraph.mockup.graphics.ganttChart'
  815. };
  816. /**
  817. * Function: paintVertexShape
  818. *
  819. * Paints the vertex shape.
  820. */
  821. mxShapeMockupGanttChart.prototype.paintVertexShape = function(c, x, y, w, h)
  822. {
  823. c.translate(x, y);
  824. this.background(c, x, y, w, h);
  825. c.setShadow(false);
  826. this.foreground(c, x, y, w, h);
  827. };
  828. mxShapeMockupGanttChart.prototype.background = function(c, x, y, w, h, bgColor, frameColor)
  829. {
  830. c.rect(0, 0, w, h);
  831. c.fillAndStroke();
  832. };
  833. mxShapeMockupGanttChart.prototype.foreground = function(c, x, y, w, h)
  834. {
  835. var shapesColors = mxUtils.getValue(this.style, mxShapeMockupGanttChart.prototype.cst.SHAPES_COLORS, '#888888,#bbbbbb').toString().split(',');
  836. var textColor = mxUtils.getValue(this.style, mxShapeMockupGanttChart.prototype.cst.TEXT_COLOR, '#666666');
  837. var textSize = mxUtils.getValue(this.style, mxShapeMockupGanttChart.prototype.cst.TEXT_SIZE, '#12');
  838. c.begin();
  839. c.moveTo(0, h * 0.13);
  840. c.lineTo(w, h * 0.13);
  841. c.moveTo(w * 0.4, 0);
  842. c.lineTo(w * 0.4, h);
  843. c.moveTo(w * 0.4, h * 0.065);
  844. c.lineTo(w, h * 0.065);
  845. c.moveTo(w * 0.03, 0);
  846. c.lineTo(w * 0.03, h * 0.13);
  847. c.moveTo(w * 0.1, 0);
  848. c.lineTo(w * 0.1, h * 0.13);
  849. c.moveTo(w * 0.315, 0);
  850. c.lineTo(w * 0.315, h * 0.13);
  851. c.moveTo(w * 0.45, h * 0.065);
  852. c.lineTo(w * 0.45, h * 0.13);
  853. c.moveTo(w * 0.5, h * 0.065);
  854. c.lineTo(w * 0.5, h);
  855. c.moveTo(w * 0.55, h * 0.065);
  856. c.lineTo(w * 0.55, h * 0.13);
  857. c.moveTo(w * 0.6, h * 0.065);
  858. c.lineTo(w * 0.6, h);
  859. c.moveTo(w * 0.65, h * 0.065);
  860. c.lineTo(w * 0.65, h * 0.13);
  861. c.moveTo(w * 0.7, h * 0.065);
  862. c.lineTo(w * 0.7, h);
  863. c.moveTo(w * 0.75, 0);
  864. c.lineTo(w * 0.75, h * 0.13);
  865. c.moveTo(w * 0.8, h * 0.065);
  866. c.lineTo(w * 0.8, h);
  867. c.moveTo(w * 0.85, h * 0.065);
  868. c.lineTo(w * 0.85, h * 0.13);
  869. c.moveTo(w * 0.9, h * 0.065);
  870. c.lineTo(w * 0.9, h);
  871. c.moveTo(w * 0.95, h * 0.065);
  872. c.lineTo(w * 0.95, h * 0.13);
  873. c.stroke();
  874. c.setFillColor(shapesColors[0]);
  875. c.begin();
  876. c.moveTo(w * 0.41, h * 0.15);
  877. c.lineTo(w * 0.64, h * 0.15);
  878. c.lineTo(w * 0.64, h * 0.18);
  879. c.lineTo(w * 0.625, h * 0.21);
  880. c.lineTo(w * 0.61, h * 0.18);
  881. c.lineTo(w * 0.44, h * 0.18);
  882. c.lineTo(w * 0.425, h * 0.21);
  883. c.lineTo(w * 0.41, h * 0.18);
  884. c.close();
  885. c.moveTo(w * 0.41, h * 0.24);
  886. c.lineTo(w * 0.49, h * 0.24);
  887. c.lineTo(w * 0.49, h * 0.275);
  888. c.lineTo(w * 0.41, h * 0.275);
  889. c.close();
  890. c.moveTo(w * 0.46, h * 0.31);
  891. c.lineTo(w * 0.64, h * 0.31);
  892. c.lineTo(w * 0.64, h * 0.345);
  893. c.lineTo(w * 0.46, h * 0.345);
  894. c.close();
  895. c.moveTo(w * 0.56, h * 0.39);
  896. c.lineTo(w * 0.69, h * 0.39);
  897. c.lineTo(w * 0.69, h * 0.425);
  898. c.lineTo(w * 0.56, h * 0.425);
  899. c.close();
  900. c.fill();
  901. c.setFillColor(shapesColors[1]);
  902. c.begin();
  903. c.moveTo(w * 0.46, h * 0.32);
  904. c.lineTo(w * 0.58, h * 0.32);
  905. c.lineTo(w * 0.58, h * 0.335);
  906. c.lineTo(w * 0.46, h * 0.335);
  907. c.close();
  908. c.fill();
  909. };
  910. mxCellRenderer.prototype.defaultShapes[mxShapeMockupGanttChart.prototype.cst.SHAPE_GANTT_CHART] = mxShapeMockupGanttChart;
  911. //**********************************************************************************************************************************************************
  912. //Simple Icon
  913. //**********************************************************************************************************************************************************
  914. /**
  915. * Extends mxShape.
  916. */
  917. function mxShapeMockupSimpleIcon(bounds, fill, stroke, strokewidth)
  918. {
  919. mxShape.call(this);
  920. this.bounds = bounds;
  921. this.fill = fill;
  922. this.stroke = stroke;
  923. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  924. };
  925. /**
  926. * Extends mxShape.
  927. */
  928. mxUtils.extend(mxShapeMockupSimpleIcon, mxShape);
  929. mxShapeMockupSimpleIcon.prototype.cst = {
  930. SIMPLE_ICON : 'mxgraph.mockup.graphics.simpleIcon'
  931. };
  932. /**
  933. * Function: paintVertexShape
  934. *
  935. * Paints the vertex shape.
  936. */
  937. mxShapeMockupSimpleIcon.prototype.paintVertexShape = function(c, x, y, w, h)
  938. {
  939. c.translate(x, y);
  940. c.rect(0, 0, w, h);
  941. c.fillAndStroke();
  942. c.begin();
  943. c.moveTo(0, 0);
  944. c.lineTo(w, h);
  945. c.moveTo(0, h);
  946. c.lineTo(w, 0);
  947. c.stroke();
  948. };
  949. mxCellRenderer.prototype.defaultShapes[mxShapeMockupSimpleIcon.prototype.cst.SIMPLE_ICON] = mxShapeMockupSimpleIcon;
  950. //**********************************************************************************************************************************************************
  951. //Anchor (a dummy shape without visuals used for anchoring)
  952. //**********************************************************************************************************************************************************
  953. /**
  954. * Extends mxShape.
  955. */
  956. function mxShapeMockupGraphicsAnchor(bounds, fill, stroke, strokewidth)
  957. {
  958. mxShape.call(this);
  959. this.bounds = bounds;
  960. };
  961. /**
  962. * Extends mxShape.
  963. */
  964. mxUtils.extend(mxShapeMockupGraphicsAnchor, mxShape);
  965. mxShapeMockupGraphicsAnchor.prototype.cst = {
  966. ANCHOR : 'mxgraph.mockup.graphics.anchor'
  967. };
  968. /**
  969. * Function: paintVertexShape
  970. *
  971. * Paints the vertex shape.
  972. */
  973. mxShapeMockupGraphicsAnchor.prototype.paintVertexShape = function(c, x, y, w, h)
  974. {
  975. };
  976. mxCellRenderer.registerShape(mxShapeMockupGraphicsAnchor.prototype.cst.ANCHOR, mxShapeMockupGraphicsAnchor);
  977. //**********************************************************************************************************************************************************
  978. //Rounded rectangle (adjustable rounding)
  979. //**********************************************************************************************************************************************************
  980. /**
  981. * Extends mxShape.
  982. */
  983. function mxShapeMockupGraphicsRRect(bounds, fill, stroke, strokewidth)
  984. {
  985. mxShape.call(this);
  986. this.bounds = bounds;
  987. this.fill = fill;
  988. this.stroke = stroke;
  989. this.strokewidth = (strokewidth != null) ? strokewidth : 1;
  990. };
  991. /**
  992. * Extends mxShape.
  993. */
  994. mxUtils.extend(mxShapeMockupGraphicsRRect, mxShape);
  995. mxShapeMockupGraphicsRRect.prototype.cst = {
  996. RRECT : 'mxgraph.mockup.graphics.rrect',
  997. R_SIZE : 'rSize'
  998. };
  999. /**
  1000. * Function: paintVertexShape
  1001. *
  1002. * Paints the vertex shape.
  1003. */
  1004. mxShapeMockupGraphicsRRect.prototype.paintVertexShape = function(c, x, y, w, h)
  1005. {
  1006. c.translate(x, y);
  1007. var rSize = parseInt(mxUtils.getValue(this.style, mxShapeMockupGraphicsRRect.prototype.cst.R_SIZE, '10'));
  1008. c.roundrect(0, 0, w, h, rSize);
  1009. c.fillAndStroke();
  1010. };
  1011. mxCellRenderer.registerShape(mxShapeMockupGraphicsRRect.prototype.cst.RRECT, mxShapeMockupGraphicsRRect);