├── .gitignore ├── AUTHORS ├── LICENSE ├── README.md ├── docs └── frontend_screenshot.png ├── publiccode.yml └── src ├── backend ├── .gitignore ├── CodeMaid.config ├── IpTools │ ├── IpNetworkChecker.cs │ ├── IpTools.csproj │ └── Properties │ │ └── AssemblyInfo.cs ├── Modello │ ├── Bindings.cs │ ├── Classi │ │ ├── Fonte.cs │ │ ├── InfoFonte.cs │ │ ├── InfoSO115.cs │ │ ├── InterpolationData.cs │ │ ├── Localizzazione.cs │ │ └── MessaggioPosizione.cs │ ├── Configurazione │ │ └── IAppConfig.cs │ ├── Modello.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Servizi │ │ ├── Persistence │ │ │ ├── GeoQuery │ │ │ │ ├── InRettangolo │ │ │ │ │ ├── IGetMezziInRettangolo.cs │ │ │ │ │ ├── QueryInRettangoloResult.cs │ │ │ │ │ └── Rettangolo.cs │ │ │ │ └── Prossimita │ │ │ │ │ ├── IGetMezziInProssimita.cs │ │ │ │ │ ├── ProssimitaMezzo.cs │ │ │ │ │ └── QueryProssimitaResult.cs │ │ │ ├── IGetClassimezzo.cs │ │ │ ├── IGetMessaggioPosizioneById.cs │ │ │ ├── IGetMezziSilenti.cs │ │ │ ├── IGetPercorso.cs │ │ │ ├── IGetPosizioneByCodiceMezzo.cs │ │ │ ├── IGetPosizioneFlotta.cs │ │ │ └── IStoreMessaggioPosizione.cs │ │ └── Statistics │ │ │ ├── GetStatistics.cs │ │ │ ├── IGetDailyStats.cs │ │ │ ├── IGetNumberOfMessagesStoredByTimeInterval.cs │ │ │ ├── IGetNumberOfVehicles.cs │ │ │ ├── IGetStatistics.cs │ │ │ └── MsgNum.cs │ └── packages.config ├── Persistence.MongoDB │ ├── Bindings.cs │ ├── Classes │ │ └── VehicleLock.cs │ ├── DbContext.cs │ ├── Persistence.MongoDB.csproj │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── Servizi │ │ ├── GetClassiMezzo_DB.cs │ │ ├── GetMessaggioPosizioneById_DB.cs │ │ ├── GetMezziInProssimita_DB.cs │ │ ├── GetMezziInRettangolo_DB.cs │ │ ├── GetMezziSilenti_DB.cs │ │ ├── GetPercorso_DB.cs │ │ ├── GetPosizioneByCodiceMezzo_DB.cs │ │ ├── GetPosizioneFlotta_DB.cs │ │ ├── Statistics │ │ │ ├── GetDailyStats_DB.cs │ │ │ ├── GetNumberOfMessagesStoredByTimeInterval_DB.cs │ │ │ └── GetNumberOfVehicles_DB.cs │ │ ├── StoreMessaggioPosizione_DB.cs │ │ ├── StoreMessaggioPosizione_DeleteInterpolatedMessages_Decorator.cs │ │ ├── StoreMessaggioPosizione_LogTooHighVelocities_Decorator.cs │ │ └── StoreMessaggioPosizione_VehicleLock_Decorator.cs │ ├── app.config │ └── packages.config ├── VVFGeoFleet.IntegrationTest │ ├── PositionMessageStorage.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── VVFGeoFleet.IntegrationTest.csproj │ ├── app.config │ └── packages.config ├── VVFGeoFleet.Test │ ├── CreazioneDatiFake.cs │ ├── IpCheckerTester.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── VVFGeoFleet.Test.csproj │ ├── app.config │ └── packages.config ├── VVFGeoFleet.licenseheader ├── VVFGeoFleet.sln └── VVFGeoFleet │ ├── ----Web.Debug.config │ ├── ----Web.Release.config │ ├── App_Start │ ├── SimpleInjectorWebApiInitializer.cs │ └── WebApiConfig.cs │ ├── Authorization │ └── IpBased │ │ └── IpAuthChecker.cs │ ├── Bindings.cs │ ├── Configurazione │ └── AppConfig_FromWebConfig.cs │ ├── Controllers │ ├── ClassiMezzoController.cs │ ├── InRettangoloController.cs │ ├── MessaggiPosizioneController.cs │ ├── MezziSilentiController.cs │ ├── PercorsoController.cs │ ├── PosizioneByCodiceMezzoController.cs │ ├── PosizioneFlottaController.cs │ ├── ProssimitaController.cs │ └── StatisticsController.cs │ ├── Global.asax │ ├── Global.asax.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── Scripts │ ├── jquery.signalR-2.4.0.js │ ├── jquery.signalR-2.4.0.min.js │ ├── jquery.signalR-2.4.1.js │ └── jquery.signalR-2.4.1.min.js │ ├── VVFGeoFleet.csproj │ ├── Web.Debug.config │ ├── Web.Release.config │ ├── Web.config │ ├── WebSocket │ ├── DatiPosizioneLive.cs │ └── StartupWebSocket.cs │ ├── actions.http │ └── packages.config └── frontend ├── .gitignore └── dashboard ├── .editorconfig ├── .gitignore ├── .vscode └── launch.json ├── README.md ├── ____backup prima della migrazione alla v.6 - package.json ├── angular.json ├── e2e ├── app.e2e-spec.ts ├── app.po.ts └── tsconfig.e2e.json ├── karma.conf.js ├── pack-list.txt ├── package-lock.json ├── package.json ├── protractor.conf.js ├── proxy.config.json ├── src ├── app │ ├── app.component.css │ ├── app.component.html │ ├── app.component.spec.ts │ ├── app.component.ts │ ├── elenco-posizioni-flotta │ │ ├── elenco-posizioni-flotta.component.css │ │ ├── elenco-posizioni-flotta.component.html │ │ ├── elenco-posizioni-flotta.component.spec.ts │ │ └── elenco-posizioni-flotta.component.ts │ ├── filtri │ │ ├── filtri.component.css │ │ ├── filtri.component.html │ │ ├── filtri.component.spec.ts │ │ ├── filtri.component.ts │ │ └── voce-filtro.model.ts │ ├── filtro-multi-select-dd │ │ ├── filtro-multi-select-dd.component.css │ │ ├── filtro-multi-select-dd.component.html │ │ ├── filtro-multi-select-dd.component.spec.ts │ │ └── filtro-multi-select-dd.component.ts │ ├── gmaps-posizioni-flotta │ │ ├── gmaps-posizioni-flotta.component.css │ │ ├── gmaps-posizioni-flotta.component.html │ │ ├── gmaps-posizioni-flotta.component.spec.ts │ │ └── gmaps-posizioni-flotta.component.ts │ ├── mappa-posizioni-flotta │ │ ├── mappa-posizioni-flotta.component.css │ │ ├── mappa-posizioni-flotta.component.html │ │ ├── mappa-posizioni-flotta.component.spec.ts │ │ └── mappa-posizioni-flotta.component.ts │ ├── pannello-filtri │ │ ├── pannello-filtri.component.css │ │ ├── pannello-filtri.component.html │ │ ├── pannello-filtri.component.spec.ts │ │ └── pannello-filtri.component.ts │ ├── pannello-opzioni │ │ ├── pannello-opzioni.component.css │ │ ├── pannello-opzioni.component.html │ │ ├── pannello-opzioni.component.spec.ts │ │ └── pannello-opzioni.component.ts │ ├── posizione-mezzo │ │ ├── posizione-mezzo.component.css │ │ ├── posizione-mezzo.component.html │ │ ├── posizione-mezzo.component.spec.ts │ │ └── posizione-mezzo.component.ts │ ├── service-VVFGeoFleet │ │ ├── posizione-flotta.service.fake.ts │ │ ├── posizione-flotta.service.spec.ts │ │ └── posizione-flotta.service.ts │ ├── service-dispatcher │ │ ├── flotta-dispatcher.service.spec.ts │ │ └── flotta-dispatcher.service.ts │ ├── service-filter │ │ ├── gestione-filtri.service.spec.ts │ │ └── gestione-filtri.service.ts │ ├── service-opzioni │ │ ├── gestione-opzioni.service.spec.ts │ │ └── gestione-opzioni.service.ts │ ├── service-parametri │ │ ├── gestione-parametri.service.spec.ts │ │ └── gestione-parametri.service.ts │ └── shared │ │ ├── css │ │ └── badge-stati-mezzo.css │ │ ├── directive │ │ └── agm-get-map-objects.ts │ │ ├── model │ │ ├── mezzo.model.ts │ │ ├── opzioni.model.ts │ │ ├── parametri-geofleet-ws.model.ts │ │ ├── posizione-mezzo.model.ts │ │ └── risultati-mezzi-in-rettangolo.model.ts │ │ └── pipes │ │ └── distanza-temporale.pipe.ts ├── assets │ ├── .gitkeep │ └── images │ │ ├── Fire-Truck.png │ │ ├── car.png │ │ ├── mm_20_black.png │ │ ├── mm_20_blue.png │ │ ├── mm_20_blue_scuro.png │ │ ├── mm_20_cyan.png │ │ ├── mm_20_gray.png │ │ ├── mm_20_green.png │ │ ├── mm_20_orange.png │ │ ├── mm_20_purple.png │ │ ├── mm_20_red.png │ │ ├── mm_20_yellow.png │ │ ├── mm_30_black.png │ │ ├── mm_30_blue.png │ │ ├── mm_30_blue_scuro.png │ │ ├── mm_30_cyan.png │ │ ├── mm_30_gray.png │ │ ├── mm_30_green.png │ │ ├── mm_30_orange.png │ │ ├── mm_30_purple.png │ │ ├── mm_30_red.png │ │ ├── mm_30_yellow.png │ │ ├── mm_40_blue_scuro.png │ │ └── mm_60_blue_scuro.png ├── favicon.ico ├── img │ └── car.png ├── main.ts ├── note.txt ├── polyfills.ts ├── styles.css ├── test.ts ├── tsconfig.app.json ├── tsconfig.spec.json └── typings.d.ts ├── tsconfig.json └── tslint.json /.gitignore: -------------------------------------------------------------------------------- 1 | *.bak 2 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Authors are those listed in the github pages as contributors. 2 | -------------------------------------------------------------------------------- /docs/frontend_screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/docs/frontend_screenshot.png -------------------------------------------------------------------------------- /src/backend/IpTools/IpNetworkChecker.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Linq; 23 | using System.Net; 24 | 25 | namespace IpTools 26 | { 27 | public class IpNetworkChecker 28 | { 29 | /// 30 | /// Checks if an ipAddress is contained withina container 31 | /// 32 | /// The ipAddress to be checked 33 | /// 34 | /// The container. Can be a plain ip address or a network represented in CIDR format (e.g. 10.0.0.0/24) 35 | /// 36 | /// True if (and only if) ip address is contained in the container 37 | public bool Check(string ipAddress, string container) 38 | { 39 | if (this.IsNetwork(container)) 40 | return this.IsInRange(ipAddress, container); 41 | 42 | return ipAddress == container; 43 | } 44 | 45 | // true if ipAddress falls inside the CIDR range, example bool result = 46 | // IsInRange("10.50.30.7", "10.0.0.0/8"); https://stackoverflow.com/a/17210019/1045789 47 | private bool IsInRange(string ipAddress, string cidrMaskStr) 48 | { 49 | var parts = cidrMaskStr.Split('/'); 50 | 51 | var IP_addr = BitConverter.ToInt32(IPAddress.Parse(parts[0]).GetAddressBytes(), 0); 52 | var cidrAddr = BitConverter.ToInt32(IPAddress.Parse(ipAddress).GetAddressBytes(), 0); 53 | var cidrMask = IPAddress.HostToNetworkOrder(-1 << (32 - int.Parse(parts[1]))); 54 | 55 | return ((IP_addr & cidrMask) == (cidrAddr & cidrMask)); 56 | } 57 | 58 | private bool IsIpAddress(string toBeChecked) 59 | { 60 | var octectsStr = toBeChecked.Split('.'); 61 | 62 | if (octectsStr.Length != 4) 63 | return false; 64 | 65 | var octects = octectsStr.Select(o => Convert.ToByte(o)); 66 | 67 | if (octects.Any(o => o < 0 && o > 255)) 68 | return false; 69 | 70 | return true; 71 | } 72 | 73 | private bool IsNetwork(string toBeChecked) 74 | { 75 | var parts = toBeChecked.Split('/'); 76 | 77 | if (parts.Length != 2) 78 | return false; 79 | 80 | if (!this.IsIpAddress(parts[0])) 81 | return false; 82 | 83 | var maskLen = Convert.ToByte(parts[1]); 84 | 85 | if (maskLen < 1 || maskLen > 31) 86 | return false; 87 | 88 | return true; 89 | } 90 | } 91 | } 92 | -------------------------------------------------------------------------------- /src/backend/IpTools/IpTools.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {6BC12BD0-21E7-4C09-ADF9-50D629046411} 8 | Library 9 | Properties 10 | IpTools 11 | IpTools 12 | v4.6.1 13 | 512 14 | 15 | 16 | true 17 | full 18 | false 19 | bin\Debug\ 20 | DEBUG;TRACE 21 | prompt 22 | 4 23 | 24 | 25 | pdbonly 26 | true 27 | bin\Release\ 28 | TRACE 29 | prompt 30 | 4 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | VVFGeoFleet.licenseheader 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /src/backend/IpTools/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Reflection; 22 | using System.Runtime.InteropServices; 23 | 24 | // Le informazioni generali relative a un assembly sono controllate dal seguente set di attributi. 25 | // Modificare i valori di questi attributi per modificare le informazioni associate a un assembly. 26 | [assembly: AssemblyTitle("IpTools")] 27 | [assembly: AssemblyDescription("")] 28 | [assembly: AssemblyConfiguration("")] 29 | [assembly: AssemblyCompany("")] 30 | [assembly: AssemblyProduct("IpTools")] 31 | [assembly: AssemblyCopyright("Copyright © 2018")] 32 | [assembly: AssemblyTrademark("")] 33 | [assembly: AssemblyCulture("")] 34 | 35 | // Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili ai componenti 36 | // COM. Se è necessario accedere a un tipo in questo assembly da COM, impostare su true l'attributo 37 | // ComVisible per tale tipo. 38 | [assembly: ComVisible(false)] 39 | 40 | // Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi 41 | [assembly: Guid("6bc12bd0-21e7-4c09-adf9-50d629046411")] 42 | 43 | // Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori: 44 | // 45 | // Versione principale Versione secondaria Numero di build Revisione 46 | // 47 | // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi 48 | // alla revisione e alla build usando l'asterisco '*' come illustrato di seguito: [assembly: AssemblyVersion("1.0.*")] 49 | [assembly: AssemblyVersion("1.0.0.0")] 50 | [assembly: AssemblyFileVersion("1.0.0.0")] 51 | -------------------------------------------------------------------------------- /src/backend/Modello/Bindings.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using SimpleInjector; 22 | using SimpleInjector.Packaging; 23 | 24 | namespace Modello 25 | { 26 | public class Bindings : IPackage 27 | { 28 | public void RegisterServices(Container container) 29 | { 30 | container.Register(Lifestyle.Scoped); 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /src/backend/Modello/Classi/Fonte.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | namespace Modello.Classi 22 | { 23 | public class Fonte 24 | { 25 | public string CodiceFonte { get; set; } 26 | public string ClasseFonte { get; set; } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /src/backend/Modello/Classi/InfoFonte.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | namespace Modello.Classi 22 | { 23 | public class InfoFonte 24 | { 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/backend/Modello/Classi/InfoSO115.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | 23 | namespace Modello.Classi 24 | { 25 | public class InfoSO115 26 | { 27 | public string Stato { get; set; } 28 | public string CodiceIntervento { get; set; } 29 | public DateTime DataIntervento { get; set; } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /src/backend/Modello/Classi/InterpolationData.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | 23 | namespace Modello.Classi 24 | { 25 | public class InterpolationData 26 | { 27 | public InterpolationData(int length_sec, int messages, DateTime? lastMsgTime) 28 | { 29 | Length_sec = length_sec; 30 | Messages = messages; 31 | LastMsgTime = lastMsgTime; 32 | } 33 | 34 | public int Length_sec { get; set; } 35 | public int Messages { get; set; } 36 | public DateTime? LastMsgTime { get; set; } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/backend/Modello/Classi/Localizzazione.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Device.Location; 22 | 23 | namespace Modello.Classi 24 | { 25 | public class Localizzazione 26 | { 27 | private string type = "Point"; 28 | private double[] coordinates = new double[2]; 29 | 30 | public double Lat 31 | { 32 | get { return this.coordinates[1]; } 33 | set { this.coordinates[1] = value; } 34 | } 35 | 36 | public double Lon 37 | { 38 | get { return this.coordinates[0]; } 39 | set { coordinates[0] = value; } 40 | } 41 | 42 | /// 43 | /// The distance between the two coordinates, in meters. 44 | /// 45 | /// The second location 46 | /// The distance in meters 47 | public double GetDistanceTo(Localizzazione loc) 48 | { 49 | var coord1 = new GeoCoordinate(this.Lat, this.Lon); 50 | var coord2 = new GeoCoordinate(loc.Lat, loc.Lon); 51 | 52 | var distance = coord1.GetDistanceTo(coord2); 53 | return distance; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/backend/Modello/Classi/MessaggioPosizione.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | 23 | namespace Modello.Classi 24 | { 25 | public class MessaggioPosizione 26 | { 27 | public string Id { get; set; } 28 | 29 | public string CodiceMezzo { get; set; } 30 | public string[] ClassiMezzo { get; set; } 31 | public Localizzazione Localizzazione { get; set; } 32 | public DateTime IstanteAcquisizione { get; set; } 33 | public Fonte Fonte { get; set; } 34 | public InfoFonte InfoFonte { get; set; } 35 | public InfoSO115 InfoSO115 { get; set; } 36 | public DateTime IstanteArchiviazione { get; set; } 37 | public bool Ultimo { get; set; } 38 | public InterpolationData InterpolationData { get; set; } 39 | public short Velocity { get; set; } 40 | public short Direction { get; set; } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/backend/Modello/Configurazione/IAppConfig.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | namespace Modello.Configurazione 22 | { 23 | public interface IAppConfig 24 | { 25 | string ConnectionString { get; } 26 | string DatabaseName { get; } 27 | bool DoCreateIndexes { get; } 28 | int OrizzonteTemporale_sec { get; } 29 | 30 | #region Interpolation data 31 | 32 | bool InterpolationActive { get; } 33 | float InterpolationThreshold_mt { get; } 34 | 35 | #endregion Interpolation data 36 | 37 | #region Too high velocity logging 38 | 39 | bool TooHighVelocityLoggingActive { get; } 40 | int VelocityThreshold_Kmh { get; } 41 | 42 | #endregion Too high velocity logging 43 | 44 | #region vechicle Locking 45 | 46 | int NumberOfRetries { get; } 47 | int RetriesInterval_msec { get; } 48 | 49 | #endregion vechicle Locking 50 | 51 | #region ip based authorization 52 | 53 | bool IpAuthEnabled { get; } 54 | string[] AuthorizedIpSources { get; } 55 | 56 | #endregion ip based authorization 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/backend/Modello/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Reflection; 22 | using System.Runtime.InteropServices; 23 | 24 | // Le informazioni generali relative a un assembly sono controllate dal seguente set di attributi. 25 | // Modificare i valori di questi attributi per modificare le informazioni associate a un assembly. 26 | [assembly: AssemblyTitle("Modello")] 27 | [assembly: AssemblyDescription("")] 28 | [assembly: AssemblyConfiguration("")] 29 | [assembly: AssemblyCompany("")] 30 | [assembly: AssemblyProduct("Modello")] 31 | [assembly: AssemblyCopyright("Copyright © 2017")] 32 | [assembly: AssemblyTrademark("")] 33 | [assembly: AssemblyCulture("")] 34 | 35 | // Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili ai componenti 36 | // COM. Se è necessario accedere a un tipo in questo assembly da COM, impostare su true l'attributo 37 | // ComVisible per tale tipo. 38 | [assembly: ComVisible(false)] 39 | 40 | // Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi 41 | [assembly: Guid("96daf73a-ca16-4f9f-b1bd-053e6af1157d")] 42 | 43 | // Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori: 44 | // 45 | // Versione principale Versione secondaria Numero di build Revisione 46 | // 47 | // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi 48 | // alla revisione e alla build usando l'asterisco '*' come illustrato di seguito: [assembly: AssemblyVersion("1.0.*")] 49 | [assembly: AssemblyVersion("1.0.0.0")] 50 | [assembly: AssemblyFileVersion("1.0.0.0")] 51 | -------------------------------------------------------------------------------- /src/backend/Modello/Servizi/Persistence/GeoQuery/InRettangolo/IGetMezziInRettangolo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | namespace Modello.Servizi.Persistence.GeoQuery.InRettangolo 22 | { 23 | public interface IGetMezziInRettangolo 24 | { 25 | QueryInRettangoloResult Get(Rettangolo rettangolo, string[] classiMezzo, int attSec); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/backend/Modello/Servizi/Persistence/GeoQuery/InRettangolo/QueryInRettangoloResult.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using Modello.Classi; 23 | 24 | namespace Modello.Servizi.Persistence.GeoQuery.InRettangolo 25 | { 26 | public class QueryInRettangoloResult 27 | { 28 | public DateTime IstanteQuery { get; set; } 29 | public Rettangolo Rettangolo { get; set; } 30 | public string[] ClassiMezzo { get; set; } 31 | public int NumeroMezzi { get; set; } 32 | public long DurataQuery_msec { get; set; } 33 | public MessaggioPosizione[] Risultati { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/backend/Modello/Servizi/Persistence/GeoQuery/InRettangolo/Rettangolo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using Modello.Classi; 22 | 23 | namespace Modello.Servizi.Persistence.GeoQuery.InRettangolo 24 | { 25 | public class Rettangolo 26 | { 27 | public Rettangolo() 28 | { 29 | this.TopLeft = new Localizzazione(); 30 | this.BottomRight = new Localizzazione(); 31 | } 32 | 33 | public Localizzazione TopLeft { get; set; } 34 | public Localizzazione BottomRight { get; set; } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/backend/Modello/Servizi/Persistence/GeoQuery/Prossimita/IGetMezziInProssimita.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using Modello.Classi; 22 | 23 | namespace Modello.Servizi.Persistence.GeoQuery.Prossimita 24 | { 25 | public interface IGetMezziInProssimita 26 | { 27 | QueryProssimitaResult Get(Localizzazione punto, float distanzaMaxMt, string[] classiMezzo, int attSec); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/backend/Modello/Servizi/Persistence/GeoQuery/Prossimita/ProssimitaMezzo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using Modello.Classi; 22 | 23 | namespace Modello.Servizi.Persistence.GeoQuery.Prossimita 24 | { 25 | public class ProssimitaMezzo 26 | { 27 | public MessaggioPosizione MessaggioPosizione { get; set; } 28 | public float DistanzaMt { get; set; } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /src/backend/Modello/Servizi/Persistence/GeoQuery/Prossimita/QueryProssimitaResult.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using Modello.Classi; 23 | 24 | namespace Modello.Servizi.Persistence.GeoQuery.Prossimita 25 | { 26 | public class QueryProssimitaResult 27 | { 28 | public DateTime IstanteQuery { get; set; } 29 | public Localizzazione Punto { get; set; } 30 | public float DistanzaMaxMt { get; set; } 31 | public int NumeroMezzi { get; set; } 32 | public long DurataQuery_msec { get; set; } 33 | public ProssimitaMezzo[] Risultati { get; set; } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/backend/Modello/Servizi/Persistence/IGetClassimezzo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Collections.Generic; 22 | 23 | namespace Modello.Servizi.Persistence 24 | { 25 | public interface IGetClassiMezzo 26 | { 27 | IDictionary Get(int activeWithinSeconds); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/backend/Modello/Servizi/Persistence/IGetMessaggioPosizioneById.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using Modello.Classi; 22 | 23 | namespace Modello.Servizi.Persistence 24 | { 25 | public interface IGetMessaggioPosizioneById 26 | { 27 | MessaggioPosizione Get(string id); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/backend/Modello/Servizi/Persistence/IGetMezziSilenti.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Collections.Generic; 22 | using Modello.Classi; 23 | 24 | namespace Modello.Servizi.Persistence 25 | { 26 | public interface IGetMezziSilenti 27 | { 28 | IEnumerable Get(int daSecondi); 29 | 30 | IEnumerable Get(int daSecondi, string[] classiMezzo); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/backend/Modello/Servizi/Persistence/IGetPercorso.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using Modello.Classi; 24 | 25 | namespace Modello.Servizi.Persistence 26 | { 27 | /// 28 | /// Restituisce tutti i messaggi di posizione relativi ad un mezzo in un intervallo temporale. 29 | /// 30 | public interface IGetPercorso 31 | { 32 | /// 33 | /// Restituisce tutti i messaggi di posizione relativi ad un mezzo in un intervallo temporale. 34 | /// 35 | /// Il codice del mezzo 36 | /// L'istante di inizio dell'intervallo temporale 37 | /// L'istante di fine dell'intervallo temporale 38 | /// I messaggi di posizione ordinati in ordine cronologico crescente 39 | IEnumerable Get(string codiceMezzo, DateTime from, DateTime to); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/backend/Modello/Servizi/Persistence/IGetPosizioneByCodiceMezzo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using Modello.Classi; 22 | 23 | namespace Modello.Servizi.Persistence 24 | { 25 | /// 26 | /// Restituisce il messaggio posizione più aggiornato, o affidabile, per il mezzo avente codice specificato. 27 | /// 28 | public interface IGetPosizioneByCodiceMezzo 29 | { 30 | /// 31 | /// Restituisce il messaggio posizione più aggiornato, o affidabile, per il mezzo avente 32 | /// codice specificato. 33 | /// 34 | /// Il codice del mezzo 35 | /// Il messaggio di posizione più aggiornato o affidabile. 36 | MessaggioPosizione Get(string codiceMezzo); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/backend/Modello/Servizi/Persistence/IGetPosizioneFlotta.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Collections.Generic; 22 | using Modello.Classi; 23 | 24 | namespace Modello.Servizi.Persistence 25 | { 26 | public interface IGetPosizioneFlotta 27 | { 28 | IEnumerable Get(int attSec); 29 | 30 | IEnumerable Get(string[] classiMezzo, int attSec); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /src/backend/Modello/Servizi/Persistence/IStoreMessaggioPosizione.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using Modello.Classi; 22 | 23 | namespace Modello.Servizi.Persistence 24 | { 25 | public interface IStoreMessaggioPosizione 26 | { 27 | void Store(MessaggioPosizione messaggio); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/backend/Modello/Servizi/Statistics/IGetDailyStats.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Collections.Generic; 22 | using System.Threading.Tasks; 23 | 24 | namespace Modello.Servizi.Statistics 25 | { 26 | /// 27 | /// Gets statistics on the number of inserted records day per day 28 | /// 29 | public interface IGetDailyStats 30 | { 31 | /// 32 | /// Gets statistics on the number of inserted records day per day 33 | /// 34 | /// The number of past days to go behind 35 | /// Statistics 36 | IEnumerable Get(int howManyDays); 37 | 38 | /// 39 | /// Gets statistics on the number of inserted records day per day 40 | /// 41 | /// The number of past days to go behind 42 | /// Statistics 43 | Task> GetAsync(int howManyDays); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/backend/Modello/Servizi/Statistics/IGetNumberOfMessagesStoredByTimeInterval.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Threading.Tasks; 23 | 24 | namespace Modello.Servizi.Statistics 25 | { 26 | public interface IGetNumberOfMessagesStoredByTimeInterval 27 | { 28 | /// 29 | /// Gets the number of messages stored. 30 | /// 31 | /// Start of time interval 32 | /// End of time interval 33 | /// Information about number of messages 34 | MsgNum Get(DateTime fromTime, DateTime toTime); 35 | 36 | /// 37 | /// Gets the number of messages stored. 38 | /// 39 | /// Start of time interval 40 | /// End of time interval 41 | /// Information about number of messages 42 | Task GetAsync(DateTime fromTime, DateTime toTime); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /src/backend/Modello/Servizi/Statistics/IGetNumberOfVehicles.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Threading.Tasks; 22 | 23 | namespace Modello.Servizi.Statistics 24 | { 25 | public interface IGetNumberOfVehicles 26 | { 27 | /// 28 | /// Gets the number of vehicles stored in the database 29 | /// 30 | /// Number of vehicles 31 | long Get(); 32 | 33 | /// 34 | /// Gets the number of vehicles stored in the database 35 | /// 36 | /// Number of vehicles 37 | Task GetAsync(); 38 | 39 | /// 40 | /// Gets the number of vehicles stored in the database 41 | /// 42 | /// Seconds to go back to consider active a vehicle 43 | /// Number of vehicles 44 | long GetActive(int withinSeconds); 45 | 46 | /// 47 | /// Gets the number of vehicles stored in the database 48 | /// 49 | /// Seconds to go back to consider active a vehicle 50 | /// Number of vehicles 51 | Task GetActiveAsync(int withinSeconds); 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /src/backend/Modello/Servizi/Statistics/IGetStatistics.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Threading.Tasks; 22 | 23 | namespace Modello.Servizi.Statistics 24 | { 25 | public interface IGetStatistics 26 | { 27 | Task GetAsync(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /src/backend/Modello/Servizi/Statistics/MsgNum.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | namespace Modello.Servizi.Statistics 22 | { 23 | public class MsgNum 24 | { 25 | public MsgNum(long netNumber, long numberWithInterpolated) 26 | { 27 | NetNumber = netNumber; 28 | NumberWithInterpolated = numberWithInterpolated; 29 | } 30 | 31 | public long NetNumber { get; } 32 | public long NumberWithInterpolated { get; } 33 | 34 | public static MsgNum NullValue 35 | { 36 | get 37 | { 38 | return new MsgNum(0, 0); 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /src/backend/Modello/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /src/backend/Persistence.MongoDB/Classes/VehicleLock.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | 23 | namespace Persistence.MongoDB.Classes 24 | { 25 | internal class VehicleLock 26 | { 27 | public VehicleLock(string vehicleCode) 28 | { 29 | this.VehicleCode = vehicleCode ?? throw new ArgumentNullException(nameof(vehicleCode)); 30 | this.InsertionTime = DateTime.UtcNow; 31 | } 32 | 33 | public string VehicleCode { get; internal set; } 34 | public DateTime InsertionTime { get; internal set; } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/backend/Persistence.MongoDB/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Reflection; 22 | using System.Runtime.CompilerServices; 23 | using System.Runtime.InteropServices; 24 | 25 | // Le informazioni generali relative a un assembly sono controllate dal seguente set di attributi. 26 | // Modificare i valori di questi attributi per modificare le informazioni associate a un assembly. 27 | [assembly: AssemblyTitle("Persistence.MongoDB")] 28 | [assembly: AssemblyDescription("")] 29 | [assembly: AssemblyConfiguration("")] 30 | [assembly: AssemblyCompany("")] 31 | [assembly: AssemblyProduct("Persistence.MongoDB")] 32 | [assembly: AssemblyCopyright("Copyright © 2017")] 33 | [assembly: AssemblyTrademark("")] 34 | [assembly: AssemblyCulture("")] 35 | 36 | // Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili ai componenti 37 | // COM. Se è necessario accedere a un tipo in questo assembly da COM, impostare su true l'attributo 38 | // ComVisible per tale tipo. 39 | [assembly: ComVisible(false)] 40 | 41 | // Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi 42 | [assembly: Guid("a5eb7ac8-7715-4a42-ab29-43f6d82dbb03")] 43 | 44 | // Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori: 45 | // 46 | // Versione principale Versione secondaria Numero di build Revisione 47 | // 48 | // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi 49 | // alla revisione e alla build usando l'asterisco '*' come illustrato di seguito: [assembly: AssemblyVersion("1.0.*")] 50 | [assembly: AssemblyVersion("1.0.0.0")] 51 | [assembly: AssemblyFileVersion("1.0.0.0")] 52 | [assembly: InternalsVisibleTo("VVFGeoFleet.Test")] 53 | [assembly: InternalsVisibleTo("VVFGeoFleet.IntegrationTest")] 54 | -------------------------------------------------------------------------------- /src/backend/Persistence.MongoDB/Servizi/GetClassiMezzo_DB.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using Modello.Classi; 25 | using Modello.Servizi.Persistence; 26 | using MongoDB.Driver; 27 | 28 | namespace Persistence.MongoDB.Servizi 29 | { 30 | internal class GetClassiMezzo_DB : IGetClassiMezzo 31 | { 32 | private readonly IMongoCollection messaggiPosizioneCollection; 33 | 34 | public GetClassiMezzo_DB(IMongoCollection messaggiPosizioneCollection) 35 | { 36 | this.messaggiPosizioneCollection = messaggiPosizioneCollection; 37 | } 38 | 39 | public IDictionary Get(int attSec) 40 | { 41 | var classiMezzo = this.messaggiPosizioneCollection.Aggregate() 42 | .Match(m => m.Ultimo && m.IstanteAcquisizione > DateTime.UtcNow.AddSeconds(-attSec)) 43 | .Unwind("classiMezzo") 44 | .SortByCount("$classiMezzo") 45 | .ToList(); 46 | 47 | return classiMezzo.ToDictionary(k => k.Id, v => v.Count); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/backend/Persistence.MongoDB/Servizi/GetMessaggioPosizioneById_DB.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Linq; 23 | using Modello.Classi; 24 | using Modello.Servizi.Persistence; 25 | using MongoDB.Driver; 26 | 27 | namespace Persistence.MongoDB.Servizi 28 | { 29 | internal class GetMessaggioPosizioneById_DB : IGetMessaggioPosizioneById 30 | { 31 | private readonly IMongoCollection messaggiPosizioneCollection; 32 | 33 | public GetMessaggioPosizioneById_DB(IMongoCollection messaggiPosizioneCollection) 34 | { 35 | this.messaggiPosizioneCollection = messaggiPosizioneCollection ?? throw new ArgumentNullException(nameof(messaggiPosizioneCollection)); 36 | } 37 | 38 | public MessaggioPosizione Get(string id) 39 | { 40 | return this.messaggiPosizioneCollection 41 | .Find(m => m.Id == id) 42 | .Single(); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/backend/Persistence.MongoDB/Servizi/GetMezziSilenti_DB.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using Modello.Classi; 24 | using Modello.Servizi.Persistence; 25 | using MongoDB.Driver; 26 | 27 | namespace Persistence.MongoDB.Servizi 28 | { 29 | internal class GetMezziSilenti_DB : IGetMezziSilenti 30 | { 31 | private readonly IMongoCollection messaggiPosizione; 32 | 33 | public GetMezziSilenti_DB(IMongoCollection messaggiPosizione) 34 | { 35 | this.messaggiPosizione = messaggiPosizione; 36 | } 37 | 38 | /// 39 | /// Restituisce la posizione dei mezzi per i quali non c'è un messaggio sufficientemente recente 40 | /// 41 | /// Numero di secondi entro i quali non è presente un messaggio 42 | /// Messaggi posizione meno recenti 43 | public IEnumerable Get(int daSecondi) 44 | { 45 | return this.Get(daSecondi, classiMezzo: null); 46 | } 47 | 48 | /// 49 | /// Restituisce la posizione dei mezzi per i quali non c'è un messaggio sufficientemente recente 50 | /// 51 | /// Numero di secondi entro i quali non è presente un messaggio 52 | /// Le classi mezzo da filtrare 53 | /// Messaggi posizione meno recenti 54 | public IEnumerable Get(int daSecondi, string[] classiMezzo) 55 | { 56 | var filter = Builders.Filter 57 | .And( 58 | Builders.Filter.Eq(m => m.Ultimo, true), 59 | Builders.Filter.Lt(m => m.IstanteAcquisizione, DateTime.UtcNow.AddSeconds(-daSecondi)) 60 | ); 61 | 62 | if (classiMezzo != null && classiMezzo.Length > 0) 63 | { 64 | var classFilter = Builders.Filter 65 | .AnyIn(m => m.ClassiMezzo, classiMezzo); 66 | 67 | filter &= classFilter; 68 | } 69 | 70 | return this.messaggiPosizione.Find(filter) 71 | .SortBy(m => m.CodiceMezzo) 72 | .ToEnumerable(); 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/backend/Persistence.MongoDB/Servizi/GetPercorso_DB.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using Modello.Classi; 24 | using Modello.Servizi.Persistence; 25 | using MongoDB.Driver; 26 | 27 | namespace Persistence.MongoDB.Servizi 28 | { 29 | internal class GetPercorso_DB : IGetPercorso 30 | { 31 | private readonly IMongoCollection messaggiPosizioneCollection; 32 | 33 | public GetPercorso_DB(IMongoCollection messaggiPosizioneCollection) 34 | { 35 | this.messaggiPosizioneCollection = messaggiPosizioneCollection ?? throw new ArgumentNullException(nameof(messaggiPosizioneCollection)); 36 | } 37 | 38 | public IEnumerable Get(string codiceMezzo, DateTime from, DateTime to) 39 | { 40 | return this.messaggiPosizioneCollection.Find(m => 41 | m.CodiceMezzo == codiceMezzo && 42 | m.IstanteAcquisizione >= from && 43 | m.IstanteAcquisizione <= to) 44 | .SortBy(m => m.IstanteAcquisizione) 45 | .ToEnumerable(); 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /src/backend/Persistence.MongoDB/Servizi/GetPosizioneByCodiceMezzo_DB.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Linq; 22 | using Modello.Classi; 23 | using Modello.Servizi.Persistence; 24 | using MongoDB.Driver; 25 | 26 | namespace Persistence.MongoDB.Servizi 27 | { 28 | internal class GetPosizioneByCodiceMezzo_DB : IGetPosizioneByCodiceMezzo 29 | { 30 | private readonly IMongoCollection messaggiPosizioneCollection; 31 | 32 | public GetPosizioneByCodiceMezzo_DB(IMongoCollection messaggiPosizioneCollection) 33 | { 34 | this.messaggiPosizioneCollection = messaggiPosizioneCollection; 35 | } 36 | 37 | public MessaggioPosizione Get(string codiceMezzo) 38 | { 39 | return this.messaggiPosizioneCollection.Find(m => m.Ultimo && m.CodiceMezzo == codiceMezzo) 40 | .SortByDescending(m => m.IstanteAcquisizione) 41 | .Limit(1) 42 | .Single(); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/backend/Persistence.MongoDB/Servizi/GetPosizioneFlotta_DB.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using Modello.Classi; 24 | using Modello.Servizi.Persistence; 25 | using MongoDB.Driver; 26 | 27 | namespace Persistence.MongoDB.Servizi 28 | { 29 | internal class GetPosizioneFlotta_DB : IGetPosizioneFlotta 30 | { 31 | private readonly IMongoCollection messaggiPosizione; 32 | 33 | public GetPosizioneFlotta_DB(IMongoCollection messaggiPosizione) 34 | { 35 | this.messaggiPosizione = messaggiPosizione; 36 | } 37 | 38 | public IEnumerable Get(int attSec) 39 | { 40 | return this.Get(null, attSec); 41 | } 42 | 43 | /// 44 | /// Restituisce la posizione dei mezzi attivi 45 | /// 46 | /// Filtro sulle classi dei mezzi 47 | /// 48 | /// I secondi entro cui deve essere stato inviato l'ultimo messaggio di posizione perché il 49 | /// mezzo sia considerato attivo 50 | /// 51 | /// La posizione della flotta 52 | public IEnumerable Get(string[] classiMezzo, int attSec) 53 | { 54 | var filter = Builders.Filter 55 | .And( 56 | Builders.Filter.Eq(m => m.Ultimo, true), 57 | Builders.Filter.Gte(m => m.IstanteAcquisizione, DateTime.UtcNow.AddSeconds(-attSec)) 58 | ); 59 | 60 | if (classiMezzo != null && classiMezzo.Length > 0) 61 | { 62 | var classFilter = Builders 63 | .Filter 64 | .AnyIn(m => m.ClassiMezzo, classiMezzo); 65 | 66 | filter &= classFilter; 67 | } 68 | 69 | return this.messaggiPosizione.Find(filter) 70 | .SortBy(m => m.CodiceMezzo) 71 | .ToEnumerable(); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/backend/Persistence.MongoDB/Servizi/Statistics/GetDailyStats_DB.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Linq; 24 | using System.Threading.Tasks; 25 | using Modello.Classi; 26 | using Modello.Servizi.Statistics; 27 | using MongoDB.Driver; 28 | 29 | namespace Persistence.MongoDB.Servizi.Statistics 30 | { 31 | internal class GetDailyStats_DB : IGetDailyStats 32 | { 33 | private readonly IMongoCollection messaggiPosizioneCollection; 34 | 35 | public GetDailyStats_DB(IMongoCollection messaggiPosizioneCollection) 36 | { 37 | this.messaggiPosizioneCollection = messaggiPosizioneCollection ?? throw new ArgumentNullException(nameof(messaggiPosizioneCollection)); 38 | } 39 | 40 | public IEnumerable Get(int howManyDays) 41 | { 42 | return this.GetAsync(howManyDays).Result; 43 | } 44 | 45 | public async Task> GetAsync(int howManyDays) 46 | { 47 | return await this.messaggiPosizioneCollection.Aggregate() 48 | .Match(m => m.IstanteArchiviazione >= DateTime.UtcNow.Date.AddDays(-howManyDays)) 49 | .Group(m => new 50 | { 51 | year = m.IstanteArchiviazione.Year, 52 | month = m.IstanteArchiviazione.Month, 53 | day = m.IstanteArchiviazione.Day 54 | }, 55 | g => new 56 | { 57 | key = g.Key, 58 | Net = g.Count(), 59 | WithInterpolation = g.Sum(m => 1 + (m.InterpolationData != null ? m.InterpolationData.Messages : 0)) 60 | }) 61 | .SortByDescending(r => r.key.year) 62 | .ThenByDescending(r => r.key.month) 63 | .ThenByDescending(r => r.key.day) 64 | .ToListAsync(); 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /src/backend/Persistence.MongoDB/Servizi/Statistics/GetNumberOfMessagesStoredByTimeInterval_DB.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Linq; 23 | using System.Threading.Tasks; 24 | using Modello.Classi; 25 | using Modello.Servizi.Statistics; 26 | using MongoDB.Driver; 27 | 28 | namespace Persistence.MongoDB.Servizi.Statistics 29 | { 30 | public class GetNumberOfMessagesStoredByTimeInterval_DB : IGetNumberOfMessagesStoredByTimeInterval 31 | { 32 | private readonly IMongoCollection messaggiPosizioneCollection; 33 | 34 | public GetNumberOfMessagesStoredByTimeInterval_DB(IMongoCollection messaggiPosizioneCollection) 35 | { 36 | this.messaggiPosizioneCollection = messaggiPosizioneCollection ?? throw new ArgumentNullException(nameof(messaggiPosizioneCollection)); 37 | } 38 | 39 | public MsgNum Get(DateTime fromTime, DateTime toTime) 40 | { 41 | return this.GetAsync(fromTime, toTime).Result; 42 | } 43 | 44 | public async Task GetAsync(DateTime fromTime, DateTime toTime) 45 | { 46 | var msgNumTask = await this.messaggiPosizioneCollection.Aggregate() 47 | .Match(m => m.IstanteArchiviazione >= fromTime && 48 | m.IstanteArchiviazione <= toTime) 49 | .Group(m => (object)null, 50 | g => new MsgNum(g.Count(), g.Sum(m => 1 + (m.InterpolationData == null ? 0 : m.InterpolationData.Messages)))) 51 | .FirstOrDefaultAsync(); 52 | 53 | return msgNumTask ?? MsgNum.NullValue; 54 | } 55 | } 56 | } 57 | -------------------------------------------------------------------------------- /src/backend/Persistence.MongoDB/Servizi/Statistics/GetNumberOfVehicles_DB.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Threading.Tasks; 23 | using Modello.Classi; 24 | using Modello.Servizi.Statistics; 25 | using MongoDB.Driver; 26 | 27 | namespace Persistence.MongoDB.Servizi.Statistics 28 | { 29 | internal class GetNumberOfVehicles_DB : IGetNumberOfVehicles 30 | { 31 | private readonly IMongoCollection messaggiPosizioneCollection; 32 | 33 | public GetNumberOfVehicles_DB(IMongoCollection messaggiPosizioneCollection) 34 | { 35 | this.messaggiPosizioneCollection = messaggiPosizioneCollection ?? throw new ArgumentNullException(nameof(messaggiPosizioneCollection)); 36 | } 37 | 38 | public long Get() 39 | { 40 | return this.GetAsync().Result; 41 | } 42 | 43 | public long GetActive(int withinSeconds) 44 | { 45 | return this.GetActiveAsync(withinSeconds).Result; 46 | } 47 | 48 | public Task GetActiveAsync(int withinSeconds) 49 | { 50 | return this.messaggiPosizioneCollection.CountAsync(m => 51 | m.Ultimo && 52 | m.IstanteAcquisizione >= DateTime.UtcNow.AddSeconds(-withinSeconds)); 53 | } 54 | 55 | public Task GetAsync() 56 | { 57 | return this.messaggiPosizioneCollection.CountAsync(m => m.Ultimo); 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/backend/Persistence.MongoDB/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/backend/Persistence.MongoDB/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet.IntegrationTest/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Reflection; 22 | using System.Runtime.InteropServices; 23 | 24 | // Le informazioni generali relative a un assembly sono controllate dal seguente set di attributi. 25 | // Modificare i valori di questi attributi per modificare le informazioni associate a un assembly. 26 | [assembly: AssemblyTitle("VVFGeoFleet.IntegrationTest")] 27 | [assembly: AssemblyDescription("")] 28 | [assembly: AssemblyConfiguration("")] 29 | [assembly: AssemblyCompany("")] 30 | [assembly: AssemblyProduct("VVFGeoFleet.IntegrationTest")] 31 | [assembly: AssemblyCopyright("Copyright © 2018")] 32 | [assembly: AssemblyTrademark("")] 33 | [assembly: AssemblyCulture("")] 34 | 35 | // Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili ai componenti 36 | // COM. Se è necessario accedere a un tipo in questo assembly da COM, impostare su true l'attributo 37 | // ComVisible per tale tipo. 38 | [assembly: ComVisible(false)] 39 | 40 | // Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi 41 | [assembly: Guid("9cca2dc1-5757-4f26-a66e-3a09c311e595")] 42 | 43 | // Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori: 44 | // 45 | // Versione principale Versione secondaria Numero di build Revisione 46 | // 47 | // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi 48 | // alla revisione e alla build usando l'asterisco '*' come illustrato di seguito: [assembly: AssemblyVersion("1.0.*")] 49 | [assembly: AssemblyVersion("1.0.0.0")] 50 | [assembly: AssemblyFileVersion("1.0.0.0")] 51 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet.IntegrationTest/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet.IntegrationTest/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet.Test/IpCheckerTester.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using IpTools; 22 | using NUnit.Framework; 23 | 24 | namespace VVFGeoFleet.Test 25 | { 26 | [TestFixture] 27 | public class IpCheckerTester 28 | { 29 | [Test] 30 | public void TwoEqualIpAddressesAreContainedOneInTheOther() 31 | { 32 | var checker = new IpNetworkChecker(); 33 | 34 | var ip = "10.0.0.222"; 35 | var container = "10.0.0.222"; 36 | 37 | Assert.That(checker.Check(ip, container), Is.True); 38 | } 39 | 40 | [Test] 41 | public void TwoDifferentIpAddressesAreContainedOneInTheOther() 42 | { 43 | var checker = new IpNetworkChecker(); 44 | 45 | var ip = "10.0.0.222"; 46 | var container = "10.0.0.223"; 47 | 48 | Assert.That(checker.Check(ip, container), Is.False); 49 | } 50 | 51 | [Test] 52 | public void AnIpIsContainedInItsNetwork_Subnet24() 53 | { 54 | var checker = new IpNetworkChecker(); 55 | 56 | var ip = "10.0.0.222"; 57 | var container = "10.0.0.0/24"; 58 | 59 | Assert.That(checker.Check(ip, container), Is.True); 60 | } 61 | 62 | [Test] 63 | public void AnIpIsNotContainedInAnotherNetwork() 64 | { 65 | var checker = new IpNetworkChecker(); 66 | 67 | var ip = "10.0.1.222"; 68 | var container = "10.0.0.0/24"; 69 | 70 | Assert.That(checker.Check(ip, container), Is.False); 71 | } 72 | 73 | [Test] 74 | public void AnIpIsContainedInItsNetwork_Subnet23() 75 | { 76 | var checker = new IpNetworkChecker(); 77 | 78 | var ip = "10.0.1.222"; 79 | var container = "10.0.0.0/23"; 80 | 81 | Assert.That(checker.Check(ip, container), Is.True); 82 | } 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet.Test/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Reflection; 22 | using System.Runtime.InteropServices; 23 | 24 | // Le informazioni generali relative a un assembly sono controllate dal seguente set di attributi. 25 | // Modificare i valori di questi attributi per modificare le informazioni associate a un assembly. 26 | [assembly: AssemblyTitle("VVFGeoFleet.Test")] 27 | [assembly: AssemblyDescription("")] 28 | [assembly: AssemblyConfiguration("")] 29 | [assembly: AssemblyCompany("")] 30 | [assembly: AssemblyProduct("VVFGeoFleet.Test")] 31 | [assembly: AssemblyCopyright("Copyright © 2017")] 32 | [assembly: AssemblyTrademark("")] 33 | [assembly: AssemblyCulture("")] 34 | 35 | // Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili ai componenti 36 | // COM. Se è necessario accedere a un tipo in questo assembly da COM, impostare su true l'attributo 37 | // ComVisible per tale tipo. 38 | [assembly: ComVisible(false)] 39 | 40 | // Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi 41 | [assembly: Guid("fc97859c-0040-4f63-b730-56752783d46b")] 42 | 43 | // Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori: 44 | // 45 | // Versione principale Versione secondaria Numero di build Revisione 46 | // 47 | // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi 48 | // alla revisione e alla build usando l'asterisco '*' come illustrato di seguito: [assembly: AssemblyVersion("1.0.*")] 49 | [assembly: AssemblyVersion("1.0.0.0")] 50 | [assembly: AssemblyFileVersion("1.0.0.0")] 51 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet.Test/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet.Test/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet.licenseheader: -------------------------------------------------------------------------------- 1 | extensions: .cs 2 | //----------------------------------------------------------------------- 3 | // 4 | // Copyright (C) 2017 - CNVVF 5 | // 6 | // This file is part of VVFGeoFleet. 7 | // VVFGeoFleet is free software: you can redistribute it and/or modify 8 | // it under the terms of the GNU Affero General Public License as 9 | // published by the Free Software Foundation, either version 3 of the 10 | // License, or (at your option) any later version. 11 | // 12 | // SOVVF is distributed in the hope that it will be useful, 13 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | // GNU Affero General Public License for more details. 16 | // 17 | // You should have received a copy of the GNU Affero General Public License 18 | // along with this program. If not, see http://www.gnu.org/licenses/. 19 | // 20 | //----------------------------------------------------------------------- 21 | 22 | extensions: .xml .config 23 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/----Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 23 | 24 | 25 | 36 | 37 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/----Web.Release.config: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 23 | 24 | 25 | 36 | 37 | 38 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/App_Start/SimpleInjectorWebApiInitializer.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | [assembly: WebActivator.PostApplicationStartMethod(typeof(VVFGeoFleet.App_Start.SimpleInjectorWebApiInitializer), "Initialize")] 22 | 23 | namespace VVFGeoFleet.App_Start 24 | { 25 | using System.Linq; 26 | using System.Reflection; 27 | using System.Web.Compilation; 28 | using System.Web.Http; 29 | using SimpleInjector; 30 | using SimpleInjector.Integration.WebApi; 31 | using SimpleInjector.Lifestyles; 32 | 33 | public static class SimpleInjectorWebApiInitializer 34 | { 35 | /// 36 | /// Initialize the container and register it as Web API Dependency Resolver. 37 | /// 38 | public static void Initialize() 39 | { 40 | var container = new Container(); 41 | container.Options.DefaultScopedLifestyle = new AsyncScopedLifestyle(); 42 | 43 | InitializeContainer(container); 44 | 45 | container.RegisterWebApiControllers(GlobalConfiguration.Configuration); 46 | 47 | container.Verify(); 48 | 49 | GlobalConfiguration.Configuration.DependencyResolver = 50 | new SimpleInjectorWebApiDependencyResolver(container); 51 | } 52 | 53 | private static void InitializeContainer(Container container) 54 | { 55 | // Scan all the referenced assemblies for packages containing DI wiring rules 56 | var assemblies = BuildManager.GetReferencedAssemblies().Cast(); 57 | container.RegisterPackages(assemblies); 58 | 59 | BindLocally(container); 60 | } 61 | 62 | private static void BindLocally(Container container) 63 | { 64 | container.RegisterDecorator(typeof(Modello.Servizi.Persistence.IStoreMessaggioPosizione), 65 | typeof(Authorization.IpBased.IpAuthChecker), 66 | Lifestyle.Scoped, 67 | context => container.GetInstance().IpAuthEnabled); 68 | 69 | container.RegisterInitializer(c => 70 | { 71 | c.AllowedSources = container.GetInstance().AuthorizedIpSources; 72 | }); 73 | 74 | container.Register(Lifestyle.Scoped); 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/App_Start/WebApiConfig.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Web.Http; 22 | using Newtonsoft.Json.Serialization; 23 | 24 | namespace VVFGeoFleet 25 | { 26 | public static class WebApiConfig 27 | { 28 | public static void Register(HttpConfiguration config) 29 | { 30 | // Servizi e configurazione dell'API Web 31 | 32 | // Route dell'API Web 33 | config.MapHttpAttributeRoutes(); 34 | 35 | config.Routes.MapHttpRoute( 36 | name: "DefaultApi", 37 | routeTemplate: "api/{controller}/{id}", 38 | defaults: new { id = RouteParameter.Optional } 39 | ); 40 | 41 | config.Formatters.JsonFormatter.SerializerSettings.ContractResolver = new CamelCasePropertyNamesContractResolver(); 42 | config.Formatters.JsonFormatter.UseDataContractJsonSerializer = false; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/Authorization/IpBased/IpAuthChecker.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Linq; 23 | using System.Web; 24 | using IpTools; 25 | using Modello.Classi; 26 | using Modello.Servizi.Persistence; 27 | 28 | namespace VVFGeoFleet.Authorization.IpBased 29 | { 30 | public class IpAuthChecker : IStoreMessaggioPosizione 31 | { 32 | private readonly IStoreMessaggioPosizione decorated; 33 | private readonly IpNetworkChecker checker; 34 | 35 | public IpAuthChecker(IStoreMessaggioPosizione decorated, 36 | IpNetworkChecker checker) 37 | { 38 | this.decorated = decorated ?? throw new ArgumentNullException(nameof(decorated)); 39 | this.checker = checker ?? throw new ArgumentNullException(nameof(checker)); 40 | } 41 | 42 | /// 43 | /// Injected field. 44 | /// 45 | public string[] AllowedSources { get; set; } 46 | 47 | public void Store(MessaggioPosizione messaggio) 48 | { 49 | var sourceIp = HttpContext.Current.Request.UserHostAddress; 50 | 51 | if (this.AllowedSources.All(allowed => !checker.Check(sourceIp, allowed))) 52 | throw new UnauthorizedAccessException("Client not authorized by the current configuration policies."); 53 | 54 | this.decorated.Store(messaggio); 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/Bindings.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using SimpleInjector; 22 | using SimpleInjector.Packaging; 23 | 24 | namespace VVFGeoFleet 25 | { 26 | public class Bindings : IPackage 27 | { 28 | public void RegisterServices(Container container) 29 | { 30 | container.Register(Lifestyle.Singleton); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/Controllers/ClassiMezzoController.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Collections.Generic; 22 | using System.Web.Http; 23 | using Modello.Configurazione; 24 | using Modello.Servizi.Persistence; 25 | 26 | namespace VVFGeoFleet.Controllers 27 | { 28 | public class ClassiMezzoController : ApiController 29 | { 30 | private readonly IGetClassiMezzo getClassiMezzo; 31 | private readonly IAppConfig appConfig; 32 | 33 | public ClassiMezzoController(IGetClassiMezzo getClassiMezzo, IAppConfig appConfig) 34 | { 35 | this.getClassiMezzo = getClassiMezzo; 36 | this.appConfig = appConfig; 37 | } 38 | 39 | /// 40 | /// Restituisce l'elenco delle classi mezzo attive, con la relativa occorrenza 41 | /// 42 | /// Elenco delle classi mezzo attive 43 | public IEnumerable Get() 44 | { 45 | var attSec = this.appConfig.OrizzonteTemporale_sec; 46 | 47 | return this.Get(attSec); 48 | } 49 | 50 | /// 51 | /// Restituisce l'elenco delle classi mezzo attive, con la relativa occorrenza 52 | /// 53 | /// 54 | /// I secondi entro cui deve essere stato inviato l'ultimo messaggio di posizione perché il 55 | /// mezzo sia considerato attivo 56 | /// 57 | /// Elenco delle classi mezzo attive 58 | public IEnumerable Get(int attSec) 59 | { 60 | var resultDict = this.getClassiMezzo.Get(attSec); 61 | foreach (var key in resultDict.Keys) 62 | yield return new { classeMezzo = key, count = resultDict[key] }; 63 | } 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/Controllers/MessaggiPosizioneController.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Web.Http; 23 | using Modello.Classi; 24 | using Modello.Servizi.Persistence; 25 | 26 | namespace VVFGeoFleet.Controllers 27 | { 28 | public class MessaggiPosizioneController : ApiController 29 | { 30 | private readonly IGetMessaggioPosizioneById getMessaggioPosizioneById; 31 | private readonly IStoreMessaggioPosizione storeMessaggioPosizione; 32 | 33 | public MessaggiPosizioneController(IGetMessaggioPosizioneById getMessaggioPosizioneById, 34 | IStoreMessaggioPosizione storeMessaggioPosizione) 35 | { 36 | if (getMessaggioPosizioneById == null) 37 | { 38 | throw new ArgumentNullException(nameof(getMessaggioPosizioneById)); 39 | } 40 | 41 | if (storeMessaggioPosizione == null) 42 | { 43 | throw new ArgumentNullException(nameof(storeMessaggioPosizione)); 44 | } 45 | 46 | this.getMessaggioPosizioneById = getMessaggioPosizioneById; 47 | this.storeMessaggioPosizione = storeMessaggioPosizione; 48 | } 49 | 50 | /// 51 | /// Restituisce un messaggio posizione per id 52 | /// 53 | /// L'id del messaggio 54 | /// Il messaggio 55 | public MessaggioPosizione Get(string id) 56 | { 57 | return this.getMessaggioPosizioneById.Get(id); 58 | } 59 | 60 | /// 61 | /// Memorizza un nuovo messaggio posizione 62 | /// 63 | /// Il messaggio 64 | /// L'oggetto inserito con la sua location 65 | public IHttpActionResult Post([FromBody]MessaggioPosizione messaggio) 66 | { 67 | this.storeMessaggioPosizione.Store(messaggio); 68 | 69 | DatiPosizioneLive.InviaPosLive(messaggio); 70 | 71 | return CreatedAtRoute("DefaultApi", new { id = messaggio.Id }, messaggio); 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/Controllers/MezziSilentiController.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Collections.Generic; 22 | using System.Web.Http; 23 | using Modello.Classi; 24 | using Modello.Servizi.Persistence; 25 | 26 | namespace VVFGeoFleet.Controllers 27 | { 28 | public class MezziSilentiController : ApiController 29 | { 30 | private readonly IGetMezziSilenti getMezziSilenti; 31 | 32 | public MezziSilentiController(IGetMezziSilenti getMezziSilenti) 33 | { 34 | this.getMezziSilenti = getMezziSilenti; 35 | } 36 | 37 | [Route("api/MezziSilenti/")] 38 | public IEnumerable Get([FromUri] int daSecondi) 39 | { 40 | return getMezziSilenti.Get(daSecondi); 41 | } 42 | 43 | [Route("api/MezziSilenti/PerClassi")] 44 | public IEnumerable Get([FromUri] int daSecondi, [FromUri] string[] perClassi) 45 | { 46 | return getMezziSilenti.Get(daSecondi, perClassi); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/Controllers/PercorsoController.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Collections.Generic; 23 | using System.Web.Http; 24 | using Modello.Classi; 25 | using Modello.Servizi.Persistence; 26 | 27 | namespace VVFGeoFleet.Controllers 28 | { 29 | /// 30 | /// Restituisce tutti i messaggi di posizione relativi ad un mezzo in un intervallo temporale. 31 | /// 32 | public class PercorsoController : ApiController 33 | { 34 | private readonly IGetPercorso getPercorso; 35 | 36 | public PercorsoController(IGetPercorso getPercorso) 37 | { 38 | this.getPercorso = getPercorso ?? throw new ArgumentNullException(nameof(getPercorso)); 39 | } 40 | 41 | // GET: api/Percorso 42 | public IEnumerable Get(string id, DateTime from, DateTime to) 43 | { 44 | return this.getPercorso.Get(id, from, to); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/Controllers/PosizioneByCodiceMezzoController.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Web.Http; 22 | using Modello.Classi; 23 | using Modello.Servizi.Persistence; 24 | 25 | namespace VVFGeoFleet.Controllers 26 | { 27 | public class PosizioneByCodiceMezzoController : ApiController 28 | { 29 | private readonly IGetPosizioneByCodiceMezzo getPosizioneByCodiceMezzo; 30 | 31 | public PosizioneByCodiceMezzoController(IGetPosizioneByCodiceMezzo getPosizioneByCodiceMezzo) 32 | { 33 | this.getPosizioneByCodiceMezzo = getPosizioneByCodiceMezzo; 34 | } 35 | 36 | public MessaggioPosizione Get(string id) 37 | { 38 | return this.getPosizioneByCodiceMezzo.Get(id); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/Controllers/StatisticsController.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System; 22 | using System.Diagnostics; 23 | using System.Threading.Tasks; 24 | using System.Web.Http; 25 | using log4net; 26 | using Modello.Servizi.Statistics; 27 | 28 | namespace VVFGeoFleet.Controllers 29 | { 30 | public class StatisticsController : ApiController 31 | { 32 | private static readonly ILog log = LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 33 | 34 | private readonly IGetStatistics getStatistics; 35 | 36 | public StatisticsController(IGetStatistics getStatistics) 37 | { 38 | this.getStatistics = getStatistics ?? throw new ArgumentNullException(nameof(getStatistics)); 39 | } 40 | 41 | public async Task Get() 42 | { 43 | var sw = new Stopwatch(); 44 | sw.Start(); 45 | var result = await this.getStatistics.GetAsync(); 46 | sw.Stop(); 47 | log.Info($"Statistics computed in { sw.ElapsedMilliseconds } msec"); 48 | 49 | return result; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/Global.asax: -------------------------------------------------------------------------------- 1 | <%@ Application Codebehind="Global.asax.cs" Inherits="VVFGeoFleet.WebApiApplication" Language="C#" %> 2 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/Global.asax.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Web.Http; 22 | 23 | namespace VVFGeoFleet 24 | { 25 | public class WebApiApplication : System.Web.HttpApplication 26 | { 27 | protected void Application_Start() 28 | { 29 | GlobalConfiguration.Configure(WebApiConfig.Register); 30 | log4net.Config.XmlConfigurator.Configure(); 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Reflection; 22 | using System.Runtime.InteropServices; 23 | 24 | // Le informazioni generali relative a un assembly sono controllate dal seguente set di attributi. 25 | // Modificare i valori di questi attributi per modificare le informazioni associate a un assembly. 26 | [assembly: AssemblyTitle("VVFGeoFleet")] 27 | [assembly: AssemblyDescription("")] 28 | [assembly: AssemblyConfiguration("")] 29 | [assembly: AssemblyCompany("")] 30 | [assembly: AssemblyProduct("VVFGeoFleet")] 31 | [assembly: AssemblyCopyright("Copyright © 2017")] 32 | [assembly: AssemblyTrademark("")] 33 | [assembly: AssemblyCulture("")] 34 | 35 | // Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili ai componenti 36 | // COM. Se è necessario accedere a un tipo in questo assembly da COM, impostare su true l'attributo 37 | // ComVisible per tale tipo. 38 | [assembly: ComVisible(false)] 39 | 40 | // Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato per creare l'ID della 41 | // libreria dei tipi 42 | [assembly: Guid("c8c3f773-b0ba-4185-b30a-9594cf12093a")] 43 | 44 | // Le informazioni sulla versione di un assembly sono costituite dai quattro valori seguenti: 45 | // 46 | // Versione principale Versione secondaria Numero build Revisione 47 | // 48 | // È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi 49 | // alla revisione e alla build utilizzando l'asterisco (*) come illustrato di seguito: 50 | [assembly: AssemblyVersion("1.0.0.0")] 51 | [assembly: AssemblyFileVersion("1.0.0.0")] 52 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/Web.Debug.config: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 23 | 24 | 25 | 36 | 37 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/Web.Release.config: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 23 | 24 | 25 | 36 | 37 | 38 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/WebSocket/DatiPosizioneLive.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using System.Threading.Tasks; 22 | using Microsoft.AspNet.SignalR; 23 | using Modello.Classi; 24 | using Newtonsoft.Json; 25 | using Newtonsoft.Json.Serialization; 26 | 27 | namespace VVFGeoFleet 28 | { 29 | public class DatiPosizioneLive : PersistentConnection 30 | { 31 | protected override Task OnConnected(IRequest request, string connectionId) 32 | { 33 | return Connection.Send(connectionId, "Connesso!"); 34 | } 35 | 36 | protected override Task OnReceived(IRequest request, string connectionId, string data) 37 | { 38 | return Connection.Broadcast(data); 39 | } 40 | 41 | public static void InviaPosLive(MessaggioPosizione messaggio) 42 | { 43 | try 44 | { 45 | GlobalHost.ConnectionManager.GetConnectionContext().Connection.Broadcast( 46 | JsonConvert.SerializeObject(messaggio, Newtonsoft.Json.Formatting.None, new JsonSerializerSettings 47 | { 48 | NullValueHandling = NullValueHandling.Ignore 49 | , 50 | ContractResolver = new DefaultContractResolver() { NamingStrategy = new CamelCaseNamingStrategy() } 51 | }) 52 | 53 | ); 54 | } 55 | catch 56 | { 57 | } 58 | } 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/WebSocket/StartupWebSocket.cs: -------------------------------------------------------------------------------- 1 | //----------------------------------------------------------------------- 2 | // 3 | // Copyright (C) 2017 - CNVVF 4 | // 5 | // This file is part of VVFGeoFleet. 6 | // VVFGeoFleet is free software: you can redistribute it and/or modify 7 | // it under the terms of the GNU Affero General Public License as 8 | // published by the Free Software Foundation, either version 3 of the 9 | // License, or (at your option) any later version. 10 | // 11 | // SOVVF is distributed in the hope that it will be useful, 12 | // but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | // GNU Affero General Public License for more details. 15 | // 16 | // You should have received a copy of the GNU Affero General Public License 17 | // along with this program. If not, see http://www.gnu.org/licenses/. 18 | // 19 | //----------------------------------------------------------------------- 20 | 21 | using Microsoft.Owin; 22 | using Owin; 23 | 24 | [assembly: OwinStartup(typeof(VVFGeoFleet.Startup))] 25 | 26 | namespace VVFGeoFleet 27 | { 28 | public class Startup 29 | { 30 | public void Configuration(IAppBuilder app) 31 | { 32 | app.MapSignalR("/api/PosizioneLive"); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/actions.http: -------------------------------------------------------------------------------- 1 | 2 | ### Get all recent positions 3 | GET http://localhost:23032/api/posizioneflotta HTTP/1.1 4 | 5 | ### Post a position message 6 | POST http://localhost:23032/api/messaggiPosizione HTTP/1.1 7 | Content-Type: application/json 8 | 9 | { 10 | "codiceMezzo": "APS.54321", 11 | "classiMezzo": [ "APS", "benzina" ], 12 | "localizzazione": { 13 | "lat": 14.3347, 14 | "lon": 43.4321 15 | }, 16 | "istanteAcquisizione": "2018-06-25T20:16:00.1234Z", 17 | "fonte": { 18 | "codiceFonte": "AH222", 19 | "classeFonte": "gpsTracker" 20 | }, 21 | "infoFonte": { 22 | 23 | } 24 | } 25 | 26 | ### InRettangolo 27 | GET http://localhost:23032/api/inRettangolo?lat1=14.30&lon1=43.42&lat2=14.3346&lon2=43.44 HTTP/1.1 -------------------------------------------------------------------------------- /src/backend/VVFGeoFleet/packages.config: -------------------------------------------------------------------------------- 1 | 2 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /src/frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # production configuration file 2 | src/environments/environment.prod.ts 3 | 4 | # See http://help.github.com/ignore-files/ for more about ignoring files. 5 | 6 | # compiled output 7 | /dist 8 | /tmp 9 | /out-tsc 10 | 11 | # dependencies 12 | node_modules/ 13 | 14 | # IDEs and editors 15 | /.idea 16 | .project 17 | .classpath 18 | .c9/ 19 | *.launch 20 | .settings/ 21 | *.sublime-workspace 22 | 23 | # IDE - VSCode 24 | .vscode/* 25 | !.vscode/settings.json 26 | !.vscode/tasks.json 27 | !.vscode/launch.json 28 | !.vscode/extensions.json 29 | 30 | # misc 31 | /.sass-cache 32 | /connect.lock 33 | /coverage 34 | /libpeerconnection.log 35 | npm-debug.log 36 | testem.log 37 | /typings 38 | 39 | # e2e 40 | /e2e/*.js 41 | /e2e/*.map 42 | 43 | # System Files 44 | .DS_Store 45 | Thumbs.db 46 | -------------------------------------------------------------------------------- /src/frontend/dashboard/.editorconfig: -------------------------------------------------------------------------------- 1 | # Editor configuration, see http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | max_line_length = off 13 | trim_trailing_whitespace = false 14 | -------------------------------------------------------------------------------- /src/frontend/dashboard/.gitignore: -------------------------------------------------------------------------------- 1 | # See http://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # compiled output 4 | /dist 5 | /tmp 6 | /out-tsc 7 | 8 | # dependencies 9 | /node_modules 10 | 11 | # IDEs and editors 12 | /.idea 13 | .project 14 | .classpath 15 | .c9/ 16 | *.launch 17 | .settings/ 18 | *.sublime-workspace 19 | 20 | # IDE - VSCode 21 | .vscode/* 22 | !.vscode/settings.json 23 | !.vscode/tasks.json 24 | !.vscode/launch.json 25 | !.vscode/extensions.json 26 | 27 | # misc 28 | /.sass-cache 29 | /connect.lock 30 | /coverage 31 | /libpeerconnection.log 32 | npm-debug.log 33 | testem.log 34 | /typings 35 | yarn-error.log 36 | 37 | # e2e 38 | /e2e/*.js 39 | /e2e/*.map 40 | 41 | # System Files 42 | .DS_Store 43 | Thumbs.db 44 | -------------------------------------------------------------------------------- /src/frontend/dashboard/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "0.2.0", 3 | "configurations": [ 4 | 5 | { 6 | "type": "chrome", 7 | "request": "launch", 8 | "name": "Launch Program", 9 | "url": "http://localhost:4201", 10 | "webRoot": "${workspaceFolder}", 11 | "sourceMaps": true 12 | } 13 | ] 14 | } -------------------------------------------------------------------------------- /src/frontend/dashboard/README.md: -------------------------------------------------------------------------------- 1 | # Dashboard 2 | 3 | This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.3.2. 4 | 5 | ## Development server 6 | 7 | Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. 8 | 9 | ## Code scaffolding 10 | 11 | Run `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`. 12 | 13 | ## Build 14 | 15 | Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. Use the `-prod` flag for a production build. 16 | 17 | ## Running unit tests 18 | 19 | Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). 20 | 21 | ## Running end-to-end tests 22 | 23 | Run `ng e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/). 24 | Before running the tests make sure you are serving the app via `ng serve`. 25 | 26 | ## Further help 27 | 28 | To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md). 29 | -------------------------------------------------------------------------------- /src/frontend/dashboard/____backup prima della migrazione alla v.6 - package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dashboard", 3 | "version": "0.0.0", 4 | "license": "MIT", 5 | "scripts": { 6 | "ng": "ng", 7 | "start": "ng serve", 8 | "build": "ng build", 9 | "test": "ng test", 10 | "lint": "ng lint", 11 | "e2e": "ng e2e" 12 | }, 13 | "private": true, 14 | "dependencies": { 15 | "@agm/core": "^1.0.0-beta.2", 16 | "@agm/js-marker-clusterer": "^1.0.0-beta.3", 17 | "@angular/animations": "^5.2.11", 18 | "@angular/common": "^5.2.11", 19 | "@angular/compiler": "^5.2.11", 20 | "@angular/core": "^5.2.11", 21 | "@angular/forms": "^5.2.11", 22 | "@angular/http": "^5.2.11", 23 | "@angular/platform-browser": "^5.2.11", 24 | "@angular/platform-browser-dynamic": "^5.2.11", 25 | "@angular/platform-server": "^6.1.7", 26 | "@angular/router": "^5.2.11", 27 | "@google/markerclusterer": "^1.0.3", 28 | "@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.5", 29 | "@types/googlemaps": "^3.30.11", 30 | "@types/markerclustererplus": "^2.1.33", 31 | "angular2-ui-switch": "^1.2.0", 32 | "bootstrap": "^4.0.0-beta.2", 33 | "classlist.js": "^1.1.20150312", 34 | "core-js": "^2.4.1", 35 | "font-awesome": "^4.7.0", 36 | "js-marker-clusterer": "^1.0.0", 37 | "moment": "^2.20.1", 38 | "ngx-ui-switch": "^1.6.0", 39 | "primeicons": "^1.0.0-beta.7", 40 | "primeng": "^6.0.0-beta.1", 41 | "rxjs": "^5.4.2", 42 | "web-animations-js": "^2.3.1", 43 | "zone.js": "^0.8.14" 44 | }, 45 | "devDependencies": { 46 | "@angular/compiler-cli": "^5.2.9", 47 | "@angular/language-service": "^5.2.9", 48 | "@types/jasmine": "~2.8.6", 49 | "@types/jasminewd2": "~2.0.2", 50 | "@types/node": "~9.6.0", 51 | "codelyzer": "~4.2.1", 52 | "jasmine-core": "~3.1.0", 53 | "jasmine-spec-reporter": "~4.2.1", 54 | "karma": "~2.0.0", 55 | "karma-chrome-launcher": "~2.2.0", 56 | "karma-cli": "~1.0.1", 57 | "karma-coverage-istanbul-reporter": "^1.2.1", 58 | "karma-jasmine": "~1.1.0", 59 | "karma-jasmine-html-reporter": "^1.0.0", 60 | "protractor": "~5.3.0", 61 | "ts-node": "~5.0.1", 62 | "tslint": "~5.9.1", 63 | "typescript": "~2.7.2" 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /src/frontend/dashboard/e2e/app.e2e-spec.ts: -------------------------------------------------------------------------------- 1 | import { AppPage } from './app.po'; 2 | 3 | describe('dashboard App', () => { 4 | let page: AppPage; 5 | 6 | beforeEach(() => { 7 | page = new AppPage(); 8 | }); 9 | 10 | it('should display welcome message', () => { 11 | page.navigateTo(); 12 | expect(page.getParagraphText()).toEqual('Welcome to app!'); 13 | }); 14 | }); 15 | -------------------------------------------------------------------------------- /src/frontend/dashboard/e2e/app.po.ts: -------------------------------------------------------------------------------- 1 | import { browser, by, element } from 'protractor'; 2 | 3 | export class AppPage { 4 | navigateTo() { 5 | return browser.get('/'); 6 | } 7 | 8 | getParagraphText() { 9 | return element(by.css('app-root h1')).getText(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/frontend/dashboard/e2e/tsconfig.e2e.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/e2e", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "jasminewd2", 11 | "node" 12 | ] 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/frontend/dashboard/karma.conf.js: -------------------------------------------------------------------------------- 1 | // Karma configuration file, see link for more information 2 | // https://karma-runner.github.io/1.0/config/configuration-file.html 3 | 4 | module.exports = function (config) { 5 | config.set({ 6 | basePath: '', 7 | frameworks: ['jasmine', '@angular-devkit/build-angular'], 8 | plugins: [ 9 | require('karma-jasmine'), 10 | require('karma-chrome-launcher'), 11 | require('karma-jasmine-html-reporter'), 12 | require('karma-coverage-istanbul-reporter'), 13 | require('@angular-devkit/build-angular/plugins/karma') 14 | ], 15 | client:{ 16 | clearContext: false // leave Jasmine Spec Runner output visible in browser 17 | }, 18 | coverageIstanbulReporter: { 19 | dir: require('path').join(__dirname, 'coverage'), reports: [ 'html', 'lcovonly' ], 20 | fixWebpackSourcePaths: true 21 | }, 22 | 23 | reporters: ['progress', 'kjhtml'], 24 | port: 9876, 25 | colors: true, 26 | logLevel: config.LOG_INFO, 27 | autoWatch: true, 28 | browsers: ['Chrome'], 29 | singleRun: false 30 | }); 31 | }; 32 | -------------------------------------------------------------------------------- /src/frontend/dashboard/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "dashboard", 3 | "version": "0.0.0", 4 | "license": "MIT", 5 | "scripts": { 6 | "ng": "ng", 7 | "start": "ng serve", 8 | "build": "ng build", 9 | "test": "ng test", 10 | "lint": "ng lint", 11 | "e2e": "ng e2e" 12 | }, 13 | "private": true, 14 | "dependencies": { 15 | "@agm/core": "^1.0.0-beta.2", 16 | "@agm/js-marker-clusterer": "^1.0.0-beta.3", 17 | "@google/markerclusterer": "^1.0.3", 18 | "@ng-bootstrap/ng-bootstrap": "^5.0.0-rc.0", 19 | "@types/googlemaps": "^3.30.11", 20 | "@types/markerclustererplus": "^2.1.33", 21 | "angular2-ui-switch": "^1.2.0", 22 | "bootstrap": "^4.3.1", 23 | "classlist.js": "^1.1.20150312", 24 | "core-js": "^2.4.1", 25 | "font-awesome": "^4.7.0", 26 | "js-marker-clusterer": "^1.0.0", 27 | "moment": "^2.20.1", 28 | "ngx-ui-switch": "^1.6.0", 29 | "npm": "^6.9.0", 30 | "primeicons": "^1.0.0-beta.7", 31 | "primeng": "^6.0.0-beta.1", 32 | "rxjs": "^6.5.2", 33 | "rxjs-compat": "^6.5.2", 34 | "web-animations-js": "^2.3.1", 35 | "zone.js": "^0.8.14" 36 | }, 37 | "devDependencies": { 38 | "@angular-devkit/build-angular": "^0.800.2", 39 | "@angular/animations": "^8.0.0", 40 | "@angular/cli": "^8.0.2", 41 | "@angular/common": "^8.0.0", 42 | "@angular/compiler": "^8.0.0", 43 | "@angular/compiler-cli": "^8.0.0", 44 | "@angular/core": "^8.0.0", 45 | "@angular/forms": "^8.0.0", 46 | "@angular/http": "^7.2.15", 47 | "@angular/platform-browser": "^8.0.0", 48 | "@angular/platform-browser-dynamic": "^8.0.0", 49 | "@angular/platform-server": "^8.0.0", 50 | "@angular/router": "^8.0.0", 51 | "@types/jasmine": "~2.8.6", 52 | "@types/jasminewd2": "~2.0.2", 53 | "@types/node": "~9.6.0", 54 | "codelyzer": "~4.2.1", 55 | "jasmine-core": "~3.1.0", 56 | "jasmine-spec-reporter": "~4.2.1", 57 | "karma": "~2.0.0", 58 | "karma-chrome-launcher": "~2.2.0", 59 | "karma-cli": "~1.0.1", 60 | "karma-coverage-istanbul-reporter": "^1.2.1", 61 | "karma-jasmine": "~1.1.0", 62 | "karma-jasmine-html-reporter": "^1.0.0", 63 | "protractor": "~5.3.0", 64 | "ts-node": "~5.0.1", 65 | "tslint": "~5.9.1", 66 | "typescript": "^3.4.5" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /src/frontend/dashboard/protractor.conf.js: -------------------------------------------------------------------------------- 1 | // Protractor configuration file, see link for more information 2 | // https://github.com/angular/protractor/blob/master/lib/config.ts 3 | 4 | const { SpecReporter } = require('jasmine-spec-reporter'); 5 | 6 | exports.config = { 7 | allScriptsTimeout: 11000, 8 | specs: [ 9 | './e2e/**/*.e2e-spec.ts' 10 | ], 11 | capabilities: { 12 | 'browserName': 'chrome' 13 | }, 14 | directConnect: true, 15 | baseUrl: 'http://localhost:4200/', 16 | framework: 'jasmine', 17 | jasmineNodeOpts: { 18 | showColors: true, 19 | defaultTimeoutInterval: 30000, 20 | print: function() {} 21 | }, 22 | onPrepare() { 23 | require('ts-node').register({ 24 | project: 'e2e/tsconfig.e2e.json' 25 | }); 26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } })); 27 | } 28 | }; 29 | -------------------------------------------------------------------------------- /src/frontend/dashboard/proxy.config.json: -------------------------------------------------------------------------------- 1 | { 2 | "/api": 3 | { 4 | "target":"http://vvfgeofleetdev:23032/", 5 | "secure":false, 6 | "logLevel":"debug", 7 | "pathRewrite": { 8 | "^/api": "" 9 | } 10 | } 11 | 12 | } -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/app.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/app/app.component.css -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/app.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, async } from '@angular/core/testing'; 2 | 3 | import { AppComponent } from './app.component'; 4 | 5 | describe('AppComponent', () => { 6 | beforeEach(async(() => { 7 | TestBed.configureTestingModule({ 8 | declarations: [ 9 | AppComponent 10 | ], 11 | }).compileComponents(); 12 | })); 13 | 14 | it('should create the app', async(() => { 15 | const fixture = TestBed.createComponent(AppComponent); 16 | const app = fixture.debugElement.componentInstance; 17 | expect(app).toBeTruthy(); 18 | })); 19 | 20 | it(`should have as title 'app'`, async(() => { 21 | const fixture = TestBed.createComponent(AppComponent); 22 | const app = fixture.debugElement.componentInstance; 23 | expect(app.title).toEqual('app'); 24 | })); 25 | 26 | it('should render title in a h1 tag', async(() => { 27 | const fixture = TestBed.createComponent(AppComponent); 28 | fixture.detectChanges(); 29 | const compiled = fixture.debugElement.nativeElement; 30 | expect(compiled.querySelector('h1').textContent).toContain('Welcome to app!'); 31 | })); 32 | }); 33 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/elenco-posizioni-flotta/elenco-posizioni-flotta.component.css: -------------------------------------------------------------------------------- 1 | 2 | .area-elenco { 3 | overflow-x: hidden; 4 | overflow-y: auto; 5 | height: 300px; 6 | } 7 | 8 | 9 | .area-elenco-mezzi-da-seguire-sticky { 10 | position: sticky; 11 | top: 11% ; 12 | z-index: 2000; 13 | } 14 | 15 | 16 | /* 17 | .header-fixed { 18 | display: block; 19 | overflow-y: auto; 20 | height: 300px; 21 | } 22 | */ 23 | 24 | 25 | /* 26 | .header-fixed { 27 | width: 100% 28 | } 29 | 30 | .header-fixed > thead, 31 | .header-fixed > tbody, 32 | .header-fixed > thead > tr, 33 | .header-fixed > tbody > tr, 34 | .header-fixed > thead > tr > th, 35 | .header-fixed > tbody > tr > td { 36 | display: block; 37 | } 38 | 39 | 40 | .header-fixed > tbody > tr:after, 41 | .header-fixed > thead > tr:after { 42 | content: ' '; 43 | display: block; 44 | visibility: hidden; 45 | clear: both; 46 | } 47 | .header-fixed > tbody { 48 | overflow-y: auto; 49 | height: 300px; 50 | } 51 | .header-fixed > tbody > tr > td, 52 | .header-fixed > thead > tr > th { 53 | width: 25%; 54 | float: left; 55 | } 56 | */ -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/elenco-posizioni-flotta/elenco-posizioni-flotta.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { ElencoPosizioniFlottaComponent } from './elenco-posizioni-flotta.component'; 4 | 5 | describe('ElencoPosizioniFlottaComponent', () => { 6 | let component: ElencoPosizioniFlottaComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ ElencoPosizioniFlottaComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(ElencoPosizioniFlottaComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should be created', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/filtri/filtri.component.css: -------------------------------------------------------------------------------- 1 | @import '../shared/css/badge-stati-mezzo.css'; 2 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/filtri/filtri.component.html: -------------------------------------------------------------------------------- 1 | 2 | {{ titolo }} 3 | 4 | 5 | 6 | 7 | 8 | 9 | {{ v.descrizione }} 10 | 11 | 12 | {{ v.descrizione }} 13 | 14 | 15 | 16 | 17 | 18 | {{ v.cardinalita }} 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/filtri/filtri.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { FiltriComponent } from './filtri.component'; 4 | 5 | describe('FiltriComponent', () => { 6 | let component: FiltriComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ FiltriComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(FiltriComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should be created', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/filtri/filtri.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; 2 | //import { UiSwitchModule } from 'angular2-ui-switch'; 3 | //import { Filtri } from './filtri.model'; 4 | import { VoceFiltro } from "./voce-filtro.model"; 5 | 6 | @Component({ 7 | selector: 'app-filtri', 8 | templateUrl: './filtri.component.html', 9 | styleUrls: ['./filtri.component.css'] 10 | }) 11 | export class FiltriComponent implements OnInit { 12 | @Input() titolo: string; 13 | @Input() vociFiltro: VoceFiltro[]; 14 | @Output() nuovaSelezione: EventEmitter = new EventEmitter(); 15 | 16 | enable: boolean = true; 17 | 18 | constructor() { 19 | } 20 | 21 | ngOnInit() { 22 | 23 | } 24 | 25 | private toggleClicked () { 26 | 27 | } 28 | 29 | public selezione(event, codice) { 30 | //console.log('event: ' + event); 31 | 32 | this.vociFiltro.find(vf => vf.codice === codice).selezionato = event.target.checked; 33 | // restituisce le sole voci selezionate 34 | this.nuovaSelezione.emit( 35 | this.vociFiltro 36 | .filter(v => v.selezionato) 37 | .map(v => v.codice) 38 | ); 39 | 40 | 41 | 42 | } 43 | 44 | } 45 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/filtri/voce-filtro.model.ts: -------------------------------------------------------------------------------- 1 | export class VoceFiltro { 2 | constructor( 3 | public codice: Object, 4 | public descrizione: string, 5 | public cardinalita: number, 6 | public selezionato: boolean = true, 7 | public tooltip: string = "", 8 | public badgeCardinalita: string = "badge-info", 9 | public icona: string = "" 10 | ) {} 11 | } 12 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/filtro-multi-select-dd/filtro-multi-select-dd.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/app/filtro-multi-select-dd/filtro-multi-select-dd.component.css -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/filtro-multi-select-dd/filtro-multi-select-dd.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | {{titolo}} 4 | 5 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/filtro-multi-select-dd/filtro-multi-select-dd.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { FiltroMultiSelectDdComponent } from './filtro-multi-select-dd.component'; 4 | 5 | describe('FiltroMultiSelectDdComponent', () => { 6 | let component: FiltroMultiSelectDdComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ FiltroMultiSelectDdComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(FiltroMultiSelectDdComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/filtro-multi-select-dd/filtro-multi-select-dd.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core'; 2 | import { VoceFiltro } from "../filtri/voce-filtro.model"; 3 | 4 | import { MultiSelectModule } from 'primeng/multiselect'; 5 | import { SelectItem } from 'primeng/components/common/selectitem'; 6 | 7 | 8 | @Component({ 9 | selector: 'app-filtro-multi-select-dd', 10 | templateUrl: './filtro-multi-select-dd.component.html', 11 | styleUrls: ['./filtro-multi-select-dd.component.css'] 12 | }) 13 | 14 | export class FiltroMultiSelectDdComponent implements OnInit { 15 | @Input() titolo: string; 16 | @Input() vociFiltro: VoceFiltro[]; 17 | @Output() nuovaSelezione: EventEmitter = new EventEmitter(); 18 | 19 | enable: boolean = true; 20 | 21 | vociFiltroDD: SelectItem[]; 22 | vociFiltroDDSelezionate: String[]; 23 | 24 | constructor() { 25 | 26 | 27 | 28 | } 29 | 30 | ngOnInit() { 31 | this.vociFiltroDD = this.vociFiltro.map( 32 | (item: VoceFiltro) => 33 | { return Object.assign({}, {label: item.descrizione, value: item.codice.toString() }) 34 | }); 35 | 36 | 37 | this.vociFiltroDDSelezionate = this.vociFiltro.filter(v => v.selezionato).map( 38 | (item: VoceFiltro) => 39 | { return item.codice.toString() } ) ; 40 | 41 | } 42 | 43 | 44 | ngOnChanges() { 45 | this.vociFiltroDD = this.vociFiltro.map( 46 | (item: VoceFiltro) => 47 | { return Object.assign({}, {label: item.descrizione, value: item.codice.toString() }) 48 | }); 49 | 50 | this.vociFiltroDDSelezionate = this.vociFiltro.filter(v => v.selezionato).map( 51 | (item: VoceFiltro) => 52 | { return item.codice.toString() } ) ; 53 | 54 | } 55 | 56 | 57 | public selezione(event, elenco) { 58 | //console.log('event: ', event, elenco); 59 | 60 | 61 | this.vociFiltro.forEach( v => { 62 | v.selezionato = false; 63 | } 64 | ); 65 | 66 | elenco.forEach( v => { 67 | this.vociFiltro.find(vf => vf.codice.toString() === v.toString()).selezionato = true; 68 | } 69 | ); 70 | this.nuovaSelezione.emit( 71 | this.vociFiltro 72 | .filter(v => v.selezionato) 73 | .map(v => v.codice) 74 | ); 75 | } 76 | 77 | } 78 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/gmaps-posizioni-flotta/gmaps-posizioni-flotta.component.css: -------------------------------------------------------------------------------- 1 | #gmap { 2 | height: 600px; 3 | } -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/gmaps-posizioni-flotta/gmaps-posizioni-flotta.component.html: -------------------------------------------------------------------------------- 1 | 2 | Situazione Flotta 3 | 7 | 8 | 9 | {{istanteUltimoAggiornamento | date:'shortDate'}} {{istanteUltimoAggiornamento | date:"mediumTime"}} 10 | 11 | 12 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/gmaps-posizioni-flotta/gmaps-posizioni-flotta.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { GmapsPosizioniFlottaComponent } from './gmaps-posizioni-flotta.component'; 4 | 5 | describe('GmapsPosizioniFlottaComponent', () => { 6 | let component: GmapsPosizioniFlottaComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ GmapsPosizioniFlottaComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(GmapsPosizioniFlottaComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/mappa-posizioni-flotta/mappa-posizioni-flotta.component.css: -------------------------------------------------------------------------------- 1 | agm-map { 2 | height:600px; 3 | } 4 | 5 | .map-sticky { 6 | position: sticky; 7 | top: 11% ; 8 | } 9 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/mappa-posizioni-flotta/mappa-posizioni-flotta.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | 10 | 22 | > 23 | 24 | 25 | 27 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/mappa-posizioni-flotta/mappa-posizioni-flotta.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { MappaPosizioniFlottaComponent } from './mappa-posizioni-flotta.component'; 4 | 5 | describe('MappaPosizioniFlottaComponent', () => { 6 | let component: MappaPosizioniFlottaComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ MappaPosizioniFlottaComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(MappaPosizioniFlottaComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should be created', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/pannello-filtri/pannello-filtri.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/app/pannello-filtri/pannello-filtri.component.css -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/pannello-filtri/pannello-filtri.component.html: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 11 | 14 | 15 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/pannello-filtri/pannello-filtri.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PannelloFiltriComponent } from './pannello-filtri.component'; 4 | 5 | describe('PannelloFiltriComponent', () => { 6 | let component: PannelloFiltriComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ PannelloFiltriComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PannelloFiltriComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/pannello-filtri/pannello-filtri.component.ts: -------------------------------------------------------------------------------- 1 | import { Component, OnInit } from '@angular/core'; 2 | import { VoceFiltro } from "../filtri/voce-filtro.model"; 3 | import { GestioneFiltriService } from '../service-filter/gestione-filtri.service'; 4 | 5 | import { Subscription } from 'rxjs'; 6 | 7 | @Component({ 8 | selector: 'app-pannello-filtri', 9 | templateUrl: './pannello-filtri.component.html', 10 | styleUrls: ['./pannello-filtri.component.css'] 11 | }) 12 | export class PannelloFiltriComponent implements OnInit { 13 | 14 | 15 | public titoloFiltroStatiMezzo: string = "Stati Mezzo"; 16 | public vociFiltroStatiMezzo: VoceFiltro[] = []; 17 | public titoloFiltroSedi: string = "Sedi"; 18 | public vociFiltroSedi: VoceFiltro[] = []; 19 | public titoloFiltroGeneriMezzo: string = "Generi Mezzo"; 20 | public vociFiltroGeneriMezzo: VoceFiltro[] = []; 21 | public titoloFiltroDestinazioneUso: string = "Destinazione d'uso"; 22 | public vociFiltroDestinazioneUso: VoceFiltro[] = []; 23 | 24 | subscription = new Subscription(); 25 | 26 | constructor( private gestioneFiltriService: GestioneFiltriService 27 | ) { 28 | 29 | 30 | this.subscription.add( 31 | this.gestioneFiltriService.getFiltriStatiMezzo() 32 | .subscribe( vocifiltro => { 33 | //console.log("ElencoPosizioniFlottaComponent, getFiltriStatiMezzo:", vocifiltro); 34 | this.vociFiltroStatiMezzo = vocifiltro; 35 | }) 36 | ); 37 | 38 | this.subscription.add( 39 | this.gestioneFiltriService.getFiltriSedi() 40 | .subscribe( vocifiltro => { 41 | //console.log("ElencoPosizioniFlottaComponent, getFiltriSedi:", vocifiltro); 42 | this.vociFiltroSedi = vocifiltro; 43 | }) 44 | ); 45 | 46 | this.subscription.add( 47 | this.gestioneFiltriService.getFiltriGeneriMezzo() 48 | .subscribe( vocifiltro => { 49 | //console.log("ElencoPosizioniFlottaComponent, getFiltriGeneriMezzo:", vocifiltro); 50 | this.vociFiltroGeneriMezzo = vocifiltro; 51 | }) 52 | ); 53 | 54 | this.subscription.add( 55 | this.gestioneFiltriService.getFiltriDestinazioneUso() 56 | .subscribe( vocifiltro => { 57 | //console.log("ElencoPosizioniFlottaComponent, getFiltriDestinazioneUso:", vocifiltro); 58 | this.vociFiltroDestinazioneUso = vocifiltro; 59 | }) 60 | ); 61 | 62 | } 63 | 64 | ngOnInit() { 65 | } 66 | 67 | nuovaSelezioneStatiMezzo(event) { 68 | //console.log('event: ', event); 69 | //this.filtriStatiMezzo = event; 70 | this.gestioneFiltriService.setVisibleStatiMezzo(event); 71 | } 72 | 73 | nuovaSelezioneSedi(event) { 74 | //console.log('event: ', event); 75 | //this.filtriSedi = event; 76 | this.gestioneFiltriService.setVisibleSedi(event); 77 | } 78 | 79 | nuovaSelezioneGeneriMezzo(event) { 80 | //console.log('event: ', event); 81 | //this.filtriGeneriMezzo = event; 82 | this.gestioneFiltriService.setVisibleGeneriMezzo(event); 83 | } 84 | 85 | nuovaSelezioneDestinazioneUso(event) { 86 | //console.log('event: ', event); 87 | //this.filtriDestinazioneUso = event; 88 | this.gestioneFiltriService.setVisibleDestinazioneUso(event); 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/pannello-opzioni/pannello-opzioni.component.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/app/pannello-opzioni/pannello-opzioni.component.css -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/pannello-opzioni/pannello-opzioni.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Estrai solo le posizioni presenti sul riquadro della mappa 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | Mostra solo le posizioni dei Mezzi selezionati 14 | 15 | 16 | 18 | 19 | 20 | 21 | 22 | Evidenzia sulla mappa l'ultima posizione ricevuta 23 | 24 | 25 | 27 | 28 | 29 | 30 | 31 | Segui sulla mappa i Mezzi Selezionati 32 | 33 | 34 | 36 | 37 | 38 | 39 | 40 | 41 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | Estrai le posizioni fino a {{opzioni.ggMaxPos}} giorni fa 52 | 53 | 54 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/pannello-opzioni/pannello-opzioni.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PannelloOpzioniComponent } from './pannello-opzioni.component'; 4 | 5 | describe('PannelloOpzioniComponent', () => { 6 | let component: PannelloOpzioniComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ PannelloOpzioniComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PannelloOpzioniComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should create', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/posizione-mezzo/posizione-mezzo.component.css: -------------------------------------------------------------------------------- 1 | @import '../shared/css/badge-stati-mezzo.css'; 2 | 3 | .highlight{ 4 | background: rgb(207, 204, 204); 5 | } 6 | 7 | .not-highlight{ 8 | background: white; 9 | } 10 | 11 | .evidence{ 12 | background: rgb(243, 239, 4) 13 | } 14 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/posizione-mezzo/posizione-mezzo.component.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | {{posizioneMezzo.sedeMezzo}} 25 | 26 | 27 | {{posizioneMezzo.codiceMezzo}} 28 | {{this.testoStatoMezzo()}} 29 | 30 | 31 | 32 | {{ this.posizioneMezzo.istanteAcquisizione | distanzaTemporale : istanteUltimoAggiornamento : "S"}} 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/posizione-mezzo/posizione-mezzo.component.spec.ts: -------------------------------------------------------------------------------- 1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing'; 2 | 3 | import { PosizioneMezzoComponent } from './posizione-mezzo.component'; 4 | 5 | describe('PosizioneMezzoComponent', () => { 6 | let component: PosizioneMezzoComponent; 7 | let fixture: ComponentFixture; 8 | 9 | beforeEach(async(() => { 10 | TestBed.configureTestingModule({ 11 | declarations: [ PosizioneMezzoComponent ] 12 | }) 13 | .compileComponents(); 14 | })); 15 | 16 | beforeEach(() => { 17 | fixture = TestBed.createComponent(PosizioneMezzoComponent); 18 | component = fixture.componentInstance; 19 | fixture.detectChanges(); 20 | }); 21 | 22 | it('should be created', () => { 23 | expect(component).toBeTruthy(); 24 | }); 25 | }); 26 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/service-VVFGeoFleet/posizione-flotta.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed, inject } from '@angular/core/testing'; 2 | 3 | import { PosizioneFlottaService } from './posizione-flotta.service'; 4 | 5 | describe('PosizioneFlottaService', () => { 6 | beforeEach(() => { 7 | TestBed.configureTestingModule({ 8 | providers: [PosizioneFlottaService] 9 | }); 10 | }); 11 | 12 | it('should be created', inject([PosizioneFlottaService], (service: PosizioneFlottaService) => { 13 | expect(service).toBeTruthy(); 14 | })); 15 | }); 16 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/service-dispatcher/flotta-dispatcher.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { FlottaDispatcherService } from './flotta-dispatcher.service'; 4 | 5 | describe('FlottaDispatcherService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: FlottaDispatcherService = TestBed.get(FlottaDispatcherService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/service-filter/gestione-filtri.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { GestioneFiltriService } from './gestione-filtri.service'; 4 | 5 | describe('GestioneFiltriService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: GestioneFiltriService = TestBed.get(GestioneFiltriService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/service-opzioni/gestione-opzioni.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { GestioneOpzioniService } from './gestione-opzioni.service'; 4 | 5 | describe('GestioneOpzioniService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: GestioneOpzioniService = TestBed.get(GestioneOpzioniService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/service-parametri/gestione-parametri.service.spec.ts: -------------------------------------------------------------------------------- 1 | import { TestBed } from '@angular/core/testing'; 2 | 3 | import { GestioneParametriService } from './gestione-parametri.service'; 4 | 5 | describe('GestioneParametriService', () => { 6 | beforeEach(() => TestBed.configureTestingModule({})); 7 | 8 | it('should be created', () => { 9 | const service: GestioneParametriService = TestBed.get(GestioneParametriService); 10 | expect(service).toBeTruthy(); 11 | }); 12 | }); 13 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/service-parametri/gestione-parametri.service.ts: -------------------------------------------------------------------------------- 1 | import { Injectable } from '@angular/core'; 2 | import { Observable, Subscription, Subject, of } from "rxjs"; 3 | 4 | import { ParametriGeoFleetWS } from '../shared/model/parametri-geofleet-ws.model'; 5 | 6 | @Injectable({ 7 | providedIn: 'root' 8 | }) 9 | export class GestioneParametriService { 10 | 11 | private subjectParametriGeoFleetWS$ = new Subject(); 12 | private parametriGeoFleetWS : ParametriGeoFleetWS; 13 | 14 | 15 | 16 | constructor() { 17 | this.parametriGeoFleetWS = new ParametriGeoFleetWS(); 18 | } 19 | 20 | 21 | public getParametriGeoFleetWS(): Observable { 22 | //console.log('GestioneParametriService - getParametriGeoFleetWS()',this.parametriGeoFleetWS); 23 | return this.subjectParametriGeoFleetWS$.asObservable(); 24 | } 25 | 26 | public resetParametriGeoFleetWS(): void { 27 | this.parametriGeoFleetWS.reset(); 28 | this.subjectParametriGeoFleetWS$.next(this.parametriGeoFleetWS); 29 | } 30 | 31 | public setRichiestaAPI(value : string): void { 32 | this.parametriGeoFleetWS.setRichiestaAPI(value); 33 | this.subjectParametriGeoFleetWS$.next(this.parametriGeoFleetWS); 34 | } 35 | 36 | public setAttSec(value : number): void { 37 | this.parametriGeoFleetWS.setAttSec(value); 38 | 39 | this.subjectParametriGeoFleetWS$.next(this.parametriGeoFleetWS); 40 | } 41 | 42 | public setRettangoloRicerca(evento) { 43 | if (evento != null) { 44 | 45 | var vv = Object.values(evento); 46 | var vv1 = Object.values(vv[0]); 47 | var vv2 = Object.values(vv[1]); 48 | 49 | this.parametriGeoFleetWS.setLat1(vv1[1]); 50 | this.parametriGeoFleetWS.setLon1(vv2[0]); 51 | this.parametriGeoFleetWS.setLat2(vv1[0]); 52 | this.parametriGeoFleetWS.setLon2(vv2[1]); 53 | 54 | this.subjectParametriGeoFleetWS$.next(this.parametriGeoFleetWS); 55 | 56 | //console.log('setRettangoloRicerca',this.parametriGeoFleetWS); 57 | } 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/shared/css/badge-stati-mezzo.css: -------------------------------------------------------------------------------- 1 | .badge-radio { 2 | background-color:#e7a34b 3 | } 4 | 5 | .badge-fuori-servizio { 6 | background-color:#80d8db 7 | } 8 | 9 | .badge-istituto { 10 | background-color:#f5f108 11 | } 12 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/shared/directive/agm-get-map-objects.ts: -------------------------------------------------------------------------------- 1 | import { Directive, Output, EventEmitter, AfterViewInit, ContentChildren, QueryList } from '@angular/core'; 2 | import { GoogleMapsAPIWrapper, MarkerManager, AgmMarker } from '@agm/core'; 3 | import { AgmJsMarkerClustererModule, ClusterManager } from '@agm/js-marker-clusterer'; 4 | 5 | @Directive({ 6 | selector: 'agm-get-map-objects', 7 | }) 8 | 9 | export class AgmGetMapObjectsDirective implements AfterViewInit { 10 | 11 | /** 12 | * Get native map object 13 | */ 14 | private _map: any = null; 15 | @Output('map') mapChanged: EventEmitter = new EventEmitter(); 16 | set map(val){ 17 | this._map = val; 18 | this.mapChanged.emit(val); 19 | } 20 | get map(){ 21 | return this._map; 22 | } 23 | 24 | /** 25 | * Get marker manager 26 | */ 27 | private _markerManager: any = null; 28 | @Output('markerManager') markerManagerChanged: EventEmitter = new EventEmitter(); 29 | set markerManager(val){ 30 | this._markerManager = val; 31 | this.markerManagerChanged.emit(val); 32 | } 33 | get markerManager(){ 34 | return this._markerManager; 35 | } 36 | 37 | /** 38 | * Get agm markers 39 | */ 40 | private _markers: any = null; 41 | @Output('markers') markersChanged: EventEmitter = new EventEmitter(); 42 | set markers(val){ 43 | this._markers = val; 44 | this.markersChanged.emit(val); 45 | } 46 | get markers(){ 47 | return this._markers; 48 | } 49 | 50 | /** 51 | * Get cluster manager 52 | */ 53 | private _clusterManager: any = null; 54 | @Output('clusterManager') clusterManagerChanged: EventEmitter = new EventEmitter(); 55 | set clusterManager(val){ 56 | this._clusterManager = val; 57 | this.clusterManagerChanged.emit(val); 58 | } 59 | get clusterManager(){ 60 | return this._clusterManager; 61 | } 62 | 63 | @ContentChildren(AgmMarker) markerChildren: QueryList; 64 | 65 | constructor( 66 | private googleMapsWrapper: GoogleMapsAPIWrapper, 67 | private googleMarkerManager: MarkerManager, 68 | private googleClusterManager: ClusterManager, 69 | ) { } 70 | 71 | ngAfterViewInit() { 72 | // get native map 73 | this.googleMapsWrapper.getNativeMap().then(map => { 74 | this.map = map; 75 | }, error => { 76 | throw error; 77 | }) 78 | 79 | // get marker manager 80 | this.markerManager = this.googleMarkerManager; 81 | //console.log("ngAfterViewInit: ", this.markerManager); 82 | 83 | // get markers 84 | this.markerChildren.changes.subscribe(markers => { 85 | this.markers = markers._results; 86 | }) 87 | 88 | // get cluster manager 89 | this.clusterManager = this.googleClusterManager 90 | //console.log("ngAfterViewInit: ", this.markerManager); 91 | 92 | } 93 | } 94 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/shared/model/mezzo.model.ts: -------------------------------------------------------------------------------- 1 | 2 | export class Mezzo { 3 | constructor ( 4 | public codiceMezzo:string, 5 | public descrizione: string 6 | ) {} 7 | 8 | } 9 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/shared/model/parametri-geofleet-ws.model.ts: -------------------------------------------------------------------------------- 1 | export class ParametriGeoFleetWS { 2 | 3 | private richiestaAPI: string; 4 | private attSec: Number; 5 | private lat1: Number; 6 | private lon1: Number; 7 | private lat2: Number; 8 | private lon2: Number; 9 | private classiMezzo: String[]; 10 | constructor() 11 | constructor(obj?: ParametriGeoFleetWS) 12 | { 13 | if (obj) { 14 | this.set(obj); 15 | } 16 | /* 17 | else 18 | {this.reset();} 19 | */ 20 | } 21 | 22 | private defaultAttSecStandard: Number = 259200; // 3 giorni (3 * 24 * 60 * 60) 23 | private defaultAttSec: Number = 259200; // 3 giorni (3 * 24 * 60 * 60) 24 | //private defaultAttSec: Number = 604800; // 1 settimana (7 * 24 * 60 * 60) 25 | private defaultrichiestaAPI: string = 'posizioneFlotta'; 26 | 27 | public reset() { 28 | this.setRichiestaAPI(this.defaultrichiestaAPI); 29 | this.setAttSec(this.defaultAttSec); 30 | this.lat1 = null; 31 | this.lon1 = null; 32 | this.lat2 = null; 33 | this.lon2 = null; 34 | this.classiMezzo = null; 35 | } 36 | 37 | public set(obj: ParametriGeoFleetWS): void { 38 | this.setAttSec(obj.getAttSec()); 39 | this.setClassiMezzo(obj.getClassiMezzo()); 40 | this.setDefaultAttSec(obj.getDefaultAttSec()); 41 | this.setLat1(obj.getLat1()); 42 | this.setLat2(obj.getLat2()); 43 | this.setLon1(obj.getLon1()); 44 | this.setLon2(obj.getLon2()); 45 | this.setRichiestaAPI(obj.getRichiestaAPI()); 46 | } 47 | 48 | public getRichiestaAPI() : string { return this.richiestaAPI; } 49 | 50 | public setRichiestaAPI(richiestaAPI : string) { 51 | if ( richiestaAPI != null) {this.richiestaAPI = richiestaAPI;} 52 | else {this.richiestaAPI = this.defaultrichiestaAPI.valueOf(); } 53 | } 54 | 55 | public getAttSec() : Number { return this.attSec; } 56 | 57 | public setAttSec(attSec : Number) { 58 | if ( attSec != null) {this.attSec = attSec;} 59 | else {this.attSec = this.defaultAttSec.valueOf(); } 60 | } 61 | 62 | public getDefaultAttSec() : Number { return this.defaultAttSec; } 63 | 64 | public setDefaultAttSec(attSec : Number) { 65 | if ( attSec != null) {this.defaultAttSec = attSec;} 66 | else {this.defaultAttSec = this.defaultAttSecStandard.valueOf(); } 67 | } 68 | 69 | public getLat1() : Number { return this.lat1; } 70 | public setLat1(lat1 : Number) { this.lat1 = lat1; } 71 | 72 | public getLon1() : Number { return this.lon1; } 73 | public setLon1(lon1 : Number) { this.lon1 = lon1; } 74 | 75 | public getLat2() : Number { return this.lat2; } 76 | public setLat2(lat2 : Number) { this.lat2 = lat2; } 77 | 78 | public getLon2() : Number { return this.lon2; } 79 | public setLon2(lon2 : Number) { this.lon2 = lon2; } 80 | 81 | public getClassiMezzo() : String[] { return this.classiMezzo; } 82 | public setClassiMezzo(classiMezzo : String[]) { 83 | this.classiMezzo = classiMezzo; } 84 | 85 | } 86 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/shared/model/posizione-mezzo.model.ts: -------------------------------------------------------------------------------- 1 | 2 | export class PosizioneMezzo { 3 | constructor ( 4 | public istanteInvio:string, 5 | public codiceMezzo:string, 6 | public classiMezzo:string[], 7 | public localizzazione: { 8 | lat:string, 9 | lon:string, 10 | }, 11 | public istanteAcquisizione: string, 12 | public fonte: { 13 | codiceFonte:string, 14 | classeFonte:string, 15 | }, 16 | public infoSO115: { 17 | stato:string, 18 | codiceIntervento:string, 19 | dataIntervento: string 20 | }, 21 | public istanteArchiviazione: string, 22 | public toolTipText: string, 23 | public sedeMezzo: string, 24 | public destinazioneUso: string, 25 | public classiMezzoDepurata: string[], 26 | public descrizionePosizione: string, 27 | public marker: google.maps.Marker, 28 | public visibile: boolean, 29 | public selezionato?: boolean 30 | ) {} 31 | 32 | } 33 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/shared/model/risultati-mezzi-in-rettangolo.model.ts: -------------------------------------------------------------------------------- 1 | import { PosizioneMezzo } from './posizione-mezzo.model'; 2 | 3 | export class RispostaMezziInRettangolo { 4 | constructor ( 5 | public istanteQuery:string, 6 | public rettangolo: { 7 | topLeft: { 8 | lat: string, 9 | lon: string 10 | }, 11 | bottomRight: { 12 | lat: string, 13 | lon: string 14 | } 15 | }, 16 | public classiMezzo: string[], 17 | public numeroMezzi: string, 18 | public durataQuery_msec: string, 19 | public risultati: PosizioneMezzo[] 20 | ) {} 21 | } 22 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/app/shared/pipes/distanza-temporale.pipe.ts: -------------------------------------------------------------------------------- 1 | import { Pipe, PipeTransform } from '@angular/core'; 2 | import * as moment from 'moment'; 3 | 4 | @Pipe({ 5 | name: 'distanzaTemporale' 6 | }) 7 | 8 | export class DistanzaTemporalePipe implements PipeTransform { 9 | 10 | transform(dataDa: Date, dataA: Date, formatoSintetico: string = "S"): string { 11 | let ritorno = ""; 12 | let dataIniziale, dataFinale : Date; 13 | let giorni, ore, minuti, secondi : number = 0; 14 | if ((!dataDa) || (!dataA) ) 15 | return ""; 16 | if (dataDa == dataA) 17 | return ""; 18 | 19 | moment.locale('it'); 20 | 21 | if (formatoSintetico == "S") { 22 | if (dataDa > dataA) 23 | { dataIniziale = dataDa; 24 | dataFinale = dataA; 25 | ritorno = "(+"; } 26 | else 27 | { dataIniziale = dataA; 28 | dataFinale = dataDa; 29 | ritorno = "(-"; } 30 | 31 | //ritorno = ritorno + moment(dataDa).diff(dataA, 'hours', true); 32 | ore = moment(dataIniziale).diff(dataFinale, 'hours'); 33 | if (ore <24 ) { 34 | if (ore != 0 ) { ritorno = ritorno + ore +"h"; 35 | dataIniziale = moment(dataIniziale).subtract(ore, 'hours').toDate();} 36 | minuti = moment(dataIniziale).diff(dataFinale, 'minutes'); 37 | if (minuti != 0 ) { ritorno = ritorno + minuti +"m"; 38 | dataIniziale = moment(dataIniziale).subtract(minuti, 'minutes').toDate();} 39 | secondi = moment(dataIniziale).diff(dataFinale, 'seconds'); 40 | if (ore == 0 && secondi != 0 ) { ritorno = ritorno + secondi +"s";} 41 | //ritorno = ritorno + moment(dataDa).diff(dataA); 42 | //ritorno = ritorno + ore +"h" + minuti +"m" + secondi +"s" ; 43 | } 44 | else { 45 | giorni = moment(dataIniziale).diff(dataFinale, 'days'); 46 | ritorno = ritorno + giorni +"d"; 47 | ore = ore - (giorni*24); 48 | if (ore > 0) { 49 | ritorno = ritorno + ore +"h"; 50 | } 51 | } 52 | ritorno = ritorno + ")"; 53 | } 54 | else 55 | { ritorno = moment(dataDa).from(dataA); 56 | } 57 | //return moment(dataDa).format("HH:mm:ss"); 58 | return ritorno; 59 | } 60 | 61 | } 62 | 63 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/.gitkeep -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/Fire-Truck.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/Fire-Truck.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/car.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/car.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_20_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_20_black.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_20_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_20_blue.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_20_blue_scuro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_20_blue_scuro.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_20_cyan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_20_cyan.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_20_gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_20_gray.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_20_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_20_green.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_20_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_20_orange.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_20_purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_20_purple.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_20_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_20_red.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_20_yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_20_yellow.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_30_black.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_30_black.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_30_blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_30_blue.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_30_blue_scuro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_30_blue_scuro.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_30_cyan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_30_cyan.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_30_gray.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_30_gray.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_30_green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_30_green.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_30_orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_30_orange.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_30_purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_30_purple.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_30_red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_30_red.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_30_yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_30_yellow.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_40_blue_scuro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_40_blue_scuro.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/assets/images/mm_60_blue_scuro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/assets/images/mm_60_blue_scuro.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/favicon.ico -------------------------------------------------------------------------------- /src/frontend/dashboard/src/img/car.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/vvfosprojects/vvfgeofleet/c8da18f10c1bd78eaa0555c414952acded9a75af/src/frontend/dashboard/src/img/car.png -------------------------------------------------------------------------------- /src/frontend/dashboard/src/main.ts: -------------------------------------------------------------------------------- 1 | import { enableProdMode } from '@angular/core'; 2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; 3 | 4 | import { AppModule } from './app/app.module'; 5 | import { environment } from './environments/environment'; 6 | 7 | if (environment.production) { 8 | enableProdMode(); 9 | } 10 | 11 | platformBrowserDynamic().bootstrapModule(AppModule); 12 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/note.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/polyfills.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This file includes polyfills needed by Angular and is loaded before the app. 3 | * You can add your own extra polyfills to this file. 4 | * 5 | * This file is divided into 2 sections: 6 | * 1. Browser polyfills. These are applied before loading ZoneJS and are sorted by browsers. 7 | * 2. Application imports. Files imported after ZoneJS that should be loaded before your main 8 | * file. 9 | * 10 | * The current setup is for so-called "evergreen" browsers; the last versions of browsers that 11 | * automatically update themselves. This includes Safari >= 10, Chrome >= 55 (including Opera), 12 | * Edge >= 13 on the desktop, and iOS 10 and Chrome on mobile. 13 | * 14 | * Learn more in https://angular.io/docs/ts/latest/guide/browser-support.html 15 | */ 16 | 17 | /*************************************************************************************************** 18 | * BROWSER POLYFILLS 19 | */ 20 | 21 | /** IE9, IE10 and IE11 requires all of the following polyfills. **/ 22 | /* 23 | import 'core-js/es6/symbol'; 24 | import 'core-js/es6/object'; 25 | import 'core-js/es6/function'; 26 | import 'core-js/es6/parse-int'; 27 | import 'core-js/es6/parse-float'; 28 | import 'core-js/es6/number'; 29 | import 'core-js/es6/math'; 30 | import 'core-js/es6/string'; 31 | import 'core-js/es6/date'; 32 | import 'core-js/es6/array'; 33 | import 'core-js/es6/regexp'; 34 | import 'core-js/es6/map'; 35 | import 'core-js/es6/weak-map'; 36 | import 'core-js/es6/set'; 37 | */ 38 | /** IE10 and IE11 requires the following for NgClass support on SVG elements */ 39 | //import 'classlist.js'; // Run `npm install --save classlist.js`. 40 | 41 | /** Evergreen browsers require these. **/ 42 | /* 43 | import 'core-js/es6/reflect'; 44 | import 'core-js/es7/reflect'; 45 | */ 46 | 47 | /** 48 | * Required to support Web Animations `@angular/animation`. 49 | * Needed for: All but Chrome, Firefox and Opera. http://caniuse.com/#feat=web-animation 50 | **/ 51 | //import 'web-animations-js'; // Run `npm install --save web-animations-js`. 52 | 53 | 54 | 55 | /*************************************************************************************************** 56 | * Zone JS is required by Angular itself. 57 | */ 58 | import 'zone.js/dist/zone'; // Included with Angular CLI. 59 | 60 | 61 | 62 | /*************************************************************************************************** 63 | * APPLICATION IMPORTS 64 | */ 65 | 66 | /** 67 | * Date, currency, decimal and percent pipes. 68 | * Needed for: All but Chrome, Firefox, Edge, IE11 and Safari 10 69 | */ 70 | // import 'intl'; // Run `npm install --save intl`. 71 | /** 72 | * Need to import at least one locale-data with intl. 73 | */ 74 | // import 'intl/locale-data/jsonp/en'; 75 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/styles.css: -------------------------------------------------------------------------------- 1 | /* You can add global styles to this file, and also import other style files */ 2 | @import "../node_modules/bootstrap/dist/css/bootstrap.min.css"; 3 | @import '../node_modules/font-awesome/css/font-awesome.css'; 4 | @import '../node_modules/primeicons/primeicons.css'; 5 | @import '../node_modules/primeng/resources/themes/omega/theme.css'; 6 | @import '../node_modules/primeng/resources/primeng.min.css'; 7 | 8 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/test.ts: -------------------------------------------------------------------------------- 1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files 2 | 3 | import 'zone.js/dist/long-stack-trace-zone'; 4 | import 'zone.js/dist/proxy.js'; 5 | import 'zone.js/dist/sync-test'; 6 | import 'zone.js/dist/jasmine-patch'; 7 | import 'zone.js/dist/async-test'; 8 | import 'zone.js/dist/fake-async-test'; 9 | import { getTestBed } from '@angular/core/testing'; 10 | import { 11 | BrowserDynamicTestingModule, 12 | platformBrowserDynamicTesting 13 | } from '@angular/platform-browser-dynamic/testing'; 14 | 15 | // Unfortunately there's no typing for the `__karma__` variable. Just declare it as any. 16 | declare const __karma__: any; 17 | declare const require: any; 18 | 19 | // Prevent Karma from running prematurely. 20 | __karma__.loaded = function () {}; 21 | 22 | // First, initialize the Angular testing environment. 23 | getTestBed().initTestEnvironment( 24 | BrowserDynamicTestingModule, 25 | platformBrowserDynamicTesting() 26 | ); 27 | // Then we find all the tests. 28 | const context = require.context('./', true, /\.spec\.ts$/); 29 | // And load the modules. 30 | context.keys().map(context); 31 | // Finally, start Karma to run the tests. 32 | __karma__.start(); 33 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/tsconfig.app.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/app", 5 | "baseUrl": "./", 6 | "module": "es2015", 7 | "types": [] 8 | }, 9 | "exclude": [ 10 | "test.ts", 11 | "**/*.spec.ts" 12 | ] 13 | } 14 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/tsconfig.spec.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "../tsconfig.json", 3 | "compilerOptions": { 4 | "outDir": "../out-tsc/spec", 5 | "baseUrl": "./", 6 | "module": "commonjs", 7 | "target": "es5", 8 | "types": [ 9 | "jasmine", 10 | "node" 11 | ] 12 | }, 13 | "files": [ 14 | "test.ts", 15 | "polyfills.ts" 16 | ], 17 | "include": [ 18 | "**/*.spec.ts", 19 | "**/*.d.ts" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /src/frontend/dashboard/src/typings.d.ts: -------------------------------------------------------------------------------- 1 | /* SystemJS module definition */ 2 | declare var module: NodeModule; 3 | interface NodeModule { 4 | id: string; 5 | } 6 | -------------------------------------------------------------------------------- /src/frontend/dashboard/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compileOnSave": false, 3 | "compilerOptions": { 4 | "outDir": "./dist/out-tsc", 5 | "sourceMap": true, 6 | "declaration": false, 7 | "moduleResolution": "node", 8 | "emitDecoratorMetadata": true, 9 | "experimentalDecorators": true, 10 | "target": "es5", 11 | "typeRoots": [ 12 | "node_modules/@types" 13 | ], 14 | "lib": [ 15 | "es2017", 16 | "dom" 17 | ], 18 | "module": "es2015", 19 | "baseUrl": "./" 20 | } 21 | } --------------------------------------------------------------------------------
2 | 5 | 8 | 11 | 14 |