lib/Models/RegionMapping.js
function calculateRegionIndices(
  regionMapping,
  time,
  failedMatches,
  ambiguousMatches
) {
  // As described in load, currently we only use the first possible region column.
  var regionDetail = regionMapping._regionDetails[0];
  var tableStructure = regionMapping._tableStructure;
  var regionColumn = tableStructure.getColumnWithNameIdOrIndex(
    regionDetail.columnName
  );
  if (!defined(regionColumn)) {
    return;
  }
  var regionColumnValues = regionColumn.values;
  // Wipe out the region names from the rows that do not apply at this time, if there is a time column.
  var timeColumn = tableStructure.activeTimeColumn;
  var disambigColumn = defined(regionDetail.disambigColumnName)
    ? tableStructure.getColumnWithNameIdOrIndex(regionDetail.disambigColumnName)
    : undefined;
  // regionIndices will be an array the same length as regionProvider.regions, giving the index of each region into the table.
  var regionIndices = regionDetail.regionProvider.mapRegionsToIndicesInto(
    regionColumnValues,
    disambigColumn && disambigColumn.values,
    failedMatches,
    ambiguousMatches,
    defined(timeColumn) ? timeColumn.timeIntervals : undefined,
    time
  );
  return regionIndices;
}
function calculateRegionIndices(
  regionMapping,
  time,
  failedMatches,
  ambiguousMatches
) {
  // As described in load, currently we only use the first possible region column.
  var regionDetail = regionMapping._regionDetails[0];
  var tableStructure = regionMapping._tableStructure;
  var regionColumn = tableStructure.getColumnWithNameIdOrIndex(
    regionDetail.columnName
  );
  if (!defined(regionColumn)) {
    return;
  }
  var regionColumnValues = regionColumn.values;
  // Wipe out the region names from the rows that do not apply at this time, if there is a time column.
  var timeColumn = tableStructure.activeTimeColumn;
  var disambigColumn = defined(regionDetail.disambigColumnName)
    ? tableStructure.getColumnWithNameIdOrIndex(regionDetail.disambigColumnName)
    : undefined;
  // regionIndices will be an array the same length as regionProvider.regions, giving the index of each region into the table.
  var regionIndices = regionDetail.regionProvider.mapRegionsToIndicesInto(
    regionColumnValues,
    disambigColumn && disambigColumn.values,
    failedMatches,
    ambiguousMatches,
    defined(timeColumn) ? timeColumn.timeIntervals : undefined,
    time
  );
  return regionIndices;
}
function calculateRegionIndices ( regionMapping , time , failedMatches , ambiguousMatches ) { // As described in load, currently we only use the first possible region column. var regionDetail = regionMapping . _regionDetails [ 0 ] ; var tableStructure = regionMapping . _tableStructure ; var regionColumn = tableStructure . getColumnWithNameIdOrIndex ( regionDetail . columnName ) ; if ( ! defined ( regionColumn ) ) { return ; } var regionColumnValues = regionColumn . values ; // Wipe out the region names from the rows that do not apply at this time, if there is a time column. var timeColumn = tableStructure . activeTimeColumn ; var disambigColumn = defined ( regionDetail . disambigColumnName ) ? tableStructure . getColumnWithNameIdOrIndex ( regionDetail . disambigColumnName ) : undefined ; // regionIndices will be an array the same length as regionProvider.regions, giving the index of each region into the table. var regionIndices = regionDetail . regionProvider . mapRegionsToIndicesInto ( regionColumnValues , disambigColumn && disambigColumn . values , failedMatches , ambiguousMatches , defined ( timeColumn ) ? timeColumn . timeIntervals : undefined , time ) ; return regionIndices ; }
Returns an array the same length as regionProvider.regions, mapping each region into the relevant index into the table data source.
Takes the current time into account if a time is provided, and there is a time column with timeIntervals defined.
@private
@param {RegionMapping} regionMapping The table data source.
@param {JulianDate} [time] The current time, eg. terria.clock.currentTime. NOT the time column's ._clock's time, which is different (and comes from a DataSourceClock).
@param {Array} [failedMatches] An optional empty array. If provided, indices of failed matches are appended to the array.
@param {Array} [ambiguousMatches] An optional empty array. If provided, indices of matches which duplicate prior matches are appended to the array.
@return {Array} An array the same length as regionProvider.regions, mapping each region into the relevant index into the table data source.
Returns an array the same length as regionProvider . regions mapping each region into the relevant index into the table data source . Takes the current time into account if a time is provided and there is a time column with timeIntervals defined .