public class ShpOc {
	// extends Model {

	public ShpOc() {
		super();
		ShapeFile shp = new ShapeFile();
//		shp.setFileName("data/2mares.shp");
		shp.setCrsEPSG("EPSG:32628");
		// shp.setFileName("data/macouria_chenier+1986.shp");
		// shp.setCrsEPSG("EPSG:32622");
//		KmlExport ke = new KmlExport();
//		ke.setShapeFile(shp);
//		ke.defStyle("s1", 2.0, "FFF2E29B", "6F756624");
//		ke.defStyle("s2", 1.0, "FFA8F29B", "6F247535");
	//	ShpRecord sr = shp.getNextRecord();
		int year = 2000;
		boolean toggle = true;
		String styl = "s1";

		// ---- Construire un buffer a -65m

		ShapeFile shp2 = new ShapeFile();
		shp2.definePolygonAttribute("the_geom");
		shp2.buildSchema("Buffer");
		shp2.setCrsEPSG("EPSG:32628");

		while (shp.hasNextRecord()) {
			ShpRecord sr2 = shp2.createEmptyShpRecord();
			sr2.setMPolygonBuffer(shp.getNextRecord(), -30);
		}

		// ---- Exporter ce shp2 en Kml
		KmlExport ke2 = new KmlExport();
		ke2.setShapeFile(shp2);
		
		ShpRecord sr2;
		while (shp2.hasNextRecord()) {
			sr2 = shp2.getNextRecord();
//			MPolygon mpl2 = sr2.getMPolygon();
			ke2.addRecord("buffer","01-01-" + year, "31-12-"+ year, sr2);
		}
		
		// ---- Exportation du premier shape en kml
		/*
		while (sr != null) {
			MPolygon mpl = sr.getMPolygon();
			sr.setMPolygon(mpl);
			// Polyline pl = sr.getPolyline();
			// sr.setPolyline(pl);
			ke.addRecord("Année " + year, "01-01-" + year, "31-12-"+ year, sr);
//			ke.addStyledRecord("Année " + year, "01-01-" + year, "31-12-"+ year, sr, styl);
			if (toggle)
				styl = "s2";
			else
				styl = "s1";
			toggle = !toggle;
			year++;
			sr = shp.getNextRecord();
		}
		shp.view(); */
			
		ke2.saveAsKmz("ShpOc.kmz");
	}

	public static void main(final java.lang.String[] args) {
		ShpOc so = new ShpOc();
	}
}
