# HG changeset patch # User Chris Cannam # Date 1498810032 -3600 # Node ID 9251232b689e0867d35d58671502e83077f909cf # Parent b69a223166b52e8ba5098b73d845ba95f0673518 Bring through (but don't yet use) bin names from output descriptor diff -r b69a223166b5 -r 9251232b689e src/app/analysis-item/analysis-item.component.html --- a/src/app/analysis-item/analysis-item.component.html Thu Jun 29 15:06:16 2017 +0100 +++ b/src/app/analysis-item/analysis-item.component.html Fri Jun 30 09:07:12 2017 +0100 @@ -78,10 +78,8 @@ [duration]="getDuration()" > - - + -
Feature cannot be visualised.
diff -r b69a223166b5 -r 9251232b689e src/app/visualisations/FeatureUtilities.ts --- a/src/app/visualisations/FeatureUtilities.ts Thu Jun 29 15:06:16 2017 +0100 +++ b/src/app/visualisations/FeatureUtilities.ts Fri Jun 30 09:07:12 2017 +0100 @@ -74,9 +74,13 @@ type ShapeDeducedFromList = 'instants' | 'notes'; export type HigherLevelFeatureShape = CollectedShape | ShapeDeducedFromList; +export interface AugmentedMatrixFeature extends MatrixFeature { + binNames: string[]; +} + export type ShapedFeatureData = VectorFeature - | MatrixFeature + | AugmentedMatrixFeature | TracksFeature | Note[] | Instant[]; @@ -89,7 +93,7 @@ } export class Vector extends ShapedFeature<'vector', VectorFeature> {} -export class Matrix extends ShapedFeature<'matrix', MatrixFeature> {} +export class Matrix extends ShapedFeature<'matrix', AugmentedMatrixFeature> {} export class Tracks extends ShapedFeature<'tracks', TracksFeature> {} export class Notes extends ShapedFeature<'notes', Note[]> {} export class Instants extends ShapedFeature<'instants', Instant[]> {} @@ -148,7 +152,12 @@ case 'vector': return response.features as Vector; case 'matrix': - return response.features as Matrix; + return { + shape: deducedShape, + collected: Object.assign(response.features.collected, { + binNames: response.outputDescriptor.configured.binNames || [] + }) + } as Matrix; case 'tracks': return response.features as Tracks; case 'notes': diff -r b69a223166b5 -r 9251232b689e src/app/visualisations/grid/grid.component.ts --- a/src/app/visualisations/grid/grid.component.ts Thu Jun 29 15:06:16 2017 +0100 +++ b/src/app/visualisations/grid/grid.component.ts Fri Jun 30 09:07:12 2017 +0100 @@ -15,7 +15,7 @@ Input, } from '@angular/core'; import Waves from 'waves-ui-piper'; -import {MatrixFeature} from 'piper/HigherLevelUtilities'; +import {AugmentedMatrixFeature} from '../FeatureUtilities'; import {iceMapper} from '../../spectrogram/ColourMap'; import {estimatePercentile} from '../../spectrogram/MatrixUtils'; @@ -27,13 +27,13 @@ providers: [ {provide: VerticallyBounded, useExisting: GridComponent }, {provide: VerticalScaleRenderer, useExisting: GridComponent }, - {provide: VerticalValueInspectorRenderer, useExisting: GridComponent }, {provide: WavesComponent, useExisting: GridComponent} ] }) -export class GridComponent extends VerticallyBoundedWavesComponent { - @Input() set grid(grid: MatrixFeature) { +export class GridComponent extends VerticallyBoundedWavesComponent { + + @Input() set grid(grid: AugmentedMatrixFeature) { this.feature = grid; } @@ -68,6 +68,10 @@ } get range(): [number, number] { + + const bins = this.feature.binNames; + console.log("have " + bins.length + " bins"); + return [0, this.feature.data.length > 0 ? this.feature.data[0].length : 0]; } }