
package jp.riken.brain.ni.samuraigraph.figure.java2d;

import java.awt.Shape;
import java.awt.geom.Rectangle2D;
import jp.riken.brain.ni.samuraigraph.figure.SGDrawingElementBar;


/**
 * 
 */
public class SGDrawingElementBar2D extends SGDrawingElementBar
	implements SGIDrawingElementJava2D
{

	/**
	 * 
	 */
	public SGDrawingElementBar2D()
	{
		super();
	}



	/**
	 * 
	 */
	public SGDrawingElementBar2D(
		final float x,
		final float y,
		final float w,
		final float h )
	{
		super();
		this.setBounds( x, y, w, h );
	}



	/**
	 * 
	 */
	public Rectangle2D getElementBounds()
	{
		Rectangle2D rect = new Rectangle2D.Float(
			this.getX(), this.getY(), this.getRectangleWidth(), this.getRectangleHeight() );
		return rect;
	}


	/**
	 * 
	 */
	public boolean contains(final int x, final int y)
	{
		return this.getElementBounds().contains(x,y);
	}


	/**
	 * 
	 */
	public Shape getShape()
	{
		return this.getElementBounds();
	}


	/**
	 * 
	 */
	public Object copy()
	{
		SGDrawingElementBar2D el = new SGDrawingElementBar2D();
		this.setPropertiesForCopy(el);
		return el;
	}


	protected boolean setPropertiesForCopy( SGDrawingElementBar2D el )
	{
		el.setProperties( this.getProperties() );
		el.setLocation( this.getX(), this.getY() );
		el.setMagnification( this.mMagnification );
		return true;
	}


}

