org.geotools.gce.imagemosaic
Class Utils

Object
  extended by Utils

public class Utils
extends Object

Sparse utilities for the various mosaic classes. I use them to extract complex code from other places.

Author:
Simone Giannecchini, GeoSolutions S.A.S.

Nested Class Summary
static class Utils.BBOXFilterExtractor
          Extracts a bbox from a filter in case there is at least one.
static class Utils.Prop
           
 
Field Summary
static String ADDITIONAL_DOMAIN
           
static Hints.Key AUXILIARY_FILES_PATH
           
static Hints.Key CHECK_AUXILIARY_METADATA
           
static boolean DEFAULT_COLOR_EXPANSION_BEHAVIOR
           
static boolean DEFAULT_CONFIGURATION_CACHING
           
static boolean DEFAULT_FOOTPRINT_MANAGEMENT
           
static String DEFAULT_INDEX_NAME
           
static String DEFAULT_LOCATION_ATTRIBUTE
          Default location attribute name.
static boolean DEFAULT_PATH_BEHAVIOR
          Default path behavior with respect to absolute paths.
static int DEFAULT_PRIORITY
          Default priority for the underlying Thread.
static boolean DEFAULT_RECURSION_BEHAVIOR
           
static String DEFAULT_WILCARD
          Default wildcard for creating mosaics.
static String ELEVATION_DOMAIN
           
static Hints.Key EXCLUDE_MOSAIC
           
static FilterFactory2 FF
           
static String INDEXER_PROPERTIES
           
static String INDEXER_XML
           
static Hints.Key MOSAIC_READER
           
static ObjectFactory OBJECT_FACTORY
           
static String PAM_DATASET
           
static String RANGE_SPLITTER_CHAR
           
static double[][] RGB_TO_GRAY_MATRIX
          RGB to GRAY coefficients (for Luminance computation)
static String SAMPLE_IMAGE_NAME
           
static String SCAN_FOR_TYPENAMES
           
static DataStoreFactorySpi SHAPE_SPI
           
static String TIME_DOMAIN
           
static TimeZone UTC_TIME_ZONE
           
 
Method Summary
static String checkDirectory(String testingDirectory, boolean writable)
           
static boolean checkFileReadable(File file)
          Checks that a File is a real file, exists and is readable.
static Map<String,Serializable> createDataStoreParamsFromPropertiesFile(Properties properties, DataStoreFactorySpi spi)
           
static Map<String,Serializable> createDataStoreParamsFromPropertiesFile(URL datastoreProperties)
           
static Range<? extends Number> createRange(Object firstValue, Object secondValue)
          Create a Range of numbers from a couple of values.
static IOFileFilter excludeFilters(IOFileFilter inputFilter, IOFileFilter... filters)
           
static Map<String,Serializable> filterDataStoreParams(Properties properties, DataStoreFactorySpi spi)
           
static void fixH2DatabaseLocation(Map<String,Serializable> params, String parentLocation)
           
static void fixH2MVCCParam(Map<String,Serializable> params)
           
static BorderExtender getBorderExtenderHint(RenderingHints renderHints)
           
static IOFileFilter getCleanupFilter()
           
static String getFileInfo(File file)
          Creates a human readable message that describe the provided File object in terms of its properties.
static ImageLayout getImageLayoutHint(RenderingHints renderHints)
           
static String getMessageFromException(Exception exception)
           
static TileCache getTileCacheHint(RenderingHints renderHints)
           
static TileScheduler getTileSchedulerHint(RenderingHints renderHints)
           
static boolean homogeneousCheck(int numberOfLevels, double[][] resolutionLevels, double[][] compareLevels)
          Check whether 2 resolution levels sets are homogeneous (within a tolerance)
static boolean isH2Store(DataStoreFactorySpi spi)
           
static boolean isOracleStore(DataStoreFactorySpi spi)
          Checks if the provided factory spi builds a Oracle store
static boolean isPostgisStore(DataStoreFactorySpi spi)
          Checks if the provided factory spi builds a Postgis store
static Properties loadPropertiesFromURL(URL propsURL)
           
static RenderedImage loadSampleImage(File sampleImageFile)
          Load a sample image from which we can take the sample model and color model to be used to fill holes in responses.
static PAMDataset mergePamDatasets(PAMDataset[] pamDatasets)
          Merge statistics across datasets.
static boolean minimalIndexCheck(Object source)
          Simple minimal check which checks whether and indexer file exists
static ReferencedEnvelope parseEnvelope(String bboxString)
          Parses a bbox in the form of MIX,MINY MAXX,MAXY
static void storeSampleImage(File sampleImageFile, SampleModel defaultSM, ColorModel defaultCM)
          Store a sample image from which we can derive the default SM and CM
static Indexer unmarshal(File indexerFile)
          Unmarshal the file and return and Indexer object.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FF

public static final FilterFactory2 FF

EXCLUDE_MOSAIC

public static final Hints.Key EXCLUDE_MOSAIC

CHECK_AUXILIARY_METADATA

public static final Hints.Key CHECK_AUXILIARY_METADATA

AUXILIARY_FILES_PATH

public static final Hints.Key AUXILIARY_FILES_PATH

MOSAIC_READER

public static final Hints.Key MOSAIC_READER

RANGE_SPLITTER_CHAR

public static final String RANGE_SPLITTER_CHAR
See Also:
Constant Field Values

INDEXER_PROPERTIES

public static final String INDEXER_PROPERTIES
See Also:
Constant Field Values

INDEXER_XML

public static final String INDEXER_XML
See Also:
Constant Field Values

PAM_DATASET

public static final String PAM_DATASET
See Also:
Constant Field Values

RGB_TO_GRAY_MATRIX

public static final double[][] RGB_TO_GRAY_MATRIX
RGB to GRAY coefficients (for Luminance computation)


DEFAULT_WILCARD

public static final String DEFAULT_WILCARD
Default wildcard for creating mosaics.

See Also:
Constant Field Values

DEFAULT_PATH_BEHAVIOR

public static final boolean DEFAULT_PATH_BEHAVIOR
Default path behavior with respect to absolute paths.

See Also:
Constant Field Values

DEFAULT_PRIORITY

public static final int DEFAULT_PRIORITY
Default priority for the underlying Thread.

See Also:
Constant Field Values

DEFAULT_LOCATION_ATTRIBUTE

public static final String DEFAULT_LOCATION_ATTRIBUTE
Default location attribute name.

See Also:
Constant Field Values

DEFAULT_INDEX_NAME

public static final String DEFAULT_INDEX_NAME
See Also:
Constant Field Values

SHAPE_SPI

public static final DataStoreFactorySpi SHAPE_SPI

DEFAULT_RECURSION_BEHAVIOR

public static final boolean DEFAULT_RECURSION_BEHAVIOR
See Also:
Constant Field Values

DEFAULT_FOOTPRINT_MANAGEMENT

public static final boolean DEFAULT_FOOTPRINT_MANAGEMENT
See Also:
Constant Field Values

DEFAULT_CONFIGURATION_CACHING

public static final boolean DEFAULT_CONFIGURATION_CACHING
See Also:
Constant Field Values

DEFAULT_COLOR_EXPANSION_BEHAVIOR

public static final boolean DEFAULT_COLOR_EXPANSION_BEHAVIOR
See Also:
Constant Field Values

UTC_TIME_ZONE

public static final TimeZone UTC_TIME_ZONE

SCAN_FOR_TYPENAMES

public static final String SCAN_FOR_TYPENAMES
See Also:
Constant Field Values

SAMPLE_IMAGE_NAME

public static final String SAMPLE_IMAGE_NAME
See Also:
Constant Field Values

TIME_DOMAIN

public static final String TIME_DOMAIN
See Also:
Constant Field Values

ELEVATION_DOMAIN

public static final String ELEVATION_DOMAIN
See Also:
Constant Field Values

ADDITIONAL_DOMAIN

public static final String ADDITIONAL_DOMAIN
See Also:
Constant Field Values

OBJECT_FACTORY

public static ObjectFactory OBJECT_FACTORY
Method Detail

getMessageFromException

public static String getMessageFromException(Exception exception)

parseEnvelope

public static ReferencedEnvelope parseEnvelope(String bboxString)
Parses a bbox in the form of MIX,MINY MAXX,MAXY

Parameters:
bboxString - the string to parse the bbox from
Returns:
a ReferencedEnvelope with the parse bbox or null

loadPropertiesFromURL

public static Properties loadPropertiesFromURL(URL propsURL)

excludeFilters

public static IOFileFilter excludeFilters(IOFileFilter inputFilter,
                                          IOFileFilter... filters)

checkFileReadable

public static boolean checkFileReadable(File file)
Checks that a File is a real file, exists and is readable.

Parameters:
file - the File instance to check. Must not be null.
Returns:
true in case the file is a real file, exists and is readable; false otherwise.

getFileInfo

public static String getFileInfo(File file)
Creates a human readable message that describe the provided File object in terms of its properties.

Useful for creating meaningful log messages.

Parameters:
file - the File object to create a descriptive message for
Returns:
a String containing a descriptive message about the provided File.

checkDirectory

public static String checkDirectory(String testingDirectory,
                                    boolean writable)
                             throws IllegalArgumentException
Parameters:
testingDirectory -
Returns:
Throws:
IllegalArgumentException
IOException

createDataStoreParamsFromPropertiesFile

public static Map<String,Serializable> createDataStoreParamsFromPropertiesFile(URL datastoreProperties)
                                                                        throws IOException
Parameters:
datastoreProperties -
Returns:
Throws:
IOException

storeSampleImage

public static void storeSampleImage(File sampleImageFile,
                                    SampleModel defaultSM,
                                    ColorModel defaultCM)
                             throws IOException
Store a sample image from which we can derive the default SM and CM

Parameters:
sampleImageFile - where we should store the image
defaultSM - the SampleModel for the sample image.
defaultCM - the ColorModel for the sample image.
Throws:
IOException - in case something bad occurs during writing.

loadSampleImage

public static RenderedImage loadSampleImage(File sampleImageFile)
Load a sample image from which we can take the sample model and color model to be used to fill holes in responses.

Parameters:
sampleImageFile - the path to sample image.
Returns:
a sample image from which we can take the sample model and color model to be used to fill holes in responses.

createDataStoreParamsFromPropertiesFile

public static Map<String,Serializable> createDataStoreParamsFromPropertiesFile(Properties properties,
                                                                               DataStoreFactorySpi spi)
                                                                        throws IOException
Throws:
IOException

filterDataStoreParams

public static Map<String,Serializable> filterDataStoreParams(Properties properties,
                                                             DataStoreFactorySpi spi)
                                                      throws IOException
Throws:
IOException

getImageLayoutHint

public static ImageLayout getImageLayoutHint(RenderingHints renderHints)

getTileCacheHint

public static TileCache getTileCacheHint(RenderingHints renderHints)

getBorderExtenderHint

public static BorderExtender getBorderExtenderHint(RenderingHints renderHints)

getTileSchedulerHint

public static TileScheduler getTileSchedulerHint(RenderingHints renderHints)

createRange

public static Range<? extends Number> createRange(Object firstValue,
                                                  Object secondValue)
Create a Range of numbers from a couple of values.

Parameters:
firstValue -
secondValue -
Returns:

minimalIndexCheck

public static boolean minimalIndexCheck(Object source)
Simple minimal check which checks whether and indexer file exists

Parameters:
source -
Returns:

homogeneousCheck

public static boolean homogeneousCheck(int numberOfLevels,
                                       double[][] resolutionLevels,
                                       double[][] compareLevels)
Check whether 2 resolution levels sets are homogeneous (within a tolerance)

Parameters:
numberOfLevels -
resolutionLevels -
compareLevels -
Returns:

unmarshal

public static Indexer unmarshal(File indexerFile)
                         throws JAXBException
Unmarshal the file and return and Indexer object.

Parameters:
indexerFile -
Returns:
Throws:
JAXBException

isH2Store

public static boolean isH2Store(DataStoreFactorySpi spi)

fixH2DatabaseLocation

public static void fixH2DatabaseLocation(Map<String,Serializable> params,
                                         String parentLocation)
                                  throws MalformedURLException
Throws:
MalformedURLException

isOracleStore

public static boolean isOracleStore(DataStoreFactorySpi spi)
Checks if the provided factory spi builds a Oracle store


isPostgisStore

public static boolean isPostgisStore(DataStoreFactorySpi spi)
Checks if the provided factory spi builds a Postgis store


mergePamDatasets

public static PAMDataset mergePamDatasets(PAMDataset[] pamDatasets)
Merge statistics across datasets.

Parameters:
pamDatasets -
Returns:

getCleanupFilter

public static IOFileFilter getCleanupFilter()

fixH2MVCCParam

public static void fixH2MVCCParam(Map<String,Serializable> params)


Copyright © 1996-2014 Geotools. All Rights Reserved.