|
@@ -264,48 +264,7 @@ export class AdjusterService {
|
|
|
this.numberOfClusters
|
|
this.numberOfClusters
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
- // Another implementation of the loop above, yet too slow
|
|
|
|
|
- //const clusters = [];
|
|
|
|
|
- //const obceFeatures: Array<any> = obce.getFeatures();
|
|
|
|
|
- // Array of arrays
|
|
|
|
|
- /*const methodsFeatures = this.methods.map((m) =>
|
|
|
|
|
- m.layer.getSource().getFeatures()
|
|
|
|
|
- );
|
|
|
|
|
- for (const region of clusterData) {
|
|
|
|
|
- //if (!clusters.includes(region[this.method])) {
|
|
|
|
|
- // clusters.push(region[this.method]);
|
|
|
|
|
- //}
|
|
|
|
|
- for (const features of methodsFeatures) {
|
|
|
|
|
-
|
|
|
|
|
- const feature = features.find(
|
|
|
|
|
- // NOTE: Do NOT add triple equal sign!
|
|
|
|
|
- (f) => f.get('nationalCode') == region['lau2']
|
|
|
|
|
- );
|
|
|
|
|
- if (!feature) {
|
|
|
|
|
- if (errs < 20) {
|
|
|
|
|
- errs++;
|
|
|
|
|
- console.warn(`No feature matches region ${region['lau2']}`);
|
|
|
|
|
- console.log(region);
|
|
|
|
|
- }
|
|
|
|
|
- continue;
|
|
|
|
|
- }
|
|
|
|
|
- Object.keys(region).forEach(function (key, index) {
|
|
|
|
|
- if (key !== 'lau2') {
|
|
|
|
|
- feature.set(key, region[key], true);
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- logs++;
|
|
|
|
|
- if (logs % 100 == 0) {
|
|
|
|
|
- console.log(`processed ${logs} items`);
|
|
|
|
|
- }
|
|
|
|
|
- //sublayers[region[this.method] - 1].getSource().addFeature(feature);
|
|
|
|
|
- }*/
|
|
|
|
|
- //obceLayer.set('Layer', sublayers);
|
|
|
|
|
- //this.hsLayerMetadataService.fillMetadata(obceLayer);
|
|
|
|
|
- //console.log(sublayers[0].getSource().getFeatures());
|
|
|
|
|
console.timeEnd('forEach-Cluster');
|
|
console.timeEnd('forEach-Cluster');
|
|
|
- //this.clusters = clusters;
|
|
|
|
|
this._clustersLoaded = true;
|
|
this._clustersLoaded = true;
|
|
|
this._clusteringInProcess = false;
|
|
this._clusteringInProcess = false;
|
|
|
this.adjusterEventService.loaded.next({
|
|
this.adjusterEventService.loaded.next({
|