1
28 package demo.view.flowchart.painters;
29
30 import y.view.NodeRealizer;
31
32 import java.awt.Shape;
33 import java.awt.geom.GeneralPath;
34
35
38 public class FlowchartCloudPainter extends AbstractFlowchartPainter {
39 protected Shape newShape( NodeRealizer context ) {
40 double x = context.getX();
41 double y = context.getY();
42 double height = context.getHeight();
43 double width = context.getWidth();
44 double asymetrConstY = 0.03 * height;
45 double asymetrConstX = 0.05 * width;
46 double xOffset1 = 0.125;
47 double yOffset1 = 0.250;
48 double yOffset2 = 0.18;
49
50 GeneralPath shapePath = new GeneralPath();
51 shapePath.moveTo((float) (x+ xOffset1 *width), (float)(y+0.5*height+asymetrConstY));
52 shapePath.curveTo((float) x, (float) (y+ yOffset1 *height), (float) (x+ 0.125 *width), (float) y, (float) (x + 0.33*width), (float) (y + yOffset2 *height));
53 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));
54 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));
55
56 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));
57 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));
58 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));
59 shapePath.closePath();
60 return shapePath;
61 }
62 }
63