Skip to content
Snippets Groups Projects
Commit fe8e2569 authored by zdenko.vuk@ijs.si's avatar zdenko.vuk@ijs.si
Browse files

This is a combination of 2 commits.

just removed a log

some updates
parent f9e0fd81
No related branches found
No related tags found
No related merge requests found
...@@ -65,7 +65,10 @@ ...@@ -65,7 +65,10 @@
</div> </div>
</div> </div>
<div id="inputsLegendContainer"> <div id="inputsLegendContainer">
<form [formGroup]="newBrinkValues" (ngSubmit)="onApplyNewValuesSubmit()"> <form
[formGroup]="newBrinkValuesForm"
(ngSubmit)="onApplyNewValuesSubmit()"
>
<div> <div>
<div> <div>
<label for="">1st color, up to</label> <label for="">1st color, up to</label>
...@@ -131,7 +134,7 @@ ...@@ -131,7 +134,7 @@
nbButton nbButton
status="primary" status="primary"
type="submit" type="submit"
[disabled]="!newBrinkValues.dirty" [disabled]="!newBrinkValuesForm.dirty"
> >
Apply new values Apply new values
</button> </button>
......
import { Component, Input, TemplateRef, OnChanges } from "@angular/core"; import {
Component,
Input,
TemplateRef,
OnChanges,
OnInit,
} from "@angular/core";
import * as L from "leaflet"; import * as L from "leaflet";
import { SimulationService } from "../utils/services/simulation.service"; import { SimulationService } from "../utils/services/simulation.service";
import * as MapColors from "./map-colors-local"; import * as MapColors from "./map-colors-local";
...@@ -13,7 +19,7 @@ import { FormControl, FormGroup } from "@angular/forms"; ...@@ -13,7 +19,7 @@ import { FormControl, FormGroup } from "@angular/forms";
templateUrl: "./results-map.component.html", templateUrl: "./results-map.component.html",
styleUrls: ["./results-map.component.scss"], styleUrls: ["./results-map.component.scss"],
}) })
export class ResultsMapComponent implements OnChanges { export class ResultsMapComponent implements OnInit, OnChanges {
@Input() selectedSimulation: Simulation; @Input() selectedSimulation: Simulation;
public map: L.Map; public map: L.Map;
options = { options = {
...@@ -35,7 +41,7 @@ export class ResultsMapComponent implements OnChanges { ...@@ -35,7 +41,7 @@ export class ResultsMapComponent implements OnChanges {
grayscale: number = 50; grayscale: number = 50;
loadGeojsons: Object[] = []; loadGeojsons: Object[] = [];
maxKeyValues: Object = {}; maxKeyValues: Object = {};
newBrinkValues = new FormGroup({ newBrinkValuesForm = new FormGroup({
legend_0: new FormControl(undefined), legend_0: new FormControl(undefined),
legend_1: new FormControl(undefined), legend_1: new FormControl(undefined),
legend_2: new FormControl(undefined), legend_2: new FormControl(undefined),
...@@ -53,6 +59,10 @@ export class ResultsMapComponent implements OnChanges { ...@@ -53,6 +59,10 @@ export class ResultsMapComponent implements OnChanges {
private dialogService: NbDialogService, private dialogService: NbDialogService,
private networkService: NetworkService private networkService: NetworkService
) {} ) {}
ngOnInit(): void {
this.newBrinkValuesForm.disable();
}
onMapReady(map: L.Map) { onMapReady(map: L.Map) {
this.map = map; this.map = map;
this.grayscaleChange(); this.grayscaleChange();
...@@ -63,28 +73,28 @@ export class ResultsMapComponent implements OnChanges { ...@@ -63,28 +73,28 @@ export class ResultsMapComponent implements OnChanges {
this.setMapPositionAndZoom(res); this.setMapPositionAndZoom(res);
}); });
}, 50); }, 50);
setTimeout(() => { // setTimeout(() => {
console.log( // console.log(
"%cTemporary", // "%cTemporary",
"background: peru; font-weight: bold; color: black; font-family: serif; padding: 0 10px;" // "background: peru; font-weight: bold; color: black; font-family: serif; padding: 0 10px;"
); // );
const celkomplet: HTMLElement = document.querySelectorAll( // const celkomplet: HTMLElement = document.querySelectorAll(
".buttons" // ".buttons"
)[0] as HTMLElement; // )[0] as HTMLElement;
celkomplet.style.display = "none"; // celkomplet.style.display = "none";
}, 825); // }, 825);
setTimeout(() => { // setTimeout(() => {
const celkomplet1: HTMLElement = document.querySelectorAll( // const celkomplet1: HTMLElement = document.querySelectorAll(
".appearance-filled.size-medium.shape-rectangle.status-primary.ng-star-inserted.nb-transition" // ".appearance-filled.size-medium.shape-rectangle.status-primary.ng-star-inserted.nb-transition"
)[1] as HTMLElement; // )[1] as HTMLElement;
celkomplet1.click(); // celkomplet1.click();
}, 1000); // }, 1000);
setTimeout(() => { // setTimeout(() => {
const celkomplet2: HTMLElement = document.querySelectorAll( // const celkomplet2: HTMLElement = document.querySelectorAll(
"#loadGeojsonButtonsContainer button" // "#loadGeojsonButtonsContainer button"
)[1] as HTMLElement; // )[1] as HTMLElement;
celkomplet2.click(); // celkomplet2.click();
}, 1050); // }, 1050);
// setTimeout(() => { // setTimeout(() => {
// const celkomplet3: HTMLElement = document.querySelectorAll( // const celkomplet3: HTMLElement = document.querySelectorAll(
// ".leaflet-control-layers-selector" // ".leaflet-control-layers-selector"
...@@ -249,11 +259,11 @@ export class ResultsMapComponent implements OnChanges { ...@@ -249,11 +259,11 @@ export class ResultsMapComponent implements OnChanges {
if (this.newBrinkValuesApplied == true) { if (this.newBrinkValuesApplied == true) {
grades = [ grades = [
0, 0,
this.newBrinkValues.get("legend_0").value, this.newBrinkValuesForm.get("legend_0").value,
this.newBrinkValues.get("legend_1").value, this.newBrinkValuesForm.get("legend_1").value,
this.newBrinkValues.get("legend_2").value, this.newBrinkValuesForm.get("legend_2").value,
this.newBrinkValues.get("legend_3").value, this.newBrinkValuesForm.get("legend_3").value,
this.newBrinkValues.get("legend_4").value, this.newBrinkValuesForm.get("legend_4").value,
]; ];
} else { } else {
grades = [ grades = [
...@@ -292,7 +302,9 @@ export class ResultsMapComponent implements OnChanges { ...@@ -292,7 +302,9 @@ export class ResultsMapComponent implements OnChanges {
"'>&#9632</span> " + "'>&#9632</span> " +
grades[i] + grades[i] +
(grades[i + 1] ? "&ndash;" + grades[i + 1] + "</p>" : "+</p>"); (grades[i + 1] ? "&ndash;" + grades[i + 1] + "</p>" : "+</p>");
this.newBrinkValues.get(`legend_${i - 1}`).setValue(`${grades[i]}`); this.newBrinkValuesForm
.get(`legend_${i - 1}`)
.setValue(`${grades[i]}`);
} }
} else { } else {
div.innerHTML += div.innerHTML +=
...@@ -310,7 +322,9 @@ export class ResultsMapComponent implements OnChanges { ...@@ -310,7 +322,9 @@ export class ResultsMapComponent implements OnChanges {
grades[i] + grades[i] +
(grades[i + 1] ? "&ndash;" + grades[i + 1] + "</p>" : "+</p>"); (grades[i + 1] ? "&ndash;" + grades[i + 1] + "</p>" : "+</p>");
this.newBrinkValues.get(`legend_${i - 1}`).setValue(`${grades[i]}`); this.newBrinkValuesForm
.get(`legend_${i - 1}`)
.setValue(`${grades[i]}`);
} }
} }
...@@ -514,7 +528,7 @@ export class ResultsMapComponent implements OnChanges { ...@@ -514,7 +528,7 @@ export class ResultsMapComponent implements OnChanges {
style: (feature) => ({ style: (feature) => ({
weight: this.geoJsonStyleWeight, weight: this.geoJsonStyleWeight,
color: MapColors.getNewColor( color: MapColors.getNewColor(
this.newBrinkValues, this.newBrinkValuesForm,
feature["properties"], feature["properties"],
keys[f], keys[f],
parseInt(feature["properties"]["capacity"]) == 9999 parseInt(feature["properties"]["capacity"]) == 9999
...@@ -535,7 +549,7 @@ export class ResultsMapComponent implements OnChanges { ...@@ -535,7 +549,7 @@ export class ResultsMapComponent implements OnChanges {
style: (feature) => ({ style: (feature) => ({
weight: this.geoJsonStyleWeight, weight: this.geoJsonStyleWeight,
color: MapColors.getNewColor( color: MapColors.getNewColor(
this.newBrinkValues, this.newBrinkValuesForm,
feature["properties"], feature["properties"],
keys[f], keys[f],
parseInt(feature["properties"]["capacity"]) == 9999 parseInt(feature["properties"]["capacity"]) == 9999
...@@ -553,7 +567,7 @@ export class ResultsMapComponent implements OnChanges { ...@@ -553,7 +567,7 @@ export class ResultsMapComponent implements OnChanges {
}); });
} }
} else { } else {
// default, newBrinkValues not applied // default, newBrinkValuesForm not applied
if (keys[f] == "capacity") { if (keys[f] == "capacity") {
tmp = L.geoJSON(<any>jsonFile, { tmp = L.geoJSON(<any>jsonFile, {
style: (feature) => ({ style: (feature) => ({
...@@ -658,9 +672,9 @@ export class ResultsMapComponent implements OnChanges { ...@@ -658,9 +672,9 @@ export class ResultsMapComponent implements OnChanges {
public addListenerToRadioButtonLayersControlAndSetLegend() { public addListenerToRadioButtonLayersControlAndSetLegend() {
this.map.on("baselayerchange", (e) => { this.map.on("baselayerchange", (e) => {
console.log(" I ho pauroa d i te");
this.setLegend(e["name"]); this.setLegend(e["name"]);
this.checkedRadioButton = e["name"]; this.checkedRadioButton = e["name"];
this.newBrinkValuesForm.enable();
}); });
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment