*
*/
private void save() throws Exception
{
FeatureStore fs = (FeatureStore) ds.getFeatureSource("poly_county");
FeatureType ft = fs.getSchema();
MemoryDataStore memorystore =new MemoryDataStore();
ArrayList polys = new ArrayList(resultPolygon);
Geometry gfinal = null;
if (polys.size() == 1)
{
gfinal = (Polygon) polys.get(0); //POLYGON
}
else
{
GeometryFactory gf = ((Polygon) polys.get(0)).getFactory();
gfinal = new MultiPolygon((Polygon[]) polys.toArray( new Polygon[polys.size()]), gf );
}
gfinal = gfinal.buffer(0); // for topologic problems.
Object[] values = new Object[5];
values[ft.find("module")] = MODULE;
values[ft.find("gen_full")] = gfinal;
values[ft.find("gen_1")] = generalize(gfinal,tolerance1);;
values[ft.find("gen_2")] = generalize(gfinal,tolerance1);;
values[ft.find("gen_3")] = generalize(gfinal,tolerance1);;
Feature f = ft.create(values);
memorystore.addFeature(f);
fs.addFeatures(memorystore.getFeatureReader("poly_county"));
}