package de.hft.stuttgart.citydoctor2.check.error;

import de.hft.stuttgart.citydoctor2.check.CheckError;
import de.hft.stuttgart.citydoctor2.check.ErrorId;
import de.hft.stuttgart.citydoctor2.check.ErrorReport;
import de.hft.stuttgart.citydoctor2.check.ErrorType;
import de.hft.stuttgart.citydoctor2.check.ErrorVisitor;
import de.hft.stuttgart.citydoctor2.check.HealingMethod;
import de.hft.stuttgart.citydoctor2.check.ModificationListener;
import de.hft.stuttgart.citydoctor2.datastructure.GmlElement;
import de.hft.stuttgart.citydoctor2.datastructure.Polygon;

public class PolygonWithoutSurfaceError implements CheckError {

	private static final long serialVersionUID = 2676579487514583105L;
	
	private Polygon p;


	public PolygonWithoutSurfaceError(Polygon polygon) {
		p = polygon;
	}

	@Override
	public ErrorType getType() {
		return ErrorType.ERROR;
	}

	@Override
	public ErrorId getErrorId() {
		return ErrorId.SE_POLYGON_WITHOUT_SURFACE;
	}
	
	public Polygon getPolygon() {
		return p;
	}

	@Override
	public GmlElement getFeature() {
		return p;
	}

	@Override
	public void accept(ErrorVisitor errorVisitor) {
		errorVisitor.visit(this);
	}

	@Override
	public boolean accept(HealingMethod method, ModificationListener l) {
		return method.visit(this, l);
	}

	@Override
	public void report(ErrorReport report) {
		report.add(p);
	}

}
