now use statistics if available in band.
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Mark van der Wal 2020-07-28 19:05:38 +02:00
parent e6cda406c9
commit f014dc9f93
9 changed files with 115 additions and 26 deletions

View File

@ -67,6 +67,8 @@ import { ForSourceTask} from './components/for-item/for-sourcetask.decorator';
import { ForPackage } from './components/for-item/for-package.decorator';
import { PanToLocation} from './components/aol/pan-to-location/pan-to-location.component';
import {LayerSwitcher} from './components/layer-switcher/layer-switcher.component';
import {HistogramDetailsComponent} from './components/legend/histogram-details/histogram-details.component';
import {StatisticsDetailsComponent} from './components/legend/statistics-details/statistics-details.component';
export function LocalStorageSync(reducer: ActionReducer<any>): ActionReducer<any> {
const r = function(state, action) {
@ -195,7 +197,9 @@ export {
WidgetStatusComponent,
GpsLocation,
PanToLocation,
LayerSwitcher
LayerSwitcher,
HistogramDetailsComponent,
StatisticsDetailsComponent
],
entryComponents: [
FeatureListComponent,

View File

@ -0,0 +1,15 @@
<div class="row pl-3">
<div class="col-8 nopadding" i18n>Average<span>:</span></div>
<div class="col-4 pull-left nopadding">{{histogram.mean| number:'1.0-2'}}</div>
<div class="col-8 nopadding" i18n>Standard deviation<span>:</span></div>
<div class="col-4 pull-left nopadding">{{histogram.stddev| number:'1.0-2'}}</div>
<div class="col-8 nopadding" i18n>Min<span>:</span></div>
<div class="col-4 pull-left nopadding">{{histogram.min| number:'1.0-2'}}</div>
<div class="col-8 nopadding" i18n>Max<span>:</span></div>
<div class="col-4 pull-left nopadding">{{histogram.max| number:'1.0-2'}}</div>
<ng-container *ngIf="showConfidenceInterval()">
<div class="col-8 nopadding" i18n>Confidence interval<span>:</span></div>
<div class="col-4 pull-left nopadding">{{histogram.confidence * 100| number:'1.0-0'}}%</div>
</ng-container>
</div>

View File

@ -0,0 +1,20 @@
import {Component, Input} from '@angular/core';
import {IHistogram, ILayer} from '../../../models/color.map';
@Component({
selector: 'fm-map-histogram-details',
templateUrl: './histogram-details.component.html',
styles: ['.nopadding{\n' +
' padding: 0 !important;\n' +
' margin: 0 !important;\n' +
'}']
})
export class HistogramDetailsComponent {
@Input()
histogram: IHistogram;
showConfidenceInterval(): boolean {
return this.histogram.confidence != null && this.histogram.confidence !== 1;
}
}

View File

@ -30,21 +30,11 @@
<tr *ngIf="showHistogram()">
<td colspan="4" class="pb-1 pt-1">
<div class="info" [ngbCollapse]="hideHistogramDetails">
<div class="row pl-3">
<div class="col-8 nopadding" i18n>Average<span>:</span></div>
<div class="col-4 pull-left nopadding">{{layer.renderer.band.histogram.mean| number:'1.0-2'}}</div>
<div class="col-8 nopadding" i18n>Standard deviation<span>:</span></div>
<div class="col-4 pull-left nopadding">{{layer.renderer.band.histogram.stddev| number:'1.0-2'}}</div>
<div class="col-8 nopadding" i18n>Min<span>:</span></div>
<div class="col-4 pull-left nopadding">{{layer.renderer.band.histogram.min| number:'1.0-2'}}</div>
<div class="col-8 nopadding" i18n>Max<span>:</span></div>
<div class="col-4 pull-left nopadding">{{layer.renderer.band.histogram.max| number:'1.0-2'}}</div>
<ng-container *ngIf="showConfidenceInterval()">
<div class="col-8 nopadding" i18n>Confidence interval<span>:</span></div>
<div class="col-4 pull-left nopadding">{{layer.renderer.band.histogram.confidence * 100| number:'1.0-0'}}%</div>
</ng-container>
</div>
<fm-map-histogram-details *ngIf="bandContainsHistogram(); else statistics"
[histogram]="layer.renderer.band.histogram"></fm-map-histogram-details>
<ng-template #statistics>
<fm-map-statistics-details [statistics]="layer.renderer.band.statistics"></fm-map-statistics-details>
</ng-template>
</div>
</td>
</tr>

View File

@ -16,11 +16,6 @@
margin-bottom: 0;
}
.nopadding{
padding: 0 !important;
margin: 0 !important;
}
span.color {
display:inline-block;
width: 1.5em;

View File

@ -88,8 +88,8 @@ export class LegendComponent implements OnInit,AfterViewInit {
return this.histogramenabled && this.layer.renderer.band.histogram.entries && this.layer.renderer.band.histogram.entries.length > 0 && this.layer.renderer.colorMap.colormapType == "minmax";
}
showConfidenceInterval():boolean {
return this.histogramenabled && this.layer.renderer.band.histogram.confidence != null && this.layer.renderer.band.histogram.confidence != 1;
bandContainsHistogram(): boolean {
return this.layer.renderer.band.histogram != null;
}
}

View File

@ -0,0 +1,32 @@
<div class="row pl-3">
<div class="col-8 nopadding" i18n>Population count<span>:</span></div>
<div class="col-4 pull-left nopadding">{{statistics.populationCount| number:'1.0-0'}}</div>
<div class="col-8 nopadding" i18n>Min<span>:</span></div>
<div class="col-4 pull-left nopadding">{{statistics.min| number:'1.0-2'}}</div>
<div class="col-8 nopadding" i18n>Max<span>:</span></div>
<div class="col-4 pull-left nopadding">{{statistics.max| number:'1.0-2'}}</div>
<div class="col-8 nopadding" i18n>Min plus<span>:</span></div>
<div class="col-4 pull-left nopadding">{{statistics.minPlus| number:'1.0-2'}}</div>
<div class="col-8 nopadding" i18n>Max minus<span>:</span></div>
<div class="col-4 pull-left nopadding">{{statistics.maxMinus| number:'1.0-2'}}</div>
<div class="col-8 nopadding" i18n>Average<span>:</span></div>
<div class="col-4 pull-left nopadding">{{statistics.mean| number:'1.0-2'}}</div>
<div class="col-8 nopadding" i18n>Standard deviation<span>:</span></div>
<div class="col-4 pull-left nopadding">{{statistics.stddev| number:'1.0-2'}}</div>
<div class="col-8 nopadding" i18n>Mode<span>:</span></div>
<div class="col-4 pull-left nopadding">{{statistics.mode| number:'1.0-2'}}</div>
<div class="col-8 nopadding" i18n>Median<span>:</span></div>
<div class="col-4 pull-left nopadding">{{statistics.median| number:'1.0-2'}}</div>
<div class="col-8 nopadding" i18n>Kurtosis<span>:</span></div>
<div class="col-4 pull-left nopadding">{{statistics.curtosis| number:'1.0-2'}}</div>
<div class="col-8 nopadding" i18n>Skewness<span>:</span></div>
<div class="col-4 pull-left nopadding">{{statistics.skewness| number:'1.0-2'}}</div>
<div class="col-8 nopadding" i18n>Variance<span>:</span></div>
<div class="col-4 pull-left nopadding">{{statistics.variance| number:'1.0-2'}}</div>
<div class="col-8 nopadding" i18n>Variance coefficient<span>:</span></div>
<div class="col-4 pull-left nopadding">{{statistics.variationCoefficient| number:'1.0-2'}}</div>
</div>

View File

@ -0,0 +1,16 @@
import {Component, Input} from '@angular/core';
import {IStatistics} from '../../../models/color.map';
@Component({
selector: 'fm-map-statistics-details',
templateUrl: './statistics-details.component.html',
styles: ['.nopadding{\n' +
' padding: 0 !important;\n' +
' margin: 0 !important;\n' +
'}']
})
export class StatisticsDetailsComponent {
@Input()
statistics: IStatistics;
}

View File

@ -28,6 +28,22 @@ export interface IHistogram {
confidence?: number;
}
export interface IStatistics {
min: number;
max: number;
mean: number;
stddev: number;
populationCount: number;
minPlus: number;
maxMinus: number;
mode: number;
median: number;
curtosis: number;
skewness: number;
variance: number;
variationCoefficient: number;
}
export interface IGradientstop {
relativestop: number,
color: IColor
@ -41,7 +57,8 @@ export interface IColorMap {
}
export interface IBand {
histogram: IHistogram
histogram: IHistogram;
statistics?: IStatistics;
}