Class WorldFileHandler

  • All Implemented Interfaces:
    HandlerToMakeYourLifeEasier

    public class WorldFileHandler
    extends Object
    implements HandlerToMakeYourLifeEasier
    class to create a ESRI-Worldfile for RasterImages that are exported from Jump, also for reading existent world files.
    Version:
    $Rev: 2509 $ modified: [sstein]: 16.Feb.2009 changed logger-entries to comments
    Author:
    Ole Rahn

    FH Osnabrück - University of Applied Sciences Osnabrück,
    Project: PIROL (2005),
    Subproject: Daten- und Wissensmanagement
    • Field Detail

      • worldFileName

        protected String worldFileName
      • imageFileName

        protected String imageFileName
    • Constructor Detail

      • WorldFileHandler

        public WorldFileHandler​(String imageFileName,
                                boolean allwaysLookForTFWExtension)
        Parameters:
        imageFileName - name of the image file the world file is for
        allwaysLookForTFWExtension - if true the worldFileHandler will look for world files with the extension .tfw even if the image file format would suggest an other extension, like .pgw - this parameter has no influence on the writing of world files!
    • Method Detail

      • writeWorldFile

        public boolean writeWorldFile​(org.locationtech.jts.geom.Envelope imageCoordinates,
                                      int imgWidth,
                                      int imgHeight)
        Method that writes a world file according to the given coordinate and image information.
        Parameters:
        imageCoordinates - real world coordinates of the image
        imgWidth - width (in pixel) of the image
        imgHeight - height (in pixel) of the image
        Returns:
        true if a world file was written, else false
      • readWorldFile

        public org.locationtech.jts.geom.Envelope readWorldFile​(int imgWidth,
                                                                int imgHeight)
        Retrieve the real world coordinates of the image from the world file
        Parameters:
        imgWidth - width (in pixel) of the image
        imgHeight - height (in pixel) of the image
        Returns:
        real world coordinates of the image
      • createListOfWorldFileNamesForImage

        protected List createListOfWorldFileNamesForImage()
        creates a list of possible worldfile names for the given image file name. The first one meets the naming conventions from ESRI, the other names are variations that we got from ArcView, far away from conventions...
        Returns:
        a list of possible worldfile names
      • isWorldFileExistentForImage

        public String isWorldFileExistentForImage()
        Method that checks if a world file for the given image name can be found. If so, it's name will be returned and also be stored internally.
        Returns:
        the name of the worldfile if existent, else null
      • isAllwaysLookForTFWExtension

        public boolean isAllwaysLookForTFWExtension()
        Returns:
        Returns the allwaysLookForTFWExtension.
      • setAllwaysLookForTFWExtension

        public void setAllwaysLookForTFWExtension​(boolean allwaysLookForTFWExtension)
        Parameters:
        allwaysLookForTFWExtension - The allwaysLookForTFWExtension to set.
      • getImageFileName

        public String getImageFileName()
        Returns:
        Returns the imageFileName.
      • setImageFileName

        public void setImageFileName​(String imageFileName)
        Parameters:
        imageFileName - The imageFileName to set.
      • getWorldFileName

        public String getWorldFileName()
        Returns:
        Returns the worldFileName.