public class SessionReader extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
private static class |
SessionReader.CancelOrContinueDialog
Show Dialog when there is an error for one layer.
|
class |
SessionReader.ImportSupport
A class that provides some context for the individual
SessionLayerImporter
when doing the import. |
static class |
SessionReader.LayerDependency |
static class |
SessionReader.SessionProjectionChoiceData
Data class for projection saved in the session file.
|
static class |
SessionReader.SessionViewportData
Data class for viewport saved in the session file.
|
Modifier and Type | Field and Description |
---|---|
private int |
active |
private java.util.List<Layer> |
layers |
private java.util.List<java.lang.Runnable> |
postLoadTasks |
private SessionReader.SessionProjectionChoiceData |
projectionChoice |
private java.net.URI |
sessionFileURI |
private static java.util.Map<java.lang.String,java.lang.Class<? extends SessionLayerImporter>> |
sessionLayerImporters |
private SessionReader.SessionViewportData |
viewport |
private boolean |
zip |
private java.util.zip.ZipFile |
zipFile |
Constructor and Description |
---|
SessionReader() |
Modifier and Type | Method and Description |
---|---|
private java.io.InputStream |
createInputStream(java.io.File sessionFile,
boolean zip) |
private static void |
error(java.lang.String msg) |
Layer |
getActive() |
private static org.w3c.dom.Element |
getElementByTagName(org.w3c.dom.Element root,
java.lang.String name) |
java.util.List<Layer> |
getLayers() |
java.util.List<java.lang.Runnable> |
getPostLoadTasks() |
SessionReader.SessionProjectionChoiceData |
getProjectionChoice()
Return the projection choice data.
|
static SessionLayerImporter |
getSessionLayerImporter(java.lang.String layerType)
Returns the session layer importer for the given layer type.
|
SessionReader.SessionViewportData |
getViewport()
Return the viewport (map position and scale).
|
private static java.io.InputStream |
getZipInputStream(java.util.zip.ZipFile zipFile) |
void |
loadSession(java.io.File sessionFile,
boolean zip,
ProgressMonitor progressMonitor)
Loads session from the given file.
|
private void |
loadSession(java.io.InputStream josIS,
java.net.URI sessionFileURI,
boolean zip,
ProgressMonitor progressMonitor) |
private void |
parseJos(org.w3c.dom.Document doc,
ProgressMonitor progressMonitor) |
private static SessionReader.SessionProjectionChoiceData |
readProjectionChoiceData(org.w3c.dom.Element root) |
private static SessionReader.SessionViewportData |
readViewportData(org.w3c.dom.Element root) |
static void |
registerSessionLayerImporter(java.lang.String layerType,
java.lang.Class<? extends SessionLayerImporter> importer)
Register a session layer importer.
|
private static final java.util.Map<java.lang.String,java.lang.Class<? extends SessionLayerImporter>> sessionLayerImporters
private java.net.URI sessionFileURI
private boolean zip
private java.util.zip.ZipFile zipFile
private int active
private final java.util.List<java.lang.Runnable> postLoadTasks
private SessionReader.SessionViewportData viewport
private SessionReader.SessionProjectionChoiceData projectionChoice
public SessionReader()
public static void registerSessionLayerImporter(java.lang.String layerType, java.lang.Class<? extends SessionLayerImporter> importer)
layerType
- layer typeimporter
- importer for this layer classpublic static SessionLayerImporter getSessionLayerImporter(java.lang.String layerType)
layerType
- layer type to importpublic java.util.List<Layer> getLayers()
public java.util.List<java.lang.Runnable> getPostLoadTasks()
public SessionReader.SessionViewportData getViewport()
public SessionReader.SessionProjectionChoiceData getProjectionChoice()
private static void error(java.lang.String msg) throws IllegalDataException
IllegalDataException
private void parseJos(org.w3c.dom.Document doc, ProgressMonitor progressMonitor) throws IllegalDataException
IllegalDataException
private static SessionReader.SessionViewportData readViewportData(org.w3c.dom.Element root)
private static SessionReader.SessionProjectionChoiceData readProjectionChoiceData(org.w3c.dom.Element root)
public void loadSession(java.io.File sessionFile, boolean zip, ProgressMonitor progressMonitor) throws IllegalDataException, java.io.IOException
sessionFile
- session file to loadzip
- true
if it's a zipped session (.joz)progressMonitor
- progress monitorIllegalDataException
- if invalid data is detectedjava.io.IOException
- if any I/O error occursprivate java.io.InputStream createInputStream(java.io.File sessionFile, boolean zip) throws java.io.IOException, IllegalDataException
java.io.IOException
IllegalDataException
private static java.io.InputStream getZipInputStream(java.util.zip.ZipFile zipFile) throws java.io.IOException, IllegalDataException
java.io.IOException
IllegalDataException
private void loadSession(java.io.InputStream josIS, java.net.URI sessionFileURI, boolean zip, ProgressMonitor progressMonitor) throws java.io.IOException, IllegalDataException
java.io.IOException
IllegalDataException
private static org.w3c.dom.Element getElementByTagName(org.w3c.dom.Element root, java.lang.String name)