|
|
@@ -14,6 +14,7 @@ import attractivenessConfig from '../attractiveness.config.json';
|
|
|
import clusteringMethods from '../data/clustering_methods.json';
|
|
|
import {AdjusterEventService} from './adjuster-event.service';
|
|
|
import {AdjusterLegendService} from './adjuster-legend.service';
|
|
|
+import {AdjusterPresetsService} from './adjuster-presets.service';
|
|
|
import {obce, obceIndexLayer, osmLayer} from '../app.config';
|
|
|
|
|
|
@Injectable({providedIn: 'root'})
|
|
|
@@ -25,7 +26,7 @@ export class AdjusterService {
|
|
|
/** To be read from a config file */
|
|
|
serviceBaseUrl: string;
|
|
|
/** Used in the UI as a selector */
|
|
|
- allowClusters = true;
|
|
|
+ allowClusters = false //FIXME: (WIP) true;
|
|
|
/** Used in the UI as a selector */
|
|
|
allowIndex = true;
|
|
|
factors = [];
|
|
|
@@ -42,6 +43,7 @@ export class AdjusterService {
|
|
|
constructor(
|
|
|
public adjusterEventService: AdjusterEventService,
|
|
|
public adjusterLegendService: AdjusterLegendService,
|
|
|
+ public adjusterPresetsService: AdjusterPresetsService,
|
|
|
public hsConfig: HsConfig,
|
|
|
public hsEventBus: HsEventBusService,
|
|
|
//public hsLayerMetadataService: HsLayerManagerMetadataService,
|
|
|
@@ -80,8 +82,23 @@ export class AdjusterService {
|
|
|
load: this.adjusterEventService.loaderReady,
|
|
|
}).subscribe(() => {
|
|
|
console.log('Oll layers Korekt! Initializing adjuster...');
|
|
|
+ //this._loadInProcess = false;
|
|
|
this.init();
|
|
|
});
|
|
|
+
|
|
|
+ /* Listen to schema changes so the factors can be re-arranged in the view */
|
|
|
+ this.adjusterPresetsService.schemaChanges.subscribe((newSchema) => {
|
|
|
+ //TODO: i18n this!
|
|
|
+ this.factors = newSchema.groups.map((group) => {
|
|
|
+ return {
|
|
|
+ id: group.id,
|
|
|
+ name: group.labels[0]['@value'],
|
|
|
+ //FIXME: load weights from file
|
|
|
+ weight: 0.5,
|
|
|
+ datasets: this.adjusterPresetsService.getGroupDatasets(group.id)
|
|
|
+ }
|
|
|
+ });
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -103,11 +120,11 @@ export class AdjusterService {
|
|
|
.post(this.serviceBaseUrl + 'cz/scores/', {
|
|
|
factors: this.factors.map((f) => {
|
|
|
return {
|
|
|
- factor: f.name,
|
|
|
+ factor: f.id,
|
|
|
weight: f.weight,
|
|
|
datasets: f.datasets
|
|
|
.filter((ds) => ds.included)
|
|
|
- .map((ds) => ds.name),
|
|
|
+ .map((ds) => ds.id),
|
|
|
};
|
|
|
}),
|
|
|
})
|
|
|
@@ -275,7 +292,8 @@ export class AdjusterService {
|
|
|
.get(this.serviceBaseUrl + 'cz/datasets/')
|
|
|
.toPromise()
|
|
|
.then((data: any) => {
|
|
|
- this.factors = data.map((dataset) => {
|
|
|
+ //console.log(data);
|
|
|
+ /*this.factors = data.map((dataset) => {
|
|
|
return {
|
|
|
name: dataset.Factor,
|
|
|
weight: this.initialWeights[dataset.Factor] ?? 1,
|
|
|
@@ -296,7 +314,7 @@ export class AdjusterService {
|
|
|
included: true,
|
|
|
};
|
|
|
});
|
|
|
- });
|
|
|
+ });*/
|
|
|
this._loadInProcess = false;
|
|
|
this.apply();
|
|
|
// In HSL 2.5, setting layer greyscale breaks the print() functionality
|