| FlowchartProcessPainter.java |
1 /****************************************************************************
2 **
3 ** This file is part of yFiles-2.9.
4 **
5 ** yWorks proprietary/confidential. Use is subject to license terms.
6 **
7 ** Redistribution of this file or of an unauthorized byte-code version
8 ** of this file is strictly forbidden.
9 **
10 ** Copyright (c) 2000-2011 by yWorks GmbH, Vor dem Kreuzberg 28,
11 ** 72070 Tuebingen, Germany. All rights reserved.
12 **
13 ***************************************************************************/
14 package demo.view.flowchart.painters;
15
16 import y.view.NodeRealizer;
17 import java.awt.geom.GeneralPath;
18
19 /**
20 * This class is an implementation of {@link y.view.GenericNodeRealizer.Painter} that draws the process symbol of flowchart diagrams.
21 */
22 public class FlowchartProcessPainter extends AbstractFlowchartPainter {
23
24 public FlowchartProcessPainter() {
25 super();
26 outline = new GeneralPath();
27 }
28
29 protected void updateOutline(NodeRealizer context) {
30 GeneralPath shapePath = (GeneralPath) getOutline();
31 shapePath.reset();
32 double height = context.getHeight();
33 double width = context.getWidth();
34 double x = context.getX();
35 double y = context.getY();
36
37 shapePath.moveTo((float) x, (float) y);
38 shapePath.lineTo((float) (x + width), (float) y);
39 shapePath.lineTo((float) (x + width), (float) (y + height));
40 shapePath.lineTo((float) x, (float) (y + height));
41 shapePath.closePath();
42 }
43 }
44
45