Mercurial > mxd2map
changeset 340:dbfcb0b69a63
* contrib/installer/example/example/template.map: Switch to latin1 encoding
* contrib/installer/example/example/mapfile_header.include: Remove shapepath,
data is now referenced relative to the mapfile
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 09 Nov 2012 16:54:16 +0100 |
parents | ef1cac2854e3 |
children | 10a0bf9a47ab |
files | ChangeLog build.xml conf/log4j.properties contrib/installer/example/example/mapfile_header.include contrib/installer/example/example/template.map src/java/de/intevation/mxd/Converter.java src/java/de/intevation/mxd/writer/MapScriptWriter.java ttf-fonts/fonts.txt |
diffstat | 8 files changed, 118 insertions(+), 89 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Thu Nov 08 12:46:16 2012 +0100 +++ b/ChangeLog Fri Nov 09 16:54:16 2012 +0100 @@ -1,3 +1,10 @@ +2012-11-09 Andre Heinecke <aheinecke@intevation.de> + + * contrib/installer/example/example/template.map: Switch to latin1 encoding + + * contrib/installer/example/example/mapfile_header.include: Remove shapepath, + data is now referenced relative to the mapfile + 2012-11-06 Andre Heinecke <aheinecke@intevation.de> * src/java/de/intevation/mxd/writer/MapScriptWriter.java:
--- a/build.xml Thu Nov 08 12:46:16 2012 +0100 +++ b/build.xml Fri Nov 09 16:54:16 2012 +0100 @@ -95,7 +95,7 @@ <jar jarfile="${dist.dir}/mxd2map.jar" compress="true" basedir="${class.dir}"> <manifest> <attribute name="Main-Class" value="de.intevation.mxd.Converter"/> - <attribute name="Class-Path" value="lib/log4j.jar lib/mapscript.jar lib/jargs.jar lib/commons-codec.jar"/> + <attribute name="Class-Path" value="lib/log4j.jar lib/mapscript.jar lib/arcobjects.jar lib/jargs.jar lib/commons-codec.jar"/> </manifest> </jar> </target>
--- a/conf/log4j.properties Thu Nov 08 12:46:16 2012 +0100 +++ b/conf/log4j.properties Fri Nov 09 16:54:16 2012 +0100 @@ -19,13 +19,19 @@ #### Log just errors and warnings to a file. log4j.rootLogger=DEBUG, MXD, Console -log4j.appender.MXD=org.apache.log4j.RollingFileAppender -log4j.appender.MXD.File=./logs/console-client.log -log4j.appender.MXD.MaxFileSize=5000KB -log4j.appender.MXD.MaxBackupIndex=1 +log4j.appender.MXD=org.apache.log4j.ConsoleAppender +#log4j.appender.MXD.File=./logs/console-client.log +#log4j.appender.MXD.MaxFileSize=5000KB +#log4j.appender.MXD.MaxBackupIndex=1 log4j.appender.MXD.layout=org.apache.log4j.PatternLayout log4j.appender.MXD.layout.ConversionPattern=%d [%t] %-5p %c - %m%n +log4j.appender.DEBUG=org.apache.log4j.ConsoleAppender +log4j.appender.DEBUG.Threshold=INFO +log4j.appender.DEBUG.layout=org.apache.log4j.PatternLayout +log4j.appender.DEBUG.layout.ConversionPattern=%d [%t] %-5p %c - %m%n + + #log4j.rootLogger=WARN, Console log4j.appender.Console=org.apache.log4j.ConsoleAppender log4j.appender.Console.Threshold=INFO
--- a/contrib/installer/example/example/mapfile_header.include Thu Nov 08 12:46:16 2012 +0100 +++ b/contrib/installer/example/example/mapfile_header.include Fri Nov 09 16:54:16 2012 +0100 @@ -22,7 +22,6 @@ IMAGECOLOR -1 -1 -1 #transparent FONTSET "ttf-fonts/fonts.txt" SYMBOLSET "../symbols/symbols.sym" -SHAPEPATH "example/testdata-frida/" IMAGETYPE png MAXSIZE 2500 # 2500x2500 pixel maximum Site
--- a/contrib/installer/example/example/template.map Thu Nov 08 12:46:16 2012 +0100 +++ b/contrib/installer/example/example/template.map Fri Nov 09 16:54:16 2012 +0100 @@ -50,7 +50,7 @@ 'ows_enable_request' '*' 'wms_feature_info_mime_type' 'text/html' 'wms_getmap_formatlist' 'image/png,image/png; mode=24bit' - 'wms_encoding' 'UTF-8' + 'wms_encoding' 'latin1' 'wms_exceptions_format' 'XML' END END
--- a/src/java/de/intevation/mxd/Converter.java Thu Nov 08 12:46:16 2012 +0100 +++ b/src/java/de/intevation/mxd/Converter.java Fri Nov 09 16:54:16 2012 +0100 @@ -137,10 +137,12 @@ reader.read(); writer.write(reader.getMapDocument()); + logger.debug("write done"); reader.shutdown(); } catch(Exception e) { logger.debug(e.getMessage()); + e.printStackTrace(); logger.error( "General error." + " See logging file for more information.");
--- a/src/java/de/intevation/mxd/writer/MapScriptWriter.java Thu Nov 08 12:46:16 2012 +0100 +++ b/src/java/de/intevation/mxd/writer/MapScriptWriter.java Fri Nov 09 16:54:16 2012 +0100 @@ -119,6 +119,7 @@ String fontSet = fonts.getAbsolutePath(); fontSet = fontSet.replaceAll("\\\\", "/"); map.setFontSet(fontSet); + } /** @@ -278,8 +279,13 @@ "/mxd/map", XPathConstants.NODE); NodeList list = mapNode.getElementsByTagName("layer"); - for(int i = 0; i < list.getLength(); i++) { + for(int i = list.getLength() - 1; i >= 0; i--) { Element layerElement = (Element)list.item(i); + if (layerElement.getAttribute("type") == "annotation" && + layerElement.getElementsByTagName("feature").getLength() == 0) { + logger.debug("Ignoring empty annotation Layer."); + continue; + } layerObj layer = new layerObj(map); NodeList renderer = layerElement.getElementsByTagName("renderer"); @@ -858,15 +864,22 @@ private String createExpression(Element ce, int index, String prefixToRemove, boolean isShapeFile) { String expression = "("; - int count = 0; + int field_count = 0; + int value_count = 0; try { - count = Integer.parseInt(ce.getAttribute("field_count")); + field_count = Integer.parseInt(ce.getAttribute("field_count")); } catch(NumberFormatException nfe) { return ""; } + try { + value_count = Integer.parseInt(ce.getAttribute("value_count")); + } + catch(NumberFormatException nfe) { + value_count = field_count; + } - if(count == 1) { + if(field_count == 1) { //Create single field expression. try { //If no exception is thrown, the expression value is a number. @@ -903,18 +916,19 @@ } else { //Create a multi field expression. - for (int i = 0; i < count; i++) { + for (int i = 0; i < field_count; i++) { try { //If no exception is thrown, the expression values are //numbers. + Double.parseDouble(ce.getAttribute("value_" + i)); expression += "["; expression += sanitizeAttribute(ce.getAttribute("expression_field_" + i), - prefixToRemove, prefix, isShapeFile); + prefixToRemove, prefix, isShapeFile); expression += "]"; expression += " " + ce.getAttribute("expression_operator"); expression += " " + ce.getAttribute("value_" + i); - if (i < count - 1) { + if (i < field_count - 1) { expression += " AND "; } else { @@ -925,11 +939,11 @@ //The expression values are strings. expression += "\"["; expression += sanitizeAttribute(ce.getAttribute("expression_field_" + i), - prefixToRemove, prefix, isShapeFile); + prefixToRemove, prefix, isShapeFile); expression += "]\""; expression += " " + ce.getAttribute("expression_operator"); expression += " \"" + ce.getAttribute("value_" + i); - if (i < count - 1) { + if (i < field_count - 1) { expression += "\" AND "; } else { @@ -937,6 +951,7 @@ } } } + } return expression; }
--- a/ttf-fonts/fonts.txt Thu Nov 08 12:46:16 2012 +0100 +++ b/ttf-fonts/fonts.txt Fri Nov 09 16:54:16 2012 +0100 @@ -24,76 +24,76 @@ # # FreeSans is a default fallback-font. FreeSans DejaVuSans.ttf -ESRIMeteorological01 C:/Windows/Fonts/esri_105.ttf -ESRIDefaultMarker C:/Windows/Fonts/esri_11.ttf -ESRIOrdnanceSurvey C:/Windows/Fonts/esri_121.ttf -ESRINIMADNCPT C:/Windows/Fonts/esri_12.ttf -ESRISDS1.951 C:/Windows/Fonts/esri_130.ttf -ESRISDS1.952 C:/Windows/Fonts/esri_131.ttf -ESRISDS2.001 C:/Windows/Fonts/esri_132.ttf -ESRISDS2.002 C:/Windows/Fonts/esri_133.ttf -ESRINIMADNCLN C:/Windows/Fonts/esri_13.ttf -ESRIArrowhead C:/Windows/Fonts/esri_144.ttf -ESRISurveyor C:/Windows/Fonts/esri_149.ttf -ESRINIMAVMAP1&2PT C:/Windows/Fonts/esri_14.ttf -ESRIAMFMElectric C:/Windows/Fonts/esri_150.ttf -ESRIAMFMGas C:/Windows/Fonts/esri_151.ttf -ESRIAMFMSewer C:/Windows/Fonts/esri_152.ttf -ESRIAMFMWater C:/Windows/Fonts/esri_153.ttf -ESRIHydrants C:/Windows/Fonts/esri_159.ttf -ESRINIMAVMAP1&2LN C:/Windows/Fonts/esri_15.ttf -ESRITelecom C:/Windows/Fonts/esri_160.ttf -ESRIPipelineUS1 C:/Windows/Fonts/esri_161.ttf -ESRINIMACityGraphicPT C:/Windows/Fonts/esri_16.ttf -ESRINIMACityGraphicLN C:/Windows/Fonts/esri_17.ttf -ESRIMilMod02 C:/Windows/Fonts/esri_19.ttf -ESRICartography C:/Windows/Fonts/esri_1.ttf -ESRIMilRed01 C:/Windows/Fonts/esri_20.ttf -ESRIIGLFont16 C:/Windows/Fonts/esri_216.ttf -ESRIMilSym01 C:/Windows/Fonts/esri_21.ttf -ESRIIGLFont20 C:/Windows/Fonts/esri_220.ttf -ESRIIGLFont21 C:/Windows/Fonts/esri_221.ttf -ESRIIGLFont22 C:/Windows/Fonts/esri_222.ttf -ESRIIGLFont23 C:/Windows/Fonts/esri_223.ttf -ESRIIGLFont24 C:/Windows/Fonts/esri_224.ttf -ESRIIGLFont25 C:/Windows/Fonts/esri_225.ttf -ESRIMilSym02 C:/Windows/Fonts/esri_22.ttf -ESRIMilSym03 C:/Windows/Fonts/esri_23.ttf -ESRIMilSym04 C:/Windows/Fonts/esri_24.ttf -ESRIMilSym05 C:/Windows/Fonts/esri_25.ttf -ESRIMilMod01 C:/Windows/Fonts/esri_26.ttf -ESRIMil2525CModifiers C:/Windows/Fonts/esri_27Mcr_2.ttf -ESRIPublic1 C:/Windows/Fonts/esri_29.ttf -ESRIEnvironmental&Icons C:/Windows/Fonts/esri_2.ttf -ESRIArcPad C:/Windows/Fonts/esri_30s.ttf -ESRIClimate&Precipitation C:/Windows/Fonts/esri_33.ttf -ESRIBusiness C:/Windows/Fonts/esri_34.ttf -ESRICaves1 C:/Windows/Fonts/esri_375.ttf -ESRICaves2 C:/Windows/Fonts/esri_376.ttf -ESRICaves3 C:/Windows/Fonts/esri_377.ttf -ESRIDimensioning C:/Windows/Fonts/esri_39.ttf -ESRIGeometricSymbols C:/Windows/Fonts/esri_3.ttf -ESRIGeologyUSGS95-525 C:/Windows/Fonts/esri_400.ttf -ESRIElements C:/Windows/Fonts/esri_405.ttf -ESRICommodities C:/Windows/Fonts/esri_406.ttf -ESRINorth C:/Windows/Fonts/esri_40.ttf -ESRIShields C:/Windows/Fonts/esri_44.ttf -ESRIUSMUTCD1 C:/Windows/Fonts/esri_47.ttf -ESRIUSMUTCD2 C:/Windows/Fonts/esri_48.ttf -ESRIUSMUTCD3 C:/Windows/Fonts/esri_49.ttf -ESRIOilGasWater C:/Windows/Fonts/esri_4.ttf -ESRIGeologyAGSO1 C:/Windows/Fonts/esri_500.ttf -ESRIWeather C:/Windows/Fonts/esri_5.ttf -ESRIUSForestry1 C:/Windows/Fonts/esri_651.ttf -ESRIUSForestry2 C:/Windows/Fonts/esri_652.ttf -ESRIConservation C:/Windows/Fonts/esri_730.ttf -ESRIGeology C:/Windows/Fonts/esri_7.ttf -ESRIEnviroHazardIncident C:/Windows/Fonts/esri_800.ttf -ESRIEnviroHazardAnalysis C:/Windows/Fonts/esri_801.ttf -ESRIEnviroHazardSites C:/Windows/Fonts/esri_802.ttf -ESRIHazardousMaterials C:/Windows/Fonts/esri_803.ttf -ESRIFireIncidentNFPA C:/Windows/Fonts/esri_804.ttf -ESRIERSInfrastructuresS1 C:/Windows/Fonts/esri_832.ttf -ESRIERSOperationsS1 C:/Windows/Fonts/esri_837.ttf -ESRICrimeAnalysis C:/Windows/Fonts/esri_8.ttf -ESRITransportationCivic C:/Windows/Fonts/esri_9.ttf +ESRIMeteorological01 /home/aheinecke/arcgis/engine10.0/fonts/esri_105.ttf +ESRIDefaultMarker /home/aheinecke/arcgis/engine10.0/fonts/esri_11.ttf +ESRIOrdnanceSurvey /home/aheinecke/arcgis/engine10.0/fonts/esri_121.ttf +ESRINIMADNCPT /home/aheinecke/arcgis/engine10.0/fonts/esri_12.ttf +ESRISDS1.951 /home/aheinecke/arcgis/engine10.0/fonts/esri_130.ttf +ESRISDS1.952 /home/aheinecke/arcgis/engine10.0/fonts/esri_131.ttf +ESRISDS2.001 /home/aheinecke/arcgis/engine10.0/fonts/esri_132.ttf +ESRISDS2.002 /home/aheinecke/arcgis/engine10.0/fonts/esri_133.ttf +ESRINIMADNCLN /home/aheinecke/arcgis/engine10.0/fonts/esri_13.ttf +ESRIArrowhead /home/aheinecke/arcgis/engine10.0/fonts/esri_144.ttf +ESRISurveyor /home/aheinecke/arcgis/engine10.0/fonts/esri_149.ttf +ESRINIMAVMAP1&2PT /home/aheinecke/arcgis/engine10.0/fonts/esri_14.ttf +ESRIAMFMElectric /home/aheinecke/arcgis/engine10.0/fonts/esri_150.ttf +ESRIAMFMGas /home/aheinecke/arcgis/engine10.0/fonts/esri_151.ttf +ESRIAMFMSewer /home/aheinecke/arcgis/engine10.0/fonts/esri_152.ttf +ESRIAMFMWater /home/aheinecke/arcgis/engine10.0/fonts/esri_153.ttf +ESRIHydrants /home/aheinecke/arcgis/engine10.0/fonts/esri_159.ttf +ESRINIMAVMAP1&2LN /home/aheinecke/arcgis/engine10.0/fonts/esri_15.ttf +ESRITelecom /home/aheinecke/arcgis/engine10.0/fonts/esri_160.ttf +ESRIPipelineUS1 /home/aheinecke/arcgis/engine10.0/fonts/esri_161.ttf +ESRINIMACityGraphicPT /home/aheinecke/arcgis/engine10.0/fonts/esri_16.ttf +ESRINIMACityGraphicLN /home/aheinecke/arcgis/engine10.0/fonts/esri_17.ttf +ESRIMilMod02 /home/aheinecke/arcgis/engine10.0/fonts/esri_19.ttf +ESRICartography /home/aheinecke/arcgis/engine10.0/fonts/esri_1.ttf +ESRIMilRed01 /home/aheinecke/arcgis/engine10.0/fonts/esri_20.ttf +ESRIIGLFont16 /home/aheinecke/arcgis/engine10.0/fonts/esri_216.ttf +ESRIMilSym01 /home/aheinecke/arcgis/engine10.0/fonts/esri_21.ttf +ESRIIGLFont20 /home/aheinecke/arcgis/engine10.0/fonts/esri_220.ttf +ESRIIGLFont21 /home/aheinecke/arcgis/engine10.0/fonts/esri_221.ttf +ESRIIGLFont22 /home/aheinecke/arcgis/engine10.0/fonts/esri_222.ttf +ESRIIGLFont23 /home/aheinecke/arcgis/engine10.0/fonts/esri_223.ttf +ESRIIGLFont24 /home/aheinecke/arcgis/engine10.0/fonts/esri_224.ttf +ESRIIGLFont25 /home/aheinecke/arcgis/engine10.0/fonts/esri_225.ttf +ESRIMilSym02 /home/aheinecke/arcgis/engine10.0/fonts/esri_22.ttf +ESRIMilSym03 /home/aheinecke/arcgis/engine10.0/fonts/esri_23.ttf +ESRIMilSym04 /home/aheinecke/arcgis/engine10.0/fonts/esri_24.ttf +ESRIMilSym05 /home/aheinecke/arcgis/engine10.0/fonts/esri_25.ttf +ESRIMilMod01 /home/aheinecke/arcgis/engine10.0/fonts/esri_26.ttf +ESRIMil2525CModifiers /home/aheinecke/arcgis/engine10.0/fonts/esri_27Mcr_2.ttf +ESRIPublic1 /home/aheinecke/arcgis/engine10.0/fonts/esri_29.ttf +ESRIEnvironmental&Icons /home/aheinecke/arcgis/engine10.0/fonts/esri_2.ttf +ESRIArcPad /home/aheinecke/arcgis/engine10.0/fonts/esri_30s.ttf +ESRIClimate&Precipitation /home/aheinecke/arcgis/engine10.0/fonts/esri_33.ttf +ESRIBusiness /home/aheinecke/arcgis/engine10.0/fonts/esri_34.ttf +ESRICaves1 /home/aheinecke/arcgis/engine10.0/fonts/esri_375.ttf +ESRICaves2 /home/aheinecke/arcgis/engine10.0/fonts/esri_376.ttf +ESRICaves3 /home/aheinecke/arcgis/engine10.0/fonts/esri_377.ttf +ESRIDimensioning /home/aheinecke/arcgis/engine10.0/fonts/esri_39.ttf +ESRIGeometricSymbols /home/aheinecke/arcgis/engine10.0/fonts/esri_3.ttf +ESRIGeologyUSGS95-525 /home/aheinecke/arcgis/engine10.0/fonts/esri_400.ttf +ESRIElements /home/aheinecke/arcgis/engine10.0/fonts/esri_405.ttf +ESRICommodities /home/aheinecke/arcgis/engine10.0/fonts/esri_406.ttf +ESRINorth /home/aheinecke/arcgis/engine10.0/fonts/esri_40.ttf +ESRIShields /home/aheinecke/arcgis/engine10.0/fonts/esri_44.ttf +ESRIUSMUTCD1 /home/aheinecke/arcgis/engine10.0/fonts/esri_47.ttf +ESRIUSMUTCD2 /home/aheinecke/arcgis/engine10.0/fonts/esri_48.ttf +ESRIUSMUTCD3 /home/aheinecke/arcgis/engine10.0/fonts/esri_49.ttf +ESRIOilGasWater /home/aheinecke/arcgis/engine10.0/fonts/esri_4.ttf +ESRIGeologyAGSO1 /home/aheinecke/arcgis/engine10.0/fonts/esri_500.ttf +ESRIWeather /home/aheinecke/arcgis/engine10.0/fonts/esri_5.ttf +ESRIUSForestry1 /home/aheinecke/arcgis/engine10.0/fonts/esri_651.ttf +ESRIUSForestry2 /home/aheinecke/arcgis/engine10.0/fonts/esri_652.ttf +ESRIConservation /home/aheinecke/arcgis/engine10.0/fonts/esri_730.ttf +ESRIGeology /home/aheinecke/arcgis/engine10.0/fonts/esri_7.ttf +ESRIEnviroHazardIncident /home/aheinecke/arcgis/engine10.0/fonts/esri_800.ttf +ESRIEnviroHazardAnalysis /home/aheinecke/arcgis/engine10.0/fonts/esri_801.ttf +ESRIEnviroHazardSites /home/aheinecke/arcgis/engine10.0/fonts/esri_802.ttf +ESRIHazardousMaterials /home/aheinecke/arcgis/engine10.0/fonts/esri_803.ttf +ESRIFireIncidentNFPA /home/aheinecke/arcgis/engine10.0/fonts/esri_804.ttf +ESRIERSInfrastructuresS1 /home/aheinecke/arcgis/engine10.0/fonts/esri_832.ttf +ESRIERSOperationsS1 /home/aheinecke/arcgis/engine10.0/fonts/esri_837.ttf +ESRICrimeAnalysis /home/aheinecke/arcgis/engine10.0/fonts/esri_8.ttf +ESRITransportationCivic /home/aheinecke/arcgis/engine10.0/fonts/esri_9.ttf