public class StkPatternFile extends Object
Reads from STK custom sensor pattern (.pattern) files. STK pattern files can express a custom sensor pattern for use with a sensor attached to a vehicle, facility, place or target in STK and are useful for getting this type of data into and out of STK.
To read an STK pattern file, call the StkPatternFile.readFrom(String)
method to read the data into memory,
and then call the StkPatternFile.createCustomSensorPattern()
method to create a CustomSensorPattern
representing the pattern data in the file.
Modifier and Type | Class and Description |
---|---|
static class |
StkPatternFile.Pattern
The base class for pattern data.
|
static class |
StkPatternFile.PatternAngleOffBoresight
Holds the data in the pattern file when the file is in the
"AngleOffBoresight" format.
|
static class |
StkPatternFile.PatternAzElMask
Holds the data in the pattern file when the file is in the
"AzElMask" format.
|
static class |
StkPatternFile.PatternReferencePlane
Holds the data in the pattern file when the file is in the
"ReferencePlane" format.
|
Constructor and Description |
---|
StkPatternFile()
Initializes a new instance.
|
Modifier and Type | Method and Description |
---|---|
CustomSensorPattern |
createCustomSensorPattern()
Creates a
CustomSensorPattern from the pattern data held by this instance in radians. |
StkPatternFile.Pattern |
getData()
Gets the pattern data.
|
Map<String,String> |
getProperties()
Gets a dictionary of key and value pairs in the STK pattern file.
|
Map<String,String> |
getPropertiesWithUnsupportedValues()
Gets a dictionary of property names and values for the properties with values specified in the file that
are not supported by the
StkPatternFile reader. |
Map<String,String> |
getUnsupportedProperties()
Gets a dictionary of property names and values for the properties that are contained in the file but that
are not supported by the
StkPatternFile reader. |
StkPatternFileVersion |
getVersion()
Gets the pattern file version.
|
static StkPatternFile |
readFrom(BufferedReader reader)
Reads an STK pattern (.pattern) file from a
BufferedReader . |
static StkPatternFile |
readFrom(BufferedReader reader,
StkPatternFileOptions readOptions)
Reads an STK pattern (.pattern) file from a
BufferedReader . |
static StkPatternFile |
readFrom(String fileName)
Reads an STK pattern (.pattern) file from a specified file.
|
static StkPatternFile |
readFrom(String fileName,
StkPatternFileOptions readOptions)
Reads an STK pattern (.pattern) file from a file.
|
void |
setData(StkPatternFile.Pattern value)
Sets the pattern data.
|
void |
setVersion(StkPatternFileVersion value)
Sets the pattern file version.
|
void |
writeTo(Writer writer)
Writes this instance to a
Writer in the STK pattern file (.pattern) format. |
@Nonnull public final CustomSensorPattern createCustomSensorPattern()
CustomSensorPattern
from the pattern data held by this instance in radians.CustomSensorPattern
.PropertyInvalidException
- Thrown when Data
(get
/ set
) is null
.@Nonnull public final StkPatternFileVersion getVersion()
public final void setVersion(@Nonnull StkPatternFileVersion value)
public final StkPatternFile.Pattern getData()
public final void setData(StkPatternFile.Pattern value)
@Nonnull public final Map<String,String> getProperties()
@Nonnull public final Map<String,String> getUnsupportedProperties()
StkPatternFile
reader. Any information contained in these properties
may not be captured by the reader.@Nonnull public final Map<String,String> getPropertiesWithUnsupportedValues()
StkPatternFile
reader. Any information contained in these
properties may not be captured by the reader.public final void writeTo(@Nonnull Writer writer)
Writer
in the STK pattern file (.pattern) format.
The Writer
can be a OutputStreamWriter
for writing to a file,
a StringWriter
for writing to a string, or any number of other types.writer
- The writer to which to write this instance.UnsupportedCaseException
- Thrown when the pattern file is in an unknown format.ArgumentNullException
- Thrown when writer
is null
.@Nonnull public static StkPatternFile readFrom(@Nonnull String fileName)
StkPatternFile.readFrom(BufferedReader,StkPatternFileOptions)
for detailed information.fileName
- The name of the file from which to read the pattern.StkPatternFile
instance containing the read pattern file.InvalidDataException
- Thrown when the STK pattern file is invalid, or it contains unsupported properties or property values.ArgumentNullException
- Thrown when fileName
is null
.@Nonnull public static StkPatternFile readFrom(@Nonnull String fileName, StkPatternFileOptions readOptions)
StkPatternFile.readFrom(BufferedReader,StkPatternFileOptions)
for detailed information.fileName
- The name of the file from which to read the pattern.readOptions
- An object containing any additional instructions for the read process.StkPatternFile
instance containing the read pattern file.InvalidDataException
- Thrown when the STK pattern file is invalid, or it contains unsupported properties or property values.ArgumentNullException
- Thrown when fileName
is null
.@Nonnull public static StkPatternFile readFrom(@Nonnull BufferedReader reader)
BufferedReader
. The
BufferedReader
can be a BufferedReader
for reading
from a file, a BufferedReader
for reading from a string,
or any number of other types. See the
documentation of StkPatternFile.readFrom(BufferedReader,StkPatternFileOptions)
for detailed information.reader
- The reader from which to read the pattern.StkPatternFile
instance containing the read pattern file.InvalidDataException
- Thrown when the STK pattern file is invalid, or it contains unsupported properties or property values.ArgumentNullException
- Thrown when reader
is null
.@Nonnull public static StkPatternFile readFrom(@Nonnull BufferedReader reader, StkPatternFileOptions readOptions)
BufferedReader
. The
BufferedReader
can be a BufferedReader
for reading
from a file, a BufferedReader
for reading from a string,
or any number of other types.
The STK pattern file format is a mix of well-defined, unambiguous properties, and fairly STK-specific properties that are difficult to interpret outside of the context of STK. As a result, this method should be considered a "best effort" that works well in most common cases, but that may have problems with certain pattern files.
By default, when this method does not understand a property or property value read from the file, it will
throw an InvalidDataException
describing the problem. You can attempt to read files with
unsupported properties or property values by setting the IgnoreUnsupportedProperties
(get
/ set
)
and IgnorePropertiesWithUnsupportedValues
(get
/ set
) properties of the
StkPatternFileOptions
passed to this method to true
.
With these properties set, unsupported properties and property values will be added to the
UnsupportedProperties
(get
) and PropertiesWithUnsupportedValues
(get
) dictionaries, respectively,
and the reader can make no guarantees that its results will match STK.
Here are the known limitations, compared to STK, when reading a pattern file using this method:
reader
- The reader from which to read the pattern.readOptions
- An object containing any additional instructions for the read process.StkPatternFile
instance containing the read pattern file.InvalidDataException
- Thrown when the STK pattern file is invalid, or it contains unsupported properties or property values.ArgumentNullException
- Thrown when reader
is null
.