lib/Models/SensorObservationServiceCatalogItem.js
function createColumnsFromMapping(item, tableStructure, identifiers) {
  var featureMapping = item._featureMapping;
  var addChartColumn = !defined(identifiers);
  if (!defined(identifiers)) {
    identifiers = Object.keys(featureMapping);
  }
  var rows = identifiers.map(identifier => featureMapping[identifier]);
  var columnOptions = { tableStructure: tableStructure };
  var chartColumnOptions = { tableStructure: tableStructure, id: "chart" }; // So the chart column can be referred to in the FeatureInfoTemplate as 'chart'.
  var result = [
    new TableColumn("type", rows.map(row => row.type), columnOptions),
    new TableColumn("name", rows.map(row => row.name), columnOptions),
    new TableColumn("id", rows.map(row => row.id), columnOptions),
    new TableColumn("lat", rows.map(row => row.lat), columnOptions),
    new TableColumn("lon", rows.map(row => row.lon), columnOptions)
  ];
  if (addChartColumn) {
    var procedure = getObjectCorrespondingToSelectedConcept(item, "procedures");
    var observableProperty = getObjectCorrespondingToSelectedConcept(
      item,
      "observableProperties"
    );
    var chartName = procedure.title || observableProperty.title || "chart";
    var chartId = procedure.title + "_" + observableProperty.title;
    var charts = rows.map(row =>
      getChartTagFromFeatureIdentifier(row.identifier, chartId)
    );
    result.push(
      new TableColumn(
        "identifier",
        rows.map(row => row.identifier),
        columnOptions
      ),
      new TableColumn(chartName, charts, chartColumnOptions)
    );
  }
  return result;
}
function createColumnsFromMapping(item, tableStructure, identifiers) {
  var featureMapping = item._featureMapping;
  var addChartColumn = !defined(identifiers);
  if (!defined(identifiers)) {
    identifiers = Object.keys(featureMapping);
  }
  var rows = identifiers.map(identifier => featureMapping[identifier]);
  var columnOptions = { tableStructure: tableStructure };
  var chartColumnOptions = { tableStructure: tableStructure, id: "chart" }; // So the chart column can be referred to in the FeatureInfoTemplate as 'chart'.
  var result = [
    new TableColumn("type", rows.map(row => row.type), columnOptions),
    new TableColumn("name", rows.map(row => row.name), columnOptions),
    new TableColumn("id", rows.map(row => row.id), columnOptions),
    new TableColumn("lat", rows.map(row => row.lat), columnOptions),
    new TableColumn("lon", rows.map(row => row.lon), columnOptions)
  ];
  if (addChartColumn) {
    var procedure = getObjectCorrespondingToSelectedConcept(item, "procedures");
    var observableProperty = getObjectCorrespondingToSelectedConcept(
      item,
      "observableProperties"
    );
    var chartName = procedure.title || observableProperty.title || "chart";
    var chartId = procedure.title + "_" + observableProperty.title;
    var charts = rows.map(row =>
      getChartTagFromFeatureIdentifier(row.identifier, chartId)
    );
    result.push(
      new TableColumn(
        "identifier",
        rows.map(row => row.identifier),
        columnOptions
      ),
      new TableColumn(chartName, charts, chartColumnOptions)
    );
  }
  return result;
}
function createColumnsFromMapping ( item , tableStructure , identifiers ) { var featureMapping = item . _featureMapping ; var addChartColumn = ! defined ( identifiers ) ; if ( ! defined ( identifiers ) ) { identifiers = Object . keys ( featureMapping ) ; } var rows = identifiers . map ( identifier => featureMapping [ identifier ] ) ; var columnOptions = { tableStructure : tableStructure } ; var chartColumnOptions = { tableStructure : tableStructure , id : "chart" } ; // So the chart column can be referred to in the FeatureInfoTemplate as 'chart'. var result = [ new TableColumn ( "type" , rows . map ( row => row . type ) , columnOptions ) , new TableColumn ( "name" , rows . map ( row => row . name ) , columnOptions ) , new TableColumn ( "id" , rows . map ( row => row . id ) , columnOptions ) , new TableColumn ( "lat" , rows . map ( row => row . lat ) , columnOptions ) , new TableColumn ( "lon" , rows . map ( row => row . lon ) , columnOptions ) ] ; if ( addChartColumn ) { var procedure = getObjectCorrespondingToSelectedConcept ( item , "procedures" ) ; var observableProperty = getObjectCorrespondingToSelectedConcept ( item , "observableProperties" ) ; var chartName = procedure . title || observableProperty . title || "chart" ; var chartId = procedure . title + "_" + observableProperty . title ; var charts = rows . map ( row => getChartTagFromFeatureIdentifier ( row . identifier , chartId ) ) ; result . push ( new TableColumn ( "identifier" , rows . map ( row => row . identifier ) , columnOptions ) , new TableColumn ( chartName , charts , chartColumnOptions ) ) ; } return result ; }
Converts the featureMapping output by createMappingFromFeatureMembers into columns for a TableStructure.
@param  {SensorObservationServiceCatalogItem} item This catalog item.
@param  {TableStructure} [tableStructure] Used to set the columns' tableStructure (parent). If identifiers given, output columns line up with them.
@param  {String[]} identifiers An array of identifier values from tableStructure. Defaults to all available identifiers.
@return {TableColumn[]} An array of columns to add to observationTableStructure. Only include 'identifier' and 'chart' columns if no identifiers provided.
@private
Converts the featureMapping output by createMappingFromFeatureMembers into columns for a TableStructure .