Search in sources :

Example 1 with SLDOutputFormatEnum

use of com.sldeditor.common.output.SLDOutputFormatEnum in project sldeditor by robward-scisys.

the class ExportSLD method main.

/**
 * The main method.
 *
 * @param args the arguments
 */
public static void main(String[] args) {
    if ((args.length != 2) && (args.length != 3)) {
        System.out.println("Usage:");
        System.out.println("ExportSLD <input JSON file> <destination folder> [<output format>]");
        System.out.println("Where <output format> is SLD, YSLD.  The default IS SLD");
        System.exit(0);
    }
    String filename = args[0];
    File outputFolder = new File(args[1]);
    if (!outputFolder.exists()) {
        outputFolder.mkdirs();
    }
    if (args.length == 3) {
        SLDOutputFormatEnum format;
        try {
            format = SLDOutputFormatEnum.valueOf(args[2]);
            outputFormat = format;
        } catch (IllegalArgumentException e) {
            System.err.println("Unknown output format : " + args[2]);
            System.exit(1);
        }
    }
    Map<String, SLDDataInterface> layerMap = MXDParser.readLayers(filename, outputFormat);
    if (layerMap != null) {
        for (String layerName : layerMap.keySet()) {
            File f = new File(outputFolder, generateFilename(layerName));
            writeData(f, layerName, layerMap.get(layerName));
        }
    }
}
Also used : SLDDataInterface(com.sldeditor.common.SLDDataInterface) SLDOutputFormatEnum(com.sldeditor.common.output.SLDOutputFormatEnum) File(java.io.File)

Example 2 with SLDOutputFormatEnum

use of com.sldeditor.common.output.SLDOutputFormatEnum in project sldeditor by robward-scisys.

the class SLDDataTest method testOriginalFormat.

/**
 * Test original format.
 */
@Test
public void testOriginalFormat() {
    SLDData data = new SLDData(null, null);
    assertEquals(SLDOutputFormatEnum.SLD, data.getOriginalFormat());
    SLDOutputFormatEnum expected = SLDOutputFormatEnum.YSLD;
    data.setOriginalFormat(expected);
    assertEquals(expected, data.getOriginalFormat());
}
Also used : SLDData(com.sldeditor.common.data.SLDData) SLDOutputFormatEnum(com.sldeditor.common.output.SLDOutputFormatEnum) Test(org.junit.Test)

Aggregations

SLDOutputFormatEnum (com.sldeditor.common.output.SLDOutputFormatEnum)2 SLDDataInterface (com.sldeditor.common.SLDDataInterface)1 SLDData (com.sldeditor.common.data.SLDData)1 File (java.io.File)1 Test (org.junit.Test)1