Class IOTools
java.lang.Object
org.openjump.core.apitools.IOTools
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringconvertPathToSystemIndependentPath(String oldPath) Converts a system-dependent path into an independent onestatic voidcopyFileToFolder(File inputFile, String outputDir) Simple method to copy a file to a folderstatic FeatureCollectionstatic FeatureCollectionstatic FeatureCollectionloaddBaseFile(String sFilename) static FeatureCollectionloadFMEGML(String filename) static voidloadImageAsLayer(File file, WorkbenchContext wcontext, String extension) Load an image file as ReferenceImageLayer.class defining its extensionstatic FeatureCollectionloadJMLFile(String filename) static FeatureCollectionloadShapefile(String filename) static FeatureCollectionloadShapefile(String filename, String zipFileName) static voidloadSimbology_Jump(File file, Layer layer) Method to load an OpenJUMP symbology file (xml jump) into a layerstatic voidloadSimbology_SLD(File file, PlugInContext context) Method to load a style file ( SLD - Spatial layer descriptor) into a layerstatic FeatureCollectionstatic voidstatic FilerecompileXMLFile(File file, String directory) This method will recompile the XML file according to location (folder) of the image symbology files used by Load JUMP Symbology methodstatic voidsave(FeatureCollection fc, String filename) static voidExport jtable to csv file using commas as separatorsstatic voidExport jtable to csv file using a cell separatorstatic voidsavedBaseFile(FeatureCollection featureCollection, String fname, Charset charset) static voidsaveDbfFile(FeatureCollection fc, String filename) static voidsaveGeoTIFF(BufferedImage image, org.locationtech.jts.geom.Envelope envelope, double cellsizex, double cellsizey, int compression, double nodata, File file) Save a given BufferedImage and envelope to GeoTIFF file, giving nodata value, x and y values of cell size and compsessionstatic voidsaveGeoTIFF(BufferedImage image, org.locationtech.jts.geom.Envelope envelope, File file) Save a BufferedImage and envelope to GeoTIFF file. cellsize is calculate from parameters (raster and envelope) nodata is set to SAGA standard value (-99999.00) compression is set to packbitsstatic voidsaveJMLFile(FeatureCollection fc, String filename) static voidsaveJMLFile(Layer layer, String filename) static voidsaveShapefile(FeatureCollection fc, String filename) static voidsaveShapefile(Layer layer, String filename) static voidsaveSimbology_Jump(File file, Layer layer) Method to save Openjump symbology of a layer to a XML filestatic voidsaveSimbology_SLD(File file, Layer layer) Method to save the style of a layer as SLD (Spatial layer descriptor) filestatic voidsaveSimbology_SLD2(File file, Layer layer) static voidsaveStyleToFile(Layer layer, String path)
-
Constructor Details
-
IOTools
public IOTools()
-
-
Method Details
-
load
- Throws:
Exception
-
load
- Throws:
Exception
-
loadJMLFile
- Throws:
Exception
-
loadShapefile
- Throws:
Exception
-
loadShapefile
- Throws:
Exception
-
loadFMEGML
- Throws:
Exception
-
loadWKT
- Throws:
Exception
-
save
- Throws:
Exception
-
saveShapefile
- Throws:
Exception
-
saveJMLFile
- Throws:
Exception
-
saveDbfFile
- Throws:
Exception
-
saveCSV
-
saveCSV
Export jtable to csv file using a cell separator- Parameters:
table- JTablefilename- output file name: C:\folder\file.csvcellseparator- cell break to separate values: "," ";" tab etc- Throws:
Exception- if an Exception occurs
-
saveShapefile
-
saveJMLFile
-
saveStyleToFile
-
print
-
saveSimbology_Jump
-
copyFileToFolder
Simple method to copy a file to a folder- Parameters:
inputFile- input FileoutputDir- output directory- Throws:
IOException- if an IOException occurs
-
convertPathToSystemIndependentPath
-
recompileXMLFile
public static File recompileXMLFile(File file, String directory) throws ParserConfigurationException, SAXException, IOException, TransformerException This method will recompile the XML file according to location (folder) of the image symbology files used by Load JUMP Symbology method- Parameters:
file- XML filedirectory- Folder where the images are stored- Returns:
- File
- Throws:
ParserConfigurationExceptionSAXExceptionIOExceptionTransformerException
-
loadSimbology_Jump
-
loadSimbology_SLD
public static void loadSimbology_SLD(File file, PlugInContext context) throws SAXException, IOException, ParserConfigurationException Method to load a style file ( SLD - Spatial layer descriptor) into a layer- Parameters:
file- file to load (ex. file.sld)context- plugin context- Throws:
Exception- if an Exception occursSAXExceptionIOExceptionParserConfigurationException
-
saveSimbology_SLD
-
saveSimbology_SLD2
-
loadImageAsLayer
public static void loadImageAsLayer(File file, WorkbenchContext wcontext, String extension) throws Exception Load an image file as ReferenceImageLayer.class defining its extension- Parameters:
file- File to loadwcontext- WorkbenchContextextension- extension of the file, eg. "tif"- Throws:
Exception- if an Exception occurs
-
saveGeoTIFF
public static void saveGeoTIFF(BufferedImage image, org.locationtech.jts.geom.Envelope envelope, File file) throws IOException Save a BufferedImage and envelope to GeoTIFF file. cellsize is calculate from parameters (raster and envelope) nodata is set to SAGA standard value (-99999.00) compression is set to packbits- Parameters:
image- BufferedImage to saveenvelope- an Envelopefile- output file- Throws:
IOException- if an IOException occurs
-
saveGeoTIFF
public static void saveGeoTIFF(BufferedImage image, org.locationtech.jts.geom.Envelope envelope, double cellsizex, double cellsizey, int compression, double nodata, File file) Save a given BufferedImage and envelope to GeoTIFF file, giving nodata value, x and y values of cell size and compsession- Parameters:
image- BufferedImage to saveenvelope- an Envelopecellsizex- Double cell size in x directioncellsizey- Double cell size in y directioncompression- Integer, see com.sun.media.jai.codec.TIFFEncodeParamnodata- Double nodata valuefile- output file- Throws:
IOException- if an IOException occurs
-
loaddBaseFile
-
savedBaseFile
public static void savedBaseFile(FeatureCollection featureCollection, String fname, Charset charset) throws Exception - Throws:
Exception
-