/* $Id: RectangleRegion.java 185 2011-05-27 03:51:24Z minao $ */
package smart_gs.logical.region;

import java.awt.Rectangle;
import java.awt.geom.Rectangle2D;
import java.awt.geom.Point2D;
import java.awt.geom.Rectangle2D.Double;
import java.util.List;
import java.util.ArrayList;


import smart_gs.drawing_tool.view.RectangleView;
import smart_gs.logical.Region;
import smart_gs.logical.Spread;

public class RectangleRegion extends Region{
	
	
	public RectangleRegion(Spread spread,Rectangle2D rectangle, String uri, String originalURI, String version){
		super(spread,new RectangleView(rectangle),uri,originalURI,version);
		double minx = rectangle.getMinX();
		double miny = rectangle.getMinY();
		double maxx = rectangle.getMaxX();
		double maxy = rectangle.getMaxY();
		Point2D a = new Point2D.Double(minx,miny);
		Point2D b = new Point2D.Double(maxx,miny);
		Point2D c = new Point2D.Double(maxx,maxy);
		Point2D d = new Point2D.Double(minx,maxy);
		
		ArrayList<Point2D> list = new ArrayList<Point2D>();
		list.add(a);
		list.add(b);
		list.add(c);
		list.add(d);
		this.points = list;
		
	
	}

	public RectangleRegion(Spread spread, Rectangle2D rectangle) {
		super(spread,new RectangleView(rectangle));
		double minx = rectangle.getMinX();
		double miny = rectangle.getMinY();
		double maxx = rectangle.getMaxX();
		double maxy = rectangle.getMaxY();
		Point2D a = new Point2D.Double(minx,miny);
		Point2D b = new Point2D.Double(maxx,miny);
		Point2D c = new Point2D.Double(maxx,maxy);
		Point2D d = new Point2D.Double(minx,maxy);
		
		ArrayList<Point2D> list = new ArrayList<Point2D>();
		list.add(a);
		list.add(b);
		list.add(c);
		list.add(d);
		this.points = list;
	}

}
