* (non-Javadoc)
* @see org.mcisb.pedro.beacon.ResultsParser#getTimeSeriesRecordModel()
*/
protected RecordModel getTimeSeriesRecordModel()
{
final RecordModel timeSeriesRecordModel = recordModelFactory.createRecordModel( "ResultTimeSeries" ); //$NON-NLS-1$
// Get the actual results timeseries
final Element timeSeriesElement = XmlUtils.getFirstElement( root, "ResultTimeSeries" ); //$NON-NLS-1$
if( timeSeriesElement != null )
{
final NodeList resultStates = timeSeriesElement.getElementsByTagName( "ResultState" ); //$NON-NLS-1$
for( int i = 0; i < resultStates.getLength(); i++ )
{
final Element resultStateElement = (Element)resultStates.item( i );
final RecordModel resultStateRecordModel = recordModelFactory.createRecordModel("ResultState"); //$NON-NLS-1$
pedroUtils.addElement( resultStateElement, resultStateRecordModel, "TimeStamp" ); //$NON-NLS-1$
// Cells at this Timestamp
final NodeList cells = resultStateElement.getElementsByTagName( "Cell" ); //$NON-NLS-1$
for( int j = 0; j < cells.getLength(); j++ )
{
final Element cellElement = (Element)cells.item( j );
final RecordModel cellRecordModel = recordModelFactory.createRecordModel( "Cell" ); //$NON-NLS-1$
pedroUtils.addElement( cellElement, cellRecordModel, "name" ); //$NON-NLS-1$
// Cellular compartments
final NodeList cellularCompartments = cellElement.getElementsByTagName( "CellularCompartment" ); //$NON-NLS-1$
for( int k = 0; k < cellularCompartments.getLength(); k++ )
{
final Element cellularCompartmentElement = (Element)cellularCompartments.item( k );
final RecordModel cellularCompartmentRecordModel = recordModelFactory.createRecordModel( "CellularCompartment" ); //$NON-NLS-1$
pedroUtils.addElement( cellularCompartmentElement, cellularCompartmentRecordModel, "name" ); //$NON-NLS-1$
pedroUtils.addElement( cellularCompartmentElement, cellularCompartmentRecordModel, "Centroid" ); //$NON-NLS-1$
// Cell Properties
final NodeList cellProperties = cellElement.getElementsByTagName( "CellProperty" ); //$NON-NLS-1$
if( cellProperties != null )
{
for( int l = 0; l < cellProperties.getLength(); l++ )
{
final Element cellPropertyElement = (Element)cellProperties.item(l);
final RecordModel cellPropertyRecordModel = recordModelFactory.createRecordModel( "CellProperty" ); //$NON-NLS-1$
pedroUtils.addElement( cellPropertyElement, cellPropertyRecordModel, "property_name" ); //$NON-NLS-1$
pedroUtils.addElements( cellPropertyElement, cellPropertyRecordModel, recordModelFactory, "Channel", Arrays.asList( new String[] { "channel_name", "channel_intensity" } ) ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
cellularCompartmentRecordModel.addChild( "CellProperty", cellPropertyRecordModel, false ); //$NON-NLS-1$
cellularCompartmentRecordModel.updateDisplayName();
}
}
// Polygon
final Element polygon = XmlUtils.getFirstElement( cellularCompartmentElement, "Polygon" ); //$NON-NLS-1$
if( polygon != null )
{
final Element exteriorElement = XmlUtils.getFirstElement( polygon, "exterior" ); //$NON-NLS-1$
final Element linearRingElement = XmlUtils.getFirstElement( exteriorElement, "LinearRing" ); //$NON-NLS-1$
final RecordModel linearRingRecordModel = recordModelFactory.createRecordModel( "LinearRing" ); //$NON-NLS-1$
pedroUtils.addElement( linearRingElement, linearRingRecordModel, "coordinates" ); //$NON-NLS-1$
final RecordModel exteriorRecordModel = recordModelFactory.createRecordModel( "exterior" ); //$NON-NLS-1$
exteriorRecordModel.addChild( "LinearRing", linearRingRecordModel, false ); //$NON-NLS-1$
final RecordModel polygonRecordModel = recordModelFactory.createRecordModel( "Polygon" ); //$NON-NLS-1$
polygonRecordModel.addChild( "exterior", exteriorRecordModel, false ); //$NON-NLS-1$
cellularCompartmentRecordModel.addChild( "Polygon", polygonRecordModel, false ); //$NON-NLS-1$
}
cellRecordModel.addChild( "CellularCompartment", cellularCompartmentRecordModel, false ); //$NON-NLS-1$