/**
 * Copyright (c) 2010 committers of YAKINDU and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 * Contributors:
 * 	committers of YAKINDU - initial API and implementation
 * 
 */
package org.yakindu.sct.statechart.diagram.editor.figures;

import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.Shape;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.PointList;
import org.eclipse.draw2d.geometry.Rectangle;

public class ChoiceFigure extends Shape {

	public ChoiceFigure() {
		this.setSize(new Dimension(15, 15));
		this.setBackgroundColor(org.eclipse.draw2d.ColorConstants.white);
		this.setForegroundColor(org.eclipse.draw2d.ColorConstants.black);
		setLineWidth(2);
	}

	/**
	 * @see org.eclipse.draw2d.Shape#fillShape(org.eclipse.draw2d.Graphics)
	 */
	@Override
	protected void fillShape(Graphics graphics) {
		PointList pl = new PointList();
		pl.addPoint(getBounds().getTop());
		pl.addPoint(getBounds().getRight());
		pl.addPoint(getBounds().getBottom());
		pl.addPoint(getBounds().getLeft());

		graphics.fillPolygon(pl);
	}

	/**
	 * @see org.eclipse.draw2d.Shape#outlineShape(org.eclipse.draw2d.Graphics)
	 */
	@Override
	protected void outlineShape(Graphics graphics) {
		Rectangle f = Rectangle.SINGLETON;
		Rectangle r = getBounds();
		f.x = r.x + lineWidth / 2;
		f.y = r.y + lineWidth / 2;
		f.width = r.width - lineWidth;
		f.height = r.height - lineWidth;

		PointList pl = new PointList();
		pl.addPoint(f.getTop());
		pl.addPoint(f.getRight());
		pl.addPoint(f.getBottom());
		pl.addPoint(f.getLeft());

		graphics.drawPolygon(pl);
	}

}
@@ -936,32 +936,35 @@
 idth(2);%0D%0A%09%7D%0D%0A%0D%0A
+%09%0D%0A
 %09/**%0D%0A%09 * @see o
@@ -1634,16 +1634,19 @@
 ineWidth
+ -1
 ;%0D%0A%09%09f.h
@@ -1673,16 +1673,19 @@
 ineWidth
+ -1
 ;%0D%0A%0D%0A%09%09P

Complete - # 214: Fix Choice-Figure is inclined