Class SessionReader.ImportSupport

    • Constructor Summary

      Constructors 
      Constructor Description
      ImportSupport​(java.lang.String layerName, int layerIndex, java.util.List<SessionReader.LayerDependency> layerDependencies)
      Constructs a new ImportSupport.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addPostLayersTask​(java.lang.Runnable task)
      Add a task, e.g.
      void addSubLayer​(int idx, Layer layer, org.w3c.dom.Element el)
      Add sub layers
      java.io.File getFile​(java.lang.String uriStr)
      Return a File for a URI from a .jos/.joz file.
      java.io.InputStream getInputStream​(java.lang.String uriStr)
      Return an InputStream for a URI from a .jos/.joz file.
      java.util.List<SessionReader.LayerDependency> getLayerDependencies()
      Dependencies - maps the layer index to the importer of the given layer.
      int getLayerIndex()
      Index of the layer that is currently imported.
      java.lang.String getLayerName()
      Name of the layer that is currently imported.
      java.util.Map<java.lang.Integer,​java.util.Map.Entry<Layer,​org.w3c.dom.Element>> getSubLayers()
      Returns the sub layers
      boolean isZip()
      Determines if we are reading from a .joz file.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ImportSupport

        public ImportSupport​(java.lang.String layerName,
                             int layerIndex,
                             java.util.List<SessionReader.LayerDependency> layerDependencies)
        Constructs a new ImportSupport.
        Parameters:
        layerName - layer name
        layerIndex - layer index
        layerDependencies - layer dependencies
    • Method Detail

      • addPostLayersTask

        public void addPostLayersTask​(java.lang.Runnable task)
        Add a task, e.g. a message dialog, that should be executed in EDT after all layers have been added.
        Parameters:
        task - task to run in EDT
      • addSubLayer

        public void addSubLayer​(int idx,
                                Layer layer,
                                org.w3c.dom.Element el)
        Add sub layers
        Parameters:
        idx - index
        layer - sub layer
        el - The XML element of the sub layer. Should contain "index" and "name" attributes. Can contain "opacity" and "visible" attributes
        Since:
        18466
      • getSubLayers

        public java.util.Map<java.lang.Integer,​java.util.Map.Entry<Layer,​org.w3c.dom.Element>> getSubLayers()
        Returns the sub layers
        Returns:
        the sub layers. Can be null.
        Since:
        18466
      • getInputStream

        public java.io.InputStream getInputStream​(java.lang.String uriStr)
                                           throws java.io.IOException
        Return an InputStream for a URI from a .jos/.joz file.

        The following forms are supported:

        - absolute file (both .jos and .joz): "file:///home/user/data.osm" "file:/home/user/data.osm" "file:///C:/files/data.osm" "file:/C:/file/data.osm" "/home/user/data.osm" "C:\files\data.osm" (not a URI, but recognized by File constructor on Windows systems) - standalone .jos files: - relative uri: "save/data.osm" "../project2/data.osm" - for .joz files: - file inside zip archive: "layers/01/data.osm" - relative to the .joz file: "../save/data.osm" ("../" steps out of the archive)

        Parameters:
        uriStr - URI as string
        Returns:
        the InputStream
        Throws:
        java.io.IOException - Thrown when no Stream can be opened for the given URI, e.g. when the linked file has been deleted.
      • getFile

        public java.io.File getFile​(java.lang.String uriStr)
                             throws java.io.IOException
        Return a File for a URI from a .jos/.joz file.

        Returns null if the URI points to a file inside the zip archive. In this case, inZipPath will be set to the corresponding path.

        Parameters:
        uriStr - the URI as string
        Returns:
        the resulting File
        Throws:
        java.io.IOException - if any I/O error occurs
      • isZip

        public boolean isZip()
        Determines if we are reading from a .joz file.
        Returns:
        true if we are reading from a .joz file, false otherwise
      • getLayerName

        public java.lang.String getLayerName()
        Name of the layer that is currently imported.
        Returns:
        layer name
      • getLayerIndex

        public int getLayerIndex()
        Index of the layer that is currently imported.
        Returns:
        layer index
      • getLayerDependencies

        public java.util.List<SessionReader.LayerDependencygetLayerDependencies()
        Dependencies - maps the layer index to the importer of the given layer. All the dependent importers have loaded completely at this point.
        Returns:
        layer dependencies
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object