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 { ForPackage } from './components/for-item/for-package.decorator';
import { PanToLocation} from './components/aol/pan-to-location/pan-to-location.component'; import { PanToLocation} from './components/aol/pan-to-location/pan-to-location.component';
import {LayerSwitcher} from './components/layer-switcher/layer-switcher.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> { export function LocalStorageSync(reducer: ActionReducer<any>): ActionReducer<any> {
const r = function(state, action) { const r = function(state, action) {
@ -148,7 +150,7 @@ export {
ForPackage ForPackage
} }
@NgModule({ @NgModule({
imports: [ imports: [
CommonModule, CommonModule,
AngularOpenlayersModule, AngularOpenlayersModule,
@ -195,7 +197,9 @@ export {
WidgetStatusComponent, WidgetStatusComponent,
GpsLocation, GpsLocation,
PanToLocation, PanToLocation,
LayerSwitcher LayerSwitcher,
HistogramDetailsComponent,
StatisticsDetailsComponent
], ],
entryComponents: [ entryComponents: [
FeatureListComponent, FeatureListComponent,
@ -255,7 +259,7 @@ export {
export class AppCommonMapModule { export class AppCommonMapModule {
static forRoot(): ModuleWithProviders<AppCommonMapModule> { static forRoot(): ModuleWithProviders<AppCommonMapModule> {
return { return {
ngModule: AppCommonMapModule, ngModule: AppCommonMapModule,
providers: [ providers: [
FeatureIconService, FeatureIconService,
GeolocationService, GeolocationService,

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()"> <tr *ngIf="showHistogram()">
<td colspan="4" class="pb-1 pt-1"> <td colspan="4" class="pb-1 pt-1">
<div class="info" [ngbCollapse]="hideHistogramDetails"> <div class="info" [ngbCollapse]="hideHistogramDetails">
<div class="row pl-3"> <fm-map-histogram-details *ngIf="bandContainsHistogram(); else statistics"
<div class="col-8 nopadding" i18n>Average<span>:</span></div> [histogram]="layer.renderer.band.histogram"></fm-map-histogram-details>
<div class="col-4 pull-left nopadding">{{layer.renderer.band.histogram.mean| number:'1.0-2'}}</div> <ng-template #statistics>
<div class="col-8 nopadding" i18n>Standard deviation<span>:</span></div> <fm-map-statistics-details [statistics]="layer.renderer.band.statistics"></fm-map-statistics-details>
<div class="col-4 pull-left nopadding">{{layer.renderer.band.histogram.stddev| number:'1.0-2'}}</div> </ng-template>
<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>
</div> </div>
</td> </td>
</tr> </tr>

View File

@ -16,11 +16,6 @@
margin-bottom: 0; margin-bottom: 0;
} }
.nopadding{
padding: 0 !important;
margin: 0 !important;
}
span.color { span.color {
display:inline-block; display:inline-block;
width: 1.5em; 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"; 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 { bandContainsHistogram(): boolean {
return this.histogramenabled && this.layer.renderer.band.histogram.confidence != null && this.layer.renderer.band.histogram.confidence != 1; 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; 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 { export interface IGradientstop {
relativestop: number, relativestop: number,
color: IColor color: IColor
@ -41,7 +57,8 @@ export interface IColorMap {
} }
export interface IBand { export interface IBand {
histogram: IHistogram histogram: IHistogram;
statistics?: IStatistics;
} }