com.pentec.adapt.afile
Class AFile

java.lang.Object
  extended by com.pentec.adapt.afile.AFile
Direct Known Subclasses:
Ascii, Cigars, Iris, Other, Pod, Saf, Satirs

public class AFile
extends java.lang.Object

AFile provides methods to open, read, and write files with ADAPT. Currently recognized file formats are SAF, SATIRS ASCII, SATIRS binary, ADAPT generated XY plots, ASCII XY files, CIGARS, IRIS, BMP, GIF, JPG, FPX, PNG, and TIFF.

Author:
Pender Technology

Field Summary
protected  java.lang.String $Value
          Text used for value readout label
protected  java.lang.String $X
          Text used for x-axis cursor readout label
protected  java.lang.String $Y
          Text used for y-axis cursor readout label; if this is "", the label will not be shown
static int ADAPTXY
          File type indentifiers
static int ASCII
          File type indentifiers
static int BASLER
          File type indentifiers
static int CIGARS
          File type indentifiers
static int COLUMNPROFILE
          Visualization mode options as integer constants
protected  java.awt.image.DataBuffer dataBuffer
          The actual data
static javax.swing.JFileChooser fileChooser
          The global ADAPT file selector
static int FIST1
          File type indentifiers
static int FIST2
          File type indentifiers
 Header header
          The header for this file
 int iFileType
          The file type of this file
static int IMAGE
          Visualization mode options as integer constants
protected  com.sun.media.jai.codec.FileSeekableStream inputFile
          The actual input stream for the file
static int IRIS
          File type indentifiers
protected  int iScanSize
          The number of words in a scan
protected  boolean isMovie
          A flag indicating if this is a movie file
protected  int iVisualizationMode
          The currently selected visualization mode
 java.io.File jfile
          The Java File variable for this file
private static javax.swing.JPanel jpViewOptions
          View mode options panel
private static javax.swing.JRadioButton jrbMScan
          Radio buttons for file chooser view mode options
private static javax.swing.JRadioButton jrbMSlice
          Radio buttons for file chooser view mode options
private static javax.swing.JRadioButton jrbSingle
          Radio buttons for file chooser view mode options
protected  DataFrame mainFrame
          A handle to the containing data frame
static int MULTISCAN
          View mode constant
static int MULTISLICE
          View mode constant
static int OTHER
          File type indentifiers
static int POD
          File type indentifiers
protected static AProgress progress
          Progress window for use with multi panel mode
static int REDLAKEMS10
          File type indentifiers
static int REDLAKEMS8
          File type indentifiers
static int ROWPROFILE
          Visualization mode options as integer constants
static int SAF
          File type indentifiers
static int SATIRSA
          File type indentifiers
static int SATIRSB
          File type indentifiers
static int SINGLE
          View mode constant
static int TPROFILE
          Visualization mode options as integer constants
static int UNKNOWN
          File type indentifiers
static int ZPROFILE
          Visualization mode options as integer constants
 
Constructor Summary
  AFile(DataFrame mainFrame, java.io.File file)
          This constructor is used for pre-created plots
protected AFile(DataFrame mainFrame, java.io.File file, com.sun.media.jai.codec.FileSeekableStream fsStream)
          This protected constructor is used by the extended AFile classes
 
Method Summary
static void chooseFile(AdaptWindow callingFrame)
          Pick and open a file using the filechooser
static void closeProgress()
           
private static java.lang.String convertURL(java.lang.String $)
           
static void fileClose(DataFrame callingFrame)
          This method (File--Close on the main menu) closes a file.
static void fileExit(AdaptWindow callingFrame)
          Close all open windows
static void fileExit(DataFrame callingFrame)
          Close all open windows
static void fileOpen(AdaptWindow callingFrame)
           
static DataFrame fileOpen(AdaptWindow callingFrame, java.io.File fileNew, int iViewMode, int iScan, int iSlide, boolean flagVisible)
          Open a file and create a frame to contain it.
static DataFrame fileOpen(AdaptWindow callingFrame, java.lang.String $FileName, boolean flagVisible)
          Open a file and create a frame to contain it.
static void fileOpen(DataFrame callingFrame)
          ADAPT menu callback: File -> Open
 void fileOpen(java.lang.String $)
          This method takes care of opening an actual file if the input string is a file name; otherwise, a file chooser dialog is used to select an input file.
static void frameClose(DataFrame callingFrame)
           
static void frameClose(DataFrame callingFrame, boolean showErrors)
           
 java.awt.image.DataBuffer getDataBuffer()
           
 int getDataType()
           
private static java.io.File[] getMergeFiles(java.lang.String $Path)
           
private static java.io.File[] getMergeFiles(java.lang.String $File1, java.lang.String $1, java.lang.String $2, java.lang.String $3)
           
 int getNumBands()
          If an AFile implementor puts all data bands into a single data buffer, then the number of bands and number of slices are equivalent; otherwise this method should be overridden by the implementing class (see Iris.java for an example)
 APanel getPanel()
           
 java.awt.image.ComponentSampleModel getSampleModel()
           
 java.lang.String getScan$()
           
 int getScanSize()
           
 java.lang.String getSlice$()
           
 java.lang.String getValue$()
           
 int getVisualizationMode()
           
 java.lang.String[] getVisualizationMode$()
           
 java.lang.String getX$()
           
 java.lang.String getY$()
           
 boolean isMovie()
           
private static boolean isURL(java.lang.String $)
           
static void openProgress(javax.swing.JFrame callingFrame, java.lang.String $Title, java.lang.String $Message)
           
 int read(int iScan)
           
 void setDataBuffer(java.awt.image.DataBuffer dataBuffer)
           
 void setLabels(java.lang.String $X, java.lang.String $Y, java.lang.String $Value)
           
static void setProgress(java.lang.String $)
           
 void setScanSize(int iScanSize)
           
 boolean setVisualizationMode(int iMode)
           
 void setX$(java.lang.String $)
           
 void setY$(java.lang.String $)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

$Value

protected java.lang.String $Value
Text used for value readout label


$X

protected java.lang.String $X
Text used for x-axis cursor readout label


$Y

protected java.lang.String $Y
Text used for y-axis cursor readout label; if this is "", the label will not be shown


ADAPTXY

public static final int ADAPTXY
File type indentifiers

See Also:
Constant Field Values

ASCII

public static final int ASCII
File type indentifiers

See Also:
Constant Field Values

BASLER

public static final int BASLER
File type indentifiers

See Also:
Constant Field Values

CIGARS

public static final int CIGARS
File type indentifiers

See Also:
Constant Field Values

COLUMNPROFILE

public static final int COLUMNPROFILE
Visualization mode options as integer constants

See Also:
Constant Field Values

dataBuffer

protected java.awt.image.DataBuffer dataBuffer
The actual data


fileChooser

public static javax.swing.JFileChooser fileChooser
The global ADAPT file selector


FIST1

public static final int FIST1
File type indentifiers

See Also:
Constant Field Values

FIST2

public static final int FIST2
File type indentifiers

See Also:
Constant Field Values

header

public Header header
The header for this file


iFileType

public int iFileType
The file type of this file


IMAGE

public static final int IMAGE
Visualization mode options as integer constants

See Also:
Constant Field Values

inputFile

protected com.sun.media.jai.codec.FileSeekableStream inputFile
The actual input stream for the file


IRIS

public static final int IRIS
File type indentifiers

See Also:
Constant Field Values

iScanSize

protected int iScanSize
The number of words in a scan


isMovie

protected boolean isMovie
A flag indicating if this is a movie file


iVisualizationMode

protected int iVisualizationMode
The currently selected visualization mode


jfile

public java.io.File jfile
The Java File variable for this file


jpViewOptions

private static final javax.swing.JPanel jpViewOptions
View mode options panel


jrbMScan

private static final javax.swing.JRadioButton jrbMScan
Radio buttons for file chooser view mode options


jrbMSlice

private static final javax.swing.JRadioButton jrbMSlice
Radio buttons for file chooser view mode options


jrbSingle

private static final javax.swing.JRadioButton jrbSingle
Radio buttons for file chooser view mode options


mainFrame

protected DataFrame mainFrame
A handle to the containing data frame


MULTISCAN

public static final int MULTISCAN
View mode constant

See Also:
Constant Field Values

MULTISLICE

public static final int MULTISLICE
View mode constant

See Also:
Constant Field Values

OTHER

public static final int OTHER
File type indentifiers

See Also:
Constant Field Values

POD

public static final int POD
File type indentifiers

See Also:
Constant Field Values

progress

protected static AProgress progress
Progress window for use with multi panel mode


REDLAKEMS10

public static final int REDLAKEMS10
File type indentifiers

See Also:
Constant Field Values

REDLAKEMS8

public static final int REDLAKEMS8
File type indentifiers

See Also:
Constant Field Values

ROWPROFILE

public static final int ROWPROFILE
Visualization mode options as integer constants

See Also:
Constant Field Values

SAF

public static final int SAF
File type indentifiers

See Also:
Constant Field Values

SATIRSA

public static final int SATIRSA
File type indentifiers

See Also:
Constant Field Values

SATIRSB

public static final int SATIRSB
File type indentifiers

See Also:
Constant Field Values

SINGLE

public static final int SINGLE
View mode constant

See Also:
Constant Field Values

TPROFILE

public static final int TPROFILE
Visualization mode options as integer constants

See Also:
Constant Field Values

UNKNOWN

public static final int UNKNOWN
File type indentifiers

See Also:
Constant Field Values

ZPROFILE

public static final int ZPROFILE
Visualization mode options as integer constants

See Also:
Constant Field Values
Constructor Detail

AFile

public AFile(DataFrame mainFrame,
             java.io.File file)
This constructor is used for pre-created plots

Parameters:
mainFrame - the DataFrame attempting to open a file
file - the file to open

AFile

protected AFile(DataFrame mainFrame,
                java.io.File file,
                com.sun.media.jai.codec.FileSeekableStream fsStream)
This protected constructor is used by the extended AFile classes

Parameters:
mainFrame - the DataFrame attempting to open a file
file - the JFile to open
fsStream - the file input stream
Method Detail

chooseFile

public static void chooseFile(AdaptWindow callingFrame)
Pick and open a file using the filechooser


closeProgress

public static void closeProgress()

convertURL

private static java.lang.String convertURL(java.lang.String $)

fileClose

public static void fileClose(DataFrame callingFrame)
This method (File--Close on the main menu) closes a file.

Parameters:
callingFrame - the DataFrame making the call

fileExit

public static void fileExit(AdaptWindow callingFrame)
Close all open windows


fileExit

public static void fileExit(DataFrame callingFrame)
Close all open windows


fileOpen

public static void fileOpen(AdaptWindow callingFrame)

fileOpen

public static DataFrame fileOpen(AdaptWindow callingFrame,
                                 java.io.File fileNew,
                                 int iViewMode,
                                 int iScan,
                                 int iSlide,
                                 boolean flagVisible)
Open a file and create a frame to contain it.

Parameters:
callingFrame - the DataFrame making the call
fileNew - the file to open
iViewMode - either SINGLE, MULTISLICE, or MULTISCAN
iScan - the scan to start reading at
iSlide - the offset in pixels (x and y) from the calling frame
flagVisible - true to make the frame visible
Returns:
an DataFrame containing the data from the file

fileOpen

public static DataFrame fileOpen(AdaptWindow callingFrame,
                                 java.lang.String $FileName,
                                 boolean flagVisible)
Open a file and create a frame to contain it. The file is opened to scan 1 in the single panel mode at an offset of 25 pixels (x and y) from the calling frame.

Parameters:
callingFrame - the DataFrame making the call
$FileName - the file to open
flagVisible - true to make the frame visible
Returns:
a DataFrame containing an image of the data from the file

fileOpen

public static void fileOpen(DataFrame callingFrame)
ADAPT menu callback: File -> Open

Parameters:
callingFrame - calling DataFrame

fileOpen

public void fileOpen(java.lang.String $)
This method takes care of opening an actual file if the input string is a file name; otherwise, a file chooser dialog is used to select an input file.

Parameters:
$ - the file to open, or the test "Open" to use the file chooser

frameClose

public static void frameClose(DataFrame callingFrame)

frameClose

public static void frameClose(DataFrame callingFrame,
                              boolean showErrors)

getDataBuffer

public java.awt.image.DataBuffer getDataBuffer()

getDataType

public int getDataType()

getMergeFiles

private static java.io.File[] getMergeFiles(java.lang.String $Path)

getMergeFiles

private static java.io.File[] getMergeFiles(java.lang.String $File1,
                                            java.lang.String $1,
                                            java.lang.String $2,
                                            java.lang.String $3)

getNumBands

public int getNumBands()
If an AFile implementor puts all data bands into a single data buffer, then the number of bands and number of slices are equivalent; otherwise this method should be overridden by the implementing class (see Iris.java for an example)


getPanel

public APanel getPanel()

getSampleModel

public java.awt.image.ComponentSampleModel getSampleModel()

getScan$

public java.lang.String getScan$()

getScanSize

public int getScanSize()

getSlice$

public java.lang.String getSlice$()

getValue$

public java.lang.String getValue$()

getVisualizationMode

public int getVisualizationMode()

getVisualizationMode$

public java.lang.String[] getVisualizationMode$()

getX$

public java.lang.String getX$()

getY$

public java.lang.String getY$()

isMovie

public boolean isMovie()

isURL

private static boolean isURL(java.lang.String $)

openProgress

public static void openProgress(javax.swing.JFrame callingFrame,
                                java.lang.String $Title,
                                java.lang.String $Message)

read

public int read(int iScan)

setDataBuffer

public void setDataBuffer(java.awt.image.DataBuffer dataBuffer)

setLabels

public void setLabels(java.lang.String $X,
                      java.lang.String $Y,
                      java.lang.String $Value)

setProgress

public static void setProgress(java.lang.String $)

setScanSize

public void setScanSize(int iScanSize)

setVisualizationMode

public boolean setVisualizationMode(int iMode)

setX$

public void setX$(java.lang.String $)

setY$

public void setY$(java.lang.String $)