Mercurial > dive4elements > gnv-client
view gnv-artifacts/src/test/java/de/intevation/gnv/artifacts/util/ShapeFileWriterTestCase.java @ 1141:f030acb8d999
dummy merge for repo head
author | Thomas Arendsen Hein <thomas@intevation.de> |
---|---|
date | Fri, 28 Sep 2012 12:15:18 +0200 |
parents | f953c9a559d8 |
children |
line wrap: on
line source
/* * Copyright (c) 2010 by Intevation GmbH * * This program is free software under the LGPL (>=v2.1) * Read the file LGPL.txt coming with the software for details * or visit http://www.gnu.org/licenses/ if it does not exist. */ package de.intevation.gnv.artifacts.util; import com.vividsolutions.jts.geom.MultiLineString; import com.vividsolutions.jts.io.WKTReader; import de.intevation.gnv.utils.Pair; import de.intevation.gnv.utils.ShapeFileWriter; import java.io.File; import java.io.FileReader; import java.util.ArrayList; import java.util.Date; import junit.framework.TestCase; import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; /** * @author <a href="mailto:tim.englich@intevation.de">Tim Englich</a> * */ public class ShapeFileWriterTestCase extends TestCase { /** * the logger, used to log exceptions and additonaly information */ private static Logger log = null; static { BasicConfigurator.configure(); log = Logger.getLogger(ShapeFileWriterTestCase.class); } /** * Constructor * @param name */ public ShapeFileWriterTestCase(String name) { super(name); } public void testMultiLineStringWriter(){ try { String wkt = "MULTILINESTRING ((10 10, 20 20),(15 15, 30 15))"; String wkt1 = "MULTILINESTRING ((10 5, 20 20),(15 15, 30 15))"; String wkt2 = "MULTILINESTRING ((10 10, 8 20),(15 15, 30 15))"; String wkt3 = "MULTILINESTRING ((8 10, 20 20),(15 15, 30 15))"; File isolineFile = new File("src/test/ressources/isolines.wkt"); MultiLineString multiLineString = (MultiLineString)new WKTReader().read(new FileReader(isolineFile)); MultiLineString multiLineString1 = (MultiLineString)new WKTReader().read(wkt1); MultiLineString multiLineString2 = (MultiLineString)new WKTReader().read(wkt2); MultiLineString multiLineString3 = (MultiLineString)new WKTReader().read(wkt3); ArrayList<Pair<Object, MultiLineString>> multiLineStrings = new ArrayList<Pair<Object, MultiLineString>>(); multiLineStrings.add( new Pair<Object, MultiLineString>( 1.2, multiLineString)); multiLineStrings.add( new Pair<Object, MultiLineString>( 1.3, multiLineString1)); multiLineStrings.add( new Pair<Object, MultiLineString>( 1.4, multiLineString2)); multiLineStrings.add( new Pair<Object, MultiLineString>( 1.5, multiLineString3)); java.io.File shapeFile = new java.io.File("/tmp/test"+System.currentTimeMillis()+".shp"); ShapeFileWriter.writeMultiLineStringsToFile(shapeFile, 1, 1, new Date(), multiLineStrings); } catch (Exception e) { log.error(e,e); fail(); } } }