1
14 package demo.view.flowchart.painters;
15
16 import y.view.NodeRealizer;
17
18 import java.awt.geom.GeneralPath;
19
20
23 public class FlowchartCloudPainter extends AbstractFlowchartPainter {
24
25
26
27 public FlowchartCloudPainter() {
28 super();
29 outline = new GeneralPath();
30 }
31
32 protected void updateOutline(NodeRealizer context) {
33
34 GeneralPath shapePath = (GeneralPath) getOutline();
35 shapePath.reset();
36
37 double x = context.getX();
38 double y = context.getY();
39 double height = context.getHeight();
40 double width = context.getWidth();
41 double asymetrConstY = 0.03 * height;
42 double asymetrConstX = 0.05 * width;
43 double xOffset1 = 0.125;
44 double yOffset1 = 0.250;
45 double yOffset2 = 0.18;
46 shapePath.moveTo((float) (x+ xOffset1 *width), (float)(y+0.5*height+asymetrConstY));
47 shapePath.curveTo((float) x, (float) (y+ yOffset1 *height), (float) (x+ 0.125 *width), (float) y, (float) (x + 0.33*width), (float) (y + yOffset2 *height));
48 shapePath.curveTo((float) (x + 0.33*width), (float) y, (float) (x+width-0.33*width), (float) y, (float) (x+width-0.33*width), (float) (y + yOffset2 *height));
49 shapePath.curveTo((float) (x + width- 0.125 *width), (float) y, (float) (x+width), (float) (y+ yOffset1 *height), (float) (x+width- xOffset1 *width), (float) (y + 0.5*height - asymetrConstY));
50
51 shapePath.curveTo((float) (x+width), (float) (y+height- yOffset1 *height), (float) (x + width- 0.125 *width), (float) (y+height), (float) (x+width-0.33*width+asymetrConstX), (float) (y + height - yOffset2 *height));
52 shapePath.curveTo((float) (x+width-0.33*width), (float) (y+height), (float) (x + 0.33*width), (float) (y+height), (float) (x + 0.33*width+asymetrConstX), (float) (y + height- yOffset2 *height));
53 shapePath.curveTo((float) (x+ 0.125 *width), (float) (y+height), (float)x, (float) (y+height- yOffset1 *height), (float) (x+ xOffset1 *width), (float)(y+0.5*height+asymetrConstY));
54 shapePath.closePath();
55
56 }
57 }