package com.persagy.adm.diagram.core.line;

import com.persagy.adm.diagram.core.model.DiagramNode;
import com.persagy.adm.diagram.core.model.base.XY;
import com.persagy.adm.diagram.core.util.GeomUtil;
import org.locationtech.jts.geom.Polygon;

/**
 * 块区域
 * @author zhaoyk
 */
public class Block {

	private DiagramNode node;

	private XY location;

	private XY size;

	private Polygon rect;

	public Block(DiagramNode node) {
		this.node = node;
		this.location = node.locationToRoot();
		this.size = node.getSize();
		this.rect = GeomUtil.getRect(location, size);
	}

	public Block(XY location, XY size) {
		this.location = location;
		this.size = size;
		this.rect = GeomUtil.getRect(location, size);
	}

	public XY getLocation() {
		return location;
	}

	public XY getSize() {
		return size;
	}

	public Polygon getRect() {
		return rect;
	}

}
