",
- steps: [
- {
- element:"#map",
- title: "Willkommen zur Guided Tour von KomMonitor",
- placement: "left",
- content: "In dieser Tour werden die Funktionalitäten der Weboberfläche erläutert. Hier werden sie mit den Elementen der Oberfläche sowie den verschiedenen Buttons vertraut gemacht. " +
- " Die Tour kann jederzeit über den Button Guided Tour beenden verlassen werden. ",
- onNext: function(tour){
- if($scope.sidebarLegendClass !== "disappear"){
- $("#sidebarLegendCollapse").click();
- }
- }
- },
- {
- element: "#map",
- title: "Inhaltsverzeichnis",
- placement: "top",
- content: "",
- onNext: function(tour){
- if($scope.sidebarLegendClass !== "disappear"){
- $("#sidebarLegendCollapse").click();
- }
- },
- onShown: function(tour) {
- $scope.generateTableOfContent();
- }
- },
- {
- element: "#header",
- title: "Kopfzeile",
- placement: "bottom",
- content: "In der Kopfzeile befinden sich neben den Logos und dem Titel der Webanwendung mehrere Buttons. " +
- "Mit kann zwischen einer vereinfachten und einer erweiterten Ansicht gewechselt werden. " +
- "Diese Guided Tour kann stets erneut mit aufgerufen werden. " +
- " öffnet das beim Aufruf der Seite erschienene Informationsfenster und" +
- " ermöglicht mit entsprechenden Zugangsdaten den Zugang zur Administrationsoberfläche."
- },
- {
- element: "#map",
- title: "Kartenfenster",
- placement: "top",
- content: "Die Standardansicht besteht aus einer kartografischen Darstellung, die bereits eine Hintergrundkarte und einen Indikator anzeigt. In dieser Darstellung können Sie in der " +
- "Karte frei navigieren (zoomen, verschieben) und beim Herüberfahren mit dem Mauszeiger über eine der Raumeinheiten werden der Name, der Wert und die Einheit des dargestellten Indikators angezeigt.",
- // onNext: function(tour){
- // // make sure that legend control is displayed
-
- // var control = document.getElementById("legendControl");
- // var controlButton = document.getElementById("toggleLegendControlButton");
- // if(control.style.display === "none" || (controlButton.style.display !== undefined && controlButton.style.display !== "none")){
- // $rootScope.$broadcast("toggleLegendControl");
- // }
-
- // },
- onNext: function(tour){
- if($scope.sidebarLegendClass === "disappear"){
- $("#sidebarLegendCollapse").click();
- }
- }
- },
- {
- element: "#kommonitorLegend",
- title: "Indikatorenlegende und Klassifizierung",
- placement: "left",
- content: "Dieses Element ist in drei Teilbereiche untergliedert, welche 1. die wichtigsten Metadaten des dargestellten Indikator abbilden, " +
- "2. Kartenlegenden zur Interpretation der Karteninhalte anbieten und 3. weitergehende Möglichkeiten zur Klassifizierung bieten.",
- onNext: function(tour){
- if($scope.sidebarLegendClass !== "disappear"){
- $("#legendSymbologyCollapse").click();
- }
- },
- onPrev: function(tour){
- if($scope.sidebarLegendClass !== "disappear"){
- $("#sidebarLegendCollapse").click();
- }
- }
- },
- {
- element: "#kommonitorIndicatorBasicMetadata",
- title: "Indikator-Metadaten, Einstellung- und Exportmöglichkeiten",
- placement: "left",
- content: "Im oberen Bereich sind der Name eine kurze Beschreibung sowie das Fortführungsintervall des angezeigten Indikators zu finden. " +
- "Im mittleren Bereich kann die angezeigte Raumebene per Dropdown-Liste gewechselt, der Zeitpunkt per Kalenderauswahl gewählt sowie " +
- "die Transparenz der Kartendarstellung per Schieberegler angepasst werden. " +
- "Der untere Bereich bietet Exportmöglichkeiten für die angezeigten Daten in den Formaten GeoJSON, ESRI Shapefile sowie CSV. " +
- "Zudem kann ein Metadatenblatt aller Metadaten des dargestellten Indikators als PDF-Datei heruntergeladen werden.",
- onNext: function(tour){
- if($scope.sidebarLegendClass !== "disappear"){
- $("#indicatorBasicMetadataCollapse").click();
- $("#legendSymbologyCollapse").click();
- }
- },
- onPrev: function(tour){
- if($scope.sidebarLegendClass !== "disappear"){
- $("#legendSymbologyCollapse").click();
- }
- }
- },
- {
- element: "#kommonitorLegendSymbology",
- title: "Kartenlegenden und Interpretation",
- placement: "left",
- content: "Dieser Bereich beinhaltet eine Farblegende mit fünf Klassen für den angezeigten Indikator sowie die Wertebereiche und Fallzahlen je Klasse " +
- "Als ergänzende Informationen werden der Indikatortyp, der Stichtag, die Einheit sowie eine kurze Interpretationshilfe angezeigt." +
- "Die einzelnen Reiter ganz oben ermöglichen den Wechsel zwischen verschiedenen Legenden, sofern zusätzlich zu einem Indikator " +
- "auch die Legende für berechnete Isochronen, ein Routingergebnis oder einen eingebundenen WMS-Dienst angezeigt werden sollen.",
- onNext: function(tour){
- if($scope.sidebarLegendClass !== "disappear"){
- $("#legendSymbologyCollapse").click();
- $("#indicatorClassificationCollapse").click();
- }
- },
- onPrev: function(tour){
- if($scope.sidebarLegendClass !== "disappear"){
- $("#legendSymbologyCollapse").click();
- $("#indicatorBasicMetadataCollapse").click();
- }
- }
- },
- {
- element: "#kommonitorIndicatorClassification",
- title: "Klassifikationsoptionen",
- placement: "left",
- content: "Hier kann zwischen den drei KlassifizierungsmethodenJenks, Gleiches Intervall und Quantile gewählt werden " +
- " Detaillierte Informationen zu den Klassifizierungsmethoden können dem Popup entnommen werden, das beim Herüberfahren mit dem Mauszeiger über eine der drei Optionen erscheint. " +
- " Zudem lässt sich per einstellen, ob die Klassifizierung die Indikatorenwerte der gesamten Zeitreihe berücksichtigen soll, oder nur jene des aktuellen Zeitschnitts. " +
- "So kann ein vergleichbares Kartenbild für eine komplette Zeitreihe gewährleistet werden. " +
- " KomMonitor überprüft jeden Indikatorendatensatz auf statistische Ausreißer. Werden ein oder mehrere Ausreißer erkannt, so können mit " +
- "Ausreißer gesondert markiert und aus der Klassifizierung entfernt werden. Dies kann hilfreich sein, " +
- "um ein differenzierteres Kartenbild zu erzeugen.",
- onNext: function(tour){
- if($scope.sidebarLegendClass !== "disappear"){
- $("#sidebarLegendCollapse").click();
- }
- },
- onPrev: function(tour){
- if($scope.sidebarLegendClass !== "disappear"){
- $("#legendSymbologyCollapse").click();
- $("#indicatorClassificationCollapse").click();
- }
- }
- },
- {
- element: "#dateSliderWrapper",
- title: "Zeitstrahl",
- placement: "top",
- content: "Die Zeitleiste am unteren Bildschirmrand enthält die verfügbaren Zeitschnitte des selektierten Indikators. Standardmäßig ist der aktuellste Zeitschnitt voreingestellt. "+
- " Durch ein Klicken auf einen beliebigen Punkt der Leiste oder durch Verschieben des runden Auswahlknopfs kann ein anderer Zeitschnitt gewählt werden.",
- onPrev: function(tour){
- if($scope.sidebarLegendClass === "disappear"){
- $("#sidebarLegendCollapse").click();
- }
- }
- },
- {
- element: "#mapUtilButtons",
- title: "Steuerung der Kartendarstellung",
- placement: "bottom",
- content: "Diese Buttons bieten Steuerungsmöglichkeiten für die Kartendarstellung. Über und kann alternativ zur Verwendung des Mausrades hinein- bzw. hinausgezoomt werden. "+
- "
zentriert die Karte und zoomt auf die maximale Ausdehnung des dargestellten Themas. " +
- "
hebt jegliche benutzerdefinierte Selektionen auf. " +
- "
erlaubt den Export des aktuellen Kartenausschnitts als Bilddatei. " +
- "
bietet die Möglichkeit, einzelne Karteninhalte temporär auszublenden oder die Hintergrundkarte zu wechseln. " +
- "
ermöglicht das Filtern innerhalb dargestellter Vektorlayer anhand des Namens oder der ID vorhandener Raumelemente. " +
- "
repräsentiert eine Geolokalisierung von Adressen und Orten. " +
- "
Darüber hinaus bietet eine Messfunktion für Abstände und Flächen."
- },
- {
- element: "#sideBarButtons",
- title: "Menü-Buttons",
- placement: "right",
- content: "Diese Buttons öffnen jeweils ein linksseitig angeordnetets Menü mitzusätzlichen Funktionen. Jedes einzelne Menü wird in den folgenden Schritten kurz erläutert."
- },
- {
- element: "#sidebarIndicatorConfigCollapse",
- title: "Indikatorenkatalog und Metadaten",
- placement: "right",
- content: "Ein Klick auf diesen Button öffnet das Indikatoren-Auswahl-Fenster.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
- onNext: function(tour){
- if($scope.sidebarIndicatorConfigClass === "disappear"){
- $("#sidebarIndicatorConfigCollapse").click();
- }
- }
- },
- {
- element: "#indicatorSetup",
- title: "Indikatorenkatalog und Metadaten",
- placement: "right",
- content: "Dieses Menü enthält eine Übersicht aller verfügbarer Indikatoren sowie die Option, " +
- "den aktuell betrachteten Indikator zu wechseln.
Indikatoren können in Form einer Themenhierarchie im Datenkatalog oder in einer " +
- "alphabetischen Liste betrachtet und selektiert werden. " +
- "Einen transparenten Zugang zu zusammenschauenden, bewertenden Indikatoren bietet die Leitindikatoren-Hierarchie." +
- "Hiermit können Leitindikatoren sowie die zur Berechnung verwendeten Basis-Indikatoren aufgerufen und deren Verknüpfung nachvollzogen werden. " +
- "Auch die Metadaten des ausgewählten Indikators können hier detailliert eingesehen werden.",
- onNext: function(tour){
- if($scope.sidebarIndicatorConfigClass !== "disappear"){
- $("#sidebarIndicatorConfigCollapse").click();
- }
- },
- onPrev: function(tour){
- if($scope.sidebarIndicatorConfigClass !== "disappear"){
- $("#sidebarIndicatorConfigCollapse").click();
- }
- }
- },
- {
- element: "#sidebarPoiCollapse",
- title: "Georessourcen und -dienste",
- placement: "right",
- content: "Ein Klick auf diesen Button öffnet das Georessourcen Fenster.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
- onNext: function(tour){
- if($scope.sidebarPoiClass === "disappear"){
- $("#sidebarPoiCollapse").click();
- }
- },
- onPrev: function(tour){
- if($scope.sidebarIndicatorConfigClass === "disappear"){
- $("#sidebarIndicatorConfigCollapse").click();
- }
- }
- },
- {
- element: "#poi",
- title: "Georessourcen und -dienste",
- placement: "right",
- content: "Zur Überlagerung von flächenhaft dargestellten Indikatoren mit weiteren relevanten Geodaten können Punkt- Linien und Flächendaten sowie Geodatendienste " +
- "zur Karte hinzugefügt werden. Hinzufügen und Entfernen dieser Datensätze geschieht dabei durch (De-) Selektion der Auswahlbox links neben dem jeweiligen Datensatz. " +
- "
In der Standardkonfiguration werden Punktdaten räumlich zu sogenannten Cluster-Punkten zusammengefasst, um die Darstellung je nach Zoom-Stufe zu optimieren und " +
- "selbst bei bei vielen Punkten eine übersichtliche Darstellung zu gewährleisten." +
- "Über eine entsprechende Auswahloption können jedoch bei jeder Zoomstufe wahlweise auch alle Einzelpunkte angezeigt werden. " +
- "
Hinweis zum Zeitbezug der darzustellenden Daten: Der Abruf eines Punkt-, Linien- oder Flächendatensatzes bezieht sich immer auf ein Datum. " +
- "Standardmäßig wird der aktuelle Zeitpunkt des dargestellten Indikators verwendet. Diese Option kann jedoch auf ein beliebiges frei definierbares Datum oder eine " +
- "listenbasierte Auswahl verfügbarer Zeitpunkte jedes Datensatzes abgeändert werden.",
- onNext: function(tour){
- if($scope.sidebarPoiClass !== "disappear"){
- $("#sidebarPoiCollapse").click();
- }
- },
- onPrev: function(tour){
- if($scope.sidebarPoiClass !== "disappear"){
- $("#sidebarPoiCollapse").click();
- }
- }
- },
- // {
- // element: "#sidebarDataImportCollapse",
- // title: "Datenimport aus externen Quellen",
- // placement: "right",
- // content: "Ein Klick auf diesen Button öffnet das Datenimport Fenster.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
- // onNext: function(tour){
- // if($scope.sidebarDataImportClass === "disappear"){
- // $("#sidebarDataImportCollapse").click();
- // }
- // }
- // },
- // {
- // element: "#dataImport",
- // title: "Datenimport aus externen Quellen",
- // placement: "right",
- // content: "Dieses Fenster bietet Optionen zum Datenimport aus externen Datenquellen, insbesondere mittels Web Map Services und Datei-basierten Quellen wie GeoJSON oder ESRI Shape.
Jeder WMS-Datensatz wird tabellarisch inklusive Titel, Beschreibung, Transparenzschieberegler, URL und Legende dargestellt. Durch Anhaken/Deselektion der Checkbox kann ein Datensatz hinzugefügt/entfernt werden. Neben den bereits vorkonfigurierten Datensätzen lassen sich weitere Quellen über den unten stehenden Button ergänzen.
Die Möglichkeit Layer aus einer lokalen Datei einzuladen wird in Kürze verfügbar sein.",
- // onNext: function(tour){
- // if($scope.sidebarDataImportClass !== "disappear"){
- // $("#sidebarDataImportCollapse").click();
- // }
- // },
- // onPrev: function(tour){
- // if($scope.sidebarDataImportClass !== "disappear"){
- // $("#sidebarDataImportCollapse").click();
- // }
- // }
- // },
- {
- element: "#sidebarFilterCollapse",
- title: "Darstellungsfilter",
- placement: "right",
- content: "Ein Klick auf diesen Button öffnet ein Fenster zur Definition von Darstellungsfiltern.
Darüber hinaus können je nach Fragestellung die Raumebenen-Geometrien (z.B. Stadtteile) auf diejenigen eingeschränkt werden, die zur Beantwortung der Fragestellung beitragen.
- content: "Hier können verschiedene Darstellungsfilter angewendet werden, die sich auf die kartografische Darstellung auswirken. " +
- "Über den Wertebereichsfilter können die angezeigten Raumeinheiten anhand der Wertausprägung des angezeigten Indikators gefiltert werden. " +
- "Dazu kann der Schieberegler an dem minimalen und maximalen Werten nach rechts oder links geschoben werden. Alternativ kann die untere und/oder obere Grenze " +
- "auch als Zahlenwert eingetragen werden. " +
- "Eine weitere Option ist die dynamische Schwellenwertklassifizierung, bei der ein spezifischer Wert definiert werden kann, " +
- "der die Indikator-Darstellung in zwei Bereiche unterteilt (oberhalb und unterhalb des Schwellenwerts) und entsprechend farbig darstellt.",
- onNext: function(tour){
- if($scope.sidebarFilterClass !== "disappear"){
- $("#sidebarFilterCollapse").click();
- }
- },
- onPrev: function(tour){
- if($scope.sidebarFilterClass !== "disappear"){
- $("#sidebarFilterCollapse").click();
- }
- }
- },
- {
- element: "#sidebarBalanceCollapse",
- title: "Zeitliche Bilanzierung",
- placement: "right",
- content: "Ein Klick auf diesen Button öffnet ein Fenster zur zeitlichen Bilanzierung des aktuell dargestellten Indikators. " +
- "
Im nächsten Schritt wird das Menü automatisch geöffnet.",
- onNext: function(tour){
- if($scope.sidebarBalanceClass === "disappear"){
- $("#sidebarBalanceCollapse").click();
- }
- },
- onPrev: function(tour){
- if($scope.sidebarFilterClass === "disappear"){
- $("#sidebarFilterCollapse").click();
- }
- }
- },
- {
- element: "#kommonitorBalance",
- title: "Zeitliche Bilanzierung",
- placement: "right",
- content: "Bei der zeitlichen Bilanzierung steht die Wertentwicklung eines Indikators über die Zeit im Fokus (z. B. Wachstum / Schrumpfung). " +
- "Wird die Bilanzierung anhand der Auswahlbox aktiviert, kann über die Zeitleiste ein Start- sowie ein Endzeitpunkt festgelegt werden. " +
- "Für diesen spezifizifischen Betrachtungszeitraum wird dann automatisch die Wertentwicklung des angezeigten Indikators berechnet und dargestellt. " +
- "
Auch die Indikatoren-Legende am rechten Rand der Anwendung beinhaltet dann die Information, dass eine Bilanz des Indikators dargestellt wird. " +
- "
Der Trendverlauf im Betrachtungszeitraumwird zudem in Form eines Liniendiagrammes visualisiert. " +
- " Zur Trendberechnung kann in KomMonitor zwischen einer linearen, exponentiellen und polynomialen Herleitung gewählt werden. " +
- " Des Weiteren sind statistische Merkmale der gewählten Trendbetrachtung hinterlegt. Hierzu zählen beispielsweise Standardabweichung, Varianz, Mittelwert und Median sowie " +
- "die Art des Trendverlaufes. " +
- "
Bitte beachten Sie, dass eine Bilanzierung nur bei Status-Indikatoren möglich ist, " +
- "deren Zeitreihe mehr als einen Zeitpunkt enthält.",
- onNext: function(tour){
- if($scope.sidebarBalanceClass !== "disappear"){
- $("#sidebarBalanceCollapse").click();
- }
- },
- onPrev: function(tour){
- if($scope.sidebarBalanceClass !== "disappear"){
- $("#sidebarBalanceCollapse").click();
- }
- }
- },
- {
- element: "#sidebarDiagramsCollapse",
- title: "Statistische Diagramme",
- placement: "right",
- content: "Ein Klick auf diesen Button öffnet ein Fenster mit statistischen Diagrammen. " +
- "
Ein Ranking der jeweiligen Raumeinheiten wird anhand eines Säulendiagramms dargestellt. " +
- "
Das untere Liniendiagramm visualisiert die zeitliche Entwicklung des aktuellen Indikators über alle jeweils verfügbaren Zeitschnitte. " +
- "Als Zusatzinformation wird hier der Durchschnittswert über alle Raumeinheiten dargestellt. " +
- "
Um einzelne Elemente der gewählten Raumebene im Säulen- und Liniendiagramm zu betrachten und hervorzuheben, " +
- "kann mit dem Mauszeiger entweder über die Säule innerhalb des Säulendiagramms oder über das jeweilige Element in der Karte gefahren werden. " +
- "Eine dauerhafte Selektion durch Klicken auf das kartografische Element oder die dazugehörige Säule ermöglicht das simultane Betrachten mehrerer Elemente. " +
- "
Jedes Diagramm enthält in der oberen rechte Ecke eine Toolbox, über die das Diagramm entweder als Bilddatei oder im Tabellenformatexportiert werden kann.",
- onNext: function(tour){
- if($scope.sidebarDiagramsClass !== "disappear"){
- $("#sidebarDiagramsCollapse").click();
- }
- },
- onPrev: function(tour){
- if($scope.sidebarDiagramsClass !== "disappear"){
- $("#sidebarDiagramsCollapse").click();
- }
- }
- },
- {
- element: "#sidebarRadarDiagramCollapse",
- title: "Indikatorenradar",
- placement: "right",
- content: "Ein Klick auf diesen Button öffnet das Indiktorenradar für die Querschnittsbetrachtung mehrerer Indikatoren.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
- onNext: function(tour){
- if($scope.sidebarRadarDiagramClass === "disappear"){
- $("#sidebarRadarDiagramCollapse").click();
- }
- },
- onPrev: function(tour){
- if($scope.sidebarDiagramsClass === "disappear"){
- $("#sidebarDiagramsCollapse").click();
- }
- }
- },
- {
- element: "#indicatorRadar",
- title: "Indikatorenradar",
- placement: "right",
- content: "Das Indikatorenradar eignet sich insbesondere für die querschnittsorientierte Betrachtung mehrerer Indikatoren. " +
- " Für die Anzeige eines solchen Diagramms, selektieren Sie bitte mindestens drei Indikatoren aus der oben stehenden Liste.
" +
- "Für jeden gewählten Indikator wird im Diagramm eine Achse genutzt, auf der einzelne Raumeinheiten anhand ihrer Wertausprägung abgetragen werden. " +
- "Jede Achse wird dabei durch Minimum und Maximum der Werte des betrachteten Indikators gebildet (daher ist die Radarmitte ausdrücklich nicht zwingend " +
- "mit dem Wert '0' gleichzusetzen, sondern mit dem Minimalwert des Indikators).
Auch hier ist der Durchschnitt aller Raumeinheiten bereits vorberechnet und " +
- "einzelne Elemente können mittels Selektion innerhalb der Karte dem Radar hinzugefügt werden. Die Indikatorenauswahl umfasst dabei nur solche Indikatoren, " +
- "die die gewählte Raumebene und den aktuell gewählten Zeitschnitt unterstützen.
Auch das Radardiagramm besitzt in der oberen rechte Ecke eine " +
- "Toolbox, über die das Diagramm entweder als Bilddatei oder im Tabellenformatexportiert werden kann",
- onNext: function(tour){
- if($scope.sidebarRadarDiagramClass !== "disappear"){
- $("#sidebarRadarDiagramCollapse").click();
- }
- },
- onPrev: function(tour){
- if($scope.sidebarRadarDiagramClass !== "disappear"){
- $("#sidebarRadarDiagramCollapse").click();
- }
- }
- },
- {
- element: "#sidebarRegressionDiagramCollapse",
- title: "Regressionsdiagramm",
- placement: "right",
- content: "Ein Klick auf diesen Button öffnet das Fenster zur Definition von Regressionsdiagrammen.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
- onNext: function(tour){
- if($scope.sidebarRegressionDiagramClass === "disappear"){
- $("#sidebarRegressionDiagramCollapse").click();
- }
- },
- onPrev: function(tour){
- if($scope.sidebarRadarDiagramClass === "disappear"){
- $("#sidebarRadarDiagramCollapse").click();
- }
- }
- },
- {
- element: "#indicatorRegression",
- title: "Regressionsdiagramm",
- placement: "right",
- content: "Als exemplarischer weiterer Diagrammtyp unterstützt KomMonitor die Berechnung einer linearen Regression zwischen zwei zu wählenden Indikatoren, um insbesondere die Korrelation zwischen diesen zu betrachten. Nach Auswahl der Indikatoren werden die Regressionsgerade und alle Elemente der gewählten Raumebene gemäß ihrer Wertausprägungen entlang der Indikatorenachsen im Diagramm abgetragen.
Beim Überfahren eines Datenpunkts mit der Maus im Diagramm oder einer in der Karte dargestellten Raumeinheit, wird das jeweilige Pendant visuell hervorgehoben.
Die Indikatorenauswahl umfasst dabei nur solche Indikatoren, die die gewählte Raumebene und den aktuell gewählten Zeitschnitt unterstützen.
Auch das Regressionsdiagramm besitzt in der oberen rechte Ecke eine Toolbox, über die das Diagramm entweder als Bilddatei oder im Tabellenformatexportiert werden kann.",
- onNext: function(tour){
- if($scope.sidebarRegressionDiagramClass !== "disappear"){
- $("#sidebarRegressionDiagramCollapse").click();
- }
- },
- onPrev: function(tour){
- if($scope.sidebarRegressionDiagramClass !== "disappear"){
- $("#sidebarRegressionDiagramCollapse").click();
- }
- }
- },
- {
- element: "#sidebarReachabilityCollapse",
- title: "Erreichbarkeitsanalysen",
- placement: "right",
- content: "Ein Klick auf diesen Button öffnet ein Fenster für Erreichbarkeitsanalysen.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
- onNext: function(tour){
- if($scope.sidebarReachabilityClass === "disappear"){
- $("#sidebarReachabilityCollapse").click();
- }
- },
- onPrev: function(tour){
- if($scope.sidebarRegressionDiagramClass === "disappear"){
- $("#sidebarRegressionDiagramCollapse").click();
- }
- }
- },
- {
- element: "#kommonitorReachability",
- title: "Erreichbarkeitsanalysen",
- placement: "right",
- content: "Als GIS-basiertes Werkzeug soll KomMonitor ausgewählte räumliche Analysen unterstützen. " +
- "Insbesondere stehen Erreichbarkeitsanalysen im Fokus, bei denen, neben reinen Puffer-basierten Ansätzen, " +
- "Erreichbarkeiten anhand tatsächlicher Wegenetze für verschiedene Transportmittel (z.B. Fußgänger, Fahrrad, Auto) "+
- "berechnet werden können. Konkret soll hierbei sowohl ein Routing zwischen einzelnen Punkten sowie " +
- "die Berechnung von Isochronen (Äquidistanzen und zeitliches Abbruchkriterium) angeboten werden.
" +
- "Auswahl der Startpunkte " +
- "Die Auswahl der Startpunkte kann entweder über die Selektion eines vorhandenen Punktdatensatzes vorgenommen werden oder mittels Einzeichnen eigener beliebiger Punkte in die Karte.
" +
- "Ergebnisdarstellung " +
- "Sowohl Isochronen- als auch Routingergebnisse werden der Karte als neuer, eigener Layer hinzugefügt. " +
- "Die jeweilige Legende über jeweiligen Reiter des rechten Legendenmenüs einsehbar.
"+
- "Punkt in Isochronen Analyse " +
- "Nachdem eine Isochronenberechnung erfolgt ist, können vorhandene Punktdatensätze räumlich mit den Isochronen verschnitten werden, bspw. um eine Umfeldanalyse für relevante Einrichtungen durchzuführen.",
- onNext: function(tour){
- if($scope.sidebarReachabilityClass !== "disappear"){
- $("#sidebarReachabilityCollapse").click();
- }
- },
- onPrev: function(tour){
- if($scope.sidebarReachabilityClass !== "disappear"){
- $("#sidebarReachabilityCollapse").click();
- }
- }
- },
- {
- element: "#map",
- title: "Vielen Dank für die Nutzung der Guided Tour von KomMonitor!",
- placement: "left",
- content: "Wir hoffen, die Erläuterungen konnten einen guten Einblick in die Funktionen bieten, " +
- "bei der ersten Orientierung helfen und die zukünftige Nutzung erleichtern! " +
- "Kritik, Anregungen oder Fragen sind jederzeit willkommen.(siehe Begrüßungsfenster für den Kontakt). " +
- "Viel Spaß bei der Nutzung von KomMonitor! ",
- onNext: function(tour){
- kommonitorDataExchangeService.guidedTour = undefined; // ends the tour
- }
- }
- // {
- // element: "#sidebarProcessingCollapse",
- // title: "Individuelle Indikatoren-Neuberechnung",
- // placement: "right",
- // content: "Ein Klick auf diesen Button öffnet ein Fenster zur individuellen Neuberechnung einzelner Indikatoren.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
- // onNext: function(tour){
- // if($scope.sidebarProcessingClass === "disappear"){
- // $("#sidebarProcessingCollapse").click();
- // }
- // },
- // onPrev: function(tour){
- // if($scope.sidebarReachabilityClass === "disappear"){
- // $("#sidebarReachabilityCollapse").click();
- // }
- // }
- // },
- // {
- // element: "#indicatorProcessing",
- // title: "Individuelle Indikatoren-Neuberechnung",
- // placement: "right",
- // content: "KomMonitor ist mehr als nur ein Darstellungswerkzeug. Es ermöglicht insbesondere auch die automatisierte Berechnung von Indikatoren. Je nach Berechnungsvorschrift kann es dabei konfigurierbare Parameter geben, die die resultierenden Indikatorenwerte beeinflussen (bspw. eine maximle Distanz bei Erreichbarkeiten oder Gewichtungen grundlegender Eingangsdaten).
Dieses Menü bietet die Möglichkeit einer Nutzer-definierten Neuberechnung von Indikatoren mit mindestens einem konfigurierbaren Parameter. Das jeweilige Berechnungsergebnis steht anschließend temporär zur Verfügung und kann bei Bedarf exportiert werden.
Künftig sollen darüber hinaus unmittelbare Vergleiche mit der 'Standard'-Variante des Indikators angeboten werden. Diese sind jedoch zum gegenwärtigen Zeitpunkt noch nicht in der Anwendung umgesetzt.",
- // onNext: function(tour){
- // if($scope.sidebarProcessingClass !== "disappear"){
- // $("#sidebarProcessingCollapse").click();
- // }
- // },
- // onPrev: function(tour){
- // if($scope.sidebarProcessingClass !== "disappear"){
- // $("#sidebarProcessingCollapse").click();
- // }
- // }
- // }
- ],
- onShown: function(tour) {
- // add shortcut to toc to each title
- let titleElement = document.getElementsByClassName("popover-title").item(0);
- titleElement.innerHTML +=
- "" +
- "";
- $compile(titleElement)($scope); // let angularjs know that there is new html, add the ng-click event
- }
- };
-
- $scope.generateTableOfContent = function() {
- let prevStepTitle = undefined;
- for(var i=0;i<$scope.tourOptions.steps.length;i++) {
- let step = $scope.tourOptions.steps[i];
- // only show the first guided tour step for each subtheme
- // specifically exclude "Individuelle Indikatoren-Neuberechnung" for now as it is not shown in the guided tour
- if (step.title !== prevStepTitle && step.title !== "Individuelle Indikatoren-Neuberechnung") {
- let html = "
",
+ steps: [
+ {
+ element: "#map",
+ title: "Willkommen zur Guided Tour von KomMonitor",
+ placement: "left",
+ content: "In dieser Tour werden die Funktionalitäten der Weboberfläche erläutert. Hier werden sie mit den Elementen der Oberfläche sowie den verschiedenen Buttons vertraut gemacht. " +
+ " Die Tour kann jederzeit über den Button Guided Tour beenden verlassen werden. ",
+ onNext: function (tour) {
+ if ($scope.sidebarLegendClass !== "disappear") {
+ $("#sidebarLegendCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#map",
+ title: "Inhaltsverzeichnis",
+ placement: "top",
+ content: "",
+ onNext: function (tour) {
+ if ($scope.sidebarLegendClass !== "disappear") {
+ $("#sidebarLegendCollapse").click();
+ }
+ },
+ onShown: function (tour) {
+ $scope.generateTableOfContent();
+ }
+ },
+ {
+ element: "#header",
+ title: "Kopfzeile",
+ placement: "bottom",
+ content: "In der Kopfzeile befinden sich neben den Logos und dem Titel der Webanwendung mehrere Buttons. " +
+ "Mit kann zwischen einer vereinfachten und einer erweiterten Ansicht gewechselt werden. " +
+ "Diese Guided Tour kann stets erneut mit aufgerufen werden. " +
+ " öffnet das beim Aufruf der Seite erschienene Informationsfenster und" +
+ " ermöglicht mit entsprechenden Zugangsdaten den Zugang zur Administrationsoberfläche."
+ },
+ {
+ element: "#map",
+ title: "Kartenfenster",
+ placement: "top",
+ content: "Die Standardansicht besteht aus einer kartografischen Darstellung, die bereits eine Hintergrundkarte und einen Indikator anzeigt. In dieser Darstellung können Sie in der " +
+ "Karte frei navigieren (zoomen, verschieben) und beim Herüberfahren mit dem Mauszeiger über eine der Raumeinheiten werden der Name, der Wert und die Einheit des dargestellten Indikators angezeigt.",
+ // onNext: function(tour){
+ // // make sure that legend control is displayed
+ // var control = document.getElementById("legendControl");
+ // var controlButton = document.getElementById("toggleLegendControlButton");
+ // if(control.style.display === "none" || (controlButton.style.display !== undefined && controlButton.style.display !== "none")){
+ // $rootScope.$broadcast("toggleLegendControl");
+ // }
+ // },
+ onNext: function (tour) {
+ if ($scope.sidebarLegendClass === "disappear") {
+ $("#sidebarLegendCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#kommonitorLegend",
+ title: "Indikatorenlegende und Klassifizierung",
+ placement: "left",
+ content: "Dieses Element ist in drei Teilbereiche untergliedert, welche 1. die wichtigsten Metadaten des dargestellten Indikator abbilden, " +
+ "2. Kartenlegenden zur Interpretation der Karteninhalte anbieten und 3. weitergehende Möglichkeiten zur Klassifizierung bieten.",
+ onNext: function (tour) {
+ if ($scope.sidebarLegendClass !== "disappear") {
+ $("#legendSymbologyCollapse").click();
+ }
+ },
+ onPrev: function (tour) {
+ if ($scope.sidebarLegendClass !== "disappear") {
+ $("#sidebarLegendCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#kommonitorIndicatorBasicMetadata",
+ title: "Indikator-Metadaten, Einstellung- und Exportmöglichkeiten",
+ placement: "left",
+ content: "Im oberen Bereich sind der Name eine kurze Beschreibung sowie das Fortführungsintervall des angezeigten Indikators zu finden. " +
+ "Im mittleren Bereich kann die angezeigte Raumebene per Dropdown-Liste gewechselt, der Zeitpunkt per Kalenderauswahl gewählt sowie " +
+ "die Transparenz der Kartendarstellung per Schieberegler angepasst werden. " +
+ "Der untere Bereich bietet Exportmöglichkeiten für die angezeigten Daten in den Formaten GeoJSON, ESRI Shapefile sowie CSV. " +
+ "Zudem kann ein Metadatenblatt aller Metadaten des dargestellten Indikators als PDF-Datei heruntergeladen werden.",
+ onNext: function (tour) {
+ if ($scope.sidebarLegendClass !== "disappear") {
+ $("#indicatorBasicMetadataCollapse").click();
+ $("#legendSymbologyCollapse").click();
+ }
+ },
+ onPrev: function (tour) {
+ if ($scope.sidebarLegendClass !== "disappear") {
+ $("#legendSymbologyCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#kommonitorLegendSymbology",
+ title: "Kartenlegenden und Interpretation",
+ placement: "left",
+ content: "Dieser Bereich beinhaltet eine Farblegende mit fünf Klassen für den angezeigten Indikator sowie die Wertebereiche und Fallzahlen je Klasse " +
+ "Als ergänzende Informationen werden der Indikatortyp, der Stichtag, die Einheit sowie eine kurze Interpretationshilfe angezeigt." +
+ "Die einzelnen Reiter ganz oben ermöglichen den Wechsel zwischen verschiedenen Legenden, sofern zusätzlich zu einem Indikator " +
+ "auch die Legende für berechnete Isochronen, ein Routingergebnis oder einen eingebundenen WMS-Dienst angezeigt werden sollen.",
+ onNext: function (tour) {
+ if ($scope.sidebarLegendClass !== "disappear") {
+ $("#legendSymbologyCollapse").click();
+ $("#indicatorClassificationCollapse").click();
+ }
+ },
+ onPrev: function (tour) {
+ if ($scope.sidebarLegendClass !== "disappear") {
+ $("#legendSymbologyCollapse").click();
+ $("#indicatorBasicMetadataCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#kommonitorIndicatorClassification",
+ title: "Klassifikationsoptionen",
+ placement: "left",
+ content: "Hier kann zwischen den drei KlassifizierungsmethodenJenks, Gleiches Intervall und Quantile gewählt werden " +
+ " Detaillierte Informationen zu den Klassifizierungsmethoden können dem Popup entnommen werden, das beim Herüberfahren mit dem Mauszeiger über eine der drei Optionen erscheint. " +
+ " Zudem lässt sich per einstellen, ob die Klassifizierung die Indikatorenwerte der gesamten Zeitreihe berücksichtigen soll, oder nur jene des aktuellen Zeitschnitts. " +
+ "So kann ein vergleichbares Kartenbild für eine komplette Zeitreihe gewährleistet werden. " +
+ " KomMonitor überprüft jeden Indikatorendatensatz auf statistische Ausreißer. Werden ein oder mehrere Ausreißer erkannt, so können mit " +
+ "Ausreißer gesondert markiert und aus der Klassifizierung entfernt werden. Dies kann hilfreich sein, " +
+ "um ein differenzierteres Kartenbild zu erzeugen.",
+ onNext: function (tour) {
+ if ($scope.sidebarLegendClass !== "disappear") {
+ $("#sidebarLegendCollapse").click();
+ }
+ },
+ onPrev: function (tour) {
+ if ($scope.sidebarLegendClass !== "disappear") {
+ $("#legendSymbologyCollapse").click();
+ $("#indicatorClassificationCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#dateSliderWrapper",
+ title: "Zeitstrahl",
+ placement: "top",
+ content: "Die Zeitleiste am unteren Bildschirmrand enthält die verfügbaren Zeitschnitte des selektierten Indikators. Standardmäßig ist der aktuellste Zeitschnitt voreingestellt. " +
+ " Durch ein Klicken auf einen beliebigen Punkt der Leiste oder durch Verschieben des runden Auswahlknopfs kann ein anderer Zeitschnitt gewählt werden.",
+ onPrev: function (tour) {
+ if ($scope.sidebarLegendClass === "disappear") {
+ $("#sidebarLegendCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#mapUtilButtons",
+ title: "Steuerung der Kartendarstellung",
+ placement: "bottom",
+ content: "Diese Buttons bieten Steuerungsmöglichkeiten für die Kartendarstellung. Über und kann alternativ zur Verwendung des Mausrades hinein- bzw. hinausgezoomt werden. " +
+ "
zentriert die Karte und zoomt auf die maximale Ausdehnung des dargestellten Themas. " +
+ "
hebt jegliche benutzerdefinierte Selektionen auf. " +
+ "
erlaubt den Export des aktuellen Kartenausschnitts als Bilddatei. " +
+ "
bietet die Möglichkeit, einzelne Karteninhalte temporär auszublenden oder die Hintergrundkarte zu wechseln. " +
+ "
ermöglicht das Filtern innerhalb dargestellter Vektorlayer anhand des Namens oder der ID vorhandener Raumelemente. " +
+ "
repräsentiert eine Geolokalisierung von Adressen und Orten. " +
+ "
Darüber hinaus bietet eine Messfunktion für Abstände und Flächen."
+ },
+ {
+ element: "#sideBarButtons",
+ title: "Menü-Buttons",
+ placement: "right",
+ content: "Diese Buttons öffnen jeweils ein linksseitig angeordnetets Menü mitzusätzlichen Funktionen. Jedes einzelne Menü wird in den folgenden Schritten kurz erläutert."
+ },
+ {
+ element: "#sidebarIndicatorConfigCollapse",
+ title: "Indikatorenkatalog und Metadaten",
+ placement: "right",
+ content: "Ein Klick auf diesen Button öffnet das Indikatoren-Auswahl-Fenster.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
+ onNext: function (tour) {
+ if ($scope.sidebarIndicatorConfigClass === "disappear") {
+ $("#sidebarIndicatorConfigCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#indicatorSetup",
+ title: "Indikatorenkatalog und Metadaten",
+ placement: "right",
+ content: "Dieses Menü enthält eine Übersicht aller verfügbarer Indikatoren sowie die Option, " +
+ "den aktuell betrachteten Indikator zu wechseln.
Indikatoren können in Form einer Themenhierarchie im Datenkatalog oder in einer " +
+ "alphabetischen Liste betrachtet und selektiert werden. " +
+ "Einen transparenten Zugang zu zusammenschauenden, bewertenden Indikatoren bietet die Leitindikatoren-Hierarchie." +
+ "Hiermit können Leitindikatoren sowie die zur Berechnung verwendeten Basis-Indikatoren aufgerufen und deren Verknüpfung nachvollzogen werden. " +
+ "Auch die Metadaten des ausgewählten Indikators können hier detailliert eingesehen werden.",
+ onNext: function (tour) {
+ if ($scope.sidebarIndicatorConfigClass !== "disappear") {
+ $("#sidebarIndicatorConfigCollapse").click();
+ }
+ },
+ onPrev: function (tour) {
+ if ($scope.sidebarIndicatorConfigClass !== "disappear") {
+ $("#sidebarIndicatorConfigCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#sidebarPoiCollapse",
+ title: "Georessourcen und -dienste",
+ placement: "right",
+ content: "Ein Klick auf diesen Button öffnet das Georessourcen Fenster.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
+ onNext: function (tour) {
+ if ($scope.sidebarPoiClass === "disappear") {
+ $("#sidebarPoiCollapse").click();
+ }
+ },
+ onPrev: function (tour) {
+ if ($scope.sidebarIndicatorConfigClass === "disappear") {
+ $("#sidebarIndicatorConfigCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#poi",
+ title: "Georessourcen und -dienste",
+ placement: "right",
+ content: "Zur Überlagerung von flächenhaft dargestellten Indikatoren mit weiteren relevanten Geodaten können Punkt- Linien und Flächendaten sowie Geodatendienste " +
+ "zur Karte hinzugefügt werden. Hinzufügen und Entfernen dieser Datensätze geschieht dabei durch (De-) Selektion der Auswahlbox links neben dem jeweiligen Datensatz. " +
+ "
In der Standardkonfiguration werden Punktdaten räumlich zu sogenannten Cluster-Punkten zusammengefasst, um die Darstellung je nach Zoom-Stufe zu optimieren und " +
+ "selbst bei bei vielen Punkten eine übersichtliche Darstellung zu gewährleisten." +
+ "Über eine entsprechende Auswahloption können jedoch bei jeder Zoomstufe wahlweise auch alle Einzelpunkte angezeigt werden. " +
+ "
Hinweis zum Zeitbezug der darzustellenden Daten: Der Abruf eines Punkt-, Linien- oder Flächendatensatzes bezieht sich immer auf ein Datum. " +
+ "Standardmäßig wird der aktuelle Zeitpunkt des dargestellten Indikators verwendet. Diese Option kann jedoch auf ein beliebiges frei definierbares Datum oder eine " +
+ "listenbasierte Auswahl verfügbarer Zeitpunkte jedes Datensatzes abgeändert werden.",
+ onNext: function (tour) {
+ if ($scope.sidebarPoiClass !== "disappear") {
+ $("#sidebarPoiCollapse").click();
+ }
+ },
+ onPrev: function (tour) {
+ if ($scope.sidebarPoiClass !== "disappear") {
+ $("#sidebarPoiCollapse").click();
+ }
+ }
+ },
+ // {
+ // element: "#sidebarDataImportCollapse",
+ // title: "Datenimport aus externen Quellen",
+ // placement: "right",
+ // content: "Ein Klick auf diesen Button öffnet das Datenimport Fenster.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
+ // onNext: function(tour){
+ // if($scope.sidebarDataImportClass === "disappear"){
+ // $("#sidebarDataImportCollapse").click();
+ // }
+ // }
+ // },
+ // {
+ // element: "#dataImport",
+ // title: "Datenimport aus externen Quellen",
+ // placement: "right",
+ // content: "Dieses Fenster bietet Optionen zum Datenimport aus externen Datenquellen, insbesondere mittels Web Map Services und Datei-basierten Quellen wie GeoJSON oder ESRI Shape.
Jeder WMS-Datensatz wird tabellarisch inklusive Titel, Beschreibung, Transparenzschieberegler, URL und Legende dargestellt. Durch Anhaken/Deselektion der Checkbox kann ein Datensatz hinzugefügt/entfernt werden. Neben den bereits vorkonfigurierten Datensätzen lassen sich weitere Quellen über den unten stehenden Button ergänzen.
Die Möglichkeit Layer aus einer lokalen Datei einzuladen wird in Kürze verfügbar sein.",
+ // onNext: function(tour){
+ // if($scope.sidebarDataImportClass !== "disappear"){
+ // $("#sidebarDataImportCollapse").click();
+ // }
+ // },
+ // onPrev: function(tour){
+ // if($scope.sidebarDataImportClass !== "disappear"){
+ // $("#sidebarDataImportCollapse").click();
+ // }
+ // }
+ // },
+ {
+ element: "#sidebarFilterCollapse",
+ title: "Darstellungsfilter",
+ placement: "right",
+ content: "Ein Klick auf diesen Button öffnet ein Fenster zur Definition von Darstellungsfiltern.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
+ onNext: function (tour) {
+ if ($scope.sidebarFilterClass === "disappear") {
+ $("#sidebarFilterCollapse").click();
+ }
+ },
+ onPrev: function (tour) {
+ if ($scope.sidebarPoiClass === "disappear") {
+ $("#sidebarPoiCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#kommonitorFilter",
+ title: "Darstellungsfilter",
+ placement: "right",
+ //
Darüber hinaus können je nach Fragestellung die Raumebenen-Geometrien (z.B. Stadtteile) auf diejenigen eingeschränkt werden, die zur Beantwortung der Fragestellung beitragen.
+ content: "Hier können verschiedene Darstellungsfilter angewendet werden, die sich auf die kartografische Darstellung auswirken. " +
+ "Über den Wertebereichsfilter können die angezeigten Raumeinheiten anhand der Wertausprägung des angezeigten Indikators gefiltert werden. " +
+ "Dazu kann der Schieberegler an dem minimalen und maximalen Werten nach rechts oder links geschoben werden. Alternativ kann die untere und/oder obere Grenze " +
+ "auch als Zahlenwert eingetragen werden. " +
+ "Eine weitere Option ist die dynamische Schwellenwertklassifizierung, bei der ein spezifischer Wert definiert werden kann, " +
+ "der die Indikator-Darstellung in zwei Bereiche unterteilt (oberhalb und unterhalb des Schwellenwerts) und entsprechend farbig darstellt.",
+ onNext: function (tour) {
+ if ($scope.sidebarFilterClass !== "disappear") {
+ $("#sidebarFilterCollapse").click();
+ }
+ },
+ onPrev: function (tour) {
+ if ($scope.sidebarFilterClass !== "disappear") {
+ $("#sidebarFilterCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#sidebarBalanceCollapse",
+ title: "Zeitliche Bilanzierung",
+ placement: "right",
+ content: "Ein Klick auf diesen Button öffnet ein Fenster zur zeitlichen Bilanzierung des aktuell dargestellten Indikators. " +
+ "
Im nächsten Schritt wird das Menü automatisch geöffnet.",
+ onNext: function (tour) {
+ if ($scope.sidebarBalanceClass === "disappear") {
+ $("#sidebarBalanceCollapse").click();
+ }
+ },
+ onPrev: function (tour) {
+ if ($scope.sidebarFilterClass === "disappear") {
+ $("#sidebarFilterCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#kommonitorBalance",
+ title: "Zeitliche Bilanzierung",
+ placement: "right",
+ content: "Bei der zeitlichen Bilanzierung steht die Wertentwicklung eines Indikators über die Zeit im Fokus (z. B. Wachstum / Schrumpfung). " +
+ "Wird die Bilanzierung anhand der Auswahlbox aktiviert, kann über die Zeitleiste ein Start- sowie ein Endzeitpunkt festgelegt werden. " +
+ "Für diesen spezifizifischen Betrachtungszeitraum wird dann automatisch die Wertentwicklung des angezeigten Indikators berechnet und dargestellt. " +
+ "
Auch die Indikatoren-Legende am rechten Rand der Anwendung beinhaltet dann die Information, dass eine Bilanz des Indikators dargestellt wird. " +
+ "
Der Trendverlauf im Betrachtungszeitraumwird zudem in Form eines Liniendiagrammes visualisiert. " +
+ " Zur Trendberechnung kann in KomMonitor zwischen einer linearen, exponentiellen und polynomialen Herleitung gewählt werden. " +
+ " Des Weiteren sind statistische Merkmale der gewählten Trendbetrachtung hinterlegt. Hierzu zählen beispielsweise Standardabweichung, Varianz, Mittelwert und Median sowie " +
+ "die Art des Trendverlaufes. " +
+ "
Bitte beachten Sie, dass eine Bilanzierung nur bei Status-Indikatoren möglich ist, " +
+ "deren Zeitreihe mehr als einen Zeitpunkt enthält.",
+ onNext: function (tour) {
+ if ($scope.sidebarBalanceClass !== "disappear") {
+ $("#sidebarBalanceCollapse").click();
+ }
+ },
+ onPrev: function (tour) {
+ if ($scope.sidebarBalanceClass !== "disappear") {
+ $("#sidebarBalanceCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#sidebarDiagramsCollapse",
+ title: "Statistische Diagramme",
+ placement: "right",
+ content: "Ein Klick auf diesen Button öffnet ein Fenster mit statistischen Diagrammen. " +
+ "
Im nächsten Schritt wird das Menü automatisch geöffnet.",
+ onNext: function (tour) {
+ if ($scope.sidebarDiagramsClass === "disappear") {
+ $("#sidebarDiagramsCollapse").click();
+ }
+ },
+ onPrev: function (tour) {
+ if ($scope.sidebarBalanceClass === "disappear") {
+ $("#sidebarBalanceCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#indicatorDiagrams",
+ title: "Statistische Diagramme",
+ placement: "right",
+ content: "Zusätzlich zur kartografischen Darstellung bieten grundlegende statistische Diagramme hilfreiche Zusatzinformationen zum gewählten Indikator. " +
+ "
Ein Ranking der jeweiligen Raumeinheiten wird anhand eines Säulendiagramms dargestellt. " +
+ "
Das untere Liniendiagramm visualisiert die zeitliche Entwicklung des aktuellen Indikators über alle jeweils verfügbaren Zeitschnitte. " +
+ "Als Zusatzinformation wird hier der Durchschnittswert über alle Raumeinheiten dargestellt. " +
+ "
Um einzelne Elemente der gewählten Raumebene im Säulen- und Liniendiagramm zu betrachten und hervorzuheben, " +
+ "kann mit dem Mauszeiger entweder über die Säule innerhalb des Säulendiagramms oder über das jeweilige Element in der Karte gefahren werden. " +
+ "Eine dauerhafte Selektion durch Klicken auf das kartografische Element oder die dazugehörige Säule ermöglicht das simultane Betrachten mehrerer Elemente. " +
+ "
Jedes Diagramm enthält in der oberen rechte Ecke eine Toolbox, über die das Diagramm entweder als Bilddatei oder im Tabellenformatexportiert werden kann.",
+ onNext: function (tour) {
+ if ($scope.sidebarDiagramsClass !== "disappear") {
+ $("#sidebarDiagramsCollapse").click();
+ }
+ },
+ onPrev: function (tour) {
+ if ($scope.sidebarDiagramsClass !== "disappear") {
+ $("#sidebarDiagramsCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#sidebarRadarDiagramCollapse",
+ title: "Indikatorenradar",
+ placement: "right",
+ content: "Ein Klick auf diesen Button öffnet das Indiktorenradar für die Querschnittsbetrachtung mehrerer Indikatoren.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
+ onNext: function (tour) {
+ if ($scope.sidebarRadarDiagramClass === "disappear") {
+ $("#sidebarRadarDiagramCollapse").click();
+ }
+ },
+ onPrev: function (tour) {
+ if ($scope.sidebarDiagramsClass === "disappear") {
+ $("#sidebarDiagramsCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#indicatorRadar",
+ title: "Indikatorenradar",
+ placement: "right",
+ content: "Das Indikatorenradar eignet sich insbesondere für die querschnittsorientierte Betrachtung mehrerer Indikatoren. " +
+ " Für die Anzeige eines solchen Diagramms, selektieren Sie bitte mindestens drei Indikatoren aus der oben stehenden Liste.
" +
+ "Für jeden gewählten Indikator wird im Diagramm eine Achse genutzt, auf der einzelne Raumeinheiten anhand ihrer Wertausprägung abgetragen werden. " +
+ "Jede Achse wird dabei durch Minimum und Maximum der Werte des betrachteten Indikators gebildet (daher ist die Radarmitte ausdrücklich nicht zwingend " +
+ "mit dem Wert '0' gleichzusetzen, sondern mit dem Minimalwert des Indikators).
Auch hier ist der Durchschnitt aller Raumeinheiten bereits vorberechnet und " +
+ "einzelne Elemente können mittels Selektion innerhalb der Karte dem Radar hinzugefügt werden. Die Indikatorenauswahl umfasst dabei nur solche Indikatoren, " +
+ "die die gewählte Raumebene und den aktuell gewählten Zeitschnitt unterstützen.
Auch das Radardiagramm besitzt in der oberen rechte Ecke eine " +
+ "Toolbox, über die das Diagramm entweder als Bilddatei oder im Tabellenformatexportiert werden kann",
+ onNext: function (tour) {
+ if ($scope.sidebarRadarDiagramClass !== "disappear") {
+ $("#sidebarRadarDiagramCollapse").click();
+ }
+ },
+ onPrev: function (tour) {
+ if ($scope.sidebarRadarDiagramClass !== "disappear") {
+ $("#sidebarRadarDiagramCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#sidebarRegressionDiagramCollapse",
+ title: "Regressionsdiagramm",
+ placement: "right",
+ content: "Ein Klick auf diesen Button öffnet das Fenster zur Definition von Regressionsdiagrammen.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
+ onNext: function (tour) {
+ if ($scope.sidebarRegressionDiagramClass === "disappear") {
+ $("#sidebarRegressionDiagramCollapse").click();
+ }
+ },
+ onPrev: function (tour) {
+ if ($scope.sidebarRadarDiagramClass === "disappear") {
+ $("#sidebarRadarDiagramCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#indicatorRegression",
+ title: "Regressionsdiagramm",
+ placement: "right",
+ content: "Als exemplarischer weiterer Diagrammtyp unterstützt KomMonitor die Berechnung einer linearen Regression zwischen zwei zu wählenden Indikatoren, um insbesondere die Korrelation zwischen diesen zu betrachten. Nach Auswahl der Indikatoren werden die Regressionsgerade und alle Elemente der gewählten Raumebene gemäß ihrer Wertausprägungen entlang der Indikatorenachsen im Diagramm abgetragen.
Beim Überfahren eines Datenpunkts mit der Maus im Diagramm oder einer in der Karte dargestellten Raumeinheit, wird das jeweilige Pendant visuell hervorgehoben.
Die Indikatorenauswahl umfasst dabei nur solche Indikatoren, die die gewählte Raumebene und den aktuell gewählten Zeitschnitt unterstützen.
Auch das Regressionsdiagramm besitzt in der oberen rechte Ecke eine Toolbox, über die das Diagramm entweder als Bilddatei oder im Tabellenformatexportiert werden kann.",
+ onNext: function (tour) {
+ if ($scope.sidebarRegressionDiagramClass !== "disappear") {
+ $("#sidebarRegressionDiagramCollapse").click();
+ }
+ },
+ onPrev: function (tour) {
+ if ($scope.sidebarRegressionDiagramClass !== "disappear") {
+ $("#sidebarRegressionDiagramCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#sidebarReachabilityCollapse",
+ title: "Erreichbarkeitsanalysen",
+ placement: "right",
+ content: "Ein Klick auf diesen Button öffnet ein Fenster für Erreichbarkeitsanalysen.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
+ onNext: function (tour) {
+ if ($scope.sidebarReachabilityClass === "disappear") {
+ $("#sidebarReachabilityCollapse").click();
+ }
+ },
+ onPrev: function (tour) {
+ if ($scope.sidebarRegressionDiagramClass === "disappear") {
+ $("#sidebarRegressionDiagramCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#kommonitorReachability",
+ title: "Erreichbarkeitsanalysen",
+ placement: "right",
+ content: "Als GIS-basiertes Werkzeug soll KomMonitor ausgewählte räumliche Analysen unterstützen. " +
+ "Insbesondere stehen Erreichbarkeitsanalysen im Fokus, bei denen, neben reinen Puffer-basierten Ansätzen, " +
+ "Erreichbarkeiten anhand tatsächlicher Wegenetze für verschiedene Transportmittel (z.B. Fußgänger, Fahrrad, Auto) " +
+ "berechnet werden können. Konkret soll hierbei sowohl ein Routing zwischen einzelnen Punkten sowie " +
+ "die Berechnung von Isochronen (Äquidistanzen und zeitliches Abbruchkriterium) angeboten werden.
" +
+ "Auswahl der Startpunkte " +
+ "Die Auswahl der Startpunkte kann entweder über die Selektion eines vorhandenen Punktdatensatzes vorgenommen werden oder mittels Einzeichnen eigener beliebiger Punkte in die Karte.
" +
+ "Ergebnisdarstellung " +
+ "Sowohl Isochronen- als auch Routingergebnisse werden der Karte als neuer, eigener Layer hinzugefügt. " +
+ "Die jeweilige Legende über jeweiligen Reiter des rechten Legendenmenüs einsehbar.
" +
+ "Punkt in Isochronen Analyse " +
+ "Nachdem eine Isochronenberechnung erfolgt ist, können vorhandene Punktdatensätze räumlich mit den Isochronen verschnitten werden, bspw. um eine Umfeldanalyse für relevante Einrichtungen durchzuführen.",
+ onNext: function (tour) {
+ if ($scope.sidebarReachabilityClass !== "disappear") {
+ $("#sidebarReachabilityCollapse").click();
+ }
+ },
+ onPrev: function (tour) {
+ if ($scope.sidebarReachabilityClass !== "disappear") {
+ $("#sidebarReachabilityCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#map",
+ title: "Vielen Dank für die Nutzung der Guided Tour von KomMonitor!",
+ placement: "left",
+ content: "Wir hoffen, die Erläuterungen konnten einen guten Einblick in die Funktionen bieten, " +
+ "bei der ersten Orientierung helfen und die zukünftige Nutzung erleichtern! " +
+ "Kritik, Anregungen oder Fragen sind jederzeit willkommen.(siehe Begrüßungsfenster für den Kontakt). " +
+ "Viel Spaß bei der Nutzung von KomMonitor! ",
+ onNext: function (tour) {
+ kommonitorDataExchangeService.guidedTour = undefined; // ends the tour
+ }
+ }
+ // {
+ // element: "#sidebarProcessingCollapse",
+ // title: "Individuelle Indikatoren-Neuberechnung",
+ // placement: "right",
+ // content: "Ein Klick auf diesen Button öffnet ein Fenster zur individuellen Neuberechnung einzelner Indikatoren.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
+ // onNext: function(tour){
+ // if($scope.sidebarProcessingClass === "disappear"){
+ // $("#sidebarProcessingCollapse").click();
+ // }
+ // },
+ // onPrev: function(tour){
+ // if($scope.sidebarReachabilityClass === "disappear"){
+ // $("#sidebarReachabilityCollapse").click();
+ // }
+ // }
+ // },
+ // {
+ // element: "#indicatorProcessing",
+ // title: "Individuelle Indikatoren-Neuberechnung",
+ // placement: "right",
+ // content: "KomMonitor ist mehr als nur ein Darstellungswerkzeug. Es ermöglicht insbesondere auch die automatisierte Berechnung von Indikatoren. Je nach Berechnungsvorschrift kann es dabei konfigurierbare Parameter geben, die die resultierenden Indikatorenwerte beeinflussen (bspw. eine maximle Distanz bei Erreichbarkeiten oder Gewichtungen grundlegender Eingangsdaten).
Dieses Menü bietet die Möglichkeit einer Nutzer-definierten Neuberechnung von Indikatoren mit mindestens einem konfigurierbaren Parameter. Das jeweilige Berechnungsergebnis steht anschließend temporär zur Verfügung und kann bei Bedarf exportiert werden.
Künftig sollen darüber hinaus unmittelbare Vergleiche mit der 'Standard'-Variante des Indikators angeboten werden. Diese sind jedoch zum gegenwärtigen Zeitpunkt noch nicht in der Anwendung umgesetzt.",
+ // onNext: function(tour){
+ // if($scope.sidebarProcessingClass !== "disappear"){
+ // $("#sidebarProcessingCollapse").click();
+ // }
+ // },
+ // onPrev: function(tour){
+ // if($scope.sidebarProcessingClass !== "disappear"){
+ // $("#sidebarProcessingCollapse").click();
+ // }
+ // }
+ // }
+ ],
+ onShown: function (tour) {
+ // add shortcut to toc to each title
+ let titleElement = document.getElementsByClassName("popover-title").item(0);
+ titleElement.innerHTML +=
+ "" +
+ "";
+ $compile(titleElement)($scope); // let angularjs know that there is new html, add the ng-click event
+ }
+ };
+ $scope.generateTableOfContent = function () {
+ let prevStepTitle = undefined;
+ for (var i = 0; i < $scope.tourOptions.steps.length; i++) {
+ let step = $scope.tourOptions.steps[i];
+ // only show the first guided tour step for each subtheme
+ // specifically exclude "Individuelle Indikatoren-Neuberechnung" for now as it is not shown in the guided tour
+ if (step.title !== prevStepTitle && step.title !== "Individuelle Indikatoren-Neuberechnung") {
+ let html = "
",
+ steps: [
+ {
+ element:"#map",
+ title: "Willkommen zur Guided Tour von KomMonitor",
+ placement: "left",
+ content: "In dieser Tour werden die Funktionalitäten der Weboberfläche erläutert. Hier werden sie mit den Elementen der Oberfläche sowie den verschiedenen Buttons vertraut gemacht. " +
+ " Die Tour kann jederzeit über den Button Guided Tour beenden verlassen werden. ",
+ onNext: function(tour){
+ if($scope.sidebarLegendClass !== "disappear"){
+ $("#sidebarLegendCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#map",
+ title: "Inhaltsverzeichnis",
+ placement: "top",
+ content: "",
+ onNext: function(tour){
+ if($scope.sidebarLegendClass !== "disappear"){
+ $("#sidebarLegendCollapse").click();
+ }
+ },
+ onShown: function(tour) {
+ $scope.generateTableOfContent();
+ }
+ },
+ {
+ element: "#header",
+ title: "Kopfzeile",
+ placement: "bottom",
+ content: "In der Kopfzeile befinden sich neben den Logos und dem Titel der Webanwendung mehrere Buttons. " +
+ "Mit kann zwischen einer vereinfachten und einer erweiterten Ansicht gewechselt werden. " +
+ "Diese Guided Tour kann stets erneut mit aufgerufen werden. " +
+ " öffnet das beim Aufruf der Seite erschienene Informationsfenster und" +
+ " ermöglicht mit entsprechenden Zugangsdaten den Zugang zur Administrationsoberfläche."
+ },
+ {
+ element: "#map",
+ title: "Kartenfenster",
+ placement: "top",
+ content: "Die Standardansicht besteht aus einer kartografischen Darstellung, die bereits eine Hintergrundkarte und einen Indikator anzeigt. In dieser Darstellung können Sie in der " +
+ "Karte frei navigieren (zoomen, verschieben) und beim Herüberfahren mit dem Mauszeiger über eine der Raumeinheiten werden der Name, der Wert und die Einheit des dargestellten Indikators angezeigt.",
+ // onNext: function(tour){
+ // // make sure that legend control is displayed
+
+ // var control = document.getElementById("legendControl");
+ // var controlButton = document.getElementById("toggleLegendControlButton");
+ // if(control.style.display === "none" || (controlButton.style.display !== undefined && controlButton.style.display !== "none")){
+ // $rootScope.$broadcast("toggleLegendControl");
+ // }
+
+ // },
+ onNext: function(tour){
+ if($scope.sidebarLegendClass === "disappear"){
+ $("#sidebarLegendCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#kommonitorLegend",
+ title: "Indikatorenlegende und Klassifizierung",
+ placement: "left",
+ content: "Dieses Element ist in drei Teilbereiche untergliedert, welche 1. die wichtigsten Metadaten des dargestellten Indikator abbilden, " +
+ "2. Kartenlegenden zur Interpretation der Karteninhalte anbieten und 3. weitergehende Möglichkeiten zur Klassifizierung bieten.",
+ onNext: function(tour){
+ if($scope.sidebarLegendClass !== "disappear"){
+ $("#legendSymbologyCollapse").click();
+ }
+ },
+ onPrev: function(tour){
+ if($scope.sidebarLegendClass !== "disappear"){
+ $("#sidebarLegendCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#kommonitorIndicatorBasicMetadata",
+ title: "Indikator-Metadaten, Einstellung- und Exportmöglichkeiten",
+ placement: "left",
+ content: "Im oberen Bereich sind der Name eine kurze Beschreibung sowie das Fortführungsintervall des angezeigten Indikators zu finden. " +
+ "Im mittleren Bereich kann die angezeigte Raumebene per Dropdown-Liste gewechselt, der Zeitpunkt per Kalenderauswahl gewählt sowie " +
+ "die Transparenz der Kartendarstellung per Schieberegler angepasst werden. " +
+ "Der untere Bereich bietet Exportmöglichkeiten für die angezeigten Daten in den Formaten GeoJSON, ESRI Shapefile sowie CSV. " +
+ "Zudem kann ein Metadatenblatt aller Metadaten des dargestellten Indikators als PDF-Datei heruntergeladen werden.",
+ onNext: function(tour){
+ if($scope.sidebarLegendClass !== "disappear"){
+ $("#indicatorBasicMetadataCollapse").click();
+ $("#legendSymbologyCollapse").click();
+ }
+ },
+ onPrev: function(tour){
+ if($scope.sidebarLegendClass !== "disappear"){
+ $("#legendSymbologyCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#kommonitorLegendSymbology",
+ title: "Kartenlegenden und Interpretation",
+ placement: "left",
+ content: "Dieser Bereich beinhaltet eine Farblegende mit fünf Klassen für den angezeigten Indikator sowie die Wertebereiche und Fallzahlen je Klasse " +
+ "Als ergänzende Informationen werden der Indikatortyp, der Stichtag, die Einheit sowie eine kurze Interpretationshilfe angezeigt." +
+ "Die einzelnen Reiter ganz oben ermöglichen den Wechsel zwischen verschiedenen Legenden, sofern zusätzlich zu einem Indikator " +
+ "auch die Legende für berechnete Isochronen, ein Routingergebnis oder einen eingebundenen WMS-Dienst angezeigt werden sollen.",
+ onNext: function(tour){
+ if($scope.sidebarLegendClass !== "disappear"){
+ $("#legendSymbologyCollapse").click();
+ $("#indicatorClassificationCollapse").click();
+ }
+ },
+ onPrev: function(tour){
+ if($scope.sidebarLegendClass !== "disappear"){
+ $("#legendSymbologyCollapse").click();
+ $("#indicatorBasicMetadataCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#kommonitorIndicatorClassification",
+ title: "Klassifikationsoptionen",
+ placement: "left",
+ content: "Hier kann zwischen den drei KlassifizierungsmethodenJenks, Gleiches Intervall und Quantile gewählt werden " +
+ " Detaillierte Informationen zu den Klassifizierungsmethoden können dem Popup entnommen werden, das beim Herüberfahren mit dem Mauszeiger über eine der drei Optionen erscheint. " +
+ " Zudem lässt sich per einstellen, ob die Klassifizierung die Indikatorenwerte der gesamten Zeitreihe berücksichtigen soll, oder nur jene des aktuellen Zeitschnitts. " +
+ "So kann ein vergleichbares Kartenbild für eine komplette Zeitreihe gewährleistet werden. " +
+ " KomMonitor überprüft jeden Indikatorendatensatz auf statistische Ausreißer. Werden ein oder mehrere Ausreißer erkannt, so können mit " +
+ "Ausreißer gesondert markiert und aus der Klassifizierung entfernt werden. Dies kann hilfreich sein, " +
+ "um ein differenzierteres Kartenbild zu erzeugen.",
+ onNext: function(tour){
+ if($scope.sidebarLegendClass !== "disappear"){
+ $("#sidebarLegendCollapse").click();
+ }
+ },
+ onPrev: function(tour){
+ if($scope.sidebarLegendClass !== "disappear"){
+ $("#legendSymbologyCollapse").click();
+ $("#indicatorClassificationCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#dateSliderWrapper",
+ title: "Zeitstrahl",
+ placement: "top",
+ content: "Die Zeitleiste am unteren Bildschirmrand enthält die verfügbaren Zeitschnitte des selektierten Indikators. Standardmäßig ist der aktuellste Zeitschnitt voreingestellt. "+
+ " Durch ein Klicken auf einen beliebigen Punkt der Leiste oder durch Verschieben des runden Auswahlknopfs kann ein anderer Zeitschnitt gewählt werden.",
+ onPrev: function(tour){
+ if($scope.sidebarLegendClass === "disappear"){
+ $("#sidebarLegendCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#mapUtilButtons",
+ title: "Steuerung der Kartendarstellung",
+ placement: "bottom",
+ content: "Diese Buttons bieten Steuerungsmöglichkeiten für die Kartendarstellung. Über und kann alternativ zur Verwendung des Mausrades hinein- bzw. hinausgezoomt werden. "+
+ "
zentriert die Karte und zoomt auf die maximale Ausdehnung des dargestellten Themas. " +
+ "
hebt jegliche benutzerdefinierte Selektionen auf. " +
+ "
erlaubt den Export des aktuellen Kartenausschnitts als Bilddatei. " +
+ "
bietet die Möglichkeit, einzelne Karteninhalte temporär auszublenden oder die Hintergrundkarte zu wechseln. " +
+ "
ermöglicht das Filtern innerhalb dargestellter Vektorlayer anhand des Namens oder der ID vorhandener Raumelemente. " +
+ "
repräsentiert eine Geolokalisierung von Adressen und Orten. " +
+ "
Darüber hinaus bietet eine Messfunktion für Abstände und Flächen."
+ },
+ {
+ element: "#sideBarButtons",
+ title: "Menü-Buttons",
+ placement: "right",
+ content: "Diese Buttons öffnen jeweils ein linksseitig angeordnetets Menü mitzusätzlichen Funktionen. Jedes einzelne Menü wird in den folgenden Schritten kurz erläutert."
+ },
+ {
+ element: "#sidebarIndicatorConfigCollapse",
+ title: "Indikatorenkatalog und Metadaten",
+ placement: "right",
+ content: "Ein Klick auf diesen Button öffnet das Indikatoren-Auswahl-Fenster.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
+ onNext: function(tour){
+ if($scope.sidebarIndicatorConfigClass === "disappear"){
+ $("#sidebarIndicatorConfigCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#indicatorSetup",
+ title: "Indikatorenkatalog und Metadaten",
+ placement: "right",
+ content: "Dieses Menü enthält eine Übersicht aller verfügbarer Indikatoren sowie die Option, " +
+ "den aktuell betrachteten Indikator zu wechseln.
Indikatoren können in Form einer Themenhierarchie im Datenkatalog oder in einer " +
+ "alphabetischen Liste betrachtet und selektiert werden. " +
+ "Einen transparenten Zugang zu zusammenschauenden, bewertenden Indikatoren bietet die Leitindikatoren-Hierarchie." +
+ "Hiermit können Leitindikatoren sowie die zur Berechnung verwendeten Basis-Indikatoren aufgerufen und deren Verknüpfung nachvollzogen werden. " +
+ "Auch die Metadaten des ausgewählten Indikators können hier detailliert eingesehen werden.",
+ onNext: function(tour){
+ if($scope.sidebarIndicatorConfigClass !== "disappear"){
+ $("#sidebarIndicatorConfigCollapse").click();
+ }
+ },
+ onPrev: function(tour){
+ if($scope.sidebarIndicatorConfigClass !== "disappear"){
+ $("#sidebarIndicatorConfigCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#sidebarPoiCollapse",
+ title: "Georessourcen und -dienste",
+ placement: "right",
+ content: "Ein Klick auf diesen Button öffnet das Georessourcen Fenster.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
+ onNext: function(tour){
+ if($scope.sidebarPoiClass === "disappear"){
+ $("#sidebarPoiCollapse").click();
+ }
+ },
+ onPrev: function(tour){
+ if($scope.sidebarIndicatorConfigClass === "disappear"){
+ $("#sidebarIndicatorConfigCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#poi",
+ title: "Georessourcen und -dienste",
+ placement: "right",
+ content: "Zur Überlagerung von flächenhaft dargestellten Indikatoren mit weiteren relevanten Geodaten können Punkt- Linien und Flächendaten sowie Geodatendienste " +
+ "zur Karte hinzugefügt werden. Hinzufügen und Entfernen dieser Datensätze geschieht dabei durch (De-) Selektion der Auswahlbox links neben dem jeweiligen Datensatz. " +
+ "
In der Standardkonfiguration werden Punktdaten räumlich zu sogenannten Cluster-Punkten zusammengefasst, um die Darstellung je nach Zoom-Stufe zu optimieren und " +
+ "selbst bei bei vielen Punkten eine übersichtliche Darstellung zu gewährleisten." +
+ "Über eine entsprechende Auswahloption können jedoch bei jeder Zoomstufe wahlweise auch alle Einzelpunkte angezeigt werden. " +
+ "
Hinweis zum Zeitbezug der darzustellenden Daten: Der Abruf eines Punkt-, Linien- oder Flächendatensatzes bezieht sich immer auf ein Datum. " +
+ "Standardmäßig wird der aktuelle Zeitpunkt des dargestellten Indikators verwendet. Diese Option kann jedoch auf ein beliebiges frei definierbares Datum oder eine " +
+ "listenbasierte Auswahl verfügbarer Zeitpunkte jedes Datensatzes abgeändert werden.",
+ onNext: function(tour){
+ if($scope.sidebarPoiClass !== "disappear"){
+ $("#sidebarPoiCollapse").click();
+ }
+ },
+ onPrev: function(tour){
+ if($scope.sidebarPoiClass !== "disappear"){
+ $("#sidebarPoiCollapse").click();
+ }
+ }
+ },
+ // {
+ // element: "#sidebarDataImportCollapse",
+ // title: "Datenimport aus externen Quellen",
+ // placement: "right",
+ // content: "Ein Klick auf diesen Button öffnet das Datenimport Fenster.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
+ // onNext: function(tour){
+ // if($scope.sidebarDataImportClass === "disappear"){
+ // $("#sidebarDataImportCollapse").click();
+ // }
+ // }
+ // },
+ // {
+ // element: "#dataImport",
+ // title: "Datenimport aus externen Quellen",
+ // placement: "right",
+ // content: "Dieses Fenster bietet Optionen zum Datenimport aus externen Datenquellen, insbesondere mittels Web Map Services und Datei-basierten Quellen wie GeoJSON oder ESRI Shape.
Jeder WMS-Datensatz wird tabellarisch inklusive Titel, Beschreibung, Transparenzschieberegler, URL und Legende dargestellt. Durch Anhaken/Deselektion der Checkbox kann ein Datensatz hinzugefügt/entfernt werden. Neben den bereits vorkonfigurierten Datensätzen lassen sich weitere Quellen über den unten stehenden Button ergänzen.
Die Möglichkeit Layer aus einer lokalen Datei einzuladen wird in Kürze verfügbar sein.",
+ // onNext: function(tour){
+ // if($scope.sidebarDataImportClass !== "disappear"){
+ // $("#sidebarDataImportCollapse").click();
+ // }
+ // },
+ // onPrev: function(tour){
+ // if($scope.sidebarDataImportClass !== "disappear"){
+ // $("#sidebarDataImportCollapse").click();
+ // }
+ // }
+ // },
+ {
+ element: "#sidebarFilterCollapse",
+ title: "Darstellungsfilter",
+ placement: "right",
+ content: "Ein Klick auf diesen Button öffnet ein Fenster zur Definition von Darstellungsfiltern.
Darüber hinaus können je nach Fragestellung die Raumebenen-Geometrien (z.B. Stadtteile) auf diejenigen eingeschränkt werden, die zur Beantwortung der Fragestellung beitragen.
+ content: "Hier können verschiedene Darstellungsfilter angewendet werden, die sich auf die kartografische Darstellung auswirken. " +
+ "Über den Wertebereichsfilter können die angezeigten Raumeinheiten anhand der Wertausprägung des angezeigten Indikators gefiltert werden. " +
+ "Dazu kann der Schieberegler an dem minimalen und maximalen Werten nach rechts oder links geschoben werden. Alternativ kann die untere und/oder obere Grenze " +
+ "auch als Zahlenwert eingetragen werden. " +
+ "Eine weitere Option ist die dynamische Schwellenwertklassifizierung, bei der ein spezifischer Wert definiert werden kann, " +
+ "der die Indikator-Darstellung in zwei Bereiche unterteilt (oberhalb und unterhalb des Schwellenwerts) und entsprechend farbig darstellt.",
+ onNext: function(tour){
+ if($scope.sidebarFilterClass !== "disappear"){
+ $("#sidebarFilterCollapse").click();
+ }
+ },
+ onPrev: function(tour){
+ if($scope.sidebarFilterClass !== "disappear"){
+ $("#sidebarFilterCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#sidebarBalanceCollapse",
+ title: "Zeitliche Bilanzierung",
+ placement: "right",
+ content: "Ein Klick auf diesen Button öffnet ein Fenster zur zeitlichen Bilanzierung des aktuell dargestellten Indikators. " +
+ "
Im nächsten Schritt wird das Menü automatisch geöffnet.",
+ onNext: function(tour){
+ if($scope.sidebarBalanceClass === "disappear"){
+ $("#sidebarBalanceCollapse").click();
+ }
+ },
+ onPrev: function(tour){
+ if($scope.sidebarFilterClass === "disappear"){
+ $("#sidebarFilterCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#kommonitorBalance",
+ title: "Zeitliche Bilanzierung",
+ placement: "right",
+ content: "Bei der zeitlichen Bilanzierung steht die Wertentwicklung eines Indikators über die Zeit im Fokus (z. B. Wachstum / Schrumpfung). " +
+ "Wird die Bilanzierung anhand der Auswahlbox aktiviert, kann über die Zeitleiste ein Start- sowie ein Endzeitpunkt festgelegt werden. " +
+ "Für diesen spezifizifischen Betrachtungszeitraum wird dann automatisch die Wertentwicklung des angezeigten Indikators berechnet und dargestellt. " +
+ "
Auch die Indikatoren-Legende am rechten Rand der Anwendung beinhaltet dann die Information, dass eine Bilanz des Indikators dargestellt wird. " +
+ "
Der Trendverlauf im Betrachtungszeitraumwird zudem in Form eines Liniendiagrammes visualisiert. " +
+ " Zur Trendberechnung kann in KomMonitor zwischen einer linearen, exponentiellen und polynomialen Herleitung gewählt werden. " +
+ " Des Weiteren sind statistische Merkmale der gewählten Trendbetrachtung hinterlegt. Hierzu zählen beispielsweise Standardabweichung, Varianz, Mittelwert und Median sowie " +
+ "die Art des Trendverlaufes. " +
+ "
Bitte beachten Sie, dass eine Bilanzierung nur bei Status-Indikatoren möglich ist, " +
+ "deren Zeitreihe mehr als einen Zeitpunkt enthält.",
+ onNext: function(tour){
+ if($scope.sidebarBalanceClass !== "disappear"){
+ $("#sidebarBalanceCollapse").click();
+ }
+ },
+ onPrev: function(tour){
+ if($scope.sidebarBalanceClass !== "disappear"){
+ $("#sidebarBalanceCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#sidebarDiagramsCollapse",
+ title: "Statistische Diagramme",
+ placement: "right",
+ content: "Ein Klick auf diesen Button öffnet ein Fenster mit statistischen Diagrammen. " +
+ "
Ein Ranking der jeweiligen Raumeinheiten wird anhand eines Säulendiagramms dargestellt. " +
+ "
Das untere Liniendiagramm visualisiert die zeitliche Entwicklung des aktuellen Indikators über alle jeweils verfügbaren Zeitschnitte. " +
+ "Als Zusatzinformation wird hier der Durchschnittswert über alle Raumeinheiten dargestellt. " +
+ "
Um einzelne Elemente der gewählten Raumebene im Säulen- und Liniendiagramm zu betrachten und hervorzuheben, " +
+ "kann mit dem Mauszeiger entweder über die Säule innerhalb des Säulendiagramms oder über das jeweilige Element in der Karte gefahren werden. " +
+ "Eine dauerhafte Selektion durch Klicken auf das kartografische Element oder die dazugehörige Säule ermöglicht das simultane Betrachten mehrerer Elemente. " +
+ "
Jedes Diagramm enthält in der oberen rechte Ecke eine Toolbox, über die das Diagramm entweder als Bilddatei oder im Tabellenformatexportiert werden kann.",
+ onNext: function(tour){
+ if($scope.sidebarDiagramsClass !== "disappear"){
+ $("#sidebarDiagramsCollapse").click();
+ }
+ },
+ onPrev: function(tour){
+ if($scope.sidebarDiagramsClass !== "disappear"){
+ $("#sidebarDiagramsCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#sidebarRadarDiagramCollapse",
+ title: "Indikatorenradar",
+ placement: "right",
+ content: "Ein Klick auf diesen Button öffnet das Indiktorenradar für die Querschnittsbetrachtung mehrerer Indikatoren.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
+ onNext: function(tour){
+ if($scope.sidebarRadarDiagramClass === "disappear"){
+ $("#sidebarRadarDiagramCollapse").click();
+ }
+ },
+ onPrev: function(tour){
+ if($scope.sidebarDiagramsClass === "disappear"){
+ $("#sidebarDiagramsCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#indicatorRadar",
+ title: "Indikatorenradar",
+ placement: "right",
+ content: "Das Indikatorenradar eignet sich insbesondere für die querschnittsorientierte Betrachtung mehrerer Indikatoren. " +
+ " Für die Anzeige eines solchen Diagramms, selektieren Sie bitte mindestens drei Indikatoren aus der oben stehenden Liste.
" +
+ "Für jeden gewählten Indikator wird im Diagramm eine Achse genutzt, auf der einzelne Raumeinheiten anhand ihrer Wertausprägung abgetragen werden. " +
+ "Jede Achse wird dabei durch Minimum und Maximum der Werte des betrachteten Indikators gebildet (daher ist die Radarmitte ausdrücklich nicht zwingend " +
+ "mit dem Wert '0' gleichzusetzen, sondern mit dem Minimalwert des Indikators).
Auch hier ist der Durchschnitt aller Raumeinheiten bereits vorberechnet und " +
+ "einzelne Elemente können mittels Selektion innerhalb der Karte dem Radar hinzugefügt werden. Die Indikatorenauswahl umfasst dabei nur solche Indikatoren, " +
+ "die die gewählte Raumebene und den aktuell gewählten Zeitschnitt unterstützen.
Auch das Radardiagramm besitzt in der oberen rechte Ecke eine " +
+ "Toolbox, über die das Diagramm entweder als Bilddatei oder im Tabellenformatexportiert werden kann",
+ onNext: function(tour){
+ if($scope.sidebarRadarDiagramClass !== "disappear"){
+ $("#sidebarRadarDiagramCollapse").click();
+ }
+ },
+ onPrev: function(tour){
+ if($scope.sidebarRadarDiagramClass !== "disappear"){
+ $("#sidebarRadarDiagramCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#sidebarRegressionDiagramCollapse",
+ title: "Regressionsdiagramm",
+ placement: "right",
+ content: "Ein Klick auf diesen Button öffnet das Fenster zur Definition von Regressionsdiagrammen.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
+ onNext: function(tour){
+ if($scope.sidebarRegressionDiagramClass === "disappear"){
+ $("#sidebarRegressionDiagramCollapse").click();
+ }
+ },
+ onPrev: function(tour){
+ if($scope.sidebarRadarDiagramClass === "disappear"){
+ $("#sidebarRadarDiagramCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#indicatorRegression",
+ title: "Regressionsdiagramm",
+ placement: "right",
+ content: "Als exemplarischer weiterer Diagrammtyp unterstützt KomMonitor die Berechnung einer linearen Regression zwischen zwei zu wählenden Indikatoren, um insbesondere die Korrelation zwischen diesen zu betrachten. Nach Auswahl der Indikatoren werden die Regressionsgerade und alle Elemente der gewählten Raumebene gemäß ihrer Wertausprägungen entlang der Indikatorenachsen im Diagramm abgetragen.
Beim Überfahren eines Datenpunkts mit der Maus im Diagramm oder einer in der Karte dargestellten Raumeinheit, wird das jeweilige Pendant visuell hervorgehoben.
Die Indikatorenauswahl umfasst dabei nur solche Indikatoren, die die gewählte Raumebene und den aktuell gewählten Zeitschnitt unterstützen.
Auch das Regressionsdiagramm besitzt in der oberen rechte Ecke eine Toolbox, über die das Diagramm entweder als Bilddatei oder im Tabellenformatexportiert werden kann.",
+ onNext: function(tour){
+ if($scope.sidebarRegressionDiagramClass !== "disappear"){
+ $("#sidebarRegressionDiagramCollapse").click();
+ }
+ },
+ onPrev: function(tour){
+ if($scope.sidebarRegressionDiagramClass !== "disappear"){
+ $("#sidebarRegressionDiagramCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#sidebarReachabilityCollapse",
+ title: "Erreichbarkeitsanalysen",
+ placement: "right",
+ content: "Ein Klick auf diesen Button öffnet ein Fenster für Erreichbarkeitsanalysen.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
+ onNext: function(tour){
+ if($scope.sidebarReachabilityClass === "disappear"){
+ $("#sidebarReachabilityCollapse").click();
+ }
+ },
+ onPrev: function(tour){
+ if($scope.sidebarRegressionDiagramClass === "disappear"){
+ $("#sidebarRegressionDiagramCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#kommonitorReachability",
+ title: "Erreichbarkeitsanalysen",
+ placement: "right",
+ content: "Als GIS-basiertes Werkzeug soll KomMonitor ausgewählte räumliche Analysen unterstützen. " +
+ "Insbesondere stehen Erreichbarkeitsanalysen im Fokus, bei denen, neben reinen Puffer-basierten Ansätzen, " +
+ "Erreichbarkeiten anhand tatsächlicher Wegenetze für verschiedene Transportmittel (z.B. Fußgänger, Fahrrad, Auto) "+
+ "berechnet werden können. Konkret soll hierbei sowohl ein Routing zwischen einzelnen Punkten sowie " +
+ "die Berechnung von Isochronen (Äquidistanzen und zeitliches Abbruchkriterium) angeboten werden.
" +
+ "Auswahl der Startpunkte " +
+ "Die Auswahl der Startpunkte kann entweder über die Selektion eines vorhandenen Punktdatensatzes vorgenommen werden oder mittels Einzeichnen eigener beliebiger Punkte in die Karte.
" +
+ "Ergebnisdarstellung " +
+ "Sowohl Isochronen- als auch Routingergebnisse werden der Karte als neuer, eigener Layer hinzugefügt. " +
+ "Die jeweilige Legende über jeweiligen Reiter des rechten Legendenmenüs einsehbar.
"+
+ "Punkt in Isochronen Analyse " +
+ "Nachdem eine Isochronenberechnung erfolgt ist, können vorhandene Punktdatensätze räumlich mit den Isochronen verschnitten werden, bspw. um eine Umfeldanalyse für relevante Einrichtungen durchzuführen.",
+ onNext: function(tour){
+ if($scope.sidebarReachabilityClass !== "disappear"){
+ $("#sidebarReachabilityCollapse").click();
+ }
+ },
+ onPrev: function(tour){
+ if($scope.sidebarReachabilityClass !== "disappear"){
+ $("#sidebarReachabilityCollapse").click();
+ }
+ }
+ },
+ {
+ element: "#map",
+ title: "Vielen Dank für die Nutzung der Guided Tour von KomMonitor!",
+ placement: "left",
+ content: "Wir hoffen, die Erläuterungen konnten einen guten Einblick in die Funktionen bieten, " +
+ "bei der ersten Orientierung helfen und die zukünftige Nutzung erleichtern! " +
+ "Kritik, Anregungen oder Fragen sind jederzeit willkommen.(siehe Begrüßungsfenster für den Kontakt). " +
+ "Viel Spaß bei der Nutzung von KomMonitor! ",
+ onNext: function(tour){
+ kommonitorDataExchangeService.guidedTour = undefined; // ends the tour
+ }
+ }
+ // {
+ // element: "#sidebarProcessingCollapse",
+ // title: "Individuelle Indikatoren-Neuberechnung",
+ // placement: "right",
+ // content: "Ein Klick auf diesen Button öffnet ein Fenster zur individuellen Neuberechnung einzelner Indikatoren.
Im nächsten Schritt wird das Menü automatisch geöffnet.",
+ // onNext: function(tour){
+ // if($scope.sidebarProcessingClass === "disappear"){
+ // $("#sidebarProcessingCollapse").click();
+ // }
+ // },
+ // onPrev: function(tour){
+ // if($scope.sidebarReachabilityClass === "disappear"){
+ // $("#sidebarReachabilityCollapse").click();
+ // }
+ // }
+ // },
+ // {
+ // element: "#indicatorProcessing",
+ // title: "Individuelle Indikatoren-Neuberechnung",
+ // placement: "right",
+ // content: "KomMonitor ist mehr als nur ein Darstellungswerkzeug. Es ermöglicht insbesondere auch die automatisierte Berechnung von Indikatoren. Je nach Berechnungsvorschrift kann es dabei konfigurierbare Parameter geben, die die resultierenden Indikatorenwerte beeinflussen (bspw. eine maximle Distanz bei Erreichbarkeiten oder Gewichtungen grundlegender Eingangsdaten).
Dieses Menü bietet die Möglichkeit einer Nutzer-definierten Neuberechnung von Indikatoren mit mindestens einem konfigurierbaren Parameter. Das jeweilige Berechnungsergebnis steht anschließend temporär zur Verfügung und kann bei Bedarf exportiert werden.
Künftig sollen darüber hinaus unmittelbare Vergleiche mit der 'Standard'-Variante des Indikators angeboten werden. Diese sind jedoch zum gegenwärtigen Zeitpunkt noch nicht in der Anwendung umgesetzt.",
+ // onNext: function(tour){
+ // if($scope.sidebarProcessingClass !== "disappear"){
+ // $("#sidebarProcessingCollapse").click();
+ // }
+ // },
+ // onPrev: function(tour){
+ // if($scope.sidebarProcessingClass !== "disappear"){
+ // $("#sidebarProcessingCollapse").click();
+ // }
+ // }
+ // }
+ ],
+ onShown: function(tour) {
+ // add shortcut to toc to each title
+ let titleElement = document.getElementsByClassName("popover-title").item(0);
+ titleElement.innerHTML +=
+ "" +
+ "";
+ $compile(titleElement)($scope); // let angularjs know that there is new html, add the ng-click event
+ }
+ };
+
+ $scope.generateTableOfContent = function() {
+ let prevStepTitle = undefined;
+ for(var i=0;i<$scope.tourOptions.steps.length;i++) {
+ let step = $scope.tourOptions.steps[i];
+ // only show the first guided tour step for each subtheme
+ // specifically exclude "Individuelle Indikatoren-Neuberechnung" for now as it is not shown in the guided tour
+ if (step.title !== prevStepTitle && step.title !== "Individuelle Indikatoren-Neuberechnung") {
+ let html = "
" + step.title + "
";
+ let compiled = $compile(html)($scope); // let angularjs know that there is new html, add the ng-click event
+ angular.element(document.getElementById('guided-tour-toc')).append(compiled);
+ }
+ prevStepTitle = step.title;
+ }
+ };
+
+ $scope.goToGuidedTourStep = function(tour, targetStepIndex) {
+ // The method "goTo" provided by the library jumps directly to the target step, ignoring the "onNext" and "onPrev" methods.
+ // That leads to menues not being opened/closed. To fix this we iterate the steps manually.
+ while(tour.getCurrentStep() < targetStepIndex)
+ tour.next();
+ while(tour.getCurrentStep() > targetStepIndex)
+ tour.prev();
+ };
+
+ $scope.startGuidedTour = function(){
+ // GUIDED TOUR
+ // Instance the tour
+ kommonitorDataExchangeService.guidedTour = new Tour($scope.tourOptions);
+
+ // Initialize the tour
+ kommonitorDataExchangeService.guidedTour.init();
+ // Start the tour
+ try{
+ kommonitorDataExchangeService.guidedTour.restart();
+ }
+ catch(error){
+ kommonitorDataExchangeService.guidedTour.start(true);
+ }
+
+ // tour gotTo() example to jump to step 7 --> index starts from 0
+ // kommonitorDataExchangeService.guidedTour.goTo(6);
+
+ };
+
+ $scope.$on("redrawGuidedTourElement", async function(event){
+
+ await sleep(100);
+
+ if(kommonitorDataExchangeService.guidedTour){
+ kommonitorDataExchangeService.guidedTour.redraw();
+ }
+ });
+
+ $scope.init();
+
+ }
+]});
diff --git a/app/components/kommonitorUserInterface/kommonitor-user-interface.module.js b/app/components/kommonitorUserInterface/kommonitor-user-interface.module.js
index 3f277716e..310280377 100644
--- a/app/components/kommonitorUserInterface/kommonitor-user-interface.module.js
+++ b/app/components/kommonitorUserInterface/kommonitor-user-interface.module.js
@@ -1,4 +1,6 @@
+"use strict";
angular.module('kommonitorUserInterface', ['kommonitorMap', 'kommonitorDataSetup', 'kommonitorAdmin',
- 'kommonitorIndividualIndicatorComputation', 'kommonitorDiagrams', 'indicatorRadar', 'regressionDiagram', 'kommonitorFilter', 'kommonitorBalance',
- 'kommonitorReachability', 'poi', 'infoModal', 'spatialUnitNotificationModal', 'feedbackModal', 'reportingModal', 'wmsModal', 'wfsModal', 'kommonitorDataImport',
- 'kommonitorLegend', 'kommonitorElementVisibilityHelper', 'kommonitorShareHelper']);
+ 'kommonitorIndividualIndicatorComputation', 'kommonitorDiagrams', 'indicatorRadar', 'regressionDiagram', 'kommonitorFilter', 'kommonitorBalance',
+ 'kommonitorReachability', 'poi', 'infoModal', 'spatialUnitNotificationModal', 'feedbackModal', 'reportingModal', 'wmsModal', 'wfsModal', 'kommonitorDataImport',
+ 'kommonitorLegend', 'kommonitorElementVisibilityHelper', 'kommonitorShareHelper']);
+//# sourceMappingURL=kommonitor-user-interface.module.js.map
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitor-user-interface.module.js.map b/app/components/kommonitorUserInterface/kommonitor-user-interface.module.js.map
new file mode 100644
index 000000000..6a0d84fa9
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitor-user-interface.module.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"kommonitor-user-interface.module.js","sourceRoot":"","sources":["kommonitor-user-interface.module.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,MAAM,CAAC,yBAAyB,EAAE,CAAC,eAAe,EAAE,qBAAqB,EAAE,iBAAiB;IAClG,0CAA0C,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,mBAAmB;IAChJ,wBAAwB,EAAE,KAAK,EAAE,WAAW,EAAE,8BAA8B,EAAE,eAAe,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,sBAAsB;IAC/J,kBAAkB,EAAE,mCAAmC,EAAE,uBAAuB,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitor-user-interface.module.ts b/app/components/kommonitorUserInterface/kommonitor-user-interface.module.ts
new file mode 100644
index 000000000..3f277716e
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitor-user-interface.module.ts
@@ -0,0 +1,4 @@
+angular.module('kommonitorUserInterface', ['kommonitorMap', 'kommonitorDataSetup', 'kommonitorAdmin',
+ 'kommonitorIndividualIndicatorComputation', 'kommonitorDiagrams', 'indicatorRadar', 'regressionDiagram', 'kommonitorFilter', 'kommonitorBalance',
+ 'kommonitorReachability', 'poi', 'infoModal', 'spatialUnitNotificationModal', 'feedbackModal', 'reportingModal', 'wmsModal', 'wfsModal', 'kommonitorDataImport',
+ 'kommonitorLegend', 'kommonitorElementVisibilityHelper', 'kommonitorShareHelper']);
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.component.js b/app/components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.component.js
index 561a9f63b..c03d4a88d 100644
--- a/app/components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.component.js
+++ b/app/components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.component.js
@@ -1,135 +1,110 @@
+"use strict";
angular.module('feedbackModal').component('feedbackModal', {
- templateUrl : "components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.template.html",
- controller : ['kommonitorDataExchangeService', '$scope', '$rootScope', '__env', '$http', function FeedbackModalController(kommonitorDataExchangeService, $scope, $rootScope, __env, $http) {
-
- this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
-
- const feedbackMailRecipient = __env.feedbackMailRecipient;
- const emailURL = __env.targetUrlToProcessingEngine + "feedback-mail";
-
- // $scope.titel;
- $scope.organization;
- $scope.contactDetails;
- $scope.feedbackType = undefined;
- $scope.feedbackContent;
- $scope.like = undefined;
- $scope.attachment = undefined;
- document.getElementById("attachment").value = "";
-
- $scope.error = undefined;
- $scope.success = undefined;
-
- var fileToBase64 = (file) => {
- return new Promise(resolve => {
- var reader = new FileReader();
- // Read file content on file loaded event
- reader.onload = function(event) {
- resolve(event.target.result);
- };
-
- // Convert data to base64
- reader.readAsDataURL(file);
- });
- };
-
- $scope.onSubmit = async function(){
- // var body = "Titel: " + $scope.titel + "\n";
- var body = "Fachbereich/Organisation: " + $scope.organization + "\n\n";
- body += "Kontaktdaten: " + $scope.contactDetails + "\n\n";
- body += "Feedback Typ: " + $scope.feedbackType + "\n\n";
- body += "Feedback Inhalt: " + $scope.feedbackContent + "\n\n";
- body += "KomMonitor Bewertung: " + $scope.like + "\n\n";
-
- // var blobFile = $('#attachment').files[0];
- var files = document.getElementById('attachment').files;
- if(files.length > 0){
- var uploadFile = files[0];
- var base64 = await fileToBase64(uploadFile);
- $scope.attachment = base64;
- }
-
-
- // var formData = undefined;
- //
- // if(files.length > 0){
- // formData = new FormData();
- //
- // for (var i = 0; i < files.length; i++) {
- // formData.append("files[]", files[i]);
- // }
- //
- // }
-
- var mailInput = {};
- mailInput.recipientMail = feedbackMailRecipient;
- mailInput.subject = "KomMonitor - Feedback";
- mailInput.body = body;
- mailInput.attachment = $scope.attachment;
-
- $scope.sendMail(mailInput);
- };
-
- $scope.sendMail = function(mailInput){
-
- if(! $scope.validate()){
- return;
- }
-
- $scope.error = undefined;
- $scope.success = undefined;
-
- $http({
- url: emailURL,
- method: "POST",
- data: mailInput
- }).then(function successCallback(response) {
-
- $scope.error = undefined;
- $scope.success = true;
-
- $("#mailSuccessInfo").show();
-
- // auto-close after 3 seconds
- // setTimeout(function() {
- // $("#mailSuccessInfo").alert('close');
- // }, 3000);
-
- }, function errorCallback(error) {
-
- $scope.error = error;
- $scope.success = undefined;
-
- $("#mailErrorInfo").show();
- });
- }
-
- $scope.onCloseSuccessAlert = function(){
- $("#mailSuccessInfo").hide();
- };
-
- $scope.onCloseErrorAlert = function(){
- $("#mailErrorInfo").hide();
- };
-
- $scope.validate = function(){
- if ($scope.feedbackType && $scope.feedbackContent){
- return true;
- }
- return false;
- }
-
- $scope.reset = function(){
- $scope.organization = undefined;
- $scope.contactDetails = undefined;
- $scope.feedbackType = undefined;
- $scope.feedbackContent = undefined;
- $scope.like = undefined;
- $scope.attachment = undefined;
- document.getElementById("attachment").value = "";
-
- $scope.error = undefined;
- $scope.success = undefined;
- }
-
- }
-]});
+ templateUrl: "components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.template.html",
+ controller: ['kommonitorDataExchangeService', '$scope', '$rootScope', '__env', '$http', function FeedbackModalController(kommonitorDataExchangeService, $scope, $rootScope, __env, $http) {
+ this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
+ const feedbackMailRecipient = __env.feedbackMailRecipient;
+ const emailURL = __env.targetUrlToProcessingEngine + "feedback-mail";
+ // $scope.titel;
+ $scope.organization;
+ $scope.contactDetails;
+ $scope.feedbackType = undefined;
+ $scope.feedbackContent;
+ $scope.like = undefined;
+ $scope.attachment = undefined;
+ document.getElementById("attachment").value = "";
+ $scope.error = undefined;
+ $scope.success = undefined;
+ var fileToBase64 = (file) => {
+ return new Promise(resolve => {
+ var reader = new FileReader();
+ // Read file content on file loaded event
+ reader.onload = function (event) {
+ resolve(event.target.result);
+ };
+ // Convert data to base64
+ reader.readAsDataURL(file);
+ });
+ };
+ $scope.onSubmit = async function () {
+ // var body = "Titel: " + $scope.titel + "\n";
+ var body = "Fachbereich/Organisation: " + $scope.organization + "\n\n";
+ body += "Kontaktdaten: " + $scope.contactDetails + "\n\n";
+ body += "Feedback Typ: " + $scope.feedbackType + "\n\n";
+ body += "Feedback Inhalt: " + $scope.feedbackContent + "\n\n";
+ body += "KomMonitor Bewertung: " + $scope.like + "\n\n";
+ // var blobFile = $('#attachment').files[0];
+ var files = document.getElementById('attachment').files;
+ if (files.length > 0) {
+ var uploadFile = files[0];
+ var base64 = await fileToBase64(uploadFile);
+ $scope.attachment = base64;
+ }
+ // var formData = undefined;
+ //
+ // if(files.length > 0){
+ // formData = new FormData();
+ //
+ // for (var i = 0; i < files.length; i++) {
+ // formData.append("files[]", files[i]);
+ // }
+ //
+ // }
+ var mailInput = {};
+ mailInput.recipientMail = feedbackMailRecipient;
+ mailInput.subject = "KomMonitor - Feedback";
+ mailInput.body = body;
+ mailInput.attachment = $scope.attachment;
+ $scope.sendMail(mailInput);
+ };
+ $scope.sendMail = function (mailInput) {
+ if (!$scope.validate()) {
+ return;
+ }
+ $scope.error = undefined;
+ $scope.success = undefined;
+ $http({
+ url: emailURL,
+ method: "POST",
+ data: mailInput
+ }).then(function successCallback(response) {
+ $scope.error = undefined;
+ $scope.success = true;
+ $("#mailSuccessInfo").show();
+ // auto-close after 3 seconds
+ // setTimeout(function() {
+ // $("#mailSuccessInfo").alert('close');
+ // }, 3000);
+ }, function errorCallback(error) {
+ $scope.error = error;
+ $scope.success = undefined;
+ $("#mailErrorInfo").show();
+ });
+ };
+ $scope.onCloseSuccessAlert = function () {
+ $("#mailSuccessInfo").hide();
+ };
+ $scope.onCloseErrorAlert = function () {
+ $("#mailErrorInfo").hide();
+ };
+ $scope.validate = function () {
+ if ($scope.feedbackType && $scope.feedbackContent) {
+ return true;
+ }
+ return false;
+ };
+ $scope.reset = function () {
+ $scope.organization = undefined;
+ $scope.contactDetails = undefined;
+ $scope.feedbackType = undefined;
+ $scope.feedbackContent = undefined;
+ $scope.like = undefined;
+ $scope.attachment = undefined;
+ document.getElementById("attachment").value = "";
+ $scope.error = undefined;
+ $scope.success = undefined;
+ };
+ }
+ ]
+});
+//# sourceMappingURL=feedback-modal.component.js.map
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.component.js.map b/app/components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.component.js.map
new file mode 100644
index 000000000..7b30005e1
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"feedback-modal.component.js","sourceRoot":"","sources":["feedback-modal.component.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC,eAAe,EAAE;IAC1D,WAAW,EAAG,kGAAkG;IAChH,UAAU,EAAG,CAAC,+BAA+B,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,uBAAuB,CAAC,6BAA6B,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK;YAExL,IAAI,CAAC,qCAAqC,GAAG,6BAA6B,CAAC;YAE3E,MAAM,qBAAqB,GAAG,KAAK,CAAC,qBAAqB,CAAC;YAC1D,MAAM,QAAQ,GAAG,KAAK,CAAC,2BAA2B,GAAG,eAAe,CAAC;YAErE,gBAAgB;YAChB,MAAM,CAAC,YAAY,CAAC;YACpB,MAAM,CAAC,cAAc,CAAC;YACtB,MAAM,CAAC,YAAY,GAAG,SAAS,CAAC;YAChC,MAAM,CAAC,eAAe,CAAC;YACvB,MAAM,CAAC,IAAI,GAAG,SAAS,CAAC;YACxB,MAAM,CAAC,UAAU,GAAG,SAAS,CAAC;YAC9B,QAAQ,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;YAEjD,MAAM,CAAC,KAAK,GAAG,SAAS,CAAC;YACzB,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC;YAE3B,IAAI,YAAY,GAAG,CAAC,IAAI,EAAE,EAAE;gBACzB,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;oBAC3B,IAAI,MAAM,GAAG,I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AEF,MAAM,CAAC,QAAQ,GAAG;gBACjB,IAAI,MAAM,CAAC,YAAY,IAAI,MAAM,CAAC,eAAe,EAAC;oBACjD,OAAO,IAAI,CAAC;iBACZ;gBACD,OAAO,KAAK,CAAC;YACd,CAAC,CAAA;YAED,MAAM,CAAC,KAAK,GAAG;gBACd,MAAM,CAAC,YAAY,GAAG,SAAS,CAAC;gBAChC,MAAM,CAAC,cAAc,GAAG,SAAS,CAAC;gBAClC,MAAM,CAAC,YAAY,GAAG,SAAS,CAAC;gBAChC,MAAM,CAAC,eAAe,GAAG,SAAS,CAAC;gBACnC,MAAM,CAAC,IAAI,GAAG,SAAS,CAAC;gBACxB,MAAM,CAAC,UAAU,GAAG,SAAS,CAAC;gBAC9B,QAAQ,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,KAAK,GAAG,EAAE,CAAC;gBAEjD,MAAM,CAAC,KAAK,GAAG,SAAS,CAAC;gBACzB,MAAM,CAAC,OAAO,GAAG,SAAS,CAAC;YAC5B,CAAC,CAAA;QAEF,CAAC;KACD;CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.component.ts b/app/components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.component.ts
new file mode 100644
index 000000000..561a9f63b
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.component.ts
@@ -0,0 +1,135 @@
+angular.module('feedbackModal').component('feedbackModal', {
+ templateUrl : "components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.template.html",
+ controller : ['kommonitorDataExchangeService', '$scope', '$rootScope', '__env', '$http', function FeedbackModalController(kommonitorDataExchangeService, $scope, $rootScope, __env, $http) {
+
+ this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
+
+ const feedbackMailRecipient = __env.feedbackMailRecipient;
+ const emailURL = __env.targetUrlToProcessingEngine + "feedback-mail";
+
+ // $scope.titel;
+ $scope.organization;
+ $scope.contactDetails;
+ $scope.feedbackType = undefined;
+ $scope.feedbackContent;
+ $scope.like = undefined;
+ $scope.attachment = undefined;
+ document.getElementById("attachment").value = "";
+
+ $scope.error = undefined;
+ $scope.success = undefined;
+
+ var fileToBase64 = (file) => {
+ return new Promise(resolve => {
+ var reader = new FileReader();
+ // Read file content on file loaded event
+ reader.onload = function(event) {
+ resolve(event.target.result);
+ };
+
+ // Convert data to base64
+ reader.readAsDataURL(file);
+ });
+ };
+
+ $scope.onSubmit = async function(){
+ // var body = "Titel: " + $scope.titel + "\n";
+ var body = "Fachbereich/Organisation: " + $scope.organization + "\n\n";
+ body += "Kontaktdaten: " + $scope.contactDetails + "\n\n";
+ body += "Feedback Typ: " + $scope.feedbackType + "\n\n";
+ body += "Feedback Inhalt: " + $scope.feedbackContent + "\n\n";
+ body += "KomMonitor Bewertung: " + $scope.like + "\n\n";
+
+ // var blobFile = $('#attachment').files[0];
+ var files = document.getElementById('attachment').files;
+ if(files.length > 0){
+ var uploadFile = files[0];
+ var base64 = await fileToBase64(uploadFile);
+ $scope.attachment = base64;
+ }
+
+
+ // var formData = undefined;
+ //
+ // if(files.length > 0){
+ // formData = new FormData();
+ //
+ // for (var i = 0; i < files.length; i++) {
+ // formData.append("files[]", files[i]);
+ // }
+ //
+ // }
+
+ var mailInput = {};
+ mailInput.recipientMail = feedbackMailRecipient;
+ mailInput.subject = "KomMonitor - Feedback";
+ mailInput.body = body;
+ mailInput.attachment = $scope.attachment;
+
+ $scope.sendMail(mailInput);
+ };
+
+ $scope.sendMail = function(mailInput){
+
+ if(! $scope.validate()){
+ return;
+ }
+
+ $scope.error = undefined;
+ $scope.success = undefined;
+
+ $http({
+ url: emailURL,
+ method: "POST",
+ data: mailInput
+ }).then(function successCallback(response) {
+
+ $scope.error = undefined;
+ $scope.success = true;
+
+ $("#mailSuccessInfo").show();
+
+ // auto-close after 3 seconds
+ // setTimeout(function() {
+ // $("#mailSuccessInfo").alert('close');
+ // }, 3000);
+
+ }, function errorCallback(error) {
+
+ $scope.error = error;
+ $scope.success = undefined;
+
+ $("#mailErrorInfo").show();
+ });
+ }
+
+ $scope.onCloseSuccessAlert = function(){
+ $("#mailSuccessInfo").hide();
+ };
+
+ $scope.onCloseErrorAlert = function(){
+ $("#mailErrorInfo").hide();
+ };
+
+ $scope.validate = function(){
+ if ($scope.feedbackType && $scope.feedbackContent){
+ return true;
+ }
+ return false;
+ }
+
+ $scope.reset = function(){
+ $scope.organization = undefined;
+ $scope.contactDetails = undefined;
+ $scope.feedbackType = undefined;
+ $scope.feedbackContent = undefined;
+ $scope.like = undefined;
+ $scope.attachment = undefined;
+ document.getElementById("attachment").value = "";
+
+ $scope.error = undefined;
+ $scope.success = undefined;
+ }
+
+ }
+]});
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.module.js b/app/components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.module.js
index 57061d6ab..e000de570 100644
--- a/app/components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.module.js
+++ b/app/components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.module.js
@@ -1,14 +1,15 @@
+"use strict";
angular.module('feedbackModal', []);
-
// custom directive to read files and parse them to ngModel
-angular.module("feedbackModal").directive("selectNgFiles", function() {
- return {
- require: "ngModel",
- link: function postLink(scope,elem,attrs,ngModel) {
- elem.on("change", function(e) {
- var files = elem[0].files;
- ngModel.$setViewValue(files);
- })
- }
- }
+angular.module("feedbackModal").directive("selectNgFiles", function () {
+ return {
+ require: "ngModel",
+ link: function postLink(scope, elem, attrs, ngModel) {
+ elem.on("change", function (e) {
+ var files = elem[0].files;
+ ngModel.$setViewValue(files);
+ });
+ }
+ };
});
+//# sourceMappingURL=feedback-modal.module.js.map
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.module.js.map b/app/components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.module.js.map
new file mode 100644
index 000000000..78f70d9c4
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.module.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"feedback-modal.module.js","sourceRoot":"","sources":["feedback-modal.module.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;AAEpC,2DAA2D;AAC3D,OAAO,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC,SAAS,CAAC,eAAe,EAAE;IACzD,OAAO;QACL,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,SAAS,QAAQ,CAAC,KAAK,EAAC,IAAI,EAAC,KAAK,EAAC,OAAO;YAC9C,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE,UAAS,CAAC;gBAC1B,IAAI,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;gBAC1B,OAAO,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;YAC/B,CAAC,CAAC,CAAA;QACJ,CAAC;KACF,CAAA;AACH,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.module.ts b/app/components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.module.ts
new file mode 100644
index 000000000..57061d6ab
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/feedbackModal/feedback-modal.module.ts
@@ -0,0 +1,14 @@
+angular.module('feedbackModal', []);
+
+// custom directive to read files and parse them to ngModel
+angular.module("feedbackModal").directive("selectNgFiles", function() {
+ return {
+ require: "ngModel",
+ link: function postLink(scope,elem,attrs,ngModel) {
+ elem.on("change", function(e) {
+ var files = elem[0].files;
+ ngModel.$setViewValue(files);
+ })
+ }
+ }
+});
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/indicatorRadar/indicator-radar.component.js b/app/components/kommonitorUserInterface/kommonitorControls/indicatorRadar/indicator-radar.component.js
index 95cceef81..57b899a81 100644
--- a/app/components/kommonitorUserInterface/kommonitorControls/indicatorRadar/indicator-radar.component.js
+++ b/app/components/kommonitorUserInterface/kommonitorControls/indicatorRadar/indicator-radar.component.js
@@ -1,612 +1,484 @@
+"use strict";
angular
- .module('indicatorRadar')
- .component(
- 'indicatorRadar',
- {
- templateUrl: "components/kommonitorUserInterface/kommonitorControls/indicatorRadar/indicator-radar.template.html",
-
- controller: [
- 'kommonitorDataExchangeService', 'kommonitorDiagramHelperService', 'kommonitorFilterHelperService', '$scope', '$rootScope', '$timeout', '$http', '__env',
- function indicatorRadarController(
- kommonitorDataExchangeService, kommonitorDiagramHelperService, kommonitorFilterHelperService, $scope, $rootScope, $timeout, $http, __env) {
- /*
- * reference to kommonitorDataExchangeService instances
- */
- this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
- this.kommonitorDiagramHelperServiceInstance = kommonitorDiagramHelperService;
-
- var self = this;
-
- $scope.activeTab = 0;
-
- // initialize any adminLTE box widgets
- $('.box').boxWidget();
-
- $(window).on('resize', function () {
- if ($scope.radarChart != null && $scope.radarChart != undefined) {
- $scope.radarChart.resize();
- }
- });
-
- $scope.$on("resizeDiagrams", function (event) {
-
- setTimeout(function () {
- if ($scope.radarChart != null && $scope.radarChart != undefined) {
- $scope.radarChart.resize();
- }
- }, 350);
- });
-
- const DATE_PREFIX = __env.indicatorDatePrefix;
-
- $scope.indicatorNameFilter = undefined;
-
- $scope.eventsRegistered = false;
-
- var numberOfDecimals = __env.numberOfDecimals;
-
- $scope.setupCompleted = true;
-
- $scope.onChangeFilterSameUnitAndSameTime = function(){
- if($scope.radarChart){
- $scope.radarChart.dispose();
- $scope.radarChart = echarts.init(document.getElementById('radarDiagram'));
- }
- kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime = [];
-
- kommonitorDiagramHelperService.setupIndicatorPropertiesForCurrentSpatialUnitAndTime(kommonitorDiagramHelperService.filterSameUnitAndSameTime);
- };
-
- $scope.date;
- $scope.spatialUnitName;
-
- $scope.$on("updateDiagrams", function (event, indicatorMetadataAndGeoJSON, spatialUnitName, spatialUnitId, date, defaultBrew, gtMeasureOfValueBrew, ltMeasureOfValueBrew, dynamicIncreaseBrew, dynamicDecreaseBrew, isMeasureOfValueChecked, measureOfValue, justRestyling) {
-
- // if the layer is just restyled (i.e. due to change of measureOfValue)
- // then we do not need to costly update the radar diagram
- if (justRestyling) {
- return;
- }
-
- console.log("updating radar diagram");
-
- $scope.setupCompleted = false;
-
- updateRadarChart(indicatorMetadataAndGeoJSON, spatialUnitName, spatialUnitId, date);
-
- $rootScope.$broadcast("preserveHighlightedFeatures");
-
- });
-
- // RADAR CHART TIME SERIES FUNCTION
- var updateRadarChart = async function (indicatorMetadataAndGeoJSON, spatialUnitName, spatialUnitId, date) {
- // based on prepared DOM, initialize echarts instance
- $scope.date = date;
- $scope.spatialUnitName = spatialUnitName;
-
- if (!$scope.radarChart)
- $scope.radarChart = echarts.init(document.getElementById('radarDiagram'));
- else {
- // explicitly kill and reinstantiate radar diagram to avoid zombie states on spatial unit change
- $scope.radarChart.dispose();
- $scope.radarChart = echarts.init(document.getElementById('radarDiagram'));
- kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime = new Array();
- }
-
- await $scope.radarChart.showLoading();
-
- kommonitorDiagramHelperService.setupIndicatorPropertiesForCurrentSpatialUnitAndTime();
-
- $scope.activeTab = 0;
- if(kommonitorDataExchangeService.selectedIndicator.creationType == "COMPUTATION"){
- $scope.activeTab = 1;
- }
- if(kommonitorDataExchangeService.selectedIndicator.isHeadlineIndicator){
- $scope.activeTab = 2;
- }
-
- modifyRadarContent(kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime);
- };
-
- $scope.onChangeSelectedDate = function(input){
- if(input.isSelected){
- modifyRadarContent(kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime);
- }
- };
-
- var wait = ms => new Promise((r, j) => setTimeout(r, ms));
-
- $scope.$on("allIndicatorPropertiesForCurrentSpatialUnitAndTime setup begin", async function (event) {
-
- await wait(130);
- $scope.setupCompleted = false;
-
-
- $timeout(function(){
- $scope.$digest();
- }, 500);
-
- });
-
- $scope.$on("allIndicatorPropertiesForCurrentSpatialUnitAndTime setup completed", async function (event) {
-
- await wait(130);
- $scope.setupCompleted = true;
-
-
- $timeout(function(){
- $scope.$digest();
- self.filterDisplayedIndicatorsOnRadar();
- }, 500);
-
- });
-
- var modifyRadarContent = async function (indicatorsForRadar) {
- var indicatorArrayForRadarChart = new Array();
- var defaultSeriesValueArray = new Array();
-
- var sampleProperties = null;
-
- for (var i = 0; i < indicatorsForRadar.length; i++) {
- if (indicatorsForRadar[i].isSelected) {
-
- await kommonitorDiagramHelperService.fetchIndicatorPropertiesIfNotExists(i);
-
- // make object to hold indicatorName, max value and average value
- var indicatorProperties = indicatorsForRadar[i].indicatorProperties;
-
- if(kommonitorFilterHelperService.completelyRemoveFilteredFeaturesFromDisplay && kommonitorFilterHelperService.filteredIndicatorFeatureIds.size > 0){
- indicatorProperties = indicatorProperties.filter(featureProperties => ! kommonitorFilterHelperService.featureIsCurrentlyFiltered(featureProperties[__env.FEATURE_ID_PROPERTY_NAME]));
- }
-
- sampleProperties = indicatorsForRadar[i].indicatorProperties;
-
- // var closestApplicableTimestamp = kommonitorDiagramHelperService.findClostestTimestamForTargetDate(indicatorsForRadar[i], $scope.date);
- // indicatorsForRadar[i].closestTimestamp = closestApplicableTimestamp;
-
- var sample = indicatorProperties[0];
- var maxValue = sample[DATE_PREFIX + indicatorsForRadar[i].selectedDate];
- var minValue = sample[DATE_PREFIX + indicatorsForRadar[i].selectedDate];
- var valueSum = 0;
-
- for (var indicatorPropertyInstance of indicatorProperties) {
- // for average only apply real numeric values
- if (!kommonitorDataExchangeService.indicatorValueIsNoData(indicatorPropertyInstance[DATE_PREFIX + indicatorsForRadar[i].selectedDate])) {
- var value = kommonitorDataExchangeService.getIndicatorValueFromArray_asNumber(indicatorPropertyInstance, indicatorsForRadar[i].selectedDate)
- valueSum += value;
-
- if (value > maxValue)
- maxValue = value;
-
- if (value < minValue)
- minValue = value;
- }
- }
-
- if (minValue == null) {
- minValue = 0;
- }
-
- if (maxValue == null) {
- maxValue = 1;
- }
-
- // IT MIGHT HAPPEN THAT AN INDICATOR IS INSPECTED THAT DOES NOT SUPPORT THE DATE
- // HENCE ONLY ADD VALUES TO DEFAULT IF THEY SHOW MEANINGFUL VALUES
- // if(valueSum != null){
- indicatorArrayForRadarChart.push({
- name: indicatorsForRadar[i].indicatorMetadata.indicatorName + " - " + indicatorsForRadar[i].selectedDate,
- unit: indicatorsForRadar[i].indicatorMetadata.unit,
- max: maxValue,
- min: minValue
- });
-
- defaultSeriesValueArray.push(kommonitorDataExchangeService.getIndicatorValue_asNumber(Number(valueSum / indicatorProperties.length)));
- // }
- }
-
- }
-
- if (defaultSeriesValueArray.length === 0) {
-
- if ($scope.radarChart) {
- $scope.radarChart.dispose();
- $scope.radarChart = undefined;
- }
-
- }
- else {
-
- if (!$scope.radarChart)
- $scope.radarChart = echarts.init(document.getElementById('radarDiagram'));
- // else{
- // // explicitly kill and reinstantiate radar diagram to avoid zombie states on spatial unit change
- // $scope.radarChart.dispose();
- // $scope.radarChart = echarts.init(document.getElementById('radarDiagram'));
- // }
-
- $scope.radarOption = {
- grid: {
- left: '4%',
- top: 0,
- right: '4%',
- bottom: 30,
- containLabel: true
- },
- title: {
- text: 'Indikatorenradar - ' + $scope.spatialUnitName + ' - ' + $scope.date,
- left: 'center',
- top: 0,
- show: false
- },
- tooltip: {
- confine: 'true',
- formatter: function (params) {
-
- var string = "" + params.name + " ";
-
- for (var index = 0; index < params.value.length; index++) {
- string += $scope.radarOption.radar.indicator[index].name + ": " + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(params.value[index]) + " [" + $scope.radarOption.radar.indicator[index].unit + "] ";
- };
-
- return string;
- }
- // position: ['50%', '50%']
- },
- toolbox: {
- show: true,
- right: '15',
- feature: {
- // mark : {show: true},
- dataView: {
- show: kommonitorDataExchangeService.showDiagramExportButtons, readOnly: true, title: "Datenansicht", lang: ['Datenansicht - Indikatorenradar', 'schließen', 'refresh'], optionToContent: function (opt) {
-
- //
- //
- //
- //
Indikator-Name
- //
Beschreibung der Verknüpfung
- //
- //
- //
- //
- //
{{indicator.referencedIndicatorName}}
- //
{{indicator.referencedIndicatorDescription}}
- //
- //
- //
-
- var radarSeries = opt.series[0].data;
- var indicators = opt.radar[0].indicator;
-
- var dataTableId = "radarDataTable";
- var tableExportName = opt.title[0].text;
-
- var htmlString = '
';
- htmlString += "";
- htmlString += "
";
- htmlString += "
Feature-Name
";
-
- for (var i = 0; i < indicators.length; i++) {
- htmlString += "
";
-
- $rootScope.$broadcast("AppendExportButtonsForTable", dataTableId, tableExportName);
-
- return htmlString;
- }
- },
- restore: { show: false, title: "Darstellung erneuern" },
- saveAsImage: { show: true, title: "Export", pixelRatio: 4 }
- }
- },
- legend: {
- type: "scroll",
- bottom: 0,
- align: 'left',
- left: 5,
- data: ['Arithmetisches Mittel']
- },
- radar: {
- // shape: 'circle',
- // name: {
- // textStyle: {
- // color: '#fff',
- // backgroundColor: '#999',
- // borderRadius: 3,
- // padding: [3, 5]
- // }
- // },
- name: {
- formatter: function (value, indicator) {
-
- return kommonitorDataExchangeService.formatIndicatorNameForLabel(value, 15);
- },
- textStyle: {
- color: '#525252'
- },
- fontSize: 11
- },
- indicator: indicatorArrayForRadarChart
- },
- series: [{
- name: 'Indikatorvergleich',
- type: 'radar',
- symbolSize: 8,
- data: [
- {
- value: defaultSeriesValueArray,
- name: 'Arithmetisches Mittel',
- lineStyle: {
- color: 'gray',
- type: 'dashed',
- width: 3
- },
- itemStyle: {
- borderWidth: 2,
- color: 'gray'
- },
- emphasis: {
- lineStyle: {
- width: 4
- },
- itemStyle: {
- borderType: 'dashed'
- }
- }
- }
- ]
- }]
- };
-
- // check if any feature is still clicked/selected
- // then append those as series within radar chart
- appendSelectedFeaturesIfNecessary(sampleProperties);
-
- // use configuration item and data specified to show chart
- $scope.radarChart.setOption($scope.radarOption);
-
- $scope.radarChart.hideLoading();
- setTimeout(function () {
- $scope.radarChart.resize();
- $scope.$digest();
- }, 350);
- registerEventsIfNecessary();
-
- }
-
- }
-
- var appendSelectedFeaturesIfNecessary = function (sampleProperties) {
-
- for (var propertiesInstance of sampleProperties) {
- if (kommonitorFilterHelperService.featureIsCurrentlySelected(propertiesInstance[__env.FEATURE_ID_PROPERTY_NAME])) {
- appendSeriesToRadarChart(propertiesInstance);
- }
- }
- };
-
- function registerEventsIfNecessary() {
- if (!$scope.eventsRegistered) {
- // when hovering over elements of the chart then highlight them in the map.
- $scope.radarChart.on('mouseOver', function (params) {
- // $scope.userHoveresOverItem = true;
- var spatialFeatureName = params.data.name;
- // console.log(spatialFeatureName);
- if(spatialFeatureName){
- $rootScope.$broadcast("highlightFeatureOnMap", spatialFeatureName);
- }
-
- });
-
- $scope.radarChart.on('mouseOut', function (params) {
- // $scope.userHoveresOverItem = false;
-
- var spatialFeatureName = params.data.name;
- // console.log(spatialFeatureName);
- if(spatialFeatureName){
- $rootScope.$broadcast("unhighlightFeatureOnMap", spatialFeatureName);
- }
-
- });
-
- //disable feature removal for radar chart - seems to be unintuititve
- // $scope.radarChart.on('click', function(params){
- // var spatialFeatureName = params.data.name;
- // // console.log(spatialFeatureName);
- // if(spatialFeatureName){
- // $rootScope.$broadcast("switchHighlightFeatureOnMap", spatialFeatureName);
- // }
- // });
-
- $scope.eventsRegistered = true;
- }
- };
-
-
- $scope.$on("updateDiagramsForHoveredFeature", function (event, featureProperties) {
-
- if (!$scope.radarChart || !$scope.radarOption || !$scope.radarOption.legend || !$scope.radarOption.series) {
- return;
- }
-
- if (!kommonitorFilterHelperService.featureIsCurrentlySelected(featureProperties[__env.FEATURE_ID_PROPERTY_NAME])) {
- appendSeriesToRadarChart(featureProperties);
- }
-
- highlightFeatureInRadarChart(featureProperties);
- });
-
- var appendSeriesToRadarChart = function (featureProperties) {
- // append feature name to legend
- $scope.radarOption.legend.data.push(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
-
- // create feature data series
- var featureSeries = {};
- featureSeries.name = featureProperties[__env.FEATURE_NAME_PROPERTY_NAME];
- featureSeries.value = new Array();
- featureSeries.emphasis = {
- lineStyle: {
- width: 4,
- type: 'dotted'
- }
- };
- featureSeries.lineStyle = {
- width: 3,
- type: 'solid'
- };
- featureSeries.itemStyle = {
- borderWidth: 2
- };
-
-
- // for each indicator create series data entry for feature
- for (var i = 0; i < kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime.length; i++) {
- if (kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime[i].isSelected) {
- // make object to hold indicatorName, max value and average value
- var indicatorProperties = kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime[i].indicatorProperties;
- var date = kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime[i].selectedDate;
-
- for (var indicatorPropertyInstance of indicatorProperties) {
- if (indicatorPropertyInstance[__env.FEATURE_NAME_PROPERTY_NAME] == featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]) {
- if (!kommonitorDataExchangeService.indicatorValueIsNoData(indicatorPropertyInstance[DATE_PREFIX + date])) {
- featureSeries.value.push(kommonitorDataExchangeService.getIndicatorValueFromArray_asNumber(indicatorPropertyInstance, date));
- }
- else {
- featureSeries.value.push(null);
- }
- break;
- }
- }
- }
-
- }
-
- $scope.radarOption.series[0].data.push(featureSeries);
-
- $scope.radarChart.setOption($scope.radarOption);
- setTimeout(function () {
- $scope.radarChart.resize();
- }, 350);
- registerEventsIfNecessary();
- };
-
- var highlightFeatureInRadarChart = function (featureProperties) {
- // highlight the corresponding bar diagram item
- // get series index of series
- var dataIndex = getSeriesDataIndexByFeatureName(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
-
- if (dataIndex > -1) {
- $scope.radarChart.dispatchAction({
- type: 'highlight',
- seriesIndex: 0,
- dataIndex: dataIndex
- });
- }
- };
-
- $scope.$on("updateDiagramsForUnhoveredFeature", function (event, featureProperties) {
-
- if (!$scope.radarChart || !$scope.radarOption || !$scope.radarOption.legend || !$scope.radarOption.series) {
- return;
- }
-
- unhighlightFeatureInRadarChart(featureProperties);
-
- if (!kommonitorFilterHelperService.featureIsCurrentlySelected(featureProperties[__env.FEATURE_ID_PROPERTY_NAME])) {
- removeSeriesFromRadarChart(featureProperties);
- }
- });
-
- var getSeriesDataIndexByFeatureName = function (featureName) {
- for (var index = 0; index < $scope.radarOption.series[0].data.length; index++) {
- if ($scope.radarOption.series[0].data[index].name == featureName)
- return index;
- }
-
- //return -1 if none was found
- return -1;
- };
-
- var removeSeriesFromRadarChart = function (featureProperties) {
- // remove feature from legend
- var legendIndex = $scope.radarOption.legend.data.indexOf(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
- if (legendIndex > -1) {
- $scope.radarOption.legend.data.splice(legendIndex, 1);
- }
-
- // remove feature data series
- var dataIndex = getSeriesDataIndexByFeatureName(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
- if (dataIndex > -1) {
- $scope.radarOption.series[0].data.splice(dataIndex, 1);
- }
-
- // second parameter tells echarts to not merge options with previous data. hence really remove series from graphic
- $scope.radarChart.setOption($scope.radarOption, true);
- setTimeout(function () {
- $scope.radarChart.resize();
- }, 350);
- registerEventsIfNecessary();
- };
-
- var unhighlightFeatureInRadarChart = function (featureProperties) {
- // highlight the corresponding bar diagram item
- // get series index of series
- var dataIndex = getSeriesDataIndexByFeatureName(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
-
- if (dataIndex > -1) {
- $scope.radarChart.dispatchAction({
- type: 'downplay',
- seriesIndex: 0,
- dataIndex: dataIndex
- });
- }
- };
-
- this.filterDisplayedIndicatorsOnRadar = function () {
- console.log("Filtering indicator radar");
-
- modifyRadarContent(kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime);
-
- }
-
- this.selectAllIndicatorsForRadar = function () {
-
- for (var indicator of kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime) {
- indicator.isSelected = true;
- }
-
- modifyRadarContent(kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime);
- }
-
- this.deselectAllIndicatorsForRadar = function () {
-
- for (var indicator of kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime) {
- indicator.isSelected = false;
- }
-
- modifyRadarContent(kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime);
- }
-
-
- }]
- });
+ .module('indicatorRadar')
+ .component('indicatorRadar', {
+ templateUrl: "components/kommonitorUserInterface/kommonitorControls/indicatorRadar/indicator-radar.template.html",
+ controller: [
+ 'kommonitorDataExchangeService', 'kommonitorDiagramHelperService', 'kommonitorFilterHelperService', '$scope', '$rootScope', '$timeout', '$http', '__env',
+ function indicatorRadarController(kommonitorDataExchangeService, kommonitorDiagramHelperService, kommonitorFilterHelperService, $scope, $rootScope, $timeout, $http, __env) {
+ /*
+ * reference to kommonitorDataExchangeService instances
+ */
+ this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
+ this.kommonitorDiagramHelperServiceInstance = kommonitorDiagramHelperService;
+ var self = this;
+ $scope.activeTab = 0;
+ // initialize any adminLTE box widgets
+ $('.box').boxWidget();
+ $(window).on('resize', function () {
+ if ($scope.radarChart != null && $scope.radarChart != undefined) {
+ $scope.radarChart.resize();
+ }
+ });
+ $scope.$on("resizeDiagrams", function (event) {
+ setTimeout(function () {
+ if ($scope.radarChart != null && $scope.radarChart != undefined) {
+ $scope.radarChart.resize();
+ }
+ }, 350);
+ });
+ const DATE_PREFIX = __env.indicatorDatePrefix;
+ $scope.indicatorNameFilter = undefined;
+ $scope.eventsRegistered = false;
+ var numberOfDecimals = __env.numberOfDecimals;
+ $scope.setupCompleted = true;
+ $scope.onChangeFilterSameUnitAndSameTime = function () {
+ if ($scope.radarChart) {
+ $scope.radarChart.dispose();
+ $scope.radarChart = echarts.init(document.getElementById('radarDiagram'));
+ }
+ kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime = [];
+ kommonitorDiagramHelperService.setupIndicatorPropertiesForCurrentSpatialUnitAndTime(kommonitorDiagramHelperService.filterSameUnitAndSameTime);
+ };
+ $scope.date;
+ $scope.spatialUnitName;
+ $scope.$on("updateDiagrams", function (event, indicatorMetadataAndGeoJSON, spatialUnitName, spatialUnitId, date, defaultBrew, gtMeasureOfValueBrew, ltMeasureOfValueBrew, dynamicIncreaseBrew, dynamicDecreaseBrew, isMeasureOfValueChecked, measureOfValue, justRestyling) {
+ // if the layer is just restyled (i.e. due to change of measureOfValue)
+ // then we do not need to costly update the radar diagram
+ if (justRestyling) {
+ return;
+ }
+ console.log("updating radar diagram");
+ $scope.setupCompleted = false;
+ updateRadarChart(indicatorMetadataAndGeoJSON, spatialUnitName, spatialUnitId, date);
+ $rootScope.$broadcast("preserveHighlightedFeatures");
+ });
+ // RADAR CHART TIME SERIES FUNCTION
+ var updateRadarChart = async function (indicatorMetadataAndGeoJSON, spatialUnitName, spatialUnitId, date) {
+ // based on prepared DOM, initialize echarts instance
+ $scope.date = date;
+ $scope.spatialUnitName = spatialUnitName;
+ if (!$scope.radarChart)
+ $scope.radarChart = echarts.init(document.getElementById('radarDiagram'));
+ else {
+ // explicitly kill and reinstantiate radar diagram to avoid zombie states on spatial unit change
+ $scope.radarChart.dispose();
+ $scope.radarChart = echarts.init(document.getElementById('radarDiagram'));
+ kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime = new Array();
+ }
+ await $scope.radarChart.showLoading();
+ kommonitorDiagramHelperService.setupIndicatorPropertiesForCurrentSpatialUnitAndTime();
+ $scope.activeTab = 0;
+ if (kommonitorDataExchangeService.selectedIndicator.creationType == "COMPUTATION") {
+ $scope.activeTab = 1;
+ }
+ if (kommonitorDataExchangeService.selectedIndicator.isHeadlineIndicator) {
+ $scope.activeTab = 2;
+ }
+ modifyRadarContent(kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime);
+ };
+ $scope.onChangeSelectedDate = function (input) {
+ if (input.isSelected) {
+ modifyRadarContent(kommonitorDiagramHelperService.indicatorPropertiesForCurrentSpatialUnitAndTime);
+ }
+ };
+ var wait = ms => new Promise((r, j) => setTimeout(r, ms));
+ $scope.$on("allIndicatorPropertiesForCurrentSpatialUnitAndTime setup begin", async function (event) {
+ await wait(130);
+ $scope.setupCompleted = false;
+ $timeout(function () {
+ $scope.$digest();
+ }, 500);
+ });
+ $scope.$on("allIndicatorPropertiesForCurrentSpatialUnitAndTime setup completed", async function (event) {
+ await wait(130);
+ $scope.setupCompleted = true;
+ $timeout(function () {
+ $scope.$digest();
+ self.filterDisplayedIndicatorsOnRadar();
+ }, 500);
+ });
+ var modifyRadarContent = async function (indicatorsForRadar) {
+ var indicatorArrayForRadarChart = new Array();
+ var defaultSeriesValueArray = new Array();
+ var sampleProperties = null;
+ for (var i = 0; i < indicatorsForRadar.length; i++) {
+ if (indicatorsForRadar[i].isSelected) {
+ await kommonitorDiagramHelperService.fetchIndicatorPropertiesIfNotExists(i);
+ // make object to hold indicatorName, max value and average value
+ var indicatorProperties = indicatorsForRadar[i].indicatorProperties;
+ if (kommonitorFilterHelperService.completelyRemoveFilteredFeaturesFromDisplay && kommonitorFilterHelperService.filteredIndicatorFeatureIds.size > 0) {
+ indicatorProperties = indicatorProperties.filter(featureProperties => !kommonitorFilterHelperService.featureIsCurrentlyFiltered(featureProperties[__env.FEATURE_ID_PROPERTY_NAME]));
+ }
+ sampleProperties = indicatorsForRadar[i].indicatorProperties;
+ // var closestApplicableTimestamp = kommonitorDiagramHelperService.findClostestTimestamForTargetDate(indicatorsForRadar[i], $scope.date);
+ // indicatorsForRadar[i].closestTimestamp = closestApplicableTimestamp;
+ var sample = indicatorProperties[0];
+ var maxValue = sample[DATE_PREFIX + indicatorsForRadar[i].selectedDate];
+ var minValue = sample[DATE_PREFIX + indicatorsForRadar[i].selectedDate];
+ var valueSum = 0;
+ for (var indicatorPropertyInstance of indicatorProperties) {
+ // for average only apply real numeric values
+ if (!kommonitorDataExchangeService.indicatorValueIsNoData(indicatorPropertyInstance[DATE_PREFIX + indicatorsForRadar[i].selectedDate])) {
+ var value = kommonitorDataExchangeService.getIndicatorValueFromArray_asNumber(indicatorPropertyInstance, indicatorsForRadar[i].selectedDate);
+ valueSum += value;
+ if (value > maxValue)
+ maxValue = value;
+ if (value < minValue)
+ minValue = value;
+ }
+ }
+ if (minValue == null) {
+ minValue = 0;
+ }
+ if (maxValue == null) {
+ maxValue = 1;
+ }
+ // IT MIGHT HAPPEN THAT AN INDICATOR IS INSPECTED THAT DOES NOT SUPPORT THE DATE
+ // HENCE ONLY ADD VALUES TO DEFAULT IF THEY SHOW MEANINGFUL VALUES
+ // if(valueSum != null){
+ indicatorArrayForRadarChart.push({
+ name: indicatorsForRadar[i].indicatorMetadata.indicatorName + " - " + indicatorsForRadar[i].selectedDate,
+ unit: indicatorsForRadar[i].indicatorMetadata.unit,
+ max: maxValue,
+ min: minValue
+ });
+ defaultSeriesValueArray.push(kommonitorDataExchangeService.getIndicatorValue_asNumber(Number(valueSum / indicatorProperties.length)));
+ // }
+ }
+ }
+ if (defaultSeriesValueArray.length === 0) {
+ if ($scope.radarChart) {
+ $scope.radarChart.dispose();
+ $scope.radarChart = undefined;
+ }
+ }
+ else {
+ if (!$scope.radarChart)
+ $scope.radarChart = echarts.init(document.getElementById('radarDiagram'));
+ // else{
+ // // explicitly kill and reinstantiate radar diagram to avoid zombie states on spatial unit change
+ // $scope.radarChart.dispose();
+ // $scope.radarChart = echarts.init(document.getElementById('radarDiagram'));
+ // }
+ $scope.radarOption = {
+ grid: {
+ left: '4%',
+ top: 0,
+ right: '4%',
+ bottom: 30,
+ containLabel: true
+ },
+ title: {
+ text: 'Indikatorenradar - ' + $scope.spatialUnitName + ' - ' + $scope.date,
+ left: 'center',
+ top: 0,
+ show: false
+ },
+ tooltip: {
+ confine: 'true',
+ formatter: function (params) {
+ var string = "" + params.name + " ";
+ for (var index = 0; index < params.value.length; index++) {
+ string += $scope.radarOption.radar.indicator[index].name + ": " + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(params.value[index]) + " [" + $scope.radarOption.radar.indicator[index].unit + "] ";
+ }
+ ;
+ return string;
+ }
+ // position: ['50%', '50%']
+ },
+ toolbox: {
+ show: true,
+ right: '15',
+ feature: {
+ // mark : {show: true},
+ dataView: {
+ show: kommonitorDataExchangeService.showDiagramExportButtons, readOnly: true, title: "Datenansicht", lang: ['Datenansicht - Indikatorenradar', 'schließen', 'refresh'], optionToContent: function (opt) {
+ //
+ //
+ //
+ //
Indikator-Name
+ //
Beschreibung der Verknüpfung
+ //
+ //
+ //
+ //
+ //
{{indicator.referencedIndicatorName}}
+ //
{{indicator.referencedIndicatorDescription}}
+ //
+ //
+ //
+ var radarSeries = opt.series[0].data;
+ var indicators = opt.radar[0].indicator;
+ var dataTableId = "radarDataTable";
+ var tableExportName = opt.title[0].text;
+ var htmlString = '
';
+ htmlString += "";
+ htmlString += "
";
+ htmlString += "
Feature-Name
";
+ for (var i = 0; i < indicators.length; i++) {
+ htmlString += "
KomMonitor ist ein GIS-gestütztes, raum-zeitliches Monitoring-Portal.
-
- Der Anwendungsfokus liegt dabei auf der Darstellung und Analyse von Indikatoren-Zeitreihendaten.
- Darüber hinaus können ergänzende Geodatensätze im System hinterlegt und zusätzlich in die Kartenanwendung eingeladen werden.
- Außerdem bietet KomMonitor die Möglichkeit, Erreichbarkeitsanalysen auf Basis von
- OpenStreetMap Daten und dem OpenRouteService durchzuführen.
-
- Sollten Sie eine fehlerhafte Darstellung oder unerklärliche Anwendungsfehler erhalten, so nehmen Sie bitte Kontakt zum Entwickler-Team auf.
-
-
-
-
-
-
- Besuchen Sie gerne das KomMonitor Wiki auf GitHub als zentrale Anlaufstelle für Dokumentationen und Hinweise zur Bedienung (derzeit noch im Aufbau).
-
- Weiterhin bietet die WebseiteKomMonitor.de allgemeine Informationen.
-
- Zuletzt sei auf das Forumhttps://forum.kommonitor.de/ hingewiesen. Tauschen Sie sich dort gerne mit weiteren Anwendern und Entwicklern aus und tragen so zur Weiterentwicklung des Systems bei.
-
-
Entwickelt wird die technische Plattform gemeinsam durch die Hochschule Bochum, Ruhr-Universität Bochum und diverse Kommunen und Kreisverwaltungen, im Rahmen des BMBF-geförderten Forschungsprojekts KomMonitor.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
Wichtige Informationen zu KomMonitor - Version 2.1.13
KomMonitor ist ein GIS-gestütztes, raum-zeitliches Monitoring-Portal.
+
+ Der Anwendungsfokus liegt dabei auf der Darstellung und Analyse von Indikatoren-Zeitreihendaten.
+ Darüber hinaus können ergänzende Geodatensätze im System hinterlegt und zusätzlich in die Kartenanwendung eingeladen werden.
+ Außerdem bietet KomMonitor die Möglichkeit, Erreichbarkeitsanalysen auf Basis von
+ OpenStreetMap Daten und dem
+ OpenRouteService durchzuführen.
+ Sollten Sie eine fehlerhafte Darstellung oder unerklärliche Anwendungsfehler erhalten, so nehmen Sie bitte Kontakt zum Entwickler-Team auf.
+
+
+
+
+
+
+ Besuchen Sie gerne das KomMonitor Wiki auf GitHub als zentrale Anlaufstelle für Dokumentationen und Hinweise zur Bedienung (derzeit noch im Aufbau).
+ Weiterhin bietet die WebseiteKomMonitor.de allgemeine Informationen.
+ Zuletzt sei auf das Forumhttps://forum.kommonitor.de/ hingewiesen. Tauschen Sie sich dort gerne mit weiteren Anwendern und Entwicklern aus und tragen so zur Weiterentwicklung des Systems bei.
+
Entwickelt wird die technische Plattform gemeinsam durch die Hochschule Bochum, Ruhr-Universität Bochum und diverse Kommunen und Kreisverwaltungen, im Rahmen des BMBF-geförderten Forschungsprojekts KomMonitor.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/info-modal.component.js b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/info-modal.component.js
new file mode 100644
index 000000000..07543d08e
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/info-modal.component.js
@@ -0,0 +1,68 @@
+"use strict";
+angular.module('infoModal').component('infoModal', {
+ templateUrl: "components/kommonitorUserInterface/kommonitorControls/infoModal/info-modal.template.html",
+ controller: [
+ 'kommonitorDataExchangeService', '$scope', '$rootScope', '__env', '$timeout',
+ function InfoModalController(kommonitorDataExchangeService, $scope, $rootScope, __env, $timeout) {
+ this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
+ $scope.isHideGreetings = false;
+ $scope.init = function () {
+ if (!(localStorage.getItem("hideKomMonitorAppGreeting") === "true")) {
+ $scope.isHideGreetings = false;
+ $('#infoModal').modal('show');
+ }
+ else {
+ $scope.isHideGreetings = true;
+ $("#changeHideGreetingsInput").prop('checked', true);
+ }
+ let tab1 = document.getElementById("infoModalTab1");
+ tab1.innerHTML = __env.standardInfoModalTabTitle;
+ tab1.click();
+ tab1.focus();
+ if (__env.enableExtendedInfoModal) {
+ let tab3 = document.getElementById("infoModalTab3");
+ let tab3content = document.getElementById("infoModalTab3Content");
+ tab3.innerHTML = __env.extendedInfoModalTabTitle;
+ tab3content.innerHTML = __env.extendedInfoModalHTMLMessage;
+ }
+ else {
+ document.getElementById("infoModalTab3").style.display = "none";
+ }
+ $timeout(function () {
+ $scope.$digest();
+ }, 250);
+ };
+ var onChangeHideGreetings = function () {
+ if ($scope.isHideGreetings) {
+ localStorage.setItem("hideKomMonitorAppGreeting", "true");
+ }
+ else {
+ localStorage.setItem("hideKomMonitorAppGreeting", "false");
+ }
+ };
+ $('#changeHideGreetingsInput').on('click', function (event) {
+ if ($scope.isHideGreetings) {
+ $scope.isHideGreetings = false;
+ }
+ else {
+ $scope.isHideGreetings = true;
+ }
+ onChangeHideGreetings();
+ event.stopPropagation();
+ });
+ var callStartGuidedTour = function () {
+ $('#infoModal').modal('hide');
+ $rootScope.$broadcast("startGuidedTour");
+ };
+ $(document).on('click', '#callStartGuidedTourButton', function (e) {
+ callStartGuidedTour();
+ });
+ $scope.showFeedbackForm = function () {
+ $('#infoModal').modal('hide');
+ $('#feedbackModal').modal('show');
+ };
+ $scope.init();
+ }
+ ]
+});
+//# sourceMappingURL=info-modal.component.js.map
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/info-modal.module.js b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/info-modal.module.js
new file mode 100644
index 000000000..9c9d0df40
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/info-modal.module.js
@@ -0,0 +1,3 @@
+"use strict";
+angular.module('infoModal', ['versionInfo']);
+//# sourceMappingURL=info-modal.module.js.map
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.component.js b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.component.js
index c1a9e683b..fc67fc291 100644
--- a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.component.js
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.component.js
@@ -1,498 +1,400 @@
+"use strict";
angular
- .module('kommonitorBalance')
- .component(
- 'kommonitorBalance',
- {
- templateUrl : "components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.template.html",
- /*
- * injected with a modules service method that manages
- * enabled tabs
- */
- controller : ['$scope', '$rootScope', 'kommonitorMapService', 'kommonitorDataExchangeService', 'kommonitorDiagramHelperService',
- 'kommonitorFilterHelperService', '__env', '$timeout',
- function kommonitorBalanceController($scope, $rootScope, kommonitorMapService, kommonitorDataExchangeService, kommonitorDiagramHelperService,
- kommonitorFilterHelperService, __env, $timeout) {
-
- const INDICATOR_DATE_PREFIX = __env.indicatorDatePrefix;
- this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
- this.kommonitorMapServiceInstance = kommonitorMapService;
- // initialize any adminLTE box widgets
- $('.box').boxWidget();
- var numberOfDecimals = __env.numberOfDecimals;
-
- $scope.targetDate;
- $scope.targetIndicatorProperty;
- $scope.rangeSliderForBalance;
- $scope.datesAsMs;
-
- $scope.trendConfig_allFeatures = {
- showMinMax: true,
- showCompleteTimeseries: true,
- trendComputationType: "linear"
- };
-
- $scope.$on("DisableBalance", function (event) {
- kommonitorDataExchangeService.isBalanceChecked = false;
- if($scope.rangeSliderForBalance){
- $scope.rangeSliderForBalance.update({
- block: true
- });
- }
-
- // reanebalbe DateSlider on map
- $rootScope.$broadcast("EnableDateSlider");
- });
-
- $scope.$on("replaceBalancedIndicator", function (event) {
- if(kommonitorDataExchangeService.isBalanceChecked){
- $scope.onChangeUseBalance();
- }
- });
-
- $scope.onChangeUseBalance = function(){
-
- if(kommonitorDataExchangeService.isMeasureOfValueChecked){
- kommonitorDataExchangeService.isMeasureOfValueChecked = false;
- }
-
- let indicatorMetadataAndGeoJSON = undefined;
-
- if(kommonitorDataExchangeService.isBalanceChecked){
- kommonitorDataExchangeService.isMeasureOfValueChecked = false;
- $scope.rangeSliderForBalance.update({
- block: false
- });
- // disable DateSlider on map
- $rootScope.$broadcast("DisableDateSlider");
- if(!kommonitorDataExchangeService.indicatorAndMetadataAsBalance){
- kommonitorDataExchangeService.indicatorAndMetadataAsBalance = jQuery.extend(true, {}, kommonitorDataExchangeService.selectedIndicator);
- var indicatorType = kommonitorDataExchangeService.selectedIndicator.indicatorType;
- if(indicatorType.includes("ABSOLUTE")){
- kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorType = "DYNAMIC_ABSOLUTE";
- }
- else if(indicatorType.includes("RELATIVE")){
- kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorType = "DYNAMIC_RELATIVE";
- }
- else if(indicatorType.includes("STANDARDIZED")){
- kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorType = "DYNAMIC_STANDARDIZED";
- }
-
- }
- var data = $scope.rangeSliderForBalance.options;
- computeAndSetBalance(data);
- $timeout(function(){
-
- $scope.updateTrendChart(kommonitorDataExchangeService.selectedIndicator, data);
- });
- indicatorMetadataAndGeoJSON = kommonitorDataExchangeService.indicatorAndMetadataAsBalance;
- // kommonitorMapService.replaceIndicatorGeoJSON(kommonitorDataExchangeService.indicatorAndMetadataAsBalance, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, $scope.targetDate, true);
- }
- else{
- $scope.rangeSliderForBalance.update({
- block: true
- });
- // reanebalbe DateSlider on map
- $rootScope.$broadcast("EnableDateSlider");
- indicatorMetadataAndGeoJSON = kommonitorDataExchangeService.selectedIndicator;
- // kommonitorMapService.replaceIndicatorGeoJSON(kommonitorDataExchangeService.selectedIndicator, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, $scope.targetDate, true);
- }
- // $rootScope.$broadcast("updateIndicatorValueRangeFilter", $scope.targetDate, indicatorMetadataAndGeoJSON);
- // do not replace dataset directly, but check if any filter can be applied when changing balance mode for the current dataset
- kommonitorFilterHelperService.filterAndReplaceDataset();
- };
-
- function getFromDate_asPropertyString(datePeriodSliderData){
- // data.from and data.to are index values, not the actual dates! (because we use "values" for rangeSlider)
- var fromDate = new Date($scope.datesAsMs[datePeriodSliderData.from]);
-
- var fromDateAsPropertyString = makePropertyString(fromDate);
- var fromDateAsString = makeDateString(fromDate);
- if(!kommonitorDataExchangeService.indicatorAndMetadataAsBalance.applicableDates.includes(fromDateAsString)){
- fromDateAsPropertyString = snapToNearestUpperDate(fromDate, kommonitorDataExchangeService.indicatorAndMetadataAsBalance.applicableDates);
- }
-
- return fromDateAsPropertyString;
- }
-
- function getFromDate_asDateString(datePeriodSliderData){
- // data.from and data.to are index values, not the actual dates! (because we use "values" for rangeSlider)
- var fromDate = new Date($scope.datesAsMs[datePeriodSliderData.from]);
-
- var fromDateAsString = makeDateString(fromDate);
-
- return fromDateAsString;
- }
-
- function getToDate_asPropertyString(datePeriodSliderData){
- // data.from and data.to are index values, not the actual dates! (because we use "values" for rangeSlider)
- var toDate = new Date($scope.datesAsMs[datePeriodSliderData.to]);
-
- var toDateAsPropertyString = makePropertyString(toDate);
- var toDateAsString = makeDateString(toDate);
- if(!kommonitorDataExchangeService.indicatorAndMetadataAsBalance.applicableDates.includes(toDateAsString)){
- toDateAsPropertyString = snapToNearestLowerDate(toDate, kommonitorDataExchangeService.indicatorAndMetadataAsBalance.applicableDates);
- }
-
- return toDateAsPropertyString;
- }
-
- function getToDate_asDateString(datePeriodSliderData){
- // data.from and data.to are index values, not the actual dates! (because we use "values" for rangeSlider)
- var toDate = new Date($scope.datesAsMs[datePeriodSliderData.to]);
-
- var toDateAsString = makeDateString(toDate);
-
- return toDateAsString;
- }
-
- $scope.updateTrendChart = function(indicatorMetadata, datePeriodSliderData){
-
-
- var fromDateAsPropertyString = getFromDate_asPropertyString(datePeriodSliderData);
- var toDateAsPropertyString = getToDate_asPropertyString(datePeriodSliderData);
- var fromDateString = getFromDate_asDateString(datePeriodSliderData);
- var fromDate_date = new Date(fromDateString);
- var toDateString = getToDate_asDateString(datePeriodSliderData);
- var toDate_date = new Date(toDateString);
-
- // based on prepared DOM, initialize echarts instance
- if (!$scope.trendChart_allFeatures)
- $scope.trendChart_allFeatures = echarts.init(document.getElementById('trendDiagram_allFeatures'));
- else {
- // explicitly kill and reinstantiate line diagram to avoid zombie states on spatial unit change
- $scope.trendChart_allFeatures.dispose();
- $scope.trendChart_allFeatures = echarts.init(document.getElementById('trendDiagram_allFeatures'));
- }
-
- // use configuration item and data specified to show chart
- $scope.trendOption = kommonitorDiagramHelperService.makeTrendChartOptions_forAllFeatures(indicatorMetadata, fromDateAsPropertyString, toDateAsPropertyString, $scope.trendConfig_allFeatures.showMinMax, $scope.trendConfig_allFeatures.showCompleteTimeseries, $scope.trendConfig_allFeatures.trendComputationType);
- $scope.trendChart_allFeatures.setOption($scope.trendOption);
-
- $scope.trendChart_allFeatures.hideLoading();
- setTimeout(function () {
- $scope.trendChart_allFeatures.resize();
- }, 350);
-
- var trendData = [];
- var timeseriesData;
- if($scope.trendConfig_allFeatures.showMinMax){
- timeseriesData = $scope.trendOption.series[2].data;
- }
- else{
- timeseriesData = $scope.trendOption.series[0].data;
- }
-
- if($scope.trendConfig_allFeatures.showCompleteTimeseries){
- for (let index = 0; index < timeseriesData.length; index++) {
- var dateCandidate = new Date(indicatorMetadata.applicableDates[index]);
- if(dateCandidate >= fromDate_date && dateCandidate <= toDate_date){
- trendData.push(timeseriesData[index]);
- }
- }
- }
- else{
- trendData = timeseriesData;
- }
-
-
-
- var balanceValue = kommonitorDataExchangeService.getIndicatorValue_asFormattedText(trendData[trendData.length - 1] - trendData[0]);
- var balanceValue_numeric = kommonitorDataExchangeService.getIndicatorValue_asNumber(trendData[trendData.length - 1] - trendData[0]);
- var trendValue = "";
- if(Number(balanceValue_numeric) == 0){
- trendValue = "gleichbleibend";
- }
- else if(Number(balanceValue_numeric) > 0){
- trendValue = "steigend";
- }
- else {
- trendValue = "sinkend";
- }
-
- $scope.trendAnalysis_allFeatures = {
- min: kommonitorDataExchangeService.getIndicatorValue_asFormattedText(ecStat.statistics.min(trendData)),
- max: kommonitorDataExchangeService.getIndicatorValue_asFormattedText(ecStat.statistics.max(trendData)),
- deviation: kommonitorDataExchangeService.getIndicatorValue_asFormattedText(ecStat.statistics.deviation(trendData)),
- variance: kommonitorDataExchangeService.getIndicatorValue_asFormattedText(ecStat.statistics.sampleVariance(trendData)),
- mean: kommonitorDataExchangeService.getIndicatorValue_asFormattedText(ecStat.statistics.mean(trendData)),
- median: kommonitorDataExchangeService.getIndicatorValue_asFormattedText(ecStat.statistics.median(trendData)),
- balance: balanceValue,
- trend: trendValue
- };
-
- };
-
- $(window).on('resize', function () {
-
- if ($scope.trendChart_allFeatures != null && $scope.trendChart_allFeatures != undefined) {
- $scope.trendChart_allFeatures.resize();
- }
- });
-
- $scope.$on("updateBalanceSlider", function (event, date) {
-
- // kommonitorDataExchangeService.isBalanceChecked = false;
- $scope.setupRangeSliderForBalance(date);
-
- });
-
- function dateToTS (date) {
- return date.valueOf();
- }
-
- function tsToDateString (dateAsMs) {
- var date = new Date(dateAsMs);
-
- /**
- * TODO FIXME dateSLider formatter will return only year for now to prevent misleading month and day settings
- */
-
- // return date.getFullYear();
-
- return date.toLocaleDateString("de-DE", {
- year: 'numeric',
- month: 'long',
- day: 'numeric'
- });
- }
-
- function dateToDateString (date) {
-
- /**
- * TODO FIXME dateSLider formatter will return only year for now to prevent misleading month and day settings
- */
-
- // return date.getFullYear();
-
- return date.toLocaleDateString("de-DE", {
- year: 'numeric',
- month: 'long',
- day: 'numeric'
- });
- }
-
- function createDatesFromIndicatorDates(indicatorDates) {
-
- $scope.datesAsMs = [];
-
- for (var index=0; index < indicatorDates.length; index++){
- // year-month-day
- var dateComponents = indicatorDates[index].split("-");
- $scope.datesAsMs.push(dateToTS(new Date(Number(dateComponents[0]), Number(dateComponents[1]) - 1, Number(dateComponents[2]))));
- }
- return $scope.datesAsMs;
- }
-
- $scope.createNewBalanceInstance = function(){
- $scope.datesAsMs = createDatesFromIndicatorDates(kommonitorDataExchangeService.selectedIndicator.applicableDates);
-
- // new Date() uses month between 0-11!
- $("#rangeSliderForBalance").ionRangeSlider({
- skin: "big",
- type: "double",
- grid: true,
- values: $scope.datesAsMs,
- from: 0, // index, not the date
- to: $scope.datesAsMs.length -1, // index, not the date
- force_edges: true,
- prettify: tsToDateString,
- onChange: onChangeBalanceRange
- });
-
- $scope.rangeSliderForBalance = $("#rangeSliderForBalance").data("ionRangeSlider");
- // make sure that the handles are properly set to min and max values
- $scope.rangeSliderForBalance.update({
- from: 0, // index, not the date
- to: $scope.datesAsMs.length -1, // index, not the date
- });
-
- if (!kommonitorDataExchangeService.isBalanceChecked){
- // deactivate balance slider
- $scope.rangeSliderForBalance.update({
- block: true
- });
- }
- }
-
- $scope.removeOldInstance = function(){
- kommonitorDataExchangeService.rangeFilterData = undefined;
- $scope.rangeSliderForBalance.destroy();
- kommonitorDataExchangeService.indicatorAndMetadataAsBalance = undefined;
-
- var domNode = document.getElementById("rangeSliderForBalance");
-
- while (domNode.hasChildNodes()) {
- domNode.removeChild(domNode.lastChild);
- }
- }
-
- $scope.setupRangeSliderForBalance = function(date){
- $scope.targetDate = date;
- $scope.targetIndicatorProperty = INDICATOR_DATE_PREFIX + date;
-
- if(!$scope.rangeSliderForBalance){
- // create new instance
- $scope.createNewBalanceInstance();
- }
- else {
-
- if(kommonitorDataExchangeService.indicatorAndMetadataAsBalance){
- if (kommonitorDataExchangeService.selectedIndicator.indicatorName != kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorName){
- $scope.removeOldInstance();
-
- // create new instance
- $scope.createNewBalanceInstance();
- }
- }
- else{
- $scope.removeOldInstance();
- $scope.createNewBalanceInstance();
- }
-
- }
-
- };
-
- function onChangeBalanceRange (data) {
- // create balance GeoJSON and broadcast "replaceIndicatorAsGeoJSON"
- // Called every time handle position is changed
- computeAndSetBalance(data);
-
- $timeout(function(){
-
- $scope.updateTrendChart(kommonitorDataExchangeService.selectedIndicator, data);
- });
- // we must call replaceIndicatorGeoJSON because the feature vaues have changed. calling restyle will not work as it only restyles the old numbers
- kommonitorMapService.replaceIndicatorGeoJSON(kommonitorDataExchangeService.indicatorAndMetadataAsBalance, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, $scope.targetDate, true);
- };
-
- function computeAndSetBalance(data){
-
- var fromDateAsPropertyString = getFromDate_asPropertyString(data);
- var fromDateAsDateString = getFromDate_asDateString(data);
- var toDateAsPropertyString = getToDate_asPropertyString(data);
- var toDateAsDateString = getToDate_asDateString(data);
-
- // make another copy of selectedIndicator to ensure that feature order matches each other
- kommonitorDataExchangeService.indicatorAndMetadataAsBalance = jQuery.extend(true, {}, kommonitorDataExchangeService.selectedIndicator);
-
- var indicatorType = kommonitorDataExchangeService.selectedIndicator.indicatorType;
- if(indicatorType.includes("ABSOLUTE")){
- kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorType = "DYNAMIC_ABSOLUTE";
- }
- else if(indicatorType.includes("RELATIVE")){
- kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorType = "DYNAMIC_RELATIVE";
- }
- else if(indicatorType.includes("STANDARDIZED")){
- kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorType = "DYNAMIC_STANDARDIZED";
- }
-
- // set value of selected target property with the computed balance between toDate - FromDate
- for (var index=0; index < kommonitorDataExchangeService.selectedIndicator.geoJSON.features.length; index++){
-
- var toDateValue = kommonitorDataExchangeService.getIndicatorValue_asNumber(kommonitorDataExchangeService.selectedIndicator.geoJSON.features[index].properties[toDateAsPropertyString]);
- var fromDateValue = kommonitorDataExchangeService.getIndicatorValue_asNumber(kommonitorDataExchangeService.selectedIndicator.geoJSON.features[index].properties[fromDateAsPropertyString]);
-
- kommonitorDataExchangeService.indicatorAndMetadataAsBalance.geoJSON.features[index].properties[$scope.targetIndicatorProperty] = kommonitorDataExchangeService.getIndicatorValue_asNumber(toDateValue - fromDateValue);
- }
- kommonitorDataExchangeService.indicatorAndMetadataAsBalance['fromDate'] = dateToDateString(new Date(fromDateAsDateString));
- kommonitorDataExchangeService.indicatorAndMetadataAsBalance['toDate'] = dateToDateString(new Date(toDateAsDateString));
- };
-
- function snapToNearestLowerDate(toDate, applicableDates){
- var earliestDateStringComponents = applicableDates[0].split("-");
-
- var earliestDate = new Date(Number(earliestDateStringComponents[0]), Number(earliestDateStringComponents[1]) - 1, Number(earliestDateStringComponents[2]));
- var dateCandidate = toDate;
-
- // we need to find the next lower applicableDate
- // decrement day by one and check, otherwise decrement month and/or year
- dateCandidate.setDate(dateCandidate.getDate() - 1);
-
- var targetDatePropertyString;
-
- while(dateCandidate > earliestDate){
- var dateCandidateString = makeDateString(dateCandidate);
- if (applicableDates.includes(dateCandidateString)){
- targetDatePropertyString = makePropertyString(dateCandidate);
- break;
- }
- //decrement by one day
- dateCandidate.setDate(dateCandidate.getDate() - 1);
- }
-
- if(!targetDatePropertyString)
- targetDatePropertyString = makePropertyString(earliestDate);
-
- return targetDatePropertyString;
- }
-
- function snapToNearestUpperDate(fromDate, applicableDates){
- var lastDateStringComponents = applicableDates[applicableDates.length -1].split("-");
-
- var latestDate = new Date(Number(lastDateStringComponents[0]), Number(lastDateStringComponents[1]) - 1, Number(lastDateStringComponents[2]));
- var dateCandidate = fromDate;
-
- // we need to find the next upper applicableDate
- // increment day by one and check, otherwise increment month and/or year
- dateCandidate.setDate(dateCandidate.getDate() + 1);
-
- var targetDatePropertyString;
-
- while(dateCandidate < latestDate){
- var dateCandidateString = makeDateString(dateCandidate);
- if (applicableDates.includes(dateCandidateString)){
- targetDatePropertyString = makePropertyString(dateCandidate);
- break;
- }
- //increment by one day
- dateCandidate.setDate(dateCandidate.getDate() + 1);
- }
-
- if(!targetDatePropertyString)
- targetDatePropertyString = makePropertyString(latestDate);
-
- return targetDatePropertyString;
- }
-
- function makeDateString(date){
- var year = date.getFullYear();
- var month = date.getMonth() + 1; // because month is from 0-11
- var day = date.getDate();
-
- // e.g. 2018-01-01
- var propertyString = year + "-";
-
- if(month < 10){
- propertyString += "0" + month + "-";
- }
- else{
- propertyString += month + "-";
- }
-
- if(day < 10){
- propertyString += "0" + day;
- }
- else{
- propertyString += day;
- }
-
- return propertyString;
- };
-
- function makePropertyString(date){
- var dateString = makeDateString(date);
- return INDICATOR_DATE_PREFIX + dateString;
- };
-
-
- $scope.onChangeTrendConfig = function(){
- var data = $scope.rangeSliderForBalance.result;
- $timeout(function(){
-
- $scope.updateTrendChart(kommonitorDataExchangeService.selectedIndicator, data);
- });
- };
-
- }]
- });
+ .module('kommonitorBalance')
+ .component('kommonitorBalance', {
+ templateUrl: "components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.template.html",
+ /*
+ * injected with a modules service method that manages
+ * enabled tabs
+ */
+ controller: ['$scope', '$rootScope', 'kommonitorMapService', 'kommonitorDataExchangeService', 'kommonitorDiagramHelperService',
+ 'kommonitorFilterHelperService', '__env', '$timeout',
+ function kommonitorBalanceController($scope, $rootScope, kommonitorMapService, kommonitorDataExchangeService, kommonitorDiagramHelperService, kommonitorFilterHelperService, __env, $timeout) {
+ const INDICATOR_DATE_PREFIX = __env.indicatorDatePrefix;
+ this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
+ this.kommonitorMapServiceInstance = kommonitorMapService;
+ // initialize any adminLTE box widgets
+ $('.box').boxWidget();
+ var numberOfDecimals = __env.numberOfDecimals;
+ $scope.targetDate;
+ $scope.targetIndicatorProperty;
+ $scope.rangeSliderForBalance;
+ $scope.datesAsMs;
+ $scope.trendConfig_allFeatures = {
+ showMinMax: true,
+ showCompleteTimeseries: true,
+ trendComputationType: "linear"
+ };
+ $scope.$on("DisableBalance", function (event) {
+ kommonitorDataExchangeService.isBalanceChecked = false;
+ if ($scope.rangeSliderForBalance) {
+ $scope.rangeSliderForBalance.update({
+ block: true
+ });
+ }
+ // reanebalbe DateSlider on map
+ $rootScope.$broadcast("EnableDateSlider");
+ });
+ $scope.$on("replaceBalancedIndicator", function (event) {
+ if (kommonitorDataExchangeService.isBalanceChecked) {
+ $scope.onChangeUseBalance();
+ }
+ });
+ $scope.onChangeUseBalance = function () {
+ if (kommonitorDataExchangeService.isMeasureOfValueChecked) {
+ kommonitorDataExchangeService.isMeasureOfValueChecked = false;
+ }
+ let indicatorMetadataAndGeoJSON = undefined;
+ if (kommonitorDataExchangeService.isBalanceChecked) {
+ kommonitorDataExchangeService.isMeasureOfValueChecked = false;
+ $scope.rangeSliderForBalance.update({
+ block: false
+ });
+ // disable DateSlider on map
+ $rootScope.$broadcast("DisableDateSlider");
+ if (!kommonitorDataExchangeService.indicatorAndMetadataAsBalance) {
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance = jQuery.extend(true, {}, kommonitorDataExchangeService.selectedIndicator);
+ var indicatorType = kommonitorDataExchangeService.selectedIndicator.indicatorType;
+ if (indicatorType.includes("ABSOLUTE")) {
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorType = "DYNAMIC_ABSOLUTE";
+ }
+ else if (indicatorType.includes("RELATIVE")) {
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorType = "DYNAMIC_RELATIVE";
+ }
+ else if (indicatorType.includes("STANDARDIZED")) {
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorType = "DYNAMIC_STANDARDIZED";
+ }
+ }
+ var data = $scope.rangeSliderForBalance.options;
+ computeAndSetBalance(data);
+ $timeout(function () {
+ $scope.updateTrendChart(kommonitorDataExchangeService.selectedIndicator, data);
+ });
+ indicatorMetadataAndGeoJSON = kommonitorDataExchangeService.indicatorAndMetadataAsBalance;
+ // kommonitorMapService.replaceIndicatorGeoJSON(kommonitorDataExchangeService.indicatorAndMetadataAsBalance, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, $scope.targetDate, true);
+ }
+ else {
+ $scope.rangeSliderForBalance.update({
+ block: true
+ });
+ // reanebalbe DateSlider on map
+ $rootScope.$broadcast("EnableDateSlider");
+ indicatorMetadataAndGeoJSON = kommonitorDataExchangeService.selectedIndicator;
+ // kommonitorMapService.replaceIndicatorGeoJSON(kommonitorDataExchangeService.selectedIndicator, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, $scope.targetDate, true);
+ }
+ // $rootScope.$broadcast("updateIndicatorValueRangeFilter", $scope.targetDate, indicatorMetadataAndGeoJSON);
+ // do not replace dataset directly, but check if any filter can be applied when changing balance mode for the current dataset
+ kommonitorFilterHelperService.filterAndReplaceDataset();
+ };
+ function getFromDate_asPropertyString(datePeriodSliderData) {
+ // data.from and data.to are index values, not the actual dates! (because we use "values" for rangeSlider)
+ var fromDate = new Date($scope.datesAsMs[datePeriodSliderData.from]);
+ var fromDateAsPropertyString = makePropertyString(fromDate);
+ var fromDateAsString = makeDateString(fromDate);
+ if (!kommonitorDataExchangeService.indicatorAndMetadataAsBalance.applicableDates.includes(fromDateAsString)) {
+ fromDateAsPropertyString = snapToNearestUpperDate(fromDate, kommonitorDataExchangeService.indicatorAndMetadataAsBalance.applicableDates);
+ }
+ return fromDateAsPropertyString;
+ }
+ function getFromDate_asDateString(datePeriodSliderData) {
+ // data.from and data.to are index values, not the actual dates! (because we use "values" for rangeSlider)
+ var fromDate = new Date($scope.datesAsMs[datePeriodSliderData.from]);
+ var fromDateAsString = makeDateString(fromDate);
+ return fromDateAsString;
+ }
+ function getToDate_asPropertyString(datePeriodSliderData) {
+ // data.from and data.to are index values, not the actual dates! (because we use "values" for rangeSlider)
+ var toDate = new Date($scope.datesAsMs[datePeriodSliderData.to]);
+ var toDateAsPropertyString = makePropertyString(toDate);
+ var toDateAsString = makeDateString(toDate);
+ if (!kommonitorDataExchangeService.indicatorAndMetadataAsBalance.applicableDates.includes(toDateAsString)) {
+ toDateAsPropertyString = snapToNearestLowerDate(toDate, kommonitorDataExchangeService.indicatorAndMetadataAsBalance.applicableDates);
+ }
+ return toDateAsPropertyString;
+ }
+ function getToDate_asDateString(datePeriodSliderData) {
+ // data.from and data.to are index values, not the actual dates! (because we use "values" for rangeSlider)
+ var toDate = new Date($scope.datesAsMs[datePeriodSliderData.to]);
+ var toDateAsString = makeDateString(toDate);
+ return toDateAsString;
+ }
+ $scope.updateTrendChart = function (indicatorMetadata, datePeriodSliderData) {
+ var fromDateAsPropertyString = getFromDate_asPropertyString(datePeriodSliderData);
+ var toDateAsPropertyString = getToDate_asPropertyString(datePeriodSliderData);
+ var fromDateString = getFromDate_asDateString(datePeriodSliderData);
+ var fromDate_date = new Date(fromDateString);
+ var toDateString = getToDate_asDateString(datePeriodSliderData);
+ var toDate_date = new Date(toDateString);
+ // based on prepared DOM, initialize echarts instance
+ if (!$scope.trendChart_allFeatures)
+ $scope.trendChart_allFeatures = echarts.init(document.getElementById('trendDiagram_allFeatures'));
+ else {
+ // explicitly kill and reinstantiate line diagram to avoid zombie states on spatial unit change
+ $scope.trendChart_allFeatures.dispose();
+ $scope.trendChart_allFeatures = echarts.init(document.getElementById('trendDiagram_allFeatures'));
+ }
+ // use configuration item and data specified to show chart
+ $scope.trendOption = kommonitorDiagramHelperService.makeTrendChartOptions_forAllFeatures(indicatorMetadata, fromDateAsPropertyString, toDateAsPropertyString, $scope.trendConfig_allFeatures.showMinMax, $scope.trendConfig_allFeatures.showCompleteTimeseries, $scope.trendConfig_allFeatures.trendComputationType);
+ $scope.trendChart_allFeatures.setOption($scope.trendOption);
+ $scope.trendChart_allFeatures.hideLoading();
+ setTimeout(function () {
+ $scope.trendChart_allFeatures.resize();
+ }, 350);
+ var trendData = [];
+ var timeseriesData;
+ if ($scope.trendConfig_allFeatures.showMinMax) {
+ timeseriesData = $scope.trendOption.series[2].data;
+ }
+ else {
+ timeseriesData = $scope.trendOption.series[0].data;
+ }
+ if ($scope.trendConfig_allFeatures.showCompleteTimeseries) {
+ for (let index = 0; index < timeseriesData.length; index++) {
+ var dateCandidate = new Date(indicatorMetadata.applicableDates[index]);
+ if (dateCandidate >= fromDate_date && dateCandidate <= toDate_date) {
+ trendData.push(timeseriesData[index]);
+ }
+ }
+ }
+ else {
+ trendData = timeseriesData;
+ }
+ var balanceValue = kommonitorDataExchangeService.getIndicatorValue_asFormattedText(trendData[trendData.length - 1] - trendData[0]);
+ var balanceValue_numeric = kommonitorDataExchangeService.getIndicatorValue_asNumber(trendData[trendData.length - 1] - trendData[0]);
+ var trendValue = "";
+ if (Number(balanceValue_numeric) == 0) {
+ trendValue = "gleichbleibend";
+ }
+ else if (Number(balanceValue_numeric) > 0) {
+ trendValue = "steigend";
+ }
+ else {
+ trendValue = "sinkend";
+ }
+ $scope.trendAnalysis_allFeatures = {
+ min: kommonitorDataExchangeService.getIndicatorValue_asFormattedText(ecStat.statistics.min(trendData)),
+ max: kommonitorDataExchangeService.getIndicatorValue_asFormattedText(ecStat.statistics.max(trendData)),
+ deviation: kommonitorDataExchangeService.getIndicatorValue_asFormattedText(ecStat.statistics.deviation(trendData)),
+ variance: kommonitorDataExchangeService.getIndicatorValue_asFormattedText(ecStat.statistics.sampleVariance(trendData)),
+ mean: kommonitorDataExchangeService.getIndicatorValue_asFormattedText(ecStat.statistics.mean(trendData)),
+ median: kommonitorDataExchangeService.getIndicatorValue_asFormattedText(ecStat.statistics.median(trendData)),
+ balance: balanceValue,
+ trend: trendValue
+ };
+ };
+ $(window).on('resize', function () {
+ if ($scope.trendChart_allFeatures != null && $scope.trendChart_allFeatures != undefined) {
+ $scope.trendChart_allFeatures.resize();
+ }
+ });
+ $scope.$on("updateBalanceSlider", function (event, date) {
+ // kommonitorDataExchangeService.isBalanceChecked = false;
+ $scope.setupRangeSliderForBalance(date);
+ });
+ function dateToTS(date) {
+ return date.valueOf();
+ }
+ function tsToDateString(dateAsMs) {
+ var date = new Date(dateAsMs);
+ /**
+ * TODO FIXME dateSLider formatter will return only year for now to prevent misleading month and day settings
+ */
+ // return date.getFullYear();
+ return date.toLocaleDateString("de-DE", {
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric'
+ });
+ }
+ function dateToDateString(date) {
+ /**
+ * TODO FIXME dateSLider formatter will return only year for now to prevent misleading month and day settings
+ */
+ // return date.getFullYear();
+ return date.toLocaleDateString("de-DE", {
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric'
+ });
+ }
+ function createDatesFromIndicatorDates(indicatorDates) {
+ $scope.datesAsMs = [];
+ for (var index = 0; index < indicatorDates.length; index++) {
+ // year-month-day
+ var dateComponents = indicatorDates[index].split("-");
+ $scope.datesAsMs.push(dateToTS(new Date(Number(dateComponents[0]), Number(dateComponents[1]) - 1, Number(dateComponents[2]))));
+ }
+ return $scope.datesAsMs;
+ }
+ $scope.createNewBalanceInstance = function () {
+ $scope.datesAsMs = createDatesFromIndicatorDates(kommonitorDataExchangeService.selectedIndicator.applicableDates);
+ // new Date() uses month between 0-11!
+ $("#rangeSliderForBalance").ionRangeSlider({
+ skin: "big",
+ type: "double",
+ grid: true,
+ values: $scope.datesAsMs,
+ from: 0,
+ to: $scope.datesAsMs.length - 1,
+ force_edges: true,
+ prettify: tsToDateString,
+ onChange: onChangeBalanceRange
+ });
+ $scope.rangeSliderForBalance = $("#rangeSliderForBalance").data("ionRangeSlider");
+ // make sure that the handles are properly set to min and max values
+ $scope.rangeSliderForBalance.update({
+ from: 0,
+ to: $scope.datesAsMs.length - 1, // index, not the date
+ });
+ if (!kommonitorDataExchangeService.isBalanceChecked) {
+ // deactivate balance slider
+ $scope.rangeSliderForBalance.update({
+ block: true
+ });
+ }
+ };
+ $scope.removeOldInstance = function () {
+ kommonitorDataExchangeService.rangeFilterData = undefined;
+ $scope.rangeSliderForBalance.destroy();
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance = undefined;
+ var domNode = document.getElementById("rangeSliderForBalance");
+ while (domNode.hasChildNodes()) {
+ domNode.removeChild(domNode.lastChild);
+ }
+ };
+ $scope.setupRangeSliderForBalance = function (date) {
+ $scope.targetDate = date;
+ $scope.targetIndicatorProperty = INDICATOR_DATE_PREFIX + date;
+ if (!$scope.rangeSliderForBalance) {
+ // create new instance
+ $scope.createNewBalanceInstance();
+ }
+ else {
+ if (kommonitorDataExchangeService.indicatorAndMetadataAsBalance) {
+ if (kommonitorDataExchangeService.selectedIndicator.indicatorName != kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorName) {
+ $scope.removeOldInstance();
+ // create new instance
+ $scope.createNewBalanceInstance();
+ }
+ }
+ else {
+ $scope.removeOldInstance();
+ $scope.createNewBalanceInstance();
+ }
+ }
+ };
+ function onChangeBalanceRange(data) {
+ // create balance GeoJSON and broadcast "replaceIndicatorAsGeoJSON"
+ // Called every time handle position is changed
+ computeAndSetBalance(data);
+ $timeout(function () {
+ $scope.updateTrendChart(kommonitorDataExchangeService.selectedIndicator, data);
+ });
+ // we must call replaceIndicatorGeoJSON because the feature vaues have changed. calling restyle will not work as it only restyles the old numbers
+ kommonitorMapService.replaceIndicatorGeoJSON(kommonitorDataExchangeService.indicatorAndMetadataAsBalance, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, $scope.targetDate, true);
+ }
+ ;
+ function computeAndSetBalance(data) {
+ var fromDateAsPropertyString = getFromDate_asPropertyString(data);
+ var fromDateAsDateString = getFromDate_asDateString(data);
+ var toDateAsPropertyString = getToDate_asPropertyString(data);
+ var toDateAsDateString = getToDate_asDateString(data);
+ // make another copy of selectedIndicator to ensure that feature order matches each other
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance = jQuery.extend(true, {}, kommonitorDataExchangeService.selectedIndicator);
+ var indicatorType = kommonitorDataExchangeService.selectedIndicator.indicatorType;
+ if (indicatorType.includes("ABSOLUTE")) {
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorType = "DYNAMIC_ABSOLUTE";
+ }
+ else if (indicatorType.includes("RELATIVE")) {
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorType = "DYNAMIC_RELATIVE";
+ }
+ else if (indicatorType.includes("STANDARDIZED")) {
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorType = "DYNAMIC_STANDARDIZED";
+ }
+ // set value of selected target property with the computed balance between toDate - FromDate
+ for (var index = 0; index < kommonitorDataExchangeService.selectedIndicator.geoJSON.features.length; index++) {
+ var toDateValue = kommonitorDataExchangeService.getIndicatorValue_asNumber(kommonitorDataExchangeService.selectedIndicator.geoJSON.features[index].properties[toDateAsPropertyString]);
+ var fromDateValue = kommonitorDataExchangeService.getIndicatorValue_asNumber(kommonitorDataExchangeService.selectedIndicator.geoJSON.features[index].properties[fromDateAsPropertyString]);
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance.geoJSON.features[index].properties[$scope.targetIndicatorProperty] = kommonitorDataExchangeService.getIndicatorValue_asNumber(toDateValue - fromDateValue);
+ }
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance['fromDate'] = dateToDateString(new Date(fromDateAsDateString));
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance['toDate'] = dateToDateString(new Date(toDateAsDateString));
+ }
+ ;
+ function snapToNearestLowerDate(toDate, applicableDates) {
+ var earliestDateStringComponents = applicableDates[0].split("-");
+ var earliestDate = new Date(Number(earliestDateStringComponents[0]), Number(earliestDateStringComponents[1]) - 1, Number(earliestDateStringComponents[2]));
+ var dateCandidate = toDate;
+ // we need to find the next lower applicableDate
+ // decrement day by one and check, otherwise decrement month and/or year
+ dateCandidate.setDate(dateCandidate.getDate() - 1);
+ var targetDatePropertyString;
+ while (dateCandidate > earliestDate) {
+ var dateCandidateString = makeDateString(dateCandidate);
+ if (applicableDates.includes(dateCandidateString)) {
+ targetDatePropertyString = makePropertyString(dateCandidate);
+ break;
+ }
+ //decrement by one day
+ dateCandidate.setDate(dateCandidate.getDate() - 1);
+ }
+ if (!targetDatePropertyString)
+ targetDatePropertyString = makePropertyString(earliestDate);
+ return targetDatePropertyString;
+ }
+ function snapToNearestUpperDate(fromDate, applicableDates) {
+ var lastDateStringComponents = applicableDates[applicableDates.length - 1].split("-");
+ var latestDate = new Date(Number(lastDateStringComponents[0]), Number(lastDateStringComponents[1]) - 1, Number(lastDateStringComponents[2]));
+ var dateCandidate = fromDate;
+ // we need to find the next upper applicableDate
+ // increment day by one and check, otherwise increment month and/or year
+ dateCandidate.setDate(dateCandidate.getDate() + 1);
+ var targetDatePropertyString;
+ while (dateCandidate < latestDate) {
+ var dateCandidateString = makeDateString(dateCandidate);
+ if (applicableDates.includes(dateCandidateString)) {
+ targetDatePropertyString = makePropertyString(dateCandidate);
+ break;
+ }
+ //increment by one day
+ dateCandidate.setDate(dateCandidate.getDate() + 1);
+ }
+ if (!targetDatePropertyString)
+ targetDatePropertyString = makePropertyString(latestDate);
+ return targetDatePropertyString;
+ }
+ function makeDateString(date) {
+ var year = date.getFullYear();
+ var month = date.getMonth() + 1; // because month is from 0-11
+ var day = date.getDate();
+ // e.g. 2018-01-01
+ var propertyString = year + "-";
+ if (month < 10) {
+ propertyString += "0" + month + "-";
+ }
+ else {
+ propertyString += month + "-";
+ }
+ if (day < 10) {
+ propertyString += "0" + day;
+ }
+ else {
+ propertyString += day;
+ }
+ return propertyString;
+ }
+ ;
+ function makePropertyString(date) {
+ var dateString = makeDateString(date);
+ return INDICATOR_DATE_PREFIX + dateString;
+ }
+ ;
+ $scope.onChangeTrendConfig = function () {
+ var data = $scope.rangeSliderForBalance.result;
+ $timeout(function () {
+ $scope.updateTrendChart(kommonitorDataExchangeService.selectedIndicator, data);
+ });
+ };
+ }]
+});
+//# sourceMappingURL=kommonitor-balance.component.js.map
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.component.js.map b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.component.js.map
new file mode 100644
index 000000000..3d139fe90
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"kommonitor-balance.component.js","sourceRoot":"","sources":["kommonitor-balance.component.ts"],"names":[],"mappings":";AAAA,OAAO;KACJ,MAAM,CAAC,mBAAmB,CAAC;KAC3B,SAAS,CACR,mBAAmB,EACnB;IACC,WAAW,EAAG,0GAA0G;IACxH;;;OAGG;IACH,UAAU,EAAG,CAAC,QAAQ,EAAE,YAAY,EAAE,sBAAsB,EAAE,+BAA+B,EAAE,gCAAgC;QAC/H,+BAA+B,EAAE,OAAO,EAAE,UAAU;QACpD,SAAS,2BAA2B,CAAC,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE,6BAA6B,EAAE,8BAA8B,EAC3I,6BAA6B,EAAE,KAAK,EAAE,QAAQ;YAE9C,MAAM,qBAAqB,GAAG,KAAK,CAAC,mBAAmB,CAAC;YACxD,IAAI,CAAC,qCAAqC,GAAG,6BAA6B,CAAC;YAC3E,IAAI,CAAC,4BAA4B,GAAG,oBAAoB,CAAC;YACzD,sCAAsC;YACtC,CAAC,CAAC,MAA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B,CAAC,6BAA6B,CAAC,iBAAiB,EAAE,IAAI,CAAC,CAAC;gBAChF,CAAC,CAAC,CAAC;YACL,CAAC,CAAC;QAEH,CAAC,CAAC;CACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.component.ts b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.component.ts
new file mode 100644
index 000000000..c1a9e683b
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.component.ts
@@ -0,0 +1,498 @@
+angular
+ .module('kommonitorBalance')
+ .component(
+ 'kommonitorBalance',
+ {
+ templateUrl : "components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.template.html",
+ /*
+ * injected with a modules service method that manages
+ * enabled tabs
+ */
+ controller : ['$scope', '$rootScope', 'kommonitorMapService', 'kommonitorDataExchangeService', 'kommonitorDiagramHelperService',
+ 'kommonitorFilterHelperService', '__env', '$timeout',
+ function kommonitorBalanceController($scope, $rootScope, kommonitorMapService, kommonitorDataExchangeService, kommonitorDiagramHelperService,
+ kommonitorFilterHelperService, __env, $timeout) {
+
+ const INDICATOR_DATE_PREFIX = __env.indicatorDatePrefix;
+ this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
+ this.kommonitorMapServiceInstance = kommonitorMapService;
+ // initialize any adminLTE box widgets
+ $('.box').boxWidget();
+ var numberOfDecimals = __env.numberOfDecimals;
+
+ $scope.targetDate;
+ $scope.targetIndicatorProperty;
+ $scope.rangeSliderForBalance;
+ $scope.datesAsMs;
+
+ $scope.trendConfig_allFeatures = {
+ showMinMax: true,
+ showCompleteTimeseries: true,
+ trendComputationType: "linear"
+ };
+
+ $scope.$on("DisableBalance", function (event) {
+ kommonitorDataExchangeService.isBalanceChecked = false;
+ if($scope.rangeSliderForBalance){
+ $scope.rangeSliderForBalance.update({
+ block: true
+ });
+ }
+
+ // reanebalbe DateSlider on map
+ $rootScope.$broadcast("EnableDateSlider");
+ });
+
+ $scope.$on("replaceBalancedIndicator", function (event) {
+ if(kommonitorDataExchangeService.isBalanceChecked){
+ $scope.onChangeUseBalance();
+ }
+ });
+
+ $scope.onChangeUseBalance = function(){
+
+ if(kommonitorDataExchangeService.isMeasureOfValueChecked){
+ kommonitorDataExchangeService.isMeasureOfValueChecked = false;
+ }
+
+ let indicatorMetadataAndGeoJSON = undefined;
+
+ if(kommonitorDataExchangeService.isBalanceChecked){
+ kommonitorDataExchangeService.isMeasureOfValueChecked = false;
+ $scope.rangeSliderForBalance.update({
+ block: false
+ });
+ // disable DateSlider on map
+ $rootScope.$broadcast("DisableDateSlider");
+ if(!kommonitorDataExchangeService.indicatorAndMetadataAsBalance){
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance = jQuery.extend(true, {}, kommonitorDataExchangeService.selectedIndicator);
+ var indicatorType = kommonitorDataExchangeService.selectedIndicator.indicatorType;
+ if(indicatorType.includes("ABSOLUTE")){
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorType = "DYNAMIC_ABSOLUTE";
+ }
+ else if(indicatorType.includes("RELATIVE")){
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorType = "DYNAMIC_RELATIVE";
+ }
+ else if(indicatorType.includes("STANDARDIZED")){
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorType = "DYNAMIC_STANDARDIZED";
+ }
+
+ }
+ var data = $scope.rangeSliderForBalance.options;
+ computeAndSetBalance(data);
+ $timeout(function(){
+
+ $scope.updateTrendChart(kommonitorDataExchangeService.selectedIndicator, data);
+ });
+ indicatorMetadataAndGeoJSON = kommonitorDataExchangeService.indicatorAndMetadataAsBalance;
+ // kommonitorMapService.replaceIndicatorGeoJSON(kommonitorDataExchangeService.indicatorAndMetadataAsBalance, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, $scope.targetDate, true);
+ }
+ else{
+ $scope.rangeSliderForBalance.update({
+ block: true
+ });
+ // reanebalbe DateSlider on map
+ $rootScope.$broadcast("EnableDateSlider");
+ indicatorMetadataAndGeoJSON = kommonitorDataExchangeService.selectedIndicator;
+ // kommonitorMapService.replaceIndicatorGeoJSON(kommonitorDataExchangeService.selectedIndicator, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, $scope.targetDate, true);
+ }
+ // $rootScope.$broadcast("updateIndicatorValueRangeFilter", $scope.targetDate, indicatorMetadataAndGeoJSON);
+ // do not replace dataset directly, but check if any filter can be applied when changing balance mode for the current dataset
+ kommonitorFilterHelperService.filterAndReplaceDataset();
+ };
+
+ function getFromDate_asPropertyString(datePeriodSliderData){
+ // data.from and data.to are index values, not the actual dates! (because we use "values" for rangeSlider)
+ var fromDate = new Date($scope.datesAsMs[datePeriodSliderData.from]);
+
+ var fromDateAsPropertyString = makePropertyString(fromDate);
+ var fromDateAsString = makeDateString(fromDate);
+ if(!kommonitorDataExchangeService.indicatorAndMetadataAsBalance.applicableDates.includes(fromDateAsString)){
+ fromDateAsPropertyString = snapToNearestUpperDate(fromDate, kommonitorDataExchangeService.indicatorAndMetadataAsBalance.applicableDates);
+ }
+
+ return fromDateAsPropertyString;
+ }
+
+ function getFromDate_asDateString(datePeriodSliderData){
+ // data.from and data.to are index values, not the actual dates! (because we use "values" for rangeSlider)
+ var fromDate = new Date($scope.datesAsMs[datePeriodSliderData.from]);
+
+ var fromDateAsString = makeDateString(fromDate);
+
+ return fromDateAsString;
+ }
+
+ function getToDate_asPropertyString(datePeriodSliderData){
+ // data.from and data.to are index values, not the actual dates! (because we use "values" for rangeSlider)
+ var toDate = new Date($scope.datesAsMs[datePeriodSliderData.to]);
+
+ var toDateAsPropertyString = makePropertyString(toDate);
+ var toDateAsString = makeDateString(toDate);
+ if(!kommonitorDataExchangeService.indicatorAndMetadataAsBalance.applicableDates.includes(toDateAsString)){
+ toDateAsPropertyString = snapToNearestLowerDate(toDate, kommonitorDataExchangeService.indicatorAndMetadataAsBalance.applicableDates);
+ }
+
+ return toDateAsPropertyString;
+ }
+
+ function getToDate_asDateString(datePeriodSliderData){
+ // data.from and data.to are index values, not the actual dates! (because we use "values" for rangeSlider)
+ var toDate = new Date($scope.datesAsMs[datePeriodSliderData.to]);
+
+ var toDateAsString = makeDateString(toDate);
+
+ return toDateAsString;
+ }
+
+ $scope.updateTrendChart = function(indicatorMetadata, datePeriodSliderData){
+
+
+ var fromDateAsPropertyString = getFromDate_asPropertyString(datePeriodSliderData);
+ var toDateAsPropertyString = getToDate_asPropertyString(datePeriodSliderData);
+ var fromDateString = getFromDate_asDateString(datePeriodSliderData);
+ var fromDate_date = new Date(fromDateString);
+ var toDateString = getToDate_asDateString(datePeriodSliderData);
+ var toDate_date = new Date(toDateString);
+
+ // based on prepared DOM, initialize echarts instance
+ if (!$scope.trendChart_allFeatures)
+ $scope.trendChart_allFeatures = echarts.init(document.getElementById('trendDiagram_allFeatures'));
+ else {
+ // explicitly kill and reinstantiate line diagram to avoid zombie states on spatial unit change
+ $scope.trendChart_allFeatures.dispose();
+ $scope.trendChart_allFeatures = echarts.init(document.getElementById('trendDiagram_allFeatures'));
+ }
+
+ // use configuration item and data specified to show chart
+ $scope.trendOption = kommonitorDiagramHelperService.makeTrendChartOptions_forAllFeatures(indicatorMetadata, fromDateAsPropertyString, toDateAsPropertyString, $scope.trendConfig_allFeatures.showMinMax, $scope.trendConfig_allFeatures.showCompleteTimeseries, $scope.trendConfig_allFeatures.trendComputationType);
+ $scope.trendChart_allFeatures.setOption($scope.trendOption);
+
+ $scope.trendChart_allFeatures.hideLoading();
+ setTimeout(function () {
+ $scope.trendChart_allFeatures.resize();
+ }, 350);
+
+ var trendData = [];
+ var timeseriesData;
+ if($scope.trendConfig_allFeatures.showMinMax){
+ timeseriesData = $scope.trendOption.series[2].data;
+ }
+ else{
+ timeseriesData = $scope.trendOption.series[0].data;
+ }
+
+ if($scope.trendConfig_allFeatures.showCompleteTimeseries){
+ for (let index = 0; index < timeseriesData.length; index++) {
+ var dateCandidate = new Date(indicatorMetadata.applicableDates[index]);
+ if(dateCandidate >= fromDate_date && dateCandidate <= toDate_date){
+ trendData.push(timeseriesData[index]);
+ }
+ }
+ }
+ else{
+ trendData = timeseriesData;
+ }
+
+
+
+ var balanceValue = kommonitorDataExchangeService.getIndicatorValue_asFormattedText(trendData[trendData.length - 1] - trendData[0]);
+ var balanceValue_numeric = kommonitorDataExchangeService.getIndicatorValue_asNumber(trendData[trendData.length - 1] - trendData[0]);
+ var trendValue = "";
+ if(Number(balanceValue_numeric) == 0){
+ trendValue = "gleichbleibend";
+ }
+ else if(Number(balanceValue_numeric) > 0){
+ trendValue = "steigend";
+ }
+ else {
+ trendValue = "sinkend";
+ }
+
+ $scope.trendAnalysis_allFeatures = {
+ min: kommonitorDataExchangeService.getIndicatorValue_asFormattedText(ecStat.statistics.min(trendData)),
+ max: kommonitorDataExchangeService.getIndicatorValue_asFormattedText(ecStat.statistics.max(trendData)),
+ deviation: kommonitorDataExchangeService.getIndicatorValue_asFormattedText(ecStat.statistics.deviation(trendData)),
+ variance: kommonitorDataExchangeService.getIndicatorValue_asFormattedText(ecStat.statistics.sampleVariance(trendData)),
+ mean: kommonitorDataExchangeService.getIndicatorValue_asFormattedText(ecStat.statistics.mean(trendData)),
+ median: kommonitorDataExchangeService.getIndicatorValue_asFormattedText(ecStat.statistics.median(trendData)),
+ balance: balanceValue,
+ trend: trendValue
+ };
+
+ };
+
+ $(window).on('resize', function () {
+
+ if ($scope.trendChart_allFeatures != null && $scope.trendChart_allFeatures != undefined) {
+ $scope.trendChart_allFeatures.resize();
+ }
+ });
+
+ $scope.$on("updateBalanceSlider", function (event, date) {
+
+ // kommonitorDataExchangeService.isBalanceChecked = false;
+ $scope.setupRangeSliderForBalance(date);
+
+ });
+
+ function dateToTS (date) {
+ return date.valueOf();
+ }
+
+ function tsToDateString (dateAsMs) {
+ var date = new Date(dateAsMs);
+
+ /**
+ * TODO FIXME dateSLider formatter will return only year for now to prevent misleading month and day settings
+ */
+
+ // return date.getFullYear();
+
+ return date.toLocaleDateString("de-DE", {
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric'
+ });
+ }
+
+ function dateToDateString (date) {
+
+ /**
+ * TODO FIXME dateSLider formatter will return only year for now to prevent misleading month and day settings
+ */
+
+ // return date.getFullYear();
+
+ return date.toLocaleDateString("de-DE", {
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric'
+ });
+ }
+
+ function createDatesFromIndicatorDates(indicatorDates) {
+
+ $scope.datesAsMs = [];
+
+ for (var index=0; index < indicatorDates.length; index++){
+ // year-month-day
+ var dateComponents = indicatorDates[index].split("-");
+ $scope.datesAsMs.push(dateToTS(new Date(Number(dateComponents[0]), Number(dateComponents[1]) - 1, Number(dateComponents[2]))));
+ }
+ return $scope.datesAsMs;
+ }
+
+ $scope.createNewBalanceInstance = function(){
+ $scope.datesAsMs = createDatesFromIndicatorDates(kommonitorDataExchangeService.selectedIndicator.applicableDates);
+
+ // new Date() uses month between 0-11!
+ $("#rangeSliderForBalance").ionRangeSlider({
+ skin: "big",
+ type: "double",
+ grid: true,
+ values: $scope.datesAsMs,
+ from: 0, // index, not the date
+ to: $scope.datesAsMs.length -1, // index, not the date
+ force_edges: true,
+ prettify: tsToDateString,
+ onChange: onChangeBalanceRange
+ });
+
+ $scope.rangeSliderForBalance = $("#rangeSliderForBalance").data("ionRangeSlider");
+ // make sure that the handles are properly set to min and max values
+ $scope.rangeSliderForBalance.update({
+ from: 0, // index, not the date
+ to: $scope.datesAsMs.length -1, // index, not the date
+ });
+
+ if (!kommonitorDataExchangeService.isBalanceChecked){
+ // deactivate balance slider
+ $scope.rangeSliderForBalance.update({
+ block: true
+ });
+ }
+ }
+
+ $scope.removeOldInstance = function(){
+ kommonitorDataExchangeService.rangeFilterData = undefined;
+ $scope.rangeSliderForBalance.destroy();
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance = undefined;
+
+ var domNode = document.getElementById("rangeSliderForBalance");
+
+ while (domNode.hasChildNodes()) {
+ domNode.removeChild(domNode.lastChild);
+ }
+ }
+
+ $scope.setupRangeSliderForBalance = function(date){
+ $scope.targetDate = date;
+ $scope.targetIndicatorProperty = INDICATOR_DATE_PREFIX + date;
+
+ if(!$scope.rangeSliderForBalance){
+ // create new instance
+ $scope.createNewBalanceInstance();
+ }
+ else {
+
+ if(kommonitorDataExchangeService.indicatorAndMetadataAsBalance){
+ if (kommonitorDataExchangeService.selectedIndicator.indicatorName != kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorName){
+ $scope.removeOldInstance();
+
+ // create new instance
+ $scope.createNewBalanceInstance();
+ }
+ }
+ else{
+ $scope.removeOldInstance();
+ $scope.createNewBalanceInstance();
+ }
+
+ }
+
+ };
+
+ function onChangeBalanceRange (data) {
+ // create balance GeoJSON and broadcast "replaceIndicatorAsGeoJSON"
+ // Called every time handle position is changed
+ computeAndSetBalance(data);
+
+ $timeout(function(){
+
+ $scope.updateTrendChart(kommonitorDataExchangeService.selectedIndicator, data);
+ });
+ // we must call replaceIndicatorGeoJSON because the feature vaues have changed. calling restyle will not work as it only restyles the old numbers
+ kommonitorMapService.replaceIndicatorGeoJSON(kommonitorDataExchangeService.indicatorAndMetadataAsBalance, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, $scope.targetDate, true);
+ };
+
+ function computeAndSetBalance(data){
+
+ var fromDateAsPropertyString = getFromDate_asPropertyString(data);
+ var fromDateAsDateString = getFromDate_asDateString(data);
+ var toDateAsPropertyString = getToDate_asPropertyString(data);
+ var toDateAsDateString = getToDate_asDateString(data);
+
+ // make another copy of selectedIndicator to ensure that feature order matches each other
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance = jQuery.extend(true, {}, kommonitorDataExchangeService.selectedIndicator);
+
+ var indicatorType = kommonitorDataExchangeService.selectedIndicator.indicatorType;
+ if(indicatorType.includes("ABSOLUTE")){
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorType = "DYNAMIC_ABSOLUTE";
+ }
+ else if(indicatorType.includes("RELATIVE")){
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorType = "DYNAMIC_RELATIVE";
+ }
+ else if(indicatorType.includes("STANDARDIZED")){
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance.indicatorType = "DYNAMIC_STANDARDIZED";
+ }
+
+ // set value of selected target property with the computed balance between toDate - FromDate
+ for (var index=0; index < kommonitorDataExchangeService.selectedIndicator.geoJSON.features.length; index++){
+
+ var toDateValue = kommonitorDataExchangeService.getIndicatorValue_asNumber(kommonitorDataExchangeService.selectedIndicator.geoJSON.features[index].properties[toDateAsPropertyString]);
+ var fromDateValue = kommonitorDataExchangeService.getIndicatorValue_asNumber(kommonitorDataExchangeService.selectedIndicator.geoJSON.features[index].properties[fromDateAsPropertyString]);
+
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance.geoJSON.features[index].properties[$scope.targetIndicatorProperty] = kommonitorDataExchangeService.getIndicatorValue_asNumber(toDateValue - fromDateValue);
+ }
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance['fromDate'] = dateToDateString(new Date(fromDateAsDateString));
+ kommonitorDataExchangeService.indicatorAndMetadataAsBalance['toDate'] = dateToDateString(new Date(toDateAsDateString));
+ };
+
+ function snapToNearestLowerDate(toDate, applicableDates){
+ var earliestDateStringComponents = applicableDates[0].split("-");
+
+ var earliestDate = new Date(Number(earliestDateStringComponents[0]), Number(earliestDateStringComponents[1]) - 1, Number(earliestDateStringComponents[2]));
+ var dateCandidate = toDate;
+
+ // we need to find the next lower applicableDate
+ // decrement day by one and check, otherwise decrement month and/or year
+ dateCandidate.setDate(dateCandidate.getDate() - 1);
+
+ var targetDatePropertyString;
+
+ while(dateCandidate > earliestDate){
+ var dateCandidateString = makeDateString(dateCandidate);
+ if (applicableDates.includes(dateCandidateString)){
+ targetDatePropertyString = makePropertyString(dateCandidate);
+ break;
+ }
+ //decrement by one day
+ dateCandidate.setDate(dateCandidate.getDate() - 1);
+ }
+
+ if(!targetDatePropertyString)
+ targetDatePropertyString = makePropertyString(earliestDate);
+
+ return targetDatePropertyString;
+ }
+
+ function snapToNearestUpperDate(fromDate, applicableDates){
+ var lastDateStringComponents = applicableDates[applicableDates.length -1].split("-");
+
+ var latestDate = new Date(Number(lastDateStringComponents[0]), Number(lastDateStringComponents[1]) - 1, Number(lastDateStringComponents[2]));
+ var dateCandidate = fromDate;
+
+ // we need to find the next upper applicableDate
+ // increment day by one and check, otherwise increment month and/or year
+ dateCandidate.setDate(dateCandidate.getDate() + 1);
+
+ var targetDatePropertyString;
+
+ while(dateCandidate < latestDate){
+ var dateCandidateString = makeDateString(dateCandidate);
+ if (applicableDates.includes(dateCandidateString)){
+ targetDatePropertyString = makePropertyString(dateCandidate);
+ break;
+ }
+ //increment by one day
+ dateCandidate.setDate(dateCandidate.getDate() + 1);
+ }
+
+ if(!targetDatePropertyString)
+ targetDatePropertyString = makePropertyString(latestDate);
+
+ return targetDatePropertyString;
+ }
+
+ function makeDateString(date){
+ var year = date.getFullYear();
+ var month = date.getMonth() + 1; // because month is from 0-11
+ var day = date.getDate();
+
+ // e.g. 2018-01-01
+ var propertyString = year + "-";
+
+ if(month < 10){
+ propertyString += "0" + month + "-";
+ }
+ else{
+ propertyString += month + "-";
+ }
+
+ if(day < 10){
+ propertyString += "0" + day;
+ }
+ else{
+ propertyString += day;
+ }
+
+ return propertyString;
+ };
+
+ function makePropertyString(date){
+ var dateString = makeDateString(date);
+ return INDICATOR_DATE_PREFIX + dateString;
+ };
+
+
+ $scope.onChangeTrendConfig = function(){
+ var data = $scope.rangeSliderForBalance.result;
+ $timeout(function(){
+
+ $scope.updateTrendChart(kommonitorDataExchangeService.selectedIndicator, data);
+ });
+ };
+
+ }]
+ });
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.module.js b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.module.js
index d878cb9e2..d3d1ff79e 100644
--- a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.module.js
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.module.js
@@ -1,15 +1,16 @@
+"use strict";
angular.module('kommonitorBalance', ['kommonitorDataExchange', 'kommonitorDiagramHelper', 'kommonitorMap', 'kommonitorFilterHelper'])
-
-.directive('stringToNumber', function() {
- return {
- require: 'ngModel',
- link: function(scope, element, attrs, ngModel) {
- ngModel.$parsers.push(function(value) {
- return '' + value;
- });
- ngModel.$formatters.push(function(value) {
- return parseFloat(value);
- });
- }
- };
+ .directive('stringToNumber', function () {
+ return {
+ require: 'ngModel',
+ link: function (scope, element, attrs, ngModel) {
+ ngModel.$parsers.push(function (value) {
+ return '' + value;
+ });
+ ngModel.$formatters.push(function (value) {
+ return parseFloat(value);
+ });
+ }
+ };
});
+//# sourceMappingURL=kommonitor-balance.module.js.map
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.module.js.map b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.module.js.map
new file mode 100644
index 000000000..354277d08
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.module.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"kommonitor-balance.module.js","sourceRoot":"","sources":["kommonitor-balance.module.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,MAAM,CAAC,mBAAmB,EAAE,CAAC,wBAAwB,EAAE,yBAAyB,EAAE,eAAe,EAAE,wBAAwB,CAAC,CAAC;KAEpI,SAAS,CAAC,gBAAgB,EAAE;IAC3B,OAAO;QACL,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,UAAS,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO;YAC3C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAS,KAAK;gBAClC,OAAO,EAAE,GAAG,KAAK,CAAC;YACpB,CAAC,CAAC,CAAC;YACH,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,UAAS,KAAK;gBACrC,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.module.ts b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.module.ts
new file mode 100644
index 000000000..d878cb9e2
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorBalance/kommonitor-balance.module.ts
@@ -0,0 +1,15 @@
+angular.module('kommonitorBalance', ['kommonitorDataExchange', 'kommonitorDiagramHelper', 'kommonitorMap', 'kommonitorFilterHelper'])
+
+.directive('stringToNumber', function() {
+ return {
+ require: 'ngModel',
+ link: function(scope, element, attrs, ngModel) {
+ ngModel.$parsers.push(function(value) {
+ return '' + value;
+ });
+ ngModel.$formatters.push(function(value) {
+ return parseFloat(value);
+ });
+ }
+ };
+});
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.component.js b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.component.js
index 75bed99f9..93101820e 100644
--- a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.component.js
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.component.js
@@ -1,245 +1,192 @@
+"use strict";
angular
- .module('kommonitorDataImport')
- .component(
- 'kommonitorDataImport',
- {
- templateUrl : "components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.template.html",
-
- controller : [
- 'kommonitorDataExchangeService', 'kommonitorMapService', '$scope', '$rootScope', '$http', '__env',
- function kommonitorDataImportController(
- kommonitorDataExchangeService, kommonitorMapService, $scope, $rootScope, $http, __env) {
- /*
- * reference to kommonitorDataExchangeService instances
- */
- this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
- this.kommonitorMapServiceInstance = kommonitorMapService;
- $scope.loadingData = false;
- $scope.date;
-
- $scope.fileLayerError;
- $scope.tmpDatasetName;
-
- $scope.wmsNameFilter = undefined;
-
- $scope.customFileInputColor = `#00AABB`;
-
- $('#customFileInputColorDiv').colorpicker();
-
- // initialize colorpicker after some time
- // wait to ensure that elements ar available on DOM
- setTimeout(function() {
-
- var colorPickerInputs = $('.input-group.colorpicker-component')
- colorPickerInputs.colorpicker();
-
- // $('.input-group.colorpicker-component').each(function (index, value){
- // $(this).colorpicker();
- // });
- }, 3000);
-
-
- // initialize any adminLTE box widgets
- $('.box').boxWidget();
-
- const DATE_PREFIX = __env.indicatorDatePrefix;
-
- var numberOfDecimals = __env.numberOfDecimals;
-
-
- $scope.dropHandler = function(ev) {
- $scope.fileLayerError = undefined;
- $("#fileErrorAlert").hide();
- $("#fileSuccessAlert").hide();
- console.log('File(s) dropped');
-
- try {
- // Prevent default behavior (Prevent file from being opened)
- ev.preventDefault();
-
- if (ev.dataTransfer.items) {
- // Use DataTransferItemList interface to access the file(s)
- for (var i = 0; i < ev.dataTransfer.items.length; i++) {
- // If dropped items aren't files, reject them
- if (ev.dataTransfer.items[i].kind === 'file') {
- var file = ev.dataTransfer.items[i].getAsFile();
- $scope.processFileInput(file);
-
- }
- }
- } else {
- // Use DataTransfer interface to access the file(s)
- for (var i = 0; i < ev.dataTransfer.files.length; i++) {
- var file = ev.dataTransfer.files[i];
- $scope.processFileInput(file);
- }
- }
- } catch (e) {
- $scope.fileLayerError = e;
- $("#fileErrorAlert").show();
- } finally {
-
- }
-
- };
-
- $scope.processFileInput = function(file){
- console.log('... file[' + i + '].name = ' + file.name);
-
- var fileEnding = file.name.split('.').pop();
-
- if(fileEnding.toUpperCase() === "json".toUpperCase() || fileEnding.toUpperCase() === "geojson".toUpperCase()){
- console.log("Potential GeoJSON file identified")
- $scope.processFileInput_geoJson(file);
- }
- else if (fileEnding.toUpperCase() === "zip".toUpperCase()){
- console.log("Potential Shapefile file identified")
- $scope.processFileInput_shape(file);
- }
- else{
- $scope.fileLayerError = "Unknown or unsupported file format";
- $("#fileErrorAlert").show();
- }
- };
-
- $scope.processFileInput_geoJson = function(file){
- var fileReader = new FileReader();
-
- fileReader.onload = function(event) {
- var geoJSON = JSON.parse(event.target.result);
-
- var fileDataset = {
- title: file.name,
- isSelected: true,
- transparency: 0,
- displayColor: $scope.customFileInputColor,
- type: "GeoJSON",
- content: geoJSON
- };
-
- kommonitorDataExchangeService.fileDatasets.push(fileDataset);
- $scope.$digest();
- // initialize colorpicker in table
- setTimeout(function() {
- // initialize colorpicker
- $('.input-group.colorpicker-component').colorpicker();
- }, 350);
-
- $scope.handleFileOnMap(fileDataset);
-
- };
-
- // Read in the image file as a data URL.
- fileReader.readAsText(file);
- };
-
- $scope.processFileInput_shape = function(file){
- var fileReader = new FileReader();
-
- fileReader.onload = function(event) {
- var arrayBuffer = event.target.result;
-
- var fileDataset = {
- title: file.name,
- isSelected: true,
- transparency: 0,
- displayColor: $scope.customFileInputColor,
- type: "shp",
- content: arrayBuffer
- };
-
- kommonitorDataExchangeService.fileDatasets.push(fileDataset);
- $scope.$digest();
- // initialize colorpicker in table
- setTimeout(function() {
- // initialize colorpicker
- $('.input-group.colorpicker-component').colorpicker();
- }, 350);
-
- $scope.handleFileOnMap(fileDataset);
-
- };
-
- // Read in the image file as a data URL.
- fileReader.readAsArrayBuffer(file);
- };
-
- $scope.handleFileOnMap = function(dataset){
- console.log("Toggle File Layer: " + dataset.title);
-
- $scope.tmpDatasetName = dataset.title;
-
- if(dataset.isSelected){
- //display on Map
- var opacity = 1 - dataset.transparency;
- kommonitorMapService.addFileLayerToMap(dataset, opacity);
- }
- else{
- //remove WMS layer from map
- kommonitorMapService.removeFileLayerFromMap(dataset);
- }
- };
-
- $scope.adjustFileLayerTransparency = function(dataset){
-
- var opacity = 1 - dataset.transparency;
-
- kommonitorMapService.adjustOpacityForFileLayer(dataset, opacity);
- };
-
- $scope.adjustFileLayerColor = function(dataset){
-
- var color = dataset.displayColor;
-
- kommonitorMapService.adjustColorForFileLayer(dataset, color);
- };
-
- $scope.$on("onDropFile", function (ev, dropEvent) {
- $scope.dropHandler(dropEvent);
- });
-
- // $scope.dragOverHandler = function(ev) {
- // console.log('File(s) in drop zone');
- //
- // // Prevent default behavior (Prevent file from being opened)
- // ev.preventDefault();
- // };
-
- $scope.openFileDialog = function(){
- // $("#fileUploadInput").trigger("click");
- document.getElementById("fileUploadInput").click();
- };
-
- $(document).on('change','#fileUploadInput',function(){
-
- // get the file
- var files = document.getElementById('fileUploadInput').files;
-
- for (var i = 0; i < files.length; i++) {
- var file = files[i];
- $scope.processFileInput(file);
- }
- });
-
- $scope.$on("FileLayerError", function (event, errorMsg, dataset) {
- $scope.fileLayerError = errorMsg;
- $("#fileErrorAlert").show();
-
- // remove element from fileDatasets
- for( var i = 0; i < kommonitorDataExchangeService.fileDatasets.length; i++){
- if ( kommonitorDataExchangeService.fileDatasets[i] === dataset) {
- kommonitorDataExchangeService.fileDatasets.splice(i, 1);
- break;
- }
- }
- });
-
- $scope.$on("FileLayerSuccess", function (event, dataset) {
- $scope.fileLayerError = undefined;
- $("#fileErrorAlert").hide();
- $("#fileSucessAlert").show();
- });
-
-
- } ]
- });
+ .module('kommonitorDataImport')
+ .component('kommonitorDataImport', {
+ templateUrl: "components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.template.html",
+ controller: [
+ 'kommonitorDataExchangeService', 'kommonitorMapService', '$scope', '$rootScope', '$http', '__env',
+ function kommonitorDataImportController(kommonitorDataExchangeService, kommonitorMapService, $scope, $rootScope, $http, __env) {
+ /*
+ * reference to kommonitorDataExchangeService instances
+ */
+ this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
+ this.kommonitorMapServiceInstance = kommonitorMapService;
+ $scope.loadingData = false;
+ $scope.date;
+ $scope.fileLayerError;
+ $scope.tmpDatasetName;
+ $scope.wmsNameFilter = undefined;
+ $scope.customFileInputColor = `#00AABB`;
+ $('#customFileInputColorDiv').colorpicker();
+ // initialize colorpicker after some time
+ // wait to ensure that elements ar available on DOM
+ setTimeout(function () {
+ var colorPickerInputs = $('.input-group.colorpicker-component');
+ colorPickerInputs.colorpicker();
+ // $('.input-group.colorpicker-component').each(function (index, value){
+ // $(this).colorpicker();
+ // });
+ }, 3000);
+ // initialize any adminLTE box widgets
+ $('.box').boxWidget();
+ const DATE_PREFIX = __env.indicatorDatePrefix;
+ var numberOfDecimals = __env.numberOfDecimals;
+ $scope.dropHandler = function (ev) {
+ $scope.fileLayerError = undefined;
+ $("#fileErrorAlert").hide();
+ $("#fileSuccessAlert").hide();
+ console.log('File(s) dropped');
+ try {
+ // Prevent default behavior (Prevent file from being opened)
+ ev.preventDefault();
+ if (ev.dataTransfer.items) {
+ // Use DataTransferItemList interface to access the file(s)
+ for (var i = 0; i < ev.dataTransfer.items.length; i++) {
+ // If dropped items aren't files, reject them
+ if (ev.dataTransfer.items[i].kind === 'file') {
+ var file = ev.dataTransfer.items[i].getAsFile();
+ $scope.processFileInput(file);
+ }
+ }
+ }
+ else {
+ // Use DataTransfer interface to access the file(s)
+ for (var i = 0; i < ev.dataTransfer.files.length; i++) {
+ var file = ev.dataTransfer.files[i];
+ $scope.processFileInput(file);
+ }
+ }
+ }
+ catch (e) {
+ $scope.fileLayerError = e;
+ $("#fileErrorAlert").show();
+ }
+ finally {
+ }
+ };
+ $scope.processFileInput = function (file) {
+ console.log('... file[' + i + '].name = ' + file.name);
+ var fileEnding = file.name.split('.').pop();
+ if (fileEnding.toUpperCase() === "json".toUpperCase() || fileEnding.toUpperCase() === "geojson".toUpperCase()) {
+ console.log("Potential GeoJSON file identified");
+ $scope.processFileInput_geoJson(file);
+ }
+ else if (fileEnding.toUpperCase() === "zip".toUpperCase()) {
+ console.log("Potential Shapefile file identified");
+ $scope.processFileInput_shape(file);
+ }
+ else {
+ $scope.fileLayerError = "Unknown or unsupported file format";
+ $("#fileErrorAlert").show();
+ }
+ };
+ $scope.processFileInput_geoJson = function (file) {
+ var fileReader = new FileReader();
+ fileReader.onload = function (event) {
+ var geoJSON = JSON.parse(event.target.result);
+ var fileDataset = {
+ title: file.name,
+ isSelected: true,
+ transparency: 0,
+ displayColor: $scope.customFileInputColor,
+ type: "GeoJSON",
+ content: geoJSON
+ };
+ kommonitorDataExchangeService.fileDatasets.push(fileDataset);
+ $scope.$digest();
+ // initialize colorpicker in table
+ setTimeout(function () {
+ // initialize colorpicker
+ $('.input-group.colorpicker-component').colorpicker();
+ }, 350);
+ $scope.handleFileOnMap(fileDataset);
+ };
+ // Read in the image file as a data URL.
+ fileReader.readAsText(file);
+ };
+ $scope.processFileInput_shape = function (file) {
+ var fileReader = new FileReader();
+ fileReader.onload = function (event) {
+ var arrayBuffer = event.target.result;
+ var fileDataset = {
+ title: file.name,
+ isSelected: true,
+ transparency: 0,
+ displayColor: $scope.customFileInputColor,
+ type: "shp",
+ content: arrayBuffer
+ };
+ kommonitorDataExchangeService.fileDatasets.push(fileDataset);
+ $scope.$digest();
+ // initialize colorpicker in table
+ setTimeout(function () {
+ // initialize colorpicker
+ $('.input-group.colorpicker-component').colorpicker();
+ }, 350);
+ $scope.handleFileOnMap(fileDataset);
+ };
+ // Read in the image file as a data URL.
+ fileReader.readAsArrayBuffer(file);
+ };
+ $scope.handleFileOnMap = function (dataset) {
+ console.log("Toggle File Layer: " + dataset.title);
+ $scope.tmpDatasetName = dataset.title;
+ if (dataset.isSelected) {
+ //display on Map
+ var opacity = 1 - dataset.transparency;
+ kommonitorMapService.addFileLayerToMap(dataset, opacity);
+ }
+ else {
+ //remove WMS layer from map
+ kommonitorMapService.removeFileLayerFromMap(dataset);
+ }
+ };
+ $scope.adjustFileLayerTransparency = function (dataset) {
+ var opacity = 1 - dataset.transparency;
+ kommonitorMapService.adjustOpacityForFileLayer(dataset, opacity);
+ };
+ $scope.adjustFileLayerColor = function (dataset) {
+ var color = dataset.displayColor;
+ kommonitorMapService.adjustColorForFileLayer(dataset, color);
+ };
+ $scope.$on("onDropFile", function (ev, dropEvent) {
+ $scope.dropHandler(dropEvent);
+ });
+ // $scope.dragOverHandler = function(ev) {
+ // console.log('File(s) in drop zone');
+ //
+ // // Prevent default behavior (Prevent file from being opened)
+ // ev.preventDefault();
+ // };
+ $scope.openFileDialog = function () {
+ // $("#fileUploadInput").trigger("click");
+ document.getElementById("fileUploadInput").click();
+ };
+ $(document).on('change', '#fileUploadInput', function () {
+ // get the file
+ var files = document.getElementById('fileUploadInput').files;
+ for (var i = 0; i < files.length; i++) {
+ var file = files[i];
+ $scope.processFileInput(file);
+ }
+ });
+ $scope.$on("FileLayerError", function (event, errorMsg, dataset) {
+ $scope.fileLayerError = errorMsg;
+ $("#fileErrorAlert").show();
+ // remove element from fileDatasets
+ for (var i = 0; i < kommonitorDataExchangeService.fileDatasets.length; i++) {
+ if (kommonitorDataExchangeService.fileDatasets[i] === dataset) {
+ kommonitorDataExchangeService.fileDatasets.splice(i, 1);
+ break;
+ }
+ }
+ });
+ $scope.$on("FileLayerSuccess", function (event, dataset) {
+ $scope.fileLayerError = undefined;
+ $("#fileErrorAlert").hide();
+ $("#fileSucessAlert").show();
+ });
+ }
+ ]
+});
+//# sourceMappingURL=kommonitor-data-import.component.js.map
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.component.js.map b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.component.js.map
new file mode 100644
index 000000000..8182eb010
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"kommonitor-data-import.component.js","sourceRoot":"","sources":["kommonitor-data-import.component.ts"],"names":[],"mappings":";AAAA,OAAO;KACJ,MAAM,CAAC,sBAAsB,CAAC;KAC9B,SAAS,CACR,sBAAsB,E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,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;oBACtC,IAAI,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;oBACpB,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;iBAC9B;YACF,CAAC,CAAC,CAAC;YAEH,MAAM,CAAC,GAAG,CAAC,gBAAgB,EAAE,UAAU,KAAK,EAAE,QAAQ,EAAE,OAAO;gBAC9D,MAAM,CAAC,cAAc,GAAG,QAAQ,CAAC;gBACjC,CAAC,CAAC,iBAAiB,CAAC,CAAC,IAAI,EAAE,CAAC;gBAE5B,mCAAmC;gBACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,6BAA6B,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC,EAAE,EAAC;oBACxE,IAAK,6BAA6B,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;wBAC9D,6BAA6B,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;wBAC1D,MAAM;qBACL;iBACH;YACF,CAAC,CAAC,CAAC;YAEH,MAAM,CAAC,GAAG,CAAC,kBAAkB,EAAE,UAAU,KAAK,EAAE,OAAO;gBACtD,MAAM,CAAC,cAAc,GAAG,SAAS,CAAC;gBAClC,CAAC,CAAC,iBAAiB,CAAC,CAAC,IAAI,EAAE,CAAC;gBAC5B,CAAC,CAAC,kBAAkB,CAAC,CAAC,IAAI,EAAE,CAAC;YAC9B,CAAC,CAAC,CAAC;QAGJ,CAAC;KAAE;CACL,CAAC,CAAC"}
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.component.ts b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.component.ts
new file mode 100644
index 000000000..75bed99f9
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.component.ts
@@ -0,0 +1,245 @@
+angular
+ .module('kommonitorDataImport')
+ .component(
+ 'kommonitorDataImport',
+ {
+ templateUrl : "components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.template.html",
+
+ controller : [
+ 'kommonitorDataExchangeService', 'kommonitorMapService', '$scope', '$rootScope', '$http', '__env',
+ function kommonitorDataImportController(
+ kommonitorDataExchangeService, kommonitorMapService, $scope, $rootScope, $http, __env) {
+ /*
+ * reference to kommonitorDataExchangeService instances
+ */
+ this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
+ this.kommonitorMapServiceInstance = kommonitorMapService;
+ $scope.loadingData = false;
+ $scope.date;
+
+ $scope.fileLayerError;
+ $scope.tmpDatasetName;
+
+ $scope.wmsNameFilter = undefined;
+
+ $scope.customFileInputColor = `#00AABB`;
+
+ $('#customFileInputColorDiv').colorpicker();
+
+ // initialize colorpicker after some time
+ // wait to ensure that elements ar available on DOM
+ setTimeout(function() {
+
+ var colorPickerInputs = $('.input-group.colorpicker-component')
+ colorPickerInputs.colorpicker();
+
+ // $('.input-group.colorpicker-component').each(function (index, value){
+ // $(this).colorpicker();
+ // });
+ }, 3000);
+
+
+ // initialize any adminLTE box widgets
+ $('.box').boxWidget();
+
+ const DATE_PREFIX = __env.indicatorDatePrefix;
+
+ var numberOfDecimals = __env.numberOfDecimals;
+
+
+ $scope.dropHandler = function(ev) {
+ $scope.fileLayerError = undefined;
+ $("#fileErrorAlert").hide();
+ $("#fileSuccessAlert").hide();
+ console.log('File(s) dropped');
+
+ try {
+ // Prevent default behavior (Prevent file from being opened)
+ ev.preventDefault();
+
+ if (ev.dataTransfer.items) {
+ // Use DataTransferItemList interface to access the file(s)
+ for (var i = 0; i < ev.dataTransfer.items.length; i++) {
+ // If dropped items aren't files, reject them
+ if (ev.dataTransfer.items[i].kind === 'file') {
+ var file = ev.dataTransfer.items[i].getAsFile();
+ $scope.processFileInput(file);
+
+ }
+ }
+ } else {
+ // Use DataTransfer interface to access the file(s)
+ for (var i = 0; i < ev.dataTransfer.files.length; i++) {
+ var file = ev.dataTransfer.files[i];
+ $scope.processFileInput(file);
+ }
+ }
+ } catch (e) {
+ $scope.fileLayerError = e;
+ $("#fileErrorAlert").show();
+ } finally {
+
+ }
+
+ };
+
+ $scope.processFileInput = function(file){
+ console.log('... file[' + i + '].name = ' + file.name);
+
+ var fileEnding = file.name.split('.').pop();
+
+ if(fileEnding.toUpperCase() === "json".toUpperCase() || fileEnding.toUpperCase() === "geojson".toUpperCase()){
+ console.log("Potential GeoJSON file identified")
+ $scope.processFileInput_geoJson(file);
+ }
+ else if (fileEnding.toUpperCase() === "zip".toUpperCase()){
+ console.log("Potential Shapefile file identified")
+ $scope.processFileInput_shape(file);
+ }
+ else{
+ $scope.fileLayerError = "Unknown or unsupported file format";
+ $("#fileErrorAlert").show();
+ }
+ };
+
+ $scope.processFileInput_geoJson = function(file){
+ var fileReader = new FileReader();
+
+ fileReader.onload = function(event) {
+ var geoJSON = JSON.parse(event.target.result);
+
+ var fileDataset = {
+ title: file.name,
+ isSelected: true,
+ transparency: 0,
+ displayColor: $scope.customFileInputColor,
+ type: "GeoJSON",
+ content: geoJSON
+ };
+
+ kommonitorDataExchangeService.fileDatasets.push(fileDataset);
+ $scope.$digest();
+ // initialize colorpicker in table
+ setTimeout(function() {
+ // initialize colorpicker
+ $('.input-group.colorpicker-component').colorpicker();
+ }, 350);
+
+ $scope.handleFileOnMap(fileDataset);
+
+ };
+
+ // Read in the image file as a data URL.
+ fileReader.readAsText(file);
+ };
+
+ $scope.processFileInput_shape = function(file){
+ var fileReader = new FileReader();
+
+ fileReader.onload = function(event) {
+ var arrayBuffer = event.target.result;
+
+ var fileDataset = {
+ title: file.name,
+ isSelected: true,
+ transparency: 0,
+ displayColor: $scope.customFileInputColor,
+ type: "shp",
+ content: arrayBuffer
+ };
+
+ kommonitorDataExchangeService.fileDatasets.push(fileDataset);
+ $scope.$digest();
+ // initialize colorpicker in table
+ setTimeout(function() {
+ // initialize colorpicker
+ $('.input-group.colorpicker-component').colorpicker();
+ }, 350);
+
+ $scope.handleFileOnMap(fileDataset);
+
+ };
+
+ // Read in the image file as a data URL.
+ fileReader.readAsArrayBuffer(file);
+ };
+
+ $scope.handleFileOnMap = function(dataset){
+ console.log("Toggle File Layer: " + dataset.title);
+
+ $scope.tmpDatasetName = dataset.title;
+
+ if(dataset.isSelected){
+ //display on Map
+ var opacity = 1 - dataset.transparency;
+ kommonitorMapService.addFileLayerToMap(dataset, opacity);
+ }
+ else{
+ //remove WMS layer from map
+ kommonitorMapService.removeFileLayerFromMap(dataset);
+ }
+ };
+
+ $scope.adjustFileLayerTransparency = function(dataset){
+
+ var opacity = 1 - dataset.transparency;
+
+ kommonitorMapService.adjustOpacityForFileLayer(dataset, opacity);
+ };
+
+ $scope.adjustFileLayerColor = function(dataset){
+
+ var color = dataset.displayColor;
+
+ kommonitorMapService.adjustColorForFileLayer(dataset, color);
+ };
+
+ $scope.$on("onDropFile", function (ev, dropEvent) {
+ $scope.dropHandler(dropEvent);
+ });
+
+ // $scope.dragOverHandler = function(ev) {
+ // console.log('File(s) in drop zone');
+ //
+ // // Prevent default behavior (Prevent file from being opened)
+ // ev.preventDefault();
+ // };
+
+ $scope.openFileDialog = function(){
+ // $("#fileUploadInput").trigger("click");
+ document.getElementById("fileUploadInput").click();
+ };
+
+ $(document).on('change','#fileUploadInput',function(){
+
+ // get the file
+ var files = document.getElementById('fileUploadInput').files;
+
+ for (var i = 0; i < files.length; i++) {
+ var file = files[i];
+ $scope.processFileInput(file);
+ }
+ });
+
+ $scope.$on("FileLayerError", function (event, errorMsg, dataset) {
+ $scope.fileLayerError = errorMsg;
+ $("#fileErrorAlert").show();
+
+ // remove element from fileDatasets
+ for( var i = 0; i < kommonitorDataExchangeService.fileDatasets.length; i++){
+ if ( kommonitorDataExchangeService.fileDatasets[i] === dataset) {
+ kommonitorDataExchangeService.fileDatasets.splice(i, 1);
+ break;
+ }
+ }
+ });
+
+ $scope.$on("FileLayerSuccess", function (event, dataset) {
+ $scope.fileLayerError = undefined;
+ $("#fileErrorAlert").hide();
+ $("#fileSucessAlert").show();
+ });
+
+
+ } ]
+ });
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.module.js b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.module.js
index f6e963169..2e52be392 100644
--- a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.module.js
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.module.js
@@ -1,62 +1,41 @@
-angular.module('kommonitorDataImport', [ 'kommonitorDataExchange', 'kommonitorMap', 'ngSanitize']);
-
-angular.module('kommonitorDataImport').directive('droppable', ['$rootScope', function($rootScope) {
- return {
- scope: {
- drop: '&' // parent
- },
- link: function(scope, element) {
- // again we need the native object
- var el = element[0];
-
- el.addEventListener(
- 'dragover',
- function(e) {
+"use strict";
+angular.module('kommonitorDataImport', ['kommonitorDataExchange', 'kommonitorMap', 'ngSanitize']);
+angular.module('kommonitorDataImport').directive('droppable', ['$rootScope', function ($rootScope) {
+ return {
+ scope: {
+ drop: '&' // parent
+ },
+ link: function (scope, element) {
+ // again we need the native object
+ var el = element[0];
+ el.addEventListener('dragover', function (e) {
e.dataTransfer.dropEffect = 'move';
// allows us to drop
- if (e.preventDefault) e.preventDefault();
+ if (e.preventDefault)
+ e.preventDefault();
this.classList.add('over');
return false;
- },
- false
- );
-
- el.addEventListener(
- 'dragenter',
- function(e) {
+ }, false);
+ el.addEventListener('dragenter', function (e) {
this.classList.add('over');
return false;
- },
- false
- );
-
- el.addEventListener(
- 'dragleave',
- function(e) {
+ }, false);
+ el.addEventListener('dragleave', function (e) {
this.classList.remove('over');
return false;
- },
- false
- );
-
- el.addEventListener(
- 'drop',
- function(e) {
+ }, false);
+ el.addEventListener('drop', function (e) {
// Stops some browsers from redirecting.
- if (e.stopPropagation) e.stopPropagation();
-
+ if (e.stopPropagation)
+ e.stopPropagation();
// Prevent default behavior (Prevent file from being opened)
- if (e.preventDefault()) e.preventDefault();
-
+ if (e.preventDefault())
+ e.preventDefault();
this.classList.remove('over');
-
$rootScope.$broadcast("onDropFile", e);
-
-
return false;
- },
- false
- );
- }
- }
-}]);
+ }, false);
+ }
+ };
+ }]);
+//# sourceMappingURL=kommonitor-data-import.module.js.map
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.module.js.map b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.module.js.map
new file mode 100644
index 000000000..4aa7eafc2
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.module.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"kommonitor-data-import.module.js","sourceRoot":"","sources":["kommonitor-data-import.module.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAE,wBAAwB,EAAE,eAAe,EAAE,YAAY,CAAC,CAAC,CAAC;AAEnG,OAAO,CAAC,MAAM,CAAC,sBAAsB,CAAC,CAAC,SAAS,CAAC,WAAW,EAAE,CAAC,YAAY,EAAE,UAAS,UAAU;QAC5F,OAAO;YACH,KAAK,EAAE;gBACH,IAAI,EAAE,GAAG,CAAC,SAAS;aACtB;YACD,IAAI,EAAE,UAAS,KAAK,EAAE,OAAO;gBACzB,kCAAkC;gBAClC,IAAI,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;gBAEpB,EAAE,CAAC,gBAAgB,CACf,UAAU,EACV,UAAS,CAAC;oBACN,CAAC,CAAC,YAAY,CAAC,UAAU,GAAG,MAAM,CAAC;oBACnC,oBAAoB;oBACpB,IAAI,CAAC,CAAC,cAAc;wBAAE,CAAC,CAAC,cAAc,EAAE,CAAC;oBACzC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;oBAC3B,OAAO,KAAK,CAAC;gBACjB,CAAC,EACD,KAAK,CACR,CAAC;gBAEF,EAAE,CAAC,gBAAgB,CACf,WAAW,EACX,UAAS,CAAC;oBACN,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;oBAC3B,OAAO,KAAK,CAAC;gBACjB,CAAC,EACD,KAAK,CACR,CAAC;gBAEF,EAAE,CAAC,gBAAgB,CACf,WAAW,EACX,UAAS,CAAC;oBACN,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;oBAC9B,OAAO,KAAK,CAAC;gBACjB,CAAC,EACD,KAAK,CACR,CAAC;gBAEF,EAAE,CAAC,gBAAgB,CACf,MAAM,EACN,UAAS,CAAC;oBACN,wCAAwC;oBACxC,IAAI,CAAC,CAAC,eAAe;wBAAE,CAAC,CAAC,eAAe,EAAE,CAAC;oBAE3C,4DAA4D;oBAC5D,IAAI,CAAC,CAAC,cAAc,EAAE;wBAAE,CAAC,CAAC,cAAc,EAAE,CAAC;oBAE3C,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;oBAE9B,UAAU,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC;oBAGvC,OAAO,KAAK,CAAC;gBACjB,CAAC,EACD,KAAK,CACR,CAAC;YACN,CAAC;SACJ,CAAA;IACL,CAAC,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.module.ts b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.module.ts
new file mode 100644
index 000000000..f6e963169
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataImport/kommonitor-data-import.module.ts
@@ -0,0 +1,62 @@
+angular.module('kommonitorDataImport', [ 'kommonitorDataExchange', 'kommonitorMap', 'ngSanitize']);
+
+angular.module('kommonitorDataImport').directive('droppable', ['$rootScope', function($rootScope) {
+ return {
+ scope: {
+ drop: '&' // parent
+ },
+ link: function(scope, element) {
+ // again we need the native object
+ var el = element[0];
+
+ el.addEventListener(
+ 'dragover',
+ function(e) {
+ e.dataTransfer.dropEffect = 'move';
+ // allows us to drop
+ if (e.preventDefault) e.preventDefault();
+ this.classList.add('over');
+ return false;
+ },
+ false
+ );
+
+ el.addEventListener(
+ 'dragenter',
+ function(e) {
+ this.classList.add('over');
+ return false;
+ },
+ false
+ );
+
+ el.addEventListener(
+ 'dragleave',
+ function(e) {
+ this.classList.remove('over');
+ return false;
+ },
+ false
+ );
+
+ el.addEventListener(
+ 'drop',
+ function(e) {
+ // Stops some browsers from redirecting.
+ if (e.stopPropagation) e.stopPropagation();
+
+ // Prevent default behavior (Prevent file from being opened)
+ if (e.preventDefault()) e.preventDefault();
+
+ this.classList.remove('over');
+
+ $rootScope.$broadcast("onDropFile", e);
+
+
+ return false;
+ },
+ false
+ );
+ }
+ }
+}]);
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.component.js b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.component.js
index a468a3590..13e396a46 100644
--- a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.component.js
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.component.js
@@ -1,796 +1,604 @@
+"use strict";
angular
- .module('kommonitorDataSetup')
- .component(
- 'kommonitorDataSetup',
- {
- templateUrl : "components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.template.html",
- /*
- * injected with a modules service method that manages
- * enabled tabs
- */
- controller : [
- 'kommonitorDataExchangeService', '$scope', 'kommonitorMapService', '$http', '$rootScope', '__env',
- '$timeout',
- function kommonitorDataSetupController(kommonitorDataExchangeService, $scope, kommonitorMapService, $http, $rootScope, __env,
- $timeout) {
-
- const INDICATOR_DATE_PREFIX = __env.indicatorDatePrefix;
-
- $scope.indicatorNameFilter = undefined;
-
- // initialize any adminLTE box widgets
- $('.box').boxWidget();
-
- var addClickListenerToEachCollapseTrigger = function(){
- setTimeout(function(){
- $('.list-group-item > .collapseTrigger').on('click', function() {
- $('.glyphicon', this)
- .toggleClass('glyphicon-chevron-right')
- .toggleClass('glyphicon-chevron-down');
-
- // manage uncollapsed entries
- // var clickedTopicId = $(this).attr('id');
- // if ($scope.unCollapsedTopicIds.includes(clickedTopicId)){
- // var index = $scope.unCollapsedTopicIds.indexOf(clickedTopicId);
- // $scope.unCollapsedTopicIds.splice(index, 1);
- // }
- // else{
- // $scope.unCollapsedTopicIds.push(clickedTopicId);
- // }
- });
- }, 500);
- };
-
- $(document).ready(function() {
-
- addClickListenerToEachCollapseTrigger();
- });
-
- // var rangeslide = require("rangeslide");
- /*
- * references to kommonitorDataExchangeService and wpsFormControl instances
- */
- this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
- this.kommonitorDataExchangeServiceInstance.selectedServiceUrl = '';
- this.kommonitorMapServiceInstance = kommonitorMapService;
-
- $scope.loadingData = true;
- $scope.changeIndicatorWasClicked = false;
-
- $scope.dateSlider;
- $scope.datePicker;
- $scope.datesAsMs;
-
- $scope.selectedDate;
-
- this.addGeopackage = function(){
- this.kommonitorMapServiceInstance.addSpatialUnitGeopackage();
- }
- this.addGeoJSON = function(){
- this.kommonitorMapServiceInstance.addSpatialUnitGeoJSON();
- }
-
- $scope.onClickHierarchyIndicator = function(indicatorMetadata){
- kommonitorDataExchangeService.selectedIndicator = indicatorMetadata;
- $scope.onChangeSelectedIndicator(false);
- };
-
- // $scope.$watch('filteredSpatialUnits', function(value){
- // if ($scope.filteredSpatialUnits) {
- // kommonitorDataExchangeService.selectedSpatialUnit = $scope.filteredSpatialUnits[0];
- // }
- // }, true);
-
- this.onClickTheme = function(topicName){
-
- for(const topic of this.kommonitorDataExchangeServiceInstance.availableTopics){
- if(topic.topicName === topicName){
- document.getElementById(topicName).setAttribute("class", "active");
- this.kommonitorDataExchangeServiceInstance.selectedTopic = topic;
- }
- else {
- if(document.getElementById(topic.topicName)){
- document.getElementById(topic.topicName).setAttribute("class", "");
- }
- }
- };
-
- if(kommonitorDataExchangeService.selectedIndicator){
- kommonitorDataExchangeService.selectedIndicatorBackup = kommonitorDataExchangeService.selectedIndicator;
- }
-
- // $scope.$digest();
- };
-
- this.unsetTopic = function(){
- this.kommonitorDataExchangeServiceInstance.selectedTopic = null;
-
- for(const topic of this.kommonitorDataExchangeServiceInstance.availableTopics){
- if (document.getElementById(topic.topicName)){
- document.getElementById(topic.topicName).setAttribute("class", "");
- }
- };
-
- if(!kommonitorDataExchangeService.selectedIndicator){
- kommonitorDataExchangeService.selectedIndicator = kommonitorDataExchangeService.selectedIndicatorBackup;
- }
-
- // $scope.$digest();
- };
-
- $scope.filterGeoresourcesByIndicator = function() {
- return function( item ) {
-
- try{
- var referencedGeoresources = kommonitorDataExchangeService.selectedIndicator.referencedGeoresources;
- var georesourceId = item.georesourceId;
-
- for (const refGeoresource of referencedGeoresources){
- if(refGeoresource.referencedGeoresourceId === georesourceId)
- return true;
- };
-
- // return referencedGeoresources.includes(georesourceId);
- }
- catch(error){
- return false;
- }
- };
- };
-
- $scope.filterReferencedIndicatorsByIndicator = function() {
- return function( item ) {
-
- try{
- var referencedIndicators = kommonitorDataExchangeService.selectedIndicator.referencedIndicators;
- var indicatorId = item.indicatorId;
-
- for (const refIndicator of referencedIndicators){
- if(refIndicator.referencedIndicatorId === indicatorId)
- return true;
- };
-
- }
- catch(error){
- return false;
- }
- };
- };
-
- $scope.filterGeoresourcesByTopic = function() {
- return function( item ) {
- if (kommonitorDataExchangeService.selectedTopic)
- return item.applicableTopics.includes(kommonitorDataExchangeService.selectedTopic.topicName);
-
- return true;
- };
- };
-
- $scope.filterSpatialUnitsByIndicator = function() {
- return function( item ) {
-
- try{
- var applicableSpatialUnits = kommonitorDataExchangeService.selectedIndicator.applicableSpatialUnits;
-
- return applicableSpatialUnits.some(o => o.spatialUnitName === item.spatialUnitLevel);
- }
- catch(error){
- return false;
- }
- };
- };
-
- $scope.getFirstSpatialUnitForSelectedIndicator = function() {
-
- var result = undefined;
-
- var applicableSpatialUnits = kommonitorDataExchangeService.selectedIndicator.applicableSpatialUnits;
-
- for (const spatialUnitEntry of kommonitorDataExchangeService.availableSpatialUnits){
- if(applicableSpatialUnits.some(o => o.spatialUnitName === spatialUnitEntry.spatialUnitLevel)){
- result = spatialUnitEntry;
- break;
- }
- }
-
- return result;
- };
-
- this.onDateChange = function(){
-
- var date = new Date($scope.selectedDate);
-
- var month = date.getMonth()+1;
- var day = date.getDate();
-
- if (month < 10)
- month = "0" + month;
-
- if (day < 10)
- day = "0" + day;
-
- $scope.selectedDate = date.getFullYear() + "-" + month + "-" + day;
- kommonitorDataExchangeService.selectedDate = $scope.selectedDate;
-
- $scope.$digest();
- };
-
- $scope.$on("initialMetadataLoadingFailed", function (event, errorArray) {
-
- $scope.loadingData = false;
- $scope.$broadcast("hideLoadingIconOnMap");
-
- });
-
- // load exemplar indicator
- $scope.$on("initialMetadataLoadingCompleted", function (event) {
-
- console.log("Load an initial example indicator");
-
- if (kommonitorDataExchangeService.displayableIndicators == null || kommonitorDataExchangeService.displayableIndicators == undefined || kommonitorDataExchangeService.displayableIndicators.length === 0){
- console.error("Kein darstellbarer Indikator konnte gefunden werden.");
-
- kommonitorDataExchangeService.displayMapApplicationError("Kein darstellbarer Indikator konnte gefunden werden.");
- $scope.loadingData = false;
- $scope.$broadcast("hideLoadingIconOnMap");
-
- return;
- }
-
- try{
- var indicatorIndex = undefined;
-
- for (var index=0; index < kommonitorDataExchangeService.displayableIndicators.length; index++){
- if (kommonitorDataExchangeService.displayableIndicators[index].indicatorId === __env.initialIndicatorId){
- if(kommonitorDataExchangeService.displayableIndicators[index].applicableDates.length > 0){
- indicatorIndex = index;
- break;
- }
- }
- }
-
- if( indicatorIndex === undefined){
- for(var t=0; t < 75; t++){
-
- var randIndex = getRandomInt(0, kommonitorDataExchangeService.displayableIndicators.length - 1);
- if (kommonitorDataExchangeService.displayableIndicators[randIndex].applicableDates.length > 0){
- indicatorIndex = randIndex;
- break;
- }
- }
- }
-
- if( indicatorIndex === undefined){
- throw Error();
- }
-
- kommonitorDataExchangeService.selectedIndicator = kommonitorDataExchangeService.displayableIndicators[indicatorIndex];
- // create Backup which is used when currently selected indicator is filtered out in select
- kommonitorDataExchangeService.selectedIndicatorBackup = kommonitorDataExchangeService.selectedIndicator;
-
- // set spatialUnit
- for (var spatialUnitEntry of kommonitorDataExchangeService.availableSpatialUnits){
- if(spatialUnitEntry.spatialUnitLevel === __env.initialSpatialUnitName){
- kommonitorDataExchangeService.selectedSpatialUnit = spatialUnitEntry;
- break;
- }
- }
- if(!kommonitorDataExchangeService.selectedSpatialUnit){
- kommonitorDataExchangeService.selectedSpatialUnit = $scope.getFirstSpatialUnitForSelectedIndicator();
- }
-
- if(! __env.centerMapInitially){
- $scope.onChangeSelectedIndicator(false);
- }
- else{
- $scope.onChangeSelectedIndicator(true);
- }
-
-
- }
- catch(error){
- console.error("Initiales Darstellen eines Indikators ist gescheitert.");
-
- kommonitorDataExchangeService.displayMapApplicationError("Initiales Darstellen eines Indikators ist gescheitert.");
- $scope.loadingData = false;
- $scope.$broadcast("hideLoadingIconOnMap");
-
- return;
- }
-
-
- });
-
- /**
- * Returns a random integer between min (inclusive) and max (inclusive).
- * The value is no lower than min (or the next integer greater than min
- * if min isn't an integer) and no greater than max (or the next integer
- * lower than max if max isn't an integer).
- * Using Math.round() will give you a non-uniform distribution!
- */
- function getRandomInt(min, max) {
- min = Math.ceil(min);
- max = Math.floor(max);
- return Math.floor(Math.random() * (max - min + 1)) + min;
- }
-
- this.addSelectedSpatialUnitToMap = function() {
- $scope.loadingData = true;
- $rootScope.$broadcast("showLoadingIconOnMap");
-
- var metadata = kommonitorDataExchangeService.selectedSpatialUnit;
-
- var id = metadata.spatialUnitId;
-
- $scope.date = $scope.selectedDate;
-
- var dateComps = $scope.selectedDate.split("-");
-
- var year = dateComps[0];
- var month = dateComps[1];
- var day = dateComps[2];
-
- $http({
- url: kommonitorDataExchangeService.getBaseUrlToKomMonitorDataAPI_spatialResource() + "/spatial-units/" + id + "/" + year + "/" + month + "/" + day + "?" + kommonitorDataExchangeService.simplifyGeometriesParameterName + "=" + kommonitorDataExchangeService.simplifyGeometries,
- method: "GET"
- }).then(function successCallback(response) {
- // this callback will be called asynchronously
- // when the response is available
- var geoJSON = response.data;
-
- kommonitorDataExchangeService.selectedSpatialUnit.geoJSON = geoJSON;
-
- kommonitorMapService.addSpatialUnitGeoJSON(kommonitorDataExchangeService.selectedSpatialUnit, $scope.date);
- $scope.loadingData = false;
- $rootScope.$broadcast("hideLoadingIconOnMap");
-
- }, function errorCallback(error) {
- // called asynchronously if an error occurs
- // or server returns response with an error status.
- $scope.loadingData = false;
- kommonitorDataExchangeService.displayMapApplicationError(error);
- $rootScope.$broadcast("hideLoadingIconOnMap");
- });
- };
-
- this.addSelectedSpatialUnitToMapAsWFS = function() {
- $scope.loadingData = true;
- $rootScope.$broadcast("showLoadingIconOnMap");
-
- var metadata = kommonitorDataExchangeService.selectedSpatialUnit;
-
- var name = metadata.spatialUnitLevel;
-
- var wfsUrl = metadata.wfsUrl;
-
- kommonitorMapService.addSpatialUnitWFS(name, wfsUrl);
- $scope.loadingData = false;
- $rootScope.$broadcast("hideLoadingIconOnMap");
-
- };
-
- this.addSelectedGeoresourceToMap = function() {
- $scope.loadingData = true;
- $rootScope.$broadcast("showLoadingIconOnMap");
-
- var metadata = kommonitorDataExchangeService.selectedGeoresource;
-
- var id = metadata.georesourceId;
-
- $scope.date = $scope.selectedDate;
-
- var dateComps = $scope.selectedDate.split("-");
-
- var year = dateComps[0];
- var month = dateComps[1];
- var day = dateComps[2];
-
- $http({
- url: kommonitorDataExchangeService.getBaseUrlToKomMonitorDataAPI_spatialResource() + "/georesources/" + id + "/" + year + "/" + month + "/" + day + "?" + kommonitorDataExchangeService.simplifyGeometriesParameterName + "=" + kommonitorDataExchangeService.simplifyGeometries,
- method: "GET"
- }).then(function successCallback(response) {
- // this callback will be called asynchronously
- // when the response is available
- var geoJSON = response.data;
-
- kommonitorDataExchangeService.selectedGeoresource.geoJSON = geoJSON;
-
- kommonitorMapService.addGeoresourceGeoJSON(kommonitorDataExchangeService.selectedGeoresource, $scope.date);
- $scope.loadingData = false;
- $rootScope.$broadcast("hideLoadingIconOnMap");
-
- }, function errorCallback(error) {
- // called asynchronously if an error occurs
- // or server returns response with an error status.
- $scope.loadingData = false;
- kommonitorDataExchangeService.displayMapApplicationError(error);
- $rootScope.$broadcast("hideLoadingIconOnMap");
- });
-
- };
-
- $scope.addSelectedIndicatorToMap = function(changeIndicator) {
-
- if(changeIndicator){
- $rootScope.$broadcast("DisableBalance");
- kommonitorMapService.replaceIndicatorGeoJSON(kommonitorDataExchangeService.selectedIndicator, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, $scope.selectedDate, false);
- }
- else{
- // check if balance mode is active
- if (kommonitorDataExchangeService.isBalanceChecked){
- $rootScope.$broadcast("replaceBalancedIndicator");
- }
- else{
- kommonitorMapService.replaceIndicatorGeoJSON(kommonitorDataExchangeService.selectedIndicator, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, $scope.selectedDate, false);
- }
- }
- };
-
- function prettifyDateSliderLabels (dateAsMs) {
- return kommonitorDataExchangeService.tsToDate_withOptionalUpdateInterval(dateAsMs, kommonitorDataExchangeService.selectedIndicator.metadata.updateInterval);
- }
-
- function createDatesFromIndicatorDates(indicatorDates) {
-
- $scope.datesAsMs = [];
-
- for (var index=0; index < indicatorDates.length; index++){
- // year-month-day
- var dateComponents = indicatorDates[index].split("-");
- $scope.datesAsMs.push(kommonitorDataExchangeService.dateToTS(new Date(Number(dateComponents[0]), Number(dateComponents[1]) - 1, Number(dateComponents[2]))));
- }
- return $scope.datesAsMs;
- }
-
- $scope.setupDateSliderForIndicator = function(){
-
- if($scope.dateSlider){
- $scope.dateSlider.destroy();
- }
-
- var domNode = document.getElementById("dateSlider");
-
- while (domNode.hasChildNodes()) {
- domNode.removeChild(domNode.lastChild);
- }
-
- var availableDates = kommonitorDataExchangeService.selectedIndicator.applicableDates;
- $scope.date = availableDates[availableDates.length - 1];
- $scope.selectedDate = availableDates[availableDates.length - 1];
- kommonitorDataExchangeService.selectedDate = availableDates[availableDates.length - 1];
-
- $scope.datesAsMs = createDatesFromIndicatorDates(kommonitorDataExchangeService.selectedIndicator.applicableDates);
-
- // new Date() uses month between 0-11!
- $("#dateSlider").ionRangeSlider({
- skin: "big",
- type: "single",
- grid: true,
- values: $scope.datesAsMs,
- from: $scope.datesAsMs.length -1, // index, not the date
- force_edges: true,
- prettify: prettifyDateSliderLabels,
- onChange: $scope.onChangeDateSliderItem
- });
-
- $scope.dateSlider = $("#dateSlider").data("ionRangeSlider");
- // make sure that the handle is properly set to max value
- $scope.dateSlider.update({
- from: $scope.datesAsMs.length -1 // index, not the date
- });
- };
-
- $scope.setupDatePickerForIndicator = function(){
-
- if($scope.datePicker){
- $('#indicatorDatePicker').datepicker('destroy');
- $scope.datePicker = undefined;
- }
-
- var domNode = document.getElementById("indicatorDatePicker");
-
- while (domNode.hasChildNodes()) {
- domNode.removeChild(domNode.lastChild);
- }
-
- var availableDates = kommonitorDataExchangeService.selectedIndicator.applicableDates;
- $scope.date = availableDates[availableDates.length - 1];
- $scope.selectedDate = availableDates[availableDates.length - 1];
- kommonitorDataExchangeService.selectedDate = availableDates[availableDates.length - 1];
-
- $scope.datePicker = $('#indicatorDatePicker').datepicker(kommonitorDataExchangeService.getLimitedDatePickerOptions(availableDates));
-
- };
-
-
- $scope.onChangeDateSliderItem = async function(data){
-
- if(!$scope.changeIndicatorWasClicked && kommonitorDataExchangeService.selectedIndicator){
- $scope.loadingData = true;
- $rootScope.$broadcast("showLoadingIconOnMap");
-
- console.log("Change selected date");
-
- //data.from is index of date!
-
- $scope.selectedDate = kommonitorDataExchangeService.selectedIndicator.applicableDates[data.from];
- $scope.date = $scope.selectedDate;
- kommonitorDataExchangeService.selectedDate = $scope.selectedDate;
-
- $('#indicatorDatePicker').datepicker('update', new Date(kommonitorDataExchangeService.selectedDate));
-
- try{
- var selectedIndicator = await $scope.tryUpdateMeasureOfValueBarForIndicator();
- }
- catch(error){
- console.error(error);
- $scope.loadingData = false;
- $rootScope.$broadcast("hideLoadingIconOnMap");
- kommonitorDataExchangeService.displayMapApplicationError(error);
- return;
- }
-
- $scope.modifyExports(false);
-
- if(document.getElementById('controlNoDataDisplay').checked)
- $rootScope.$broadcast('applyNoDataDisplay')
-
- $scope.loadingData = false;
- $rootScope.$broadcast("hideLoadingIconOnMap");
- $rootScope.$broadcast("selectedIndicatorDateHasChanged");
- $rootScope.$apply();
- }
- };
-
- $scope.$on("DisableDateSlider", function (event) {
- if($scope.dateSlider){
- $scope.dateSlider.update({
- block: true
- });
- }
-
- kommonitorDataExchangeService.disableIndicatorDatePicker = true;
- });
-
- $scope.$on("EnableDateSlider", function (event) {
- if($scope.dateSlider){
- $scope.dateSlider.update({
- block: false
- });
- }
-
- kommonitorDataExchangeService.disableIndicatorDatePicker = false;
- });
-
- var wait = ms => new Promise((r, j)=>setTimeout(r, ms));
-
- $scope.tryUpdateMeasureOfValueBarForIndicator = async function(){
- var indicatorId = kommonitorDataExchangeService.selectedIndicator.indicatorId;
-
- if(! ($scope.date && kommonitorDataExchangeService.selectedSpatialUnit && indicatorId)){
- kommonitorDataExchangeService.displayMapApplicationError("Beim Versuch, einen Beispielindikator zu laden, ist ein Fehler aufgetreten. Der Datenbankeintrag scheint eine fehlerhafte Kombination aus Raumeinheit und Zeitschnitt zu enthalten.");
- throw Error("Not all parameters have been set up yet.");
- }
- //
- // $scope.selectedDate = $scope.selectedDate;
- $scope.spatialUnitName = kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
-
- var dateComps = $scope.date.split("-");
- var year = dateComps[0];
- var month = dateComps[1];
- var day = dateComps[2];
-
- return await $http({
- url: kommonitorDataExchangeService.getBaseUrlToKomMonitorDataAPI_spatialResource() + "/indicators/" + indicatorId + "/" + kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitId + "/" + year + "/" + month + "/" + day + "?" + kommonitorDataExchangeService.simplifyGeometriesParameterName + "=" + kommonitorDataExchangeService.simplifyGeometries,
- method: "GET"
- }).then(function successCallback(response) {
- // this callback will be called asynchronously
- // when the response is available
- var geoJSON = response.data;
-
- kommonitorDataExchangeService.selectedIndicator.geoJSON = geoJSON;
-
- $rootScope.$broadcast("updateMeasureOfValueBar", $scope.date, kommonitorDataExchangeService.selectedIndicator);
-
- // $scope.updateMeasureOfValueBar($scope.date);
-
- return kommonitorDataExchangeService.selectedIndicator;
-
- }, function errorCallback(error) {
- // called asynchronously if an error occurs
- // or server returns response with an error status.
- $scope.loadingData = false;
- kommonitorDataExchangeService.displayMapApplicationError(error);
- $rootScope.$broadcast("hideLoadingIconOnMap");
-
- return kommonitorDataExchangeService.selectedIndicator;
- });
- };
-
- $scope.$on("changeSpatialUnit", function(event){
- $scope.onChangeSelectedSpatialUnit();
- });
-
- $scope.$on("changeIndicatorDate", async function(event){
-
- if(kommonitorDataExchangeService.selectedIndicator && kommonitorDataExchangeService.selectedDate){
- $scope.loadingData = true;
- $rootScope.$broadcast("showLoadingIconOnMap");
-
- console.log("Change selected date");
-
- //data.from is index of date!
- var index = kommonitorDataExchangeService.selectedIndicator.applicableDates.indexOf(kommonitorDataExchangeService.selectedDate); ;
-
- $scope.dateSlider.update({
- from: index // index, not the date
- });
-
- $scope.date = kommonitorDataExchangeService.selectedDate;
- $scope.selectedDate = kommonitorDataExchangeService.selectedDate;
-
- try{
- var selectedIndicator = await $scope.tryUpdateMeasureOfValueBarForIndicator();
- }
- catch(error){
- console.error(error);
- $scope.loadingData = false;
- $rootScope.$broadcast("hideLoadingIconOnMap");
- kommonitorDataExchangeService.displayMapApplicationError(error);
- return;
- }
-
- $scope.modifyExports(false);
-
- if(document.getElementById('controlNoDataDisplay').checked)
- $rootScope.$broadcast('applyNoDataDisplay')
-
- $scope.loadingData = false;
- $rootScope.$broadcast("hideLoadingIconOnMap");
- $rootScope.$broadcast("selectedIndicatorDateHasChanged");
- $rootScope.$apply();
- }
-
- });
-
- $scope.onChangeSelectedSpatialUnit = async function(){
- if(!$scope.changeIndicatorWasClicked && kommonitorDataExchangeService.selectedIndicator){
- $scope.loadingData = true;
- $rootScope.$broadcast("showLoadingIconOnMap");
-
- console.log("Change spatial unit");
-
- try{
- var selectedIndicator = await $scope.tryUpdateMeasureOfValueBarForIndicator();
- }
- catch(error){
- console.error(error);
- $scope.loadingData = false;
- $rootScope.$broadcast("hideLoadingIconOnMap");
- kommonitorDataExchangeService.displayMapApplicationError(error);
- return;
- }
-
- $scope.modifyExports(false);
-
- if(document.getElementById('controlNoDataDisplay').checked)
- $rootScope.$broadcast('applyNoDataDisplay');
-
- $scope.loadingData = false;
- $rootScope.$broadcast("hideLoadingIconOnMap");
- $scope.$digest();
- }
- }
-
- $scope.markAssociatedHierarchyElement = function(selectedIndicatorMetadata){
- var selectedIndicatorId = selectedIndicatorMetadata.indicatorId;
-
- for (var indicator of kommonitorDataExchangeService.displayableIndicators) {
- $("#indicatorHierarchyElement-" + indicator.indicatorId).removeClass('active');
- }
-
- $("#indicatorHierarchyElement-" + selectedIndicatorId).addClass('active');
- };
-
- $scope.onChangeSelectedIndicator_fromAlphabeticalList = function(indicatorMetadata){
- kommonitorDataExchangeService.selectedIndicator = indicatorMetadata;
- $scope.onChangeSelectedIndicator(false);
- };
-
- $scope.onChangeSelectedIndicator = async function(recenterMap){
-
- $rootScope.$broadcast("onChangeSelectedIndicator");
-
- if(kommonitorDataExchangeService.selectedIndicator){
-
- $scope.loadingData = true;
- $rootScope.$broadcast("showLoadingIconOnMap");
- $scope.changeIndicatorWasClicked = true;
-
- $scope.markAssociatedHierarchyElement(kommonitorDataExchangeService.selectedIndicator);
-
- kommonitorDataExchangeService.selectedIndicatorBackup = kommonitorDataExchangeService.selectedIndicator;
-
- $scope.setupDateSliderForIndicator();
- $scope.setupDatePickerForIndicator();
-
- if(!kommonitorDataExchangeService.selectedSpatialUnit || !kommonitorDataExchangeService.selectedIndicator.applicableSpatialUnits.some(o => o.spatialUnitName === kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel)){
- kommonitorDataExchangeService.selectedSpatialUnit = $scope.getFirstSpatialUnitForSelectedIndicator();
- }
-
- try{
- var selectedIndicator = await $scope.tryUpdateMeasureOfValueBarForIndicator();
- }
- catch(error){
- console.error(error);
- $scope.loadingData = false;
- $rootScope.$broadcast("hideLoadingIconOnMap");
- kommonitorDataExchangeService.displayMapApplicationError(error);
- return;
- }
-
- $rootScope.$broadcast("DisableBalance");
- $scope.modifyExports(true);
-
- if(document.getElementById('controlNoDataDisplay').checked)
- $rootScope.$broadcast('applyNoDataDisplay');
-
- $scope.loadingData = false;
-
- if(recenterMap){
- $rootScope.$broadcast("recenterMapContent");
- }
-
- $rootScope.$broadcast("hideLoadingIconOnMap");
- $scope.changeIndicatorWasClicked = false;
-
- // $rootScope.$broadcast("updateDiagrams", kommonitorDataExchangeService.selectedIndicator, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, $scope.selectedDate);
-
- $rootScope.$apply();
-
-
- }
- else{
- if (kommonitorDataExchangeService.selectedIndicatorBackup){
- kommonitorDataExchangeService.selectedIndicator = kommonitorDataExchangeService.selectedIndicatorBackup;
- }
- }
-
- $rootScope.$broadcast("selectedIndicatorDateHasChanged");
- }
-
-
-
- $scope.modifyExports = function(changeIndicator){
- kommonitorDataExchangeService.wmsUrlForSelectedIndicator = undefined;
- kommonitorDataExchangeService.wmsUrlForSelectedIndicator = undefined;
-
- var selectedSpatialUnitName = kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
-
- for(const ogcServiceEntry of kommonitorDataExchangeService.selectedIndicator.ogcServices){
- if (ogcServiceEntry.spatialUnit === selectedSpatialUnitName){
- kommonitorDataExchangeService.wmsUrlForSelectedIndicator = ogcServiceEntry.wmsUrl;
- kommonitorDataExchangeService.wfsUrlForSelectedIndicator = ogcServiceEntry.wfsUrl;
- break;
- }
- };
-
- $rootScope.$broadcast("updateBalanceSlider", kommonitorDataExchangeService.selectedDate);
- $rootScope.$broadcast("updateIndicatorValueRangeFilter", kommonitorDataExchangeService.selectedDate, kommonitorDataExchangeService.selectedIndicator);
- $scope.addSelectedIndicatorToMap(changeIndicator);
-
- }
-
- $scope.$on("updateIndicatorOgcServices", function (event, indicatorWmsUrl, indicatorWfsUrl) {
-
- console.log('updateIndicatorOgcServices was called');
-
- kommonitorDataExchangeService.wmsUrlForSelectedIndicator = indicatorWmsUrl;
- kommonitorDataExchangeService.wfsUrlForSelectedIndicator = indicatorWfsUrl;
- $scope.$digest();
-
- });
-
-
- } ]
- });
+ .module('kommonitorDataSetup')
+ .component('kommonitorDataSetup', {
+ templateUrl: "components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.template.html",
+ /*
+ * injected with a modules service method that manages
+ * enabled tabs
+ */
+ controller: [
+ 'kommonitorDataExchangeService', '$scope', 'kommonitorMapService', '$http', '$rootScope', '__env',
+ '$timeout',
+ function kommonitorDataSetupController(kommonitorDataExchangeService, $scope, kommonitorMapService, $http, $rootScope, __env, $timeout) {
+ const INDICATOR_DATE_PREFIX = __env.indicatorDatePrefix;
+ $scope.indicatorNameFilter = undefined;
+ // initialize any adminLTE box widgets
+ $('.box').boxWidget();
+ var addClickListenerToEachCollapseTrigger = function () {
+ setTimeout(function () {
+ $('.list-group-item > .collapseTrigger').on('click', function () {
+ $('.glyphicon', this)
+ .toggleClass('glyphicon-chevron-right')
+ .toggleClass('glyphicon-chevron-down');
+ // manage uncollapsed entries
+ // var clickedTopicId = $(this).attr('id');
+ // if ($scope.unCollapsedTopicIds.includes(clickedTopicId)){
+ // var index = $scope.unCollapsedTopicIds.indexOf(clickedTopicId);
+ // $scope.unCollapsedTopicIds.splice(index, 1);
+ // }
+ // else{
+ // $scope.unCollapsedTopicIds.push(clickedTopicId);
+ // }
+ });
+ }, 500);
+ };
+ $(document).ready(function () {
+ addClickListenerToEachCollapseTrigger();
+ });
+ // var rangeslide = require("rangeslide");
+ /*
+ * references to kommonitorDataExchangeService and wpsFormControl instances
+ */
+ this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
+ this.kommonitorDataExchangeServiceInstance.selectedServiceUrl = '';
+ this.kommonitorMapServiceInstance = kommonitorMapService;
+ $scope.loadingData = true;
+ $scope.changeIndicatorWasClicked = false;
+ $scope.dateSlider;
+ $scope.datePicker;
+ $scope.datesAsMs;
+ $scope.selectedDate;
+ this.addGeopackage = function () {
+ this.kommonitorMapServiceInstance.addSpatialUnitGeopackage();
+ };
+ this.addGeoJSON = function () {
+ this.kommonitorMapServiceInstance.addSpatialUnitGeoJSON();
+ };
+ $scope.onClickHierarchyIndicator = function (indicatorMetadata) {
+ kommonitorDataExchangeService.selectedIndicator = indicatorMetadata;
+ $scope.onChangeSelectedIndicator(false);
+ };
+ // $scope.$watch('filteredSpatialUnits', function(value){
+ // if ($scope.filteredSpatialUnits) {
+ // kommonitorDataExchangeService.selectedSpatialUnit = $scope.filteredSpatialUnits[0];
+ // }
+ // }, true);
+ this.onClickTheme = function (topicName) {
+ for (const topic of this.kommonitorDataExchangeServiceInstance.availableTopics) {
+ if (topic.topicName === topicName) {
+ document.getElementById(topicName).setAttribute("class", "active");
+ this.kommonitorDataExchangeServiceInstance.selectedTopic = topic;
+ }
+ else {
+ if (document.getElementById(topic.topicName)) {
+ document.getElementById(topic.topicName).setAttribute("class", "");
+ }
+ }
+ }
+ ;
+ if (kommonitorDataExchangeService.selectedIndicator) {
+ kommonitorDataExchangeService.selectedIndicatorBackup = kommonitorDataExchangeService.selectedIndicator;
+ }
+ // $scope.$digest();
+ };
+ this.unsetTopic = function () {
+ this.kommonitorDataExchangeServiceInstance.selectedTopic = null;
+ for (const topic of this.kommonitorDataExchangeServiceInstance.availableTopics) {
+ if (document.getElementById(topic.topicName)) {
+ document.getElementById(topic.topicName).setAttribute("class", "");
+ }
+ }
+ ;
+ if (!kommonitorDataExchangeService.selectedIndicator) {
+ kommonitorDataExchangeService.selectedIndicator = kommonitorDataExchangeService.selectedIndicatorBackup;
+ }
+ // $scope.$digest();
+ };
+ $scope.filterGeoresourcesByIndicator = function () {
+ return function (item) {
+ try {
+ var referencedGeoresources = kommonitorDataExchangeService.selectedIndicator.referencedGeoresources;
+ var georesourceId = item.georesourceId;
+ for (const refGeoresource of referencedGeoresources) {
+ if (refGeoresource.referencedGeoresourceId === georesourceId)
+ return true;
+ }
+ ;
+ // return referencedGeoresources.includes(georesourceId);
+ }
+ catch (error) {
+ return false;
+ }
+ };
+ };
+ $scope.filterReferencedIndicatorsByIndicator = function () {
+ return function (item) {
+ try {
+ var referencedIndicators = kommonitorDataExchangeService.selectedIndicator.referencedIndicators;
+ var indicatorId = item.indicatorId;
+ for (const refIndicator of referencedIndicators) {
+ if (refIndicator.referencedIndicatorId === indicatorId)
+ return true;
+ }
+ ;
+ }
+ catch (error) {
+ return false;
+ }
+ };
+ };
+ $scope.filterGeoresourcesByTopic = function () {
+ return function (item) {
+ if (kommonitorDataExchangeService.selectedTopic)
+ return item.applicableTopics.includes(kommonitorDataExchangeService.selectedTopic.topicName);
+ return true;
+ };
+ };
+ $scope.filterSpatialUnitsByIndicator = function () {
+ return function (item) {
+ try {
+ var applicableSpatialUnits = kommonitorDataExchangeService.selectedIndicator.applicableSpatialUnits;
+ return applicableSpatialUnits.some(o => o.spatialUnitName === item.spatialUnitLevel);
+ }
+ catch (error) {
+ return false;
+ }
+ };
+ };
+ $scope.getFirstSpatialUnitForSelectedIndicator = function () {
+ var result = undefined;
+ var applicableSpatialUnits = kommonitorDataExchangeService.selectedIndicator.applicableSpatialUnits;
+ for (const spatialUnitEntry of kommonitorDataExchangeService.availableSpatialUnits) {
+ if (applicableSpatialUnits.some(o => o.spatialUnitName === spatialUnitEntry.spatialUnitLevel)) {
+ result = spatialUnitEntry;
+ break;
+ }
+ }
+ return result;
+ };
+ this.onDateChange = function () {
+ var date = new Date($scope.selectedDate);
+ var month = date.getMonth() + 1;
+ var day = date.getDate();
+ if (month < 10)
+ month = "0" + month;
+ if (day < 10)
+ day = "0" + day;
+ $scope.selectedDate = date.getFullYear() + "-" + month + "-" + day;
+ kommonitorDataExchangeService.selectedDate = $scope.selectedDate;
+ $scope.$digest();
+ };
+ $scope.$on("initialMetadataLoadingFailed", function (event, errorArray) {
+ $scope.loadingData = false;
+ $scope.$broadcast("hideLoadingIconOnMap");
+ });
+ // load exemplar indicator
+ $scope.$on("initialMetadataLoadingCompleted", function (event) {
+ console.log("Load an initial example indicator");
+ if (kommonitorDataExchangeService.displayableIndicators == null || kommonitorDataExchangeService.displayableIndicators == undefined || kommonitorDataExchangeService.displayableIndicators.length === 0) {
+ console.error("Kein darstellbarer Indikator konnte gefunden werden.");
+ kommonitorDataExchangeService.displayMapApplicationError("Kein darstellbarer Indikator konnte gefunden werden.");
+ $scope.loadingData = false;
+ $scope.$broadcast("hideLoadingIconOnMap");
+ return;
+ }
+ try {
+ var indicatorIndex = undefined;
+ for (var index = 0; index < kommonitorDataExchangeService.displayableIndicators.length; index++) {
+ if (kommonitorDataExchangeService.displayableIndicators[index].indicatorId === __env.initialIndicatorId) {
+ if (kommonitorDataExchangeService.displayableIndicators[index].applicableDates.length > 0) {
+ indicatorIndex = index;
+ break;
+ }
+ }
+ }
+ if (indicatorIndex === undefined) {
+ for (var t = 0; t < 75; t++) {
+ var randIndex = getRandomInt(0, kommonitorDataExchangeService.displayableIndicators.length - 1);
+ if (kommonitorDataExchangeService.displayableIndicators[randIndex].applicableDates.length > 0) {
+ indicatorIndex = randIndex;
+ break;
+ }
+ }
+ }
+ if (indicatorIndex === undefined) {
+ throw Error();
+ }
+ kommonitorDataExchangeService.selectedIndicator = kommonitorDataExchangeService.displayableIndicators[indicatorIndex];
+ // create Backup which is used when currently selected indicator is filtered out in select
+ kommonitorDataExchangeService.selectedIndicatorBackup = kommonitorDataExchangeService.selectedIndicator;
+ // set spatialUnit
+ for (var spatialUnitEntry of kommonitorDataExchangeService.availableSpatialUnits) {
+ if (spatialUnitEntry.spatialUnitLevel === __env.initialSpatialUnitName) {
+ kommonitorDataExchangeService.selectedSpatialUnit = spatialUnitEntry;
+ break;
+ }
+ }
+ if (!kommonitorDataExchangeService.selectedSpatialUnit) {
+ kommonitorDataExchangeService.selectedSpatialUnit = $scope.getFirstSpatialUnitForSelectedIndicator();
+ }
+ if (!__env.centerMapInitially) {
+ $scope.onChangeSelectedIndicator(false);
+ }
+ else {
+ $scope.onChangeSelectedIndicator(true);
+ }
+ }
+ catch (error) {
+ console.error("Initiales Darstellen eines Indikators ist gescheitert.");
+ kommonitorDataExchangeService.displayMapApplicationError("Initiales Darstellen eines Indikators ist gescheitert.");
+ $scope.loadingData = false;
+ $scope.$broadcast("hideLoadingIconOnMap");
+ return;
+ }
+ });
+ /**
+ * Returns a random integer between min (inclusive) and max (inclusive).
+ * The value is no lower than min (or the next integer greater than min
+ * if min isn't an integer) and no greater than max (or the next integer
+ * lower than max if max isn't an integer).
+ * Using Math.round() will give you a non-uniform distribution!
+ */
+ function getRandomInt(min, max) {
+ min = Math.ceil(min);
+ max = Math.floor(max);
+ return Math.floor(Math.random() * (max - min + 1)) + min;
+ }
+ this.addSelectedSpatialUnitToMap = function () {
+ $scope.loadingData = true;
+ $rootScope.$broadcast("showLoadingIconOnMap");
+ var metadata = kommonitorDataExchangeService.selectedSpatialUnit;
+ var id = metadata.spatialUnitId;
+ $scope.date = $scope.selectedDate;
+ var dateComps = $scope.selectedDate.split("-");
+ var year = dateComps[0];
+ var month = dateComps[1];
+ var day = dateComps[2];
+ $http({
+ url: kommonitorDataExchangeService.getBaseUrlToKomMonitorDataAPI_spatialResource() + "/spatial-units/" + id + "/" + year + "/" + month + "/" + day + "?" + kommonitorDataExchangeService.simplifyGeometriesParameterName + "=" + kommonitorDataExchangeService.simplifyGeometries,
+ method: "GET"
+ }).then(function successCallback(response) {
+ // this callback will be called asynchronously
+ // when the response is available
+ var geoJSON = response.data;
+ kommonitorDataExchangeService.selectedSpatialUnit.geoJSON = geoJSON;
+ kommonitorMapService.addSpatialUnitGeoJSON(kommonitorDataExchangeService.selectedSpatialUnit, $scope.date);
+ $scope.loadingData = false;
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ }, function errorCallback(error) {
+ // called asynchronously if an error occurs
+ // or server returns response with an error status.
+ $scope.loadingData = false;
+ kommonitorDataExchangeService.displayMapApplicationError(error);
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ });
+ };
+ this.addSelectedSpatialUnitToMapAsWFS = function () {
+ $scope.loadingData = true;
+ $rootScope.$broadcast("showLoadingIconOnMap");
+ var metadata = kommonitorDataExchangeService.selectedSpatialUnit;
+ var name = metadata.spatialUnitLevel;
+ var wfsUrl = metadata.wfsUrl;
+ kommonitorMapService.addSpatialUnitWFS(name, wfsUrl);
+ $scope.loadingData = false;
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ };
+ this.addSelectedGeoresourceToMap = function () {
+ $scope.loadingData = true;
+ $rootScope.$broadcast("showLoadingIconOnMap");
+ var metadata = kommonitorDataExchangeService.selectedGeoresource;
+ var id = metadata.georesourceId;
+ $scope.date = $scope.selectedDate;
+ var dateComps = $scope.selectedDate.split("-");
+ var year = dateComps[0];
+ var month = dateComps[1];
+ var day = dateComps[2];
+ $http({
+ url: kommonitorDataExchangeService.getBaseUrlToKomMonitorDataAPI_spatialResource() + "/georesources/" + id + "/" + year + "/" + month + "/" + day + "?" + kommonitorDataExchangeService.simplifyGeometriesParameterName + "=" + kommonitorDataExchangeService.simplifyGeometries,
+ method: "GET"
+ }).then(function successCallback(response) {
+ // this callback will be called asynchronously
+ // when the response is available
+ var geoJSON = response.data;
+ kommonitorDataExchangeService.selectedGeoresource.geoJSON = geoJSON;
+ kommonitorMapService.addGeoresourceGeoJSON(kommonitorDataExchangeService.selectedGeoresource, $scope.date);
+ $scope.loadingData = false;
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ }, function errorCallback(error) {
+ // called asynchronously if an error occurs
+ // or server returns response with an error status.
+ $scope.loadingData = false;
+ kommonitorDataExchangeService.displayMapApplicationError(error);
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ });
+ };
+ $scope.addSelectedIndicatorToMap = function (changeIndicator) {
+ if (changeIndicator) {
+ $rootScope.$broadcast("DisableBalance");
+ kommonitorMapService.replaceIndicatorGeoJSON(kommonitorDataExchangeService.selectedIndicator, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, $scope.selectedDate, false);
+ }
+ else {
+ // check if balance mode is active
+ if (kommonitorDataExchangeService.isBalanceChecked) {
+ $rootScope.$broadcast("replaceBalancedIndicator");
+ }
+ else {
+ kommonitorMapService.replaceIndicatorGeoJSON(kommonitorDataExchangeService.selectedIndicator, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, $scope.selectedDate, false);
+ }
+ }
+ };
+ function prettifyDateSliderLabels(dateAsMs) {
+ return kommonitorDataExchangeService.tsToDate_withOptionalUpdateInterval(dateAsMs, kommonitorDataExchangeService.selectedIndicator.metadata.updateInterval);
+ }
+ function createDatesFromIndicatorDates(indicatorDates) {
+ $scope.datesAsMs = [];
+ for (var index = 0; index < indicatorDates.length; index++) {
+ // year-month-day
+ var dateComponents = indicatorDates[index].split("-");
+ $scope.datesAsMs.push(kommonitorDataExchangeService.dateToTS(new Date(Number(dateComponents[0]), Number(dateComponents[1]) - 1, Number(dateComponents[2]))));
+ }
+ return $scope.datesAsMs;
+ }
+ $scope.setupDateSliderForIndicator = function () {
+ if ($scope.dateSlider) {
+ $scope.dateSlider.destroy();
+ }
+ var domNode = document.getElementById("dateSlider");
+ while (domNode.hasChildNodes()) {
+ domNode.removeChild(domNode.lastChild);
+ }
+ var availableDates = kommonitorDataExchangeService.selectedIndicator.applicableDates;
+ $scope.date = availableDates[availableDates.length - 1];
+ $scope.selectedDate = availableDates[availableDates.length - 1];
+ kommonitorDataExchangeService.selectedDate = availableDates[availableDates.length - 1];
+ $scope.datesAsMs = createDatesFromIndicatorDates(kommonitorDataExchangeService.selectedIndicator.applicableDates);
+ // new Date() uses month between 0-11!
+ $("#dateSlider").ionRangeSlider({
+ skin: "big",
+ type: "single",
+ grid: true,
+ values: $scope.datesAsMs,
+ from: $scope.datesAsMs.length - 1,
+ force_edges: true,
+ prettify: prettifyDateSliderLabels,
+ onChange: $scope.onChangeDateSliderItem
+ });
+ $scope.dateSlider = $("#dateSlider").data("ionRangeSlider");
+ // make sure that the handle is properly set to max value
+ $scope.dateSlider.update({
+ from: $scope.datesAsMs.length - 1 // index, not the date
+ });
+ };
+ $scope.setupDatePickerForIndicator = function () {
+ if ($scope.datePicker) {
+ $('#indicatorDatePicker').datepicker('destroy');
+ $scope.datePicker = undefined;
+ }
+ var domNode = document.getElementById("indicatorDatePicker");
+ while (domNode.hasChildNodes()) {
+ domNode.removeChild(domNode.lastChild);
+ }
+ var availableDates = kommonitorDataExchangeService.selectedIndicator.applicableDates;
+ $scope.date = availableDates[availableDates.length - 1];
+ $scope.selectedDate = availableDates[availableDates.length - 1];
+ kommonitorDataExchangeService.selectedDate = availableDates[availableDates.length - 1];
+ $scope.datePicker = $('#indicatorDatePicker').datepicker(kommonitorDataExchangeService.getLimitedDatePickerOptions(availableDates));
+ };
+ $scope.onChangeDateSliderItem = async function (data) {
+ if (!$scope.changeIndicatorWasClicked && kommonitorDataExchangeService.selectedIndicator) {
+ $scope.loadingData = true;
+ $rootScope.$broadcast("showLoadingIconOnMap");
+ console.log("Change selected date");
+ //data.from is index of date!
+ $scope.selectedDate = kommonitorDataExchangeService.selectedIndicator.applicableDates[data.from];
+ $scope.date = $scope.selectedDate;
+ kommonitorDataExchangeService.selectedDate = $scope.selectedDate;
+ $('#indicatorDatePicker').datepicker('update', new Date(kommonitorDataExchangeService.selectedDate));
+ try {
+ var selectedIndicator = await $scope.tryUpdateMeasureOfValueBarForIndicator();
+ }
+ catch (error) {
+ console.error(error);
+ $scope.loadingData = false;
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ kommonitorDataExchangeService.displayMapApplicationError(error);
+ return;
+ }
+ $scope.modifyExports(false);
+ if (document.getElementById('controlNoDataDisplay').checked)
+ $rootScope.$broadcast('applyNoDataDisplay');
+ $scope.loadingData = false;
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ $rootScope.$broadcast("selectedIndicatorDateHasChanged");
+ $rootScope.$apply();
+ }
+ };
+ $scope.$on("DisableDateSlider", function (event) {
+ if ($scope.dateSlider) {
+ $scope.dateSlider.update({
+ block: true
+ });
+ }
+ kommonitorDataExchangeService.disableIndicatorDatePicker = true;
+ });
+ $scope.$on("EnableDateSlider", function (event) {
+ if ($scope.dateSlider) {
+ $scope.dateSlider.update({
+ block: false
+ });
+ }
+ kommonitorDataExchangeService.disableIndicatorDatePicker = false;
+ });
+ var wait = ms => new Promise((r, j) => setTimeout(r, ms));
+ $scope.tryUpdateMeasureOfValueBarForIndicator = async function () {
+ var indicatorId = kommonitorDataExchangeService.selectedIndicator.indicatorId;
+ if (!($scope.date && kommonitorDataExchangeService.selectedSpatialUnit && indicatorId)) {
+ kommonitorDataExchangeService.displayMapApplicationError("Beim Versuch, einen Beispielindikator zu laden, ist ein Fehler aufgetreten. Der Datenbankeintrag scheint eine fehlerhafte Kombination aus Raumeinheit und Zeitschnitt zu enthalten.");
+ throw Error("Not all parameters have been set up yet.");
+ }
+ //
+ // $scope.selectedDate = $scope.selectedDate;
+ $scope.spatialUnitName = kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
+ var dateComps = $scope.date.split("-");
+ var year = dateComps[0];
+ var month = dateComps[1];
+ var day = dateComps[2];
+ return await $http({
+ url: kommonitorDataExchangeService.getBaseUrlToKomMonitorDataAPI_spatialResource() + "/indicators/" + indicatorId + "/" + kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitId + "/" + year + "/" + month + "/" + day + "?" + kommonitorDataExchangeService.simplifyGeometriesParameterName + "=" + kommonitorDataExchangeService.simplifyGeometries,
+ method: "GET"
+ }).then(function successCallback(response) {
+ // this callback will be called asynchronously
+ // when the response is available
+ var geoJSON = response.data;
+ kommonitorDataExchangeService.selectedIndicator.geoJSON = geoJSON;
+ $rootScope.$broadcast("updateMeasureOfValueBar", $scope.date, kommonitorDataExchangeService.selectedIndicator);
+ // $scope.updateMeasureOfValueBar($scope.date);
+ return kommonitorDataExchangeService.selectedIndicator;
+ }, function errorCallback(error) {
+ // called asynchronously if an error occurs
+ // or server returns response with an error status.
+ $scope.loadingData = false;
+ kommonitorDataExchangeService.displayMapApplicationError(error);
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ return kommonitorDataExchangeService.selectedIndicator;
+ });
+ };
+ $scope.$on("changeSpatialUnit", function (event) {
+ $scope.onChangeSelectedSpatialUnit();
+ });
+ $scope.$on("changeIndicatorDate", async function (event) {
+ if (kommonitorDataExchangeService.selectedIndicator && kommonitorDataExchangeService.selectedDate) {
+ $scope.loadingData = true;
+ $rootScope.$broadcast("showLoadingIconOnMap");
+ console.log("Change selected date");
+ //data.from is index of date!
+ var index = kommonitorDataExchangeService.selectedIndicator.applicableDates.indexOf(kommonitorDataExchangeService.selectedDate);
+ ;
+ $scope.dateSlider.update({
+ from: index // index, not the date
+ });
+ $scope.date = kommonitorDataExchangeService.selectedDate;
+ $scope.selectedDate = kommonitorDataExchangeService.selectedDate;
+ try {
+ var selectedIndicator = await $scope.tryUpdateMeasureOfValueBarForIndicator();
+ }
+ catch (error) {
+ console.error(error);
+ $scope.loadingData = false;
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ kommonitorDataExchangeService.displayMapApplicationError(error);
+ return;
+ }
+ $scope.modifyExports(false);
+ if (document.getElementById('controlNoDataDisplay').checked)
+ $rootScope.$broadcast('applyNoDataDisplay');
+ $scope.loadingData = false;
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ $rootScope.$broadcast("selectedIndicatorDateHasChanged");
+ $rootScope.$apply();
+ }
+ });
+ $scope.onChangeSelectedSpatialUnit = async function () {
+ if (!$scope.changeIndicatorWasClicked && kommonitorDataExchangeService.selectedIndicator) {
+ $scope.loadingData = true;
+ $rootScope.$broadcast("showLoadingIconOnMap");
+ console.log("Change spatial unit");
+ try {
+ var selectedIndicator = await $scope.tryUpdateMeasureOfValueBarForIndicator();
+ }
+ catch (error) {
+ console.error(error);
+ $scope.loadingData = false;
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ kommonitorDataExchangeService.displayMapApplicationError(error);
+ return;
+ }
+ $scope.modifyExports(false);
+ if (document.getElementById('controlNoDataDisplay').checked)
+ $rootScope.$broadcast('applyNoDataDisplay');
+ $scope.loadingData = false;
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ $scope.$digest();
+ }
+ };
+ $scope.markAssociatedHierarchyElement = function (selectedIndicatorMetadata) {
+ var selectedIndicatorId = selectedIndicatorMetadata.indicatorId;
+ for (var indicator of kommonitorDataExchangeService.displayableIndicators) {
+ $("#indicatorHierarchyElement-" + indicator.indicatorId).removeClass('active');
+ }
+ $("#indicatorHierarchyElement-" + selectedIndicatorId).addClass('active');
+ };
+ $scope.onChangeSelectedIndicator_fromAlphabeticalList = function (indicatorMetadata) {
+ kommonitorDataExchangeService.selectedIndicator = indicatorMetadata;
+ $scope.onChangeSelectedIndicator(false);
+ };
+ $scope.onChangeSelectedIndicator = async function (recenterMap) {
+ $rootScope.$broadcast("onChangeSelectedIndicator");
+ if (kommonitorDataExchangeService.selectedIndicator) {
+ $scope.loadingData = true;
+ $rootScope.$broadcast("showLoadingIconOnMap");
+ $scope.changeIndicatorWasClicked = true;
+ $scope.markAssociatedHierarchyElement(kommonitorDataExchangeService.selectedIndicator);
+ kommonitorDataExchangeService.selectedIndicatorBackup = kommonitorDataExchangeService.selectedIndicator;
+ $scope.setupDateSliderForIndicator();
+ $scope.setupDatePickerForIndicator();
+ if (!kommonitorDataExchangeService.selectedSpatialUnit || !kommonitorDataExchangeService.selectedIndicator.applicableSpatialUnits.some(o => o.spatialUnitName === kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel)) {
+ kommonitorDataExchangeService.selectedSpatialUnit = $scope.getFirstSpatialUnitForSelectedIndicator();
+ }
+ try {
+ var selectedIndicator = await $scope.tryUpdateMeasureOfValueBarForIndicator();
+ }
+ catch (error) {
+ console.error(error);
+ $scope.loadingData = false;
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ kommonitorDataExchangeService.displayMapApplicationError(error);
+ return;
+ }
+ $rootScope.$broadcast("DisableBalance");
+ $scope.modifyExports(true);
+ if (document.getElementById('controlNoDataDisplay').checked)
+ $rootScope.$broadcast('applyNoDataDisplay');
+ $scope.loadingData = false;
+ if (recenterMap) {
+ $rootScope.$broadcast("recenterMapContent");
+ }
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ $scope.changeIndicatorWasClicked = false;
+ // $rootScope.$broadcast("updateDiagrams", kommonitorDataExchangeService.selectedIndicator, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, $scope.selectedDate);
+ $rootScope.$apply();
+ }
+ else {
+ if (kommonitorDataExchangeService.selectedIndicatorBackup) {
+ kommonitorDataExchangeService.selectedIndicator = kommonitorDataExchangeService.selectedIndicatorBackup;
+ }
+ }
+ $rootScope.$broadcast("selectedIndicatorDateHasChanged");
+ };
+ $scope.modifyExports = function (changeIndicator) {
+ kommonitorDataExchangeService.wmsUrlForSelectedIndicator = undefined;
+ kommonitorDataExchangeService.wmsUrlForSelectedIndicator = undefined;
+ var selectedSpatialUnitName = kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
+ for (const ogcServiceEntry of kommonitorDataExchangeService.selectedIndicator.ogcServices) {
+ if (ogcServiceEntry.spatialUnit === selectedSpatialUnitName) {
+ kommonitorDataExchangeService.wmsUrlForSelectedIndicator = ogcServiceEntry.wmsUrl;
+ kommonitorDataExchangeService.wfsUrlForSelectedIndicator = ogcServiceEntry.wfsUrl;
+ break;
+ }
+ }
+ ;
+ $rootScope.$broadcast("updateBalanceSlider", kommonitorDataExchangeService.selectedDate);
+ $rootScope.$broadcast("updateIndicatorValueRangeFilter", kommonitorDataExchangeService.selectedDate, kommonitorDataExchangeService.selectedIndicator);
+ $scope.addSelectedIndicatorToMap(changeIndicator);
+ };
+ $scope.$on("updateIndicatorOgcServices", function (event, indicatorWmsUrl, indicatorWfsUrl) {
+ console.log('updateIndicatorOgcServices was called');
+ kommonitorDataExchangeService.wmsUrlForSelectedIndicator = indicatorWmsUrl;
+ kommonitorDataExchangeService.wfsUrlForSelectedIndicator = indicatorWfsUrl;
+ $scope.$digest();
+ });
+ }
+ ]
+});
+//# sourceMappingURL=kommonitor-data-setup.component.js.map
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.component.js.map b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.component.js.map
new file mode 100644
index 000000000..ebe8c7e5f
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"kommonitor-data-setup.component.js","sourceRoot":"","sources":["kommonitor-data-setup.component.ts"],"names":[],"mappings":";AAAA,OAAO;KACJ,MAAM,CAAC,qBAAqB,CAAC;KAC7B,SAAS,CACR,qBAAqB,EACrB;IACC,WAAW,EAAG,+GAA+G;IAC7H;;;OAGG;IACH,UAAU,EAAG;QACX,+BAA+B,EAAE,QAAQ,EAAE,sBAAsB,EAAE,OAAO,EAAE,YAAY,EAAE,OAAO;QACjG,UAAU;QACV,SAAS,6BAA6B,CAAC,6BAA6B,EAAE,MAAM,EAAE,oBAAoB,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAC3H,QAAQ;YAER,MAAM,qBAAqB,GAAG,KAAK,CAAC,mBAAmB,CAAC;YAExD,MAAM,CAAC,mBAAmB,GAAG,SAAS,CAAC;YAEvC,sCA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AAC,CAAC;YAC1D,CAAC,CAAA;YAID,MAAM,CAAC,aAAa,GAAG,UAAS,eAAe;gBAC9C,6BAA6B,CAAC,0BAA0B,GAAG,SAAS,CAAC;gBACrE,6BAA6B,CAAC,0BAA0B,GAAG,SAAS,CAAC;gBAErE,IAAI,uBAAuB,GAAG,6BAA6B,CAAC,mBAAmB,CAAC,gBAAgB,CAAC;gBAEjG,KAAI,MAAM,eAAe,IAAI,6BAA6B,CAAC,iBAAiB,CAAC,WAAW,EAAC;oBACxF,IAAI,eAAe,CAAC,WAAW,KAAK,uBAAuB,EAAC;wBAC3D,6BAA6B,CAAC,0BAA0B,GAAG,eAAe,CAAC,MAAM,CAAC;wBAClF,6BAA6B,CAAC,0BAA0B,GAAG,eAAe,CAAC,MAAM,CAAC;wBAClF,MAAM;qBACN;iBACD;gBAAA,CAAC;gBAEF,UAAU,CAAC,UAAU,CAAC,qBAAqB,EAAE,6BAA6B,CAAC,YAAY,CAAC,CAAC;gBACzF,UAAU,CAAC,UAAU,CAAC,iCAAiC,EAAE,6BAA6B,CAAC,YAAY,EAAE,6BAA6B,CAAC,iBAAiB,CAAC,CAAC;gBACtJ,MAAM,CAAC,yBAAyB,CAAC,eAAe,CAAC,CAAC;YAEnD,CAAC,CAAA;YAED,MAAM,CAAC,GAAG,CAAC,4BAA4B,EAAE,UAAU,KAAK,EAAE,eAAe,EAAE,eAAe;gBAEnF,OAAO,CAAC,GAAG,CAAC,uCAAuC,CAAC,CAAC;gBAErD,6BAA6B,CAAC,0BAA0B,GAAG,eAAe,CAAC;gBAC3E,6BAA6B,CAAC,0BAA0B,GAAG,eAAe,CAAC;gBAC3E,MAAM,CAAC,OAAO,EAAE,CAAC;YAExB,CAAC,CAAC,CAAC;QAGJ,CAAC;KAAE;CACL,CAAC,CAAC"}
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.component.ts b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.component.ts
new file mode 100644
index 000000000..a468a3590
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.component.ts
@@ -0,0 +1,796 @@
+angular
+ .module('kommonitorDataSetup')
+ .component(
+ 'kommonitorDataSetup',
+ {
+ templateUrl : "components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.template.html",
+ /*
+ * injected with a modules service method that manages
+ * enabled tabs
+ */
+ controller : [
+ 'kommonitorDataExchangeService', '$scope', 'kommonitorMapService', '$http', '$rootScope', '__env',
+ '$timeout',
+ function kommonitorDataSetupController(kommonitorDataExchangeService, $scope, kommonitorMapService, $http, $rootScope, __env,
+ $timeout) {
+
+ const INDICATOR_DATE_PREFIX = __env.indicatorDatePrefix;
+
+ $scope.indicatorNameFilter = undefined;
+
+ // initialize any adminLTE box widgets
+ $('.box').boxWidget();
+
+ var addClickListenerToEachCollapseTrigger = function(){
+ setTimeout(function(){
+ $('.list-group-item > .collapseTrigger').on('click', function() {
+ $('.glyphicon', this)
+ .toggleClass('glyphicon-chevron-right')
+ .toggleClass('glyphicon-chevron-down');
+
+ // manage uncollapsed entries
+ // var clickedTopicId = $(this).attr('id');
+ // if ($scope.unCollapsedTopicIds.includes(clickedTopicId)){
+ // var index = $scope.unCollapsedTopicIds.indexOf(clickedTopicId);
+ // $scope.unCollapsedTopicIds.splice(index, 1);
+ // }
+ // else{
+ // $scope.unCollapsedTopicIds.push(clickedTopicId);
+ // }
+ });
+ }, 500);
+ };
+
+ $(document).ready(function() {
+
+ addClickListenerToEachCollapseTrigger();
+ });
+
+ // var rangeslide = require("rangeslide");
+ /*
+ * references to kommonitorDataExchangeService and wpsFormControl instances
+ */
+ this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
+ this.kommonitorDataExchangeServiceInstance.selectedServiceUrl = '';
+ this.kommonitorMapServiceInstance = kommonitorMapService;
+
+ $scope.loadingData = true;
+ $scope.changeIndicatorWasClicked = false;
+
+ $scope.dateSlider;
+ $scope.datePicker;
+ $scope.datesAsMs;
+
+ $scope.selectedDate;
+
+ this.addGeopackage = function(){
+ this.kommonitorMapServiceInstance.addSpatialUnitGeopackage();
+ }
+ this.addGeoJSON = function(){
+ this.kommonitorMapServiceInstance.addSpatialUnitGeoJSON();
+ }
+
+ $scope.onClickHierarchyIndicator = function(indicatorMetadata){
+ kommonitorDataExchangeService.selectedIndicator = indicatorMetadata;
+ $scope.onChangeSelectedIndicator(false);
+ };
+
+ // $scope.$watch('filteredSpatialUnits', function(value){
+ // if ($scope.filteredSpatialUnits) {
+ // kommonitorDataExchangeService.selectedSpatialUnit = $scope.filteredSpatialUnits[0];
+ // }
+ // }, true);
+
+ this.onClickTheme = function(topicName){
+
+ for(const topic of this.kommonitorDataExchangeServiceInstance.availableTopics){
+ if(topic.topicName === topicName){
+ document.getElementById(topicName).setAttribute("class", "active");
+ this.kommonitorDataExchangeServiceInstance.selectedTopic = topic;
+ }
+ else {
+ if(document.getElementById(topic.topicName)){
+ document.getElementById(topic.topicName).setAttribute("class", "");
+ }
+ }
+ };
+
+ if(kommonitorDataExchangeService.selectedIndicator){
+ kommonitorDataExchangeService.selectedIndicatorBackup = kommonitorDataExchangeService.selectedIndicator;
+ }
+
+ // $scope.$digest();
+ };
+
+ this.unsetTopic = function(){
+ this.kommonitorDataExchangeServiceInstance.selectedTopic = null;
+
+ for(const topic of this.kommonitorDataExchangeServiceInstance.availableTopics){
+ if (document.getElementById(topic.topicName)){
+ document.getElementById(topic.topicName).setAttribute("class", "");
+ }
+ };
+
+ if(!kommonitorDataExchangeService.selectedIndicator){
+ kommonitorDataExchangeService.selectedIndicator = kommonitorDataExchangeService.selectedIndicatorBackup;
+ }
+
+ // $scope.$digest();
+ };
+
+ $scope.filterGeoresourcesByIndicator = function() {
+ return function( item ) {
+
+ try{
+ var referencedGeoresources = kommonitorDataExchangeService.selectedIndicator.referencedGeoresources;
+ var georesourceId = item.georesourceId;
+
+ for (const refGeoresource of referencedGeoresources){
+ if(refGeoresource.referencedGeoresourceId === georesourceId)
+ return true;
+ };
+
+ // return referencedGeoresources.includes(georesourceId);
+ }
+ catch(error){
+ return false;
+ }
+ };
+ };
+
+ $scope.filterReferencedIndicatorsByIndicator = function() {
+ return function( item ) {
+
+ try{
+ var referencedIndicators = kommonitorDataExchangeService.selectedIndicator.referencedIndicators;
+ var indicatorId = item.indicatorId;
+
+ for (const refIndicator of referencedIndicators){
+ if(refIndicator.referencedIndicatorId === indicatorId)
+ return true;
+ };
+
+ }
+ catch(error){
+ return false;
+ }
+ };
+ };
+
+ $scope.filterGeoresourcesByTopic = function() {
+ return function( item ) {
+ if (kommonitorDataExchangeService.selectedTopic)
+ return item.applicableTopics.includes(kommonitorDataExchangeService.selectedTopic.topicName);
+
+ return true;
+ };
+ };
+
+ $scope.filterSpatialUnitsByIndicator = function() {
+ return function( item ) {
+
+ try{
+ var applicableSpatialUnits = kommonitorDataExchangeService.selectedIndicator.applicableSpatialUnits;
+
+ return applicableSpatialUnits.some(o => o.spatialUnitName === item.spatialUnitLevel);
+ }
+ catch(error){
+ return false;
+ }
+ };
+ };
+
+ $scope.getFirstSpatialUnitForSelectedIndicator = function() {
+
+ var result = undefined;
+
+ var applicableSpatialUnits = kommonitorDataExchangeService.selectedIndicator.applicableSpatialUnits;
+
+ for (const spatialUnitEntry of kommonitorDataExchangeService.availableSpatialUnits){
+ if(applicableSpatialUnits.some(o => o.spatialUnitName === spatialUnitEntry.spatialUnitLevel)){
+ result = spatialUnitEntry;
+ break;
+ }
+ }
+
+ return result;
+ };
+
+ this.onDateChange = function(){
+
+ var date = new Date($scope.selectedDate);
+
+ var month = date.getMonth()+1;
+ var day = date.getDate();
+
+ if (month < 10)
+ month = "0" + month;
+
+ if (day < 10)
+ day = "0" + day;
+
+ $scope.selectedDate = date.getFullYear() + "-" + month + "-" + day;
+ kommonitorDataExchangeService.selectedDate = $scope.selectedDate;
+
+ $scope.$digest();
+ };
+
+ $scope.$on("initialMetadataLoadingFailed", function (event, errorArray) {
+
+ $scope.loadingData = false;
+ $scope.$broadcast("hideLoadingIconOnMap");
+
+ });
+
+ // load exemplar indicator
+ $scope.$on("initialMetadataLoadingCompleted", function (event) {
+
+ console.log("Load an initial example indicator");
+
+ if (kommonitorDataExchangeService.displayableIndicators == null || kommonitorDataExchangeService.displayableIndicators == undefined || kommonitorDataExchangeService.displayableIndicators.length === 0){
+ console.error("Kein darstellbarer Indikator konnte gefunden werden.");
+
+ kommonitorDataExchangeService.displayMapApplicationError("Kein darstellbarer Indikator konnte gefunden werden.");
+ $scope.loadingData = false;
+ $scope.$broadcast("hideLoadingIconOnMap");
+
+ return;
+ }
+
+ try{
+ var indicatorIndex = undefined;
+
+ for (var index=0; index < kommonitorDataExchangeService.displayableIndicators.length; index++){
+ if (kommonitorDataExchangeService.displayableIndicators[index].indicatorId === __env.initialIndicatorId){
+ if(kommonitorDataExchangeService.displayableIndicators[index].applicableDates.length > 0){
+ indicatorIndex = index;
+ break;
+ }
+ }
+ }
+
+ if( indicatorIndex === undefined){
+ for(var t=0; t < 75; t++){
+
+ var randIndex = getRandomInt(0, kommonitorDataExchangeService.displayableIndicators.length - 1);
+ if (kommonitorDataExchangeService.displayableIndicators[randIndex].applicableDates.length > 0){
+ indicatorIndex = randIndex;
+ break;
+ }
+ }
+ }
+
+ if( indicatorIndex === undefined){
+ throw Error();
+ }
+
+ kommonitorDataExchangeService.selectedIndicator = kommonitorDataExchangeService.displayableIndicators[indicatorIndex];
+ // create Backup which is used when currently selected indicator is filtered out in select
+ kommonitorDataExchangeService.selectedIndicatorBackup = kommonitorDataExchangeService.selectedIndicator;
+
+ // set spatialUnit
+ for (var spatialUnitEntry of kommonitorDataExchangeService.availableSpatialUnits){
+ if(spatialUnitEntry.spatialUnitLevel === __env.initialSpatialUnitName){
+ kommonitorDataExchangeService.selectedSpatialUnit = spatialUnitEntry;
+ break;
+ }
+ }
+ if(!kommonitorDataExchangeService.selectedSpatialUnit){
+ kommonitorDataExchangeService.selectedSpatialUnit = $scope.getFirstSpatialUnitForSelectedIndicator();
+ }
+
+ if(! __env.centerMapInitially){
+ $scope.onChangeSelectedIndicator(false);
+ }
+ else{
+ $scope.onChangeSelectedIndicator(true);
+ }
+
+
+ }
+ catch(error){
+ console.error("Initiales Darstellen eines Indikators ist gescheitert.");
+
+ kommonitorDataExchangeService.displayMapApplicationError("Initiales Darstellen eines Indikators ist gescheitert.");
+ $scope.loadingData = false;
+ $scope.$broadcast("hideLoadingIconOnMap");
+
+ return;
+ }
+
+
+ });
+
+ /**
+ * Returns a random integer between min (inclusive) and max (inclusive).
+ * The value is no lower than min (or the next integer greater than min
+ * if min isn't an integer) and no greater than max (or the next integer
+ * lower than max if max isn't an integer).
+ * Using Math.round() will give you a non-uniform distribution!
+ */
+ function getRandomInt(min, max) {
+ min = Math.ceil(min);
+ max = Math.floor(max);
+ return Math.floor(Math.random() * (max - min + 1)) + min;
+ }
+
+ this.addSelectedSpatialUnitToMap = function() {
+ $scope.loadingData = true;
+ $rootScope.$broadcast("showLoadingIconOnMap");
+
+ var metadata = kommonitorDataExchangeService.selectedSpatialUnit;
+
+ var id = metadata.spatialUnitId;
+
+ $scope.date = $scope.selectedDate;
+
+ var dateComps = $scope.selectedDate.split("-");
+
+ var year = dateComps[0];
+ var month = dateComps[1];
+ var day = dateComps[2];
+
+ $http({
+ url: kommonitorDataExchangeService.getBaseUrlToKomMonitorDataAPI_spatialResource() + "/spatial-units/" + id + "/" + year + "/" + month + "/" + day + "?" + kommonitorDataExchangeService.simplifyGeometriesParameterName + "=" + kommonitorDataExchangeService.simplifyGeometries,
+ method: "GET"
+ }).then(function successCallback(response) {
+ // this callback will be called asynchronously
+ // when the response is available
+ var geoJSON = response.data;
+
+ kommonitorDataExchangeService.selectedSpatialUnit.geoJSON = geoJSON;
+
+ kommonitorMapService.addSpatialUnitGeoJSON(kommonitorDataExchangeService.selectedSpatialUnit, $scope.date);
+ $scope.loadingData = false;
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+
+ }, function errorCallback(error) {
+ // called asynchronously if an error occurs
+ // or server returns response with an error status.
+ $scope.loadingData = false;
+ kommonitorDataExchangeService.displayMapApplicationError(error);
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ });
+ };
+
+ this.addSelectedSpatialUnitToMapAsWFS = function() {
+ $scope.loadingData = true;
+ $rootScope.$broadcast("showLoadingIconOnMap");
+
+ var metadata = kommonitorDataExchangeService.selectedSpatialUnit;
+
+ var name = metadata.spatialUnitLevel;
+
+ var wfsUrl = metadata.wfsUrl;
+
+ kommonitorMapService.addSpatialUnitWFS(name, wfsUrl);
+ $scope.loadingData = false;
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+
+ };
+
+ this.addSelectedGeoresourceToMap = function() {
+ $scope.loadingData = true;
+ $rootScope.$broadcast("showLoadingIconOnMap");
+
+ var metadata = kommonitorDataExchangeService.selectedGeoresource;
+
+ var id = metadata.georesourceId;
+
+ $scope.date = $scope.selectedDate;
+
+ var dateComps = $scope.selectedDate.split("-");
+
+ var year = dateComps[0];
+ var month = dateComps[1];
+ var day = dateComps[2];
+
+ $http({
+ url: kommonitorDataExchangeService.getBaseUrlToKomMonitorDataAPI_spatialResource() + "/georesources/" + id + "/" + year + "/" + month + "/" + day + "?" + kommonitorDataExchangeService.simplifyGeometriesParameterName + "=" + kommonitorDataExchangeService.simplifyGeometries,
+ method: "GET"
+ }).then(function successCallback(response) {
+ // this callback will be called asynchronously
+ // when the response is available
+ var geoJSON = response.data;
+
+ kommonitorDataExchangeService.selectedGeoresource.geoJSON = geoJSON;
+
+ kommonitorMapService.addGeoresourceGeoJSON(kommonitorDataExchangeService.selectedGeoresource, $scope.date);
+ $scope.loadingData = false;
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+
+ }, function errorCallback(error) {
+ // called asynchronously if an error occurs
+ // or server returns response with an error status.
+ $scope.loadingData = false;
+ kommonitorDataExchangeService.displayMapApplicationError(error);
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ });
+
+ };
+
+ $scope.addSelectedIndicatorToMap = function(changeIndicator) {
+
+ if(changeIndicator){
+ $rootScope.$broadcast("DisableBalance");
+ kommonitorMapService.replaceIndicatorGeoJSON(kommonitorDataExchangeService.selectedIndicator, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, $scope.selectedDate, false);
+ }
+ else{
+ // check if balance mode is active
+ if (kommonitorDataExchangeService.isBalanceChecked){
+ $rootScope.$broadcast("replaceBalancedIndicator");
+ }
+ else{
+ kommonitorMapService.replaceIndicatorGeoJSON(kommonitorDataExchangeService.selectedIndicator, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, $scope.selectedDate, false);
+ }
+ }
+ };
+
+ function prettifyDateSliderLabels (dateAsMs) {
+ return kommonitorDataExchangeService.tsToDate_withOptionalUpdateInterval(dateAsMs, kommonitorDataExchangeService.selectedIndicator.metadata.updateInterval);
+ }
+
+ function createDatesFromIndicatorDates(indicatorDates) {
+
+ $scope.datesAsMs = [];
+
+ for (var index=0; index < indicatorDates.length; index++){
+ // year-month-day
+ var dateComponents = indicatorDates[index].split("-");
+ $scope.datesAsMs.push(kommonitorDataExchangeService.dateToTS(new Date(Number(dateComponents[0]), Number(dateComponents[1]) - 1, Number(dateComponents[2]))));
+ }
+ return $scope.datesAsMs;
+ }
+
+ $scope.setupDateSliderForIndicator = function(){
+
+ if($scope.dateSlider){
+ $scope.dateSlider.destroy();
+ }
+
+ var domNode = document.getElementById("dateSlider");
+
+ while (domNode.hasChildNodes()) {
+ domNode.removeChild(domNode.lastChild);
+ }
+
+ var availableDates = kommonitorDataExchangeService.selectedIndicator.applicableDates;
+ $scope.date = availableDates[availableDates.length - 1];
+ $scope.selectedDate = availableDates[availableDates.length - 1];
+ kommonitorDataExchangeService.selectedDate = availableDates[availableDates.length - 1];
+
+ $scope.datesAsMs = createDatesFromIndicatorDates(kommonitorDataExchangeService.selectedIndicator.applicableDates);
+
+ // new Date() uses month between 0-11!
+ $("#dateSlider").ionRangeSlider({
+ skin: "big",
+ type: "single",
+ grid: true,
+ values: $scope.datesAsMs,
+ from: $scope.datesAsMs.length -1, // index, not the date
+ force_edges: true,
+ prettify: prettifyDateSliderLabels,
+ onChange: $scope.onChangeDateSliderItem
+ });
+
+ $scope.dateSlider = $("#dateSlider").data("ionRangeSlider");
+ // make sure that the handle is properly set to max value
+ $scope.dateSlider.update({
+ from: $scope.datesAsMs.length -1 // index, not the date
+ });
+ };
+
+ $scope.setupDatePickerForIndicator = function(){
+
+ if($scope.datePicker){
+ $('#indicatorDatePicker').datepicker('destroy');
+ $scope.datePicker = undefined;
+ }
+
+ var domNode = document.getElementById("indicatorDatePicker");
+
+ while (domNode.hasChildNodes()) {
+ domNode.removeChild(domNode.lastChild);
+ }
+
+ var availableDates = kommonitorDataExchangeService.selectedIndicator.applicableDates;
+ $scope.date = availableDates[availableDates.length - 1];
+ $scope.selectedDate = availableDates[availableDates.length - 1];
+ kommonitorDataExchangeService.selectedDate = availableDates[availableDates.length - 1];
+
+ $scope.datePicker = $('#indicatorDatePicker').datepicker(kommonitorDataExchangeService.getLimitedDatePickerOptions(availableDates));
+
+ };
+
+
+ $scope.onChangeDateSliderItem = async function(data){
+
+ if(!$scope.changeIndicatorWasClicked && kommonitorDataExchangeService.selectedIndicator){
+ $scope.loadingData = true;
+ $rootScope.$broadcast("showLoadingIconOnMap");
+
+ console.log("Change selected date");
+
+ //data.from is index of date!
+
+ $scope.selectedDate = kommonitorDataExchangeService.selectedIndicator.applicableDates[data.from];
+ $scope.date = $scope.selectedDate;
+ kommonitorDataExchangeService.selectedDate = $scope.selectedDate;
+
+ $('#indicatorDatePicker').datepicker('update', new Date(kommonitorDataExchangeService.selectedDate));
+
+ try{
+ var selectedIndicator = await $scope.tryUpdateMeasureOfValueBarForIndicator();
+ }
+ catch(error){
+ console.error(error);
+ $scope.loadingData = false;
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ kommonitorDataExchangeService.displayMapApplicationError(error);
+ return;
+ }
+
+ $scope.modifyExports(false);
+
+ if(document.getElementById('controlNoDataDisplay').checked)
+ $rootScope.$broadcast('applyNoDataDisplay')
+
+ $scope.loadingData = false;
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ $rootScope.$broadcast("selectedIndicatorDateHasChanged");
+ $rootScope.$apply();
+ }
+ };
+
+ $scope.$on("DisableDateSlider", function (event) {
+ if($scope.dateSlider){
+ $scope.dateSlider.update({
+ block: true
+ });
+ }
+
+ kommonitorDataExchangeService.disableIndicatorDatePicker = true;
+ });
+
+ $scope.$on("EnableDateSlider", function (event) {
+ if($scope.dateSlider){
+ $scope.dateSlider.update({
+ block: false
+ });
+ }
+
+ kommonitorDataExchangeService.disableIndicatorDatePicker = false;
+ });
+
+ var wait = ms => new Promise((r, j)=>setTimeout(r, ms));
+
+ $scope.tryUpdateMeasureOfValueBarForIndicator = async function(){
+ var indicatorId = kommonitorDataExchangeService.selectedIndicator.indicatorId;
+
+ if(! ($scope.date && kommonitorDataExchangeService.selectedSpatialUnit && indicatorId)){
+ kommonitorDataExchangeService.displayMapApplicationError("Beim Versuch, einen Beispielindikator zu laden, ist ein Fehler aufgetreten. Der Datenbankeintrag scheint eine fehlerhafte Kombination aus Raumeinheit und Zeitschnitt zu enthalten.");
+ throw Error("Not all parameters have been set up yet.");
+ }
+ //
+ // $scope.selectedDate = $scope.selectedDate;
+ $scope.spatialUnitName = kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
+
+ var dateComps = $scope.date.split("-");
+ var year = dateComps[0];
+ var month = dateComps[1];
+ var day = dateComps[2];
+
+ return await $http({
+ url: kommonitorDataExchangeService.getBaseUrlToKomMonitorDataAPI_spatialResource() + "/indicators/" + indicatorId + "/" + kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitId + "/" + year + "/" + month + "/" + day + "?" + kommonitorDataExchangeService.simplifyGeometriesParameterName + "=" + kommonitorDataExchangeService.simplifyGeometries,
+ method: "GET"
+ }).then(function successCallback(response) {
+ // this callback will be called asynchronously
+ // when the response is available
+ var geoJSON = response.data;
+
+ kommonitorDataExchangeService.selectedIndicator.geoJSON = geoJSON;
+
+ $rootScope.$broadcast("updateMeasureOfValueBar", $scope.date, kommonitorDataExchangeService.selectedIndicator);
+
+ // $scope.updateMeasureOfValueBar($scope.date);
+
+ return kommonitorDataExchangeService.selectedIndicator;
+
+ }, function errorCallback(error) {
+ // called asynchronously if an error occurs
+ // or server returns response with an error status.
+ $scope.loadingData = false;
+ kommonitorDataExchangeService.displayMapApplicationError(error);
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+
+ return kommonitorDataExchangeService.selectedIndicator;
+ });
+ };
+
+ $scope.$on("changeSpatialUnit", function(event){
+ $scope.onChangeSelectedSpatialUnit();
+ });
+
+ $scope.$on("changeIndicatorDate", async function(event){
+
+ if(kommonitorDataExchangeService.selectedIndicator && kommonitorDataExchangeService.selectedDate){
+ $scope.loadingData = true;
+ $rootScope.$broadcast("showLoadingIconOnMap");
+
+ console.log("Change selected date");
+
+ //data.from is index of date!
+ var index = kommonitorDataExchangeService.selectedIndicator.applicableDates.indexOf(kommonitorDataExchangeService.selectedDate); ;
+
+ $scope.dateSlider.update({
+ from: index // index, not the date
+ });
+
+ $scope.date = kommonitorDataExchangeService.selectedDate;
+ $scope.selectedDate = kommonitorDataExchangeService.selectedDate;
+
+ try{
+ var selectedIndicator = await $scope.tryUpdateMeasureOfValueBarForIndicator();
+ }
+ catch(error){
+ console.error(error);
+ $scope.loadingData = false;
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ kommonitorDataExchangeService.displayMapApplicationError(error);
+ return;
+ }
+
+ $scope.modifyExports(false);
+
+ if(document.getElementById('controlNoDataDisplay').checked)
+ $rootScope.$broadcast('applyNoDataDisplay')
+
+ $scope.loadingData = false;
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ $rootScope.$broadcast("selectedIndicatorDateHasChanged");
+ $rootScope.$apply();
+ }
+
+ });
+
+ $scope.onChangeSelectedSpatialUnit = async function(){
+ if(!$scope.changeIndicatorWasClicked && kommonitorDataExchangeService.selectedIndicator){
+ $scope.loadingData = true;
+ $rootScope.$broadcast("showLoadingIconOnMap");
+
+ console.log("Change spatial unit");
+
+ try{
+ var selectedIndicator = await $scope.tryUpdateMeasureOfValueBarForIndicator();
+ }
+ catch(error){
+ console.error(error);
+ $scope.loadingData = false;
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ kommonitorDataExchangeService.displayMapApplicationError(error);
+ return;
+ }
+
+ $scope.modifyExports(false);
+
+ if(document.getElementById('controlNoDataDisplay').checked)
+ $rootScope.$broadcast('applyNoDataDisplay');
+
+ $scope.loadingData = false;
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ $scope.$digest();
+ }
+ }
+
+ $scope.markAssociatedHierarchyElement = function(selectedIndicatorMetadata){
+ var selectedIndicatorId = selectedIndicatorMetadata.indicatorId;
+
+ for (var indicator of kommonitorDataExchangeService.displayableIndicators) {
+ $("#indicatorHierarchyElement-" + indicator.indicatorId).removeClass('active');
+ }
+
+ $("#indicatorHierarchyElement-" + selectedIndicatorId).addClass('active');
+ };
+
+ $scope.onChangeSelectedIndicator_fromAlphabeticalList = function(indicatorMetadata){
+ kommonitorDataExchangeService.selectedIndicator = indicatorMetadata;
+ $scope.onChangeSelectedIndicator(false);
+ };
+
+ $scope.onChangeSelectedIndicator = async function(recenterMap){
+
+ $rootScope.$broadcast("onChangeSelectedIndicator");
+
+ if(kommonitorDataExchangeService.selectedIndicator){
+
+ $scope.loadingData = true;
+ $rootScope.$broadcast("showLoadingIconOnMap");
+ $scope.changeIndicatorWasClicked = true;
+
+ $scope.markAssociatedHierarchyElement(kommonitorDataExchangeService.selectedIndicator);
+
+ kommonitorDataExchangeService.selectedIndicatorBackup = kommonitorDataExchangeService.selectedIndicator;
+
+ $scope.setupDateSliderForIndicator();
+ $scope.setupDatePickerForIndicator();
+
+ if(!kommonitorDataExchangeService.selectedSpatialUnit || !kommonitorDataExchangeService.selectedIndicator.applicableSpatialUnits.some(o => o.spatialUnitName === kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel)){
+ kommonitorDataExchangeService.selectedSpatialUnit = $scope.getFirstSpatialUnitForSelectedIndicator();
+ }
+
+ try{
+ var selectedIndicator = await $scope.tryUpdateMeasureOfValueBarForIndicator();
+ }
+ catch(error){
+ console.error(error);
+ $scope.loadingData = false;
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ kommonitorDataExchangeService.displayMapApplicationError(error);
+ return;
+ }
+
+ $rootScope.$broadcast("DisableBalance");
+ $scope.modifyExports(true);
+
+ if(document.getElementById('controlNoDataDisplay').checked)
+ $rootScope.$broadcast('applyNoDataDisplay');
+
+ $scope.loadingData = false;
+
+ if(recenterMap){
+ $rootScope.$broadcast("recenterMapContent");
+ }
+
+ $rootScope.$broadcast("hideLoadingIconOnMap");
+ $scope.changeIndicatorWasClicked = false;
+
+ // $rootScope.$broadcast("updateDiagrams", kommonitorDataExchangeService.selectedIndicator, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, $scope.selectedDate);
+
+ $rootScope.$apply();
+
+
+ }
+ else{
+ if (kommonitorDataExchangeService.selectedIndicatorBackup){
+ kommonitorDataExchangeService.selectedIndicator = kommonitorDataExchangeService.selectedIndicatorBackup;
+ }
+ }
+
+ $rootScope.$broadcast("selectedIndicatorDateHasChanged");
+ }
+
+
+
+ $scope.modifyExports = function(changeIndicator){
+ kommonitorDataExchangeService.wmsUrlForSelectedIndicator = undefined;
+ kommonitorDataExchangeService.wmsUrlForSelectedIndicator = undefined;
+
+ var selectedSpatialUnitName = kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
+
+ for(const ogcServiceEntry of kommonitorDataExchangeService.selectedIndicator.ogcServices){
+ if (ogcServiceEntry.spatialUnit === selectedSpatialUnitName){
+ kommonitorDataExchangeService.wmsUrlForSelectedIndicator = ogcServiceEntry.wmsUrl;
+ kommonitorDataExchangeService.wfsUrlForSelectedIndicator = ogcServiceEntry.wfsUrl;
+ break;
+ }
+ };
+
+ $rootScope.$broadcast("updateBalanceSlider", kommonitorDataExchangeService.selectedDate);
+ $rootScope.$broadcast("updateIndicatorValueRangeFilter", kommonitorDataExchangeService.selectedDate, kommonitorDataExchangeService.selectedIndicator);
+ $scope.addSelectedIndicatorToMap(changeIndicator);
+
+ }
+
+ $scope.$on("updateIndicatorOgcServices", function (event, indicatorWmsUrl, indicatorWfsUrl) {
+
+ console.log('updateIndicatorOgcServices was called');
+
+ kommonitorDataExchangeService.wmsUrlForSelectedIndicator = indicatorWmsUrl;
+ kommonitorDataExchangeService.wfsUrlForSelectedIndicator = indicatorWfsUrl;
+ $scope.$digest();
+
+ });
+
+
+ } ]
+ });
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.module.js b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.module.js
index cf61d4599..059de2d3b 100644
--- a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.module.js
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.module.js
@@ -1 +1,3 @@
+"use strict";
angular.module('kommonitorDataSetup', ['kommonitorDataExchange', 'kommonitorMap', 'kommonitorShareHelper']);
+//# sourceMappingURL=kommonitor-data-setup.module.js.map
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.module.js.map b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.module.js.map
new file mode 100644
index 000000000..a846bb082
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.module.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"kommonitor-data-setup.module.js","sourceRoot":"","sources":["kommonitor-data-setup.module.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,MAAM,CAAC,qBAAqB,EAAE,CAAC,wBAAwB,EAAE,eAAe,EAAE,uBAAuB,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.module.ts b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.module.ts
new file mode 100644
index 000000000..cf61d4599
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDataSetup/kommonitor-data-setup.module.ts
@@ -0,0 +1 @@
+angular.module('kommonitorDataSetup', ['kommonitorDataExchange', 'kommonitorMap', 'kommonitorShareHelper']);
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.component.js b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.component.js
index 4c670a9a2..f35a8c56a 100644
--- a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.component.js
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.component.js
@@ -1,451 +1,363 @@
+"use strict";
angular
- .module('kommonitorDiagrams')
- .component(
- 'kommonitorDiagrams',
- {
- templateUrl: "components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.template.html",
- /*
- * injected with a modules service method that manages
- * enabled tabs
- */
- controller: [
- 'kommonitorDataExchangeService', 'kommonitorDiagramHelperService', 'kommonitorFilterHelperService',
- '$scope', '$rootScope', '__env',
- function kommonitorDiagramsController(kommonitorDataExchangeService, kommonitorDiagramHelperService, kommonitorFilterHelperService,
- $scope, $rootScope, __env) {
- this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
- this.kommonitorDiagramHelperServiceInstance = kommonitorDiagramHelperService;
- // initialize any adminLTE box widgets
- $('.box').boxWidget();
-
- $(window).on('resize', function () {
- if ($scope.histogramChart != null && $scope.histogramChart != undefined) {
- $scope.histogramChart.resize();
- }
-
- if ($scope.barChart != null && $scope.barChart != undefined) {
- $scope.barChart.resize();
- }
-
- if ($scope.lineChart != null && $scope.lineChart != undefined) {
- $scope.lineChart.resize();
- }
- });
-
- $scope.$on("resizeDiagrams", function (event) {
-
- setTimeout(function () {
- if ($scope.histogramChart != null && $scope.histogramChart != undefined) {
- $scope.histogramChart.resize();
- }
-
- if ($scope.barChart != null && $scope.barChart != undefined) {
- $scope.barChart.resize();
- }
-
- if ($scope.lineChart != null && $scope.lineChart != undefined) {
- $scope.lineChart.resize();
- }
- }, 350);
- });
-
- const INDICATOR_DATE_PREFIX = __env.indicatorDatePrefix;
- const defaultColorForHoveredFeatures = __env.defaultColorForHoveredFeatures;
- const defaultColorForClickedFeatures = __env.defaultColorForClickedFeatures;
-
- // $scope.userHoveresOverBarItem = false;
- $scope.eventsRegistered = false;
- $scope.isTooManyFeatures = false;
- $scope.histogramCanBeDisplayed = false;
- $scope.spatialUnitName;
- $scope.date;
- var numberOfDecimals = __env.numberOfDecimals;
- var defaultColorForZeroValues = __env.defaultColorForZeroValues;
- var defaultColorForNoDataValues = __env.defaultColorForNoDataValues;
- var defaultColorForFilteredValues = __env.defaultColorForFilteredValues;
-
- const defaultColorForOutliers_high = __env.defaultColorForOutliers_high;
- const defaultBorderColorForOutliers_high = __env.defaultBorderColorForOutliers_high;
- const defaultFillOpacityForOutliers_high = __env.defaultFillOpacityForOutliers_high;
- const defaultColorForOutliers_low = __env.defaultColorForOutliers_low;
- const defaultBorderColorForOutliers_low = __env.defaultBorderColorForOutliers_low;
- const defaultFillOpacityForOutliers_low = __env.defaultFillOpacityForOutliers_low;
-
- var compareFeaturesByIndicatorValue = function (featureA, featureB) {
- if (featureA.properties[$scope.indicatorPropertyName] < featureB.properties[$scope.indicatorPropertyName])
- return -1;
- if (featureA.properties[$scope.indicatorPropertyName] > featureB.properties[$scope.indicatorPropertyName])
- return 1;
- return 0;
- }
-
- var showLoadingIcons = function () {
-
- if ($scope.histogramChart)
- $scope.histogramChart.showLoading();
-
- if ($scope.barChart)
- $scope.barChart.showLoading();
-
- if ($scope.lineChart)
- $scope.lineChart.showLoading();
- };
-
- $scope.$on("updateDiagrams", function (event, indicatorMetadataAndGeoJSON, spatialUnitName, spatialUnitId, date, defaultBrew, gtMeasureOfValueBrew, ltMeasureOfValueBrew, dynamicIncreaseBrew, dynamicDecreaseBrew, isMeasureOfValueChecked, measureOfValue, justRestyling) {
-
- // console.log("Updating diagrams!");
-
- $scope.loadingData = true;
-
- showLoadingIcons();
-
- $scope.spatialUnitName = spatialUnitName;
- $scope.date = date;
-
- kommonitorDiagramHelperService.prepareAllDiagramResources_forCurrentMapIndicator(indicatorMetadataAndGeoJSON, spatialUnitName, date, defaultBrew, gtMeasureOfValueBrew, ltMeasureOfValueBrew, dynamicIncreaseBrew, dynamicDecreaseBrew, isMeasureOfValueChecked, measureOfValue, false);
-
- // updateHistogramChart();
-
- updateLineChart();
-
- updateBarChart();
- $scope.loadingData = false;
- });
-
- //HISTOGRAM CHART FUNCTION
- var updateHistogramChart = function () {
-
- $scope.histogramCanBeDisplayed = false;
-
- if (!$scope.histogramChart)
- $scope.histogramChart = echarts.init(document.getElementById('histogramDiagram'));
- else {
- // explicitly kill and reinstantiate histogram diagram to avoid zombie states on spatial unit change
- $scope.histogramChart.dispose();
- $scope.histogramChart = echarts.init(document.getElementById('histogramDiagram'));
- }
-
- $scope.histogramOption = kommonitorDiagramHelperService.getHistogramChartOptions();
-
- $scope.histogramChart.setOption($scope.histogramOption);
- $scope.histogramChart.hideLoading();
- $scope.histogramCanBeDisplayed = true;
- setTimeout(function () {
- $scope.histogramChart.resize();
- }, 350);
- };
-
- // BAR CHART FUNCTION
-
- var updateBarChart = function (indicatorMetadataAndGeoJSON, featureNamesArray, indicatorValueBarChartArray) {
- // based on prepared DOM, initialize echarts instance
- $scope.eventsRegistered = false;
-
- if (!$scope.barChart)
- $scope.barChart = echarts.init(document.getElementById('barDiagram'));
- else {
- // explicitly kill and reinstantiate bar diagram to avoid zombie states on spatial unit change
- $scope.barChart.dispose();
- $scope.barChart = echarts.init(document.getElementById('barDiagram'));
- }
-
- // use configuration item and data specified to show chart
- $scope.barOption = kommonitorDiagramHelperService.getBarChartOptions();
- $scope.barChart.setOption($scope.barOption);
-
- $scope.barChart.hideLoading();
-
- setTimeout(function () {
- $scope.barChart.resize();
- }, 350);
-
- registerEventsIfNecessary();
- };
-
- function registerEventsIfNecessary() {
- if (!$scope.eventsRegistered) {
- // when hovering over elements of the chart then highlight them in the map.
- $scope.barChart.on('mouseOver', function (params) {
- // $scope.userHoveresOverBarItem = true;
- var seriesIndex = params.seriesIndex;
- var dataIndex = params.dataIndex;
-
- // console.log("Series: " + seriesIndex + ", dataIndex: " + dataIndex);
- //
- // var barElement = $scope.barOption.series[seriesIndex].data[dataIndex];
- //
- // console.log(barElement);
-
- var spatialFeatureName = $scope.barOption.xAxis.data[dataIndex];
- if(spatialFeatureName){
- // console.log(spatialFeatureName);
- $rootScope.$broadcast("highlightFeatureOnMap", spatialFeatureName);
- }
-
- });
-
- $scope.barChart.on('mouseOut', function (params) {
- // $scope.userHoveresOverBarItem = false;
- var seriesIndex = params.seriesIndex;
- var dataIndex = params.dataIndex;
-
- // console.log("Series: " + seriesIndex + ", dataIndex: " + dataIndex);
- //
- // var barElement = $scope.barOption.series[seriesIndex].data[dataIndex];
- //
- // console.log(barElement);
-
- var spatialFeatureName = $scope.barOption.xAxis.data[dataIndex];
- // console.log(spatialFeatureName);
- if(spatialFeatureName){
- $rootScope.$broadcast("unhighlightFeatureOnMap", spatialFeatureName);
- }
-
- });
-
- $scope.barChart.on('click', function (params) {
- var seriesIndex = params.seriesIndex;
- var dataIndex = params.dataIndex;
-
- // console.log("Series: " + seriesIndex + ", dataIndex: " + dataIndex);
- //
- // var barElement = $scope.barOption.series[seriesIndex].data[dataIndex];
- //
- // console.log(barElement);
-
- var spatialFeatureName = $scope.barOption.xAxis.data[dataIndex];
- // console.log(spatialFeatureName);
- if(spatialFeatureName){
- $rootScope.$broadcast("switchHighlightFeatureOnMap", spatialFeatureName);
- }
-
- });
-
- $scope.eventsRegistered = true;
- }
- };
-
- // LINE CHART TIME SERIES FUNCTION
- var updateLineChart = function (indicatorMetadataAndGeoJSON, indicatorTimeSeriesDatesArray, indicatorTimeSeriesAverageArray) {
- // based on prepared DOM, initialize echarts instance
- if (!$scope.lineChart)
- $scope.lineChart = echarts.init(document.getElementById('lineDiagram'));
- else {
- // explicitly kill and reinstantiate line diagram to avoid zombie states on spatial unit change
- $scope.lineChart.dispose();
- $scope.lineChart = echarts.init(document.getElementById('lineDiagram'));
- }
-
- // use configuration item and data specified to show chart
- $scope.lineOption = kommonitorDiagramHelperService.getLineChartOptions();
- $scope.lineChart.setOption($scope.lineOption);
-
- $scope.lineChart.hideLoading();
- setTimeout(function () {
- $scope.lineChart.resize();
- }, 350);
- };
-
- $scope.$on("updateDiagramsForHoveredFeature", function (event, featureProperties) {
-
- if (!$scope.lineOption.legend.data.includes(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME])) {
- appendSeriesToLineChart(featureProperties);
- }
-
- highlightFeatureInBarChart(featureProperties);
- highlightFeatureInLineChart(featureProperties);
- });
-
- var appendSeriesToLineChart = function (featureProperties) {
-
- // in case of activated balance mode, we must use the properties of kommonitorDataExchangeService.selectedIndicator, to aquire the correct time series item!
- if (kommonitorDataExchangeService.isBalanceChecked) {
- featureProperties = findPropertiesForTimeSeries(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
- }
-
- // append feature name to legend
- $scope.lineOption.legend.data.push(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
-
- // create feature data series
- var featureSeries = {};
- featureSeries.name = featureProperties[__env.FEATURE_NAME_PROPERTY_NAME];
- featureSeries.type = 'line';
- featureSeries.data = new Array();
-
- // for each date create series data entry for feature
- for (var date of $scope.lineOption.xAxis.data) {
- var value;
- if (kommonitorDataExchangeService.indicatorValueIsNoData(featureProperties[INDICATOR_DATE_PREFIX + date])) {
- value = null;
- }
- else {
- value = kommonitorDataExchangeService.getIndicatorValue_asNumber(featureProperties[INDICATOR_DATE_PREFIX + date]);
- }
- featureSeries.data.push(value);
- }
-
- $scope.lineOption.series.push(featureSeries);
-
- $scope.lineChart.setOption($scope.lineOption);
- setTimeout(function () {
- $scope.lineChart.resize();
- }, 350);
- };
-
- var findPropertiesForTimeSeries = function (spatialUnitFeatureName) {
- for (var feature of kommonitorDataExchangeService.selectedIndicator.geoJSON.features) {
- if (feature.properties[__env.FEATURE_NAME_PROPERTY_NAME] == spatialUnitFeatureName) {
- return feature.properties;
- }
- }
- }
-
- var highlightFeatureInBarChart = function (featureProperties) {
- // highlight the corresponding bar diagram item
- // get index of bar item
-
- // if($scope.userHoveresOverBarItem){
- // return;
- // }
-
- var index = -1;
- for (var i = 0; i < $scope.barOption.xAxis.data.length; i++) {
- if ($scope.barOption.xAxis.data[i] === featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]) {
- index = i;
- break;
- }
- }
-
- if (index > -1) {
- $scope.barChart.dispatchAction({
- type: 'highlight',
- seriesIndex: 0,
- dataIndex: index
- });
- // tooltip
- $scope.barChart.dispatchAction({
- type: 'showTip',
- seriesIndex: 0,
- dataIndex: index
- });
- }
- };
-
- var highlightFeatureInLineChart = function (featureProperties) {
- // highlight the corresponding bar diagram item
- // get series index of series
- var seriesIndex = getSeriesIndexByFeatureName(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
-
- if (seriesIndex > -1) {
- $scope.lineChart.dispatchAction({
- type: 'highlight',
- seriesIndex: seriesIndex
- });
- }
- };
-
- $scope.$on("updateDiagramsForUnhoveredFeature", function (event, featureProperties) {
-
- if (!kommonitorFilterHelperService.featureIsCurrentlySelected(featureProperties[__env.FEATURE_ID_PROPERTY_NAME])) {
- unhighlightFeatureInLineChart(featureProperties);
-
- removeSeriesFromLineChart(featureProperties);
-
- unhighlightFeatureInBarChart(featureProperties);
- }
- });
-
- var getSeriesIndexByFeatureName = function (featureName) {
- for (var index = 0; index < $scope.lineOption.series.length; index++) {
- if ($scope.lineOption.series[index].name === featureName)
- return index;
- }
-
- //return -1 if none was found
- return -1;
- };
-
- var removeSeriesFromLineChart = function (featureProperties) {
- // remove feature from legend
- var legendIndex = $scope.lineOption.legend.data.indexOf(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
- if (legendIndex > -1) {
- $scope.lineOption.legend.data.splice(legendIndex, 1);
- }
-
- // remove feature data series
- var seriesIndex = getSeriesIndexByFeatureName(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
- if (seriesIndex > -1) {
- $scope.lineOption.series.splice(seriesIndex, 1);
- }
-
- // second parameter tells echarts to not merge options with previous data. hence really remove series from graphic
- $scope.lineChart.setOption($scope.lineOption, true);
- setTimeout(function () {
- $scope.lineChart.resize();
- }, 350);
- };
-
- var unhighlightFeatureInBarChart = function (featureProperties) {
- // highlight the corresponding bar diagram item
- // get index of bar item
- var index = -1;
- for (var i = 0; i < $scope.barOption.xAxis.data.length; i++) {
- if ($scope.barOption.xAxis.data[i] === featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]) {
- index = i;
- break;
- }
- }
-
- if (index > -1) {
- $scope.barChart.dispatchAction({
- type: 'downplay',
- seriesIndex: 0,
- dataIndex: index
- });
- // tooltip
- $scope.barChart.dispatchAction({
- type: 'hideTip',
- seriesIndex: 0,
- dataIndex: index
- });
- }
- };
-
- var unhighlightFeatureInLineChart = function (featureProperties) {
- // highlight the corresponding bar diagram item
- // get series index of series
- var seriesIndex = getSeriesIndexByFeatureName(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
-
- if (seriesIndex > -1) {
- $scope.lineChart.dispatchAction({
- type: 'downplay',
- seriesIndex: seriesIndex
- });
- }
- };
-
- $scope.$on("AppendExportButtonsForTable", function (event, tableId, tableExportName) {
-
- setTimeout(function () {
-
-
- // new TableExport(document.getElementsByTagName("table"), {
- new TableExport(document.getElementById(tableId), {
- headers: true, // (Boolean), display table headers (th or td elements) in the , (default: true)
- footers: true, // (Boolean), display table footers (th or td elements) in the , (default: false)
- formats: ['xlsx', 'csv', 'txt'], // (String[]), filetype(s) for the export, (default: ['xlsx', 'csv', 'txt'])
- filename: tableExportName, // (id, String), filename for the downloaded file, (default: 'id')
- bootstrap: true, // (Boolean), style buttons using bootstrap, (default: true)
- exportButtons: true, // (Boolean), automatically generate the built-in export buttons for each of the specified formats (default: true)
- position: 'top', // (top, bottom), position of the caption element relative to table, (default: 'bottom')
- ignoreRows: null, // (Number, Number[]), row indices to exclude from the exported file(s) (default: null)
- ignoreCols: null, // (Number, Number[]), column indices to exclude from the exported file(s) (default: null)
- trimWhitespace: true // (Boolean), remove all leading/trailing newlines, spaces, and tabs from cell text in the exported file(s) (default: false)
- });
- }, 50);
-
-
- });
-
- }]
- });
+ .module('kommonitorDiagrams')
+ .component('kommonitorDiagrams', {
+ templateUrl: "components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.template.html",
+ /*
+ * injected with a modules service method that manages
+ * enabled tabs
+ */
+ controller: [
+ 'kommonitorDataExchangeService', 'kommonitorDiagramHelperService', 'kommonitorFilterHelperService',
+ '$scope', '$rootScope', '__env',
+ function kommonitorDiagramsController(kommonitorDataExchangeService, kommonitorDiagramHelperService, kommonitorFilterHelperService, $scope, $rootScope, __env) {
+ this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
+ this.kommonitorDiagramHelperServiceInstance = kommonitorDiagramHelperService;
+ // initialize any adminLTE box widgets
+ $('.box').boxWidget();
+ $(window).on('resize', function () {
+ if ($scope.histogramChart != null && $scope.histogramChart != undefined) {
+ $scope.histogramChart.resize();
+ }
+ if ($scope.barChart != null && $scope.barChart != undefined) {
+ $scope.barChart.resize();
+ }
+ if ($scope.lineChart != null && $scope.lineChart != undefined) {
+ $scope.lineChart.resize();
+ }
+ });
+ $scope.$on("resizeDiagrams", function (event) {
+ setTimeout(function () {
+ if ($scope.histogramChart != null && $scope.histogramChart != undefined) {
+ $scope.histogramChart.resize();
+ }
+ if ($scope.barChart != null && $scope.barChart != undefined) {
+ $scope.barChart.resize();
+ }
+ if ($scope.lineChart != null && $scope.lineChart != undefined) {
+ $scope.lineChart.resize();
+ }
+ }, 350);
+ });
+ const INDICATOR_DATE_PREFIX = __env.indicatorDatePrefix;
+ const defaultColorForHoveredFeatures = __env.defaultColorForHoveredFeatures;
+ const defaultColorForClickedFeatures = __env.defaultColorForClickedFeatures;
+ // $scope.userHoveresOverBarItem = false;
+ $scope.eventsRegistered = false;
+ $scope.isTooManyFeatures = false;
+ $scope.histogramCanBeDisplayed = false;
+ $scope.spatialUnitName;
+ $scope.date;
+ var numberOfDecimals = __env.numberOfDecimals;
+ var defaultColorForZeroValues = __env.defaultColorForZeroValues;
+ var defaultColorForNoDataValues = __env.defaultColorForNoDataValues;
+ var defaultColorForFilteredValues = __env.defaultColorForFilteredValues;
+ const defaultColorForOutliers_high = __env.defaultColorForOutliers_high;
+ const defaultBorderColorForOutliers_high = __env.defaultBorderColorForOutliers_high;
+ const defaultFillOpacityForOutliers_high = __env.defaultFillOpacityForOutliers_high;
+ const defaultColorForOutliers_low = __env.defaultColorForOutliers_low;
+ const defaultBorderColorForOutliers_low = __env.defaultBorderColorForOutliers_low;
+ const defaultFillOpacityForOutliers_low = __env.defaultFillOpacityForOutliers_low;
+ var compareFeaturesByIndicatorValue = function (featureA, featureB) {
+ if (featureA.properties[$scope.indicatorPropertyName] < featureB.properties[$scope.indicatorPropertyName])
+ return -1;
+ if (featureA.properties[$scope.indicatorPropertyName] > featureB.properties[$scope.indicatorPropertyName])
+ return 1;
+ return 0;
+ };
+ var showLoadingIcons = function () {
+ if ($scope.histogramChart)
+ $scope.histogramChart.showLoading();
+ if ($scope.barChart)
+ $scope.barChart.showLoading();
+ if ($scope.lineChart)
+ $scope.lineChart.showLoading();
+ };
+ $scope.$on("updateDiagrams", function (event, indicatorMetadataAndGeoJSON, spatialUnitName, spatialUnitId, date, defaultBrew, gtMeasureOfValueBrew, ltMeasureOfValueBrew, dynamicIncreaseBrew, dynamicDecreaseBrew, isMeasureOfValueChecked, measureOfValue, justRestyling) {
+ // console.log("Updating diagrams!");
+ $scope.loadingData = true;
+ showLoadingIcons();
+ $scope.spatialUnitName = spatialUnitName;
+ $scope.date = date;
+ kommonitorDiagramHelperService.prepareAllDiagramResources_forCurrentMapIndicator(indicatorMetadataAndGeoJSON, spatialUnitName, date, defaultBrew, gtMeasureOfValueBrew, ltMeasureOfValueBrew, dynamicIncreaseBrew, dynamicDecreaseBrew, isMeasureOfValueChecked, measureOfValue, false);
+ // updateHistogramChart();
+ updateLineChart();
+ updateBarChart();
+ $scope.loadingData = false;
+ });
+ //HISTOGRAM CHART FUNCTION
+ var updateHistogramChart = function () {
+ $scope.histogramCanBeDisplayed = false;
+ if (!$scope.histogramChart)
+ $scope.histogramChart = echarts.init(document.getElementById('histogramDiagram'));
+ else {
+ // explicitly kill and reinstantiate histogram diagram to avoid zombie states on spatial unit change
+ $scope.histogramChart.dispose();
+ $scope.histogramChart = echarts.init(document.getElementById('histogramDiagram'));
+ }
+ $scope.histogramOption = kommonitorDiagramHelperService.getHistogramChartOptions();
+ $scope.histogramChart.setOption($scope.histogramOption);
+ $scope.histogramChart.hideLoading();
+ $scope.histogramCanBeDisplayed = true;
+ setTimeout(function () {
+ $scope.histogramChart.resize();
+ }, 350);
+ };
+ // BAR CHART FUNCTION
+ var updateBarChart = function (indicatorMetadataAndGeoJSON, featureNamesArray, indicatorValueBarChartArray) {
+ // based on prepared DOM, initialize echarts instance
+ $scope.eventsRegistered = false;
+ if (!$scope.barChart)
+ $scope.barChart = echarts.init(document.getElementById('barDiagram'));
+ else {
+ // explicitly kill and reinstantiate bar diagram to avoid zombie states on spatial unit change
+ $scope.barChart.dispose();
+ $scope.barChart = echarts.init(document.getElementById('barDiagram'));
+ }
+ // use configuration item and data specified to show chart
+ $scope.barOption = kommonitorDiagramHelperService.getBarChartOptions();
+ $scope.barChart.setOption($scope.barOption);
+ $scope.barChart.hideLoading();
+ setTimeout(function () {
+ $scope.barChart.resize();
+ }, 350);
+ registerEventsIfNecessary();
+ };
+ function registerEventsIfNecessary() {
+ if (!$scope.eventsRegistered) {
+ // when hovering over elements of the chart then highlight them in the map.
+ $scope.barChart.on('mouseOver', function (params) {
+ // $scope.userHoveresOverBarItem = true;
+ var seriesIndex = params.seriesIndex;
+ var dataIndex = params.dataIndex;
+ // console.log("Series: " + seriesIndex + ", dataIndex: " + dataIndex);
+ //
+ // var barElement = $scope.barOption.series[seriesIndex].data[dataIndex];
+ //
+ // console.log(barElement);
+ var spatialFeatureName = $scope.barOption.xAxis.data[dataIndex];
+ if (spatialFeatureName) {
+ // console.log(spatialFeatureName);
+ $rootScope.$broadcast("highlightFeatureOnMap", spatialFeatureName);
+ }
+ });
+ $scope.barChart.on('mouseOut', function (params) {
+ // $scope.userHoveresOverBarItem = false;
+ var seriesIndex = params.seriesIndex;
+ var dataIndex = params.dataIndex;
+ // console.log("Series: " + seriesIndex + ", dataIndex: " + dataIndex);
+ //
+ // var barElement = $scope.barOption.series[seriesIndex].data[dataIndex];
+ //
+ // console.log(barElement);
+ var spatialFeatureName = $scope.barOption.xAxis.data[dataIndex];
+ // console.log(spatialFeatureName);
+ if (spatialFeatureName) {
+ $rootScope.$broadcast("unhighlightFeatureOnMap", spatialFeatureName);
+ }
+ });
+ $scope.barChart.on('click', function (params) {
+ var seriesIndex = params.seriesIndex;
+ var dataIndex = params.dataIndex;
+ // console.log("Series: " + seriesIndex + ", dataIndex: " + dataIndex);
+ //
+ // var barElement = $scope.barOption.series[seriesIndex].data[dataIndex];
+ //
+ // console.log(barElement);
+ var spatialFeatureName = $scope.barOption.xAxis.data[dataIndex];
+ // console.log(spatialFeatureName);
+ if (spatialFeatureName) {
+ $rootScope.$broadcast("switchHighlightFeatureOnMap", spatialFeatureName);
+ }
+ });
+ $scope.eventsRegistered = true;
+ }
+ }
+ ;
+ // LINE CHART TIME SERIES FUNCTION
+ var updateLineChart = function (indicatorMetadataAndGeoJSON, indicatorTimeSeriesDatesArray, indicatorTimeSeriesAverageArray) {
+ // based on prepared DOM, initialize echarts instance
+ if (!$scope.lineChart)
+ $scope.lineChart = echarts.init(document.getElementById('lineDiagram'));
+ else {
+ // explicitly kill and reinstantiate line diagram to avoid zombie states on spatial unit change
+ $scope.lineChart.dispose();
+ $scope.lineChart = echarts.init(document.getElementById('lineDiagram'));
+ }
+ // use configuration item and data specified to show chart
+ $scope.lineOption = kommonitorDiagramHelperService.getLineChartOptions();
+ $scope.lineChart.setOption($scope.lineOption);
+ $scope.lineChart.hideLoading();
+ setTimeout(function () {
+ $scope.lineChart.resize();
+ }, 350);
+ };
+ $scope.$on("updateDiagramsForHoveredFeature", function (event, featureProperties) {
+ if (!$scope.lineOption.legend.data.includes(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME])) {
+ appendSeriesToLineChart(featureProperties);
+ }
+ highlightFeatureInBarChart(featureProperties);
+ highlightFeatureInLineChart(featureProperties);
+ });
+ var appendSeriesToLineChart = function (featureProperties) {
+ // in case of activated balance mode, we must use the properties of kommonitorDataExchangeService.selectedIndicator, to aquire the correct time series item!
+ if (kommonitorDataExchangeService.isBalanceChecked) {
+ featureProperties = findPropertiesForTimeSeries(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
+ }
+ // append feature name to legend
+ $scope.lineOption.legend.data.push(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
+ // create feature data series
+ var featureSeries = {};
+ featureSeries.name = featureProperties[__env.FEATURE_NAME_PROPERTY_NAME];
+ featureSeries.type = 'line';
+ featureSeries.data = new Array();
+ // for each date create series data entry for feature
+ for (var date of $scope.lineOption.xAxis.data) {
+ var value;
+ if (kommonitorDataExchangeService.indicatorValueIsNoData(featureProperties[INDICATOR_DATE_PREFIX + date])) {
+ value = null;
+ }
+ else {
+ value = kommonitorDataExchangeService.getIndicatorValue_asNumber(featureProperties[INDICATOR_DATE_PREFIX + date]);
+ }
+ featureSeries.data.push(value);
+ }
+ $scope.lineOption.series.push(featureSeries);
+ $scope.lineChart.setOption($scope.lineOption);
+ setTimeout(function () {
+ $scope.lineChart.resize();
+ }, 350);
+ };
+ var findPropertiesForTimeSeries = function (spatialUnitFeatureName) {
+ for (var feature of kommonitorDataExchangeService.selectedIndicator.geoJSON.features) {
+ if (feature.properties[__env.FEATURE_NAME_PROPERTY_NAME] == spatialUnitFeatureName) {
+ return feature.properties;
+ }
+ }
+ };
+ var highlightFeatureInBarChart = function (featureProperties) {
+ // highlight the corresponding bar diagram item
+ // get index of bar item
+ // if($scope.userHoveresOverBarItem){
+ // return;
+ // }
+ var index = -1;
+ for (var i = 0; i < $scope.barOption.xAxis.data.length; i++) {
+ if ($scope.barOption.xAxis.data[i] === featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]) {
+ index = i;
+ break;
+ }
+ }
+ if (index > -1) {
+ $scope.barChart.dispatchAction({
+ type: 'highlight',
+ seriesIndex: 0,
+ dataIndex: index
+ });
+ // tooltip
+ $scope.barChart.dispatchAction({
+ type: 'showTip',
+ seriesIndex: 0,
+ dataIndex: index
+ });
+ }
+ };
+ var highlightFeatureInLineChart = function (featureProperties) {
+ // highlight the corresponding bar diagram item
+ // get series index of series
+ var seriesIndex = getSeriesIndexByFeatureName(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
+ if (seriesIndex > -1) {
+ $scope.lineChart.dispatchAction({
+ type: 'highlight',
+ seriesIndex: seriesIndex
+ });
+ }
+ };
+ $scope.$on("updateDiagramsForUnhoveredFeature", function (event, featureProperties) {
+ if (!kommonitorFilterHelperService.featureIsCurrentlySelected(featureProperties[__env.FEATURE_ID_PROPERTY_NAME])) {
+ unhighlightFeatureInLineChart(featureProperties);
+ removeSeriesFromLineChart(featureProperties);
+ unhighlightFeatureInBarChart(featureProperties);
+ }
+ });
+ var getSeriesIndexByFeatureName = function (featureName) {
+ for (var index = 0; index < $scope.lineOption.series.length; index++) {
+ if ($scope.lineOption.series[index].name === featureName)
+ return index;
+ }
+ //return -1 if none was found
+ return -1;
+ };
+ var removeSeriesFromLineChart = function (featureProperties) {
+ // remove feature from legend
+ var legendIndex = $scope.lineOption.legend.data.indexOf(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
+ if (legendIndex > -1) {
+ $scope.lineOption.legend.data.splice(legendIndex, 1);
+ }
+ // remove feature data series
+ var seriesIndex = getSeriesIndexByFeatureName(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
+ if (seriesIndex > -1) {
+ $scope.lineOption.series.splice(seriesIndex, 1);
+ }
+ // second parameter tells echarts to not merge options with previous data. hence really remove series from graphic
+ $scope.lineChart.setOption($scope.lineOption, true);
+ setTimeout(function () {
+ $scope.lineChart.resize();
+ }, 350);
+ };
+ var unhighlightFeatureInBarChart = function (featureProperties) {
+ // highlight the corresponding bar diagram item
+ // get index of bar item
+ var index = -1;
+ for (var i = 0; i < $scope.barOption.xAxis.data.length; i++) {
+ if ($scope.barOption.xAxis.data[i] === featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]) {
+ index = i;
+ break;
+ }
+ }
+ if (index > -1) {
+ $scope.barChart.dispatchAction({
+ type: 'downplay',
+ seriesIndex: 0,
+ dataIndex: index
+ });
+ // tooltip
+ $scope.barChart.dispatchAction({
+ type: 'hideTip',
+ seriesIndex: 0,
+ dataIndex: index
+ });
+ }
+ };
+ var unhighlightFeatureInLineChart = function (featureProperties) {
+ // highlight the corresponding bar diagram item
+ // get series index of series
+ var seriesIndex = getSeriesIndexByFeatureName(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
+ if (seriesIndex > -1) {
+ $scope.lineChart.dispatchAction({
+ type: 'downplay',
+ seriesIndex: seriesIndex
+ });
+ }
+ };
+ $scope.$on("AppendExportButtonsForTable", function (event, tableId, tableExportName) {
+ setTimeout(function () {
+ // new TableExport(document.getElementsByTagName("table"), {
+ new TableExport(document.getElementById(tableId), {
+ headers: true,
+ footers: true,
+ formats: ['xlsx', 'csv', 'txt'],
+ filename: tableExportName,
+ bootstrap: true,
+ exportButtons: true,
+ position: 'top',
+ ignoreRows: null,
+ ignoreCols: null,
+ trimWhitespace: true // (Boolean), remove all leading/trailing newlines, spaces, and tabs from cell text in the exported file(s) (default: false)
+ });
+ }, 50);
+ });
+ }
+ ]
+});
+//# sourceMappingURL=kommonitor-diagrams.component.js.map
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.component.js.map b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.component.js.map
new file mode 100644
index 000000000..d2ba2e0f5
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"kommonitor-diagrams.component.js","sourceRoot":"","sources":["kommonitor-diagrams.component.ts"],"names":[],"mappings":";AAAA,OAAO;KACL,MAAM,CAAC,oBAAoB,CAAC;KAC5B,SAAS,CACT,oBAAoB,EACpB;IACC,WAAW,EAAE,4GAA4G;IACzH;;;OAGG;IACH,UAAU,EAAE;QACX,+BAA+B,EAAE,gCAAgC,EAAE,+BAA+B;QAClG,QAAQ,EAAE,YAAY,EAAE,OAAO;QAC/B,SAAS,4BAA4B,CAAC,6BAA6B,EAAE,8BAA8B,EAAE,6BAA6B,EACjI,MAAM,EAAE,UAAU,EAAE,KAAK;YACzB,IAAI,CAAC,qCAAqC,GAAG,6BAA6B,CAAC;YAC3E,IAAI,CAAC,sCAAsC,GAAG,8BAA8B,CAAC;YAC7E,sCAAsC;YACtC,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,CAAC;YAEtB,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,QAAQ,EAAE;gBACtB,IAAI,MAAM,CAAC,cAAc,IAAI,IAAI,IAAI,MAAM,CAAC,cAAc,IAAI,SAAS,EAAE;oBACxE,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,CAAC;iBAC/B;gBAED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itorDiagrams/kommonitor-diagrams.component.ts b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.component.ts
new file mode 100644
index 000000000..4c670a9a2
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.component.ts
@@ -0,0 +1,451 @@
+angular
+ .module('kommonitorDiagrams')
+ .component(
+ 'kommonitorDiagrams',
+ {
+ templateUrl: "components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.template.html",
+ /*
+ * injected with a modules service method that manages
+ * enabled tabs
+ */
+ controller: [
+ 'kommonitorDataExchangeService', 'kommonitorDiagramHelperService', 'kommonitorFilterHelperService',
+ '$scope', '$rootScope', '__env',
+ function kommonitorDiagramsController(kommonitorDataExchangeService, kommonitorDiagramHelperService, kommonitorFilterHelperService,
+ $scope, $rootScope, __env) {
+ this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
+ this.kommonitorDiagramHelperServiceInstance = kommonitorDiagramHelperService;
+ // initialize any adminLTE box widgets
+ $('.box').boxWidget();
+
+ $(window).on('resize', function () {
+ if ($scope.histogramChart != null && $scope.histogramChart != undefined) {
+ $scope.histogramChart.resize();
+ }
+
+ if ($scope.barChart != null && $scope.barChart != undefined) {
+ $scope.barChart.resize();
+ }
+
+ if ($scope.lineChart != null && $scope.lineChart != undefined) {
+ $scope.lineChart.resize();
+ }
+ });
+
+ $scope.$on("resizeDiagrams", function (event) {
+
+ setTimeout(function () {
+ if ($scope.histogramChart != null && $scope.histogramChart != undefined) {
+ $scope.histogramChart.resize();
+ }
+
+ if ($scope.barChart != null && $scope.barChart != undefined) {
+ $scope.barChart.resize();
+ }
+
+ if ($scope.lineChart != null && $scope.lineChart != undefined) {
+ $scope.lineChart.resize();
+ }
+ }, 350);
+ });
+
+ const INDICATOR_DATE_PREFIX = __env.indicatorDatePrefix;
+ const defaultColorForHoveredFeatures = __env.defaultColorForHoveredFeatures;
+ const defaultColorForClickedFeatures = __env.defaultColorForClickedFeatures;
+
+ // $scope.userHoveresOverBarItem = false;
+ $scope.eventsRegistered = false;
+ $scope.isTooManyFeatures = false;
+ $scope.histogramCanBeDisplayed = false;
+ $scope.spatialUnitName;
+ $scope.date;
+ var numberOfDecimals = __env.numberOfDecimals;
+ var defaultColorForZeroValues = __env.defaultColorForZeroValues;
+ var defaultColorForNoDataValues = __env.defaultColorForNoDataValues;
+ var defaultColorForFilteredValues = __env.defaultColorForFilteredValues;
+
+ const defaultColorForOutliers_high = __env.defaultColorForOutliers_high;
+ const defaultBorderColorForOutliers_high = __env.defaultBorderColorForOutliers_high;
+ const defaultFillOpacityForOutliers_high = __env.defaultFillOpacityForOutliers_high;
+ const defaultColorForOutliers_low = __env.defaultColorForOutliers_low;
+ const defaultBorderColorForOutliers_low = __env.defaultBorderColorForOutliers_low;
+ const defaultFillOpacityForOutliers_low = __env.defaultFillOpacityForOutliers_low;
+
+ var compareFeaturesByIndicatorValue = function (featureA, featureB) {
+ if (featureA.properties[$scope.indicatorPropertyName] < featureB.properties[$scope.indicatorPropertyName])
+ return -1;
+ if (featureA.properties[$scope.indicatorPropertyName] > featureB.properties[$scope.indicatorPropertyName])
+ return 1;
+ return 0;
+ }
+
+ var showLoadingIcons = function () {
+
+ if ($scope.histogramChart)
+ $scope.histogramChart.showLoading();
+
+ if ($scope.barChart)
+ $scope.barChart.showLoading();
+
+ if ($scope.lineChart)
+ $scope.lineChart.showLoading();
+ };
+
+ $scope.$on("updateDiagrams", function (event, indicatorMetadataAndGeoJSON, spatialUnitName, spatialUnitId, date, defaultBrew, gtMeasureOfValueBrew, ltMeasureOfValueBrew, dynamicIncreaseBrew, dynamicDecreaseBrew, isMeasureOfValueChecked, measureOfValue, justRestyling) {
+
+ // console.log("Updating diagrams!");
+
+ $scope.loadingData = true;
+
+ showLoadingIcons();
+
+ $scope.spatialUnitName = spatialUnitName;
+ $scope.date = date;
+
+ kommonitorDiagramHelperService.prepareAllDiagramResources_forCurrentMapIndicator(indicatorMetadataAndGeoJSON, spatialUnitName, date, defaultBrew, gtMeasureOfValueBrew, ltMeasureOfValueBrew, dynamicIncreaseBrew, dynamicDecreaseBrew, isMeasureOfValueChecked, measureOfValue, false);
+
+ // updateHistogramChart();
+
+ updateLineChart();
+
+ updateBarChart();
+ $scope.loadingData = false;
+ });
+
+ //HISTOGRAM CHART FUNCTION
+ var updateHistogramChart = function () {
+
+ $scope.histogramCanBeDisplayed = false;
+
+ if (!$scope.histogramChart)
+ $scope.histogramChart = echarts.init(document.getElementById('histogramDiagram'));
+ else {
+ // explicitly kill and reinstantiate histogram diagram to avoid zombie states on spatial unit change
+ $scope.histogramChart.dispose();
+ $scope.histogramChart = echarts.init(document.getElementById('histogramDiagram'));
+ }
+
+ $scope.histogramOption = kommonitorDiagramHelperService.getHistogramChartOptions();
+
+ $scope.histogramChart.setOption($scope.histogramOption);
+ $scope.histogramChart.hideLoading();
+ $scope.histogramCanBeDisplayed = true;
+ setTimeout(function () {
+ $scope.histogramChart.resize();
+ }, 350);
+ };
+
+ // BAR CHART FUNCTION
+
+ var updateBarChart = function (indicatorMetadataAndGeoJSON, featureNamesArray, indicatorValueBarChartArray) {
+ // based on prepared DOM, initialize echarts instance
+ $scope.eventsRegistered = false;
+
+ if (!$scope.barChart)
+ $scope.barChart = echarts.init(document.getElementById('barDiagram'));
+ else {
+ // explicitly kill and reinstantiate bar diagram to avoid zombie states on spatial unit change
+ $scope.barChart.dispose();
+ $scope.barChart = echarts.init(document.getElementById('barDiagram'));
+ }
+
+ // use configuration item and data specified to show chart
+ $scope.barOption = kommonitorDiagramHelperService.getBarChartOptions();
+ $scope.barChart.setOption($scope.barOption);
+
+ $scope.barChart.hideLoading();
+
+ setTimeout(function () {
+ $scope.barChart.resize();
+ }, 350);
+
+ registerEventsIfNecessary();
+ };
+
+ function registerEventsIfNecessary() {
+ if (!$scope.eventsRegistered) {
+ // when hovering over elements of the chart then highlight them in the map.
+ $scope.barChart.on('mouseOver', function (params) {
+ // $scope.userHoveresOverBarItem = true;
+ var seriesIndex = params.seriesIndex;
+ var dataIndex = params.dataIndex;
+
+ // console.log("Series: " + seriesIndex + ", dataIndex: " + dataIndex);
+ //
+ // var barElement = $scope.barOption.series[seriesIndex].data[dataIndex];
+ //
+ // console.log(barElement);
+
+ var spatialFeatureName = $scope.barOption.xAxis.data[dataIndex];
+ if(spatialFeatureName){
+ // console.log(spatialFeatureName);
+ $rootScope.$broadcast("highlightFeatureOnMap", spatialFeatureName);
+ }
+
+ });
+
+ $scope.barChart.on('mouseOut', function (params) {
+ // $scope.userHoveresOverBarItem = false;
+ var seriesIndex = params.seriesIndex;
+ var dataIndex = params.dataIndex;
+
+ // console.log("Series: " + seriesIndex + ", dataIndex: " + dataIndex);
+ //
+ // var barElement = $scope.barOption.series[seriesIndex].data[dataIndex];
+ //
+ // console.log(barElement);
+
+ var spatialFeatureName = $scope.barOption.xAxis.data[dataIndex];
+ // console.log(spatialFeatureName);
+ if(spatialFeatureName){
+ $rootScope.$broadcast("unhighlightFeatureOnMap", spatialFeatureName);
+ }
+
+ });
+
+ $scope.barChart.on('click', function (params) {
+ var seriesIndex = params.seriesIndex;
+ var dataIndex = params.dataIndex;
+
+ // console.log("Series: " + seriesIndex + ", dataIndex: " + dataIndex);
+ //
+ // var barElement = $scope.barOption.series[seriesIndex].data[dataIndex];
+ //
+ // console.log(barElement);
+
+ var spatialFeatureName = $scope.barOption.xAxis.data[dataIndex];
+ // console.log(spatialFeatureName);
+ if(spatialFeatureName){
+ $rootScope.$broadcast("switchHighlightFeatureOnMap", spatialFeatureName);
+ }
+
+ });
+
+ $scope.eventsRegistered = true;
+ }
+ };
+
+ // LINE CHART TIME SERIES FUNCTION
+ var updateLineChart = function (indicatorMetadataAndGeoJSON, indicatorTimeSeriesDatesArray, indicatorTimeSeriesAverageArray) {
+ // based on prepared DOM, initialize echarts instance
+ if (!$scope.lineChart)
+ $scope.lineChart = echarts.init(document.getElementById('lineDiagram'));
+ else {
+ // explicitly kill and reinstantiate line diagram to avoid zombie states on spatial unit change
+ $scope.lineChart.dispose();
+ $scope.lineChart = echarts.init(document.getElementById('lineDiagram'));
+ }
+
+ // use configuration item and data specified to show chart
+ $scope.lineOption = kommonitorDiagramHelperService.getLineChartOptions();
+ $scope.lineChart.setOption($scope.lineOption);
+
+ $scope.lineChart.hideLoading();
+ setTimeout(function () {
+ $scope.lineChart.resize();
+ }, 350);
+ };
+
+ $scope.$on("updateDiagramsForHoveredFeature", function (event, featureProperties) {
+
+ if (!$scope.lineOption.legend.data.includes(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME])) {
+ appendSeriesToLineChart(featureProperties);
+ }
+
+ highlightFeatureInBarChart(featureProperties);
+ highlightFeatureInLineChart(featureProperties);
+ });
+
+ var appendSeriesToLineChart = function (featureProperties) {
+
+ // in case of activated balance mode, we must use the properties of kommonitorDataExchangeService.selectedIndicator, to aquire the correct time series item!
+ if (kommonitorDataExchangeService.isBalanceChecked) {
+ featureProperties = findPropertiesForTimeSeries(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
+ }
+
+ // append feature name to legend
+ $scope.lineOption.legend.data.push(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
+
+ // create feature data series
+ var featureSeries = {};
+ featureSeries.name = featureProperties[__env.FEATURE_NAME_PROPERTY_NAME];
+ featureSeries.type = 'line';
+ featureSeries.data = new Array();
+
+ // for each date create series data entry for feature
+ for (var date of $scope.lineOption.xAxis.data) {
+ var value;
+ if (kommonitorDataExchangeService.indicatorValueIsNoData(featureProperties[INDICATOR_DATE_PREFIX + date])) {
+ value = null;
+ }
+ else {
+ value = kommonitorDataExchangeService.getIndicatorValue_asNumber(featureProperties[INDICATOR_DATE_PREFIX + date]);
+ }
+ featureSeries.data.push(value);
+ }
+
+ $scope.lineOption.series.push(featureSeries);
+
+ $scope.lineChart.setOption($scope.lineOption);
+ setTimeout(function () {
+ $scope.lineChart.resize();
+ }, 350);
+ };
+
+ var findPropertiesForTimeSeries = function (spatialUnitFeatureName) {
+ for (var feature of kommonitorDataExchangeService.selectedIndicator.geoJSON.features) {
+ if (feature.properties[__env.FEATURE_NAME_PROPERTY_NAME] == spatialUnitFeatureName) {
+ return feature.properties;
+ }
+ }
+ }
+
+ var highlightFeatureInBarChart = function (featureProperties) {
+ // highlight the corresponding bar diagram item
+ // get index of bar item
+
+ // if($scope.userHoveresOverBarItem){
+ // return;
+ // }
+
+ var index = -1;
+ for (var i = 0; i < $scope.barOption.xAxis.data.length; i++) {
+ if ($scope.barOption.xAxis.data[i] === featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]) {
+ index = i;
+ break;
+ }
+ }
+
+ if (index > -1) {
+ $scope.barChart.dispatchAction({
+ type: 'highlight',
+ seriesIndex: 0,
+ dataIndex: index
+ });
+ // tooltip
+ $scope.barChart.dispatchAction({
+ type: 'showTip',
+ seriesIndex: 0,
+ dataIndex: index
+ });
+ }
+ };
+
+ var highlightFeatureInLineChart = function (featureProperties) {
+ // highlight the corresponding bar diagram item
+ // get series index of series
+ var seriesIndex = getSeriesIndexByFeatureName(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
+
+ if (seriesIndex > -1) {
+ $scope.lineChart.dispatchAction({
+ type: 'highlight',
+ seriesIndex: seriesIndex
+ });
+ }
+ };
+
+ $scope.$on("updateDiagramsForUnhoveredFeature", function (event, featureProperties) {
+
+ if (!kommonitorFilterHelperService.featureIsCurrentlySelected(featureProperties[__env.FEATURE_ID_PROPERTY_NAME])) {
+ unhighlightFeatureInLineChart(featureProperties);
+
+ removeSeriesFromLineChart(featureProperties);
+
+ unhighlightFeatureInBarChart(featureProperties);
+ }
+ });
+
+ var getSeriesIndexByFeatureName = function (featureName) {
+ for (var index = 0; index < $scope.lineOption.series.length; index++) {
+ if ($scope.lineOption.series[index].name === featureName)
+ return index;
+ }
+
+ //return -1 if none was found
+ return -1;
+ };
+
+ var removeSeriesFromLineChart = function (featureProperties) {
+ // remove feature from legend
+ var legendIndex = $scope.lineOption.legend.data.indexOf(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
+ if (legendIndex > -1) {
+ $scope.lineOption.legend.data.splice(legendIndex, 1);
+ }
+
+ // remove feature data series
+ var seriesIndex = getSeriesIndexByFeatureName(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
+ if (seriesIndex > -1) {
+ $scope.lineOption.series.splice(seriesIndex, 1);
+ }
+
+ // second parameter tells echarts to not merge options with previous data. hence really remove series from graphic
+ $scope.lineChart.setOption($scope.lineOption, true);
+ setTimeout(function () {
+ $scope.lineChart.resize();
+ }, 350);
+ };
+
+ var unhighlightFeatureInBarChart = function (featureProperties) {
+ // highlight the corresponding bar diagram item
+ // get index of bar item
+ var index = -1;
+ for (var i = 0; i < $scope.barOption.xAxis.data.length; i++) {
+ if ($scope.barOption.xAxis.data[i] === featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]) {
+ index = i;
+ break;
+ }
+ }
+
+ if (index > -1) {
+ $scope.barChart.dispatchAction({
+ type: 'downplay',
+ seriesIndex: 0,
+ dataIndex: index
+ });
+ // tooltip
+ $scope.barChart.dispatchAction({
+ type: 'hideTip',
+ seriesIndex: 0,
+ dataIndex: index
+ });
+ }
+ };
+
+ var unhighlightFeatureInLineChart = function (featureProperties) {
+ // highlight the corresponding bar diagram item
+ // get series index of series
+ var seriesIndex = getSeriesIndexByFeatureName(featureProperties[__env.FEATURE_NAME_PROPERTY_NAME]);
+
+ if (seriesIndex > -1) {
+ $scope.lineChart.dispatchAction({
+ type: 'downplay',
+ seriesIndex: seriesIndex
+ });
+ }
+ };
+
+ $scope.$on("AppendExportButtonsForTable", function (event, tableId, tableExportName) {
+
+ setTimeout(function () {
+
+
+ // new TableExport(document.getElementsByTagName("table"), {
+ new TableExport(document.getElementById(tableId), {
+ headers: true, // (Boolean), display table headers (th or td elements) in the , (default: true)
+ footers: true, // (Boolean), display table footers (th or td elements) in the , (default: false)
+ formats: ['xlsx', 'csv', 'txt'], // (String[]), filetype(s) for the export, (default: ['xlsx', 'csv', 'txt'])
+ filename: tableExportName, // (id, String), filename for the downloaded file, (default: 'id')
+ bootstrap: true, // (Boolean), style buttons using bootstrap, (default: true)
+ exportButtons: true, // (Boolean), automatically generate the built-in export buttons for each of the specified formats (default: true)
+ position: 'top', // (top, bottom), position of the caption element relative to table, (default: 'bottom')
+ ignoreRows: null, // (Number, Number[]), row indices to exclude from the exported file(s) (default: null)
+ ignoreCols: null, // (Number, Number[]), column indices to exclude from the exported file(s) (default: null)
+ trimWhitespace: true // (Boolean), remove all leading/trailing newlines, spaces, and tabs from cell text in the exported file(s) (default: false)
+ });
+ }, 50);
+
+
+ });
+
+ }]
+ });
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.module.js b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.module.js
index e2e076e1c..b909c5448 100644
--- a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.module.js
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.module.js
@@ -1 +1,3 @@
-angular.module('kommonitorDiagrams', [ 'kommonitorDataExchange', 'kommonitorDiagramHelper']);
+"use strict";
+angular.module('kommonitorDiagrams', ['kommonitorDataExchange', 'kommonitorDiagramHelper']);
+//# sourceMappingURL=kommonitor-diagrams.module.js.map
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.module.js.map b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.module.js.map
new file mode 100644
index 000000000..a940e2e05
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.module.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"kommonitor-diagrams.module.js","sourceRoot":"","sources":["kommonitor-diagrams.module.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,CAAE,wBAAwB,EAAE,yBAAyB,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.module.ts b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.module.ts
new file mode 100644
index 000000000..e2e076e1c
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorDiagrams/kommonitor-diagrams.module.ts
@@ -0,0 +1 @@
+angular.module('kommonitorDiagrams', [ 'kommonitorDataExchange', 'kommonitorDiagramHelper']);
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.component.js b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.component.js
index 39a8ea4fb..5ae890376 100644
--- a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.component.js
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.component.js
@@ -1,580 +1,460 @@
+"use strict";
angular
- .module('kommonitorFilter')
- .component(
- 'kommonitorFilter',
- {
- templateUrl : "components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.template.html",
- /*
- * injected with a modules service method that manages
- * enabled tabs
- */
- controller : ['$scope', '$rootScope', 'kommonitorMapService', 'kommonitorDataExchangeService', 'kommonitorFilterHelperService',
- '__env', '$http', function kommonitorFilterController($scope, $rootScope, kommonitorMapService, kommonitorDataExchangeService,
- kommonitorFilterHelperService, __env, $http) {
-
- const INDICATOR_DATE_PREFIX = __env.indicatorDatePrefix;
- this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
- this.kommonitorMapServiceInstance = kommonitorMapService;
- this.kommonitorFilterHelperServiceInstance = kommonitorFilterHelperService;
- var numberOfDecimals = __env.numberOfDecimals;
- // initialize any adminLTE box widgets
- $('.box').boxWidget();
-
- $scope.considerAllowedSpatialUnitsOfCurrentIndicator = true;
- $scope.loadingData = false;
-
- $scope.rangeSliderForFilter;
- $scope.valueRangeMinValue;
- $scope.valueRangeMaxValue;
- $scope.currentLowerFilterValue;
- $scope.currentHigherFilterValue;
- $scope.lowerFilterInputNotValid = false;
- $scope.higherFilterInputNotValid = false;
- $scope.indicatorMetadataAndGeoJSON;
-
- //measureOfValue stuff
- $scope.movMinValue;
- $scope.movMaxValue;
- $scope.movMiddleValue;
- $scope.movStep;
- $scope.movRangeSlider;
-
- // SPATIAL FILTER STUFF
- $scope.selectedSpatialUnitForFilter;
- $scope.higherSpatialUnits = undefined;
- $scope.higherSpatialUnitFilterFeatureGeoJSON;
- $scope.reappliedFilter = false;
-
- $scope.selectionByFeatureSpatialFilterDuallistOptions = {
- title: {label: 'Gebiete', helpMessage: 'help'},
- selectOptions: {initialText: "Gebiete"},
- items: [],
- button: {leftText: "Alle auswählen" , rightText: "Alle entfernen"},
- selectedItems: []
- };
-
- $scope.manualSelectionSpatialFilterDuallistOptions = {
- title: {label: 'Gebiete', helpMessage: 'help'},
- selectOptions: {initialText: "Gebiete"},
- items: [],
- button: {leftText: "Alle auswählen" , rightText: "Alle entfernen"},
- selectedItems: []
- };
-
-
- $scope.setupSpatialUnitFilter = function(indicatorMetadataAndGeoJSON, spatialUnitName, date){
-
- $scope.loadingData = true;
-
- let allowedSpatialUnitIds = indicatorMetadataAndGeoJSON.applicableSpatialUnits.map(spatialUnitEntry => {
- return spatialUnitEntry.spatialUnitId;
- });
-
- $scope.higherSpatialUnits = JSON.parse(JSON.stringify(kommonitorDataExchangeService.availableSpatialUnits));
-
- // only show those spatial units that are actually visible according to keycloak role
- // and associated to the current indicator as well
- for (let index = 0; index < $scope.higherSpatialUnits.length; index++) {
- const spatialUnitMetadata = $scope.higherSpatialUnits[index];
-
- // remove if it is not applicable for current indicator OR
- // remove if it is the currently displayed spatial unit to show only hierarchically higher spatial units
- if($scope.considerAllowedSpatialUnitsOfCurrentIndicator && ! allowedSpatialUnitIds.includes(spatialUnitMetadata.spatialUnitId)){
-
- // only remove the current element
- // which represents a spatial unit that is
- // not supported by the current indicator
- $scope.higherSpatialUnits.splice(index, 1);
- }
-
- // since we query through a hierarchically sorted array of ALL spatial units
- // we have to stop when we identify the currently displayed spatial unit
- // in that case we have to remove that from the list of upper
- if (spatialUnitName == spatialUnitMetadata.spatialUnitLevel){
- // remove current all all remaining elements from array
- // (which are lower hierarchy spatial units)
- $scope.higherSpatialUnits.splice(index);
- break;
- }
- }
-
- // $scope.higherSpatialUnits.splice(targetIndex);
- $scope.selectedSpatialUnitForFilter = $scope.higherSpatialUnits[$scope.higherSpatialUnits.length - 1];
-
- $scope.loadingData = false;
- };
-
- $scope.inputNotValid = false;
-
- $scope.$on("onChangeSelectedIndicator", function(event){
- $scope.reappliedFilter = false;
- });
-
- $scope.$on("indicatortMapDisplayFinished", function(){
- // trigger the continous display of current filter
- if(! $scope.reappliedFilter){
- $scope.reappliedFilter = true;
- if ($scope.showSelectionByFeatureSpatialFilter){
- $scope.onSelectionByFeatureSpatialFilterSelectBtnPressed();
- }
- if ($scope.showManualSelectionSpatialFilter){
- $scope.onManualSelectionBySelectedMapFeaturesBtnPressed();
- }
- }
- });
-
- $scope.$on("replaceIndicatorAsGeoJSON", function (event, indicatorMetadataAndGeoJSON, spatialUnitName, date, justRestyling, isCustomComputation) {
-
- $scope.setupSpatialUnitFilter(indicatorMetadataAndGeoJSON, spatialUnitName, date);
-
- if(! $scope.previouslySelectedIndicator){
- $scope.previouslySelectedIndicator = kommonitorDataExchangeService.selectedIndicator;
- }
- if(! $scope.previouslySelectedSpatialUnit){
- $scope.previouslySelectedSpatialUnit = kommonitorDataExchangeService.selectedSpatialUnit;
- }
-
- // if($scope.previouslySelectedIndicator.indicatorId != indicatorMetadataAndGeoJSON.indicatorId || $scope.previouslySelectedSpatialUnit.spatialUnitLevel != spatialUnitName){
- if($scope.previouslySelectedSpatialUnit.spatialUnitLevel != spatialUnitName){
- // reset filter component
- if ($scope.showSelectionByFeatureSpatialFilter)
- $scope.updateSelectableAreas("byFeature");
- kommonitorFilterHelperService.clearFilteredFeatures();
- kommonitorFilterHelperService.clearSelectedFeatures();
- if ($scope.showManualSelectionSpatialFilter)
- $scope.updateSelectableAreas("manual");
- kommonitorFilterHelperService.clearFilteredFeatures();
- kommonitorFilterHelperService.clearSelectedFeatures();
- }
-
- $scope.previouslySelectedIndicator = kommonitorDataExchangeService.selectedIndicator;
- $scope.previouslySelectedSpatialUnit = kommonitorDataExchangeService.selectedSpatialUnit;
-
- });
-
- $scope.$on("updateIndicatorValueRangeFilter", function (event, date, indicatorMetadataAndGeoJSON) {
-
- $scope.setupRangeSliderForFilter(date, indicatorMetadataAndGeoJSON);
-
- });
-
- $scope.setupRangeSliderForFilter = function(date, indicatorMetadataAndGeoJSON){
- date = INDICATOR_DATE_PREFIX + date;
-
- if($scope.rangeSliderForFilter){
- kommonitorDataExchangeService.rangeFilterData = undefined;
- $scope.rangeSliderForFilter.destroy();
-
- var domNode = document.getElementById("rangeSliderForFiltering");
-
- while (domNode.hasChildNodes()) {
- domNode.removeChild(domNode.lastChild);
- }
- }
-
- $scope.indicatorMetadataAndGeoJSON = indicatorMetadataAndGeoJSON;
-
- var values = [];
-
- $scope.indicatorMetadataAndGeoJSON.geoJSON.features.forEach(function(feature){
- // if (feature.properties[date] > movMaxValue)
- // movMaxValue = feature.properties[date];
- //
- // else if (feature.properties[date] < movMinValue)
- // movMinValue = feature.properties[date];
-
- if(! kommonitorDataExchangeService.indicatorValueIsNoData(feature.properties[date])){
- values.push(feature.properties[date]);
- }
- });
-
- if(values.length === 0){
- console.warn("Filter range slider cannot be created, as there is no valid indicator value on the selected dataset for the selected date.");
- return ;
- }
-
- //sort ascending order
- values.sort(function(a, b){return a-b});
-
- // initialize and fill in loop
- $scope.valueRangeMinValue = values[0];
- $scope.valueRangeMaxValue = values[values.length - 1];
-
- $scope.valueRangeMinValue = kommonitorDataExchangeService.getIndicatorValue_asNumber($scope.valueRangeMinValue);
- $scope.valueRangeMaxValue = kommonitorDataExchangeService.getIndicatorValue_asNumber($scope.valueRangeMaxValue);
-
- $scope.currentLowerFilterValue = $scope.valueRangeMinValue;
- $scope.currentHigherFilterValue = $scope.valueRangeMaxValue;
-
- $("#rangeSliderForFiltering").ionRangeSlider({
- skin: "big",
- type: "double",
- min: $scope.valueRangeMinValue,
- max: $scope.valueRangeMaxValue,
- from: $scope.valueRangeMinValue,
- to: $scope.valueRangeMaxValue,
- force_edges: true,
- step: 0.01,
- grid: true,
- prettify_enabled: true,
- prettify_separator: "",
- onChange: onChangeRangeFilter
- });
-
- $scope.rangeSliderForFilter = $("#rangeSliderForFiltering").data("ionRangeSlider");
- // make sure that the handles are properly set to min and max values
- $scope.rangeSliderForFilter.update({
- from: $scope.valueRangeMinValue,
- to: $scope.valueRangeMaxValue
- });
-
- };
-
- $scope.onChangeLowerFilterValue = function(){
- if(($scope.currentLowerFilterValue >= $scope.valueRangeMinValue) && ($scope.currentLowerFilterValue <= $scope.valueRangeMaxValue) && ($scope.currentLowerFilterValue <= $scope.currentHigherFilterValue)){
- $scope.lowerFilterInputNotValid = false;
- $scope.rangeSliderForFilter.update({
- from: $scope.currentLowerFilterValue,
- to: $scope.currentHigherFilterValue
- });
-
- $scope.applyRangeFilter();
- }
- else{
- $scope.lowerFilterInputNotValid = true;
- }
- };
-
- $scope.onChangeHigherFilterValue = function(){
- if(($scope.currentHigherFilterValue <= $scope.valueRangeMaxValue) && ($scope.currentHigherFilterValue >= $scope.valueRangeMinValue) && ($scope.currentLowerFilterValue <= $scope.currentHigherFilterValue)){
- $scope.higherFilterInputNotValid = false;
- $scope.rangeSliderForFilter.update({
- from: $scope.currentLowerFilterValue,
- to: $scope.currentHigherFilterValue
- });
-
- $scope.applyRangeFilter();
- }
- else{
- $scope.higherFilterInputNotValid = true;
- }
- };
-
- function onChangeRangeFilter (data) {
- // Called every time handle position is changed
- kommonitorDataExchangeService.rangeFilterData = data;
-
- $scope.lowerFilterInputNotValid = false;
- $scope.higherFilterInputNotValid = false;
-
- $scope.currentLowerFilterValue = data.from;
- $scope.currentHigherFilterValue = data.to;
-
- $scope.applyRangeFilter();
- };
-
- $scope.applyRangeFilter = function(){
-
- var dateProperty = INDICATOR_DATE_PREFIX + kommonitorDataExchangeService.selectedDate;
-
- kommonitorFilterHelperService.applyRangeFilter($scope.indicatorMetadataAndGeoJSON.geoJSON.features, dateProperty, $scope.currentLowerFilterValue, $scope.currentHigherFilterValue);
-
- $scope.$digest();
- }
-
-
- // MeasureOfValue stuff
- $scope.inputNotValid = false;
-
-
- this.onChangeUseMeasureOfValue = function(){
- if(kommonitorDataExchangeService.isBalanceChecked){
- $rootScope.$broadcast("DisableBalance");
- $rootScope.$broadcast("updateIndicatorValueRangeFilter", kommonitorDataExchangeService.selectedDate, kommonitorDataExchangeService.selectedIndicator);
- //replace displayed indicator on map
- kommonitorFilterHelperService.filterAndReplaceDataset();
- // kommonitorMapService.replaceIndicatorGeoJSON(kommonitorDataExchangeService.selectedIndicator, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, kommonitorDataExchangeService.selectedDate, true);
- }
- else{
- this.kommonitorMapServiceInstance.restyleCurrentLayer();
- }
-
- };
-
- $scope.$on("updateMeasureOfValueBar", function (event, date, indicatorMetadataAndGeoJSON) {
-
- $scope.updateMeasureOfValueBar(date, indicatorMetadataAndGeoJSON);
-
- });
-
- $scope.updateMeasureOfValueBar = function(date, indicatorMetadataAndGeoJSON){
-
- //append date prefix to access correct property!
- date = INDICATOR_DATE_PREFIX + date;
- var geoJSON = indicatorMetadataAndGeoJSON.geoJSON;
-
- // var measureOfValueInput = document.getElementById("measureOfValueInput");
-
- var values = [];
-
- geoJSON.features.forEach(function(feature){
- // if (feature.properties[date] > movMaxValue)
- // movMaxValue = feature.properties[date];
- //
- // else if (feature.properties[date] < movMinValue)
- // movMinValue = feature.properties[date];
-
- if(! kommonitorDataExchangeService.indicatorValueIsNoData(feature.properties[date])){
- values.push(feature.properties[date]);
- }
- });
-
- //sort ascending order
- values.sort(function(a, b){return a-b});
-
- $scope.movMinValue = +Number(values[0]).toFixed(numberOfDecimals);
- $scope.movMaxValue = +Number(values[values.length - 1]).toFixed(numberOfDecimals);
-
- $scope.movMiddleValue = +(($scope.movMaxValue + $scope.movMinValue) / 2).toFixed(numberOfDecimals);
- // $scope.movStep = +(($scope.movMaxValue - $scope.movMinValue)/35).toFixed(numberOfDecimals);
- $scope.movStep = 0.01;
-
- // measureOfValueInput.setAttribute("min", $scope.movMinValue);
- // measureOfValueInput.setAttribute("max", $scope.movMaxValue);
- // measureOfValueInput.setAttribute("movStep", $scope.movStep);
- // measureOfValueInput.setAttribute("value", $scope.movMiddleValue);
-
- kommonitorDataExchangeService.measureOfValue = $scope.movMiddleValue;
-
- var measureOfValueTextInput = document.getElementById("measureOfValueTextInput");
- measureOfValueTextInput.setAttribute("min", $scope.movMinValue);
- measureOfValueTextInput.setAttribute("max", $scope.movMaxValue);
- measureOfValueTextInput.setAttribute("value", $scope.movMiddleValue);
- measureOfValueTextInput.setAttribute("step", $scope.movStep);
-
- if($scope.movRangeSlider){
- $scope.movRangeSlider.destroy();
-
- var domNode = document.getElementById("measureOfValueInput");
-
- while (domNode.hasChildNodes()) {
- domNode.removeChild(domNode.lastChild);
- }
- }
-
- // rangeSLider
- $("#measureOfValueInput").ionRangeSlider({
- skin: "big",
- type: "single",
- min: $scope.movMinValue,
- max: $scope.movMaxValue,
- from: $scope.movMiddleValue,
- force_edges: true,
- step: 0.01,
- grid: true,
- prettify_enabled: true,
- prettify_separator: "",
- onChange: $scope.onMeasureOfValueChange
- });
-
- $scope.movRangeSlider = $("#measureOfValueInput").data("ionRangeSlider");
- // make sure that the handles are properly set to min and max values
- $scope.movRangeSlider.update({
- from: $scope.movMiddleValue
- });
-
- $scope.inputNotValid = false;
-
- };
-
- $scope.onMeasureOfValueChange = function(data){
-
- kommonitorDataExchangeService.measureOfValue = +Number(data.from).toFixed(numberOfDecimals);
-
- // kommonitorDataExchangeService.measureOfValue = +Number(kommonitorDataExchangeService.measureOfValue).toFixed(numberOfDecimals);
-
- if(kommonitorDataExchangeService.measureOfValue >= $scope.movMinValue && kommonitorDataExchangeService.measureOfValue <= $scope.movMaxValue){
- $scope.inputNotValid = false;
- kommonitorMapService.restyleCurrentLayer();
- }
- else{
- $scope.inputNotValid = true;
- }
-
- };
-
- $scope.onMeasureOfValueChangeByText = function(){
-
- kommonitorDataExchangeService.measureOfValue = +Number(kommonitorDataExchangeService.measureOfValue).toFixed(numberOfDecimals);
-
- // kommonitorDataExchangeService.measureOfValue = +Number(kommonitorDataExchangeService.measureOfValue).toFixed(numberOfDecimals);
-
- if(kommonitorDataExchangeService.measureOfValue >= $scope.movMinValue && kommonitorDataExchangeService.measureOfValue <= $scope.movMaxValue){
- $scope.inputNotValid = false;
- $scope.movRangeSlider.update({
- from: kommonitorDataExchangeService.measureOfValue
- });
- kommonitorMapService.restyleCurrentLayer();
- }
- else{
- $scope.inputNotValid = true;
- }
-
- };
-
- $scope.updateSelectableAreas = async function(selectionType) {
- $scope.loadingData = true;
- //send request to datamanagement API
- let selectedSpatialUnit = kommonitorDataExchangeService.selectedSpatialUnit;
- let selectedSpatialUnitId = selectedSpatialUnit.spatialUnitId;
- let upperSpatialUnitId = undefined;
-
- // spatial filter not applicable since no upper spatial unit is available or selected
- if(! $scope.selectedSpatialUnitForFilter){
- $scope.loadingData = false;
- return;
- }
-
- if (selectionType === "byFeature" && $scope.selectedSpatialUnitForFilter) {
- upperSpatialUnitId = $scope.selectedSpatialUnitForFilter.spatialUnitId;
- }
- let selectedIndicatorId = kommonitorDataExchangeService.selectedIndicator.indicatorId;
-
- // example: 2020-12-31
- let selectedDateComponents = kommonitorDataExchangeService.selectedDate.split("-");
-
- //build request
- let datePath = "";
- if(selectedDateComponents && selectedDateComponents.length && selectedDateComponents.length == 3){
- datePath = selectedDateComponents[0] + "/" + selectedDateComponents[1] + "/" + selectedDateComponents[2];
- }
- else{
- // fallback option, if no valid date could be used
- datePath = "allFeatures";
- }
- let url = kommonitorDataExchangeService.getBaseUrlToKomMonitorDataAPI_spatialResource() +
- "/spatial-units/" + selectedSpatialUnitId + "/" + datePath;
-
- if (selectionType === "byFeature" && upperSpatialUnitId)
- url = kommonitorDataExchangeService.getBaseUrlToKomMonitorDataAPI_spatialResource() +
- "/spatial-units/" + upperSpatialUnitId + "/" + datePath;
- //send request
- console.log(url);
- await $http({
- url: url,
- method: "GET"
- }).then(function successCallback(response) { //TODO add error callback for the case that the combination of indicator and nextUpperHierarchyLevel doesn't exist
- let areaNames = [];
- $(response.data.features).each( (id, obj) => {
- areaNames.push({name: obj.properties[__env.FEATURE_NAME_PROPERTY_NAME], id: obj.properties[__env.FEATURE_ID_PROPERTY_NAME]});
- });
- if (selectionType === "manual") {
- $scope.manualSelectionSpatialFilterDuallistOptions.selectedItems = [];
- let dataArray = kommonitorDataExchangeService.createDualListInputArray(areaNames, "name", "id");
- $scope.manualSelectionSpatialFilterDuallistOptions.items = dataArray;
- }
- if (selectionType === "byFeature") {
- $scope.higherSpatialUnitFilterFeatureGeoJSON = response.data;
- $scope.selectionByFeatureSpatialFilterDuallistOptions.selectedItems = [];
- let dataArray = kommonitorDataExchangeService.createDualListInputArray(areaNames, "name", "id");
- $scope.selectionByFeatureSpatialFilterDuallistOptions.items = dataArray;
- }
- $scope.loadingData = false;
- $scope.$digest();
- });
- };
-
- $scope.onChangeShowManualSelection = async function() {
- // return if toggle was deactivated
- if(!$scope.showManualSelectionSpatialFilter)
- $scope.onManualSelectionSpatialFilterResetBtnPressed();
- else {
- $scope.showSelectionByFeatureSpatialFilter = false;
- $scope.onManualSelectionSpatialFilterResetBtnPressed();
- }
- };
-
- $scope.onChangeShowSelectionByFeature = async function() {
- // return if toggle was deactivated
- if(!$scope.showSelectionByFeatureSpatialFilter)
- $scope.onSelectionByFeatureSpatialFilterResetBtnPressed();
- else {
- $scope.showManualSelectionSpatialFilter = false;
- $scope.onSelectionByFeatureSpatialFilterResetBtnPressed();
- }
- };
-
- $scope.onChangeSelectedSpatialUnitForFilter = function(){
- if ($scope.showSelectionByFeatureSpatialFilter)
- $scope.updateSelectableAreas("byFeature");
-
- if($scope.showManualSelectionSpatialFilter){
- $scope.updateSelectableAreas("manual");
- }
- };
-
- $scope.onSelectionByFeatureSpatialFilterSelectBtnPressed = function(){
- if($scope.selectionByFeatureSpatialFilterDuallistOptions.selectedItems && $scope.selectionByFeatureSpatialFilterDuallistOptions.selectedItems.length > 0){
- // objects like {category: category, name:name}
- //$scope.selectionByFeatureSpatialFilterDuallistOptions.selectedItems
- let targetFeatureNames = $scope.selectionByFeatureSpatialFilterDuallistOptions.selectedItems.map(object => object.name);
-
- kommonitorFilterHelperService.applySpatialFilter_higherSpatialUnitFeatures($scope.higherSpatialUnitFilterFeatureGeoJSON, targetFeatureNames);
- }
- };
-
- $scope.onSelectionByFeatureSpatialFilterResetBtnPressed = function(){
- $scope.updateSelectableAreas("byFeature");
-
- kommonitorFilterHelperService.clearFilteredFeatures();
- kommonitorFilterHelperService.filterAndReplaceDataset();
- if(document.getElementById('controlNoDataDisplay').checked)
- $rootScope.$broadcast('applyNoDataDisplay')
- };
-
- $scope.onManualSelectionSpatialFilterSelectBtnPressed = function(){
- if($scope.manualSelectionSpatialFilterDuallistOptions.selectedItems && $scope.manualSelectionSpatialFilterDuallistOptions.selectedItems.length > 0){
- // objects like {category: category, name:name}
- //$scope.manualSelectionSpatialFilterDuallistOptions.selectedItems
- let targetFeatureNames = $scope.manualSelectionSpatialFilterDuallistOptions.selectedItems.map(object => object.name);
-
- kommonitorFilterHelperService.applySpatialFilter_currentSpatialUnitFeatures(targetFeatureNames);
- }
- };
-
- $scope.onManualSelectionSpatialFilterResetBtnPressed = function(){
- $scope.updateSelectableAreas("manual");
-
- kommonitorFilterHelperService.clearFilteredFeatures();
- kommonitorFilterHelperService.filterAndReplaceDataset();
- if(document.getElementById('controlNoDataDisplay').checked)
- $rootScope.$broadcast('applyNoDataDisplay')
- };
-
- $scope.onManualSelectionBySelectedMapFeaturesBtnPressed = function(){
- // manage duallist items display
- $scope.manageManualDualList_fromMapSelection();
-
- // apply spatial filter from selected map features
- $scope.onManualSelectionSpatialFilterSelectBtnPressed();
- };
-
- $scope.manageManualDualList_fromMapSelection = function(){
- $scope.manualSelectionSpatialFilterDuallistOptions.items = $scope.manualSelectionSpatialFilterDuallistOptions.items.concat($scope.manualSelectionSpatialFilterDuallistOptions.selectedItems);
- $scope.manualSelectionSpatialFilterDuallistOptions.selectedItems = [];
-
- $scope.manualSelectionSpatialFilterDuallistOptions.selectedItems = $scope.manualSelectionSpatialFilterDuallistOptions.items.filter(item => kommonitorFilterHelperService.featureIsCurrentlySelected(item.id));
- $scope.manualSelectionSpatialFilterDuallistOptions.items = $scope.manualSelectionSpatialFilterDuallistOptions.items.filter(item => ! kommonitorFilterHelperService.featureIsCurrentlySelected(item.id));
- };
-
- // $rootScope.$on("changeSpatialUnit", function() {
- // if ($scope.showSelectionByFeatureSpatialFilter)
- // $scope.updateSelectableAreas("byFeature");
- // if ($scope.showManualSelectionSpatialFilter)
- // $scope.updateSelectableAreas("manual");
- // });
-
- //TODO on indicator change
-
- }]
- });
+ .module('kommonitorFilter')
+ .component('kommonitorFilter', {
+ templateUrl: "components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.template.html",
+ /*
+ * injected with a modules service method that manages
+ * enabled tabs
+ */
+ controller: ['$scope', '$rootScope', 'kommonitorMapService', 'kommonitorDataExchangeService', 'kommonitorFilterHelperService',
+ '__env', '$http', function kommonitorFilterController($scope, $rootScope, kommonitorMapService, kommonitorDataExchangeService, kommonitorFilterHelperService, __env, $http) {
+ const INDICATOR_DATE_PREFIX = __env.indicatorDatePrefix;
+ this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
+ this.kommonitorMapServiceInstance = kommonitorMapService;
+ this.kommonitorFilterHelperServiceInstance = kommonitorFilterHelperService;
+ var numberOfDecimals = __env.numberOfDecimals;
+ // initialize any adminLTE box widgets
+ $('.box').boxWidget();
+ $scope.considerAllowedSpatialUnitsOfCurrentIndicator = true;
+ $scope.loadingData = false;
+ $scope.rangeSliderForFilter;
+ $scope.valueRangeMinValue;
+ $scope.valueRangeMaxValue;
+ $scope.currentLowerFilterValue;
+ $scope.currentHigherFilterValue;
+ $scope.lowerFilterInputNotValid = false;
+ $scope.higherFilterInputNotValid = false;
+ $scope.indicatorMetadataAndGeoJSON;
+ //measureOfValue stuff
+ $scope.movMinValue;
+ $scope.movMaxValue;
+ $scope.movMiddleValue;
+ $scope.movStep;
+ $scope.movRangeSlider;
+ // SPATIAL FILTER STUFF
+ $scope.selectedSpatialUnitForFilter;
+ $scope.higherSpatialUnits = undefined;
+ $scope.higherSpatialUnitFilterFeatureGeoJSON;
+ $scope.reappliedFilter = false;
+ $scope.selectionByFeatureSpatialFilterDuallistOptions = {
+ title: { label: 'Gebiete', helpMessage: 'help' },
+ selectOptions: { initialText: "Gebiete" },
+ items: [],
+ button: { leftText: "Alle auswählen", rightText: "Alle entfernen" },
+ selectedItems: []
+ };
+ $scope.manualSelectionSpatialFilterDuallistOptions = {
+ title: { label: 'Gebiete', helpMessage: 'help' },
+ selectOptions: { initialText: "Gebiete" },
+ items: [],
+ button: { leftText: "Alle auswählen", rightText: "Alle entfernen" },
+ selectedItems: []
+ };
+ $scope.setupSpatialUnitFilter = function (indicatorMetadataAndGeoJSON, spatialUnitName, date) {
+ $scope.loadingData = true;
+ let allowedSpatialUnitIds = indicatorMetadataAndGeoJSON.applicableSpatialUnits.map(spatialUnitEntry => {
+ return spatialUnitEntry.spatialUnitId;
+ });
+ $scope.higherSpatialUnits = JSON.parse(JSON.stringify(kommonitorDataExchangeService.availableSpatialUnits));
+ // only show those spatial units that are actually visible according to keycloak role
+ // and associated to the current indicator as well
+ for (let index = 0; index < $scope.higherSpatialUnits.length; index++) {
+ const spatialUnitMetadata = $scope.higherSpatialUnits[index];
+ // remove if it is not applicable for current indicator OR
+ // remove if it is the currently displayed spatial unit to show only hierarchically higher spatial units
+ if ($scope.considerAllowedSpatialUnitsOfCurrentIndicator && !allowedSpatialUnitIds.includes(spatialUnitMetadata.spatialUnitId)) {
+ // only remove the current element
+ // which represents a spatial unit that is
+ // not supported by the current indicator
+ $scope.higherSpatialUnits.splice(index, 1);
+ }
+ // since we query through a hierarchically sorted array of ALL spatial units
+ // we have to stop when we identify the currently displayed spatial unit
+ // in that case we have to remove that from the list of upper
+ if (spatialUnitName == spatialUnitMetadata.spatialUnitLevel) {
+ // remove current all all remaining elements from array
+ // (which are lower hierarchy spatial units)
+ $scope.higherSpatialUnits.splice(index);
+ break;
+ }
+ }
+ // $scope.higherSpatialUnits.splice(targetIndex);
+ $scope.selectedSpatialUnitForFilter = $scope.higherSpatialUnits[$scope.higherSpatialUnits.length - 1];
+ $scope.loadingData = false;
+ };
+ $scope.inputNotValid = false;
+ $scope.$on("onChangeSelectedIndicator", function (event) {
+ $scope.reappliedFilter = false;
+ });
+ $scope.$on("indicatortMapDisplayFinished", function () {
+ // trigger the continous display of current filter
+ if (!$scope.reappliedFilter) {
+ $scope.reappliedFilter = true;
+ if ($scope.showSelectionByFeatureSpatialFilter) {
+ $scope.onSelectionByFeatureSpatialFilterSelectBtnPressed();
+ }
+ if ($scope.showManualSelectionSpatialFilter) {
+ $scope.onManualSelectionBySelectedMapFeaturesBtnPressed();
+ }
+ }
+ });
+ $scope.$on("replaceIndicatorAsGeoJSON", function (event, indicatorMetadataAndGeoJSON, spatialUnitName, date, justRestyling, isCustomComputation) {
+ $scope.setupSpatialUnitFilter(indicatorMetadataAndGeoJSON, spatialUnitName, date);
+ if (!$scope.previouslySelectedIndicator) {
+ $scope.previouslySelectedIndicator = kommonitorDataExchangeService.selectedIndicator;
+ }
+ if (!$scope.previouslySelectedSpatialUnit) {
+ $scope.previouslySelectedSpatialUnit = kommonitorDataExchangeService.selectedSpatialUnit;
+ }
+ // if($scope.previouslySelectedIndicator.indicatorId != indicatorMetadataAndGeoJSON.indicatorId || $scope.previouslySelectedSpatialUnit.spatialUnitLevel != spatialUnitName){
+ if ($scope.previouslySelectedSpatialUnit.spatialUnitLevel != spatialUnitName) {
+ // reset filter component
+ if ($scope.showSelectionByFeatureSpatialFilter)
+ $scope.updateSelectableAreas("byFeature");
+ kommonitorFilterHelperService.clearFilteredFeatures();
+ kommonitorFilterHelperService.clearSelectedFeatures();
+ if ($scope.showManualSelectionSpatialFilter)
+ $scope.updateSelectableAreas("manual");
+ kommonitorFilterHelperService.clearFilteredFeatures();
+ kommonitorFilterHelperService.clearSelectedFeatures();
+ }
+ $scope.previouslySelectedIndicator = kommonitorDataExchangeService.selectedIndicator;
+ $scope.previouslySelectedSpatialUnit = kommonitorDataExchangeService.selectedSpatialUnit;
+ });
+ $scope.$on("updateIndicatorValueRangeFilter", function (event, date, indicatorMetadataAndGeoJSON) {
+ $scope.setupRangeSliderForFilter(date, indicatorMetadataAndGeoJSON);
+ });
+ $scope.setupRangeSliderForFilter = function (date, indicatorMetadataAndGeoJSON) {
+ date = INDICATOR_DATE_PREFIX + date;
+ if ($scope.rangeSliderForFilter) {
+ kommonitorDataExchangeService.rangeFilterData = undefined;
+ $scope.rangeSliderForFilter.destroy();
+ var domNode = document.getElementById("rangeSliderForFiltering");
+ while (domNode.hasChildNodes()) {
+ domNode.removeChild(domNode.lastChild);
+ }
+ }
+ $scope.indicatorMetadataAndGeoJSON = indicatorMetadataAndGeoJSON;
+ var values = [];
+ $scope.indicatorMetadataAndGeoJSON.geoJSON.features.forEach(function (feature) {
+ // if (feature.properties[date] > movMaxValue)
+ // movMaxValue = feature.properties[date];
+ //
+ // else if (feature.properties[date] < movMinValue)
+ // movMinValue = feature.properties[date];
+ if (!kommonitorDataExchangeService.indicatorValueIsNoData(feature.properties[date])) {
+ values.push(feature.properties[date]);
+ }
+ });
+ if (values.length === 0) {
+ console.warn("Filter range slider cannot be created, as there is no valid indicator value on the selected dataset for the selected date.");
+ return;
+ }
+ //sort ascending order
+ values.sort(function (a, b) { return a - b; });
+ // initialize and fill in loop
+ $scope.valueRangeMinValue = values[0];
+ $scope.valueRangeMaxValue = values[values.length - 1];
+ $scope.valueRangeMinValue = kommonitorDataExchangeService.getIndicatorValue_asNumber($scope.valueRangeMinValue);
+ $scope.valueRangeMaxValue = kommonitorDataExchangeService.getIndicatorValue_asNumber($scope.valueRangeMaxValue);
+ $scope.currentLowerFilterValue = $scope.valueRangeMinValue;
+ $scope.currentHigherFilterValue = $scope.valueRangeMaxValue;
+ $("#rangeSliderForFiltering").ionRangeSlider({
+ skin: "big",
+ type: "double",
+ min: $scope.valueRangeMinValue,
+ max: $scope.valueRangeMaxValue,
+ from: $scope.valueRangeMinValue,
+ to: $scope.valueRangeMaxValue,
+ force_edges: true,
+ step: 0.01,
+ grid: true,
+ prettify_enabled: true,
+ prettify_separator: "",
+ onChange: onChangeRangeFilter
+ });
+ $scope.rangeSliderForFilter = $("#rangeSliderForFiltering").data("ionRangeSlider");
+ // make sure that the handles are properly set to min and max values
+ $scope.rangeSliderForFilter.update({
+ from: $scope.valueRangeMinValue,
+ to: $scope.valueRangeMaxValue
+ });
+ };
+ $scope.onChangeLowerFilterValue = function () {
+ if (($scope.currentLowerFilterValue >= $scope.valueRangeMinValue) && ($scope.currentLowerFilterValue <= $scope.valueRangeMaxValue) && ($scope.currentLowerFilterValue <= $scope.currentHigherFilterValue)) {
+ $scope.lowerFilterInputNotValid = false;
+ $scope.rangeSliderForFilter.update({
+ from: $scope.currentLowerFilterValue,
+ to: $scope.currentHigherFilterValue
+ });
+ $scope.applyRangeFilter();
+ }
+ else {
+ $scope.lowerFilterInputNotValid = true;
+ }
+ };
+ $scope.onChangeHigherFilterValue = function () {
+ if (($scope.currentHigherFilterValue <= $scope.valueRangeMaxValue) && ($scope.currentHigherFilterValue >= $scope.valueRangeMinValue) && ($scope.currentLowerFilterValue <= $scope.currentHigherFilterValue)) {
+ $scope.higherFilterInputNotValid = false;
+ $scope.rangeSliderForFilter.update({
+ from: $scope.currentLowerFilterValue,
+ to: $scope.currentHigherFilterValue
+ });
+ $scope.applyRangeFilter();
+ }
+ else {
+ $scope.higherFilterInputNotValid = true;
+ }
+ };
+ function onChangeRangeFilter(data) {
+ // Called every time handle position is changed
+ kommonitorDataExchangeService.rangeFilterData = data;
+ $scope.lowerFilterInputNotValid = false;
+ $scope.higherFilterInputNotValid = false;
+ $scope.currentLowerFilterValue = data.from;
+ $scope.currentHigherFilterValue = data.to;
+ $scope.applyRangeFilter();
+ }
+ ;
+ $scope.applyRangeFilter = function () {
+ var dateProperty = INDICATOR_DATE_PREFIX + kommonitorDataExchangeService.selectedDate;
+ kommonitorFilterHelperService.applyRangeFilter($scope.indicatorMetadataAndGeoJSON.geoJSON.features, dateProperty, $scope.currentLowerFilterValue, $scope.currentHigherFilterValue);
+ $scope.$digest();
+ };
+ // MeasureOfValue stuff
+ $scope.inputNotValid = false;
+ this.onChangeUseMeasureOfValue = function () {
+ if (kommonitorDataExchangeService.isBalanceChecked) {
+ $rootScope.$broadcast("DisableBalance");
+ $rootScope.$broadcast("updateIndicatorValueRangeFilter", kommonitorDataExchangeService.selectedDate, kommonitorDataExchangeService.selectedIndicator);
+ //replace displayed indicator on map
+ kommonitorFilterHelperService.filterAndReplaceDataset();
+ // kommonitorMapService.replaceIndicatorGeoJSON(kommonitorDataExchangeService.selectedIndicator, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, kommonitorDataExchangeService.selectedDate, true);
+ }
+ else {
+ this.kommonitorMapServiceInstance.restyleCurrentLayer();
+ }
+ };
+ $scope.$on("updateMeasureOfValueBar", function (event, date, indicatorMetadataAndGeoJSON) {
+ $scope.updateMeasureOfValueBar(date, indicatorMetadataAndGeoJSON);
+ });
+ $scope.updateMeasureOfValueBar = function (date, indicatorMetadataAndGeoJSON) {
+ //append date prefix to access correct property!
+ date = INDICATOR_DATE_PREFIX + date;
+ var geoJSON = indicatorMetadataAndGeoJSON.geoJSON;
+ // var measureOfValueInput = document.getElementById("measureOfValueInput");
+ var values = [];
+ geoJSON.features.forEach(function (feature) {
+ // if (feature.properties[date] > movMaxValue)
+ // movMaxValue = feature.properties[date];
+ //
+ // else if (feature.properties[date] < movMinValue)
+ // movMinValue = feature.properties[date];
+ if (!kommonitorDataExchangeService.indicatorValueIsNoData(feature.properties[date])) {
+ values.push(feature.properties[date]);
+ }
+ });
+ //sort ascending order
+ values.sort(function (a, b) { return a - b; });
+ $scope.movMinValue = +Number(values[0]).toFixed(numberOfDecimals);
+ $scope.movMaxValue = +Number(values[values.length - 1]).toFixed(numberOfDecimals);
+ $scope.movMiddleValue = +(($scope.movMaxValue + $scope.movMinValue) / 2).toFixed(numberOfDecimals);
+ // $scope.movStep = +(($scope.movMaxValue - $scope.movMinValue)/35).toFixed(numberOfDecimals);
+ $scope.movStep = 0.01;
+ // measureOfValueInput.setAttribute("min", $scope.movMinValue);
+ // measureOfValueInput.setAttribute("max", $scope.movMaxValue);
+ // measureOfValueInput.setAttribute("movStep", $scope.movStep);
+ // measureOfValueInput.setAttribute("value", $scope.movMiddleValue);
+ kommonitorDataExchangeService.measureOfValue = $scope.movMiddleValue;
+ var measureOfValueTextInput = document.getElementById("measureOfValueTextInput");
+ measureOfValueTextInput.setAttribute("min", $scope.movMinValue);
+ measureOfValueTextInput.setAttribute("max", $scope.movMaxValue);
+ measureOfValueTextInput.setAttribute("value", $scope.movMiddleValue);
+ measureOfValueTextInput.setAttribute("step", $scope.movStep);
+ if ($scope.movRangeSlider) {
+ $scope.movRangeSlider.destroy();
+ var domNode = document.getElementById("measureOfValueInput");
+ while (domNode.hasChildNodes()) {
+ domNode.removeChild(domNode.lastChild);
+ }
+ }
+ // rangeSLider
+ $("#measureOfValueInput").ionRangeSlider({
+ skin: "big",
+ type: "single",
+ min: $scope.movMinValue,
+ max: $scope.movMaxValue,
+ from: $scope.movMiddleValue,
+ force_edges: true,
+ step: 0.01,
+ grid: true,
+ prettify_enabled: true,
+ prettify_separator: "",
+ onChange: $scope.onMeasureOfValueChange
+ });
+ $scope.movRangeSlider = $("#measureOfValueInput").data("ionRangeSlider");
+ // make sure that the handles are properly set to min and max values
+ $scope.movRangeSlider.update({
+ from: $scope.movMiddleValue
+ });
+ $scope.inputNotValid = false;
+ };
+ $scope.onMeasureOfValueChange = function (data) {
+ kommonitorDataExchangeService.measureOfValue = +Number(data.from).toFixed(numberOfDecimals);
+ // kommonitorDataExchangeService.measureOfValue = +Number(kommonitorDataExchangeService.measureOfValue).toFixed(numberOfDecimals);
+ if (kommonitorDataExchangeService.measureOfValue >= $scope.movMinValue && kommonitorDataExchangeService.measureOfValue <= $scope.movMaxValue) {
+ $scope.inputNotValid = false;
+ kommonitorMapService.restyleCurrentLayer();
+ }
+ else {
+ $scope.inputNotValid = true;
+ }
+ };
+ $scope.onMeasureOfValueChangeByText = function () {
+ kommonitorDataExchangeService.measureOfValue = +Number(kommonitorDataExchangeService.measureOfValue).toFixed(numberOfDecimals);
+ // kommonitorDataExchangeService.measureOfValue = +Number(kommonitorDataExchangeService.measureOfValue).toFixed(numberOfDecimals);
+ if (kommonitorDataExchangeService.measureOfValue >= $scope.movMinValue && kommonitorDataExchangeService.measureOfValue <= $scope.movMaxValue) {
+ $scope.inputNotValid = false;
+ $scope.movRangeSlider.update({
+ from: kommonitorDataExchangeService.measureOfValue
+ });
+ kommonitorMapService.restyleCurrentLayer();
+ }
+ else {
+ $scope.inputNotValid = true;
+ }
+ };
+ $scope.updateSelectableAreas = async function (selectionType) {
+ $scope.loadingData = true;
+ //send request to datamanagement API
+ let selectedSpatialUnit = kommonitorDataExchangeService.selectedSpatialUnit;
+ let selectedSpatialUnitId = selectedSpatialUnit.spatialUnitId;
+ let upperSpatialUnitId = undefined;
+ // spatial filter not applicable since no upper spatial unit is available or selected
+ if (!$scope.selectedSpatialUnitForFilter) {
+ $scope.loadingData = false;
+ return;
+ }
+ if (selectionType === "byFeature" && $scope.selectedSpatialUnitForFilter) {
+ upperSpatialUnitId = $scope.selectedSpatialUnitForFilter.spatialUnitId;
+ }
+ let selectedIndicatorId = kommonitorDataExchangeService.selectedIndicator.indicatorId;
+ // example: 2020-12-31
+ let selectedDateComponents = kommonitorDataExchangeService.selectedDate.split("-");
+ //build request
+ let datePath = "";
+ if (selectedDateComponents && selectedDateComponents.length && selectedDateComponents.length == 3) {
+ datePath = selectedDateComponents[0] + "/" + selectedDateComponents[1] + "/" + selectedDateComponents[2];
+ }
+ else {
+ // fallback option, if no valid date could be used
+ datePath = "allFeatures";
+ }
+ let url = kommonitorDataExchangeService.getBaseUrlToKomMonitorDataAPI_spatialResource() +
+ "/spatial-units/" + selectedSpatialUnitId + "/" + datePath;
+ if (selectionType === "byFeature" && upperSpatialUnitId)
+ url = kommonitorDataExchangeService.getBaseUrlToKomMonitorDataAPI_spatialResource() +
+ "/spatial-units/" + upperSpatialUnitId + "/" + datePath;
+ //send request
+ console.log(url);
+ await $http({
+ url: url,
+ method: "GET"
+ }).then(function successCallback(response) {
+ let areaNames = [];
+ $(response.data.features).each((id, obj) => {
+ areaNames.push({ name: obj.properties[__env.FEATURE_NAME_PROPERTY_NAME], id: obj.properties[__env.FEATURE_ID_PROPERTY_NAME] });
+ });
+ if (selectionType === "manual") {
+ $scope.manualSelectionSpatialFilterDuallistOptions.selectedItems = [];
+ let dataArray = kommonitorDataExchangeService.createDualListInputArray(areaNames, "name", "id");
+ $scope.manualSelectionSpatialFilterDuallistOptions.items = dataArray;
+ }
+ if (selectionType === "byFeature") {
+ $scope.higherSpatialUnitFilterFeatureGeoJSON = response.data;
+ $scope.selectionByFeatureSpatialFilterDuallistOptions.selectedItems = [];
+ let dataArray = kommonitorDataExchangeService.createDualListInputArray(areaNames, "name", "id");
+ $scope.selectionByFeatureSpatialFilterDuallistOptions.items = dataArray;
+ }
+ $scope.loadingData = false;
+ $scope.$digest();
+ });
+ };
+ $scope.onChangeShowManualSelection = async function () {
+ // return if toggle was deactivated
+ if (!$scope.showManualSelectionSpatialFilter)
+ $scope.onManualSelectionSpatialFilterResetBtnPressed();
+ else {
+ $scope.showSelectionByFeatureSpatialFilter = false;
+ $scope.onManualSelectionSpatialFilterResetBtnPressed();
+ }
+ };
+ $scope.onChangeShowSelectionByFeature = async function () {
+ // return if toggle was deactivated
+ if (!$scope.showSelectionByFeatureSpatialFilter)
+ $scope.onSelectionByFeatureSpatialFilterResetBtnPressed();
+ else {
+ $scope.showManualSelectionSpatialFilter = false;
+ $scope.onSelectionByFeatureSpatialFilterResetBtnPressed();
+ }
+ };
+ $scope.onChangeSelectedSpatialUnitForFilter = function () {
+ if ($scope.showSelectionByFeatureSpatialFilter)
+ $scope.updateSelectableAreas("byFeature");
+ if ($scope.showManualSelectionSpatialFilter) {
+ $scope.updateSelectableAreas("manual");
+ }
+ };
+ $scope.onSelectionByFeatureSpatialFilterSelectBtnPressed = function () {
+ if ($scope.selectionByFeatureSpatialFilterDuallistOptions.selectedItems && $scope.selectionByFeatureSpatialFilterDuallistOptions.selectedItems.length > 0) {
+ // objects like {category: category, name:name}
+ //$scope.selectionByFeatureSpatialFilterDuallistOptions.selectedItems
+ let targetFeatureNames = $scope.selectionByFeatureSpatialFilterDuallistOptions.selectedItems.map(object => object.name);
+ kommonitorFilterHelperService.applySpatialFilter_higherSpatialUnitFeatures($scope.higherSpatialUnitFilterFeatureGeoJSON, targetFeatureNames);
+ }
+ };
+ $scope.onSelectionByFeatureSpatialFilterResetBtnPressed = function () {
+ $scope.updateSelectableAreas("byFeature");
+ kommonitorFilterHelperService.clearFilteredFeatures();
+ kommonitorFilterHelperService.filterAndReplaceDataset();
+ if (document.getElementById('controlNoDataDisplay').checked)
+ $rootScope.$broadcast('applyNoDataDisplay');
+ };
+ $scope.onManualSelectionSpatialFilterSelectBtnPressed = function () {
+ if ($scope.manualSelectionSpatialFilterDuallistOptions.selectedItems && $scope.manualSelectionSpatialFilterDuallistOptions.selectedItems.length > 0) {
+ // objects like {category: category, name:name}
+ //$scope.manualSelectionSpatialFilterDuallistOptions.selectedItems
+ let targetFeatureNames = $scope.manualSelectionSpatialFilterDuallistOptions.selectedItems.map(object => object.name);
+ kommonitorFilterHelperService.applySpatialFilter_currentSpatialUnitFeatures(targetFeatureNames);
+ }
+ };
+ $scope.onManualSelectionSpatialFilterResetBtnPressed = function () {
+ $scope.updateSelectableAreas("manual");
+ kommonitorFilterHelperService.clearFilteredFeatures();
+ kommonitorFilterHelperService.filterAndReplaceDataset();
+ if (document.getElementById('controlNoDataDisplay').checked)
+ $rootScope.$broadcast('applyNoDataDisplay');
+ };
+ $scope.onManualSelectionBySelectedMapFeaturesBtnPressed = function () {
+ // manage duallist items display
+ $scope.manageManualDualList_fromMapSelection();
+ // apply spatial filter from selected map features
+ $scope.onManualSelectionSpatialFilterSelectBtnPressed();
+ };
+ $scope.manageManualDualList_fromMapSelection = function () {
+ $scope.manualSelectionSpatialFilterDuallistOptions.items = $scope.manualSelectionSpatialFilterDuallistOptions.items.concat($scope.manualSelectionSpatialFilterDuallistOptions.selectedItems);
+ $scope.manualSelectionSpatialFilterDuallistOptions.selectedItems = [];
+ $scope.manualSelectionSpatialFilterDuallistOptions.selectedItems = $scope.manualSelectionSpatialFilterDuallistOptions.items.filter(item => kommonitorFilterHelperService.featureIsCurrentlySelected(item.id));
+ $scope.manualSelectionSpatialFilterDuallistOptions.items = $scope.manualSelectionSpatialFilterDuallistOptions.items.filter(item => !kommonitorFilterHelperService.featureIsCurrentlySelected(item.id));
+ };
+ // $rootScope.$on("changeSpatialUnit", function() {
+ // if ($scope.showSelectionByFeatureSpatialFilter)
+ // $scope.updateSelectableAreas("byFeature");
+ // if ($scope.showManualSelectionSpatialFilter)
+ // $scope.updateSelectableAreas("manual");
+ // });
+ //TODO on indicator change
+ }]
+});
+//# sourceMappingURL=kommonitor-filter.component.js.map
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.component.js.map b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.component.js.map
new file mode 100644
index 000000000..6937ed42d
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"kommonitor-filter.component.js","sourceRoot":"","sources":["kommonitor-filter.component.ts"],"names":[],"mappings":";AAAA,OAAO;KACJ,MAAM,CAAC,kBAAkB,CAAC;KAC1B,SAAS,CACR,kBAAkB,EAClB;IACC,WAAW,EAAG,wGAAwG;IACtH;;;OAGG;IACH,UAAU,EAAG,CAAC,QAAQ,EAAE,YAAY,EAAE,sBAAsB,EAAE,+BAA+B,EAAE,+BAA+B;QAC9H,OAAO,EAAE,OAAO,EAAE,SAAS,0BAA0B,CAAC,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAAE,6BAA6B,EAC5H,6BAA6B,EAAE,KAAK,EAAE,KAAK;YAE1C,MAAM,qBAAqB,GAAG,KAAK,CAAC,mBAAmB,CAAC;YACxD,IAAI,CAAC,qCAAqC,GAAG,6BAA6B,CAAC;YAC3E,IAAI,CAAC,4BAA4B,GAAG,oBAAoB,CAAC;YACzD,IAAI,CAAC,qCAAqC,GAAG,6BAA6B,CAAC;YAC3E,IAAI,gBAAgB,GAAG,KAAK,CAAC,gBAAgB,CAAC;YAC9C,sCAAsC;YACtC,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,CAAC;YAEtB,MAAM,CAAC,6CAA6C,GAAG,IAAI,CAAC;YAC5D,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC;YAE3B,MAAM,CAAC,oBAAoB,CAAC;YAC5B,MAAM,CAAC,kBAAkB,CAAC;YAC1B,MAAM,CAAC,kBAAkB,CAAC;YAC1B,MAAM,CAAC,uBAAuB,CAAC;YAC/B,MAAM,CAAC,wBAAwB,CAAC;YAChC,MAAM,CAAC,wBAAwB,GAAG,KAAK,CAAC;YACxC,MAAM,CAAC,yBAAyB,GAAG,KAAK,CAAC;YACzC,MAAM,CAAC,2BAA2B,CAAC;YAEnC,sBAAsB;YACtB,MAAM,CAAC,WAAW,CAA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,CAAC,CAAC;YAEF,MAAM,CAAC,qCAAqC,GAAG;gBAC9C,MAAM,CAAC,2CAA2C,CAAC,KAAK,GAAG,MAAM,CAAC,2CAA2C,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,2CAA2C,CAAC,aAAa,CAAC,CAAC;gBAC7L,MAAM,CAAC,2CAA2C,CAAC,aAAa,GAAG,EAAE,CAAC;gBAEtE,MAAM,CAAC,2CAA2C,CAAC,aAAa,GAAG,MAAM,CAAC,2CAA2C,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,6BAA6B,CAAC,0BAA0B,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC9M,MAAM,CAAC,2CAA2C,CAAC,KAAK,GAAG,MAAM,CAAC,2CAA2C,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAE,6BAA6B,CAAC,0BAA0B,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;YACzM,CAAC,CAAC;YAEF,mDAAmD;YACnD,mDAAmD;YACnD,+CAA+C;YAC/C,gDAAgD;YAChD,4CAA4C;YAC5C,MAAM;YAEN,0BAA0B;QAE5B,CAAC,CAAC;CACF,CAAC,CAAC"}
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.component.ts b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.component.ts
new file mode 100644
index 000000000..39a8ea4fb
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.component.ts
@@ -0,0 +1,580 @@
+angular
+ .module('kommonitorFilter')
+ .component(
+ 'kommonitorFilter',
+ {
+ templateUrl : "components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.template.html",
+ /*
+ * injected with a modules service method that manages
+ * enabled tabs
+ */
+ controller : ['$scope', '$rootScope', 'kommonitorMapService', 'kommonitorDataExchangeService', 'kommonitorFilterHelperService',
+ '__env', '$http', function kommonitorFilterController($scope, $rootScope, kommonitorMapService, kommonitorDataExchangeService,
+ kommonitorFilterHelperService, __env, $http) {
+
+ const INDICATOR_DATE_PREFIX = __env.indicatorDatePrefix;
+ this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
+ this.kommonitorMapServiceInstance = kommonitorMapService;
+ this.kommonitorFilterHelperServiceInstance = kommonitorFilterHelperService;
+ var numberOfDecimals = __env.numberOfDecimals;
+ // initialize any adminLTE box widgets
+ $('.box').boxWidget();
+
+ $scope.considerAllowedSpatialUnitsOfCurrentIndicator = true;
+ $scope.loadingData = false;
+
+ $scope.rangeSliderForFilter;
+ $scope.valueRangeMinValue;
+ $scope.valueRangeMaxValue;
+ $scope.currentLowerFilterValue;
+ $scope.currentHigherFilterValue;
+ $scope.lowerFilterInputNotValid = false;
+ $scope.higherFilterInputNotValid = false;
+ $scope.indicatorMetadataAndGeoJSON;
+
+ //measureOfValue stuff
+ $scope.movMinValue;
+ $scope.movMaxValue;
+ $scope.movMiddleValue;
+ $scope.movStep;
+ $scope.movRangeSlider;
+
+ // SPATIAL FILTER STUFF
+ $scope.selectedSpatialUnitForFilter;
+ $scope.higherSpatialUnits = undefined;
+ $scope.higherSpatialUnitFilterFeatureGeoJSON;
+ $scope.reappliedFilter = false;
+
+ $scope.selectionByFeatureSpatialFilterDuallistOptions = {
+ title: {label: 'Gebiete', helpMessage: 'help'},
+ selectOptions: {initialText: "Gebiete"},
+ items: [],
+ button: {leftText: "Alle auswählen" , rightText: "Alle entfernen"},
+ selectedItems: []
+ };
+
+ $scope.manualSelectionSpatialFilterDuallistOptions = {
+ title: {label: 'Gebiete', helpMessage: 'help'},
+ selectOptions: {initialText: "Gebiete"},
+ items: [],
+ button: {leftText: "Alle auswählen" , rightText: "Alle entfernen"},
+ selectedItems: []
+ };
+
+
+ $scope.setupSpatialUnitFilter = function(indicatorMetadataAndGeoJSON, spatialUnitName, date){
+
+ $scope.loadingData = true;
+
+ let allowedSpatialUnitIds = indicatorMetadataAndGeoJSON.applicableSpatialUnits.map(spatialUnitEntry => {
+ return spatialUnitEntry.spatialUnitId;
+ });
+
+ $scope.higherSpatialUnits = JSON.parse(JSON.stringify(kommonitorDataExchangeService.availableSpatialUnits));
+
+ // only show those spatial units that are actually visible according to keycloak role
+ // and associated to the current indicator as well
+ for (let index = 0; index < $scope.higherSpatialUnits.length; index++) {
+ const spatialUnitMetadata = $scope.higherSpatialUnits[index];
+
+ // remove if it is not applicable for current indicator OR
+ // remove if it is the currently displayed spatial unit to show only hierarchically higher spatial units
+ if($scope.considerAllowedSpatialUnitsOfCurrentIndicator && ! allowedSpatialUnitIds.includes(spatialUnitMetadata.spatialUnitId)){
+
+ // only remove the current element
+ // which represents a spatial unit that is
+ // not supported by the current indicator
+ $scope.higherSpatialUnits.splice(index, 1);
+ }
+
+ // since we query through a hierarchically sorted array of ALL spatial units
+ // we have to stop when we identify the currently displayed spatial unit
+ // in that case we have to remove that from the list of upper
+ if (spatialUnitName == spatialUnitMetadata.spatialUnitLevel){
+ // remove current all all remaining elements from array
+ // (which are lower hierarchy spatial units)
+ $scope.higherSpatialUnits.splice(index);
+ break;
+ }
+ }
+
+ // $scope.higherSpatialUnits.splice(targetIndex);
+ $scope.selectedSpatialUnitForFilter = $scope.higherSpatialUnits[$scope.higherSpatialUnits.length - 1];
+
+ $scope.loadingData = false;
+ };
+
+ $scope.inputNotValid = false;
+
+ $scope.$on("onChangeSelectedIndicator", function(event){
+ $scope.reappliedFilter = false;
+ });
+
+ $scope.$on("indicatortMapDisplayFinished", function(){
+ // trigger the continous display of current filter
+ if(! $scope.reappliedFilter){
+ $scope.reappliedFilter = true;
+ if ($scope.showSelectionByFeatureSpatialFilter){
+ $scope.onSelectionByFeatureSpatialFilterSelectBtnPressed();
+ }
+ if ($scope.showManualSelectionSpatialFilter){
+ $scope.onManualSelectionBySelectedMapFeaturesBtnPressed();
+ }
+ }
+ });
+
+ $scope.$on("replaceIndicatorAsGeoJSON", function (event, indicatorMetadataAndGeoJSON, spatialUnitName, date, justRestyling, isCustomComputation) {
+
+ $scope.setupSpatialUnitFilter(indicatorMetadataAndGeoJSON, spatialUnitName, date);
+
+ if(! $scope.previouslySelectedIndicator){
+ $scope.previouslySelectedIndicator = kommonitorDataExchangeService.selectedIndicator;
+ }
+ if(! $scope.previouslySelectedSpatialUnit){
+ $scope.previouslySelectedSpatialUnit = kommonitorDataExchangeService.selectedSpatialUnit;
+ }
+
+ // if($scope.previouslySelectedIndicator.indicatorId != indicatorMetadataAndGeoJSON.indicatorId || $scope.previouslySelectedSpatialUnit.spatialUnitLevel != spatialUnitName){
+ if($scope.previouslySelectedSpatialUnit.spatialUnitLevel != spatialUnitName){
+ // reset filter component
+ if ($scope.showSelectionByFeatureSpatialFilter)
+ $scope.updateSelectableAreas("byFeature");
+ kommonitorFilterHelperService.clearFilteredFeatures();
+ kommonitorFilterHelperService.clearSelectedFeatures();
+ if ($scope.showManualSelectionSpatialFilter)
+ $scope.updateSelectableAreas("manual");
+ kommonitorFilterHelperService.clearFilteredFeatures();
+ kommonitorFilterHelperService.clearSelectedFeatures();
+ }
+
+ $scope.previouslySelectedIndicator = kommonitorDataExchangeService.selectedIndicator;
+ $scope.previouslySelectedSpatialUnit = kommonitorDataExchangeService.selectedSpatialUnit;
+
+ });
+
+ $scope.$on("updateIndicatorValueRangeFilter", function (event, date, indicatorMetadataAndGeoJSON) {
+
+ $scope.setupRangeSliderForFilter(date, indicatorMetadataAndGeoJSON);
+
+ });
+
+ $scope.setupRangeSliderForFilter = function(date, indicatorMetadataAndGeoJSON){
+ date = INDICATOR_DATE_PREFIX + date;
+
+ if($scope.rangeSliderForFilter){
+ kommonitorDataExchangeService.rangeFilterData = undefined;
+ $scope.rangeSliderForFilter.destroy();
+
+ var domNode = document.getElementById("rangeSliderForFiltering");
+
+ while (domNode.hasChildNodes()) {
+ domNode.removeChild(domNode.lastChild);
+ }
+ }
+
+ $scope.indicatorMetadataAndGeoJSON = indicatorMetadataAndGeoJSON;
+
+ var values = [];
+
+ $scope.indicatorMetadataAndGeoJSON.geoJSON.features.forEach(function(feature){
+ // if (feature.properties[date] > movMaxValue)
+ // movMaxValue = feature.properties[date];
+ //
+ // else if (feature.properties[date] < movMinValue)
+ // movMinValue = feature.properties[date];
+
+ if(! kommonitorDataExchangeService.indicatorValueIsNoData(feature.properties[date])){
+ values.push(feature.properties[date]);
+ }
+ });
+
+ if(values.length === 0){
+ console.warn("Filter range slider cannot be created, as there is no valid indicator value on the selected dataset for the selected date.");
+ return ;
+ }
+
+ //sort ascending order
+ values.sort(function(a, b){return a-b});
+
+ // initialize and fill in loop
+ $scope.valueRangeMinValue = values[0];
+ $scope.valueRangeMaxValue = values[values.length - 1];
+
+ $scope.valueRangeMinValue = kommonitorDataExchangeService.getIndicatorValue_asNumber($scope.valueRangeMinValue);
+ $scope.valueRangeMaxValue = kommonitorDataExchangeService.getIndicatorValue_asNumber($scope.valueRangeMaxValue);
+
+ $scope.currentLowerFilterValue = $scope.valueRangeMinValue;
+ $scope.currentHigherFilterValue = $scope.valueRangeMaxValue;
+
+ $("#rangeSliderForFiltering").ionRangeSlider({
+ skin: "big",
+ type: "double",
+ min: $scope.valueRangeMinValue,
+ max: $scope.valueRangeMaxValue,
+ from: $scope.valueRangeMinValue,
+ to: $scope.valueRangeMaxValue,
+ force_edges: true,
+ step: 0.01,
+ grid: true,
+ prettify_enabled: true,
+ prettify_separator: "",
+ onChange: onChangeRangeFilter
+ });
+
+ $scope.rangeSliderForFilter = $("#rangeSliderForFiltering").data("ionRangeSlider");
+ // make sure that the handles are properly set to min and max values
+ $scope.rangeSliderForFilter.update({
+ from: $scope.valueRangeMinValue,
+ to: $scope.valueRangeMaxValue
+ });
+
+ };
+
+ $scope.onChangeLowerFilterValue = function(){
+ if(($scope.currentLowerFilterValue >= $scope.valueRangeMinValue) && ($scope.currentLowerFilterValue <= $scope.valueRangeMaxValue) && ($scope.currentLowerFilterValue <= $scope.currentHigherFilterValue)){
+ $scope.lowerFilterInputNotValid = false;
+ $scope.rangeSliderForFilter.update({
+ from: $scope.currentLowerFilterValue,
+ to: $scope.currentHigherFilterValue
+ });
+
+ $scope.applyRangeFilter();
+ }
+ else{
+ $scope.lowerFilterInputNotValid = true;
+ }
+ };
+
+ $scope.onChangeHigherFilterValue = function(){
+ if(($scope.currentHigherFilterValue <= $scope.valueRangeMaxValue) && ($scope.currentHigherFilterValue >= $scope.valueRangeMinValue) && ($scope.currentLowerFilterValue <= $scope.currentHigherFilterValue)){
+ $scope.higherFilterInputNotValid = false;
+ $scope.rangeSliderForFilter.update({
+ from: $scope.currentLowerFilterValue,
+ to: $scope.currentHigherFilterValue
+ });
+
+ $scope.applyRangeFilter();
+ }
+ else{
+ $scope.higherFilterInputNotValid = true;
+ }
+ };
+
+ function onChangeRangeFilter (data) {
+ // Called every time handle position is changed
+ kommonitorDataExchangeService.rangeFilterData = data;
+
+ $scope.lowerFilterInputNotValid = false;
+ $scope.higherFilterInputNotValid = false;
+
+ $scope.currentLowerFilterValue = data.from;
+ $scope.currentHigherFilterValue = data.to;
+
+ $scope.applyRangeFilter();
+ };
+
+ $scope.applyRangeFilter = function(){
+
+ var dateProperty = INDICATOR_DATE_PREFIX + kommonitorDataExchangeService.selectedDate;
+
+ kommonitorFilterHelperService.applyRangeFilter($scope.indicatorMetadataAndGeoJSON.geoJSON.features, dateProperty, $scope.currentLowerFilterValue, $scope.currentHigherFilterValue);
+
+ $scope.$digest();
+ }
+
+
+ // MeasureOfValue stuff
+ $scope.inputNotValid = false;
+
+
+ this.onChangeUseMeasureOfValue = function(){
+ if(kommonitorDataExchangeService.isBalanceChecked){
+ $rootScope.$broadcast("DisableBalance");
+ $rootScope.$broadcast("updateIndicatorValueRangeFilter", kommonitorDataExchangeService.selectedDate, kommonitorDataExchangeService.selectedIndicator);
+ //replace displayed indicator on map
+ kommonitorFilterHelperService.filterAndReplaceDataset();
+ // kommonitorMapService.replaceIndicatorGeoJSON(kommonitorDataExchangeService.selectedIndicator, kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel, kommonitorDataExchangeService.selectedDate, true);
+ }
+ else{
+ this.kommonitorMapServiceInstance.restyleCurrentLayer();
+ }
+
+ };
+
+ $scope.$on("updateMeasureOfValueBar", function (event, date, indicatorMetadataAndGeoJSON) {
+
+ $scope.updateMeasureOfValueBar(date, indicatorMetadataAndGeoJSON);
+
+ });
+
+ $scope.updateMeasureOfValueBar = function(date, indicatorMetadataAndGeoJSON){
+
+ //append date prefix to access correct property!
+ date = INDICATOR_DATE_PREFIX + date;
+ var geoJSON = indicatorMetadataAndGeoJSON.geoJSON;
+
+ // var measureOfValueInput = document.getElementById("measureOfValueInput");
+
+ var values = [];
+
+ geoJSON.features.forEach(function(feature){
+ // if (feature.properties[date] > movMaxValue)
+ // movMaxValue = feature.properties[date];
+ //
+ // else if (feature.properties[date] < movMinValue)
+ // movMinValue = feature.properties[date];
+
+ if(! kommonitorDataExchangeService.indicatorValueIsNoData(feature.properties[date])){
+ values.push(feature.properties[date]);
+ }
+ });
+
+ //sort ascending order
+ values.sort(function(a, b){return a-b});
+
+ $scope.movMinValue = +Number(values[0]).toFixed(numberOfDecimals);
+ $scope.movMaxValue = +Number(values[values.length - 1]).toFixed(numberOfDecimals);
+
+ $scope.movMiddleValue = +(($scope.movMaxValue + $scope.movMinValue) / 2).toFixed(numberOfDecimals);
+ // $scope.movStep = +(($scope.movMaxValue - $scope.movMinValue)/35).toFixed(numberOfDecimals);
+ $scope.movStep = 0.01;
+
+ // measureOfValueInput.setAttribute("min", $scope.movMinValue);
+ // measureOfValueInput.setAttribute("max", $scope.movMaxValue);
+ // measureOfValueInput.setAttribute("movStep", $scope.movStep);
+ // measureOfValueInput.setAttribute("value", $scope.movMiddleValue);
+
+ kommonitorDataExchangeService.measureOfValue = $scope.movMiddleValue;
+
+ var measureOfValueTextInput = document.getElementById("measureOfValueTextInput");
+ measureOfValueTextInput.setAttribute("min", $scope.movMinValue);
+ measureOfValueTextInput.setAttribute("max", $scope.movMaxValue);
+ measureOfValueTextInput.setAttribute("value", $scope.movMiddleValue);
+ measureOfValueTextInput.setAttribute("step", $scope.movStep);
+
+ if($scope.movRangeSlider){
+ $scope.movRangeSlider.destroy();
+
+ var domNode = document.getElementById("measureOfValueInput");
+
+ while (domNode.hasChildNodes()) {
+ domNode.removeChild(domNode.lastChild);
+ }
+ }
+
+ // rangeSLider
+ $("#measureOfValueInput").ionRangeSlider({
+ skin: "big",
+ type: "single",
+ min: $scope.movMinValue,
+ max: $scope.movMaxValue,
+ from: $scope.movMiddleValue,
+ force_edges: true,
+ step: 0.01,
+ grid: true,
+ prettify_enabled: true,
+ prettify_separator: "",
+ onChange: $scope.onMeasureOfValueChange
+ });
+
+ $scope.movRangeSlider = $("#measureOfValueInput").data("ionRangeSlider");
+ // make sure that the handles are properly set to min and max values
+ $scope.movRangeSlider.update({
+ from: $scope.movMiddleValue
+ });
+
+ $scope.inputNotValid = false;
+
+ };
+
+ $scope.onMeasureOfValueChange = function(data){
+
+ kommonitorDataExchangeService.measureOfValue = +Number(data.from).toFixed(numberOfDecimals);
+
+ // kommonitorDataExchangeService.measureOfValue = +Number(kommonitorDataExchangeService.measureOfValue).toFixed(numberOfDecimals);
+
+ if(kommonitorDataExchangeService.measureOfValue >= $scope.movMinValue && kommonitorDataExchangeService.measureOfValue <= $scope.movMaxValue){
+ $scope.inputNotValid = false;
+ kommonitorMapService.restyleCurrentLayer();
+ }
+ else{
+ $scope.inputNotValid = true;
+ }
+
+ };
+
+ $scope.onMeasureOfValueChangeByText = function(){
+
+ kommonitorDataExchangeService.measureOfValue = +Number(kommonitorDataExchangeService.measureOfValue).toFixed(numberOfDecimals);
+
+ // kommonitorDataExchangeService.measureOfValue = +Number(kommonitorDataExchangeService.measureOfValue).toFixed(numberOfDecimals);
+
+ if(kommonitorDataExchangeService.measureOfValue >= $scope.movMinValue && kommonitorDataExchangeService.measureOfValue <= $scope.movMaxValue){
+ $scope.inputNotValid = false;
+ $scope.movRangeSlider.update({
+ from: kommonitorDataExchangeService.measureOfValue
+ });
+ kommonitorMapService.restyleCurrentLayer();
+ }
+ else{
+ $scope.inputNotValid = true;
+ }
+
+ };
+
+ $scope.updateSelectableAreas = async function(selectionType) {
+ $scope.loadingData = true;
+ //send request to datamanagement API
+ let selectedSpatialUnit = kommonitorDataExchangeService.selectedSpatialUnit;
+ let selectedSpatialUnitId = selectedSpatialUnit.spatialUnitId;
+ let upperSpatialUnitId = undefined;
+
+ // spatial filter not applicable since no upper spatial unit is available or selected
+ if(! $scope.selectedSpatialUnitForFilter){
+ $scope.loadingData = false;
+ return;
+ }
+
+ if (selectionType === "byFeature" && $scope.selectedSpatialUnitForFilter) {
+ upperSpatialUnitId = $scope.selectedSpatialUnitForFilter.spatialUnitId;
+ }
+ let selectedIndicatorId = kommonitorDataExchangeService.selectedIndicator.indicatorId;
+
+ // example: 2020-12-31
+ let selectedDateComponents = kommonitorDataExchangeService.selectedDate.split("-");
+
+ //build request
+ let datePath = "";
+ if(selectedDateComponents && selectedDateComponents.length && selectedDateComponents.length == 3){
+ datePath = selectedDateComponents[0] + "/" + selectedDateComponents[1] + "/" + selectedDateComponents[2];
+ }
+ else{
+ // fallback option, if no valid date could be used
+ datePath = "allFeatures";
+ }
+ let url = kommonitorDataExchangeService.getBaseUrlToKomMonitorDataAPI_spatialResource() +
+ "/spatial-units/" + selectedSpatialUnitId + "/" + datePath;
+
+ if (selectionType === "byFeature" && upperSpatialUnitId)
+ url = kommonitorDataExchangeService.getBaseUrlToKomMonitorDataAPI_spatialResource() +
+ "/spatial-units/" + upperSpatialUnitId + "/" + datePath;
+ //send request
+ console.log(url);
+ await $http({
+ url: url,
+ method: "GET"
+ }).then(function successCallback(response) { //TODO add error callback for the case that the combination of indicator and nextUpperHierarchyLevel doesn't exist
+ let areaNames = [];
+ $(response.data.features).each( (id, obj) => {
+ areaNames.push({name: obj.properties[__env.FEATURE_NAME_PROPERTY_NAME], id: obj.properties[__env.FEATURE_ID_PROPERTY_NAME]});
+ });
+ if (selectionType === "manual") {
+ $scope.manualSelectionSpatialFilterDuallistOptions.selectedItems = [];
+ let dataArray = kommonitorDataExchangeService.createDualListInputArray(areaNames, "name", "id");
+ $scope.manualSelectionSpatialFilterDuallistOptions.items = dataArray;
+ }
+ if (selectionType === "byFeature") {
+ $scope.higherSpatialUnitFilterFeatureGeoJSON = response.data;
+ $scope.selectionByFeatureSpatialFilterDuallistOptions.selectedItems = [];
+ let dataArray = kommonitorDataExchangeService.createDualListInputArray(areaNames, "name", "id");
+ $scope.selectionByFeatureSpatialFilterDuallistOptions.items = dataArray;
+ }
+ $scope.loadingData = false;
+ $scope.$digest();
+ });
+ };
+
+ $scope.onChangeShowManualSelection = async function() {
+ // return if toggle was deactivated
+ if(!$scope.showManualSelectionSpatialFilter)
+ $scope.onManualSelectionSpatialFilterResetBtnPressed();
+ else {
+ $scope.showSelectionByFeatureSpatialFilter = false;
+ $scope.onManualSelectionSpatialFilterResetBtnPressed();
+ }
+ };
+
+ $scope.onChangeShowSelectionByFeature = async function() {
+ // return if toggle was deactivated
+ if(!$scope.showSelectionByFeatureSpatialFilter)
+ $scope.onSelectionByFeatureSpatialFilterResetBtnPressed();
+ else {
+ $scope.showManualSelectionSpatialFilter = false;
+ $scope.onSelectionByFeatureSpatialFilterResetBtnPressed();
+ }
+ };
+
+ $scope.onChangeSelectedSpatialUnitForFilter = function(){
+ if ($scope.showSelectionByFeatureSpatialFilter)
+ $scope.updateSelectableAreas("byFeature");
+
+ if($scope.showManualSelectionSpatialFilter){
+ $scope.updateSelectableAreas("manual");
+ }
+ };
+
+ $scope.onSelectionByFeatureSpatialFilterSelectBtnPressed = function(){
+ if($scope.selectionByFeatureSpatialFilterDuallistOptions.selectedItems && $scope.selectionByFeatureSpatialFilterDuallistOptions.selectedItems.length > 0){
+ // objects like {category: category, name:name}
+ //$scope.selectionByFeatureSpatialFilterDuallistOptions.selectedItems
+ let targetFeatureNames = $scope.selectionByFeatureSpatialFilterDuallistOptions.selectedItems.map(object => object.name);
+
+ kommonitorFilterHelperService.applySpatialFilter_higherSpatialUnitFeatures($scope.higherSpatialUnitFilterFeatureGeoJSON, targetFeatureNames);
+ }
+ };
+
+ $scope.onSelectionByFeatureSpatialFilterResetBtnPressed = function(){
+ $scope.updateSelectableAreas("byFeature");
+
+ kommonitorFilterHelperService.clearFilteredFeatures();
+ kommonitorFilterHelperService.filterAndReplaceDataset();
+ if(document.getElementById('controlNoDataDisplay').checked)
+ $rootScope.$broadcast('applyNoDataDisplay')
+ };
+
+ $scope.onManualSelectionSpatialFilterSelectBtnPressed = function(){
+ if($scope.manualSelectionSpatialFilterDuallistOptions.selectedItems && $scope.manualSelectionSpatialFilterDuallistOptions.selectedItems.length > 0){
+ // objects like {category: category, name:name}
+ //$scope.manualSelectionSpatialFilterDuallistOptions.selectedItems
+ let targetFeatureNames = $scope.manualSelectionSpatialFilterDuallistOptions.selectedItems.map(object => object.name);
+
+ kommonitorFilterHelperService.applySpatialFilter_currentSpatialUnitFeatures(targetFeatureNames);
+ }
+ };
+
+ $scope.onManualSelectionSpatialFilterResetBtnPressed = function(){
+ $scope.updateSelectableAreas("manual");
+
+ kommonitorFilterHelperService.clearFilteredFeatures();
+ kommonitorFilterHelperService.filterAndReplaceDataset();
+ if(document.getElementById('controlNoDataDisplay').checked)
+ $rootScope.$broadcast('applyNoDataDisplay')
+ };
+
+ $scope.onManualSelectionBySelectedMapFeaturesBtnPressed = function(){
+ // manage duallist items display
+ $scope.manageManualDualList_fromMapSelection();
+
+ // apply spatial filter from selected map features
+ $scope.onManualSelectionSpatialFilterSelectBtnPressed();
+ };
+
+ $scope.manageManualDualList_fromMapSelection = function(){
+ $scope.manualSelectionSpatialFilterDuallistOptions.items = $scope.manualSelectionSpatialFilterDuallistOptions.items.concat($scope.manualSelectionSpatialFilterDuallistOptions.selectedItems);
+ $scope.manualSelectionSpatialFilterDuallistOptions.selectedItems = [];
+
+ $scope.manualSelectionSpatialFilterDuallistOptions.selectedItems = $scope.manualSelectionSpatialFilterDuallistOptions.items.filter(item => kommonitorFilterHelperService.featureIsCurrentlySelected(item.id));
+ $scope.manualSelectionSpatialFilterDuallistOptions.items = $scope.manualSelectionSpatialFilterDuallistOptions.items.filter(item => ! kommonitorFilterHelperService.featureIsCurrentlySelected(item.id));
+ };
+
+ // $rootScope.$on("changeSpatialUnit", function() {
+ // if ($scope.showSelectionByFeatureSpatialFilter)
+ // $scope.updateSelectableAreas("byFeature");
+ // if ($scope.showManualSelectionSpatialFilter)
+ // $scope.updateSelectableAreas("manual");
+ // });
+
+ //TODO on indicator change
+
+ }]
+ });
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.module.js b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.module.js
index 61070bda9..0745e2a58 100644
--- a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.module.js
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.module.js
@@ -1,15 +1,16 @@
+"use strict";
angular.module('kommonitorFilter', ['kommonitorDataExchange', 'kommonitorMap', 'kommonitorFilterHelper'])
-
-.directive('stringToNumber', function() {
- return {
- require: 'ngModel',
- link: function(scope, element, attrs, ngModel) {
- ngModel.$parsers.push(function(value) {
- return '' + value;
- });
- ngModel.$formatters.push(function(value) {
- return parseFloat(value);
- });
- }
- };
+ .directive('stringToNumber', function () {
+ return {
+ require: 'ngModel',
+ link: function (scope, element, attrs, ngModel) {
+ ngModel.$parsers.push(function (value) {
+ return '' + value;
+ });
+ ngModel.$formatters.push(function (value) {
+ return parseFloat(value);
+ });
+ }
+ };
});
+//# sourceMappingURL=kommonitor-filter.module.js.map
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.module.js.map b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.module.js.map
new file mode 100644
index 000000000..69f5a6447
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.module.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"kommonitor-filter.module.js","sourceRoot":"","sources":["kommonitor-filter.module.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC,wBAAwB,EAAE,eAAe,EAAE,wBAAwB,CAAC,CAAC;KAExG,SAAS,CAAC,gBAAgB,EAAE;IAC3B,OAAO;QACL,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,UAAS,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO;YAC3C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAS,KAAK;gBAClC,OAAO,EAAE,GAAG,KAAK,CAAC;YACpB,CAAC,CAAC,CAAC;YACH,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,UAAS,KAAK;gBACrC,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.module.ts b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.module.ts
new file mode 100644
index 000000000..61070bda9
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorFilter/kommonitor-filter.module.ts
@@ -0,0 +1,15 @@
+angular.module('kommonitorFilter', ['kommonitorDataExchange', 'kommonitorMap', 'kommonitorFilterHelper'])
+
+.directive('stringToNumber', function() {
+ return {
+ require: 'ngModel',
+ link: function(scope, element, attrs, ngModel) {
+ ngModel.$parsers.push(function(value) {
+ return '' + value;
+ });
+ ngModel.$formatters.push(function(value) {
+ return parseFloat(value);
+ });
+ }
+ };
+});
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.component.js b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.component.js
index 73d678b56..36056aef6 100644
--- a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.component.js
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.component.js
@@ -1,819 +1,615 @@
+"use strict";
angular
- .module('kommonitorIndividualIndicatorComputation')
- .component(
- 'kommonitorIndividualIndicatorComputation',
- {
- templateUrl : "components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.template.html",
- controller : ['kommonitorDataExchangeService', '$rootScope', '$scope', '$http','kommonitorMapService', '__env', '$timeout', function kommonitorIndividualIndicatorComputationController(
- kommonitorDataExchangeService, $rootScope, $scope, $http, kommonitorMapService, __env, $timeout) {
-
- this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
- // initialize any adminLTE box widgets
- $('.box').boxWidget();
-
- const targetURL = __env.targetUrlToProcessingEngine + "script-engine/customizableIndicatorComputation";
-
- $scope.loadingData = false;
-
- $scope.targetIndicator;
- $scope.targetIndicator_backup;
-
- $scope.indicatorNameFilter = undefined;
-
- $scope.targetDate;
- $scope.targetSpatialUnit;
- $scope.targetScriptMetadata;
- $scope.jobInfoText;
- $scope.computedCustomizedIndicatorGeoJSON;
- $scope.datesAsMs;
- $scope.availableDates;
- $scope.inputNgModels = {};
-
- $scope.dateSliderForComputation;
-
- $scope.filterComputableIndicators = function() {
- return function( item ) {
-
- // if(item.indicatorName.includes("Erreichbarkeit")){
- // return false;
- // }
-
- var scriptForIndicator;
-
- for (var script of kommonitorDataExchangeService.availableProcessScripts){
- if (script.indicatorId === item.indicatorId){
- scriptForIndicator = script;
- break;
- }
- };
-
- if (! script.variableProcessParameters.length > 0){
- return false;
- }
-
- return true;
- };
- };
-
- $scope.resetComputationForm = function(){
-
- $scope.stopLoop = true;
- $scope.computationStarted = false;
-
- $scope.loadingData = false;
-
- $scope.targetIndicator = undefined;
- $scope.targetDate = undefined;
- $scope.targetSpatialUnit = undefined;
- $scope.targetScriptMetadata = undefined;
- $scope.jobInfoText = undefined;
- $scope.computedCustomizedIndicatorGeoJSON = undefined;
- $scope.datesAsMs = undefined;
- $scope.availableDates = undefined;
- $scope.inputNgModels = {};
- $scope.error = undefined;
-
- if($scope.dateSliderForComputation){
- $scope.dateSliderForComputation.destroy();
- }
-
- var domNode = document.getElementById("dateSliderForComputation");
-
- while (domNode.hasChildNodes()) {
- domNode.removeChild(domNode.lastChild);
- }
-
- $scope.resetProgressBar();
- };
-
- $scope.onTargetDateChange = function(){
-
- $scope.computedCustomizedIndicatorGeoJSON = undefined;
- $scope.resetProgressBar();
-
- var date = new Date($scope.targetDate);
-
- var month = date.getMonth()+1;
- var day = date.getDate();
-
- if (month < 10)
- month = "0" + month;
-
- if (day < 10)
- day = "0" + day;
-
- $scope.targetDate = date.getFullYear() + "-" + month + "-" + day;
-
- $scope.$digest();
- };
-
- var updateInputDisplay = function(input){
-
- var inputDOMElement = document.getElementById(input.parameterData.name);
- var inputDOMLabelInput = document.getElementById(input.parameterData.name + "Label");
-
- input.inputElement.value = inputDOMElement.value;
- inputDOMLabelInput.value = inputDOMElement.value;
- }
-
- var createInputAsString = function(parameterData){
- // {
- // "minParameterValueForNumericInputs": 6.027456183070403,
- // "maxParameterValueForNumericInputs": 0.8008281904610115,
- // "defaultValue": "defaultValue",
- // "dataType": "string",
- // "name": "name",
- // "description": "description"
- // }
-
- var inputElement = document.createElement("input");
- inputElement.setAttribute("id", parameterData.name);
- inputElement.setAttribute("type", "text");
- inputElement.setAttribute("value", parameterData.defaultValue);
- inputElement.value = parameterData.defaultValue;
-
- return inputElement;
- };
-
- var createInputAsBoolean = function(parameterData){
- // {
- // "minParameterValueForNumericInputs": 6.027456183070403,
- // "maxParameterValueForNumericInputs": 0.8008281904610115,
- // "defaultValue": "defaultValue",
- // "dataType": "string",
- // "name": "name",
- // "description": "description"
- // }
-
- var inputElement = document.createElement("input");
- inputElement.setAttribute("id", parameterData.name);
- inputElement.setAttribute("type", "checkbox");
- inputElement.setAttribute("value", parameterData.name);
-
- if(parameterData.defaultValue === 'true')
- inputElement.setAttribute("checked", "checked");
-
- return inputElement;
- };
-
- var createInputAsInteger = function(parameterData){
- // {
- // "minParameterValueForNumericInputs": 6.027456183070403,
- // "maxParameterValueForNumericInputs": 0.8008281904610115,
- // "defaultValue": "defaultValue",
- // "dataType": "string",
- // "name": "name",
- // "description": "description"
- // }
-
- //
-
- var inputElement = document.createElement("input");
- inputElement.setAttribute("id", parameterData.name);
- inputElement.setAttribute("type", "range");
- inputElement.setAttribute("value", Number(parameterData.defaultValue));
- inputElement.value = Number(parameterData.defaultValue);
- // inputElement.setAttribute("class", "slider");
- inputElement.setAttribute("min", parameterData.minParameterValueForNumericInputs);
- inputElement.setAttribute("max", parameterData.maxParameterValueForNumericInputs);
- inputElement.setAttribute("data-show-value", "true");
- inputElement.setAttribute("step", "1");
-
- return inputElement;
- };
-
- var createInputAsDouble = function(parameterData){
- // {
- // "minParameterValueForNumericInputs": 6.027456183070403,
- // "maxParameterValueForNumericInputs": 0.8008281904610115,
- // "defaultValue": "defaultValue",
- // "dataType": "string",
- // "name": "name",
- // "description": "description"
- // }
-
- //
-
- // var inputElement = document.createElement("input");
- var inputElement = {};
- inputElement.id = parameterData.name;
- inputElement.type = "range";
- inputElement.value = Number(parameterData.defaultValue);
- // inputElement.class = "slider";
- inputElement.min = parameterData.minParameterValueForNumericInputs;
- inputElement.max = parameterData.maxParameterValueForNumericInputs;
- // inputElement.dataShowValue = "true";
- inputElement.step = "0.01";
-
- // inputElement.ngModelVariable = parameterData.name + "Value";
- //
- // // inputElement.setAttribute("ng-model", parameterData.name + "Value");
- // $scope.inputNgModels[inputElement.ngModelVariable] = Number(parameterData.defaultValue);
-
- return inputElement;
- };
-
- function sleep(ms) {
- return new Promise(resolve => setTimeout(resolve, ms));
- }
-
- var buildParameterFormHtml = function(targetScriptMetadata){
-
- $scope.computedCustomizedIndicatorGeoJSON = undefined;
- $scope.resetProgressBar();
- $scope.inputNgModels = {};
-
- // await sleep(1000);
-
- // try{
- // var processInputFormNode = document.getElementById("processInputForm");
- // // remove old content
- // while (processInputFormNode.firstChild) {
- // processInputFormNode.removeChild(processInputFormNode.firstChild);
- // }
- // }
- // catch(error){
- // console.error("DOM Element with ID 'processInputForm' was not found");
- // }
-
-
-
- //example to create elements via code
-
- // we must iterate over all process parameters and setup form elements for each input type
- // e.g. sliders for range values, checkboxes for boolean
-
- // var processInputFormNode = document.getElementById("processInputForm");
-
- $scope.processInputs = [];
-
- targetScriptMetadata.variableProcessParameters.forEach(function(parameterData){
- // looks like:
-
- // {
- // "minParameterValueForNumericInputs": 6.027456183070403,
- // "maxParameterValueForNumericInputs": 0.8008281904610115,
- // "defaultValue": "defaultValue",
- // "dataType": "string",
- // "name": "name",
- // "description": "description"
- // }
-
- // var parameterNode = document.createDocumentFragment();
-
- var processInput = {};
- processInput.parameterData = parameterData;
-
- // var parameterDiv = document.createElement("div");
- // parameterDiv.setAttribute("class", "slidecontainer");
- //
- // var parameterLabel = document.createElement("label");
- // parameterLabel.appendChild(document.createTextNode(parameterData.name + ": {{" + parameterData.name + "Value}}"));
- //
- // var parameterDescription = document.createElement("p");
- // parameterDescription.appendChild(document.createTextNode(parameterData.description));
- //
- // parameterDiv.appendChild(parameterLabel);
- // parameterDiv.appendChild(parameterDescription);
-
- // create input element depending on dataType
- // dataType can be string, boolean, integer, double
- switch(parameterData.dataType) {
- case "string":
- // parameterDiv.appendChild(createInputAsString(parameterData));
- processInput.inputElement = createInputAsString(parameterData);
- break;
- case "boolean":
- // parameterDiv.appendChild(createInputAsBoolean(parameterData));
- processInput.inputElement = createInputAsBoolean(parameterData);
- break;
- case "integer":
- // parameterDiv.appendChild(createInputAsInteger(parameterData));
- processInput.inputElement = createInputAsInteger(parameterData);
- break;
- case "double":
- // parameterDiv.appendChild(createInputAsDouble(parameterData));
- processInput.inputElement = createInputAsDouble(parameterData);
- break;
- default:
- // parameterDiv.appendChild(createInputAsString(parameterData));
- processInput.inputElement = createInputAsString(parameterData);
- }
-
- $scope.processInputs.push(processInput);
-
- // $scope[processInput.inputElement.ngModelVariable] = processInput.parameterData.defaultValue;
-
- // make a bit space after paramter
- // parameterDiv.appendChild(document.createElement("p"));
-
- // processInputFormNode.appendChild(parameterDiv);
- });
-
- // parameterNode.appendChild(parameterDiv);
-
- // $scope.$digest();
- };
-
- $scope.getScriptMetadataForIndicatorId = function(indicatorId){
- var targetScriptMetadata;
-
- for (const scriptElement of kommonitorDataExchangeService.availableProcessScripts){
- if (scriptElement.indicatorId === indicatorId){
- targetScriptMetadata = scriptElement;
- break;
- }
- };
-
- return targetScriptMetadata;
- };
-
- $scope.onChangeTargetIndicator = function(){
-
- if($scope.targetIndicator){
- $scope.targetIndicator_backup = $scope.targetIndicator;
- }
- else{
- $scope.targetIndicator = $scope.targetIndicator_backup;
- }
-
- $scope.computedCustomizedIndicatorGeoJSON = undefined;
- $scope.resetProgressBar();
-
- $scope.targetScriptMetadata = $scope.getScriptMetadataForIndicatorId($scope.targetIndicator.indicatorId);
-
- buildParameterFormHtml($scope.targetScriptMetadata);
-
- $scope.setupDateSliderForComputation();
-
- if(!$scope.targetSpatialUnit){
- $scope.targetSpatialUnit = $scope.getFirstSpatialUnitForSelectedIndicator();
- }
-
- // modify guidedTour if required
- $rootScope.$broadcast("redrawGuidedTourElement");
-
- };
-
- $scope.getFirstSpatialUnitForSelectedIndicator = function() {
-
- var result = undefined;
-
- var applicableSpatialUnits = $scope.targetIndicator.applicableSpatialUnits;
-
- for (const spatialUnitEntry of kommonitorDataExchangeService.availableSpatialUnits){
- if(applicableSpatialUnits.some(o => o.spatialUnitName === spatialUnitEntry.spatialUnitLevel))
- result = spatialUnitEntry;
- break;
- }
-
- return result;
- };
-
- $scope.onChangeTargetSpatialUnit = function(){
-
- $scope.computedCustomizedIndicatorGeoJSON = undefined;
- $scope.resetProgressBar();
-
-
- buildParameterFormHtml($scope.targetScriptMetadata);
- $scope.setupDateSliderForComputation();
-
- };
-
- $scope.fetchBaseIndicatorMetadata = function(baseIndicatorId){
- for (const indicatorMetadata of kommonitorDataExchangeService.displayableIndicators){
- if(indicatorMetadata.indicatorId === baseIndicatorId)
- return indicatorMetadata;
- }
- }
-
- $scope.fetchGeoresourceMetadata = function(georesourceId){
- for (const georesourceMetadata of kommonitorDataExchangeService.availableGeoresources){
- if(georesourceMetadata.datasetId === georesourceId)
- return georesourceMetadata;
- }
- }
-
- $scope.appendDatesFromIndicatorMetadataApplicableDates = function(dates){
-
- var indicatorMetadata = $scope.fetchBaseIndicatorMetadata($scope.targetScriptMetadata.indicatorId);
- for (const date of indicatorMetadata.applicableDates){
- if(!dates.includes(date))
- dates.push(date);
- }
-
- return dates;
- }
-
- $scope.appendDatesFromBaseIndicators = function(dates){
-
- for (const baseIndicatorId of $scope.targetScriptMetadata.requiredIndicatorIds){
- var baseIndicator = $scope.fetchBaseIndicatorMetadata(baseIndicatorId);
- for (const date of baseIndicator.applicableDates){
- if(!dates.includes(date))
- dates.push(date);
- }
- }
-
- return dates;
- }
-
- $scope.appendDatesFromGeoresources = function(dates){
-
- for (const georesourceId of $scope.targetScriptMetadata.requiredGeoresourceIds){
- var georesource = $scope.fetchGeoresourceMetadata(georesourceId);
- for (const date of georesource.applicableDates){
- if(!dates.includes(date))
- dates.push(date);
- }
- }
-
- return dates;
- }
-
- function dateToTS (date) {
- return date.valueOf();
- }
-
- function tsToDateString (dateAsMs) {
- var date = new Date(dateAsMs);
-
- /**
- * TODO FIXME dateSLider formatter will return only year for now to prevent misleading month and day settings
- */
-
- // return date.getFullYear();
-
- return date.toLocaleDateString("de-DE", {
- year: 'numeric',
- month: 'long',
- day: 'numeric'
- });
- }
-
- function dateToDateString (date) {
-
- /**
- * TODO FIXME dateSLider formatter will return only year for now to prevent misleading month and day settings
- */
-
- // return date.getFullYear();
-
- return date.toLocaleDateString("de-DE", {
- year: 'numeric',
- month: 'long',
- day: 'numeric'
- });
- }
-
- function createDatesFromIndicatorDates(indicatorDates) {
-
- $scope.datesAsMs = [];
-
- for (var index=0; index < indicatorDates.length; index++){
- // year-month-day
- var dateComponents = indicatorDates[index].split("-");
- $scope.datesAsMs.push(dateToTS(new Date(Number(dateComponents[0]), Number(dateComponents[1]) - 1, Number(dateComponents[2]))));
- }
- return $scope.datesAsMs;
- }
-
-
- $scope.setupDateSliderForComputation = function(){
-
- if($scope.dateSliderForComputation){
- $scope.dateSliderForComputation.destroy();
- }
-
- var domNode = document.getElementById("dateSliderForComputation");
-
- while (domNode.hasChildNodes()) {
- domNode.removeChild(domNode.lastChild);
- }
-
- $scope.availableDates = new Array();
-
- // availableDates = $scope.appendDatesFromBaseIndicators(availableDates);
- $scope.availableDates = $scope.appendDatesFromIndicatorMetadataApplicableDates($scope.availableDates);
- // availableDates = $scope.appendDatesFromGeoresources(availableDates);
-
- // sort ascending
- $scope.availableDates.sort(function(a, b) {
- return a - b;
- });
-
- $scope.date = $scope.availableDates[$scope.availableDates.length - 1];
- $scope.targetDate = $scope.availableDates[$scope.availableDates.length - 1];
-
- $scope.datesAsMs = createDatesFromIndicatorDates($scope.availableDates);
-
- // new Date() uses month between 0-11!
- $("#dateSliderForComputation").ionRangeSlider({
- skin: "big",
- type: "single",
- grid: true,
- values: $scope.datesAsMs,
- from: $scope.datesAsMs.length -1, // index, not the date
- force_edges: true,
- prettify: tsToDateString,
- onChange: $scope.onChangeDateSliderItem
- });
-
- $scope.dateSliderForComputation = $("#dateSliderForComputation").data("ionRangeSlider");
- // make sure that the handle is properly set to max value
- $scope.dateSliderForComputation.update({
- from: $scope.datesAsMs.length -1 // index, not the date
- });
- };
-
- $scope.onChangeDateSliderItem = async function(data){
-
- $scope.targetDate = $scope.availableDates[data.from];
- $scope.date = $scope.targetDate;
- };
-
-
- $scope.calculateCustomIndicator = function(){
-
- $scope.computationStarted = true;
-
- $scope.computedCustomizedIndicatorGeoJSON = undefined;
- $scope.jobInfoText = undefined;
- $scope.resetProgressBar();
-
- $scope.stopLoop = false;
-
- console.log("calculateCustomIndicator called!");
-
- $scope.loadingData = true;
- // example request model
-
- // {
- // "targetSpatialUnitId": "targetSpatialUnitId",
- // "scriptId": "scriptId",
- // "customProcessProperties": [
- // {
- // "dataType": "string",
- // "name": "name",
- // "value": "customValue"
- // },
- // {
- // "dataType": "string",
- // "name": "name",
- // "value": "customValue"
- // }
- // ],
- // "targetDate": "2000-01-23",
- // "georesourceIds": [
- // "georesourceIds",
- // "georesourceIds"
- // ],
- // "baseIndicatorIds": [
- // "baseIndicatorIds",
- // "baseIndicatorIds"
- // ]
- // }
-
- var processingInput = {};
- processingInput.targetSpatialUnitId = $scope.targetSpatialUnit.spatialUnitId;
- processingInput.scriptId = $scope.targetScriptMetadata.scriptId;
- processingInput.targetDate = $scope.targetDate;
- processingInput.georesourceIds = $scope.targetScriptMetadata.requiredGeoresourceIds;
- processingInput.baseIndicatorIds = $scope.targetScriptMetadata.requiredIndicatorIds;
- processingInput.customProcessProperties = new Array();
-
- $scope.targetScriptMetadata.variableProcessParameters.forEach(function(processParam){
- // now get name of parameter
- // then seach for input element within DOM with id=name
- // get value of that DOM element and create parameter object
- var scriptParam = {};
- scriptParam.name = processParam.name;
- scriptParam.dataType = processParam.dataType;
- scriptParam.value = document.getElementById(scriptParam.name).value;
-
- processingInput.customProcessProperties.push(scriptParam);
- });
-
- console.log("created URL POST body for CUSTOM PROCESSING: " + processingInput);
-
- $scope.indicatorName = $scope.targetIndicator.indicatorName;
- $scope.spatialUnitName = $scope.targetSpatialUnit.spatialUnitLevel;
- $scope.date = $scope.targetDate;
-
- $http({
- url: targetURL,
- method: "POST",
- headers: {
- 'Content-Type': 'application/json'
- },
- data: processingInput
- }).then(async function successCallback(response) {
- // this callback will be called asynchronously
- // when the response is available
-
- console.log("success callback for customizable indicator comutation");
- // get location header to achieve jobId
- var jobId = response.headers('Location');
-
- await sleep(300);
-
- $scope.showInitialJobStatus(jobId);
-
- $timeout(function(){
-
- $scope.loadingData = false;
- });
-
- $scope.pendForResult(jobId);
-
- // $scope.downloadGeoJSON(geoJSON_string);
-
- }, function errorCallback(error) {
- // called asynchronously if an error occurs
- // or server returns response with an error status.
- $scope.error = error.statusText;
-
- kommonitorDataExchangeService.displayMapApplicationError(error);
-
- $timeout(function(){
-
- $scope.loadingData = false;
- });
- });
-
- }
-
- $scope.showInitialJobStatus = function(jobId){
-
- $http({
- url: targetURL + "/" + jobId,
- method: "GET"
- }).then(function successCallback(response) {
- // this callback will be called asynchronously
- // when the response is available
-
- console.log("success callback for showInitialJobStatus");
- $scope.jobInfoText = "Berechnung begonnen. Siehe Fortschrittsbalken.";
-
- if(response.data.progress)
- $scope.updateProgressBar(response.data.progress);
-
- }, function errorCallback(error) {
- // called asynchronously if an error occurs
- // or server returns response with an error status.
- $scope.error = error.data.error;
-
- kommonitorDataExchangeService.displayMapApplicationError(error);
-
- $scope.loadingData = false;
- });
- };
-
- $scope.pendForResult = async function(jobId){
-
- var sleepTimeInMS = 1000;
-
-
- while(!$scope.computedCustomizedIndicatorGeoJSON && !$scope.stopLoop){
-
- if($scope.stopLoop)
- break;
-
- $http({
- url: targetURL + '/' + jobId,
- method: "GET"
- }).then(function successCallback(response) {
- // this callback will be called asynchronously
- // when the response is available
-
- console.log("success callback for pendForResult");
-
- if(response.data.status === "failed"){
- $scope.error = response.data.error;
- console.error(response.data.error);
- $scope.stopLoop = true;
- return;
- }
-
- if(response.data.progress)
- $scope.updateProgressBar(response.data.progress);
-
-
- if(response.data.progress === 100 || response.data.status === "succeeded"){
- var geoJSON_base64 = response.data.result_geoJSON_base64;
- // first decode Base64 and then parse string as JSON
- $scope.computedCustomizedIndicatorGeoJSON = JSON.parse(atob(geoJSON_base64));
- $scope.jobInfoText = undefined;
- $scope.stopLoop = true;
-
- $scope.prepareDownloadGeoJSON();
-
- // $scope.$digest();
- }
-
- }, function errorCallback(error) {
- // called asynchronously if an error occurs
- // or server returns response with an error status.
- $scope.error = error.data.error;
- console.error(error.data.error);
- kommonitorDataExchangeService.displayMapApplicationError(error);
- $scope.stopLoop = true;
- $scope.loadingData = false;
- return;
-
-
- });
-
- if ($scope.computedCustomizedIndicatorGeoJSON)
- return;
-
- await sleep(sleepTimeInMS);
- }
-
- };
-
- $scope.updateProgressBar = function(progress){
- var progressBarNode = document.getElementById("customComputationProgressBar");
-
- progressBarNode.setAttribute("aria-valuenow", ""+progress);
- progressBarNode.setAttribute("style", "width:"+progress+"%");
- progressBarNode.textContent = progress + "% Fortschritt";
- // $scope.progress = progress;
- };
-
- $scope.resetProgressBar = function(){
- var progressBarNode = document.getElementById("customComputationProgressBar");
-
- progressBarNode.setAttribute("aria-valuenow", "0");
- progressBarNode.setAttribute("style", "width:0%");
- progressBarNode.textContent = "0% Fortschritt";
- // $scope.progress = 0;
- };
-
- $scope.addComputedIndicatorToMap = function(){
- console.log("Adding customized indicator to map.");
-
- $scope.targetIndicator.geoJSON = $scope.computedCustomizedIndicatorGeoJSON;
- kommonitorDataExchangeService.selectedIndicator = $scope.targetIndicator;
- // kommonitorMapService.addCustomIndicatorGeoJSON($scope.targetIndicator, $scope.targetSpatialUnit.spatialUnitLevel, $scope.targetDate);
- kommonitorMapService.replaceIndicatorGeoJSON($scope.targetIndicator, $scope.targetSpatialUnit.spatialUnitLevel, $scope.targetDate, false, true);
- };
-
- $scope.prepareDownloadGeoJSON = function(){
-
- console.log("removing old download button if available")
- if(document.getElementById("downloadComputedIndicator"))
- document.getElementById("downloadComputedIndicator").remove();
-
- var geoJSON_string = JSON.stringify($scope.computedCustomizedIndicatorGeoJSON);
-
- var fileName = $scope.indicatorName + "_" + $scope.spatialUnitName + "_" + $scope.date + "_CUSTOM.geojson";
- // var fileName = "export.geojson"
-
- // if (!geoJSON_string.match(/^data:application\/vnd.geo+json/i)) {
- // geoJSON_string = 'data:application/vnd.geo+json;charset=utf-8,' + geoJSON_string;
- // }
- // data = encodeURI(geoJSON_string);
-
- var blob = new Blob([geoJSON_string], {type: "application/json"});
- var data = URL.createObjectURL(blob);
- //
- // $scope.indicatorDownloadURL = data;
- // $scope.indicatorDownloadName = fileName;
-
- console.log("create new Download button and append it to DOM");
- var a = document.createElement('a');
- a.download = fileName;
- a.href = data;
- a.textContent = "Download GeoJSON";
- a.id = "downloadComputedIndicator";
- a.setAttribute("class", "btn btn-primary");
-
- document.getElementById('indicatorOutput').appendChild(a);
- }
-
- $scope.downloadGeoJSON = function(){
-
- var geoJSON_string = JSON.stringify($scope.computedCustomizedIndicatorGeoJSON);
-
- filename = $scope.targetIndicator.indicatorName + "_" + $scope.targetSpatialUnit.spatialUnitLevel + "_" + $scope.targetDate + "_CUSTOM.geojson";
-
- if (!geoJSON_string.match(/^data:application\/vnd.geo+json/i)) {
- geoJSON_string = 'data:application/vnd.geo+json;charset=utf-8,' + geoJSON_string;
- }
- data = encodeURI(geoJSON_string);
-
- link = document.createElement('a');
- link.setAttribute('href', data);
- link.setAttribute('download', filename);
-
- document.body.appendChild(link);
-
- console.log("Trigger download");
-
- link.click();
- }
-
- }]
- });
+ .module('kommonitorIndividualIndicatorComputation')
+ .component('kommonitorIndividualIndicatorComputation', {
+ templateUrl: "components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.template.html",
+ controller: ['kommonitorDataExchangeService', '$rootScope', '$scope', '$http', 'kommonitorMapService', '__env', '$timeout', function kommonitorIndividualIndicatorComputationController(kommonitorDataExchangeService, $rootScope, $scope, $http, kommonitorMapService, __env, $timeout) {
+ this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
+ // initialize any adminLTE box widgets
+ $('.box').boxWidget();
+ const targetURL = __env.targetUrlToProcessingEngine + "script-engine/customizableIndicatorComputation";
+ $scope.loadingData = false;
+ $scope.targetIndicator;
+ $scope.targetIndicator_backup;
+ $scope.indicatorNameFilter = undefined;
+ $scope.targetDate;
+ $scope.targetSpatialUnit;
+ $scope.targetScriptMetadata;
+ $scope.jobInfoText;
+ $scope.computedCustomizedIndicatorGeoJSON;
+ $scope.datesAsMs;
+ $scope.availableDates;
+ $scope.inputNgModels = {};
+ $scope.dateSliderForComputation;
+ $scope.filterComputableIndicators = function () {
+ return function (item) {
+ // if(item.indicatorName.includes("Erreichbarkeit")){
+ // return false;
+ // }
+ var scriptForIndicator;
+ for (var script of kommonitorDataExchangeService.availableProcessScripts) {
+ if (script.indicatorId === item.indicatorId) {
+ scriptForIndicator = script;
+ break;
+ }
+ }
+ ;
+ if (!script.variableProcessParameters.length > 0) {
+ return false;
+ }
+ return true;
+ };
+ };
+ $scope.resetComputationForm = function () {
+ $scope.stopLoop = true;
+ $scope.computationStarted = false;
+ $scope.loadingData = false;
+ $scope.targetIndicator = undefined;
+ $scope.targetDate = undefined;
+ $scope.targetSpatialUnit = undefined;
+ $scope.targetScriptMetadata = undefined;
+ $scope.jobInfoText = undefined;
+ $scope.computedCustomizedIndicatorGeoJSON = undefined;
+ $scope.datesAsMs = undefined;
+ $scope.availableDates = undefined;
+ $scope.inputNgModels = {};
+ $scope.error = undefined;
+ if ($scope.dateSliderForComputation) {
+ $scope.dateSliderForComputation.destroy();
+ }
+ var domNode = document.getElementById("dateSliderForComputation");
+ while (domNode.hasChildNodes()) {
+ domNode.removeChild(domNode.lastChild);
+ }
+ $scope.resetProgressBar();
+ };
+ $scope.onTargetDateChange = function () {
+ $scope.computedCustomizedIndicatorGeoJSON = undefined;
+ $scope.resetProgressBar();
+ var date = new Date($scope.targetDate);
+ var month = date.getMonth() + 1;
+ var day = date.getDate();
+ if (month < 10)
+ month = "0" + month;
+ if (day < 10)
+ day = "0" + day;
+ $scope.targetDate = date.getFullYear() + "-" + month + "-" + day;
+ $scope.$digest();
+ };
+ var updateInputDisplay = function (input) {
+ var inputDOMElement = document.getElementById(input.parameterData.name);
+ var inputDOMLabelInput = document.getElementById(input.parameterData.name + "Label");
+ input.inputElement.value = inputDOMElement.value;
+ inputDOMLabelInput.value = inputDOMElement.value;
+ };
+ var createInputAsString = function (parameterData) {
+ // {
+ // "minParameterValueForNumericInputs": 6.027456183070403,
+ // "maxParameterValueForNumericInputs": 0.8008281904610115,
+ // "defaultValue": "defaultValue",
+ // "dataType": "string",
+ // "name": "name",
+ // "description": "description"
+ // }
+ var inputElement = document.createElement("input");
+ inputElement.setAttribute("id", parameterData.name);
+ inputElement.setAttribute("type", "text");
+ inputElement.setAttribute("value", parameterData.defaultValue);
+ inputElement.value = parameterData.defaultValue;
+ return inputElement;
+ };
+ var createInputAsBoolean = function (parameterData) {
+ // {
+ // "minParameterValueForNumericInputs": 6.027456183070403,
+ // "maxParameterValueForNumericInputs": 0.8008281904610115,
+ // "defaultValue": "defaultValue",
+ // "dataType": "string",
+ // "name": "name",
+ // "description": "description"
+ // }
+ var inputElement = document.createElement("input");
+ inputElement.setAttribute("id", parameterData.name);
+ inputElement.setAttribute("type", "checkbox");
+ inputElement.setAttribute("value", parameterData.name);
+ if (parameterData.defaultValue === 'true')
+ inputElement.setAttribute("checked", "checked");
+ return inputElement;
+ };
+ var createInputAsInteger = function (parameterData) {
+ // {
+ // "minParameterValueForNumericInputs": 6.027456183070403,
+ // "maxParameterValueForNumericInputs": 0.8008281904610115,
+ // "defaultValue": "defaultValue",
+ // "dataType": "string",
+ // "name": "name",
+ // "description": "description"
+ // }
+ //
+ var inputElement = document.createElement("input");
+ inputElement.setAttribute("id", parameterData.name);
+ inputElement.setAttribute("type", "range");
+ inputElement.setAttribute("value", Number(parameterData.defaultValue));
+ inputElement.value = Number(parameterData.defaultValue);
+ // inputElement.setAttribute("class", "slider");
+ inputElement.setAttribute("min", parameterData.minParameterValueForNumericInputs);
+ inputElement.setAttribute("max", parameterData.maxParameterValueForNumericInputs);
+ inputElement.setAttribute("data-show-value", "true");
+ inputElement.setAttribute("step", "1");
+ return inputElement;
+ };
+ var createInputAsDouble = function (parameterData) {
+ // {
+ // "minParameterValueForNumericInputs": 6.027456183070403,
+ // "maxParameterValueForNumericInputs": 0.8008281904610115,
+ // "defaultValue": "defaultValue",
+ // "dataType": "string",
+ // "name": "name",
+ // "description": "description"
+ // }
+ //
+ // var inputElement = document.createElement("input");
+ var inputElement = {};
+ inputElement.id = parameterData.name;
+ inputElement.type = "range";
+ inputElement.value = Number(parameterData.defaultValue);
+ // inputElement.class = "slider";
+ inputElement.min = parameterData.minParameterValueForNumericInputs;
+ inputElement.max = parameterData.maxParameterValueForNumericInputs;
+ // inputElement.dataShowValue = "true";
+ inputElement.step = "0.01";
+ // inputElement.ngModelVariable = parameterData.name + "Value";
+ //
+ // // inputElement.setAttribute("ng-model", parameterData.name + "Value");
+ // $scope.inputNgModels[inputElement.ngModelVariable] = Number(parameterData.defaultValue);
+ return inputElement;
+ };
+ function sleep(ms) {
+ return new Promise(resolve => setTimeout(resolve, ms));
+ }
+ var buildParameterFormHtml = function (targetScriptMetadata) {
+ $scope.computedCustomizedIndicatorGeoJSON = undefined;
+ $scope.resetProgressBar();
+ $scope.inputNgModels = {};
+ // await sleep(1000);
+ // try{
+ // var processInputFormNode = document.getElementById("processInputForm");
+ // // remove old content
+ // while (processInputFormNode.firstChild) {
+ // processInputFormNode.removeChild(processInputFormNode.firstChild);
+ // }
+ // }
+ // catch(error){
+ // console.error("DOM Element with ID 'processInputForm' was not found");
+ // }
+ //example to create elements via code
+ // we must iterate over all process parameters and setup form elements for each input type
+ // e.g. sliders for range values, checkboxes for boolean
+ // var processInputFormNode = document.getElementById("processInputForm");
+ $scope.processInputs = [];
+ targetScriptMetadata.variableProcessParameters.forEach(function (parameterData) {
+ // looks like:
+ // {
+ // "minParameterValueForNumericInputs": 6.027456183070403,
+ // "maxParameterValueForNumericInputs": 0.8008281904610115,
+ // "defaultValue": "defaultValue",
+ // "dataType": "string",
+ // "name": "name",
+ // "description": "description"
+ // }
+ // var parameterNode = document.createDocumentFragment();
+ var processInput = {};
+ processInput.parameterData = parameterData;
+ // var parameterDiv = document.createElement("div");
+ // parameterDiv.setAttribute("class", "slidecontainer");
+ //
+ // var parameterLabel = document.createElement("label");
+ // parameterLabel.appendChild(document.createTextNode(parameterData.name + ": {{" + parameterData.name + "Value}}"));
+ //
+ // var parameterDescription = document.createElement("p");
+ // parameterDescription.appendChild(document.createTextNode(parameterData.description));
+ //
+ // parameterDiv.appendChild(parameterLabel);
+ // parameterDiv.appendChild(parameterDescription);
+ // create input element depending on dataType
+ // dataType can be string, boolean, integer, double
+ switch (parameterData.dataType) {
+ case "string":
+ // parameterDiv.appendChild(createInputAsString(parameterData));
+ processInput.inputElement = createInputAsString(parameterData);
+ break;
+ case "boolean":
+ // parameterDiv.appendChild(createInputAsBoolean(parameterData));
+ processInput.inputElement = createInputAsBoolean(parameterData);
+ break;
+ case "integer":
+ // parameterDiv.appendChild(createInputAsInteger(parameterData));
+ processInput.inputElement = createInputAsInteger(parameterData);
+ break;
+ case "double":
+ // parameterDiv.appendChild(createInputAsDouble(parameterData));
+ processInput.inputElement = createInputAsDouble(parameterData);
+ break;
+ default:
+ // parameterDiv.appendChild(createInputAsString(parameterData));
+ processInput.inputElement = createInputAsString(parameterData);
+ }
+ $scope.processInputs.push(processInput);
+ // $scope[processInput.inputElement.ngModelVariable] = processInput.parameterData.defaultValue;
+ // make a bit space after paramter
+ // parameterDiv.appendChild(document.createElement("p"));
+ // processInputFormNode.appendChild(parameterDiv);
+ });
+ // parameterNode.appendChild(parameterDiv);
+ // $scope.$digest();
+ };
+ $scope.getScriptMetadataForIndicatorId = function (indicatorId) {
+ var targetScriptMetadata;
+ for (const scriptElement of kommonitorDataExchangeService.availableProcessScripts) {
+ if (scriptElement.indicatorId === indicatorId) {
+ targetScriptMetadata = scriptElement;
+ break;
+ }
+ }
+ ;
+ return targetScriptMetadata;
+ };
+ $scope.onChangeTargetIndicator = function () {
+ if ($scope.targetIndicator) {
+ $scope.targetIndicator_backup = $scope.targetIndicator;
+ }
+ else {
+ $scope.targetIndicator = $scope.targetIndicator_backup;
+ }
+ $scope.computedCustomizedIndicatorGeoJSON = undefined;
+ $scope.resetProgressBar();
+ $scope.targetScriptMetadata = $scope.getScriptMetadataForIndicatorId($scope.targetIndicator.indicatorId);
+ buildParameterFormHtml($scope.targetScriptMetadata);
+ $scope.setupDateSliderForComputation();
+ if (!$scope.targetSpatialUnit) {
+ $scope.targetSpatialUnit = $scope.getFirstSpatialUnitForSelectedIndicator();
+ }
+ // modify guidedTour if required
+ $rootScope.$broadcast("redrawGuidedTourElement");
+ };
+ $scope.getFirstSpatialUnitForSelectedIndicator = function () {
+ var result = undefined;
+ var applicableSpatialUnits = $scope.targetIndicator.applicableSpatialUnits;
+ for (const spatialUnitEntry of kommonitorDataExchangeService.availableSpatialUnits) {
+ if (applicableSpatialUnits.some(o => o.spatialUnitName === spatialUnitEntry.spatialUnitLevel))
+ result = spatialUnitEntry;
+ break;
+ }
+ return result;
+ };
+ $scope.onChangeTargetSpatialUnit = function () {
+ $scope.computedCustomizedIndicatorGeoJSON = undefined;
+ $scope.resetProgressBar();
+ buildParameterFormHtml($scope.targetScriptMetadata);
+ $scope.setupDateSliderForComputation();
+ };
+ $scope.fetchBaseIndicatorMetadata = function (baseIndicatorId) {
+ for (const indicatorMetadata of kommonitorDataExchangeService.displayableIndicators) {
+ if (indicatorMetadata.indicatorId === baseIndicatorId)
+ return indicatorMetadata;
+ }
+ };
+ $scope.fetchGeoresourceMetadata = function (georesourceId) {
+ for (const georesourceMetadata of kommonitorDataExchangeService.availableGeoresources) {
+ if (georesourceMetadata.datasetId === georesourceId)
+ return georesourceMetadata;
+ }
+ };
+ $scope.appendDatesFromIndicatorMetadataApplicableDates = function (dates) {
+ var indicatorMetadata = $scope.fetchBaseIndicatorMetadata($scope.targetScriptMetadata.indicatorId);
+ for (const date of indicatorMetadata.applicableDates) {
+ if (!dates.includes(date))
+ dates.push(date);
+ }
+ return dates;
+ };
+ $scope.appendDatesFromBaseIndicators = function (dates) {
+ for (const baseIndicatorId of $scope.targetScriptMetadata.requiredIndicatorIds) {
+ var baseIndicator = $scope.fetchBaseIndicatorMetadata(baseIndicatorId);
+ for (const date of baseIndicator.applicableDates) {
+ if (!dates.includes(date))
+ dates.push(date);
+ }
+ }
+ return dates;
+ };
+ $scope.appendDatesFromGeoresources = function (dates) {
+ for (const georesourceId of $scope.targetScriptMetadata.requiredGeoresourceIds) {
+ var georesource = $scope.fetchGeoresourceMetadata(georesourceId);
+ for (const date of georesource.applicableDates) {
+ if (!dates.includes(date))
+ dates.push(date);
+ }
+ }
+ return dates;
+ };
+ function dateToTS(date) {
+ return date.valueOf();
+ }
+ function tsToDateString(dateAsMs) {
+ var date = new Date(dateAsMs);
+ /**
+ * TODO FIXME dateSLider formatter will return only year for now to prevent misleading month and day settings
+ */
+ // return date.getFullYear();
+ return date.toLocaleDateString("de-DE", {
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric'
+ });
+ }
+ function dateToDateString(date) {
+ /**
+ * TODO FIXME dateSLider formatter will return only year for now to prevent misleading month and day settings
+ */
+ // return date.getFullYear();
+ return date.toLocaleDateString("de-DE", {
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric'
+ });
+ }
+ function createDatesFromIndicatorDates(indicatorDates) {
+ $scope.datesAsMs = [];
+ for (var index = 0; index < indicatorDates.length; index++) {
+ // year-month-day
+ var dateComponents = indicatorDates[index].split("-");
+ $scope.datesAsMs.push(dateToTS(new Date(Number(dateComponents[0]), Number(dateComponents[1]) - 1, Number(dateComponents[2]))));
+ }
+ return $scope.datesAsMs;
+ }
+ $scope.setupDateSliderForComputation = function () {
+ if ($scope.dateSliderForComputation) {
+ $scope.dateSliderForComputation.destroy();
+ }
+ var domNode = document.getElementById("dateSliderForComputation");
+ while (domNode.hasChildNodes()) {
+ domNode.removeChild(domNode.lastChild);
+ }
+ $scope.availableDates = new Array();
+ // availableDates = $scope.appendDatesFromBaseIndicators(availableDates);
+ $scope.availableDates = $scope.appendDatesFromIndicatorMetadataApplicableDates($scope.availableDates);
+ // availableDates = $scope.appendDatesFromGeoresources(availableDates);
+ // sort ascending
+ $scope.availableDates.sort(function (a, b) {
+ return a - b;
+ });
+ $scope.date = $scope.availableDates[$scope.availableDates.length - 1];
+ $scope.targetDate = $scope.availableDates[$scope.availableDates.length - 1];
+ $scope.datesAsMs = createDatesFromIndicatorDates($scope.availableDates);
+ // new Date() uses month between 0-11!
+ $("#dateSliderForComputation").ionRangeSlider({
+ skin: "big",
+ type: "single",
+ grid: true,
+ values: $scope.datesAsMs,
+ from: $scope.datesAsMs.length - 1,
+ force_edges: true,
+ prettify: tsToDateString,
+ onChange: $scope.onChangeDateSliderItem
+ });
+ $scope.dateSliderForComputation = $("#dateSliderForComputation").data("ionRangeSlider");
+ // make sure that the handle is properly set to max value
+ $scope.dateSliderForComputation.update({
+ from: $scope.datesAsMs.length - 1 // index, not the date
+ });
+ };
+ $scope.onChangeDateSliderItem = async function (data) {
+ $scope.targetDate = $scope.availableDates[data.from];
+ $scope.date = $scope.targetDate;
+ };
+ $scope.calculateCustomIndicator = function () {
+ $scope.computationStarted = true;
+ $scope.computedCustomizedIndicatorGeoJSON = undefined;
+ $scope.jobInfoText = undefined;
+ $scope.resetProgressBar();
+ $scope.stopLoop = false;
+ console.log("calculateCustomIndicator called!");
+ $scope.loadingData = true;
+ // example request model
+ // {
+ // "targetSpatialUnitId": "targetSpatialUnitId",
+ // "scriptId": "scriptId",
+ // "customProcessProperties": [
+ // {
+ // "dataType": "string",
+ // "name": "name",
+ // "value": "customValue"
+ // },
+ // {
+ // "dataType": "string",
+ // "name": "name",
+ // "value": "customValue"
+ // }
+ // ],
+ // "targetDate": "2000-01-23",
+ // "georesourceIds": [
+ // "georesourceIds",
+ // "georesourceIds"
+ // ],
+ // "baseIndicatorIds": [
+ // "baseIndicatorIds",
+ // "baseIndicatorIds"
+ // ]
+ // }
+ var processingInput = {};
+ processingInput.targetSpatialUnitId = $scope.targetSpatialUnit.spatialUnitId;
+ processingInput.scriptId = $scope.targetScriptMetadata.scriptId;
+ processingInput.targetDate = $scope.targetDate;
+ processingInput.georesourceIds = $scope.targetScriptMetadata.requiredGeoresourceIds;
+ processingInput.baseIndicatorIds = $scope.targetScriptMetadata.requiredIndicatorIds;
+ processingInput.customProcessProperties = new Array();
+ $scope.targetScriptMetadata.variableProcessParameters.forEach(function (processParam) {
+ // now get name of parameter
+ // then seach for input element within DOM with id=name
+ // get value of that DOM element and create parameter object
+ var scriptParam = {};
+ scriptParam.name = processParam.name;
+ scriptParam.dataType = processParam.dataType;
+ scriptParam.value = document.getElementById(scriptParam.name).value;
+ processingInput.customProcessProperties.push(scriptParam);
+ });
+ console.log("created URL POST body for CUSTOM PROCESSING: " + processingInput);
+ $scope.indicatorName = $scope.targetIndicator.indicatorName;
+ $scope.spatialUnitName = $scope.targetSpatialUnit.spatialUnitLevel;
+ $scope.date = $scope.targetDate;
+ $http({
+ url: targetURL,
+ method: "POST",
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ data: processingInput
+ }).then(async function successCallback(response) {
+ // this callback will be called asynchronously
+ // when the response is available
+ console.log("success callback for customizable indicator comutation");
+ // get location header to achieve jobId
+ var jobId = response.headers('Location');
+ await sleep(300);
+ $scope.showInitialJobStatus(jobId);
+ $timeout(function () {
+ $scope.loadingData = false;
+ });
+ $scope.pendForResult(jobId);
+ // $scope.downloadGeoJSON(geoJSON_string);
+ }, function errorCallback(error) {
+ // called asynchronously if an error occurs
+ // or server returns response with an error status.
+ $scope.error = error.statusText;
+ kommonitorDataExchangeService.displayMapApplicationError(error);
+ $timeout(function () {
+ $scope.loadingData = false;
+ });
+ });
+ };
+ $scope.showInitialJobStatus = function (jobId) {
+ $http({
+ url: targetURL + "/" + jobId,
+ method: "GET"
+ }).then(function successCallback(response) {
+ // this callback will be called asynchronously
+ // when the response is available
+ console.log("success callback for showInitialJobStatus");
+ $scope.jobInfoText = "Berechnung begonnen. Siehe Fortschrittsbalken.";
+ if (response.data.progress)
+ $scope.updateProgressBar(response.data.progress);
+ }, function errorCallback(error) {
+ // called asynchronously if an error occurs
+ // or server returns response with an error status.
+ $scope.error = error.data.error;
+ kommonitorDataExchangeService.displayMapApplicationError(error);
+ $scope.loadingData = false;
+ });
+ };
+ $scope.pendForResult = async function (jobId) {
+ var sleepTimeInMS = 1000;
+ while (!$scope.computedCustomizedIndicatorGeoJSON && !$scope.stopLoop) {
+ if ($scope.stopLoop)
+ break;
+ $http({
+ url: targetURL + '/' + jobId,
+ method: "GET"
+ }).then(function successCallback(response) {
+ // this callback will be called asynchronously
+ // when the response is available
+ console.log("success callback for pendForResult");
+ if (response.data.status === "failed") {
+ $scope.error = response.data.error;
+ console.error(response.data.error);
+ $scope.stopLoop = true;
+ return;
+ }
+ if (response.data.progress)
+ $scope.updateProgressBar(response.data.progress);
+ if (response.data.progress === 100 || response.data.status === "succeeded") {
+ var geoJSON_base64 = response.data.result_geoJSON_base64;
+ // first decode Base64 and then parse string as JSON
+ $scope.computedCustomizedIndicatorGeoJSON = JSON.parse(atob(geoJSON_base64));
+ $scope.jobInfoText = undefined;
+ $scope.stopLoop = true;
+ $scope.prepareDownloadGeoJSON();
+ // $scope.$digest();
+ }
+ }, function errorCallback(error) {
+ // called asynchronously if an error occurs
+ // or server returns response with an error status.
+ $scope.error = error.data.error;
+ console.error(error.data.error);
+ kommonitorDataExchangeService.displayMapApplicationError(error);
+ $scope.stopLoop = true;
+ $scope.loadingData = false;
+ return;
+ });
+ if ($scope.computedCustomizedIndicatorGeoJSON)
+ return;
+ await sleep(sleepTimeInMS);
+ }
+ };
+ $scope.updateProgressBar = function (progress) {
+ var progressBarNode = document.getElementById("customComputationProgressBar");
+ progressBarNode.setAttribute("aria-valuenow", "" + progress);
+ progressBarNode.setAttribute("style", "width:" + progress + "%");
+ progressBarNode.textContent = progress + "% Fortschritt";
+ // $scope.progress = progress;
+ };
+ $scope.resetProgressBar = function () {
+ var progressBarNode = document.getElementById("customComputationProgressBar");
+ progressBarNode.setAttribute("aria-valuenow", "0");
+ progressBarNode.setAttribute("style", "width:0%");
+ progressBarNode.textContent = "0% Fortschritt";
+ // $scope.progress = 0;
+ };
+ $scope.addComputedIndicatorToMap = function () {
+ console.log("Adding customized indicator to map.");
+ $scope.targetIndicator.geoJSON = $scope.computedCustomizedIndicatorGeoJSON;
+ kommonitorDataExchangeService.selectedIndicator = $scope.targetIndicator;
+ // kommonitorMapService.addCustomIndicatorGeoJSON($scope.targetIndicator, $scope.targetSpatialUnit.spatialUnitLevel, $scope.targetDate);
+ kommonitorMapService.replaceIndicatorGeoJSON($scope.targetIndicator, $scope.targetSpatialUnit.spatialUnitLevel, $scope.targetDate, false, true);
+ };
+ $scope.prepareDownloadGeoJSON = function () {
+ console.log("removing old download button if available");
+ if (document.getElementById("downloadComputedIndicator"))
+ document.getElementById("downloadComputedIndicator").remove();
+ var geoJSON_string = JSON.stringify($scope.computedCustomizedIndicatorGeoJSON);
+ var fileName = $scope.indicatorName + "_" + $scope.spatialUnitName + "_" + $scope.date + "_CUSTOM.geojson";
+ // var fileName = "export.geojson"
+ // if (!geoJSON_string.match(/^data:application\/vnd.geo+json/i)) {
+ // geoJSON_string = 'data:application/vnd.geo+json;charset=utf-8,' + geoJSON_string;
+ // }
+ // data = encodeURI(geoJSON_string);
+ var blob = new Blob([geoJSON_string], { type: "application/json" });
+ var data = URL.createObjectURL(blob);
+ //
+ // $scope.indicatorDownloadURL = data;
+ // $scope.indicatorDownloadName = fileName;
+ console.log("create new Download button and append it to DOM");
+ var a = document.createElement('a');
+ a.download = fileName;
+ a.href = data;
+ a.textContent = "Download GeoJSON";
+ a.id = "downloadComputedIndicator";
+ a.setAttribute("class", "btn btn-primary");
+ document.getElementById('indicatorOutput').appendChild(a);
+ };
+ $scope.downloadGeoJSON = function () {
+ var geoJSON_string = JSON.stringify($scope.computedCustomizedIndicatorGeoJSON);
+ filename = $scope.targetIndicator.indicatorName + "_" + $scope.targetSpatialUnit.spatialUnitLevel + "_" + $scope.targetDate + "_CUSTOM.geojson";
+ if (!geoJSON_string.match(/^data:application\/vnd.geo+json/i)) {
+ geoJSON_string = 'data:application/vnd.geo+json;charset=utf-8,' + geoJSON_string;
+ }
+ data = encodeURI(geoJSON_string);
+ link = document.createElement('a');
+ link.setAttribute('href', data);
+ link.setAttribute('download', filename);
+ document.body.appendChild(link);
+ console.log("Trigger download");
+ link.click();
+ };
+ }]
+});
+//# sourceMappingURL=kommonitor-individual-indicator-computation.component.js.map
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.component.js.map b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.component.js.map
new file mode 100644
index 000000000..7fec528b3
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"kommonitor-individual-indicator-computation.component.js","sourceRoot":"","sources":["kommonitor-individual-indicator-computation.component.ts"],"names":[],"mappings":";AAAA,OAAO;KACJ,MAAM,CAAC,0CAA0C,CAAC;KAClD,SAAS,CACR,0CAA0C,EAC1C;IACC,WAAW,EAAG,0JAA0J;IACxK,UAAU,EAAG,CAAC,+BAA+B,EAAE,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAC,sBAAsB,EAAE,OAAO,EAAE,UAAU,EAAE,SAAS,kDAAkD,CACrL,6BAA6B,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,QAAQ;YAEhG,IAAI,CAAC,qCAAqC,GAAG,6BAA6B,CAAC;YAC3E,sCAAsC;YACtC,CAAC,CAAC,MAAM,CAAC,CAAC,SAAS,EAAE,CAAC;YAEtB,MAAM,SAAS,GAAG,KAAK,CAAC,2BAA2B,GAAG,gDAAgD,CAAC;YAEvG,MAAM,CAAC,WAAW,GAAG,KAAK,CAAC;YAE3B,MAAM,CAAC,eAAe,CAAC;YACvB,M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onitor-individual-indicator-computation.component.ts b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.component.ts
new file mode 100644
index 000000000..73d678b56
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.component.ts
@@ -0,0 +1,819 @@
+angular
+ .module('kommonitorIndividualIndicatorComputation')
+ .component(
+ 'kommonitorIndividualIndicatorComputation',
+ {
+ templateUrl : "components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.template.html",
+ controller : ['kommonitorDataExchangeService', '$rootScope', '$scope', '$http','kommonitorMapService', '__env', '$timeout', function kommonitorIndividualIndicatorComputationController(
+ kommonitorDataExchangeService, $rootScope, $scope, $http, kommonitorMapService, __env, $timeout) {
+
+ this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
+ // initialize any adminLTE box widgets
+ $('.box').boxWidget();
+
+ const targetURL = __env.targetUrlToProcessingEngine + "script-engine/customizableIndicatorComputation";
+
+ $scope.loadingData = false;
+
+ $scope.targetIndicator;
+ $scope.targetIndicator_backup;
+
+ $scope.indicatorNameFilter = undefined;
+
+ $scope.targetDate;
+ $scope.targetSpatialUnit;
+ $scope.targetScriptMetadata;
+ $scope.jobInfoText;
+ $scope.computedCustomizedIndicatorGeoJSON;
+ $scope.datesAsMs;
+ $scope.availableDates;
+ $scope.inputNgModels = {};
+
+ $scope.dateSliderForComputation;
+
+ $scope.filterComputableIndicators = function() {
+ return function( item ) {
+
+ // if(item.indicatorName.includes("Erreichbarkeit")){
+ // return false;
+ // }
+
+ var scriptForIndicator;
+
+ for (var script of kommonitorDataExchangeService.availableProcessScripts){
+ if (script.indicatorId === item.indicatorId){
+ scriptForIndicator = script;
+ break;
+ }
+ };
+
+ if (! script.variableProcessParameters.length > 0){
+ return false;
+ }
+
+ return true;
+ };
+ };
+
+ $scope.resetComputationForm = function(){
+
+ $scope.stopLoop = true;
+ $scope.computationStarted = false;
+
+ $scope.loadingData = false;
+
+ $scope.targetIndicator = undefined;
+ $scope.targetDate = undefined;
+ $scope.targetSpatialUnit = undefined;
+ $scope.targetScriptMetadata = undefined;
+ $scope.jobInfoText = undefined;
+ $scope.computedCustomizedIndicatorGeoJSON = undefined;
+ $scope.datesAsMs = undefined;
+ $scope.availableDates = undefined;
+ $scope.inputNgModels = {};
+ $scope.error = undefined;
+
+ if($scope.dateSliderForComputation){
+ $scope.dateSliderForComputation.destroy();
+ }
+
+ var domNode = document.getElementById("dateSliderForComputation");
+
+ while (domNode.hasChildNodes()) {
+ domNode.removeChild(domNode.lastChild);
+ }
+
+ $scope.resetProgressBar();
+ };
+
+ $scope.onTargetDateChange = function(){
+
+ $scope.computedCustomizedIndicatorGeoJSON = undefined;
+ $scope.resetProgressBar();
+
+ var date = new Date($scope.targetDate);
+
+ var month = date.getMonth()+1;
+ var day = date.getDate();
+
+ if (month < 10)
+ month = "0" + month;
+
+ if (day < 10)
+ day = "0" + day;
+
+ $scope.targetDate = date.getFullYear() + "-" + month + "-" + day;
+
+ $scope.$digest();
+ };
+
+ var updateInputDisplay = function(input){
+
+ var inputDOMElement = document.getElementById(input.parameterData.name);
+ var inputDOMLabelInput = document.getElementById(input.parameterData.name + "Label");
+
+ input.inputElement.value = inputDOMElement.value;
+ inputDOMLabelInput.value = inputDOMElement.value;
+ }
+
+ var createInputAsString = function(parameterData){
+ // {
+ // "minParameterValueForNumericInputs": 6.027456183070403,
+ // "maxParameterValueForNumericInputs": 0.8008281904610115,
+ // "defaultValue": "defaultValue",
+ // "dataType": "string",
+ // "name": "name",
+ // "description": "description"
+ // }
+
+ var inputElement = document.createElement("input");
+ inputElement.setAttribute("id", parameterData.name);
+ inputElement.setAttribute("type", "text");
+ inputElement.setAttribute("value", parameterData.defaultValue);
+ inputElement.value = parameterData.defaultValue;
+
+ return inputElement;
+ };
+
+ var createInputAsBoolean = function(parameterData){
+ // {
+ // "minParameterValueForNumericInputs": 6.027456183070403,
+ // "maxParameterValueForNumericInputs": 0.8008281904610115,
+ // "defaultValue": "defaultValue",
+ // "dataType": "string",
+ // "name": "name",
+ // "description": "description"
+ // }
+
+ var inputElement = document.createElement("input");
+ inputElement.setAttribute("id", parameterData.name);
+ inputElement.setAttribute("type", "checkbox");
+ inputElement.setAttribute("value", parameterData.name);
+
+ if(parameterData.defaultValue === 'true')
+ inputElement.setAttribute("checked", "checked");
+
+ return inputElement;
+ };
+
+ var createInputAsInteger = function(parameterData){
+ // {
+ // "minParameterValueForNumericInputs": 6.027456183070403,
+ // "maxParameterValueForNumericInputs": 0.8008281904610115,
+ // "defaultValue": "defaultValue",
+ // "dataType": "string",
+ // "name": "name",
+ // "description": "description"
+ // }
+
+ //
+
+ var inputElement = document.createElement("input");
+ inputElement.setAttribute("id", parameterData.name);
+ inputElement.setAttribute("type", "range");
+ inputElement.setAttribute("value", Number(parameterData.defaultValue));
+ inputElement.value = Number(parameterData.defaultValue);
+ // inputElement.setAttribute("class", "slider");
+ inputElement.setAttribute("min", parameterData.minParameterValueForNumericInputs);
+ inputElement.setAttribute("max", parameterData.maxParameterValueForNumericInputs);
+ inputElement.setAttribute("data-show-value", "true");
+ inputElement.setAttribute("step", "1");
+
+ return inputElement;
+ };
+
+ var createInputAsDouble = function(parameterData){
+ // {
+ // "minParameterValueForNumericInputs": 6.027456183070403,
+ // "maxParameterValueForNumericInputs": 0.8008281904610115,
+ // "defaultValue": "defaultValue",
+ // "dataType": "string",
+ // "name": "name",
+ // "description": "description"
+ // }
+
+ //
+
+ // var inputElement = document.createElement("input");
+ var inputElement = {};
+ inputElement.id = parameterData.name;
+ inputElement.type = "range";
+ inputElement.value = Number(parameterData.defaultValue);
+ // inputElement.class = "slider";
+ inputElement.min = parameterData.minParameterValueForNumericInputs;
+ inputElement.max = parameterData.maxParameterValueForNumericInputs;
+ // inputElement.dataShowValue = "true";
+ inputElement.step = "0.01";
+
+ // inputElement.ngModelVariable = parameterData.name + "Value";
+ //
+ // // inputElement.setAttribute("ng-model", parameterData.name + "Value");
+ // $scope.inputNgModels[inputElement.ngModelVariable] = Number(parameterData.defaultValue);
+
+ return inputElement;
+ };
+
+ function sleep(ms) {
+ return new Promise(resolve => setTimeout(resolve, ms));
+ }
+
+ var buildParameterFormHtml = function(targetScriptMetadata){
+
+ $scope.computedCustomizedIndicatorGeoJSON = undefined;
+ $scope.resetProgressBar();
+ $scope.inputNgModels = {};
+
+ // await sleep(1000);
+
+ // try{
+ // var processInputFormNode = document.getElementById("processInputForm");
+ // // remove old content
+ // while (processInputFormNode.firstChild) {
+ // processInputFormNode.removeChild(processInputFormNode.firstChild);
+ // }
+ // }
+ // catch(error){
+ // console.error("DOM Element with ID 'processInputForm' was not found");
+ // }
+
+
+
+ //example to create elements via code
+
+ // we must iterate over all process parameters and setup form elements for each input type
+ // e.g. sliders for range values, checkboxes for boolean
+
+ // var processInputFormNode = document.getElementById("processInputForm");
+
+ $scope.processInputs = [];
+
+ targetScriptMetadata.variableProcessParameters.forEach(function(parameterData){
+ // looks like:
+
+ // {
+ // "minParameterValueForNumericInputs": 6.027456183070403,
+ // "maxParameterValueForNumericInputs": 0.8008281904610115,
+ // "defaultValue": "defaultValue",
+ // "dataType": "string",
+ // "name": "name",
+ // "description": "description"
+ // }
+
+ // var parameterNode = document.createDocumentFragment();
+
+ var processInput = {};
+ processInput.parameterData = parameterData;
+
+ // var parameterDiv = document.createElement("div");
+ // parameterDiv.setAttribute("class", "slidecontainer");
+ //
+ // var parameterLabel = document.createElement("label");
+ // parameterLabel.appendChild(document.createTextNode(parameterData.name + ": {{" + parameterData.name + "Value}}"));
+ //
+ // var parameterDescription = document.createElement("p");
+ // parameterDescription.appendChild(document.createTextNode(parameterData.description));
+ //
+ // parameterDiv.appendChild(parameterLabel);
+ // parameterDiv.appendChild(parameterDescription);
+
+ // create input element depending on dataType
+ // dataType can be string, boolean, integer, double
+ switch(parameterData.dataType) {
+ case "string":
+ // parameterDiv.appendChild(createInputAsString(parameterData));
+ processInput.inputElement = createInputAsString(parameterData);
+ break;
+ case "boolean":
+ // parameterDiv.appendChild(createInputAsBoolean(parameterData));
+ processInput.inputElement = createInputAsBoolean(parameterData);
+ break;
+ case "integer":
+ // parameterDiv.appendChild(createInputAsInteger(parameterData));
+ processInput.inputElement = createInputAsInteger(parameterData);
+ break;
+ case "double":
+ // parameterDiv.appendChild(createInputAsDouble(parameterData));
+ processInput.inputElement = createInputAsDouble(parameterData);
+ break;
+ default:
+ // parameterDiv.appendChild(createInputAsString(parameterData));
+ processInput.inputElement = createInputAsString(parameterData);
+ }
+
+ $scope.processInputs.push(processInput);
+
+ // $scope[processInput.inputElement.ngModelVariable] = processInput.parameterData.defaultValue;
+
+ // make a bit space after paramter
+ // parameterDiv.appendChild(document.createElement("p"));
+
+ // processInputFormNode.appendChild(parameterDiv);
+ });
+
+ // parameterNode.appendChild(parameterDiv);
+
+ // $scope.$digest();
+ };
+
+ $scope.getScriptMetadataForIndicatorId = function(indicatorId){
+ var targetScriptMetadata;
+
+ for (const scriptElement of kommonitorDataExchangeService.availableProcessScripts){
+ if (scriptElement.indicatorId === indicatorId){
+ targetScriptMetadata = scriptElement;
+ break;
+ }
+ };
+
+ return targetScriptMetadata;
+ };
+
+ $scope.onChangeTargetIndicator = function(){
+
+ if($scope.targetIndicator){
+ $scope.targetIndicator_backup = $scope.targetIndicator;
+ }
+ else{
+ $scope.targetIndicator = $scope.targetIndicator_backup;
+ }
+
+ $scope.computedCustomizedIndicatorGeoJSON = undefined;
+ $scope.resetProgressBar();
+
+ $scope.targetScriptMetadata = $scope.getScriptMetadataForIndicatorId($scope.targetIndicator.indicatorId);
+
+ buildParameterFormHtml($scope.targetScriptMetadata);
+
+ $scope.setupDateSliderForComputation();
+
+ if(!$scope.targetSpatialUnit){
+ $scope.targetSpatialUnit = $scope.getFirstSpatialUnitForSelectedIndicator();
+ }
+
+ // modify guidedTour if required
+ $rootScope.$broadcast("redrawGuidedTourElement");
+
+ };
+
+ $scope.getFirstSpatialUnitForSelectedIndicator = function() {
+
+ var result = undefined;
+
+ var applicableSpatialUnits = $scope.targetIndicator.applicableSpatialUnits;
+
+ for (const spatialUnitEntry of kommonitorDataExchangeService.availableSpatialUnits){
+ if(applicableSpatialUnits.some(o => o.spatialUnitName === spatialUnitEntry.spatialUnitLevel))
+ result = spatialUnitEntry;
+ break;
+ }
+
+ return result;
+ };
+
+ $scope.onChangeTargetSpatialUnit = function(){
+
+ $scope.computedCustomizedIndicatorGeoJSON = undefined;
+ $scope.resetProgressBar();
+
+
+ buildParameterFormHtml($scope.targetScriptMetadata);
+ $scope.setupDateSliderForComputation();
+
+ };
+
+ $scope.fetchBaseIndicatorMetadata = function(baseIndicatorId){
+ for (const indicatorMetadata of kommonitorDataExchangeService.displayableIndicators){
+ if(indicatorMetadata.indicatorId === baseIndicatorId)
+ return indicatorMetadata;
+ }
+ }
+
+ $scope.fetchGeoresourceMetadata = function(georesourceId){
+ for (const georesourceMetadata of kommonitorDataExchangeService.availableGeoresources){
+ if(georesourceMetadata.datasetId === georesourceId)
+ return georesourceMetadata;
+ }
+ }
+
+ $scope.appendDatesFromIndicatorMetadataApplicableDates = function(dates){
+
+ var indicatorMetadata = $scope.fetchBaseIndicatorMetadata($scope.targetScriptMetadata.indicatorId);
+ for (const date of indicatorMetadata.applicableDates){
+ if(!dates.includes(date))
+ dates.push(date);
+ }
+
+ return dates;
+ }
+
+ $scope.appendDatesFromBaseIndicators = function(dates){
+
+ for (const baseIndicatorId of $scope.targetScriptMetadata.requiredIndicatorIds){
+ var baseIndicator = $scope.fetchBaseIndicatorMetadata(baseIndicatorId);
+ for (const date of baseIndicator.applicableDates){
+ if(!dates.includes(date))
+ dates.push(date);
+ }
+ }
+
+ return dates;
+ }
+
+ $scope.appendDatesFromGeoresources = function(dates){
+
+ for (const georesourceId of $scope.targetScriptMetadata.requiredGeoresourceIds){
+ var georesource = $scope.fetchGeoresourceMetadata(georesourceId);
+ for (const date of georesource.applicableDates){
+ if(!dates.includes(date))
+ dates.push(date);
+ }
+ }
+
+ return dates;
+ }
+
+ function dateToTS (date) {
+ return date.valueOf();
+ }
+
+ function tsToDateString (dateAsMs) {
+ var date = new Date(dateAsMs);
+
+ /**
+ * TODO FIXME dateSLider formatter will return only year for now to prevent misleading month and day settings
+ */
+
+ // return date.getFullYear();
+
+ return date.toLocaleDateString("de-DE", {
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric'
+ });
+ }
+
+ function dateToDateString (date) {
+
+ /**
+ * TODO FIXME dateSLider formatter will return only year for now to prevent misleading month and day settings
+ */
+
+ // return date.getFullYear();
+
+ return date.toLocaleDateString("de-DE", {
+ year: 'numeric',
+ month: 'long',
+ day: 'numeric'
+ });
+ }
+
+ function createDatesFromIndicatorDates(indicatorDates) {
+
+ $scope.datesAsMs = [];
+
+ for (var index=0; index < indicatorDates.length; index++){
+ // year-month-day
+ var dateComponents = indicatorDates[index].split("-");
+ $scope.datesAsMs.push(dateToTS(new Date(Number(dateComponents[0]), Number(dateComponents[1]) - 1, Number(dateComponents[2]))));
+ }
+ return $scope.datesAsMs;
+ }
+
+
+ $scope.setupDateSliderForComputation = function(){
+
+ if($scope.dateSliderForComputation){
+ $scope.dateSliderForComputation.destroy();
+ }
+
+ var domNode = document.getElementById("dateSliderForComputation");
+
+ while (domNode.hasChildNodes()) {
+ domNode.removeChild(domNode.lastChild);
+ }
+
+ $scope.availableDates = new Array();
+
+ // availableDates = $scope.appendDatesFromBaseIndicators(availableDates);
+ $scope.availableDates = $scope.appendDatesFromIndicatorMetadataApplicableDates($scope.availableDates);
+ // availableDates = $scope.appendDatesFromGeoresources(availableDates);
+
+ // sort ascending
+ $scope.availableDates.sort(function(a, b) {
+ return a - b;
+ });
+
+ $scope.date = $scope.availableDates[$scope.availableDates.length - 1];
+ $scope.targetDate = $scope.availableDates[$scope.availableDates.length - 1];
+
+ $scope.datesAsMs = createDatesFromIndicatorDates($scope.availableDates);
+
+ // new Date() uses month between 0-11!
+ $("#dateSliderForComputation").ionRangeSlider({
+ skin: "big",
+ type: "single",
+ grid: true,
+ values: $scope.datesAsMs,
+ from: $scope.datesAsMs.length -1, // index, not the date
+ force_edges: true,
+ prettify: tsToDateString,
+ onChange: $scope.onChangeDateSliderItem
+ });
+
+ $scope.dateSliderForComputation = $("#dateSliderForComputation").data("ionRangeSlider");
+ // make sure that the handle is properly set to max value
+ $scope.dateSliderForComputation.update({
+ from: $scope.datesAsMs.length -1 // index, not the date
+ });
+ };
+
+ $scope.onChangeDateSliderItem = async function(data){
+
+ $scope.targetDate = $scope.availableDates[data.from];
+ $scope.date = $scope.targetDate;
+ };
+
+
+ $scope.calculateCustomIndicator = function(){
+
+ $scope.computationStarted = true;
+
+ $scope.computedCustomizedIndicatorGeoJSON = undefined;
+ $scope.jobInfoText = undefined;
+ $scope.resetProgressBar();
+
+ $scope.stopLoop = false;
+
+ console.log("calculateCustomIndicator called!");
+
+ $scope.loadingData = true;
+ // example request model
+
+ // {
+ // "targetSpatialUnitId": "targetSpatialUnitId",
+ // "scriptId": "scriptId",
+ // "customProcessProperties": [
+ // {
+ // "dataType": "string",
+ // "name": "name",
+ // "value": "customValue"
+ // },
+ // {
+ // "dataType": "string",
+ // "name": "name",
+ // "value": "customValue"
+ // }
+ // ],
+ // "targetDate": "2000-01-23",
+ // "georesourceIds": [
+ // "georesourceIds",
+ // "georesourceIds"
+ // ],
+ // "baseIndicatorIds": [
+ // "baseIndicatorIds",
+ // "baseIndicatorIds"
+ // ]
+ // }
+
+ var processingInput = {};
+ processingInput.targetSpatialUnitId = $scope.targetSpatialUnit.spatialUnitId;
+ processingInput.scriptId = $scope.targetScriptMetadata.scriptId;
+ processingInput.targetDate = $scope.targetDate;
+ processingInput.georesourceIds = $scope.targetScriptMetadata.requiredGeoresourceIds;
+ processingInput.baseIndicatorIds = $scope.targetScriptMetadata.requiredIndicatorIds;
+ processingInput.customProcessProperties = new Array();
+
+ $scope.targetScriptMetadata.variableProcessParameters.forEach(function(processParam){
+ // now get name of parameter
+ // then seach for input element within DOM with id=name
+ // get value of that DOM element and create parameter object
+ var scriptParam = {};
+ scriptParam.name = processParam.name;
+ scriptParam.dataType = processParam.dataType;
+ scriptParam.value = document.getElementById(scriptParam.name).value;
+
+ processingInput.customProcessProperties.push(scriptParam);
+ });
+
+ console.log("created URL POST body for CUSTOM PROCESSING: " + processingInput);
+
+ $scope.indicatorName = $scope.targetIndicator.indicatorName;
+ $scope.spatialUnitName = $scope.targetSpatialUnit.spatialUnitLevel;
+ $scope.date = $scope.targetDate;
+
+ $http({
+ url: targetURL,
+ method: "POST",
+ headers: {
+ 'Content-Type': 'application/json'
+ },
+ data: processingInput
+ }).then(async function successCallback(response) {
+ // this callback will be called asynchronously
+ // when the response is available
+
+ console.log("success callback for customizable indicator comutation");
+ // get location header to achieve jobId
+ var jobId = response.headers('Location');
+
+ await sleep(300);
+
+ $scope.showInitialJobStatus(jobId);
+
+ $timeout(function(){
+
+ $scope.loadingData = false;
+ });
+
+ $scope.pendForResult(jobId);
+
+ // $scope.downloadGeoJSON(geoJSON_string);
+
+ }, function errorCallback(error) {
+ // called asynchronously if an error occurs
+ // or server returns response with an error status.
+ $scope.error = error.statusText;
+
+ kommonitorDataExchangeService.displayMapApplicationError(error);
+
+ $timeout(function(){
+
+ $scope.loadingData = false;
+ });
+ });
+
+ }
+
+ $scope.showInitialJobStatus = function(jobId){
+
+ $http({
+ url: targetURL + "/" + jobId,
+ method: "GET"
+ }).then(function successCallback(response) {
+ // this callback will be called asynchronously
+ // when the response is available
+
+ console.log("success callback for showInitialJobStatus");
+ $scope.jobInfoText = "Berechnung begonnen. Siehe Fortschrittsbalken.";
+
+ if(response.data.progress)
+ $scope.updateProgressBar(response.data.progress);
+
+ }, function errorCallback(error) {
+ // called asynchronously if an error occurs
+ // or server returns response with an error status.
+ $scope.error = error.data.error;
+
+ kommonitorDataExchangeService.displayMapApplicationError(error);
+
+ $scope.loadingData = false;
+ });
+ };
+
+ $scope.pendForResult = async function(jobId){
+
+ var sleepTimeInMS = 1000;
+
+
+ while(!$scope.computedCustomizedIndicatorGeoJSON && !$scope.stopLoop){
+
+ if($scope.stopLoop)
+ break;
+
+ $http({
+ url: targetURL + '/' + jobId,
+ method: "GET"
+ }).then(function successCallback(response) {
+ // this callback will be called asynchronously
+ // when the response is available
+
+ console.log("success callback for pendForResult");
+
+ if(response.data.status === "failed"){
+ $scope.error = response.data.error;
+ console.error(response.data.error);
+ $scope.stopLoop = true;
+ return;
+ }
+
+ if(response.data.progress)
+ $scope.updateProgressBar(response.data.progress);
+
+
+ if(response.data.progress === 100 || response.data.status === "succeeded"){
+ var geoJSON_base64 = response.data.result_geoJSON_base64;
+ // first decode Base64 and then parse string as JSON
+ $scope.computedCustomizedIndicatorGeoJSON = JSON.parse(atob(geoJSON_base64));
+ $scope.jobInfoText = undefined;
+ $scope.stopLoop = true;
+
+ $scope.prepareDownloadGeoJSON();
+
+ // $scope.$digest();
+ }
+
+ }, function errorCallback(error) {
+ // called asynchronously if an error occurs
+ // or server returns response with an error status.
+ $scope.error = error.data.error;
+ console.error(error.data.error);
+ kommonitorDataExchangeService.displayMapApplicationError(error);
+ $scope.stopLoop = true;
+ $scope.loadingData = false;
+ return;
+
+
+ });
+
+ if ($scope.computedCustomizedIndicatorGeoJSON)
+ return;
+
+ await sleep(sleepTimeInMS);
+ }
+
+ };
+
+ $scope.updateProgressBar = function(progress){
+ var progressBarNode = document.getElementById("customComputationProgressBar");
+
+ progressBarNode.setAttribute("aria-valuenow", ""+progress);
+ progressBarNode.setAttribute("style", "width:"+progress+"%");
+ progressBarNode.textContent = progress + "% Fortschritt";
+ // $scope.progress = progress;
+ };
+
+ $scope.resetProgressBar = function(){
+ var progressBarNode = document.getElementById("customComputationProgressBar");
+
+ progressBarNode.setAttribute("aria-valuenow", "0");
+ progressBarNode.setAttribute("style", "width:0%");
+ progressBarNode.textContent = "0% Fortschritt";
+ // $scope.progress = 0;
+ };
+
+ $scope.addComputedIndicatorToMap = function(){
+ console.log("Adding customized indicator to map.");
+
+ $scope.targetIndicator.geoJSON = $scope.computedCustomizedIndicatorGeoJSON;
+ kommonitorDataExchangeService.selectedIndicator = $scope.targetIndicator;
+ // kommonitorMapService.addCustomIndicatorGeoJSON($scope.targetIndicator, $scope.targetSpatialUnit.spatialUnitLevel, $scope.targetDate);
+ kommonitorMapService.replaceIndicatorGeoJSON($scope.targetIndicator, $scope.targetSpatialUnit.spatialUnitLevel, $scope.targetDate, false, true);
+ };
+
+ $scope.prepareDownloadGeoJSON = function(){
+
+ console.log("removing old download button if available")
+ if(document.getElementById("downloadComputedIndicator"))
+ document.getElementById("downloadComputedIndicator").remove();
+
+ var geoJSON_string = JSON.stringify($scope.computedCustomizedIndicatorGeoJSON);
+
+ var fileName = $scope.indicatorName + "_" + $scope.spatialUnitName + "_" + $scope.date + "_CUSTOM.geojson";
+ // var fileName = "export.geojson"
+
+ // if (!geoJSON_string.match(/^data:application\/vnd.geo+json/i)) {
+ // geoJSON_string = 'data:application/vnd.geo+json;charset=utf-8,' + geoJSON_string;
+ // }
+ // data = encodeURI(geoJSON_string);
+
+ var blob = new Blob([geoJSON_string], {type: "application/json"});
+ var data = URL.createObjectURL(blob);
+ //
+ // $scope.indicatorDownloadURL = data;
+ // $scope.indicatorDownloadName = fileName;
+
+ console.log("create new Download button and append it to DOM");
+ var a = document.createElement('a');
+ a.download = fileName;
+ a.href = data;
+ a.textContent = "Download GeoJSON";
+ a.id = "downloadComputedIndicator";
+ a.setAttribute("class", "btn btn-primary");
+
+ document.getElementById('indicatorOutput').appendChild(a);
+ }
+
+ $scope.downloadGeoJSON = function(){
+
+ var geoJSON_string = JSON.stringify($scope.computedCustomizedIndicatorGeoJSON);
+
+ filename = $scope.targetIndicator.indicatorName + "_" + $scope.targetSpatialUnit.spatialUnitLevel + "_" + $scope.targetDate + "_CUSTOM.geojson";
+
+ if (!geoJSON_string.match(/^data:application\/vnd.geo+json/i)) {
+ geoJSON_string = 'data:application/vnd.geo+json;charset=utf-8,' + geoJSON_string;
+ }
+ data = encodeURI(geoJSON_string);
+
+ link = document.createElement('a');
+ link.setAttribute('href', data);
+ link.setAttribute('download', filename);
+
+ document.body.appendChild(link);
+
+ console.log("Trigger download");
+
+ link.click();
+ }
+
+ }]
+ });
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.module.js b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.module.js
index fd566b6a8..f2b94d24c 100644
--- a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.module.js
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.module.js
@@ -1,15 +1,16 @@
+"use strict";
angular.module('kommonitorIndividualIndicatorComputation', ['kommonitorDataExchange'])
-
-.directive('stringToNumber', function() {
- return {
- require: 'ngModel',
- link: function(scope, element, attrs, ngModel) {
- ngModel.$parsers.push(function(value) {
- return parseFloat(value);
- });
- ngModel.$formatters.push(function(value) {
- return '' + value;
- });
- }
- };
+ .directive('stringToNumber', function () {
+ return {
+ require: 'ngModel',
+ link: function (scope, element, attrs, ngModel) {
+ ngModel.$parsers.push(function (value) {
+ return parseFloat(value);
+ });
+ ngModel.$formatters.push(function (value) {
+ return '' + value;
+ });
+ }
+ };
});
+//# sourceMappingURL=kommonitor-individual-indicator-computation.module.js.map
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.module.js.map b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.module.js.map
new file mode 100644
index 000000000..11677fcf9
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.module.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"kommonitor-individual-indicator-computation.module.js","sourceRoot":"","sources":["kommonitor-individual-indicator-computation.module.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,MAAM,CAAC,0CAA0C,EAAE,CAAC,wBAAwB,CAAC,CAAC;KAErF,SAAS,CAAC,gBAAgB,EAAE;IAC3B,OAAO;QACL,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,UAAS,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO;YAC3C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAS,KAAK;gBAClC,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;YACH,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,UAAS,KAAK;gBACrC,OAAO,EAAE,GAAG,KAAK,CAAC;YACpB,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.module.ts b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.module.ts
new file mode 100644
index 000000000..fd566b6a8
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorIndividualIndicatorComputation/kommonitor-individual-indicator-computation.module.ts
@@ -0,0 +1,15 @@
+angular.module('kommonitorIndividualIndicatorComputation', ['kommonitorDataExchange'])
+
+.directive('stringToNumber', function() {
+ return {
+ require: 'ngModel',
+ link: function(scope, element, attrs, ngModel) {
+ ngModel.$parsers.push(function(value) {
+ return parseFloat(value);
+ });
+ ngModel.$formatters.push(function(value) {
+ return '' + value;
+ });
+ }
+ };
+});
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.component.js b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.component.js
index 3293791f4..5836e1e7a 100644
--- a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.component.js
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.component.js
@@ -1,381 +1,300 @@
+"use strict";
angular
- .module('kommonitorLegend')
- .component(
- 'kommonitorLegend',
- {
- templateUrl : "components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.template.html",
- /*
- * injected with a modules service method that manages
- * enabled tabs
- */
- controller : ['$scope', '$rootScope', 'kommonitorMapService', 'kommonitorVisualStyleHelperService',
- 'kommonitorDataExchangeService', 'kommonitorDiagramHelperService', 'kommonitorElementVisibilityHelperService',
- 'kommonitorFilterHelperService', '__env', '$timeout', '$sce', 'kommonitorShareHelperService',
- function KommonitorLegendController($scope, $rootScope, kommonitorMapService,
- kommonitorVisualStyleHelperService, kommonitorDataExchangeService, kommonitorDiagramHelperService, kommonitorElementVisibilityHelperService,
- kommonitorFilterHelperService, __env, $timeout, $sce, kommonitorShareHelperService) {
-
- const INDICATOR_DATE_PREFIX = __env.indicatorDatePrefix;
- this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
- this.kommonitorMapServiceInstance = kommonitorMapService;
- this.kommonitorVisualStyleHelperServiceInstance = kommonitorVisualStyleHelperService;
- this.kommonitorElementVisibilityHelperServiceInstance = kommonitorElementVisibilityHelperService;
- this.kommonitorFilterHelperServiceInstance = kommonitorFilterHelperService;
- this.kommonitorShareHelperServiceInstance = kommonitorShareHelperService;
- this.envInstance = __env;
-
- this.env = __env;
- $scope.svgString_outlierLow = $sce.trustAsHtml('');
- $scope.svgString_outlierHigh = $sce.trustAsHtml('');
-
-
- // initialize any adminLTE box widgets
- $('.box').boxWidget();
-
- $rootScope.$on( "updateLegendDisplay", function(event, containsZeroValues, containsNegativeValues, containsNoData, containsOutliers_high, containsOutliers_low, outliers_low, outliers_high, selectedDate) {
- $scope.containsZeroValues = containsZeroValues;
- $scope.containsNegativeValues = containsNegativeValues;
- $scope.containsOutliers_high = containsOutliers_high;
- $scope.containsOutliers_low = containsOutliers_low;
- $scope.outliers_high = outliers_high;
- $scope.outliers_low = outliers_low;
- $scope.containsNoData = containsNoData;
- var dateComponents = selectedDate.split("-");
- $scope.dateAsDate = new Date(Number(dateComponents[0]), Number(dateComponents[1]) - 1, Number(dateComponents[2]));
-
- });
-
- $scope.onChangeIndicatorDatepickerDate = function(){
- $rootScope.$broadcast("changeIndicatorDate");
- };
-
-
- $scope.filterSpatialUnits = function(){
- return function( item ) {
- return kommonitorDataExchangeService.isAllowedSpatialUnitForCurrentIndicator(item);
- };
- };
-
- $scope.makeOutliersLowLegendString = function(outliersArray) {
- if (outliersArray.length > 1) {
-
- return "(" + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(outliersArray[0]) + " - " + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(outliersArray[outliersArray.length - 1]) + ")";
- }
- else {
- return "(" + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(outliersArray[0]) + ")";
- }
- };
-
- $scope.makeOutliersHighLegendString = function(outliersArray) {
- if (outliersArray.length > 1) {
- return "(" + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(outliersArray[0]) + " - " + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(outliersArray[outliersArray.length - 1]) + ")";
- }
- else {
- return "(" + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(outliersArray[0]) + ")";
- }
- };
-
- $scope.onChangeSelectedSpatialUnit = function(){
-
- $rootScope.$broadcast("changeSpatialUnit");
-
- if(__env.enableSpatialUnitNotificationSelection) {
- if(! (localStorage.getItem("hideKomMonitorSpatialUnitNotification") === "true")) {
- let selectedSpatialUnitName = kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
- if(__env.spatialUnitNotificationSelection.includes(selectedSpatialUnitName)) {
- $('#spatialUnitNotificationModal').modal('show');
- }
- }
- }
- };
-
-
- $scope.showSpatialUnitNotificationModalIfEnabled = function() {
- if(__env.enableSpatialUnitNotificationSelection) {
- $('#spatialUnitNotificationModal').modal('show');
- }
- }
-
- $(document).on('click', '#controlIndicatorClassifyOption_wholeTimeseries', function (e) {
- var wholeTimeseriesClassificationCheckbox = document.getElementById('controlIndicatorClassifyOption_wholeTimeseries');
- if (wholeTimeseriesClassificationCheckbox.checked) {
- kommonitorDataExchangeService.classifyUsingWholeTimeseries = true;
- }
- else {
- kommonitorDataExchangeService.classifyUsingWholeTimeseries = false;
- }
- $rootScope.$broadcast("restyleCurrentLayer", false);
- });
-
- $(document).on('input change', '#indicatorTransparencyInput', function (e) {
- e.stopImmediatePropagation();
- var indicatorMetadata = kommonitorDataExchangeService.selectedIndicator;
-
- var transparency = document.getElementById("indicatorTransparencyInput").value;
- var opacity = 1 - transparency;
-
- $rootScope.$broadcast("adjustOpacityForIndicatorLayer", indicatorMetadata, opacity);
- });
-
- $(document).on('click', '#radiojenks', function (e) {
- $rootScope.$broadcast("changeClassifyMethod", "jenks");
- });
-
- $(document).on('click', '#radioquantile', function (e) {
- $rootScope.$broadcast("changeClassifyMethod", "quantile");
- });
-
- $(document).on('click', '#radioequal_interval', function (e) {
- $rootScope.$broadcast("changeClassifyMethod", "equal_interval");
- });
-
- $scope.onClickDownloadMetadata = async function(){
- // create PDF from currently selected/displayed indicator!
- var indicatorMetadata = kommonitorDataExchangeService.selectedIndicator;
- var pdfName = indicatorMetadata.indicatorName + ".pdf";
- var jspdf = await kommonitorDataExchangeService.generateIndicatorMetadataPdf(indicatorMetadata, pdfName);
- jspdf.save(pdfName);
- };
-
- function prepareBalanceGeoJSON(geoJSON, indicatorMetadataAsBalance){
- var fromDate = indicatorMetadataAsBalance["fromDate"];
- var toDate = indicatorMetadataAsBalance["toDate"];
- var targetDate = kommonitorDataExchangeService.selectedDate;
-
- for (var feature of geoJSON.features) {
- var properties = feature.properties;
-
- var targetValue = properties[kommonitorDataExchangeService.indicatorDatePrefix + targetDate];
- properties["balance"] = targetValue;
-
- // rename all properties due to char limit in shaoefiles
- var keys = Object.keys(properties);
-
- for (var key of keys) {
- if (key.toLowerCase().includes("date_")) {
- // from DATE_2018-01-01
- // to 20180101
- delete properties[key];
- }
- }
-
- // replace properties with the one with new keys
- feature.properties = properties;
- }
-
- return geoJSON;
- }
-
- $scope.downloadIndicatorAsGeoJSON = function () {
-
- var fileName = kommonitorDataExchangeService.selectedIndicator.indicatorName + "_" + kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
-
- var geoJSON_string;
- var geoJSON;
-
- if(kommonitorDataExchangeService.isBalanceChecked){
- geoJSON = jQuery.extend(true, {}, kommonitorDataExchangeService.indicatorAndMetadataAsBalance.geoJSON);
- geoJSON = prepareBalanceGeoJSON(geoJSON, kommonitorDataExchangeService.indicatorAndMetadataAsBalance);
- geoJSON_string = JSON.stringify(geoJSON);
- fileName += "_Bilanz" + kommonitorDataExchangeService.indicatorAndMetadataAsBalance['fromDate'] + " - " + kommonitorDataExchangeService.indicatorAndMetadataAsBalance['toDate'];
- }
- else{
- geoJSON_string = JSON.stringify(kommonitorDataExchangeService.selectedIndicator.geoJSON);
- fileName += "_" + kommonitorDataExchangeService.selectedDate;
- }
-
- kommonitorDataExchangeService.generateAndDownloadIndicatorZIP(geoJSON_string, fileName, ".geojson", {});
- };
-
- $scope.downloadIndicatorAsShape = function () {
-
- var fileName = kommonitorDataExchangeService.selectedIndicator.indicatorName + "_" + kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
- var polygonName = kommonitorDataExchangeService.selectedIndicator.indicatorName + "_" + kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
-
- var options = {
- folder: "shape",
- types: {
- point: 'points',
- polygon: polygonName,
- line: 'lines'
- }
- };
-
- var geoJSON;
-
- if(kommonitorDataExchangeService.isBalanceChecked){
- geoJSON = jQuery.extend(true, {}, kommonitorDataExchangeService.indicatorAndMetadataAsBalance.geoJSON);
- geoJSON = prepareBalanceGeoJSON(geoJSON, kommonitorDataExchangeService.indicatorAndMetadataAsBalance);
- fileName += "_Bilanz_" + kommonitorDataExchangeService.indicatorAndMetadataAsBalance['fromDate'] + " - " + kommonitorDataExchangeService.indicatorAndMetadataAsBalance['toDate'];
- }
- else{
- geoJSON = jQuery.extend(true, {}, kommonitorDataExchangeService.selectedIndicator.geoJSON);
- fileName += "_" + kommonitorDataExchangeService.selectedDate;
- }
-
- for (var feature of geoJSON.features) {
- var properties = feature.properties;
-
- // rename all properties due to char limit in shaoefiles
- var keys = Object.keys(properties);
-
- for (var key of keys) {
- var newKey = undefined;
- if (key.toLowerCase().includes("featureid")) {
- newKey = "ID";
- }
- else if (key.toLowerCase().includes("featurename")) {
- newKey = "NAME";
- }
- else if (key.toLowerCase().includes("date_")) {
- // from DATE_2018-01-01
- // to 20180101
- newKey = key.split("_")[1].replace(/-|\s/g, "");
- }
- else if (key.toLowerCase().includes("startdate")) {
- newKey = "validFrom";
- }
- else if (key.toLowerCase().includes("enddate")) {
- newKey = "validTo";
- }
-
- if (newKey) {
- properties[newKey] = properties[key];
- delete properties[key];
- }
- }
-
- // replace properties with the one with new keys
- feature.properties = properties;
- }
-
- // shpwrite.download(geoJSON, options);
- var arrayBuffer = shpwrite.zip(geoJSON, options);
- kommonitorDataExchangeService.generateAndDownloadIndicatorZIP(arrayBuffer, fileName, "_shape.zip", {base64: true});
- };
-
- $scope.downloadIndicatorAsCSV = function () {
-
- var fileName = kommonitorDataExchangeService.selectedIndicator.indicatorName + "_" + kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
-
- var geoJSON;
-
- if(kommonitorDataExchangeService.isBalanceChecked){
- geoJSON = jQuery.extend(true, {}, kommonitorDataExchangeService.indicatorAndMetadataAsBalance.geoJSON);
- geoJSON = prepareBalanceGeoJSON(geoJSON, kommonitorDataExchangeService.indicatorAndMetadataAsBalance);
- fileName += "_Bilanz_" + kommonitorDataExchangeService.indicatorAndMetadataAsBalance['fromDate'] + " - " + kommonitorDataExchangeService.indicatorAndMetadataAsBalance['toDate'];
- }
- else{
- geoJSON = jQuery.extend(true, {}, kommonitorDataExchangeService.selectedIndicator.geoJSON);
- fileName += "_" + kommonitorDataExchangeService.selectedDate;
- }
-
- var items = [];
-
- for (var feature of geoJSON.features) {
- var properties = feature.properties;
-
- // rename all properties due to char limit in shaoefiles
- var keys = Object.keys(properties);
-
- for (var key of keys) {
- var newKey = undefined;
- if (key.toLowerCase().includes("featureid")) {
- newKey = "ID";
- }
- else if (key.toLowerCase().includes("featurename")) {
- newKey = "NAME";
- }
- else if (key.toLowerCase().includes("date_")) {
- // from DATE_2018-01-01
- // to 2018-01-01
- newKey = key.split("_")[1];
- }
- else if (key.toLowerCase().includes("startdate")) {
- newKey = "validFrom";
- }
- else if (key.toLowerCase().includes("enddate")) {
- newKey = "validTo";
- }
-
- if (newKey) {
- properties[newKey] = properties[key];
- delete properties[key];
- }
- }
-
- // replace properties with the one with new keys
- feature.properties = properties;
-
- items.push(properties);
- }
-
- var headers = {};
-
- for (const key in items[0]) {
- if (Object.hasOwnProperty.call(items[0], key)) {
- headers[key] = key;
- }
- }
-
- exportCSVFile(headers, items, fileName);
- };
-
- function convertToCSV(objArray) {
- var array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray;
- var str = '';
-
- for (var i = 0; i < array.length; i++) {
- var line = '';
- for (var index in array[i]) {
- if (line != '') line += ';';
-
- line += array[i][index];
- }
-
- str += line + '\r\n';
- }
-
- return str;
- }
-
- function exportCSVFile(headers, items, fileTitle) {
- if (headers) {
- items.unshift(headers);
- }
-
- // Convert Object to JSON
- var jsonObject = JSON.stringify(items);
-
- var csv = convertToCSV(jsonObject);
-
- kommonitorDataExchangeService.generateAndDownloadIndicatorZIP(csv, fileTitle, ".csv", {});
- }
-
- $scope.onClickShareLinkButton = function(){
-
- kommonitorShareHelperService.generateCurrentShareLink();
-
- /* Copy to clipboard */
- if(navigator && navigator.clipboard){
- navigator.clipboard.writeText(kommonitorShareHelperService.currentShareLink);
-
- // Get the snackbar DIV
- var x = document.getElementById("snackbar");
-
- // Add the "show" class to DIV
- x.className = "show";
-
- // After 3 seconds, remove the show class from DIV
- setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
- }
- else{
- // open in new tab
- window.open(kommonitorShareHelperService.currentShareLink, '_blank');
- }
-
- };
-
-
- }]
- });
+ .module('kommonitorLegend')
+ .component('kommonitorLegend', {
+ templateUrl: "components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.template.html",
+ /*
+ * injected with a modules service method that manages
+ * enabled tabs
+ */
+ controller: ['$scope', '$rootScope', 'kommonitorMapService', 'kommonitorVisualStyleHelperService',
+ 'kommonitorDataExchangeService', 'kommonitorDiagramHelperService', 'kommonitorElementVisibilityHelperService',
+ 'kommonitorFilterHelperService', '__env', '$timeout', '$sce', 'kommonitorShareHelperService',
+ function KommonitorLegendController($scope, $rootScope, kommonitorMapService, kommonitorVisualStyleHelperService, kommonitorDataExchangeService, kommonitorDiagramHelperService, kommonitorElementVisibilityHelperService, kommonitorFilterHelperService, __env, $timeout, $sce, kommonitorShareHelperService) {
+ const INDICATOR_DATE_PREFIX = __env.indicatorDatePrefix;
+ this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
+ this.kommonitorMapServiceInstance = kommonitorMapService;
+ this.kommonitorVisualStyleHelperServiceInstance = kommonitorVisualStyleHelperService;
+ this.kommonitorElementVisibilityHelperServiceInstance = kommonitorElementVisibilityHelperService;
+ this.kommonitorFilterHelperServiceInstance = kommonitorFilterHelperService;
+ this.kommonitorShareHelperServiceInstance = kommonitorShareHelperService;
+ this.envInstance = __env;
+ this.env = __env;
+ $scope.svgString_outlierLow = $sce.trustAsHtml('');
+ $scope.svgString_outlierHigh = $sce.trustAsHtml('');
+ // initialize any adminLTE box widgets
+ $('.box').boxWidget();
+ $rootScope.$on("updateLegendDisplay", function (event, containsZeroValues, containsNegativeValues, containsNoData, containsOutliers_high, containsOutliers_low, outliers_low, outliers_high, selectedDate) {
+ $scope.containsZeroValues = containsZeroValues;
+ $scope.containsNegativeValues = containsNegativeValues;
+ $scope.containsOutliers_high = containsOutliers_high;
+ $scope.containsOutliers_low = containsOutliers_low;
+ $scope.outliers_high = outliers_high;
+ $scope.outliers_low = outliers_low;
+ $scope.containsNoData = containsNoData;
+ var dateComponents = selectedDate.split("-");
+ $scope.dateAsDate = new Date(Number(dateComponents[0]), Number(dateComponents[1]) - 1, Number(dateComponents[2]));
+ });
+ $scope.onChangeIndicatorDatepickerDate = function () {
+ $rootScope.$broadcast("changeIndicatorDate");
+ };
+ $scope.filterSpatialUnits = function () {
+ return function (item) {
+ return kommonitorDataExchangeService.isAllowedSpatialUnitForCurrentIndicator(item);
+ };
+ };
+ $scope.makeOutliersLowLegendString = function (outliersArray) {
+ if (outliersArray.length > 1) {
+ return "(" + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(outliersArray[0]) + " - " + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(outliersArray[outliersArray.length - 1]) + ")";
+ }
+ else {
+ return "(" + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(outliersArray[0]) + ")";
+ }
+ };
+ $scope.makeOutliersHighLegendString = function (outliersArray) {
+ if (outliersArray.length > 1) {
+ return "(" + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(outliersArray[0]) + " - " + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(outliersArray[outliersArray.length - 1]) + ")";
+ }
+ else {
+ return "(" + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(outliersArray[0]) + ")";
+ }
+ };
+ $scope.onChangeSelectedSpatialUnit = function () {
+ $rootScope.$broadcast("changeSpatialUnit");
+ if (__env.enableSpatialUnitNotificationSelection) {
+ if (!(localStorage.getItem("hideKomMonitorSpatialUnitNotification") === "true")) {
+ let selectedSpatialUnitName = kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
+ if (__env.spatialUnitNotificationSelection.includes(selectedSpatialUnitName)) {
+ $('#spatialUnitNotificationModal').modal('show');
+ }
+ }
+ }
+ };
+ $scope.showSpatialUnitNotificationModalIfEnabled = function () {
+ if (__env.enableSpatialUnitNotificationSelection) {
+ $('#spatialUnitNotificationModal').modal('show');
+ }
+ };
+ $(document).on('click', '#controlIndicatorClassifyOption_wholeTimeseries', function (e) {
+ var wholeTimeseriesClassificationCheckbox = document.getElementById('controlIndicatorClassifyOption_wholeTimeseries');
+ if (wholeTimeseriesClassificationCheckbox.checked) {
+ kommonitorDataExchangeService.classifyUsingWholeTimeseries = true;
+ }
+ else {
+ kommonitorDataExchangeService.classifyUsingWholeTimeseries = false;
+ }
+ $rootScope.$broadcast("restyleCurrentLayer", false);
+ });
+ $(document).on('input change', '#indicatorTransparencyInput', function (e) {
+ e.stopImmediatePropagation();
+ var indicatorMetadata = kommonitorDataExchangeService.selectedIndicator;
+ var transparency = document.getElementById("indicatorTransparencyInput").value;
+ var opacity = 1 - transparency;
+ $rootScope.$broadcast("adjustOpacityForIndicatorLayer", indicatorMetadata, opacity);
+ });
+ $(document).on('click', '#radiojenks', function (e) {
+ $rootScope.$broadcast("changeClassifyMethod", "jenks");
+ });
+ $(document).on('click', '#radioquantile', function (e) {
+ $rootScope.$broadcast("changeClassifyMethod", "quantile");
+ });
+ $(document).on('click', '#radioequal_interval', function (e) {
+ $rootScope.$broadcast("changeClassifyMethod", "equal_interval");
+ });
+ $scope.onClickDownloadMetadata = async function () {
+ // create PDF from currently selected/displayed indicator!
+ var indicatorMetadata = kommonitorDataExchangeService.selectedIndicator;
+ var pdfName = indicatorMetadata.indicatorName + ".pdf";
+ var jspdf = await kommonitorDataExchangeService.generateIndicatorMetadataPdf(indicatorMetadata, pdfName);
+ jspdf.save(pdfName);
+ };
+ function prepareBalanceGeoJSON(geoJSON, indicatorMetadataAsBalance) {
+ var fromDate = indicatorMetadataAsBalance["fromDate"];
+ var toDate = indicatorMetadataAsBalance["toDate"];
+ var targetDate = kommonitorDataExchangeService.selectedDate;
+ for (var feature of geoJSON.features) {
+ var properties = feature.properties;
+ var targetValue = properties[kommonitorDataExchangeService.indicatorDatePrefix + targetDate];
+ properties["balance"] = targetValue;
+ // rename all properties due to char limit in shaoefiles
+ var keys = Object.keys(properties);
+ for (var key of keys) {
+ if (key.toLowerCase().includes("date_")) {
+ // from DATE_2018-01-01
+ // to 20180101
+ delete properties[key];
+ }
+ }
+ // replace properties with the one with new keys
+ feature.properties = properties;
+ }
+ return geoJSON;
+ }
+ $scope.downloadIndicatorAsGeoJSON = function () {
+ var fileName = kommonitorDataExchangeService.selectedIndicator.indicatorName + "_" + kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
+ var geoJSON_string;
+ var geoJSON;
+ if (kommonitorDataExchangeService.isBalanceChecked) {
+ geoJSON = jQuery.extend(true, {}, kommonitorDataExchangeService.indicatorAndMetadataAsBalance.geoJSON);
+ geoJSON = prepareBalanceGeoJSON(geoJSON, kommonitorDataExchangeService.indicatorAndMetadataAsBalance);
+ geoJSON_string = JSON.stringify(geoJSON);
+ fileName += "_Bilanz" + kommonitorDataExchangeService.indicatorAndMetadataAsBalance['fromDate'] + " - " + kommonitorDataExchangeService.indicatorAndMetadataAsBalance['toDate'];
+ }
+ else {
+ geoJSON_string = JSON.stringify(kommonitorDataExchangeService.selectedIndicator.geoJSON);
+ fileName += "_" + kommonitorDataExchangeService.selectedDate;
+ }
+ kommonitorDataExchangeService.generateAndDownloadIndicatorZIP(geoJSON_string, fileName, ".geojson", {});
+ };
+ $scope.downloadIndicatorAsShape = function () {
+ var fileName = kommonitorDataExchangeService.selectedIndicator.indicatorName + "_" + kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
+ var polygonName = kommonitorDataExchangeService.selectedIndicator.indicatorName + "_" + kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
+ var options = {
+ folder: "shape",
+ types: {
+ point: 'points',
+ polygon: polygonName,
+ line: 'lines'
+ }
+ };
+ var geoJSON;
+ if (kommonitorDataExchangeService.isBalanceChecked) {
+ geoJSON = jQuery.extend(true, {}, kommonitorDataExchangeService.indicatorAndMetadataAsBalance.geoJSON);
+ geoJSON = prepareBalanceGeoJSON(geoJSON, kommonitorDataExchangeService.indicatorAndMetadataAsBalance);
+ fileName += "_Bilanz_" + kommonitorDataExchangeService.indicatorAndMetadataAsBalance['fromDate'] + " - " + kommonitorDataExchangeService.indicatorAndMetadataAsBalance['toDate'];
+ }
+ else {
+ geoJSON = jQuery.extend(true, {}, kommonitorDataExchangeService.selectedIndicator.geoJSON);
+ fileName += "_" + kommonitorDataExchangeService.selectedDate;
+ }
+ for (var feature of geoJSON.features) {
+ var properties = feature.properties;
+ // rename all properties due to char limit in shaoefiles
+ var keys = Object.keys(properties);
+ for (var key of keys) {
+ var newKey = undefined;
+ if (key.toLowerCase().includes("featureid")) {
+ newKey = "ID";
+ }
+ else if (key.toLowerCase().includes("featurename")) {
+ newKey = "NAME";
+ }
+ else if (key.toLowerCase().includes("date_")) {
+ // from DATE_2018-01-01
+ // to 20180101
+ newKey = key.split("_")[1].replace(/-|\s/g, "");
+ }
+ else if (key.toLowerCase().includes("startdate")) {
+ newKey = "validFrom";
+ }
+ else if (key.toLowerCase().includes("enddate")) {
+ newKey = "validTo";
+ }
+ if (newKey) {
+ properties[newKey] = properties[key];
+ delete properties[key];
+ }
+ }
+ // replace properties with the one with new keys
+ feature.properties = properties;
+ }
+ // shpwrite.download(geoJSON, options);
+ var arrayBuffer = shpwrite.zip(geoJSON, options);
+ kommonitorDataExchangeService.generateAndDownloadIndicatorZIP(arrayBuffer, fileName, "_shape.zip", { base64: true });
+ };
+ $scope.downloadIndicatorAsCSV = function () {
+ var fileName = kommonitorDataExchangeService.selectedIndicator.indicatorName + "_" + kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
+ var geoJSON;
+ if (kommonitorDataExchangeService.isBalanceChecked) {
+ geoJSON = jQuery.extend(true, {}, kommonitorDataExchangeService.indicatorAndMetadataAsBalance.geoJSON);
+ geoJSON = prepareBalanceGeoJSON(geoJSON, kommonitorDataExchangeService.indicatorAndMetadataAsBalance);
+ fileName += "_Bilanz_" + kommonitorDataExchangeService.indicatorAndMetadataAsBalance['fromDate'] + " - " + kommonitorDataExchangeService.indicatorAndMetadataAsBalance['toDate'];
+ }
+ else {
+ geoJSON = jQuery.extend(true, {}, kommonitorDataExchangeService.selectedIndicator.geoJSON);
+ fileName += "_" + kommonitorDataExchangeService.selectedDate;
+ }
+ var items = [];
+ for (var feature of geoJSON.features) {
+ var properties = feature.properties;
+ // rename all properties due to char limit in shaoefiles
+ var keys = Object.keys(properties);
+ for (var key of keys) {
+ var newKey = undefined;
+ if (key.toLowerCase().includes("featureid")) {
+ newKey = "ID";
+ }
+ else if (key.toLowerCase().includes("featurename")) {
+ newKey = "NAME";
+ }
+ else if (key.toLowerCase().includes("date_")) {
+ // from DATE_2018-01-01
+ // to 2018-01-01
+ newKey = key.split("_")[1];
+ }
+ else if (key.toLowerCase().includes("startdate")) {
+ newKey = "validFrom";
+ }
+ else if (key.toLowerCase().includes("enddate")) {
+ newKey = "validTo";
+ }
+ if (newKey) {
+ properties[newKey] = properties[key];
+ delete properties[key];
+ }
+ }
+ // replace properties with the one with new keys
+ feature.properties = properties;
+ items.push(properties);
+ }
+ var headers = {};
+ for (const key in items[0]) {
+ if (Object.hasOwnProperty.call(items[0], key)) {
+ headers[key] = key;
+ }
+ }
+ exportCSVFile(headers, items, fileName);
+ };
+ function convertToCSV(objArray) {
+ var array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray;
+ var str = '';
+ for (var i = 0; i < array.length; i++) {
+ var line = '';
+ for (var index in array[i]) {
+ if (line != '')
+ line += ';';
+ line += array[i][index];
+ }
+ str += line + '\r\n';
+ }
+ return str;
+ }
+ function exportCSVFile(headers, items, fileTitle) {
+ if (headers) {
+ items.unshift(headers);
+ }
+ // Convert Object to JSON
+ var jsonObject = JSON.stringify(items);
+ var csv = convertToCSV(jsonObject);
+ kommonitorDataExchangeService.generateAndDownloadIndicatorZIP(csv, fileTitle, ".csv", {});
+ }
+ $scope.onClickShareLinkButton = function () {
+ kommonitorShareHelperService.generateCurrentShareLink();
+ /* Copy to clipboard */
+ if (navigator && navigator.clipboard) {
+ navigator.clipboard.writeText(kommonitorShareHelperService.currentShareLink);
+ // Get the snackbar DIV
+ var x = document.getElementById("snackbar");
+ // Add the "show" class to DIV
+ x.className = "show";
+ // After 3 seconds, remove the show class from DIV
+ setTimeout(function () { x.className = x.className.replace("show", ""); }, 3000);
+ }
+ else {
+ // open in new tab
+ window.open(kommonitorShareHelperService.currentShareLink, '_blank');
+ }
+ };
+ }]
+});
+//# sourceMappingURL=kommonitor-legend.component.js.map
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.component.js.map b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.component.js.map
new file mode 100644
index 000000000..f14186c05
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.component.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"kommonitor-legend.component.js","sourceRoot":"","sources":["kommonitor-legend.component.ts"],"names":[],"mappings":";AAAA,OAAO;KACJ,MAAM,CAAC,kBAAkB,CAAC;KAC1B,SAAS,CACR,kBAAkB,EAClB;IACC,WAAW,EAAG,wGAAwG;IACtH;;;OAGG;IACH,UAAU,EAAG,CAAC,QAAQ,EAAE,YAAY,EAAE,sBAAsB,EAAE,oCAAoC;QAClG,+BAA+B,EAAE,gCAAgC,EAAE,0CAA0C;QAC7G,+BAA+B,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,8BAA8B;QAC5F,SAAS,0BAA0B,CAAC,MAAM,EAAE,UAAU,EAAE,oBAAoB,EAC3E,kCAAkC,EAAE,6BAA6B,EAAE,8BAA8B,EAAE,wCAAwC,EAC3I,6BAA6B,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,4BAA4B;YAElF,MAAM,qBAAqB,GAAG,KAAK,CAAC,mBAAmB,CAAC;YACxD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CAAC"}
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.component.ts b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.component.ts
new file mode 100644
index 000000000..3293791f4
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.component.ts
@@ -0,0 +1,381 @@
+angular
+ .module('kommonitorLegend')
+ .component(
+ 'kommonitorLegend',
+ {
+ templateUrl : "components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.template.html",
+ /*
+ * injected with a modules service method that manages
+ * enabled tabs
+ */
+ controller : ['$scope', '$rootScope', 'kommonitorMapService', 'kommonitorVisualStyleHelperService',
+ 'kommonitorDataExchangeService', 'kommonitorDiagramHelperService', 'kommonitorElementVisibilityHelperService',
+ 'kommonitorFilterHelperService', '__env', '$timeout', '$sce', 'kommonitorShareHelperService',
+ function KommonitorLegendController($scope, $rootScope, kommonitorMapService,
+ kommonitorVisualStyleHelperService, kommonitorDataExchangeService, kommonitorDiagramHelperService, kommonitorElementVisibilityHelperService,
+ kommonitorFilterHelperService, __env, $timeout, $sce, kommonitorShareHelperService) {
+
+ const INDICATOR_DATE_PREFIX = __env.indicatorDatePrefix;
+ this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
+ this.kommonitorMapServiceInstance = kommonitorMapService;
+ this.kommonitorVisualStyleHelperServiceInstance = kommonitorVisualStyleHelperService;
+ this.kommonitorElementVisibilityHelperServiceInstance = kommonitorElementVisibilityHelperService;
+ this.kommonitorFilterHelperServiceInstance = kommonitorFilterHelperService;
+ this.kommonitorShareHelperServiceInstance = kommonitorShareHelperService;
+ this.envInstance = __env;
+
+ this.env = __env;
+ $scope.svgString_outlierLow = $sce.trustAsHtml('');
+ $scope.svgString_outlierHigh = $sce.trustAsHtml('');
+
+
+ // initialize any adminLTE box widgets
+ $('.box').boxWidget();
+
+ $rootScope.$on( "updateLegendDisplay", function(event, containsZeroValues, containsNegativeValues, containsNoData, containsOutliers_high, containsOutliers_low, outliers_low, outliers_high, selectedDate) {
+ $scope.containsZeroValues = containsZeroValues;
+ $scope.containsNegativeValues = containsNegativeValues;
+ $scope.containsOutliers_high = containsOutliers_high;
+ $scope.containsOutliers_low = containsOutliers_low;
+ $scope.outliers_high = outliers_high;
+ $scope.outliers_low = outliers_low;
+ $scope.containsNoData = containsNoData;
+ var dateComponents = selectedDate.split("-");
+ $scope.dateAsDate = new Date(Number(dateComponents[0]), Number(dateComponents[1]) - 1, Number(dateComponents[2]));
+
+ });
+
+ $scope.onChangeIndicatorDatepickerDate = function(){
+ $rootScope.$broadcast("changeIndicatorDate");
+ };
+
+
+ $scope.filterSpatialUnits = function(){
+ return function( item ) {
+ return kommonitorDataExchangeService.isAllowedSpatialUnitForCurrentIndicator(item);
+ };
+ };
+
+ $scope.makeOutliersLowLegendString = function(outliersArray) {
+ if (outliersArray.length > 1) {
+
+ return "(" + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(outliersArray[0]) + " - " + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(outliersArray[outliersArray.length - 1]) + ")";
+ }
+ else {
+ return "(" + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(outliersArray[0]) + ")";
+ }
+ };
+
+ $scope.makeOutliersHighLegendString = function(outliersArray) {
+ if (outliersArray.length > 1) {
+ return "(" + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(outliersArray[0]) + " - " + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(outliersArray[outliersArray.length - 1]) + ")";
+ }
+ else {
+ return "(" + kommonitorDataExchangeService.getIndicatorValue_asFormattedText(outliersArray[0]) + ")";
+ }
+ };
+
+ $scope.onChangeSelectedSpatialUnit = function(){
+
+ $rootScope.$broadcast("changeSpatialUnit");
+
+ if(__env.enableSpatialUnitNotificationSelection) {
+ if(! (localStorage.getItem("hideKomMonitorSpatialUnitNotification") === "true")) {
+ let selectedSpatialUnitName = kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
+ if(__env.spatialUnitNotificationSelection.includes(selectedSpatialUnitName)) {
+ $('#spatialUnitNotificationModal').modal('show');
+ }
+ }
+ }
+ };
+
+
+ $scope.showSpatialUnitNotificationModalIfEnabled = function() {
+ if(__env.enableSpatialUnitNotificationSelection) {
+ $('#spatialUnitNotificationModal').modal('show');
+ }
+ }
+
+ $(document).on('click', '#controlIndicatorClassifyOption_wholeTimeseries', function (e) {
+ var wholeTimeseriesClassificationCheckbox = document.getElementById('controlIndicatorClassifyOption_wholeTimeseries');
+ if (wholeTimeseriesClassificationCheckbox.checked) {
+ kommonitorDataExchangeService.classifyUsingWholeTimeseries = true;
+ }
+ else {
+ kommonitorDataExchangeService.classifyUsingWholeTimeseries = false;
+ }
+ $rootScope.$broadcast("restyleCurrentLayer", false);
+ });
+
+ $(document).on('input change', '#indicatorTransparencyInput', function (e) {
+ e.stopImmediatePropagation();
+ var indicatorMetadata = kommonitorDataExchangeService.selectedIndicator;
+
+ var transparency = document.getElementById("indicatorTransparencyInput").value;
+ var opacity = 1 - transparency;
+
+ $rootScope.$broadcast("adjustOpacityForIndicatorLayer", indicatorMetadata, opacity);
+ });
+
+ $(document).on('click', '#radiojenks', function (e) {
+ $rootScope.$broadcast("changeClassifyMethod", "jenks");
+ });
+
+ $(document).on('click', '#radioquantile', function (e) {
+ $rootScope.$broadcast("changeClassifyMethod", "quantile");
+ });
+
+ $(document).on('click', '#radioequal_interval', function (e) {
+ $rootScope.$broadcast("changeClassifyMethod", "equal_interval");
+ });
+
+ $scope.onClickDownloadMetadata = async function(){
+ // create PDF from currently selected/displayed indicator!
+ var indicatorMetadata = kommonitorDataExchangeService.selectedIndicator;
+ var pdfName = indicatorMetadata.indicatorName + ".pdf";
+ var jspdf = await kommonitorDataExchangeService.generateIndicatorMetadataPdf(indicatorMetadata, pdfName);
+ jspdf.save(pdfName);
+ };
+
+ function prepareBalanceGeoJSON(geoJSON, indicatorMetadataAsBalance){
+ var fromDate = indicatorMetadataAsBalance["fromDate"];
+ var toDate = indicatorMetadataAsBalance["toDate"];
+ var targetDate = kommonitorDataExchangeService.selectedDate;
+
+ for (var feature of geoJSON.features) {
+ var properties = feature.properties;
+
+ var targetValue = properties[kommonitorDataExchangeService.indicatorDatePrefix + targetDate];
+ properties["balance"] = targetValue;
+
+ // rename all properties due to char limit in shaoefiles
+ var keys = Object.keys(properties);
+
+ for (var key of keys) {
+ if (key.toLowerCase().includes("date_")) {
+ // from DATE_2018-01-01
+ // to 20180101
+ delete properties[key];
+ }
+ }
+
+ // replace properties with the one with new keys
+ feature.properties = properties;
+ }
+
+ return geoJSON;
+ }
+
+ $scope.downloadIndicatorAsGeoJSON = function () {
+
+ var fileName = kommonitorDataExchangeService.selectedIndicator.indicatorName + "_" + kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
+
+ var geoJSON_string;
+ var geoJSON;
+
+ if(kommonitorDataExchangeService.isBalanceChecked){
+ geoJSON = jQuery.extend(true, {}, kommonitorDataExchangeService.indicatorAndMetadataAsBalance.geoJSON);
+ geoJSON = prepareBalanceGeoJSON(geoJSON, kommonitorDataExchangeService.indicatorAndMetadataAsBalance);
+ geoJSON_string = JSON.stringify(geoJSON);
+ fileName += "_Bilanz" + kommonitorDataExchangeService.indicatorAndMetadataAsBalance['fromDate'] + " - " + kommonitorDataExchangeService.indicatorAndMetadataAsBalance['toDate'];
+ }
+ else{
+ geoJSON_string = JSON.stringify(kommonitorDataExchangeService.selectedIndicator.geoJSON);
+ fileName += "_" + kommonitorDataExchangeService.selectedDate;
+ }
+
+ kommonitorDataExchangeService.generateAndDownloadIndicatorZIP(geoJSON_string, fileName, ".geojson", {});
+ };
+
+ $scope.downloadIndicatorAsShape = function () {
+
+ var fileName = kommonitorDataExchangeService.selectedIndicator.indicatorName + "_" + kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
+ var polygonName = kommonitorDataExchangeService.selectedIndicator.indicatorName + "_" + kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
+
+ var options = {
+ folder: "shape",
+ types: {
+ point: 'points',
+ polygon: polygonName,
+ line: 'lines'
+ }
+ };
+
+ var geoJSON;
+
+ if(kommonitorDataExchangeService.isBalanceChecked){
+ geoJSON = jQuery.extend(true, {}, kommonitorDataExchangeService.indicatorAndMetadataAsBalance.geoJSON);
+ geoJSON = prepareBalanceGeoJSON(geoJSON, kommonitorDataExchangeService.indicatorAndMetadataAsBalance);
+ fileName += "_Bilanz_" + kommonitorDataExchangeService.indicatorAndMetadataAsBalance['fromDate'] + " - " + kommonitorDataExchangeService.indicatorAndMetadataAsBalance['toDate'];
+ }
+ else{
+ geoJSON = jQuery.extend(true, {}, kommonitorDataExchangeService.selectedIndicator.geoJSON);
+ fileName += "_" + kommonitorDataExchangeService.selectedDate;
+ }
+
+ for (var feature of geoJSON.features) {
+ var properties = feature.properties;
+
+ // rename all properties due to char limit in shaoefiles
+ var keys = Object.keys(properties);
+
+ for (var key of keys) {
+ var newKey = undefined;
+ if (key.toLowerCase().includes("featureid")) {
+ newKey = "ID";
+ }
+ else if (key.toLowerCase().includes("featurename")) {
+ newKey = "NAME";
+ }
+ else if (key.toLowerCase().includes("date_")) {
+ // from DATE_2018-01-01
+ // to 20180101
+ newKey = key.split("_")[1].replace(/-|\s/g, "");
+ }
+ else if (key.toLowerCase().includes("startdate")) {
+ newKey = "validFrom";
+ }
+ else if (key.toLowerCase().includes("enddate")) {
+ newKey = "validTo";
+ }
+
+ if (newKey) {
+ properties[newKey] = properties[key];
+ delete properties[key];
+ }
+ }
+
+ // replace properties with the one with new keys
+ feature.properties = properties;
+ }
+
+ // shpwrite.download(geoJSON, options);
+ var arrayBuffer = shpwrite.zip(geoJSON, options);
+ kommonitorDataExchangeService.generateAndDownloadIndicatorZIP(arrayBuffer, fileName, "_shape.zip", {base64: true});
+ };
+
+ $scope.downloadIndicatorAsCSV = function () {
+
+ var fileName = kommonitorDataExchangeService.selectedIndicator.indicatorName + "_" + kommonitorDataExchangeService.selectedSpatialUnit.spatialUnitLevel;
+
+ var geoJSON;
+
+ if(kommonitorDataExchangeService.isBalanceChecked){
+ geoJSON = jQuery.extend(true, {}, kommonitorDataExchangeService.indicatorAndMetadataAsBalance.geoJSON);
+ geoJSON = prepareBalanceGeoJSON(geoJSON, kommonitorDataExchangeService.indicatorAndMetadataAsBalance);
+ fileName += "_Bilanz_" + kommonitorDataExchangeService.indicatorAndMetadataAsBalance['fromDate'] + " - " + kommonitorDataExchangeService.indicatorAndMetadataAsBalance['toDate'];
+ }
+ else{
+ geoJSON = jQuery.extend(true, {}, kommonitorDataExchangeService.selectedIndicator.geoJSON);
+ fileName += "_" + kommonitorDataExchangeService.selectedDate;
+ }
+
+ var items = [];
+
+ for (var feature of geoJSON.features) {
+ var properties = feature.properties;
+
+ // rename all properties due to char limit in shaoefiles
+ var keys = Object.keys(properties);
+
+ for (var key of keys) {
+ var newKey = undefined;
+ if (key.toLowerCase().includes("featureid")) {
+ newKey = "ID";
+ }
+ else if (key.toLowerCase().includes("featurename")) {
+ newKey = "NAME";
+ }
+ else if (key.toLowerCase().includes("date_")) {
+ // from DATE_2018-01-01
+ // to 2018-01-01
+ newKey = key.split("_")[1];
+ }
+ else if (key.toLowerCase().includes("startdate")) {
+ newKey = "validFrom";
+ }
+ else if (key.toLowerCase().includes("enddate")) {
+ newKey = "validTo";
+ }
+
+ if (newKey) {
+ properties[newKey] = properties[key];
+ delete properties[key];
+ }
+ }
+
+ // replace properties with the one with new keys
+ feature.properties = properties;
+
+ items.push(properties);
+ }
+
+ var headers = {};
+
+ for (const key in items[0]) {
+ if (Object.hasOwnProperty.call(items[0], key)) {
+ headers[key] = key;
+ }
+ }
+
+ exportCSVFile(headers, items, fileName);
+ };
+
+ function convertToCSV(objArray) {
+ var array = typeof objArray != 'object' ? JSON.parse(objArray) : objArray;
+ var str = '';
+
+ for (var i = 0; i < array.length; i++) {
+ var line = '';
+ for (var index in array[i]) {
+ if (line != '') line += ';';
+
+ line += array[i][index];
+ }
+
+ str += line + '\r\n';
+ }
+
+ return str;
+ }
+
+ function exportCSVFile(headers, items, fileTitle) {
+ if (headers) {
+ items.unshift(headers);
+ }
+
+ // Convert Object to JSON
+ var jsonObject = JSON.stringify(items);
+
+ var csv = convertToCSV(jsonObject);
+
+ kommonitorDataExchangeService.generateAndDownloadIndicatorZIP(csv, fileTitle, ".csv", {});
+ }
+
+ $scope.onClickShareLinkButton = function(){
+
+ kommonitorShareHelperService.generateCurrentShareLink();
+
+ /* Copy to clipboard */
+ if(navigator && navigator.clipboard){
+ navigator.clipboard.writeText(kommonitorShareHelperService.currentShareLink);
+
+ // Get the snackbar DIV
+ var x = document.getElementById("snackbar");
+
+ // Add the "show" class to DIV
+ x.className = "show";
+
+ // After 3 seconds, remove the show class from DIV
+ setTimeout(function(){ x.className = x.className.replace("show", ""); }, 3000);
+ }
+ else{
+ // open in new tab
+ window.open(kommonitorShareHelperService.currentShareLink, '_blank');
+ }
+
+ };
+
+
+ }]
+ });
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.module.js b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.module.js
index 03eb82c2f..a4b58e645 100644
--- a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.module.js
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.module.js
@@ -1,16 +1,17 @@
+"use strict";
angular.module('kommonitorLegend', ['kommonitorDataExchange', 'kommonitorDiagramHelper', 'kommonitorVisualStyleHelper',
-'kommonitorMap', 'kommonitorElementVisibilityHelper', 'kommonitorFilterHelper', 'kommonitorShareHelper'])
-
-.directive('stringToNumber', function() {
- return {
- require: 'ngModel',
- link: function(scope, element, attrs, ngModel) {
- ngModel.$parsers.push(function(value) {
- return '' + value;
- });
- ngModel.$formatters.push(function(value) {
- return parseFloat(value);
- });
- }
- };
+ 'kommonitorMap', 'kommonitorElementVisibilityHelper', 'kommonitorFilterHelper', 'kommonitorShareHelper'])
+ .directive('stringToNumber', function () {
+ return {
+ require: 'ngModel',
+ link: function (scope, element, attrs, ngModel) {
+ ngModel.$parsers.push(function (value) {
+ return '' + value;
+ });
+ ngModel.$formatters.push(function (value) {
+ return parseFloat(value);
+ });
+ }
+ };
});
+//# sourceMappingURL=kommonitor-legend.module.js.map
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.module.js.map b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.module.js.map
new file mode 100644
index 000000000..a10472dce
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.module.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"kommonitor-legend.module.js","sourceRoot":"","sources":["kommonitor-legend.module.ts"],"names":[],"mappings":";AAAA,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,CAAC,wBAAwB,EAAE,yBAAyB,EAAE,6BAA6B;IACtH,eAAe,EAAE,mCAAmC,EAAE,wBAAwB,EAAE,uBAAuB,CAAC,CAAC;KAExG,SAAS,CAAC,gBAAgB,EAAE;IAC3B,OAAO;QACL,OAAO,EAAE,SAAS;QAClB,IAAI,EAAE,UAAS,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO;YAC3C,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,UAAS,KAAK;gBAClC,OAAO,EAAE,GAAG,KAAK,CAAC;YACpB,CAAC,CAAC,CAAC;YACH,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,UAAS,KAAK;gBACrC,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;QACL,CAAC;KACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
\ No newline at end of file
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.module.ts b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.module.ts
new file mode 100644
index 000000000..03eb82c2f
--- /dev/null
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorLegend/kommonitor-legend.module.ts
@@ -0,0 +1,16 @@
+angular.module('kommonitorLegend', ['kommonitorDataExchange', 'kommonitorDiagramHelper', 'kommonitorVisualStyleHelper',
+'kommonitorMap', 'kommonitorElementVisibilityHelper', 'kommonitorFilterHelper', 'kommonitorShareHelper'])
+
+.directive('stringToNumber', function() {
+ return {
+ require: 'ngModel',
+ link: function(scope, element, attrs, ngModel) {
+ ngModel.$parsers.push(function(value) {
+ return '' + value;
+ });
+ ngModel.$formatters.push(function(value) {
+ return parseFloat(value);
+ });
+ }
+ };
+});
diff --git a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorReachability/kommonitor-reachability.component.js b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorReachability/kommonitor-reachability.component.js
index e9b726c6a..996d381cd 100644
--- a/app/components/kommonitorUserInterface/kommonitorControls/kommonitorReachability/kommonitor-reachability.component.js
+++ b/app/components/kommonitorUserInterface/kommonitorControls/kommonitorReachability/kommonitor-reachability.component.js
@@ -1,1817 +1,1436 @@
+"use strict";
angular
- .module('kommonitorReachability')
- .component(
- 'kommonitorReachability', {
- templateUrl: 'components/kommonitorUserInterface/kommonitorControls/kommonitorReachability/kommonitor-reachability.template.html',
- /*
- * injected with a modules service method that manages
- * enabled tabs
- */
- controller: [
- '$scope',
- '$rootScope',
- '$http',
- '$timeout',
- 'kommonitorMapService',
- 'kommonitorDataExchangeService',
- 'kommonitorDiagramHelperService',
- '__env',
- /**
- * TODO
- */
- function kommonitorReachabilityController($scope,
- $rootScope, $http, $timeout, kommonitorMapService,
- kommonitorDataExchangeService, kommonitorDiagramHelperService,__env) {
-
- //$("[data-toggle=tooltip]").tooltip();
-
- $scope.isUsedInReporting = false;
-
- // initialize any adminLTE box widgets
- $('.box').boxWidget();
-
- let input = document.getElementById("isochroneCutInput");
- input.addEventListener("keypress", function isInputAllowed(evt) {
- var code = (evt.keyCode ? evt.keyCode : evt.which);
- if (code == 8) { //Backspace key press
- return true;
- } else {
- var ch = String.fromCharCode(evt.which);
- if (!(/[0-9,]/.test(ch))) {
- evt.preventDefault();
- }
- }
- });
-
-
-
- var OpenStreetMapProvider = window.GeoSearch.OpenStreetMapProvider;
-
- $scope.openStreetMapProvider = new OpenStreetMapProvider(
- {
- params: {
- 'accept-language': 'de', // render results in Dutch
- countrycodes: 'de', // limit search results to the Netherlands
- addressdetails: 1, // include additional address detail parts
- viewbox: "" + (Number(__env.initialLongitude) - 0.001) + "," + (Number(__env.initialLatitude) - 0.001) + "," + (Number(__env.initialLongitude) + 0.001) + "," + (Number(__env.initialLatitude) + 0.001)
- },
- searchUrl: __env.targetUrlToGeocoderService + '/search',
- reverseUrl: __env.targetUrlToGeocoderService + '/reverse'
- }
- );
-
- const INDICATOR_DATE_PREFIX = __env.indicatorDatePrefix;
- this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
- this.kommonitorDiagramHelperServiceInstance = kommonitorDiagramHelperService;
- this.kommonitorMapServiceInstance = kommonitorMapService;
- $scope.targetUrlToReachabilityService_ORS = __env.targetUrlToReachabilityService_ORS;
- var numberOfDecimals = __env.numberOfDecimals;
-
- $scope.currentIsochronesGeoJSON = undefined;
- $scope.currentRouteGeoJSON = undefined;
- $scope.error = undefined;
-
- $scope.echartsInstances_reachabilityAnalysis = new Map();
-
- /**
- * a delay object for geosearch input
- */
- $scope.delay = undefined;
-
- $scope.geosearchResults_startingPoint;
- $scope.geosearchResults_endPoint;
-
- $scope.settings = {};
-
- $scope.settings.usePreconfigRanges_500_1000 = false;
-
- $scope.settings.dateSelectionType_valueIndicator = "date_indicator";
- $scope.settings.dateSelectionType_valueManual = "date_manual";
- $scope.settings.dateSelectionType_valuePerDataset = "date_perDataset";
- $scope.settings.dateSelectionType = {
- selectedDateType: $scope.settings.dateSelectionType_valuePerDataset
- };
-
- $scope.settings.selectedDate_manual = undefined;
-
- $scope.settings.isochroneConfig = {};
- $scope.settings.isochroneConfig.dateSelectionType_valueIndicator = "date_indicator";
- $scope.settings.isochroneConfig.dateSelectionType_valueManual = "date_manual";
- $scope.settings.isochroneConfig.dateSelectionType_valuePerDataset = "date_perDataset";
- $scope.settings.isochroneConfig.dateSelectionType = {
- selectedDateType: $scope.settings.isochroneConfig.dateSelectionType_valuePerDataset
- };
-
- $scope.settings.isochroneConfig.selectedDate_manual = undefined;
- $('#manualDateDatepicker_reachabilityAnalysis').datepicker(kommonitorDataExchangeService.datePickerOptions);
- $('#manualDateDatepicker_reachabilityConfig').datepicker(kommonitorDataExchangeService.datePickerOptions);
-
-
- $scope.routeDistance_km = undefined;
- $scope.routeDuration_minutes = undefined;
-
-
- /**
- * Show the isochrone-calculation-div if this
- * value is set to 'true', if the value is set
- * to 'false' the routing between different
- * points shall be displayed.
- */
- $scope.showIsochrones = true;
-
- $scope.settings.dissolveIsochrones = true;
-
- /**
- * TODO : Folgende drei Variablen werden fuer den
- * Produktivbetrieb eigentlich nicht benoetigt,
- * oder?
- */
- $scope.locationsArray = [[7.049869894,51.42055331]];
-
- /**
- * Values used in the GUI (initial).
- */
- $scope.latitudeStart = 51.42055331;
- $scope.longitudeStart = 7.049869894;
- $scope.latitudeEnd = 51.42055331+0.05;
- $scope.longitudeEnd = 7.049869894+0.05;
- $scope.settings.routingStartPointInput = undefined;
- $scope.settings.routingEndPointInput = undefined;
-
- /**
- * The range array (for isochrone calculation)
- * prefilled with dummy-values. TODO : Werte und
- * Variable behalten, oder im Grunde dann nicht
- * mehr benoetigt?
- */
- $scope.rangeArray = [300, 600, 900];
-
- /**
- * Variable to save the keywords used by the
- * routing API. Valid values are:
- * driving-car
- * driving-hgv // LKW
- * cycling-regular
- * cycling-road
- * cycling-safe
- * cycling-mountain
- * cycling-tour
- * cycling-electric
- * foot-walking
- * foot-hiking
- * wheelchair
- */
- $scope.settings.transitMode = 'buffer';
-
- /**
- * The focus of the analysis. Valid values are:
- * 'distance' and 'time'. TODO : Starke
- * Ueberschneidung mit der Variablen 'focus',
- * die im Grunde genau das gleiche speichert.
- */
- $scope.settings.focus = 'distance';
-
- /**
- * config of starting points source (layer or manual draw) for isochrones
- */
- $scope.settings.startPointsSource = "fromLayer";
-
- /**
- * selected start point layer for isochrone computation
- * GeoJSON within property .geoJSON
- */
- $scope.settings.selectedStartPointLayer = undefined;
-
- /**
- * start points that were drawn manually
- * direct GeoJSON structure
- */
- $scope.manualStartPoints = undefined;
-
- /**
- * indicator wheather the isochrone point source is configured
- */
- $scope.pointSourceConfigured = false;
-
- /**
- * The analysis speed (for the current vehicle)
- * in km/h.
- */
- $scope.settings.speedInKilometersPerHour = 3;
-
- /**
- * Indicator if multiple starting-points shall
- * be used.
- */
- $scope.useMultipleStartPoints = false;
-
- /**
- * Flag indicating if data is loading /
- * calculations are in progress. Used to set the
- * GUI on 'standby' until the progress is
- * completed.
- */
- $scope.settings.loadingData = false;
-
- /**
- * The calculation unit-indicator.
- */
- $scope.unit = 'Meter';
-
- /**
- * Stores the minimal speed in km/h for the
- * currently chosen vehicle.
- */
- $scope.minSpeedInKilometersPerHour = 3;
-
- /**
- * Stores the maximum speed in km/h for the
- * currently chosen vehicle.
- */
- $scope.maxSpeedInKilometersPerHour = 6;
-
- /**
- * The maximum distance or time for the current
- * vehicle. The unit of the stored value can be
- * found in the variable 'unit'.
- */
- $scope.max_value = 5000;
-
- /**
- * The current time-or-distance value of the
- * analysis. The unit of the stored value can be
- * found in the variable 'unit'. This value
- * represents value of the slider in the GUI and
- * handed to the routing API.
- */
- $scope.settings.currentTODValue = 1;
-
- /**
- * Variable that stores 'true' if the speed-selection
- * shall be shown or 'false' if not.
- */
- $scope.isTime = false;
-
- /**
- * Specifies the route preference.
- *
- * Allowed values are:
- * - "fastest"
- * - "shortest"
- * - "recommended"
- */
- $scope.settings.preference = "fastest";
-
- /*
- * array of arrays of lon, lat
- * [[lon,lat],[lon,lat]]
- */
- $scope.locationsArray = [];
-
- $scope.settings.isochroneInput = undefined;
-
- /**
- * TODO
- */
- var isochronesGETParameter = 'profile=foot-walking&units=m&location_type=start&locations=7.268504,51.448405&range_type=time&range=300,600,900&attributes=area|reachfactor&options={"maximum_speed":3}';
-
- /**
- * TODO
- */
- var createRoutingRequest = function(transitMode, preference, routingStartPointInput, routingEndPointInput){
- var locString = routingStartPointInput+'%7C'+routingEndPointInput;
-
- // if user never clicked transit mode set standard
- if(transitMode === "buffer"){
- transitMode = "foot-walking";
- }
-
- // var getRequest = $scope.targetUrlToReachabilityService_ORS
- // + '/routes?'
- // + 'coordinates=' + locString
- // + '&profile='+transitMode
- // + '&preference='+preference
- // + '&units='+'km'
- // + '&language='+'de'
- // + '&format='+'geojson'
- // + '&instructions='+'true'
- // + '&instructions_format='+'html'
- // + '&maneuvers='+'true'
- // + '&attributes='+'avgspeed'
- // + '&elevation='+'true';
-
- //console.log(getRequest);
-
- var getRequest = $scope.targetUrlToReachabilityService_ORS
- + '/v2/directions/' + transitMode + '?'
- + 'start=' + routingStartPointInput
- + '&end=' + routingEndPointInput;
-
- return getRequest;
- }
-
- /**
- * TODO
- */
- var createORSIsochroneRequestBody = function (locationsArray, rangeArray) {
- let body = {
- "locations": [],
- "range": [],
- "attributes": ["reachfactor", "area"],
- "location_type": "start",
- "range_type": $scope.settings.focus,
- "smoothing": 0,
- "area_units": "km",
- "units": "m"
- };
-
- for (var index = 0; index < locationsArray.length; index++) {
- // element looks like
- // [longitude,latitude]
- let point = [locationsArray[index][0], locationsArray[index][1]];
- body.locations.push(point);
- };
-
- for (var i = 0; i < rangeArray.length; i++) {
- var cValue = rangeArray[i];
-
- // CALCULATE SECONDS FROM MINUTE VALUES IF TIME-ANALYSIS IS WANTED
- if($scope.settings.focus=='time'){
- cValue = cValue*60;
- }
-
- body.range.push(cValue);
- };
-
- return body;
- };
-
- // If the reporting modal is shown we want to integrate this component there.
- // A couple of modifications need to be done to achieve that.
- // These are controlled by setting a variable and checking it when needed.
- $('#reporting-modal').on('hidden.bs.modal', function (e) {
- $scope.isUsedInReporting = false;
- $scope.$digest();
- })
-
- $scope.$on("reportingPoiLayerSelected", function(event, data) {
- $scope.isUsedInReporting = true;
- $scope.settings.selectedStartPointLayer = data;
- $scope.pointSourceConfigured = true; // timestamp selection is hidden, so we are good to go for now.
- $scope.$digest();
- });
-
-
- $scope.resetPoisInIsochrone = function(){
- $scope.echartsInstances_reachabilityAnalysis = new Map();
- document.getElementById("reachability_diagrams_section").innerHTML = "";
- for (var poi of kommonitorDataExchangeService.availableGeoresources){
- if (poi.isSelected_reachabilityAnalysis){
- poi.isSelected_reachabilityAnalysis = false;
- //remove POI layer from map
- $scope.removePoiLayerFromMap(poi);
- }
- }
- };
-
- $scope.resetForm = function(){
- $scope.resetSlider();
-
- $scope.resetPoisInIsochrone();
-
- $scope.error = undefined;
-
- $scope.settings = {};
-
- $scope.settings = {};
-
- $scope.settings.usePreconfigRanges_500_1000 = false;
-
- $scope.settings.dateSelectionType_valueIndicator = "date_indicator";
- $scope.settings.dateSelectionType_valueManual = "date_manual";
- $scope.settings.dateSelectionType_valuePerDataset = "date_perDataset";
- $scope.settings.dateSelectionType = {
- selectedDateType: $scope.settings.dateSelectionType_valuePerDataset
- };
-
- $scope.settings.selectedDate_manual = undefined;
-
- $scope.settings.isochroneConfig = {};
- $scope.settings.isochroneConfig.dateSelectionType_valueIndicator = "date_indicator";
- $scope.settings.isochroneConfig.dateSelectionType_valueManual = "date_manual";
- $scope.settings.isochroneConfig.dateSelectionType_valuePerDataset = "date_perDataset";
- $scope.settings.isochroneConfig.dateSelectionType = {
- selectedDateType: $scope.settings.isochroneConfig.dateSelectionType_valuePerDataset
- };
-
- $scope.settings.isochroneConfig.selectedDate_manual = undefined;
-
- $scope.showIsochrones = true;
- $scope.settings.dissolveIsochrones = true;
- document.getElementById("btn_isochrones").click();
- $scope.settings.transitMode = 'buffer';
- document.getElementById("optBuffer").click();
- $scope.settings.focus = 'distance';
- document.getElementById("focus_distance").click();
- $scope.settings.startPointsSource = "fromLayer";
- $scope.changeStartPointsSource_fromLayer();
- document.getElementById("startPointsSource_layer").click();
- $scope.settings.selectedStartPointLayer = undefined;
- $scope.pointSourceConfigured = false;
- $scope.settings.speedInKilometersPerHour = 3;
- $scope.useMultipleStartPoints = false;
- $scope.settings.loadingData = false;
- $scope.unit = 'Meter';
- $scope.settings.currentTODValue = 1;
- $scope.isTime = false;
- $scope.settings.preference = "fastest";
- $scope.locationsArray = [];
-
- $scope.rangeArray = [];
-
- $scope.removePotentialDrawnStartingPoints();
-
- $scope.routeDistance_km = undefined;
- $scope.routeDuration_minutes = undefined;
-
- $scope.currentIsochronesGeoJSON = undefined;
- $scope.currentRouteGeoJSON = undefined;
- $scope.error = undefined;
-
- $scope.geosearchResults_startingPoint;
- $scope.geosearchResults_endPoint;
-
- $scope.routingStartPoint = undefined;
- $scope.routingEndPoint = undefined;
-
- $scope.settings.routingStartPointInput = undefined;
- $scope.settings.routingEndPointInput = undefined;
-
- setTimeout(function(){
- $scope.$digest();
- }, 200);
- };
-
- $scope.removePotentialDrawnStartingPoints = function(){
- // TODO
- $scope.manualStartPoints = undefined;
- $scope.disablePointDrawTool();
- $scope.removeAllDrawnPoints();
- };
-
- /**
- * TODO
- */
- $scope.removeReachabilityLayers = function() {
- $scope.settings.loadingData = true;
- $rootScope
- .$broadcast('showLoadingIconOnMap');
-
- kommonitorMapService
- .removeReachabilityLayers();
- $scope.currentIsochronesGeoJSON = undefined;
- kommonitorDataExchangeService.isochroneLegend = undefined;
- // remove any diagram
- $scope.resetPoisInIsochrone();
- $scope.settings.loadingData = false;
- $rootScope
- .$broadcast('hideLoadingIconOnMap');
- };
-
- $scope.removeRoutingLayers = function() {
- $scope.settings.loadingData = true;
- $rootScope
- .$broadcast('showLoadingIconOnMap');
-
- kommonitorMapService
- .removeRoutingLayers();
- $scope.currentRouteGeoJSON = undefined;
- kommonitorDataExchangeService.routingLegend = undefined;
- $scope.settings.loadingData = false;
- $rootScope
- .$broadcast('hideLoadingIconOnMap');
- };
-
- /**
- * TODO
- */
- $scope.prepareDownloadGeoJSON = function() {
-
- if($scope.currentIsochronesGeoJSON){
- $scope.prepareIsochroneDownload();
- }
- if($scope.currentRouteGeoJSON){
- $scope.prepareRouteDownload();
- }
-
- };
-
- $scope.prepareIsochroneDownload = function(){
- console.log('removing old download button if available')
- if (document
- .getElementById('downloadReachabilityIsochrones'))
- document
- .getElementById(
- 'downloadReachabilityIsochrones')
- .remove();
-
- var geoJSON_string = JSON
- .stringify($scope.currentIsochronesGeoJSON);
-
- var fileName = 'Erreichbarkeitsisochronen_via-' +
- $scope.settings.transitMode +
- '_Abbruchkriterium-' +
- $scope.settings.focus + '.geojson';
-
- var blob = new Blob([geoJSON_string], {
- type: 'application/json'
- });
- var data = URL.createObjectURL(blob);
-
- console.log('create new Download button and append it to DOM');
- var a = document.createElement('a');
- a.download = fileName;
- a.href = data;
- a.textContent = 'Download Isochronen als GeoJSON';
- a.id = 'downloadReachabilityIsochrones';
- a.setAttribute('class', 'btn btn-info');
-
- let elements = document.getElementsByClassName(
- 'reachabilityIsochroneButtonSection');
-
- for (const element of elements) {
- element.appendChild(a);
- }
- };
-
- $scope.prepareRouteDownload = function(){
- console.log('removing old download button if available')
- if (document
- .getElementById('downloadReachabilityRoute'))
- document
- .getElementById(
- 'downloadReachabilityRoute')
- .remove();
-
- var geoJSON_string = JSON
- .stringify($scope.currentRouteGeoJSON);
-
- var fileName = 'Routing-Ergebnis.geojson';
-
- var blob = new Blob([geoJSON_string], {
- type: 'application/json'
- });
- var data = URL.createObjectURL(blob);
-
- console.log('create new Download button and append it to DOM');
- var a = document.createElement('a');
- a.download = fileName;
- a.href = data;
- a.textContent = 'Download Route als GeoJSON';
- a.id = 'downloadReachabilityRoute';
- a.setAttribute('class', 'btn btn-info');
-
- let elements = document.getElementsByClassName(
- 'reachabilityRouteButtonSection');
-
- for (const element of elements) {
- element.appendChild(a);
- }
- };
-
- /**
- * Dummy function.
- */
- $scope.TODO = function() {
- alert('Funktion wurde noch nicht implementiert!');
- };
-
- /**
- * Changes the focus of the analysis between
- * distance and time.
- */
- $scope.changeFocus = function(value) {
-
- if(value === 'time' && $scope.settings.transitMode === "buffer") {
- $scope.settings.focus = 'distance'
- $scope.isTime=false;
- $scope.unit = 'Meter';
- $scope.changeValues();
- return;
- }
-
- $scope.resetSlider();
-
- if ($scope.settings.focus=='distance'){
- $scope.isTime=false;
- $scope.unit = 'Meter';
- }
- else if ($scope.settings.focus=='time'){
- $scope.unit = 'Minuten';
- $scope.isTime=true;
- }
-
- $scope.changeMinMaxSpeed();
- $scope.changeValues();
- };
-
- /**
- * Changes the start points source of the analysis between
- * fromLayer and manualDraw.
- */
- $scope.changeStartPointsSource_fromLayer = function() {
-
- $scope.disablePointDrawTool();
- $scope.settings.startPointsSource = "fromLayer";
-
- };
- $scope.changeStartPointsSource_manual = function() {
-
- $scope.enablePointDrawTool();
- $scope.settings.startPointsSource = "manual";
-
- };
-
- $scope.removeAllDrawnPoints = function(){
- // TODO
-
- $rootScope.$broadcast("removeAllDrawnPoints");
- };
-
- $scope.enablePointDrawTool = function(){
- // add/activate leaflet-draw toolbar for only POINT features
-
- $rootScope.$broadcast("enablePointDrawTool");
- };
-
- $scope.disablePointDrawTool = function(){
- // disable/hide leaflet-draw toolbar for only POINT features
- $rootScope.$broadcast("disablePointDrawTool");
- };
-
- $scope.$on("onUpdateDrawnPointFeatures", function (event, drawnPointsFeatureGroup) {
-
- // if drawnPointsFeatureGroup is empty or does not exist, we must catch that
- try{
- $scope.manualStartPoints = drawnPointsFeatureGroup.toGeoJSON();
- $scope.pointSourceConfigured = true;
- }
- catch (error){
- $scope.manualStartPoints = undefined;
- $scope.pointSourceConfigured = false;
- }
-
- setTimeout(function(){
- $scope.$digest();
- }, 150);
- });
-
-
- /**
- * Resets the slider for the distance-/time and
- * speed to initial values.
- */
- $scope.resetSlider = function() {
- $scope.settings.speedInKilometersPerHour = $scope.minSpeedInKilometersPerHour;
- $scope.settings.currentTODValue = 1;
- };
-
- /**
- * Changes the vehicle type according to an
- * action on the related buttons.
- */
- $scope.changeType = function() {
- $scope.changeValues();
- $scope.changeMinMaxSpeed();
- $scope.resetSlider();
- };
-
- /**
- * Changes the max_value depending on the
- * selected vehicle type.
- */
- $scope.changeValues = function() {
- if ($scope.settings.transitMode == 'buffer'){
- $scope.settings.focus = 'distance';
- $("#focus_distance").click();
- if ($scope.settings.focus == 'distance')
- $scope.max_value = 5000;
- else
- $scope.max_value = 25;
- }
-
- if ($scope.settings.transitMode == 'foot-walking'){
- if ($scope.settings.focus == 'distance')
- $scope.max_value = 5000;
- else
- $scope.max_value = 25;
- }
-
-
- if ($scope.settings.transitMode == 'cycling-regular'){
- if ($scope.settings.focus == 'distance')
- $scope.max_value = 5000;
- else
- $scope.max_value = 20;
- }
-
-
- if ($scope.settings.transitMode == 'driving-car'){
- if ($scope.settings.focus == 'distance')
- $scope.max_value = 5000;
- else
- $scope.max_value = 15;
- }
-
- if ($scope.settings.transitMode == 'wheelchair'){
- if ($scope.settings.focus == 'distance')
- $scope.max_value = 5000;
- else
- $scope.max_value = 25;
- }
-
- };
-
- /**
- * Changes the minimum and maximum
- * speed-per-hour value depending on the current
- * selected vehicle type.
- */
- $scope.changeMinMaxSpeed = function() {
- if ($scope.settings.transitMode == 'buffer') {
- $scope.minSpeedInKilometersPerHour = 1;
- $scope.maxSpeedInKilometersPerHour = 6;
- }
- if ($scope.settings.transitMode == 'foot-walking') {
- $scope.minSpeedInKilometersPerHour = 1;
- $scope.maxSpeedInKilometersPerHour = 6;
- }
- if ($scope.settings.transitMode == 'cycling-regular') {
- $scope.minSpeedInKilometersPerHour = 10;
- $scope.maxSpeedInKilometersPerHour = 25;
- }
- if ($scope.settings.transitMode == 'driving-car') {
- $scope.minSpeedInKilometersPerHour = 30;
- $scope.maxSpeedInKilometersPerHour = 130;
- }
- if ($scope.settings.transitMode == 'wheelchair') {
- $scope.minSpeedInKilometersPerHour = 1;
- $scope.maxSpeedInKilometersPerHour = 6;
- }
-
- $scope.settings.speedInKilometersPerHour = $scope.minSpeedInKilometersPerHour;
- };
-
- /**
- * Checks the input-textfield for the
- * isochrone-distance-array for validity.
- * Extracts the text value of the textfield,
- * splits it at every ',' and writes the values
- * into the array of desired distances. Adds the
- * analysis distance at the end of the array so
- * the whole distance of the analysis will be
- * covered by isochones.
- */
- $scope.checkArrayInput = function() {
- $scope.rangeArray = [];
- var split = $scope.settings.isochroneInput.split(',');
- var actVal;
- if (split.length > 0) {
- for (var a = 0; a < split.length; a++) {
- if (!isNaN(split[a])) {
- actVal = parseFloat(split[a]);
- if (!isNaN(actVal))
- $scope.rangeArray
- .push(actVal);
- }
- }
- }
-
- $scope.rangeArray.sort(function(a, b){return a-b;});
- };
-
- /**
- * Changes variables so the isochrone-calculation-elements will be shown.
- */
- $scope.showIso = function() {
- $scope.showIsochrones = true;
- };
-
- /**
- * Changes variables so the routing-calculation-elements will be shown.
- */
- $scope.showRouting = function() {
- $scope.showIsochrones = false;
- // force active setting of transit mode foot-walking when changing to routing mode
- $scope.settings.transitMode = "foot-walking";
- document.getElementById("optFeet").click();
- document.getElementById("optFeetRadioButtonLabel").classList.add('active');
- $timeout(function(){
- $scope.$digest();
- });
- };
-
- $scope.onClickPerDataset_isochroneConfig = function(){
- $timeout(function(){
- if(! $scope.settings.isochroneConfig.selectedDate){
- $scope.settings.isochroneConfig.selectedDate = $scope.settings.selectedStartPointLayer.availablePeriodsOfValidity[$scope.settings.selectedStartPointLayer.availablePeriodsOfValidity.length - 1];
- }
- if(!$scope.isUsedInReporting) {
- $scope.fetchGeoJSONForIsochrones();
- }
- }, 500);
- };
-
- $scope.fetchGeoJSONForIsochrones = async function(){
- if(! $scope.settings.selectedStartPointLayer){
- $scope.settings.loadingData = false;
- return;
- }
-
- // clear any previous results
- $scope.settings.selectedStartPointLayer.geoJSON = undefined;
-
- var date;
-
- if($scope.settings.isochroneConfig.dateSelectionType.selectedDateType === $scope.settings.isochroneConfig.dateSelectionType_valuePerDataset){
- date = $scope.settings.isochroneConfig.selectedDate.startDate;
- }
- else if($scope.settings.isochroneConfig.dateSelectionType.selectedDateType === $scope.settings.isochroneConfig.dateSelectionType_valueManual){
- date = $scope.settings.isochroneConfig.selectedDate_manual;
- }
- else{
- date = kommonitorDataExchangeService.selectedDate;
- }
-
- if(! date){
- $scope.settings.loadingData = false;
- return;
- }
-
-
- $scope.settings.loadingData = true;
- var id = $scope.settings.selectedStartPointLayer.georesourceId;
-
- var dateComps = date.split("-");
-
- var year = dateComps[0];
- var month = dateComps[1];
- var day = dateComps[2];
-
- await $http({
- url: kommonitorDataExchangeService.getBaseUrlToKomMonitorDataAPI_spatialResource() + "/georesources/" + id + "/" + year + "/" + month + "/" + day,
- method: "GET"
- }).then(function successCallback(response) {
- // this callback will be called asynchronously
- // when the response is available
- var geoJSON = response.data;
-
- $scope.settings.selectedStartPointLayer.geoJSON = geoJSON;
-
- $scope.settings.loadingData = false;
- $scope.pointSourceConfigured = true;
-
- }, function errorCallback(error) {
- // called asynchronously if an error occurs
- // or server returns response with an error status.
- $scope.pointSourceConfigured = false;
- $scope.settings.loadingData = false;
- console.error(error.statusText);
- kommonitorDataExchangeService.displayMapApplicationError(error);
- $scope.error = error.statusText;
- });
- };
-
- $scope.onChangeSelectedStartPointLayer = async function(){
- $scope.settings.isochroneConfig.selectedDate = undefined;
-
- if(! $scope.settings.isochroneConfig.selectedDate){
- $scope.settings.isochroneConfig.selectedDate = $scope.settings.selectedStartPointLayer.availablePeriodsOfValidity[$scope.settings.selectedStartPointLayer.availablePeriodsOfValidity.length - 1];
- }
-
- if(!$scope.isUsedInReporting) {
- $scope.fetchGeoJSONForIsochrones();
- }
- };
-
- /**
- * Starts the analysis. This function is fired
- * when the related button is pushed.
- *
- * Depending on the current selection of the
- * calculation-task the function
- * 'startRoutingAnalysis' or
- * 'startIsochroneCalculation' will be
- * triggered.
- *
- * The values from the input-elements are all
- * up-to-date and saved in the variables
- * accessible via the scope. The request URL
- * will be build by this values and send towards
- * the routing-API. The result will be handled,
- * stored in the related scope- variables and
- * displayed in the KM GUI.
- *
- * If this method is fired from within the reporting modal
- * ($scope.isUsedInReporting = true) the result is not added to the main map,
- * but returned to the reporting component per broadcast.
- */
- $scope.startAnalysis = function() {
-
- $timeout(function(){
- // Any code in here will automatically have an $scope.apply() run afterwards
- if(!$scope.isUsedInReporting) { // reporting uses it's own loading overlay, which is controlled there
- $scope.settings.loadingData = true;
- $rootScope.$broadcast("showLoadingIconOnMap");
- }
- // And it just works!
- }, 50);
-
- $timeout(function(){
- $scope.error = undefined;
-
- if ($scope.showIsochrones)
- $scope.startIsochroneCalculation();
- else
- $scope.startRoutingCalculation();
- }, 150);
-
- };
-
- /**
- * Starts the routing-calculation.
- */
- $scope.startRoutingCalculation = function() {
-
- $scope.settings.loadingData = true;
- $rootScope.$broadcast("showLoadingIconOnMap");
- var startPointString = $scope.routingStartPoint.longitude + "," + $scope.routingStartPoint.latitude;
- var endPointString = $scope.routingEndPoint.longitude + "," + $scope.routingEndPoint.latitude;
-
- var url = createRoutingRequest($scope.settings.transitMode, $scope.settings.preference, startPointString, endPointString);
- // let coordinatesArray = [];
- // coordinatesArray.push(startPointString);
- // coordinatesArray.push(endPointString);
- // let postBody = {
- // "coordinates": coordinatesArray
- // };
- // let url = $scope.targetUrlToReachabilityService_ORS
- // + '/v2/directions/' + $scope.settings.transitMode + '/geojson';
-
- console.log("execute OpenRouteService routing request: " + url);
-
- var req = {
- method: 'GET',
- url: url,
- headers: {
- // 'Accept': 'application/json'
- }
- };
-
- $http(req)
- // $http.post(url, postBody)
- .then(
- function successCallback(
- response) {
- $scope.currentRouteGeoJSON = response.data;
-
- $scope.routeDistance_km = $scope.currentRouteGeoJSON.features[0].properties.summary.distance / 1000;
- $scope.routeDuration_minutes = Math.round($scope.currentRouteGeoJSON.features[0].properties.summary.duration / 60);
-
-
- // TODO : CDB
- kommonitorMapService
- .replaceRouteGeoJSON(
- $scope.currentRouteGeoJSON,
- $scope.settings.transitMode,
- $scope.settings.preference, $scope.routingStartPoint, $scope.routingEndPoint,
- $scope.routeDistance_km, $scope.routeDuration_minutes);
- $scope.prepareDownloadGeoJSON();
- $scope.settings.loadingData = false;
- $rootScope.$broadcast('hideLoadingIconOnMap');
- },
- function errorCallback(
- error) {
- // called asynchronously
- // if an error occurs
- // or server returns
- // response with an
- // error status.
- console.error(error.data.error.message);
- $scope.error = error.data.error.message;
-
- $scope.settings.loadingData = false;
- kommonitorDataExchangeService.displayMapApplicationError(error);
- $rootScope.$broadcast("hideLoadingIconOnMap");
- });
- };
-
- $scope.makeLocationsArrayFromStartPoints = function(){
- // array of arrays of lon,lat
- $scope.locationsArray = [];
-
- if($scope.settings.startPointsSource === "manual"){
- // establish from drawn points
- $scope.manualStartPoints.features.forEach(function(feature){
- $scope.locationsArray.push(feature.geometry.coordinates);
- });
- }
- else{
- // establish from chosen layer
- $scope.settings.selectedStartPointLayer.geoJSON.features.forEach(function(feature){
- $scope.locationsArray.push(feature.geometry.coordinates);
- });
- }
-
- return $scope.locationsArray;
- };
-
- /**
- * Starts an isochrone-calculation.
- */
- $scope.startIsochroneCalculation = async function() {
- if(!$scope.isUsedInReporting) { // reporting uses it's own loading overlay, which is controlled there
- $scope.settings.loadingData = true;
- $rootScope.$broadcast("showLoadingIconOnMap");
- } else {
- $scope.$emit("reportingIsochronesCalculationStarted");
- }
-
- $scope.checkArrayInput();
-
- $scope.locationsArray = $scope.makeLocationsArrayFromStartPoints();
-
- // SWITCH THE VALUE DEPENDING ON THE LENGTH
- // OF THE LOCATIONS ARRAY
- if ($scope.locationsArray.length > 1)
- $scope.useMultipleStartPoints = true;
- else
- $scope.useMultipleStartPoints = false;
-
- var resultIsochrones;
-
- if($scope.settings.transitMode === 'buffer'){
- resultIsochrones = await $scope.createBuffers();
- }
- else{
- resultIsochrones = await $scope.createIsochrones();
- }
-
- if($scope.isUsedInReporting) {
- // No need to add isochrones to main map.
- // Instead they are returned to reporting modal
- $scope.$emit("reportingIsochronesCalculationFinished", resultIsochrones)
- return;
- }
-
- $scope.currentIsochronesGeoJSON = resultIsochrones;
-
-
- kommonitorMapService.replaceIsochroneMarker($scope.locationsArray);
- kommonitorMapService
- .replaceIsochroneGeoJSON(
- $scope.currentIsochronesGeoJSON,
- $scope.settings.transitMode,
- $scope.settings.focus,
- $scope.rangeArray,
- $scope.useMultipleStartPoints,
- $scope.settings.dissolveIsochrones,
- $scope.settings.speedInKilometersPerHour);
- $scope
- .prepareDownloadGeoJSON();
-
- $scope.settings.loadingData = false;
- $timeout(function(){
- $rootScope.$broadcast('hideLoadingIconOnMap');
- }, 500);
-
-
- $scope.$digest();
- };
-
-
-
- $scope.fetchIsochrones = async function(tempStartPointsArray){
- var body = createORSIsochroneRequestBody(
- tempStartPointsArray,
- $scope.rangeArray);
-
- let url = $scope.targetUrlToReachabilityService_ORS +
- '/v2/isochrones/' + $scope.settings.transitMode;
-
- var req = {
- method: 'POST',
- url: url,
- data: body,
- headers: {
- // 'Accept': 'application/json',
- "Content-Type": 'application/json'
- }
- };
-
- return await $http(req)
- .then(
- function successCallback(
- response) {
- // this callback will
- // becalled
- // asynchronously
- // when the response is
- // available
-
- // dissolve features
- if ($scope.settings.dissolveIsochrones){
- try {
- var dissolved = turf.dissolve(response.data, {propertyName: 'value'});
- return dissolved;
- } catch (e) {
- console.error("Dissolving Isochrones failed with error: " + e);
- console.error("Will return undissolved isochrones");
- return response.data;
- } finally {
-
- }
-
- }
- else{
- return response.data;
- }
-
- },
- function errorCallback(
- error) {
- // called asynchronously
- // if an error occurs
- // or server returns
- // response with an
- // error status.
- console.error(error.data.error.message);
- $scope.error = error.data.error.message;
- $scope.settings.loadingData = false;
- kommonitorDataExchangeService.displayMapApplicationError(error);
- $rootScope.$broadcast("hideLoadingIconOnMap");
- });
- };
-
- $scope.createBuffers = function(){
- var resultIsochrones;
-
- var startingPoints_geoJSON;
- // create Buffers for each input and range definition
- if($scope.settings.startPointsSource === "manual"){
- // establish from drawn points
- startingPoints_geoJSON = $scope.manualStartPoints;
- }
- else{
- // establish from chosen layer
- startingPoints_geoJSON = $scope.settings.selectedStartPointLayer.geoJSON;
- }
-
- // range in meters
- for (const range of $scope.rangeArray) {
- var geoJSON_buffered = turf.buffer(startingPoints_geoJSON, Number(range)/1000, {units: 'kilometers', steps: 12});
-
- if(! geoJSON_buffered.features){
- // transform single feature to featureCollection
- geoJSON_buffered = turf.featureCollection([
- geoJSON_buffered
- ]);
- }
-
- if ($scope.settings.dissolveIsochrones){
- try {
- geoJSON_buffered = turf.dissolve(geoJSON_buffered);
- } catch (e) {
- console.error("Dissolving Isochrones failed with error: " + e);
- console.error("Will return undissolved isochrones");
- } finally {
-
- }
-
- }
-
- // add property: value --> range
- if (geoJSON_buffered.features && geoJSON_buffered.features.length > 0){
- for (const feature of geoJSON_buffered.features) {
- feature.properties.value = range;
- }
- }
-
- if(! resultIsochrones){
- resultIsochrones = geoJSON_buffered;
- }
- else{
- resultIsochrones.features = resultIsochrones.features.concat(geoJSON_buffered.features);
- }
- }
-
- return resultIsochrones;
- };
-
- $scope.createIsochrones = async function(){
- var resultIsochrones;
-
- console.log('Calculating isochrones for ' +
- $scope.locationsArray.length +
- ' start points.');
-
- var maxLocationsForORSRequest = 400;
-
- var featureIndex = 0;
- // log progress for each 10% of features
- var logProgressIndexSeparator = Math.round($scope.locationsArray.length / 100 * 10);
-
- var countFeatures = 0;
- var tempStartPointsArray = [];
- for (var pointIndex=0; pointIndex < $scope.locationsArray.length; pointIndex++){
- tempStartPointsArray.push($scope.locationsArray[pointIndex]);
- countFeatures++;
-
- // if maxNumber of locations is reached or the last starting point is reached
- if(countFeatures === maxLocationsForORSRequest || pointIndex === $scope.locationsArray.length -1){
- // make request, collect results
-
- // responses will be GeoJSON FeatureCollections
- var tempIsochrones = await $scope.fetchIsochrones(tempStartPointsArray);
-
- if (! resultIsochrones){
- resultIsochrones = tempIsochrones;
- }
- else{
- // apend results of tempIsochrones to resultIsochrones
- resultIsochrones.features = resultIsochrones.features.concat(tempIsochrones.features);
- }
- // increment featureIndex
- featureIndex++;
- if(featureIndex % logProgressIndexSeparator === 0){
- console.log("PROGRESS: Computed isochrones for '" + featureIndex + "' of total '" + $scope.locationsArray.length + "' starting points.");
- }
-
- // reset temp vars
- tempStartPointsArray = [];
- countFeatures = 0;
-
- } // end if
- } // end for
-
- return resultIsochrones;
-
- };
-
- $scope.onChangeRoutingStartPoint = function(){
-
- // Clear the timeout if it has already been set.
- // This will prevent the previous task from executing
- // if it has been less than
- clearTimeout($scope.delay);
-
- $scope.geosearchResults_startingPoint = undefined;
-
- // Make a new timeout set to go off in 800ms
- $scope.delay = setTimeout(function () {
- console.log('Geosearch for Input String: ', $scope.settings.routingStartPointInput);
-
- $scope.openStreetMapProvider.search({ query: $scope.settings.routingStartPointInput })
- .then(function(result){
- $scope.geosearchResults_startingPoint = result;
-
- $scope.$digest();
- });
-
- }, 500);
- };
-
- $scope.onClickGeosearchResult_startingPoint = function(geosearchResult){
- // result object from leaflet-geosearch
-
- // const result = {
- // x: Number, // lon,
- // y: Number, // lat,
- // label: String, // formatted address
- // bounds: [
- // [Number, Number], // s, w - lat, lon
- // [Number, Number], // n, e - lat, lon
- // ],
- // raw: {}, // raw provider result
- // }
-
- $scope.routingStartPoint = {
- label: geosearchResult.label,
- longitude: geosearchResult.x,
- latitude: geosearchResult.y
- };
-
- // hide geosearch results to minimize page height
- $scope.geosearchResults_startingPoint = undefined;
- };
-
- $scope.onChangeRoutingEndPoint = function(){
-
- // Clear the timeout if it has already been set.
- // This will prevent the previous task from executing
- // if it has been less than
- clearTimeout($scope.delay);
-
- $scope.geosearchResults_endPoint = undefined;
-
- // Make a new timeout set to go off in 800ms
- $scope.delay = setTimeout(function () {
- console.log('Geosearch for Input String: ', $scope.settings.routingEndPointInput);
-
- $scope.openStreetMapProvider.search({ query: $scope.settings.routingEndPointInput })
- .then(function(result){
- $scope.geosearchResults_endPoint = result;
-
- $scope.$digest();
- });
-
- }, 500);
- };
-
- $scope.onClickGeosearchResult_endPoint = function(geosearchResult){
- // result object from leaflet-geosearch
-
- // const result = {
- // x: Number, // lon,
- // y: Number, // lat,
- // label: String, // formatted address
- // bounds: [
- // [Number, Number], // s, w - lat, lon
- // [Number, Number], // n, e - lat, lon
- // ],
- // raw: {}, // raw provider result
- // }
-
- $scope.routingEndPoint = {
- label: geosearchResult.label,
- longitude: geosearchResult.x,
- latitude: geosearchResult.y
- };
-
- // hide geosearch results to minimize page height
- $scope.geosearchResults_endPoint = undefined;
- };
-
-
- //////////////////////////// SECTION FOR GORESOURCE AND INDICATOR ANALYSIS
-
- $scope.getQueryDate = function(resource){
- if ($scope.settings.dateSelectionType.selectedDateType === $scope.settings.dateSelectionType_valueIndicator){
- return kommonitorDataExchangeService.selectedDate;
- }
- else if($scope.settings.dateSelectionType.selectedDateType === $scope.settings.dateSelectionType_valueManual){
- return $scope.settings.selectedDate_manual;
- }
- else if($scope.settings.dateSelectionType.selectedDateType === $scope.settings.dateSelectionType_valuePerDataset){
- return resource.selectedDate.startDate;
- }
- else{
- return kommonitorDataExchangeService.selectedDate;
- }
- };
-
- $scope.handlePoiForAnalysis = async function(poi){
- $scope.settings.loadingData = true;
- $rootScope.$broadcast("showLoadingIconOnMap");
-
- try {
- if(poi.isSelected_reachabilityAnalysis){
- poi = await $scope.fetchGeoJSONForDate(poi);
- }
-
- poi = await $scope.handlePoiOnDiagram(poi);
-
- if(kommonitorDataExchangeService.isDisplayableGeoresource(poi)){
- $scope.handlePoiOnMap(poi);
- }
- } catch (error) {
- console.error(error);
- }
-
- $scope.settings.loadingData = false;
- $rootScope.$broadcast("hideLoadingIconOnMap");
-
- // as method is async we may call angular digest cycle
- setTimeout(() => {
- $scope.$digest();
- }, 250);
- };
-
- $scope.fetchGeoJSONForDate = function(poiGeoresource){
- var id = poiGeoresource.georesourceId;
-
- var date = $scope.getQueryDate(poiGeoresource);
-
- var dateComps = date.split("-");
-
- var year = dateComps[0];
- var month = dateComps[1];
- var day = dateComps[2];
-
- return $http({
- url: kommonitorDataExchangeService.getBaseUrlToKomMonitorDataAPI_spatialResource() + "/georesources/" + id + "/" + year + "/" + month + "/" + day,
- method: "GET"
- }).then(function successCallback(response) {
- // this callback will be called asynchronously
- // when the response is available
- var geoJSON = response.data;
-
- poiGeoresource.geoJSON = geoJSON;
-
- return poiGeoresource;
-
- }, function errorCallback(error) {
- // called asynchronously if an error occurs
- // or server returns response with an error status.
- $scope.settings.loadingData = false;
- kommonitorDataExchangeService.displayMapApplicationError(error);
- $rootScope.$broadcast("hideLoadingIconOnMap");
- });
- };
-
- $scope.handlePoiOnDiagram = async function(poi){
- if(poi.isSelected_reachabilityAnalysis){
- // maps range value to result GeoJSON
- var pointsPerIsochroneRangeMap = await $scope.computePoisWithinIsochrones(poi);
- $scope.addOrReplaceWithinDiagrams(poi, pointsPerIsochroneRangeMap);
- // now filter the geoJSON to only include those datasets that are actually inside any isochrone
- poi = filterGeoJSONPointsInsideLargestIsochrone(poi, pointsPerIsochroneRangeMap);
- }
- else{
- //remove POI layer from map
- $scope.removePoiFromDiagram(poi);
- }
-
- return poi;
- };
-
- function filterGeoJSONPointsInsideLargestIsochrone(poi, pointsPerIsochroneRangeMap){
- var keyIter = pointsPerIsochroneRangeMap.keys();
-
- var nextKey = keyIter.next();
-
- var largestRange;
-
- while(nextKey.value){
- var nextRange = nextKey.value;
- if (! largestRange){
- largestRange = Number(nextRange);
- }
- else if (largestRange < Number(nextRange)){
- largestRange = Number(nextRange);
- }
-
- nextKey = keyIter.next();
- }
-
- // map stores keys as string
- poi.geoJSON = pointsPerIsochroneRangeMap.get("" + largestRange);
-
- return poi;
- }
-
- $scope.computePoisWithinIsochrones = async function(poi){
- var pointsPerIsochroneRangeMap = $scope.initializeMapWithRangeKeys();
- if (! poi.geoJSON){
- poi = await $scope.fetchGeoJSONForDate(poi);
- }
-
- // as there might be mutliple isochrone ranges
- // we must perform point in polygon for each range
- var keyIter = pointsPerIsochroneRangeMap.keys();
-
- var nextKey = keyIter.next();
-
- while(nextKey.value){
- var nextKeyValue = nextKey.value;
-
- var geoJSON_featureCollection = $scope.computePoisWithinIsochrone(nextKeyValue, poi);
- pointsPerIsochroneRangeMap.set(nextKeyValue, geoJSON_featureCollection);
- nextKey = keyIter.next();
- }
-
- return pointsPerIsochroneRangeMap;
- };
-
- $scope.computePoisWithinIsochrone = function(rangeValue, poi){
- // create clones of poi geoJSON and isochrone geoJSON
- var isochrones_geoJSON_clone = JSON.parse(JSON.stringify($scope.currentIsochronesGeoJSON));
- var poi_geoJSON_clone = JSON.parse(JSON.stringify(poi.geoJSON));
-
- // filter isochrone geoJSON clone by range value
- isochrones_geoJSON_clone.features = isochrones_geoJSON_clone.features.filter(feature => {
- return String(feature.properties.value) === String(rangeValue);
- });
-
- // filter poi geoJSON clone by spatial within isochrone
- var pointsWithinIsochrones = turf.pointsWithinPolygon(poi_geoJSON_clone, isochrones_geoJSON_clone);
-
- return pointsWithinIsochrones;
- };
-
-
- $scope.initializeMapWithRangeKeys = function(){
- var map = new Map();
-
- for (const feature of $scope.currentIsochronesGeoJSON.features) {
- map.set("" + feature.properties.value, null);
- }
-
- return map;
- };
-
-
-
- $scope.addOrReplaceWithinDiagrams = function(poi, pointsPerIsochroneRangeMap){
- var mapEntries = pointsPerIsochroneRangeMap.entries();
-
- var nextEntry = mapEntries.next();
- while(nextEntry.value){
-
- var nextEntry_keyRange = nextEntry.value[0];
- var nextEntry_valueGeoJSON = nextEntry.value[1];
- var numberOfFeatures = 0;
-
- var nextEntry_keyRange_label = nextEntry_keyRange;
- if($scope.settings.focus == 'time'){
- // compute seconds to minutes for display
- nextEntry_keyRange_label = nextEntry_keyRange_label / 60;
- }
-
- if(nextEntry_valueGeoJSON){
- numberOfFeatures = nextEntry_valueGeoJSON.features.length;
- }
- console.log("Number of Points wihtin Range '" + nextEntry_keyRange + "' is '" + numberOfFeatures + "'");
-
- var date = $scope.getQueryDate(poi);
-
- if ($scope.echartsInstances_reachabilityAnalysis && $scope.echartsInstances_reachabilityAnalysis.has(nextEntry_keyRange)){
- // append to diagram
-
- var echartsInstance = $scope.echartsInstances_reachabilityAnalysis.get(nextEntry_keyRange);
- var echartsOptions = echartsInstance.getOption();
- echartsOptions = kommonitorDiagramHelperService.appendToReachabilityAnalysisOptions(poi, nextEntry_valueGeoJSON, echartsOptions, date);
- echartsInstance.setOption(echartsOptions);
- $scope.echartsInstances_reachabilityAnalysis.set(nextEntry_keyRange, echartsInstance);
- }
- else{
- var reachabilityDiagramsSectionNode = document.getElementById("reachability_diagrams_section");
- var newChartNode = document.createElement("div");
- newChartNode.innerHTML = '
- Zugriffsschutz beim Anlegen neuer Ressourcen
-
- Beim Anlegen neuer Ressourcen werden nun standardmäßig die Rollen des eingeloggten Nutzers verwendet,
- um die daraus verknüpften Organisationen und Rechtestufen vorauszufüllen.
- Dies stellt sicher, dass eingeloggte User den Zugriff auf die Ressource bekommen.
-
-
+ Zugriffsschutz beim Anlegen neuer Ressourcen
+
+ Beim Anlegen neuer Ressourcen werden nun standardmäßig die Rollen des eingeloggten Nutzers verwendet,
+ um die daraus verknüpften Organisationen und Rechtestufen vorauszufüllen.
+ Dies stellt sicher, dass eingeloggte User den Zugriff auf die Ressource bekommen.
+
+
+
+ Anpassungen in der Kartenapp
+
- Anpassungen in der Kartenapp
-
-
- keine
-
-
+ keine
-
-
+
+
+
+
-
+
+
@@ -79,11 +82,12 @@
Neuerungen in KomMonitor V2.1.12
Neuerungen in KomMonitor V2.1.11
-
+
-
+
@@ -118,11 +122,12 @@
Neuerungen in KomMonitor V2.1.11
Neuerungen in KomMonitor V2.1.10
-
+
-
+
@@ -158,11 +163,12 @@
Neuerungen in KomMonitor V2.1.10
Neuerungen in KomMonitor V2.1.9
-
+
-
+
@@ -199,11 +205,12 @@
Neuerungen in KomMonitor V2.1.9
Neuerungen in KomMonitor V2.1.8
-
+
-
+
@@ -238,11 +245,12 @@
Neuerungen in KomMonitor V2.1.8
Neuerungen in KomMonitor V2.1.7
-
+
-
+
@@ -287,11 +295,12 @@
Neuerungen in KomMonitor V2.1.7
Neuerungen in KomMonitor V2.1.6
-
+
-
+
@@ -316,11 +325,12 @@
Neuerungen in KomMonitor V2.1.6
Neuerungen in KomMonitor V2.1.5
-
+
-
+
@@ -343,11 +353,12 @@
Neuerungen in KomMonitor V2.1.5
Neuerungen in KomMonitor V2.1.4
-
+
-
+
@@ -368,11 +379,12 @@
Neuerungen in KomMonitor V2.1.4
Neuerungen in KomMonitor V2.1.3
-
+
-
+
@@ -392,11 +404,12 @@
Neuerungen in KomMonitor V2.1.3
Neuerungen in KomMonitor V2.1.2
-
+
-
+
@@ -419,11 +432,12 @@
Neuerungen in KomMonitor V2.1.2
Neuerungen in KomMonitor V2.1.1
-
+
-
+
@@ -443,11 +457,12 @@
Neuerungen in KomMonitor V2.1.1
Neuerungen in KomMonitor V2.1.0
-
+
-
+
@@ -526,11 +541,12 @@
Neuerungen in KomMonitor V2.1.0
Neuerungen in KomMonitor V2.0.1
-
+
-
+
@@ -550,11 +566,12 @@
Neuerungen in KomMonitor V2.0.1
Neuerungen in KomMonitor V2.0.0
-
+
-
+
Grundlegende Erweiterung des Datenmodells und des Rollen- und Rechtemanagements
Die Aktualisierung aller KomMonitor Komponenten auf eine Version >= V2.0.0 beinhaltet bedeutende
@@ -677,7 +694,7 @@
Upgradeempfehlung KomMonitor < V2.0.0
-
+
KomMonitor wurde in Version 2.0.0 hinsichtlich des Datenmodells sowie Rechte- und Rollenkonzepts grundlegend
erweitert. Es wird daher dringend empfohlen, alle Komponenten auf die neueste Version zu aktualisieren.
diff --git a/app/components/kommonitorUserInterface/kommonitorMap/kommonitor-map.component.js b/app/components/kommonitorUserInterface/kommonitorMap/kommonitor-map.component.js
index 518355fc5..62414b88b 100644
--- a/app/components/kommonitorUserInterface/kommonitorMap/kommonitor-map.component.js
+++ b/app/components/kommonitorUserInterface/kommonitorMap/kommonitor-map.component.js
@@ -1,3484 +1,2844 @@
-angular.module('kommonitorMap').component(
- 'kommonitorMap',
- {
+"use strict";
+angular.module('kommonitorMap').component('kommonitorMap', {
templateUrl: "components/kommonitorUserInterface/kommonitorMap/kommonitor-map.template.html",
controller: [
- '$rootScope',
- '$http',
- '$scope',
- '$timeout',
- 'kommonitorMapService',
- 'kommonitorDataExchangeService',
- 'kommonitorVisualStyleHelperService',
- 'kommonitorInfoLegendHelperService',
- 'kommonitorFilterHelperService',
- '__env',
- function MapController($rootScope, $http, $scope, $timeout, kommonitorMapService, kommonitorDataExchangeService, kommonitorVisualStyleHelperService,
- kommonitorInfoLegendHelperService, kommonitorFilterHelperService, __env) {
-
- this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
-
- const INDICATOR_DATE_PREFIX = __env.indicatorDatePrefix;
- const numberOfDecimals = __env.numberOfDecimals;
- var defaultColorForFilteredValues = __env.defaultColorForFilteredValues;
- var defaultBorderColorForFilteredValues = __env.defaultBorderColorForFilteredValues;
- var defaultBorderColor = __env.defaultBorderColor;
- var defaultFillOpacity = __env.defaultFillOpacity;
- var defaultFillOpacityForFilteredFeatures = __env.defaultFillOpacityForFilteredFeatures;
- var defaultFillOpacityForHighlightedFeatures = __env.defaultFillOpacityForHighlightedFeatures;
- var defaultFillOpacityForZeroFeatures = __env.defaultFillOpacityForZeroFeatures;
- var defaultColorBrewerPaletteForBalanceIncreasingValues = __env.defaultColorBrewerPaletteForBalanceIncreasingValues;
- var defaultColorBrewerPaletteForBalanceDecreasingValues = __env.defaultColorBrewerPaletteForBalanceDecreasingValues;
- var defaultColorBrewerPaletteForGtMovValues = __env.defaultColorBrewerPaletteForGtMovValues;
- var defaultColorBrewerPaletteForLtMovValues = __env.defaultColorBrewerPaletteForLtMovValues;
- var defaultColorForHoveredFeatures = __env.defaultColorForHoveredFeatures;
- var defaultColorForClickedFeatures = __env.defaultColorForClickedFeatures;
- var defaultBorderColorForNoDataValues = __env.defaultBorderColorForNoDataValues;
- var defaultColorForNoDataValues = __env.defaultColorForNoDataValues;
- var defaultFillOpacityForNoDataValues = __env.defaultFillOpacityForNoDataValues;
-
-
- var defaultColorForOutliers_high = __env.defaultColorForOutliers_high;
- var defaultBorderColorForOutliers_high = __env.defaultBorderColorForOutliers_high;
- var defaultFillOpacityForOutliers_high = __env.defaultFillOpacityForOutliers_high;
- var defaultColorForOutliers_low = __env.defaultColorForOutliers_low;
- var defaultBorderColorForOutliers_low = __env.defaultBorderColorForOutliers_low;
- var defaultFillOpacityForOutliers_low = __env.defaultFillOpacityForOutliers_low;
- var useOutlierDetectionOnIndicator = __env.useOutlierDetectionOnIndicator;
-
- const outlierPropertyName = "outlier";
- const outlierPropertyValue_high_soft = "high-soft";
- const outlierPropertyValue_low_soft = "low-soft";
- const outlierPropertyValue_high_extreme = "high-extreme";
- const outlierPropertyValue_low_extreme = "low-extreme";
- const outlierPropertyValue_no = "no";
-
- $scope.containsOutliers_high = false;
- $scope.containsOutliers_low = false;
- $scope.outliers_high = undefined;
- $scope.outliers_low = undefined;
- kommonitorDataExchangeService.useOutlierDetectionOnIndicator = useOutlierDetectionOnIndicator;
-
- $scope.svgString_outlierLow = '';
- $scope.svgString_outlierHigh = '';
-
- $scope.showOutlierInfoAlert = false;
-
-
-
- $scope.drawnPointFeatures = undefined;
- $scope.drawPointControl = undefined;
-
- $scope.featuresWithValues = [];
- $scope.featuresWithoutValues = [];
-
-
- const MultipleResultsLeafletSearch = L.Control.Search.extend({
-
- _makeUniqueKey: function (featureName, featureId) {
- return featureName + " (Name) - " + featureId + " (ID)";
- },
-
- _searchInLayer: function (layer, retRecords, propName) {
- var self = this, loc;
- var key_withUniqueID;
-
- if (layer instanceof L.Control.Search.Marker) return;
-
- if (layer instanceof L.Marker || layer instanceof L.CircleMarker) {
- if (self._getPath(layer.options, propName)) {
- loc = layer.getLatLng();
- loc.layer = layer;
- retRecords[self._getPath(layer.options, propName)] = loc;
- }
- else if (self._getPath(layer.feature.properties, propName)) {
- loc = layer.getLatLng();
- loc.layer = layer;
- key_withUniqueID = this._makeUniqueKey(self._getPath(layer.feature.properties, propName), layer.feature.properties.ID);
- retRecords[key_withUniqueID] = loc;
- }
- else {
- //throw new Error("propertyName '"+propName+"' not found in marker");
- console.warn("propertyName '" + propName + "' not found in marker");
- }
- }
- else if (layer instanceof L.Path || layer instanceof L.Polyline || layer instanceof L.Polygon) {
- if (self._getPath(layer.options, propName)) {
- loc = layer.getBounds().getCenter();
- loc.layer = layer;
- retRecords[self._getPath(layer.options, propName)] = loc;
- }
- else if (self._getPath(layer.feature.properties, propName)) {
- loc = layer.getBounds().getCenter();
- loc.layer = layer;
- key_withUniqueID = this._makeUniqueKey(self._getPath(layer.feature.properties, propName), layer.feature.properties.ID);
- retRecords[key_withUniqueID] = loc;
- }
- else {
- //throw new Error("propertyName '"+propName+"' not found in shape");
- console.warn("propertyName '" + propName + "' not found in shape");
- }
- }
- else if (layer.hasOwnProperty('feature'))//GeoJSON
- {
- if (layer.feature.properties.hasOwnProperty(propName)) {
-
- key_withUniqueID = this._makeUniqueKey(self._getPath(layer.feature.properties, propName), layer.feature.properties.ID);
- if (layer.getLatLng && typeof layer.getLatLng === 'function') {
- loc = layer.getLatLng();
- loc.layer = layer;
- retRecords[key_withUniqueID] = loc;
- } else if (layer.getBounds && typeof layer.getBounds === 'function') {
- loc = layer.getBounds().getCenter();
- loc.layer = layer;
- retRecords[key_withUniqueID] = loc;
- } else {
- console.warn("Unknown type of Layer");
- }
- }
- else {
- //throw new Error("propertyName '"+propName+"' not found in feature");
- console.warn("propertyName '" + propName + "' not found in feature");
- }
- }
- else if (layer instanceof L.LayerGroup) {
- layer.eachLayer(function (layer) {
- self._searchInLayer(layer, retRecords, propName);
- });
- }
- },
- _defaultMoveToLocation: function (latlng, title, map) {
- if (this.options.zoom)
- this._map.setView(latlng, this.options.zoom);
- else
- this._map.panTo(latlng);
-
- // add collapse after click on item
- this.collapse();
- },
- _handleAutoresize: function () {
- var maxWidth;
-
- if (!this._map) {
- this._map = $scope.map;
- }
-
- if (this._input.style.maxWidth !== this._map._container.offsetWidth) {
- maxWidth = this._map._container.clientWidth;
-
- // other side margin + padding + width border + width search-button + width search-cancel
- maxWidth -= 10 + 20 + 1 + 30 + 22;
-
- this._input.style.maxWidth = maxWidth.toString() + 'px';
- }
-
- if (this.options.autoResize && (this._container.offsetWidth + 20 < this._map._container.offsetWidth)) {
- this._input.size = this._input.value.length < this._inputMinSize ? this._inputMinSize : this._input.value.length;
- }
- }
- });
-
- $scope.onCloseOutlierAlert = function () {
- // $("#outlierInfo").hide();
- $scope.showOutlierInfoAlert = false;
- };
-
-
- var refreshNoDataStyle = function () {
-
- $scope.currentIndicatorContainsNoDataValues = false;
- $scope.svgString_noData = '';
-
- $scope.noDataStyle = kommonitorVisualStyleHelperService.noDataStyle;
- };
-
- var refreshOutliersStyle = function () {
-
- $scope.containsOutliers_high = false;
- $scope.containsOutliers_low = false;
- $scope.outlierMinValue = undefined;
- $scope.outlierMaxValue = undefined;
- $scope.showOutlierInfoAlert = false;
-
- $scope.svgString_outlierLow = '';
- $scope.svgString_outlierHigh = '';
-
- // if ($scope.useTransparencyOnIndicator) {
- // fillOpacity_high = defaultFillOpacityForOutliers_high;
- // fillOpacity_low = defaultFillOpacityForOutliers_low;
- // }
-
- $scope.outlierStyle_high = kommonitorVisualStyleHelperService.outlierStyle_high;
-
- $scope.outlierStyle_low = kommonitorVisualStyleHelperService.outlierStyle_low;
- };
-
- $scope.useTransparencyOnIndicator = __env.useTransparencyOnIndicator;
-
- $scope.filteredStyle = kommonitorVisualStyleHelperService.filteredStyle;
-
- var refreshFilteredStyle = function () {
-
- $scope.filteredStyle = kommonitorVisualStyleHelperService.filteredStyle;
- };
-
- this.kommonitorMapServiceInstance = kommonitorMapService;
- this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
- $scope.inputLayerCounter = 0;
-
- $scope.latCenter = __env.initialLatitude;
- $scope.lonCenter = __env.initialLongitude;
- $scope.zoomLevel = __env.initialZoomLevel;
-
- $scope.loadingData = true;
-
- $scope.drawnItems = new L.FeatureGroup();
- $scope.drawControl = undefined;
-
- $scope.allDrawingToolsEnabled = false;
- $scope.date = undefined;
-
- // central map object
- $scope.map = undefined;
- $scope.scaleBar = undefined;
- $scope.layerControl = undefined;
- $scope.showInfoControl = true;
- $scope.showLegendControl = true;
- $scope.showLegend = true;
- $scope.overlays = new Array();
- $scope.baseMaps = new Array();
- const spatialUnitLayerGroupName = "Raumeinheiten";
- const georesourceLayerGroupName = "Georessourcen";
- const poiLayerGroupName = "Points of Interest";
- const loiLayerGroupName = "Lines of Interest";
- const aoiLayerGroupName = "Areas of Interest";
- const indicatorLayerGroupName = "Indikatoren";
- const reachabilityLayerGroupName = "Erreichbarkeiten";
- const wmsLayerGroupName = "Web Map Services (WMS)";
- const wfsLayerGroupName = "Web Feature Services (WFS)";
- const fileLayerGroupName = "Dateilayer";
-
- // create classyBrew object
- $scope.defaultBrew = new classyBrew();
- $scope.gtMeasureOfValueBrew = new classyBrew();
- $scope.ltMeasureOfValueBrew = new classyBrew();
-
- $scope.currentIndicatorMetadataAndGeoJSON;
- $scope.currentGeoJSONOfCurrentLayer;
- $scope.currentIndicatorContainsZeroValues = false;
- $scope.currentIndicatorContainsNoDataValues = false;
- $scope.indicatorTypeOfCurrentLayer;
- $scope.defaultColorForZeroValues = __env.defaultColorForZeroValues;
-
- $scope.customIndicatorPropertyName;
- $scope.customIndicatorName;
- $scope.customIndicatorUnit;
-
- $scope.currentCustomIndicatorLayerOfCurrentLayer;
- $scope.customPropertyName;
-
- $scope.currentCustomIndicatorLayer;
- $scope.isochronesLayer = undefined;
- $scope.isochroneMarkerLayer = undefined;
-
- /*
- * L.TileLayer.Grayscale is a regular tilelayer with grayscale makeover.
- */
-
- L.TileLayer.Grayscale = L.TileLayer.extend({
- options: {
- quotaRed: 21,
- quotaGreen: 71,
- quotaBlue: 8,
- quotaDividerTune: 0,
- quotaDivider: function () {
- return this.quotaRed + this.quotaGreen + this.quotaBlue + this.quotaDividerTune;
- }
- },
-
- initialize: function (url, options) {
- options = options || {};
- options.crossOrigin = true;
- L.TileLayer.prototype.initialize.call(this, url, options);
-
- this.on('tileload', function (e) {
- this._makeGrayscale(e.tile);
- });
- },
-
- _createTile: function () {
- var tile = L.TileLayer.prototype._createTile.call(this);
- tile.crossOrigin = "Anonymous";
- return tile;
- },
-
- _makeGrayscale: function (img) {
- if (img.getAttribute('data-grayscaled'))
- return;
-
- img.crossOrigin = '';
- var canvas = document.createElement("canvas");
- canvas.width = img.width;
- canvas.height = img.height;
- var ctx = canvas.getContext("2d");
- ctx.drawImage(img, 0, 0);
-
- var imgd = ctx.getImageData(0, 0, canvas.width, canvas.height);
- var pix = imgd.data;
- for (var i = 0, n = pix.length; i < n; i += 4) {
- pix[i] = pix[i + 1] = pix[i + 2] = (this.options.quotaRed * pix[i] + this.options.quotaGreen * pix[i + 1] + this.options.quotaBlue * pix[i + 2]) / this.options.quotaDivider();
- }
- ctx.putImageData(imgd, 0, 0);
- img.setAttribute('data-grayscaled', true);
- img.src = canvas.toDataURL();
- }
- });
-
- L.tileLayer.grayscale = function (url, options) {
- return new L.TileLayer.Grayscale(url, options);
- };
-
- this.initializeMap = function () {
-
- $scope.loadingData = true;
-
- // initialize map referring to div element with id="map"
-
- var baseLayerDefinitionsMap = new Map();
-
- for (const baseMapEntry of __env.baseLayers) {
-
- if (baseMapEntry.layerType === "TILE_LAYER_GRAYSCALE"){
- var grayscaleLayer = new L.tileLayer.grayscale(baseMapEntry.url, { minZoom: baseMapEntry.minZoomLevel, maxZoom: baseMapEntry.maxZoomLevel, attribution: baseMapEntry.attribution_html });
- baseLayerDefinitionsMap.set(baseMapEntry.name, grayscaleLayer);
- }
- else if (baseMapEntry.layerType === "TILE_LAYER"){
- var tileLayer = new L.tileLayer(baseMapEntry.url, { minZoom: baseMapEntry.minZoomLevel, maxZoom: baseMapEntry.maxZoomLevel, attribution: baseMapEntry.attribution_html });
- baseLayerDefinitionsMap.set(baseMapEntry.name, tileLayer);
- }
- else if (baseMapEntry.layerType === "WMS"){
- var wmsLayer = new L.tileLayer.wms(baseMapEntry.url, { minZoom: baseMapEntry.minZoomLevel, maxZoom: baseMapEntry.maxZoomLevel, attribution: baseMapEntry.attribution_html, layers: baseMapEntry.layerName_WMS, format: 'image/png' });
- baseLayerDefinitionsMap.set(baseMapEntry.name, wmsLayer);
- }
- }
-
- $scope.map = L.map('map', {
- center: [$scope.latCenter, $scope.lonCenter],
- zoom: $scope.zoomLevel,
- zoomDelta: 0.5,
- zoomSnap: 0.5,
- layers: [baseLayerDefinitionsMap.get(__env.baseLayers[0].name)]
- });
-
- // execute update search control on layer add and remove
- $scope.map.on('overlayadd', function (eo) {
- $scope.updateSearchControl();
- });
- $scope.map.on('overlayremove', function (eo) {
- $scope.updateSearchControl();
- });
-
- // update zoom and extent
- $scope.map.on('zoomend', function (eo) {
- let latLng = $scope.map.getCenter();
- __env.currentLatitude = latLng.lat;
- __env.currentLongitude = latLng.lng;
- __env.currentZoomLevel = $scope.map.getZoom();
- });
- $scope.map.on('moveend', function (eo) {
- let latLng = $scope.map.getCenter();
- __env.currentLatitude = latLng.lat;
- __env.currentLongitude = latLng.lng;
- __env.currentZoomLevel = $scope.map.getZoom();
- });
-
- $scope.baseMaps = {
- };
-
- baseLayerDefinitionsMap.forEach(function(value, key, map){
- $scope.baseMaps[key] = value;
- });
-
- $scope.groupedOverlays = {
- indicatorLayerGroupName: {
-
- },
- poiLayerGroupName: {
-
- },
- loiLayerGroupName: {
-
- },
- aoiLayerGroupName: {
-
- },
- wmsLayerGroupName: {
-
- },
- wfsLayerGroupName: {
-
- },
- fileLayerGroupName: {
-
- },
- reachabilityLayerGroupName: {
-
- }
- };
-
- $scope.layerControl = L.control.groupedLayers($scope.baseMaps, $scope.groupedOverlays, { position: 'topleft' });
- $scope.map.addControl($scope.layerControl);
-
- // Disable dragging when user's cursor enters the element
- $scope.layerControl.getContainer().addEventListener('mouseover', function () {
- $scope.map.dragging.disable();
- $scope.map.touchZoom.disable();
- $scope.map.doubleClickZoom.disable();
- $scope.map.scrollWheelZoom.disable();
- });
-
- // Re-enable dragging when user's cursor leaves the element
- $scope.layerControl.getContainer().addEventListener('mouseout', function () {
- $scope.map.dragging.enable();
- $scope.map.touchZoom.enable();
- $scope.map.doubleClickZoom.enable();
- $scope.map.scrollWheelZoom.enable();
- });
-
- $scope.scaleBar = L.control.scale();
- $scope.scaleBar.addTo($scope.map);
-
-
-
- // hatch patterns
- // var diagonalPattern = new L.PatternPath({ d: "M-1,1 l2,-2 M0,4 l4,-4 M3,5 l2,-2" , fill: true });
-
- // $scope.outlierFillPattern_high = new L.Pattern();
- // $scope.outlierFillPattern_high.addShape(diagonalPattern);
- // $scope.outlierFillPattern_high.addTo($scope.map);
-
- $scope.outlierFillPattern_low = kommonitorVisualStyleHelperService.outlierFillPattern_low;
- $scope.outlierFillPattern_low.addTo($scope.map);
-
- $scope.outlierFillPattern_high = kommonitorVisualStyleHelperService.outlierFillPattern_high;
- $scope.outlierFillPattern_high.addTo($scope.map);
-
- $scope.noDataFillPattern = kommonitorVisualStyleHelperService.noDataFillPattern;
- $scope.noDataFillPattern.addTo($scope.map);
-
- // $scope.loadingData = false;
-
- /////////////////////////////////////////////////////
- ///// LEAFLET GEOSEARCH SETUP
- /////////////////////////////////////////////////////
- var GeoSearchControl = window.GeoSearch.GeoSearchControl;
- var OpenStreetMapProvider = window.GeoSearch.OpenStreetMapProvider;
-
- // remaining is the same as in the docs, accept for the var instead of const declarations
- var provider = new OpenStreetMapProvider(
- {
- params: {
- 'accept-language': 'de', // render results in Dutch
- countrycodes: 'de', // limit search results to the Netherlands
- addressdetails: 1, // include additional address detail parts
- viewbox: "" + (Number(__env.initialLongitude) - 0.001) + "," + (Number(__env.initialLatitude) - 0.001) + "," + (Number(__env.initialLongitude) + 0.001) + "," + (Number(__env.initialLatitude) + 0.001)
- },
- searchUrl: __env.targetUrlToGeocoderService + '/search',
- reverseUrl: __env.targetUrlToGeocoderService + '/reverse'
- }
- );
-
- $scope.geosearchControl = new GeoSearchControl({
- position: "topleft",
- provider: provider,
- style: 'button',
- autoComplete: true,
- autoCompleteDelay: 250,
- showMarker: true, // optional: true|false - default true
- showPopup: false, // optional: true|false - default false
- marker: { // optional: L.Marker - default L.Icon.Default
- icon: new L.Icon.Default(),
- draggable: false,
- },
- popupFormat: ({ query, result }) => result.label, // optional: function - default returns result label
- maxMarkers: 1, // optional: number - default 1
- retainZoomLevel: false, // optional: true|false - default false
- animateZoom: true, // optional: true|false - default true
- autoClose: false, // optional: true|false - default false
- searchLabel: 'Suche nach Adressen ...', // optional: string - default 'Enter address'
- keepResult: false // optional: true|false - default false
- });
-
- $scope.map.addControl($scope.geosearchControl);
-
-
- /////////////////////////////////////////////////////
- ///// LEAFLET SEARCH SETUP
- /////////////////////////////////////////////////////
- // will be updated once example indicator layer is loaded
- $scope.searchControl = new MultipleResultsLeafletSearch({
- });
- $scope.searchControl.addTo($scope.map);
-
-
- /////////////////////////////////////////////////////
- ///// LEAFLET MEASURE SETUP
- /////////////////////////////////////////////////////
- var measureOptions = {
- position: 'topleft',
- primaryLengthUnit: 'meters',
- secondaryLengthUnit: 'kilometers',
- primaryAreaUnit: 'sqmeters',
- activeColor: "#d15c54",
- completedColor: "#d15c54",
- decPoint: ',',
- thousandsSep: '.'
- };
-
- $scope.measureControl = new L.Control.Measure(measureOptions);
- $scope.measureControl.addTo($scope.map);
-
- /////////////////////////////////////////////////////
- ///// LEAFLET SCREENSHOTER SETUP
- /////////////////////////////////////////////////////
-
- // from the docs, most of it is probably not needed
- let screenshotterOptions = {
- cropImageByInnerWH: true, // crop blank opacity from image borders
- hidden: true, // hide screen icon
- preventDownload: false, // prevent download on button click
- domtoimageOptions: {}, // see options for dom-to-image
- position: 'topleft', // position of take screen icon
- screenName: 'screen', // string or function
- hideElementsWithSelectors: ['.leaflet-control-container'], // by default hide map controls All els must be child of _map._container
- mimeType: 'image/png', // used if format == image,
- caption: null, // string or function, added caption to bottom of screen
- captionFontSize: 15,
- captionFont: 'Arial',
- captionColor: 'black',
- captionBgColor: 'white',
- captionOffset: 5,
- // callback for manually edit map if have warn: "May be map size very big on that zoom level, we have error"
- // and screenshot not created
- onPixelDataFail: async function({ node, plugin, error, mapPane, domtoimageOptions }) {
- // Solutions:
- // decrease size of map
- // or decrease zoom level
- // or remove elements with big distanses
- // and after that return image in Promise - plugin._getPixelDataOfNormalMap
- return plugin._getPixelDataOfNormalMap(domtoimageOptions)
- }
- }
-
- $scope.simpleMapScreenshoter = L.simpleMapScreenshoter(screenshotterOptions).addTo($scope.map);
- $scope.map.simpleMapScreenshoter = $scope.simpleMapScreenshoter;
-
- }; // end initialize map
-
-
- $scope.$on("exportMap", function (event) {
-
- // wait for print process to finish
- let format = 'blob'; // 'image' - return base64, 'canvas' - return canvas
- let overridedPluginOptions = {
- mimeType: 'image/png'
- };
- $scope.simpleMapScreenshoter.takeScreen(format, overridedPluginOptions);
- $scope.simpleMapScreenshoter.takeScreen(format, overridedPluginOptions).then(blob => {
- // FileSaver saveAs method
- saveAs(blob, 'KomMonitor-Screenshot.png');
- }).catch(error => {
- console.log("Error while exporting map view.");
- console.error(error);
-
- kommonitorDataExchangeService.displayMapApplicationError(error);
- });
-
- });
-
- function isKomMonitorSpecificProperty(propertyKey){
- let isKomMonitorSpecificProperty = false;
-
- if(propertyKey == "outlier"){
- isKomMonitorSpecificProperty = true;
- }
- else if(propertyKey == __env.VALID_START_DATE_PROPERTY_NAME){
- isKomMonitorSpecificProperty = true;
- }
- else if(propertyKey == __env.VALID_END_DATE_PROPERTY_NAME){
- isKomMonitorSpecificProperty = true;
- }
- else if(propertyKey == "bbox"){
- isKomMonitorSpecificProperty = true;
- }
- else if(propertyKey.includes(__env.indicatorDatePrefix)){
- isKomMonitorSpecificProperty = true;
- }
-
- return isKomMonitorSpecificProperty;
- }
-
- $scope.updateSearchControl = function () {
-
- setTimeout(function () {
- if ($scope.searchControl) {
- try {
- $scope.map.removeControl($scope.searchControl);
- $scope.searchControl = undefined;
- }
- catch (error) {
- kommonitorDataExchangeService.displayMapApplicationError(error);
- }
- }
-
- // build L.layerGroup of available POI layers
- var featureLayers = [];
-
- for (var layerEntry of $scope.layerControl._layers) {
- if (layerEntry) {
- if (layerEntry.overlay) {
- if ($scope.map.hasLayer(layerEntry.layer)) {
- if (layerEntry.group.name === poiLayerGroupName || layerEntry.group.name === loiLayerGroupName || layerEntry.group.name === aoiLayerGroupName || layerEntry.group.name === indicatorLayerGroupName || layerEntry.group.name === wfsLayerGroupName || layerEntry.group.name === fileLayerGroupName) {
- featureLayers.push(layerEntry.layer);
- }
- }
-
- }
- }
- }
-
- var layerGroup;
- // if no relevant layers are currently displayed, then
- if (featureLayers.length === 0) {
- $scope.searchControl = new MultipleResultsLeafletSearch({
- });
- $scope.searchControl.addTo($scope.map);
- }
- else {
- layerGroup = L.featureGroup(featureLayers);
-
- $scope.searchControl = new MultipleResultsLeafletSearch({
- position: "topleft",
- layer: layerGroup,
- initial: false,
- propertyName: __env.FEATURE_NAME_PROPERTY_NAME,
- textPlaceholder: "Layer-Objekte nach Name und/oder ID filtern",
- textCancel: "Abbrechen",
- textErr: "Position nicht gefunden",
- hideMarkerOnCollapse: true,
- zoom: 15,
- autoResize: true,
- autoCollapse: false,
- autoType: true,
- formatData: function (json) { //adds coordinates to name.
- var propName = this.options.propertyName,
- propLoc = this.options.propertyLoc,
- i, jsonret = {};
- if (L.Util.isArray(propLoc))
- for (i in json) {
- if (!this._getPath(json[i], propName)) continue;
- jsonret[this._getPath(json[i], propName) + " (" + json[i][propLoc[0]] + "," + json[i][propLoc[1]] + ")"] = L.latLng(json[i][propLoc[0]], json[i][propLoc[1]]);
- }
- else
- for (i in json) {
- if (!this._getPath(json[i], propName)) continue;
- jsonret[this._getPath(json[i], propName) + " (" + json[i][propLoc][0] + "," + json[i][propLoc][1] + ")"] = L.latLng(this._getPath(json[i], propLoc));
- }
- return jsonret;
+ '$rootScope',
+ '$http',
+ '$scope',
+ '$timeout',
+ 'kommonitorMapService',
+ 'kommonitorDataExchangeService',
+ 'kommonitorVisualStyleHelperService',
+ 'kommonitorInfoLegendHelperService',
+ 'kommonitorFilterHelperService',
+ '__env',
+ function MapController($rootScope, $http, $scope, $timeout, kommonitorMapService, kommonitorDataExchangeService, kommonitorVisualStyleHelperService, kommonitorInfoLegendHelperService, kommonitorFilterHelperService, __env) {
+ this.kommonitorDataExchangeServiceInstance = kommonitorDataExchangeService;
+ const INDICATOR_DATE_PREFIX = __env.indicatorDatePrefix;
+ const numberOfDecimals = __env.numberOfDecimals;
+ var defaultColorForFilteredValues = __env.defaultColorForFilteredValues;
+ var defaultBorderColorForFilteredValues = __env.defaultBorderColorForFilteredValues;
+ var defaultBorderColor = __env.defaultBorderColor;
+ var defaultFillOpacity = __env.defaultFillOpacity;
+ var defaultFillOpacityForFilteredFeatures = __env.defaultFillOpacityForFilteredFeatures;
+ var defaultFillOpacityForHighlightedFeatures = __env.defaultFillOpacityForHighlightedFeatures;
+ var defaultFillOpacityForZeroFeatures = __env.defaultFillOpacityForZeroFeatures;
+ var defaultColorBrewerPaletteForBalanceIncreasingValues = __env.defaultColorBrewerPaletteForBalanceIncreasingValues;
+ var defaultColorBrewerPaletteForBalanceDecreasingValues = __env.defaultColorBrewerPaletteForBalanceDecreasingValues;
+ var defaultColorBrewerPaletteForGtMovValues = __env.defaultColorBrewerPaletteForGtMovValues;
+ var defaultColorBrewerPaletteForLtMovValues = __env.defaultColorBrewerPaletteForLtMovValues;
+ var defaultColorForHoveredFeatures = __env.defaultColorForHoveredFeatures;
+ var defaultColorForClickedFeatures = __env.defaultColorForClickedFeatures;
+ var defaultBorderColorForNoDataValues = __env.defaultBorderColorForNoDataValues;
+ var defaultColorForNoDataValues = __env.defaultColorForNoDataValues;
+ var defaultFillOpacityForNoDataValues = __env.defaultFillOpacityForNoDataValues;
+ var defaultColorForOutliers_high = __env.defaultColorForOutliers_high;
+ var defaultBorderColorForOutliers_high = __env.defaultBorderColorForOutliers_high;
+ var defaultFillOpacityForOutliers_high = __env.defaultFillOpacityForOutliers_high;
+ var defaultColorForOutliers_low = __env.defaultColorForOutliers_low;
+ var defaultBorderColorForOutliers_low = __env.defaultBorderColorForOutliers_low;
+ var defaultFillOpacityForOutliers_low = __env.defaultFillOpacityForOutliers_low;
+ var useOutlierDetectionOnIndicator = __env.useOutlierDetectionOnIndicator;
+ const outlierPropertyName = "outlier";
+ const outlierPropertyValue_high_soft = "high-soft";
+ const outlierPropertyValue_low_soft = "low-soft";
+ const outlierPropertyValue_high_extreme = "high-extreme";
+ const outlierPropertyValue_low_extreme = "low-extreme";
+ const outlierPropertyValue_no = "no";
+ $scope.containsOutliers_high = false;
+ $scope.containsOutliers_low = false;
+ $scope.outliers_high = undefined;
+ $scope.outliers_low = undefined;
+ kommonitorDataExchangeService.useOutlierDetectionOnIndicator = useOutlierDetectionOnIndicator;
+ $scope.svgString_outlierLow = '';
+ $scope.svgString_outlierHigh = '';
+ $scope.showOutlierInfoAlert = false;
+ $scope.drawnPointFeatures = undefined;
+ $scope.drawPointControl = undefined;
+ $scope.featuresWithValues = [];
+ $scope.featuresWithoutValues = [];
+ const MultipleResultsLeafletSearch = L.Control.Search.extend({
+ _makeUniqueKey: function (featureName, featureId) {
+ return featureName + " (Name) - " + featureId + " (ID)";
},
- filterData: function (text, records) {
- var I, icase, regSearch, frecords = {};
-
- text = text.replace(/[.*+?^${}()|[\]\\]/g, ''); //sanitize remove all special characters
- if (text === '')
- return [];
-
- I = this.options.initial ? '^' : ''; //search only initial text
- icase = !this.options.casesensitive ? 'i' : undefined;
-
- regSearch = new RegExp(I + text, icase);
-
- for (var key in records) {
-
- // make a searchable string from all relevant feature properties
- let recordString = "";
- let record = records[key];
- let recordProperties = record.layer.feature.properties;
-
- for (const propertyKey in recordProperties) {
- if(recordProperties[propertyKey] && !isKomMonitorSpecificProperty(propertyKey)){
- recordString += recordProperties[propertyKey];
- }
- }
-
- if (regSearch.test(recordString))
- frecords[key] = records[key];
- }
-
- return frecords;
+ _searchInLayer: function (layer, retRecords, propName) {
+ var self = this, loc;
+ var key_withUniqueID;
+ if (layer instanceof L.Control.Search.Marker)
+ return;
+ if (layer instanceof L.Marker || layer instanceof L.CircleMarker) {
+ if (self._getPath(layer.options, propName)) {
+ loc = layer.getLatLng();
+ loc.layer = layer;
+ retRecords[self._getPath(layer.options, propName)] = loc;
+ }
+ else if (self._getPath(layer.feature.properties, propName)) {
+ loc = layer.getLatLng();
+ loc.layer = layer;
+ key_withUniqueID = this._makeUniqueKey(self._getPath(layer.feature.properties, propName), layer.feature.properties.ID);
+ retRecords[key_withUniqueID] = loc;
+ }
+ else {
+ //throw new Error("propertyName '"+propName+"' not found in marker");
+ console.warn("propertyName '" + propName + "' not found in marker");
+ }
+ }
+ else if (layer instanceof L.Path || layer instanceof L.Polyline || layer instanceof L.Polygon) {
+ if (self._getPath(layer.options, propName)) {
+ loc = layer.getBounds().getCenter();
+ loc.layer = layer;
+ retRecords[self._getPath(layer.options, propName)] = loc;
+ }
+ else if (self._getPath(layer.feature.properties, propName)) {
+ loc = layer.getBounds().getCenter();
+ loc.layer = layer;
+ key_withUniqueID = this._makeUniqueKey(self._getPath(layer.feature.properties, propName), layer.feature.properties.ID);
+ retRecords[key_withUniqueID] = loc;
+ }
+ else {
+ //throw new Error("propertyName '"+propName+"' not found in shape");
+ console.warn("propertyName '" + propName + "' not found in shape");
+ }
+ }
+ else if (layer.hasOwnProperty('feature')) //GeoJSON
+ {
+ if (layer.feature.properties.hasOwnProperty(propName)) {
+ key_withUniqueID = this._makeUniqueKey(self._getPath(layer.feature.properties, propName), layer.feature.properties.ID);
+ if (layer.getLatLng && typeof layer.getLatLng === 'function') {
+ loc = layer.getLatLng();
+ loc.layer = layer;
+ retRecords[key_withUniqueID] = loc;
+ }
+ else if (layer.getBounds && typeof layer.getBounds === 'function') {
+ loc = layer.getBounds().getCenter();
+ loc.layer = layer;
+ retRecords[key_withUniqueID] = loc;
+ }
+ else {
+ console.warn("Unknown type of Layer");
+ }
+ }
+ else {
+ //throw new Error("propertyName '"+propName+"' not found in feature");
+ console.warn("propertyName '" + propName + "' not found in feature");
+ }
+ }
+ else if (layer instanceof L.LayerGroup) {
+ layer.eachLayer(function (layer) {
+ self._searchInLayer(layer, retRecords, propName);
+ });
+ }
},
- buildTip: function (text, val) {
- var emString = "";
-
- if (val.layer.metadataObject) {
- if (val.layer.metadataObject.isPOI) {
- emString += '';
- emString += "";
- emString += '';
- }
- }
- else {
- emString += "";
- }
- return '' + emString + ' ' + text + '';
- }
- });
-
- $scope.searchControl.addTo($scope.map);
- }
- }, 200);
- };
-
- $scope.$on("showLoadingIconOnMap", function (event) {
- // console.log("Show loading icon on map");
- $scope.loadingData = true;
- });
-
- $scope.$on("hideLoadingIconOnMap", function (event) {
- // console.log("Hide loading icon on map");
- $timeout(function(){
- $scope.loadingData = false;
- }, 250);
-
- });
-
- $(document).on('click', '#selectSpatialUnitViaInfoControl li p', function () {
- var spatialUnitName = $(this).text();
- $('#selectSpatialUnitViaInfoControl_text').text(spatialUnitName);
-
- $rootScope.$broadcast("changeSpatialUnitViaInfoControl", spatialUnitName);
- });
-
- // $(document).on('change','#selectSimplifyGeometriesViaInfoControl',function(){
- // var selector = document.getElementById('selectSimplifyGeometriesViaInfoControl');
- // var simplifyGeometries = selector[selector.selectedIndex].value;
- //
- // kommonitorDataExchangeService.simplifyGeometries = simplifyGeometries;
- //
- // $rootScope.$broadcast("changeSpatialUnit");
- // });
-
- $scope.$on("changeSpatialUnitViaInfoControl", function (event, spatialUnitLevel) {
-
- $rootScope.$broadcast("changeSpatialUnit");
-
- });
-
-
- $scope.appendSpatialUnitOptions = function () {
-
- //
-
- // var innerHTMLString = "";
- // // innerHTMLString += " ";
-
- //
';
- for (var p in feature.properties) {
- popupContent += '
' + p + '
'+ feature.properties[p] + '
';
- }
- popupContent += '
';
-
- layer.bindPopup(popupContent);
-
- // if (propertiesString)
- // layer.bindPopup(propertiesString);
+ /**
+ * binds the popup of a clicked output
+ * to layer.feature.properties.popupContent
+ */
+ function onEachFeatureGeoresource(feature, layer) {
+ // does this feature have a property named popupContent?
+ layer.on({
+ click: function () {
+ var popupContent = '
';
+ for (var p in feature.properties) {
+ popupContent += '
' + p + '
' + feature.properties[p] + '
';
+ }
+ popupContent += '
';
+ layer.bindPopup(popupContent);
+ // var propertiesString = "
";
+ // if (propertiesString)
+ // layer.bindPopup(propertiesString);
+ }
+ });
}
- });
- }
-
- /**
- * binds the popup of a clicked output
- * to layer.feature.properties.popupContent
- */
- function onEachFeatureGeoresource(feature, layer) {
- // does this feature have a property named popupContent?
- layer.on({
- click: function () {
-
- var popupContent = '
';
- for (var p in feature.properties) {
- popupContent += '
';
+ for (var p in feature.properties) {
+ popupContent += '
' + p + '
'+ feature.properties[p] + '
';
+ }
+ popupContent += '
';
+
+ layer.bindPopup(popupContent);
+
+ // if (propertiesString)
+ // layer.bindPopup(propertiesString);
+ }
+ });
+ }
+
+ /**
+ * binds the popup of a clicked output
+ * to layer.feature.properties.popupContent
+ */
+ function onEachFeatureGeoresource(feature, layer) {
+ // does this feature have a property named popupContent?
+ layer.on({
+ click: function () {
+
+ var popupContent = '
';
+ for (var p in feature.properties) {
+ popupContent += '