private void extractFromStationFeatures ( ) throws Exception { int stationIdIndex = - 1 ; int stationElevIndex = - 1 ; pm . beginTask ( "Filling the elevation and id arrays for the stations, ordering them in ascending elevation order." , stationCoordinates . size ( ) ) ; for ( int i = 0 ; i < stationCoordinates . size ( ) ; i ++ ) { pm . worked ( 1 ) ; SimpleFeature stationF = stationFeatures . get ( i ) ; Coordinate stationCoord = stationCoordinates . get ( i ) ; if ( stationIdIndex == - 1 ) { SimpleFeatureType featureType = stationF . getFeatureType ( ) ; stationIdIndex = featureType . indexOf ( fStationid ) ; stationElevIndex = featureType . indexOf ( fStationelev ) ; if ( stationIdIndex == - 1 ) { throw new IllegalArgumentException ( "Could not find the field: " + fStationid ) ; } if ( stationElevIndex == - 1 ) { throw new IllegalArgumentException ( "Could not find the field: " + fStationelev ) ; } } int id = ( ( Number ) stationF . getAttribute ( stationIdIndex ) ) . intValue ( ) ; double elev = ( ( Number ) stationF . getAttribute ( stationElevIndex ) ) . doubleValue ( ) ; statElev [ i ] = elev ; statId [ i ] = id ; stationId2CoordinateMap . put ( id , stationCoord ) ; } pm . done ( ) ; // sort QuickSortAlgorithm qsA = new QuickSortAlgorithm ( pm ) ; qsA . sort ( statElev , statId ) ; }
Fills the elevation and id arrays for the stations ordering in ascending elevation order .