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 FlowchartDirectDataPainter extends AbstractFlowchartPainter {
39 protected Shape newShape( NodeRealizer context ) {
40 double height = context.getHeight();
41 double width = context.getWidth();
42 double x = context.getX();
43 double y = context.getY();
44
45 double radius = Math.min(getRadius(context, FLOWCHART_DEFAULT_DIRECT_DATA_RADIUS), 0.5);
46 double borderDistance = radius * Math.min(width, height);
47
48 GeneralPath shapePath = new GeneralPath();
49 shapePath.moveTo((float)(x + borderDistance), (float)y);
50 shapePath.lineTo((float)(x + width - borderDistance), (float)y);
51 shapePath.quadTo((float)(x + width + borderDistance), (float)(y + height / 2), (float)(x + width - borderDistance), (float)(y + height));
52 shapePath.lineTo((float)(x + borderDistance), (float)(y + height));
53 shapePath.quadTo((float)(x - borderDistance), (float)(y + height / 2), (float)(x + borderDistance), (float)y);
54 shapePath.closePath();
55 return shapePath;
56 }
57
58 protected Shape newDecoration( NodeRealizer context ) {
59 double height = context.getHeight();
60 double width = context.getWidth();
61 double x = context.getX();
62 double y = context.getY();
63
64 double radius = Math.min(getRadius(context, FLOWCHART_DEFAULT_DIRECT_DATA_RADIUS), 0.5);
65 double borderDistance = radius * Math.min(width, height);
66
67 GeneralPath shapePath = new GeneralPath();
68 shapePath.moveTo((float)(x + width - borderDistance), (float)y);
69 shapePath.quadTo((float)(x + width - 3 * borderDistance), (float)(y + height / 2), (float)(x + width - borderDistance), (float)(y + height));
70 return shapePath;
71 }
72 }
73