1
14 package demo.view.flowchart.painters;
15
16 import y.view.NodeRealizer;
17 import java.awt.geom.GeneralPath;
18
19
22 public class FlowchartPreparationPainter extends AbstractFlowchartPainter{
23 public FlowchartPreparationPainter() {
24 super();
25 outline = new GeneralPath();
26 }
27
28 protected void updateOutline(NodeRealizer context) {
29 GeneralPath shapePath = (GeneralPath) getOutline();
30 shapePath.reset();
31
32 double x = context.getX();
33 double y = context.getY();
34 double height = context.getHeight();
35 double width = context.getWidth();
36 double borderDistance = Math.min(FLOWCHART_DEFAULT_PREPARATION_INCLINATION * height, FLOWCHART_DEFAULT_PREPARATION_INCLINATION * width);
37
38 shapePath.moveTo((float)(x + borderDistance), (float)y);
39 shapePath.lineTo((float)(x + width - borderDistance), (float)y);
40 shapePath.lineTo((float)(x + width), (float)(y + height/2));
41 shapePath.lineTo((float)(x + width - borderDistance), (float)(y + height));
42 shapePath.lineTo((float)(x + borderDistance), (float)(y + height));
43 shapePath.lineTo((float)x, (float)(y + height/2));
44 shapePath.closePath();
45 }
46 }
47