Browse Source

✨ add quantile and blur selectors

jmacura 3 years ago
parent
commit
16375b1854

+ 8 - 0
src/app/calculator/calculator.component.html

@@ -12,6 +12,14 @@
         <p class="p-1 text-info">{{ 'CALCULATOR.selectField' | translate}}</p>
       </div>
       <div>
+        {{hsLanguageService.getTranslationIgnoreNonExisting('CALCULATOR', 'selectQuantiles', {quantileCount: calcService.quantileCount})}}:&emsp;
+        <input type="range" min="2" max="10" step="1" [(ngModel)]="calcService.quantileCount">
+      </div>
+      <div>
+        {{ 'CALCULATOR.selectBlur' | translate}}:&emsp;{{calcService.blurValue}}
+        <input type="range" min="0" max="1" step="0.1" [(ngModel)]="calcService.blurValue">
+      </div>
+      <div>
         {{ 'CALCULATOR.selectIndex' | translate}}:&emsp;
         <select class="form-select" [(ngModel)]="data.selectedProduct">
           <option *ngFor="let product of calcService.AVAILABLE_PRODUCTS" [ngValue]="product">{{product}}</option>

+ 7 - 2
src/app/calculator/calculator.component.ts

@@ -1,7 +1,11 @@
 import {Component, ViewRef} from '@angular/core';
 
-// eslint-disable-next-line import/named
-import {HsLayoutService, HsPanelComponent} from 'hslayers-ng';
+import {
+  HsLanguageService,
+  HsLayoutService,
+  // eslint-disable-next-line import/named
+  HsPanelComponent,
+} from 'hslayers-ng';
 
 import {CalculatorService, Index} from './calculator.service';
 import {FieldService} from './field.service';
@@ -21,6 +25,7 @@ export class CalculatorComponent implements HsPanelComponent {
   constructor(
     public calcService: CalculatorService,
     private fieldService: FieldService,
+    public hsLanguageService: HsLanguageService,
     public hsLayoutService: HsLayoutService
   ) {
     this.fieldService.fieldSelects.subscribe(({feature}) => {

+ 3 - 0
src/app/calculator/calculator.service.ts

@@ -15,8 +15,10 @@ export class CalculatorService {
   AVAILABLE_PRODUCTS = ['EVI', 'RVI4S1'] as const;
   SERVICE_BASE_URL = 'https://fieldcalc.lesprojekt.cz/' as const;
   availableDates: Array<string>;
+  blurValue = 0.4;
   dateRangeSelects: Subject<{date: string}> = new Subject();
   dateCalendarSelects: Subject<{date: string}> = new Subject();
+  quantileCount = 4;
   selectedDate;
   //selectedProduct;
   private _datesLoading: boolean;
@@ -98,6 +100,7 @@ export class CalculatorService {
             'get_zones',
           {
             product,
+            number_of_quantiles: this.quantileCount,
             date: this.selectedDate,
             format: 'geojson',
             geojson: this.fieldService.getSelectedFieldGeoJSON(),

+ 7 - 3
src/app/translations.json

@@ -4,10 +4,12 @@
       "getDates": "VYBRAT DATUM",
       "getZones": "ZÍSKAT ZÓNY",
       "panelHeader": "Výpočet indexů pole",
+      "selectBlur": "Chci vyhlazení",
       "selectDate": "Chci datum",
       "selectField": "Pole vyberte kliknutím do mapy. Pro výběr pole je potřeba mapu přiblížit.",
       "selectedField": "Vybráno pole",
-      "selectIndex": "Chci vypočítat index"
+      "selectIndex": "Chci vypočítat index",
+      "selectQuantiles": "Chci {{quantileCount}} kvantilů"
     }
   },
   "en": {
@@ -15,10 +17,12 @@
       "getDates": "GET DATES",
       "getZones": "GET ZONES",
       "panelHeader": "Field calculation",
-      "selectDate": "I want a datum",
+      "selectBlur": "I want to blur by",
+      "selectDate": "I want a date",
       "selectField": "Select a field by clicking in the map. In order to select the field, you must zoom the map in.",
       "selectedField": "Selected field",
-      "selectIndex": "I want to calculate index"
+      "selectIndex": "I want to calculate index",
+      "selectQuantiles": "I want {{quantileCount}} quantiles"
     }
   }
 }