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  
18  import java.awt.geom.GeneralPath;
19  
20  
21  /**
22  * This class is an implementation of {@link y.view.GenericNodeRealizer.Painter} that draws the decision symbol of flowchart diagrams.
23   **/
24  public class FlowchartDecisionPainter extends AbstractFlowchartPainter{
25    public FlowchartDecisionPainter() {
26      super();
27      outline = new GeneralPath();
28      innerShape = new GeneralPath();
29    }
30  
31  
32    protected void updateOutline(NodeRealizer context) {
33          GeneralPath shapePath = (GeneralPath) getOutline();
34          shapePath.reset();
35          double height = context.getHeight();
36          double width = context.getWidth();
37         
38          double x = context.getX();
39          double y = context.getY();
40  
41          shapePath.moveTo((float)(x + width/2), (float)y);
42          shapePath.lineTo((float)(x + width), (float)(y + height/2));
43          shapePath.lineTo((float)(x + width/2), (float)(y + height));
44          shapePath.lineTo((float)x , (float)(y + height/2));
45          shapePath.closePath();
46      }
47  }
48