protected bool doCanRead(Object source, AVList parameters)
        {
            String path = WWIO.getSourcePath(source);

            if (path == null)
            {
                return(false);
            }

            GeotiffReader reader = null;

            try
            {
                reader = new GeotiffReader(path);
                bool isGeoTiff = reader.isGeotiff(0);
                if (!isGeoTiff)
                {
                    isGeoTiff = WorldFile.hasWorldFiles(source);
                }
                return(isGeoTiff);
            }
            catch (Exception e)
            {
                // Intentionally ignoring exceptions.
                return(false);
            }
            finally
            {
                if (reader != null)
                {
                    reader.close();
                }
            }
        }
Пример #2
0
        protected bool doCanRead(Object source, AVList parameters)
        {
            if (!(source is java.io.File) && !(source is java.net.URL))
            {
                return(false);
            }

            // If the data source doesn't already have all the necessary metadata, then we determine whether or not
            // the missing metadata can be read.
            String error = this.validateMetadata(source, parameters);

            if (!WWUtil.isEmpty(error))
            {
                if (!WorldFile.hasWorldFiles(source))
                {
                    Logging.logger().fine(error);
                    return(false);
                }
            }

            if (null != parameters)
            {
                if (!params.hasKey(AVKey.PIXEL_FORMAT))
                {
                    parameters.setValue(AVKey.PIXEL_FORMAT, AVKey.ELEVATION);
                }
            }

            return(true);
        }