Oops remember to test it next time..
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
This commit is contained in:
parent
0948bacaaf
commit
5d7fd63adc
@ -1,5 +1,5 @@
|
||||
import { Component, OnInit, Input,AfterViewInit } from '@angular/core';
|
||||
import { IColorMap, IColor, IColorEntry,ILayer, IRenderer } from '../../models';
|
||||
import { IColorMap, IColor, IColorEntry,ILayer, IRenderer } from '../../models/color.map';
|
||||
|
||||
|
||||
@Component({
|
||||
@ -48,7 +48,7 @@ export class LegendComponent implements OnInit,AfterViewInit {
|
||||
|
||||
|
||||
|
||||
private getHex(color: IColor): string {
|
||||
public getHex(color: IColor): string {
|
||||
return '#' + this.componentToHex(color.red) + this.componentToHex(color.green) + this.componentToHex(color.blue);
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ export class LegendComponent implements OnInit,AfterViewInit {
|
||||
return hex.length === 1 ? `0${hex}` : hex;
|
||||
}
|
||||
|
||||
private getPart(renderer: IRenderer, index: number): string {
|
||||
public getPart(renderer: IRenderer, index: number): string {
|
||||
let max = renderer.band.histogram.entries.reduce((max, entry) => entry.freqency > max ? entry.freqency : max, 0);
|
||||
let scale = 75 / max;
|
||||
let part = (renderer.band.histogram.entries[index].freqency * scale) + "%";
|
||||
@ -65,7 +65,7 @@ export class LegendComponent implements OnInit,AfterViewInit {
|
||||
return part;
|
||||
}
|
||||
|
||||
private getLabel(renderer: IRenderer, index: number): string {
|
||||
public getLabel(renderer: IRenderer, index: number): string {
|
||||
let scale = 100 / renderer.band.histogram.entries.reduce((sum, entry) => sum + entry.freqency, 0);
|
||||
let percent = renderer.band.histogram.entries[index].freqency * scale;
|
||||
return percent < 0.1 ? "" : percent.toFixed(1) + " %";
|
||||
|
@ -1,69 +1,70 @@
|
||||
export interface IColor {
|
||||
red: number,
|
||||
green: number,
|
||||
blue: number,
|
||||
alpha: number,
|
||||
}
|
||||
|
||||
export interface IColorEntry {
|
||||
value: number,
|
||||
color: IColor
|
||||
}
|
||||
|
||||
export interface IHistogramEntry {
|
||||
value: number,
|
||||
freqency: number
|
||||
}
|
||||
|
||||
export interface IHistogram {
|
||||
min: number,
|
||||
max: number,
|
||||
mean: number,
|
||||
stddev: number,
|
||||
classes: number,
|
||||
entries: IHistogramEntry[]
|
||||
}
|
||||
|
||||
export interface IGradientstop {
|
||||
relativestop: number,
|
||||
color: IColor
|
||||
}
|
||||
|
||||
export interface IColorMap {
|
||||
gradient: IGradientstop[],
|
||||
noValue: IColorEntry,
|
||||
entries: IColorEntry[]
|
||||
}
|
||||
|
||||
export interface IBand {
|
||||
histogram: IHistogram
|
||||
}
|
||||
|
||||
|
||||
export interface IRenderer {
|
||||
band:IBand,
|
||||
colorMap: IColorMap
|
||||
}
|
||||
|
||||
export interface IRenderoutput {
|
||||
renderoutputType: string
|
||||
}
|
||||
|
||||
export interface IRenderoutputTiles {
|
||||
renderoutputType: string,
|
||||
minzoom: number,
|
||||
maxzoom: number
|
||||
}
|
||||
|
||||
export interface IRenderoutputImage {
|
||||
renderoutputType: string,
|
||||
extent: [number,number,number,number]
|
||||
}
|
||||
|
||||
export interface ILayer {
|
||||
name: string,
|
||||
unit: string,
|
||||
index: number,
|
||||
renderer: IRenderer,
|
||||
rendering: IRenderoutput
|
||||
}
|
||||
export interface IColor {
|
||||
red: number,
|
||||
green: number,
|
||||
blue: number,
|
||||
alpha: number,
|
||||
}
|
||||
|
||||
export interface IColorEntry {
|
||||
value: number,
|
||||
color: IColor
|
||||
}
|
||||
|
||||
export interface IHistogramEntry {
|
||||
value: number,
|
||||
freqency: number
|
||||
}
|
||||
|
||||
export interface IHistogram {
|
||||
min: number,
|
||||
max: number,
|
||||
mean: number,
|
||||
stddev: number,
|
||||
classes: number,
|
||||
entries: IHistogramEntry[]
|
||||
}
|
||||
|
||||
export interface IGradientstop {
|
||||
relativestop: number,
|
||||
color: IColor
|
||||
}
|
||||
|
||||
export interface IColorMap {
|
||||
gradient: IGradientstop[],
|
||||
noValue: IColorEntry,
|
||||
entries: IColorEntry[],
|
||||
colormapType: string
|
||||
}
|
||||
|
||||
export interface IBand {
|
||||
histogram: IHistogram
|
||||
}
|
||||
|
||||
|
||||
export interface IRenderer {
|
||||
band:IBand,
|
||||
colorMap: IColorMap
|
||||
}
|
||||
|
||||
export interface IRenderoutput {
|
||||
renderoutputType: string
|
||||
}
|
||||
|
||||
export interface IRenderoutputTiles {
|
||||
renderoutputType: string,
|
||||
minzoom: number,
|
||||
maxzoom: number
|
||||
}
|
||||
|
||||
export interface IRenderoutputImage {
|
||||
renderoutputType: string,
|
||||
extent: [number,number,number,number]
|
||||
}
|
||||
|
||||
export interface ILayer {
|
||||
name: string,
|
||||
unit: string,
|
||||
index: number,
|
||||
renderer: IRenderer,
|
||||
rendering: IRenderoutput
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user