Show histogram
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good

This commit is contained in:
Willem Dantuma 2019-12-18 10:21:25 +01:00
parent f44b079cde
commit e1fef2d7f3
5 changed files with 73 additions and 59 deletions

View File

@ -1,4 +1,4 @@
<table class="container" *ngIf="layer"> <table class="container" *ngIf="showLegend()">
<tr> <tr>
<td colspan="2"> <td colspan="2">
<div class="title"> <div class="title">

View File

@ -71,7 +71,9 @@ export class LegendComponent implements OnInit,AfterViewInit {
return percent < 0.1 ? "" : percent.toFixed(1) + " %"; return percent < 0.1 ? "" : percent.toFixed(1) + " %";
} }
showLegend(): boolean {
return this.layer && this.layer.renderer && this.layer.renderer.renderType != "MULTIBAND_COLOR";
}
showHistogram(): boolean { showHistogram(): boolean {
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";

View File

@ -3,20 +3,21 @@
<div class="card border-0"> <div class="card border-0">
<div class="card-body"> <div class="card-body">
<div class="mb-2"><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div> <div class="mb-2"><a href="#" (click)="handleBackToList($event)" i18n>Back</a></div>
<h1>{{item.name}}</h1> <div class="card menu-card">
<div class="legend-container" *ngIf="item?.data.layers;let layers"> <h1>{{item.name}}</h1>
<!--<div *ngIf="layers.length>1"> </div>
<select (change)="onLayerChanged($event.target.value)"> <div class="legend-container" *ngIf="item?.data.layers;let layers">
<option *ngFor="let l of layers;let layerIndex = index" [value]="layerIndex">{{l.name}}</option> <div class="card menu-card">
</select> <fm-map-layer-legend [layer]="layers[selectedLayer]" [histogramenabled]="true"></fm-map-layer-legend>
</div>--> </div>
<fm-map-layer-legend [layer]="layers[selectedLayer]" [histogramenabled]="false" histogramunit="ha"></fm-map-layer-legend> </div>
<div class="card menu-card">
<ul class="p-0 mt-2">
<!--<li><a href="/api/v1/items/{{item.code}}/file" class="mt-1 mr-1" i18n><i class="fa fa-download" aria-hidden="true" title="Download"></i> Download</a></li>-->
<li><a href="#" class="mt-1 mr-1" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a></li>
<li *ngIf="itemTypeService.isLayer(item)"><a href="#" (click)="handleAddAsLayer(item)" class="mt-1 mr-1" i18n><i class="fa fa-eye" aria-hidden="true" title="Add as layer"></i> Add as overlay</a></li>
</ul>
</div> </div>
<ul class="p-0 mt-2">
<!--<li><a href="/api/v1/items/{{item.code}}/file" class="mt-1 mr-1" i18n><i class="fa fa-download" aria-hidden="true" title="Download"></i> Download</a></li>-->
<li><a href="#" class="mt-1 mr-1" (click)="handleOnEdit(item)" i18n><i class="fa fa-pencil" aria-hidden="true" title="Edit"></i> Edit</a></li>
<li *ngIf="itemTypeService.isLayer(item)"><a href="#" (click)="handleAddAsLayer(item)" class="mt-1 mr-1" i18n><i class="fa fa-eye" aria-hidden="true" title="Add as layer"></i> Add as overlay</a></li>
</ul>
</div> </div>
</div> </div>
</div> </div>

View File

@ -31,3 +31,12 @@ li {
display:block; display:block;
} }
} }
.menu-card {
margin-left: -7px;
padding-left: 7px;
margin-right: -7px;
padding-right: 7px;
margin-bottom: 7px;
}

View File

@ -7,7 +7,8 @@ export interface IColor {
export interface IColorEntry { export interface IColorEntry {
value: number, value: number,
color: IColor color: IColor,
label: string
} }
export interface IHistogramEntry { export interface IHistogramEntry {
@ -43,7 +44,8 @@ export interface IBand {
export interface IRenderer { export interface IRenderer {
band:IBand, band:IBand,
colorMap: IColorMap colorMap: IColorMap,
renderType:string
} }
export interface IRenderoutput { export interface IRenderoutput {