diff --git a/src/app/pages/simulation-wizard/results-map/map-colors-local.ts b/src/app/pages/simulation-wizard/results-map/map-colors-local.ts index 150f685fc9333bc3092ae2ff6e7db4b157fab015..33842fa15510410f8bbb7516ec8e88411ae44c10 100644 --- a/src/app/pages/simulation-wizard/results-map/map-colors-local.ts +++ b/src/app/pages/simulation-wizard/results-map/map-colors-local.ts @@ -18,7 +18,7 @@ const color_value_undefined = "#9efcff33"; export function getColor( properties: any, pro: any, - ograjice: number[], + brinkValues: number[], isCapacityEqual9999: boolean ): string { if (isCapacityEqual9999 == true) { @@ -42,23 +42,23 @@ export function getColor( if (value == undefined) return color_value_undefined; - return value > ograjice[4] + return value > brinkValues[4] ? color_0 - : value > ograjice[3] + : value > brinkValues[3] ? color_1 - : value > ograjice[2] + : value > brinkValues[2] ? color_2 - : value > ograjice[1] + : value > brinkValues[1] ? color_3 - : value > ograjice[0] + : value > brinkValues[0] ? color_4 : color_5; } -export function getColorOgrajiceHighToLow( +export function getColorHighToLow( properties: any, pro: any, - ograjice: number[], + brinkValues: number[], isCapacityEqual9999: boolean ): string { if (isCapacityEqual9999 == true) { @@ -82,15 +82,15 @@ export function getColorOgrajiceHighToLow( if (value == undefined) return color_value_undefined; - return value > ograjice[4] + return value > brinkValues[4] ? color_5 - : value > ograjice[3] + : value > brinkValues[3] ? color_4 - : value > ograjice[2] + : value > brinkValues[2] ? color_3 - : value > ograjice[1] + : value > brinkValues[1] ? color_2 - : value > ograjice[0] + : value > brinkValues[0] ? color_1 : color_0; } diff --git a/src/app/pages/simulation-wizard/results-map/results-map.component.ts b/src/app/pages/simulation-wizard/results-map/results-map.component.ts index d4e57c2c4e3a92b004054ae4e9d72eb2c4c5d16e..42aaa2cd737b9ce7cc9320f501c18f0c26c97a85 100644 --- a/src/app/pages/simulation-wizard/results-map/results-map.component.ts +++ b/src/app/pages/simulation-wizard/results-map/results-map.component.ts @@ -41,7 +41,7 @@ export class ResultsMapComponent implements OnInit, OnChanges { grayscale: number = 50; loadGeojsons: Object[] = []; maxKeyValues: Object = {}; - ograjiceValues: Object = {}; + brinkValues: Object = {}; newBrinkValuesForm = new FormGroup({ legend_0: new FormControl(undefined), legend_1: new FormControl(undefined), @@ -357,22 +357,22 @@ export class ResultsMapComponent implements OnInit, OnChanges { }); } else { if (this.newBrinkValuesApplied) { - let ograjice = []; - ograjice.push(this.newBrinkValuesForm.get("legend_0").value); - ograjice.push(this.newBrinkValuesForm.get("legend_1").value); - ograjice.push(this.newBrinkValuesForm.get("legend_2").value); - ograjice.push(this.newBrinkValuesForm.get("legend_3").value); - ograjice.push(this.newBrinkValuesForm.get("legend_4").value); - this.ograjiceValues[keys[f]] = ograjice; + let l = []; + l.push(this.newBrinkValuesForm.get("legend_0").value); + l.push(this.newBrinkValuesForm.get("legend_1").value); + l.push(this.newBrinkValuesForm.get("legend_2").value); + l.push(this.newBrinkValuesForm.get("legend_3").value); + l.push(this.newBrinkValuesForm.get("legend_4").value); + this.brinkValues[keys[f]] = l; if (keys[f] == "capacity") { tmp = L.geoJSON(<any>jsonFile, { style: (feature) => ({ weight: this.geoJsonStyleWeight, - color: MapColors.getColorOgrajiceHighToLow( + color: MapColors.getColorHighToLow( feature["properties"]["capacity"], keys[f], - ograjice, + l, parseInt(feature["properties"]["capacity"]) == 9999 ? true : false @@ -397,7 +397,7 @@ export class ResultsMapComponent implements OnInit, OnChanges { feature["properties"]["cityWide"]["traffic"][keys[f]] || feature["properties"][keys[f]], keys[f], - ograjice, + l, false ), opacity: this.geoJsonStyleOpacity, @@ -413,10 +413,10 @@ export class ResultsMapComponent implements OnInit, OnChanges { tmp = L.geoJSON(<any>jsonFile, { style: (feature) => ({ weight: this.geoJsonStyleWeight, - color: MapColors.getColorOgrajiceHighToLow( + color: MapColors.getColorHighToLow( feature["properties"], keys[f], - ograjice, + l, false ), opacity: this.geoJsonStyleOpacity, @@ -435,7 +435,7 @@ export class ResultsMapComponent implements OnInit, OnChanges { color: MapColors.getColor( feature["properties"], keys[f], - ograjice, + l, false ), opacity: this.geoJsonStyleOpacity, @@ -450,22 +450,22 @@ export class ResultsMapComponent implements OnInit, OnChanges { } } else { // default, newBrinkValuesForm not applied - let ograjice = []; + let l = []; ratiosBetweenGrades.forEach((r) => { - ograjice.push( + l.push( this.roundMyNumbers(this.maxKeyValues[`maxValue_${keys[f]}`] / r) ); }); - this.ograjiceValues[keys[f]] = ograjice; + this.brinkValues[keys[f]] = l; if (keys[f] == "capacity") { tmp = L.geoJSON(<any>jsonFile, { style: (feature) => ({ weight: this.geoJsonStyleWeight, - color: MapColors.getColorOgrajiceHighToLow( + color: MapColors.getColorHighToLow( feature["properties"]["capacity"], keys[f], - ograjice, + l, parseInt(feature["properties"]["capacity"]) == 9999 ? true : false @@ -490,7 +490,7 @@ export class ResultsMapComponent implements OnInit, OnChanges { feature["properties"]["cityWide"]["traffic"][keys[f]] || feature["properties"][keys[f]], keys[f], - ograjice, + l, false ), opacity: this.geoJsonStyleOpacity, @@ -506,10 +506,10 @@ export class ResultsMapComponent implements OnInit, OnChanges { tmp = L.geoJSON(<any>jsonFile, { style: (feature) => ({ weight: this.geoJsonStyleWeight, - color: MapColors.getColorOgrajiceHighToLow( + color: MapColors.getColorHighToLow( feature["properties"], keys[f], - ograjice, + l, false ), opacity: this.geoJsonStyleOpacity, @@ -528,7 +528,7 @@ export class ResultsMapComponent implements OnInit, OnChanges { color: MapColors.getColor( feature["properties"], keys[f], - ograjice, + l, false ), opacity: this.geoJsonStyleOpacity, @@ -722,28 +722,28 @@ export class ResultsMapComponent implements OnInit, OnChanges { "<p style='background:white; display: inline; font-size:17px'> <span style='color:" + MapColors.getColorForLegend(0) + "'>■</span> <" + - this.ograjiceValues[legendType][0] + + this.brinkValues[legendType][0] + "</p>"; for (let i = 1; i < 6; i++) { div.innerHTML += "<p style='background:white; display: inline; font-size:17px'> <span style='color:" + MapColors.getColorForLegend(i) + "'>■</span> " + - this.ograjiceValues[legendType][i - 1] + - (this.ograjiceValues[legendType][i] - ? "–" + this.ograjiceValues[legendType][i] + "</p>" + this.brinkValues[legendType][i - 1] + + (this.brinkValues[legendType][i] + ? "–" + this.brinkValues[legendType][i] + "</p>" : "+</p>"); this.newBrinkValuesForm .get(`legend_${i - 1}`) - .setValue(`${this.ograjiceValues[legendType][i - 1]}`); + .setValue(`${this.brinkValues[legendType][i - 1]}`); } } else { div.innerHTML += "<p style='background:white; display: inline; font-size:17px'> <span style='color:" + MapColors.getColorForLegendHighToLow(0) + "'>■</span> <" + - this.ograjiceValues[legendType][0] + + this.brinkValues[legendType][0] + "</p>"; for (let i = 0; i < 5; i++) { @@ -751,14 +751,14 @@ export class ResultsMapComponent implements OnInit, OnChanges { "<p style='background:white; display: inline; font-size:17px'> <span style='color:" + MapColors.getColorForLegendHighToLow(i + 1) + "'>■</span> " + - this.ograjiceValues[legendType][i] + - (this.ograjiceValues[legendType][i + 1] - ? "–" + this.ograjiceValues[legendType][i + 1] + "</p>" + this.brinkValues[legendType][i] + + (this.brinkValues[legendType][i + 1] + ? "–" + this.brinkValues[legendType][i + 1] + "</p>" : "+</p>"); this.newBrinkValuesForm .get(`legend_${i}`) - .setValue(`${this.ograjiceValues[legendType][i]}`); + .setValue(`${this.brinkValues[legendType][i]}`); } }