Package ucar.unidata.data.imagery
Class ImageDataSource
java.lang.Object
ucar.unidata.collab.SharableImpl
ucar.unidata.data.DataSourceImpl
ucar.unidata.data.imagery.ImageDataSource
- All Implemented Interfaces:
Sharable
,DataSource
,DataSourceFactory
,XmlPersistable
- Direct Known Subclasses:
AddeImageDataSource
,McIDASImageDataSource
Abstract DataSource class for images files.
- Author:
- IDV development team
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Class ImageDataInfo Holds an index and an AddeImageDescriptor -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List
list of imagesprotected List
list of image timesstatic final String
satellite typestatic final String
Type of image, radar or satellite.static final String
radar typestatic final String
satellite typeFields inherited from class ucar.unidata.data.DataSourceImpl
changeDataPathsCbx, dataCacheKey, dataChoices, geoSelectionPanel, haveBeenUnPersisted, okToContinue, PARAM_SHOW_HIDE, PARAM_SHOW_NO, PARAM_SHOW_YES
Fields inherited from interface ucar.unidata.data.DataSource
DATAPATH_DATE_FORMAT, DATAPATH_DATE_PATTERN, MOST_RECENT, ordinalNames, PROP_AUTOCREATEDISPLAY, PROP_BASEDIRECTORY, PROP_CACHEABLE, PROP_DATACHOICENAME, PROP_DISPLAYPROPERTIES, PROP_DOCUMENTLINKS, PROP_FILEPATTERN, PROP_GEOLOCATION, PROP_ICON, PROP_NAME, PROP_POLLINFO, PROP_RESOLVERURL, PROP_SERVICE_HTTP, PROP_SUBPROPERTIES, PROP_TIMELABELS, PROP_TIMESTRIDE, PROP_TITLE
-
Constructor Summary
ConstructorsConstructorDescriptionThe parameterless constructor for unpersisting.ImageDataSource
(DataSourceDescriptor descriptor, String[] images, Hashtable properties) Create a new ImageDataSource with a list of (String) images.ImageDataSource
(DataSourceDescriptor descriptor, List images, Hashtable properties) Create a new ImageDataSource with a list of (String) images.ImageDataSource
(DataSourceDescriptor descriptor, ImageDataset ids, Hashtable properties) Create a new ImageDataSource with the givenImageDataset
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Can this data source cache itsboolean
Is this data source capable of saving its data to local diskvoid
Create the set ofDataChoice
that represent the data held by this data source.Override the base class method to return the list of times we created.void
doRemove()
Called when Datasource is removed.boolean
Check to see if this ImageDataSource is equal to the object in question.getAllDateTimes
(DataChoice dataChoice) Override the base class method for the non composite choices.Return the list ofDataCategory
used for single time step data with band information.Return the list ofDataCategory
used for multiple time step data with band information.boolean
Get whether we should cache to diskgetCompositeDataChoices
(CompositeDataChoice compositeDataChoice, List dataChoices) This is used when we are unbundled and we may have different times than when we were saved.protected Data
getDataInner
(DataChoice dataChoice, DataCategory category, DataSelection dataSelection, Hashtable requestProperties) Create the actual data represented by the givenDataChoice
.Get the name for the main data objectGet the paths for saving data filesgetDescriptor
(Object object) A utility method that helps us deal with legacy bundles that used to have String file names as the id of a data choice.protected List
getDescriptors
(DataChoice dataChoice, DataSelection subset) Get a list of descriptors from the choice and subsetReturn the list ofAddeImageDescriptor
s that define this data source.Get an expanded description for the details display.abstract String
A hook for the derived classes to return their specific name (eg, ADDE data source, McIDAS data source.Return the list ofAddeImageDescriptor
s that define this data source.protected List
Get the location where we poll.getSelectedDateTimes
(DataChoice dataChoice) Override the base class method for the non-composite choices.Return the list ofDataCategory
used for single time step data.Return the list ofDataCategory
used for multiple time step data.int
hashCode()
Override the hashCode method.void
Override the init method for when this data source is unpersisted.protected boolean
Method for intializing the data.protected boolean
Are we getting images from a file or from addeprotected final SingleBandedImage
makeImage
(DataChoice dataChoice, DataSelection subset) Create the single image defined by the given dataChoice.protected SingleBandedImage
makeImage
(AddeImageDescriptor aid, MathType rangeType, boolean fromSequence, String readLabel) Create the single image defined by the given dataChoice.static ImageDataset
makeImageDataset
(String[] addeURLs) Make an ImageDataset from an array of ADDE URLs or AREA file namesstatic List
makeImageDescriptors
(String[] addeURLs) Make a list of image descriptorsprotected ImageSequence
makeImageSequence
(DataChoice dataChoice, DataSelection subset) Create the image sequence defined by the given dataChoice.void
newFileFromPolling
(File file) If we are polling some directory this method gets called when there is a new file.protected void
The user changed the properties.void
Reload the datavoid
reloadData
(Object object, Hashtable properties) Reload dataprotected List
saveDataToLocalDisk
(String prefix, Object loadId, boolean changeLinks) Save files to local diskvoid
setImageList
(List l) Set the list ofAddeImageDescriptor
s that define this data source.void
setNewFiles
(List files) Handle when this data source gets new files to use at runtime (e.g., from isl)void
updateState
(Object newObject, Hashtable newProperties) Update the stateMethods inherited from class ucar.unidata.data.DataSourceImpl
addActions, addDataChangeListener, addDataChoice, addPropertiesTabs, addReloadTab, applyFieldMask, applyProperties, beginWritingDataToLocalDisk, canAddCurrentName, canChangeData, canDoAllLevels, canDoFieldMask, canDoGeoSelection, canDoGeoSelectionMap, canDoGeoSelectionStride, canPoll, canShowParameter, checkForInitAfterUnPersistence, clearCachedData, clearFileCache, clearTimes, convertSourceFile, convertToFilesIfDirectory, createAutoDisplay, createCacheKey, createElement, decrOutstandingGetDataCalls, doDirectory, doMakeGeoSelectionPanel, doMakeGeoSelectionPanel, doMakeGeoSelectionPanel, doMakeGeoSubsetPropertiesComponent, endWritingDataToLocalDisk, expandIfNeeded, findDataChoice, findDataChoices, flushCache, getAbsoluteDateTimes, getActions, getAlias, getAllDateTimes, getAllLevels, getAllLevels, getAllTimesForTimeDriver, getCache, getCache, getCacheClearDelay, getData, getData, getDataCachePath, getDataChangeListeners, getDataChoices, getDataContext, getDataInner, getDataIsEditable, getDataPrefix, getDataSelection, getDataSelectionComponents, getDataSource, getDateTimes, getDateTimeSelection, getDefaultSave, getDescription, getDescriptor, getErrorMessage, getEverChangedName, getExtraGeoSelectionComponent, getExtraTimesComponent, getFileFilterForPolling, getid, getIdv, getInError, getLocalDirectory, getLocationForPolling, getMostRecentFiles, getName, getNameForDataSource, getNeedToShowErrorToUser, getNextId, getOutstandingGetDataCalls, getPartialDescription, getPassword, getPathsThatCanBeRelative, getPollingInfo, getProperties, getPropertiesComponents, getPropertiesHeader, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getProperty, getRelativePaths, getSampleDataProjection, getSaveDataFileLabel, getSelectedDateTimes, getTimesFromDataSelection, getTmpPaths, getTypeName, getUserName, handlePropertiesAction, hasPollingInfo, holdsDateTimes, holdsIndices, identifiedBy, identifiedByName, incrOutstandingGetDataCalls, initAfter, initAfterCreation, initDataChoice, initDataSelectionComponents, initFromXml, isPolling, loadFieldMask, loadFieldMask, loadLatestFile, logException, logException, makeDerivedDataChoices, makeSaveLocalActions, newFilesFromPolling, notifyDataChange, putCache, putCache, reloadProperties, removeCache, removeDataChangeListener, removeDataChoice, removeProperty, replaceDataChoice, resetTmpState, saveDataToLocalDisk, saveDataToLocalDisk, selectTimesFromList, setAlias, setAskToUpdate, setCacheClearDelay, setCacheDataToDisk, setDataEditableStrings, setDataIsEditable, setDataIsRelative, setDataRelativeStrings, setDataSelection, setDateTimeSelection, setDefaultSave, setDescription, setDescriptor, setDirectory, setEverChangedName, setInError, setInError, setInError, setName, setObjectProperties, setObjectProperty, setPassword, setPollingInfo, setPollLocation, setProperties, setProperty, setProperty, setRelativePaths, setTemplateName, setTmpPaths, setUserName, shouldCache, shouldCache, showPasswordDialog, showPropertiesDialog, showPropertiesDialog, showPropertiesDialog, showWaitDialog, tick, toString, toStringTruncated, updateDetailsText, writeFieldMaskFile, writeFieldMaskFile
Methods inherited from class ucar.unidata.collab.SharableImpl
applySharableProperties, doShare, doShare, doShareExternal, doShareInternal, getReceiveShareTime, getSharablePropertiesComponent, getShareGroup, getSharing, getUniqueId, initSharable, receiveShareData, removeSharable, setReceiveShareTime, setShareGroup, setSharing, setUniqueId, showSharableDialog
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface ucar.unidata.data.DataSource
getUniqueId
-
Field Details
-
PROP_IMAGETYPE
Type of image, radar or satellite. Set by the chooser to disambiguate between types- See Also:
-
TYPE_RADAR
radar type- See Also:
-
TYPE_SATELLITE
satellite type- See Also:
-
PROP_BANDINFO
satellite type- See Also:
-
imageList
list of images -
imageTimes
list of image times
-
-
Constructor Details
-
ImageDataSource
public ImageDataSource()The parameterless constructor for unpersisting. -
ImageDataSource
Create a new ImageDataSource with a list of (String) images. These can either be AREA files or ADDE URLs.- Parameters:
descriptor
- The descriptor for this data source.images
- Array of file anmes or urls.properties
- The properties for this data source.
-
ImageDataSource
Create a new ImageDataSource with a list of (String) images. These can either be AREA files or ADDE URLs.- Parameters:
descriptor
- The descriptor for this data source.images
- Array of file anmes or urls.properties
- The properties for this data source.
-
ImageDataSource
Create a new ImageDataSource with the givenImageDataset
. The dataset may hold eight AREA file filepaths or ADDE URLs.- Parameters:
descriptor
- The descriptor for this data source.ids
- The dataset.properties
- The properties for this data source.
-
-
Method Details
-
reloadData
Reload data- Specified by:
reloadData
in interfaceDataSource
- Overrides:
reloadData
in classDataSourceImpl
- Parameters:
object
- the object to reloadproperties
- the properties
-
setNewFiles
Handle when this data source gets new files to use at runtime (e.g., from isl)- Specified by:
setNewFiles
in interfaceDataSource
- Overrides:
setNewFiles
in classDataSourceImpl
- Parameters:
files
- List of files
-
updateState
Update the state- Specified by:
updateState
in interfaceDataSource
- Overrides:
updateState
in classDataSourceImpl
- Parameters:
newObject
- the new objectnewProperties
- the new properties
-
getDataPaths
Get the paths for saving data files- Specified by:
getDataPaths
in interfaceDataSource
- Overrides:
getDataPaths
in classDataSourceImpl
- Returns:
- data paths
-
initAfterUnpersistence
public void initAfterUnpersistence()Override the init method for when this data source is unpersisted. We simply check the imageList to see if this object came from a legacy bundle.- Specified by:
initAfterUnpersistence
in interfaceDataSource
- Overrides:
initAfterUnpersistence
in classDataSourceImpl
-
canCacheDataToDisk
public boolean canCacheDataToDisk()Can this data source cache its- Overrides:
canCacheDataToDisk
in classDataSourceImpl
- Returns:
- can cache data to disk
-
canSaveDataToLocalDisk
public boolean canSaveDataToLocalDisk()Is this data source capable of saving its data to local disk- Specified by:
canSaveDataToLocalDisk
in interfaceDataSource
- Overrides:
canSaveDataToLocalDisk
in classDataSourceImpl
- Returns:
- Can save to local disk
-
saveDataToLocalDisk
protected List saveDataToLocalDisk(String prefix, Object loadId, boolean changeLinks) throws Exception Save files to local disk- Overrides:
saveDataToLocalDisk
in classDataSourceImpl
- Parameters:
prefix
- destination dir and file prefixloadId
- For JobManagerchangeLinks
- Change internal file references- Returns:
- Files copied
- Throws:
Exception
- On badness
-
initDataFromPollingInfo
protected boolean initDataFromPollingInfo()Method for intializing the data.- Returns:
- result
-
propertiesChanged
protected void propertiesChanged()The user changed the properties. Update me.- Overrides:
propertiesChanged
in classDataSourceImpl
-
makeImageDataset
Make an ImageDataset from an array of ADDE URLs or AREA file names- Parameters:
addeURLs
- array of ADDE URLs- Returns:
- ImageDataset
-
makeImageDescriptors
Make a list of image descriptors- Parameters:
addeURLs
- array of ADDE URLs- Returns:
- ImageDataset
-
getLocationsForPolling
Get the location where we poll.- Overrides:
getLocationsForPolling
in classDataSourceImpl
- Returns:
- Directory to poll on.
-
isFileBased
protected boolean isFileBased()Are we getting images from a file or from adde- Returns:
- is the data from files
-
getDescriptor
A utility method that helps us deal with legacy bundles that used to have String file names as the id of a data choice.- Parameters:
object
- May be an AddeImageDescriptor (for new bundles) or a String that is converted to an image descriptor.- Returns:
- The image descriptor.
-
getCompositeDataChoices
This is used when we are unbundled and we may have different times than when we were saved. Use the current set of data choices.- Specified by:
getCompositeDataChoices
in interfaceDataSource
- Overrides:
getCompositeDataChoices
in classDataSourceImpl
- Parameters:
compositeDataChoice
- The compositedataChoices
- Its choices- Returns:
- The current choices
-
getImageDataSourceName
A hook for the derived classes to return their specific name (eg, ADDE data source, McIDAS data source.- Returns:
- The name of this data source.
-
getImageList
Return the list ofAddeImageDescriptor
s that define this data source.- Returns:
- The list of image descriptors.
-
getDescriptorsToUse
Return the list ofAddeImageDescriptor
s that define this data source.- Returns:
- The list of image descriptors.
-
setImageList
Set the list ofAddeImageDescriptor
s that define this data source.- Parameters:
l
- The list of image descriptors.
-
doMakeDateTimes
Override the base class method to return the list of times we created.- Overrides:
doMakeDateTimes
in classDataSourceImpl
- Returns:
- The list of times held by this data source.
-
getTwoDCategories
Return the list ofDataCategory
used for single time step data.- Returns:
- A list of categories.
-
getTwoDTimeSeriesCategories
Return the list ofDataCategory
used for multiple time step data.- Returns:
- A list of categories.
-
getBandCategories
Return the list ofDataCategory
used for single time step data with band information.- Returns:
- A list of categories.
-
getBandTimeSeriesCategories
Return the list ofDataCategory
used for multiple time step data with band information.- Returns:
- A list of categories.
-
doMakeDataChoices
public void doMakeDataChoices()Create the set ofDataChoice
that represent the data held by this data source. We create one top-levelCompositeDataChoice
that represents all of the image time steps. We create a set of childrenDirectDataChoice
, one for each time step.- Overrides:
doMakeDataChoices
in classDataSourceImpl
-
getDataInner
protected Data getDataInner(DataChoice dataChoice, DataCategory category, DataSelection dataSelection, Hashtable requestProperties) throws VisADException, RemoteException Create the actual data represented by the givenDataChoice
.- Overrides:
getDataInner
in classDataSourceImpl
- Parameters:
dataChoice
- Either theCompositeDataChoice
representing all time steps or aDirectDataChoice
representing a single time step.category
- Not really used.dataSelection
- Defines any time subsets.requestProperties
- extra request properties- Returns:
- The image or image sequence data.
- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
getAllDateTimes
Override the base class method for the non composite choices.- Specified by:
getAllDateTimes
in interfaceDataSource
- Overrides:
getAllDateTimes
in classDataSourceImpl
- Parameters:
dataChoice
- Either theCompositeDataChoice
representing all time steps or aDirectDataChoice
representing a single time step.- Returns:
- The list of times represented by the given dataChoice.
-
getSelectedDateTimes
Override the base class method for the non-composite choices.- Specified by:
getSelectedDateTimes
in interfaceDataSource
- Overrides:
getSelectedDateTimes
in classDataSourceImpl
- Parameters:
dataChoice
- Either theCompositeDataChoice
representing all time steps or aDirectDataChoice
representing a single time step.- Returns:
- The list of times represented by the given dataChoice.
-
makeImage
protected final SingleBandedImage makeImage(DataChoice dataChoice, DataSelection subset) throws VisADException, RemoteException Create the single image defined by the given dataChoice.- Parameters:
dataChoice
- The choice.subset
- any time subsets.- Returns:
- The data.
- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
makeImage
protected SingleBandedImage makeImage(AddeImageDescriptor aid, MathType rangeType, boolean fromSequence, String readLabel) throws VisADException, RemoteException Create the single image defined by the given dataChoice.- Parameters:
aid
- AddeImageDescriptorrangeType
- This is the sample rangeType. For the first image this is null and this method will immediately read the datafromSequence
- from a sequencereadLabel
- the label- Returns:
- The data.
- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
reloadData
public void reloadData()Reload the data- Specified by:
reloadData
in interfaceDataSource
- Overrides:
reloadData
in classDataSourceImpl
-
getCacheDataToDisk
public boolean getCacheDataToDisk()Get whether we should cache to disk- Overrides:
getCacheDataToDisk
in classDataSourceImpl
- Returns:
- true
-
makeImageSequence
protected ImageSequence makeImageSequence(DataChoice dataChoice, DataSelection subset) throws VisADException, RemoteException Create the image sequence defined by the given dataChoice.- Parameters:
dataChoice
- The choice.subset
- any time subsets.- Returns:
- The image sequence.
- Throws:
RemoteException
- Java RMI problemVisADException
- VisAD problem
-
getDescriptors
Get a list of descriptors from the choice and subset- Parameters:
dataChoice
- Data choicesubset
- subsetting info- Returns:
- list of descriptors matching the selection
-
equals
Check to see if this ImageDataSource is equal to the object in question.- Overrides:
equals
in classDataSourceImpl
- Parameters:
o
- object in question- Returns:
- true if they are the same or equivalent objects
-
hashCode
public int hashCode()Override the hashCode method. Use name and imageList. -
getDataName
Get the name for the main data object- Returns:
- name of main data object
-
getFullDescription
Get an expanded description for the details display. Override base class implementation to add more info.- Specified by:
getFullDescription
in interfaceDataSource
- Overrides:
getFullDescription
in classDataSourceImpl
- Returns:
- full description of this data source
-
newFileFromPolling
If we are polling some directory this method gets called when there is a new file. We set the file name, clear our state, reload the metadata and tell listeners of the change.- Overrides:
newFileFromPolling
in classDataSourceImpl
- Parameters:
file
- new File to use.
-
doRemove
public void doRemove()Called when Datasource is removed.- Specified by:
doRemove
in interfaceDataSource
- Overrides:
doRemove
in classDataSourceImpl
-