Mercurial > hg > ugly-duckling
comparison src/app/visualisations/grid/grid.component.ts @ 477:e3cbf4c53e5e
Rename type and make it an abstract class to stop angular-cli complaining (I still don't understand this).
author | Lucas Thompson <dev@lucas.im> |
---|---|
date | Fri, 30 Jun 2017 16:25:58 +0100 |
parents | f2b62195a5a6 |
children | 64ed45a0bad3 |
comparison
equal
deleted
inserted
replaced
476:eacf505f7e1f | 477:e3cbf4c53e5e |
---|---|
3 */ | 3 */ |
4 import { | 4 import { |
5 VerticallyBinned, | 5 VerticallyBinned, |
6 VerticallyBinnedWavesComponent, | 6 VerticallyBinnedWavesComponent, |
7 VerticalBinNameRenderer, | 7 VerticalBinNameRenderer, |
8 VerticalValueInspectorRenderer, | |
9 WavesComponent | 8 WavesComponent |
10 } from '../waves-base.component'; | 9 } from '../waves-base.component'; |
11 import { | 10 import { |
12 ChangeDetectionStrategy, | 11 ChangeDetectionStrategy, |
13 Component, | 12 Component, |
14 Input, | 13 Input, |
15 } from '@angular/core'; | 14 } from '@angular/core'; |
16 import Waves from 'waves-ui-piper'; | 15 import Waves from 'waves-ui-piper'; |
17 import {AugmentedMatrixFeature} from '../FeatureUtilities'; | 16 import {Grid} from '../FeatureUtilities'; |
18 import {iceMapper} from '../../spectrogram/ColourMap'; | 17 import {iceMapper} from '../../spectrogram/ColourMap'; |
19 import {estimatePercentile} from '../../spectrogram/MatrixUtils'; | 18 import {estimatePercentile} from '../../spectrogram/MatrixUtils'; |
20 | 19 |
21 @Component({ | 20 @Component({ |
22 selector: 'ugly-grid', | 21 selector: 'ugly-grid', |
28 {provide: VerticalBinNameRenderer, useExisting: GridComponent }, | 27 {provide: VerticalBinNameRenderer, useExisting: GridComponent }, |
29 {provide: WavesComponent, useExisting: GridComponent} | 28 {provide: WavesComponent, useExisting: GridComponent} |
30 ] | 29 ] |
31 }) | 30 }) |
32 | 31 |
33 export class GridComponent extends VerticallyBinnedWavesComponent<AugmentedMatrixFeature> { | 32 export class GridComponent extends VerticallyBinnedWavesComponent<Grid> { |
34 | 33 |
35 @Input() set grid(grid: AugmentedMatrixFeature) { | 34 @Input() set grid(grid: Grid) { |
36 this.feature = grid; | 35 this.feature = grid; |
37 } | 36 } |
38 | 37 |
39 protected get featureLayers(): Layer[] { | 38 protected get featureLayers(): Layer[] { |
40 const startTime = this.feature.startTime; | 39 const startTime = this.feature.startTime; |
63 mapper: iceMapper() | 62 mapper: iceMapper() |
64 } | 63 } |
65 ) | 64 ) |
66 ]; | 65 ]; |
67 } | 66 } |
68 | 67 |
69 get binNames(): string[] { | 68 get binNames(): string[] { |
70 if (!this.feature.binNames || this.feature.binNames.length === 0) { | 69 if (!this.feature.binNames || this.feature.binNames.length === 0) { |
71 const binCount = (this.feature.data.length > 0 ? | 70 const binCount = (this.feature.data.length > 0 ? |
72 this.feature.data[0].length : 0); | 71 this.feature.data[0].length : 0); |
73 for (let i = 0; i < binCount; ++i) { | 72 for (let i = 0; i < binCount; ++i) { |
74 this.feature.binNames.push("" + (i + 1)); | 73 this.feature.binNames.push(`${i + 1}`); |
75 } | 74 } |
76 } | 75 } |
77 return this.feature.binNames; | 76 return this.feature.binNames; |
78 } | 77 } |
79 } | 78 } |