public class SWEHelper extends SWEFactory
Helper class for creating common data structures and encodings and browsing a data component tree.
newEncodedValuesProperty
Modifier and Type | Field and Description |
---|---|
static String |
PATH_SEPARATOR |
Constructor and Description |
---|
SWEHelper() |
Modifier and Type | Method and Description |
---|---|
static void |
assignBinaryEncoding(DataComponent dataComponents,
BinaryEncoding encoding)
Assigns binary components and blocks definitions to the actual data component.
|
static DataStreamParser |
createDataParser(DataEncoding encoding)
Helper method to instantiate the proper parser for the given encoding
|
static DataStreamWriter |
createDataWriter(DataEncoding encoding)
Helper method to instantiate the proper writer for the given encoding
|
static DataEncoding |
ensureXmlCompatible(DataEncoding encoding)
Ajusts encoding settings to ensures that data produced with the encoding
can be embedded in XML (e.g.
|
static DataComponent |
findComponent(DataComponent parent,
IComponentFilter filter)
Finds the first component in the tree matching the given filter
|
static DataComponent |
findComponentByDefinition(DataComponent parent,
String defUri)
Finds a component in the component tree using its definition
|
static DataComponent |
findComponentByName(DataComponent parent,
String name)
Finds a component in the component tree using its name (property name)
|
static DataComponent |
findComponentByPath(DataComponent parent,
String path)
Finds a component in a component tree using a path
|
static DataComponent |
findComponentByPath(DataComponent parent,
String[] path)
Finds a component in a component tree using a path
|
static BinaryEncoding |
getDefaultBinaryEncoding(DataComponent dataComponents)
Get default binary encoding for the given component tree.
Data types used will be ones specified in each scalar component. |
static DataEncoding |
getDefaultEncoding(DataComponent dataComponents)
Gets the default encoding for the given data structure.
This uses BinaryEncoding if data structure contains a large array and TextEncoding otherwise. |
static String |
getEpsgUri(int epsgCode) |
static String |
getPropertyUri(String propName) |
static ScalarIndexer |
getTimeStampIndexer(DataComponent parent)
Retrieves an indexer for the first time stamp component found in the parent structure
|
DataArray |
newArray(Count sizeComponent,
String eltName,
DataComponent elementType)
Creates a variable size 1D array
|
BinaryEncoding |
newBinaryEncoding(ByteOrder byteOrder,
ByteEncoding byteEncoding)
Creates a binary encoding with the specified options
|
Boolean |
newBoolean(String definition,
String label,
String description)
Creates a new boolean component
|
Category |
newCategory(String definition,
String label,
String description,
String codeSpace)
Creates a new category component
|
Count |
newCount(String definition,
String label,
String description)
Creates a new count (integer) component
|
Count |
newCount(String definition,
String label,
String description,
DataType dataType)
Creates a new count (integer) component
|
DataStream |
newDataStream(DataComponent dataDescription,
DataEncoding dataEncoding)
Creates a data stream description with given description and encoding
|
static OgcProperty<?> |
newLinkProperty(String href) |
static OgcProperty<?> |
newLinkProperty(String name,
String href) |
static OgcProperty<?> |
newLinkProperty(String name,
String href,
String role) |
Quantity |
newQuantity(String definition,
String label,
String description,
String uomCode)
Creates a new quantity (decimal) component with default data type
|
Quantity |
newQuantity(String definition,
String label,
String description,
String uomCode,
DataType dataType)
Creates a new quantity (decimal) component
|
DataArray |
newRgbImage(int width,
int height,
DataType dataType)
Creates a fixed size 2D-array component representing an RGB image
|
Text |
newSystemIdComponent()
Creates a component for carrying system ID (e.g.
|
Text |
newText(String definition,
String label,
String description)
Creates a new Text component
|
TextEncoding |
newTextEncoding(String tokenSep,
String blockSep)
Creates a text encoding with the specified separators.
Since no escaping is supported, it is up to the programmer to make sure that separator characters are not present within the encoded data. |
Time |
newTimeStamp(String uom,
boolean isUomCode,
String timeRef)
Creates a new sampling time component
|
Time |
newTimeStampIsoGPS()
Creates a new sampling time component with ISO calendar and UTC time frame
|
Time |
newTimeStampIsoUTC()
Creates a new sampling time component with ISO calendar and UTC time frame
|
Time |
newTimeStampOnBoardClock(String uomCode,
String timeRef)
Creates a new sampling time component
|
Vector |
newVector(String def,
String crs,
String[] names,
String[] labels,
String[] uoms,
String[] axes)
Creates a 3D vector component with the specified CRS and axes
|
DataRecord |
wrapWithTimeStamp(Time timeStamp,
DataComponent... subComponents)
Wraps the given component(s) into a record with a time stamp
|
DataRecord |
wrapWithTimeStampUTC(DataComponent... subComponents)
Wraps the given component(s) into a record with a UTC ISO time stamp
|
newAllowedTimes, newAllowedTokens, newAllowedValues, newBinaryBlock, newBinaryComponent, newBinaryEncoding, newBoolean, newCategory, newCategoryRange, newCount, newCount, newCountRange, newCountRange, newDataArray, newDataArray, newDataChoice, newDataRecord, newDataRecord, newDataStream, newEncodedValuesProperty, newMatrix, newMatrix, newNilValue, newNilValues, newQuantity, newQuantity, newQuantityRange, newQuantityRange, newText, newTextEncoding, newTime, newTime, newTimeRange, newTimeRange, newUnitReference, newVector, newXMLEncoding
public static final String PATH_SEPARATOR
public static String getEpsgUri(int epsgCode)
epsgCode
- public static OgcProperty<?> newLinkProperty(String href)
public static OgcProperty<?> newLinkProperty(String name, String href)
public static OgcProperty<?> newLinkProperty(String name, String href, String role)
public Boolean newBoolean(String definition, String label, String description)
definition
- URI pointing to semantic definition of component in a dictionarylabel
- short human readable label identifying the component (shown in UI)description
- textual description of this component (can be long)public Text newText(String definition, String label, String description)
definition
- URI pointing to semantic definition of component in a dictionarylabel
- short human readable label identifying the component (shown in UI)description
- textual description of this component (can be long)public Count newCount(String definition, String label, String description, DataType dataType)
definition
- URI pointing to semantic definition of component in a dictionarylabel
- short human readable label identifying the component (shown in UI)description
- textual description of this component (can be long)dataType
- data type to use for this component (if null, DataType.INT
will be used)public Count newCount(String definition, String label, String description)
definition
- URI pointing to semantic definition of component in a dictionarylabel
- short human readable label identifying the component (shown in UI)description
- textual description of this component (can be long)public Category newCategory(String definition, String label, String description, String codeSpace)
definition
- URI pointing to semantic definition of component in a dictionarylabel
- short human readable label identifying the component (shown in UI)description
- textual description of this component (can be long) or nullcodeSpace
- URI of this category code spacepublic Quantity newQuantity(String definition, String label, String description, String uomCode, DataType dataType)
definition
- URI pointing to semantic definition of component in a dictionarylabel
- short human readable label identifying the component (shown in UI)description
- textual description of this component (can be long) or nulluomCode
- UCUM code for this decimal quantity's unit of measuredataType
- data type to use for this component (if null, DataType.DOUBLE
will be used)public Quantity newQuantity(String definition, String label, String description, String uomCode)
definition
- URI pointing to semantic definition of component in a dictionarylabel
- short human readable label identifying the component (shown in UI)description
- textual description of this component (can be long) or nulluomCode
- UCUM code for this decimal quantity's unit of measurepublic Time newTimeStamp(String uom, boolean isUomCode, String timeRef)
uom
- unit of time stampisUomCode
- true if uom is a UCUM code, false if it is a URItimeRef
- URI of temporal reference frame for this time stamppublic Time newTimeStampIsoUTC()
public Time newTimeStampIsoGPS()
public Time newTimeStampOnBoardClock(String uomCode, String timeRef)
uomCode
- time unit used for this onboard time stamp (e.g. 's', 'ms', 'ns', etc.)timeRef
- URI of temporal reference frame for this time stamp (e.g. missionStart, etc.)public DataRecord wrapWithTimeStamp(Time timeStamp, DataComponent... subComponents)
timeStamp
- Time component representing the time stampsubComponents
- list of components to wrap with the time stamppublic DataRecord wrapWithTimeStampUTC(DataComponent... subComponents)
subComponents
- list of components to wrappublic Text newSystemIdComponent()
public Vector newVector(String def, String crs, String[] names, String[] labels, String[] uoms, String[] axes)
def
- definition of the whole vectorcrs
- reference frame of the vectornames
- array containing name of each individual vector elementlabels
- array containing label of each individual vector elementuoms
- array containing unit of measure of each individual vector elementaxes
- array containing axis name of each individual vector elementpublic DataArray newArray(Count sizeComponent, String eltName, DataComponent elementType)
sizeComponent
- eltName
- elementType
- public DataArray newRgbImage(int width, int height, DataType dataType)
width
- height
- dataType
- public DataStream newDataStream(DataComponent dataDescription, DataEncoding dataEncoding)
dataDescription
- description of each stream elementdataEncoding
- data encoding specpublic TextEncoding newTextEncoding(String tokenSep, String blockSep)
tokenSep
- separator used between tokensblockSep
- separator used to delimit complete tuplespublic BinaryEncoding newBinaryEncoding(ByteOrder byteOrder, ByteEncoding byteEncoding)
byteOrder
- byte ordering (endianness) of the byte streambyteEncoding
- byte encoding used (raw or base64)public static DataStreamParser createDataParser(DataEncoding encoding)
encoding
- public static DataStreamWriter createDataWriter(DataEncoding encoding)
encoding
- public static DataEncoding getDefaultEncoding(DataComponent dataComponents)
dataComponents
- public static BinaryEncoding getDefaultBinaryEncoding(DataComponent dataComponents)
dataComponents
- component whose children will be mapped to encoding optionspublic static DataEncoding ensureXmlCompatible(DataEncoding encoding)
encoding
- public static void assignBinaryEncoding(DataComponent dataComponents, BinaryEncoding encoding) throws CDMException
dataComponents
- encoding
- CDMException
public static DataComponent findComponent(DataComponent parent, IComponentFilter filter)
parent
- component from which to start the searchfilter
- component filter instance (must not be null)public static DataComponent findComponentByName(DataComponent parent, String name)
parent
- component from which to start the searchname
- component name to look forpublic static DataComponent findComponentByDefinition(DataComponent parent, String defUri)
parent
- component from which to start the searchdefUri
- definition URI to look forpublic static DataComponent findComponentByPath(DataComponent parent, String path) throws CDMException
parent
- component from which to start the searchpath
- desired path as a String composed of component names separated by "/" charactersCDMException
- if the specified path is incorrectpublic static DataComponent findComponentByPath(DataComponent parent, String[] path) throws CDMException
parent
- component from which to start the searchpath
- desired path as a String array cotnaining a sequence of component namesCDMException
- if the specified path is incorrectpublic static ScalarIndexer getTimeStampIndexer(DataComponent parent)
parent
- Copyright © 2016 Sensia Software LLC. All rights reserved.