package org.arakhne.neteditor.fsm.figures ;

import java.awt.Color;
import java.awt.geom.Ellipse2D;
import java.awt.geom.Rectangle2D;
import java.util.UUID;

import org.arakhne.neteditor.fig.figure.node.CircleNodeFigure;
import org.arakhne.neteditor.fig.graphics.ViewGraphics2D;
import org.arakhne.neteditor.fsm.constructs.FSMAnchor;
import org.arakhne.neteditor.fsm.constructs.FSMEndPoint;

public class FSMEndPointFigure extends CircleNodeFigure<FSMEndPoint,FSMAnchor> {

	public FSMEndPointFigure(UUID viewId, float x, float y) {
		super(viewId, x, y);
		setResizeDirections();
		setMinimalDimension(20, 20);
		setMaximalDimension(20, 20);
	}
	
	public FSMEndPointFigure(UUID viewId) {
		this(viewId, 0, 0);
	}

	@Override
	protected void paintNode(ViewGraphics2D g) {
		g.beginGroup();
		super.paintNode(g);
		Rectangle2D figureBounds = g.getCurrentViewBounds();
		Ellipse2D oval = new Ellipse2D.Float(
				(float)figureBounds.getX() + 5,
				(float)figureBounds.getY() + 5,
				(float)figureBounds.getWidth() - 10,
				(float)figureBounds.getHeight() - 10);
		g.setInteriorPainted(true);
		g.setOutlineDrawn(false);
		Color old = g.setFillColor(g.getOutlineColor());
		g.draw(oval);
		g.setFillColor(old);
		g.endGroup();
	}

}