Mercurial > mxd2map
view src/java/de/intevation/mxd/Converter.java @ 46:34a93dad7604
Added MultiLayerMarkerSymbol(ArrowMarkerSymbol) support.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Mon, 18 Apr 2011 17:51:33 +0200 |
parents | ef7ca23c4233 |
children | f0c02ff120d6 |
line wrap: on
line source
package de.intevation.mxd; import java.io.IOException; import java.io.File; import org.apache.log4j.Logger; import org.apache.log4j.PropertyConfigurator; import java.net.MalformedURLException; import de.intevation.mxd.reader.IReader; import de.intevation.mxd.reader.MXDReader; import de.intevation.mxd.writer.IWriter; import de.intevation.mxd.writer.MapScriptWriter; /** * The entry point of the MXD converter tool. * * @author <a href="mailto:ingo.weinzierl@intevation.de">Ingo Weinzierl</a> */ public class Converter { /** * The logging is done via Log4j. To configure the logging * a file 'log4j.properties' is search in the configuration * directory. */ public static final String LOG4J_PROPERTIES = "log4j.properties"; /** * * The path of the configuration directory. */ public static final String CONFIG_PATH = System.getProperty("config.dir", "conf"); /** * The logger used in this class. */ private static Logger logger; static { configureLogging(); logger = Logger.getLogger(Converter.class); } /** * Trys to load the Log4j configuration * from ${config.dir}/log4j.properties. */ public static final void configureLogging() { File configDir = new File(CONFIG_PATH); File propFile = new File(configDir, LOG4J_PROPERTIES); if (propFile.isFile() && propFile.canRead()) { try { PropertyConfigurator.configure(propFile.toURI().toURL()); } catch (MalformedURLException mue) { mue.printStackTrace(System.err); } } } /** * Entrypoint for the application. */ public static void main(String[] args) { try{ IReader reader = new MXDReader(); IWriter writer = new MapScriptWriter(); reader.init(); String path = System.getProperty("mxd.file"); if (path.equals("${MXDFILE}")) { System.out.println("No valid MXD file. Use ant parameter" + " \"-DMXDFILE=path/to/file.mxd\"."); System.exit(-1); } reader.setFilename(path); reader.read(); writer.write(reader.getMapDocument()); reader.shutdown(); } catch(IOException e) { e.printStackTrace(); } } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :