diff --git a/.github/workflows/dotnetcore.yml b/.github/workflows/dotnetcore.yml new file mode 100644 index 0000000..f199d4b --- /dev/null +++ b/.github/workflows/dotnetcore.yml @@ -0,0 +1,106 @@ +name: Build, Test, Publish and Dockerise Lora-Map + +on: [push] + +jobs: + build: + name: Build, pack and release + runs-on: ubuntu-latest + steps: + - name: Checkout parent project with dependencys + uses: actions/checkout@v1 + with: + repository: MONICA-Project/map-project + ref: refs/heads/master + submodules: true + + - name: Checkout last versions + run: git -C Lora-Map checkout --progress --force ${{ github.sha }} + working-directory: ../map-project + + - name: Install dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 3.0.100 + + - name: Build with dotnet + run: dotnet build Lora-Map.sln --configuration Release + working-directory: ../map-project/Lora-Map + + - name: Create deb files + if: success() + run: | + mkdir ../../../Builds + chmod oug+x make-deb.sh + ./make-deb.sh amd64 + ./make-deb.sh armhf + id: create_deb + working-directory: ../map-project/Lora-Map/Lora-Map/dpkg + + - name: Create release + if: success() + id: nightly_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.create_deb.outputs.builddaterelease }} + release_name: Nightly from master + body: This is a nightly release. It may be not working properly. + draft: false + prerelease: true + + - name: Upload release asset amd64 + if: success() + id: upload-release-asset-amd64 + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.nightly_release.outputs.upload_url }} + asset_path: ../map-project/Builds/amd64-${{ steps.create_deb.outputs.debuilderfile }} + asset_name: amd64-${{ steps.create_deb.outputs.debuilderfile }} + asset_content_type: application/x-deb + + - name: Upload release asset armhf + if: success() + id: upload-release-asset-armhf + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.nightly_release.outputs.upload_url }} + asset_path: ../map-project/Builds/armhf-${{ steps.create_deb.outputs.debuilderfile }} + asset_name: armhf-${{ steps.create_deb.outputs.debuilderfile }} + asset_content_type: application/x-deb + + docker: + name: Build and push dockerfile + runs-on: ubuntu-latest + steps: + - name: Checkout parent project with dependencys + uses: actions/checkout@v1 + with: + repository: MONICA-Project/map-project + ref: refs/heads/master + submodules: true + + - name: Checkout last versions + run: git -C Lora-Map checkout --progress --force ${{ github.sha }} + working-directory: ../map-project + + - name: Docker build + id: docker_build + run: | + DOCKERTAG=$(date +%Y%m%d%H%M%S) + echo "##[set-output name=dockertag;]$DOCKERTAG" + docker build . -t monicaproject/lora-map:latest -t monicaproject/lora-map:$DOCKERTAG + working-directory: ../map-project + + - name: Docker-compose publish + if: success() + run: | + echo ${{ secrets.DOCKER_PASSWORD }} | docker login -u ${{ secrets.DOCKER_USERNAME }} --password-stdin ${INPUT_REGISTRY} + docker push monicaproject/lora-map:latest + docker push monicaproject/lora-map:${{ steps.docker_build.outputs.dockertag }} + working-directory: ../map-project \ No newline at end of file diff --git a/.gitignore b/.gitignore index 584d982..4ef7bed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /.vs /Lora-Map/obj /Lora-Map/bin +/Doku/.vs diff --git a/CHANGELOG b/CHANGELOG.md similarity index 85% rename from CHANGELOG rename to CHANGELOG.md index 4cc8a11..a9ddd52 100644 --- a/CHANGELOG +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Changelogs +## 1.2.10 +### New Features +* Posibility to display sensor data on map +### Bugfixes +* Parse also all Doublevalues as Int +### Changes +* Change Online Map MaxZoom to 19 +* Searchfunction case insensitive +* Show Numbers from a Place not with linebreaking +* Numbers on places are not clickable, also as the grid +* Search in Description of Polygons +* Change Sani to Rettungsdienst +* Display GateCounting Boxes in a line not a collumn +* Create Aliases for Camera Count +* Filter Fight under level +* Refactoring +* Porting to .NET Core + ## 1.2.9 ### New Features * Add setting model to code diff --git a/Lora-Map.jpg b/Lora-Map.jpg new file mode 100644 index 0000000..c8fe2d2 Binary files /dev/null and b/Lora-Map.jpg differ diff --git a/Lora-Map.sln b/Lora-Map.sln index 1a0592c..6999e79 100644 --- a/Lora-Map.sln +++ b/Lora-Map.sln @@ -1,25 +1,34 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27703.2026 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29519.87 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lora-Map", "Lora-Map\Lora-Map.csproj", "{95D6F48A-9488-42A6-A973-941B45B26DB8}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Lora-Map_Core", "Lora-Map\Lora-Map.csproj", "{78136B15-FF0B-4DCE-94CA-1D6148DEA232}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils-IoT", "..\Utils\Utils-IoT\Utils-IoT\Utils-IoT.csproj", "{B870E4D5-6806-4A0B-B233-8907EEDC5AFC}" +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7DD32F31-ACB0-4F5E-B3D8-78564A83ACEF}" + ProjectSection(SolutionItems) = preProject + ..\.dockerignore = ..\.dockerignore + ..\CONTRIBUTING.md = ..\CONTRIBUTING.md + ..\docker-compose.yml = ..\docker-compose.yml + ..\Dockerfile = ..\Dockerfile + ..\LICENSE = ..\LICENSE + ..\README.md = ..\README.md + ..\update.sh = ..\update.sh + EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ConnectorDataMqtt", "..\Utils\ConnectorDataMqtt\ConnectorDataMqtt\ConnectorDataMqtt.csproj", "{EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Bot-Utils_Core", "..\Utils\Bot-Utils\Bot-Utils\Bot-Utils_Core.csproj", "{ED37370F-AE65-498D-A425-413FEE69C0A8}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "litjson_4.7.1", "..\Librarys\litjson\litjson\litjson_4.7.1.csproj", "{91A14CD2-2940-4500-8193-56D37EDDDBAA}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Utils_Core", "..\Utils\Utils\Utils\Utils_Core.csproj", "{E8268FE5-D6F0-4805-9BDE-9DBC9CB517FF}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "M2Mqtt_4.7.1", "..\Librarys\mqtt\M2Mqtt\M2Mqtt_4.7.1.csproj", "{A11AEF5A-B246-4FE8-8330-06DB73CC8074}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Utils-IoT_Core", "..\Utils\Utils-IoT\Utils-IoT\Utils-IoT_Core.csproj", "{04CF6328-3976-44D3-9959-A3B1A2C5C45A}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bot-Utils", "..\Utils\Bot-Utils\Bot-Utils\Bot-Utils.csproj", "{BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConnectorDataMqtt_Core", "..\Utils\ConnectorDataMqtt\ConnectorDataMqtt\ConnectorDataMqtt_Core.csproj", "{E40D29CB-B499-4FA6-AEA1-18E8CEAA911B}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Utils", "..\Utils\Utils\Utils\Utils.csproj", "{FAC8CE64-BF13-4ECE-8097-AEB5DD060098}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "litjson_Core", "..\Librarys\litjson\litjson\litjson_Core.csproj", "{FFC66B7F-B4FB-4E42-B896-2C6772D899AA}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mono.Posix", "..\Librarys\Mono.Posix\Mono.Posix\Mono.Posix.csproj", "{E2CA132E-E85C-40AD-BE94-B138AA68772B}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "M2Mqtt_Core", "..\Librarys\mqtt\M2Mqtt\M2Mqtt_Core.csproj", "{00C678EE-6BAA-4FCB-AAA5-7755E65C6CC5}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CoordinateSharp", "..\Librarys\Coordinates\CoordinateSharp\CoordinateSharp.csproj", "{DA8510CE-7899-49DD-9E17-7C974382288D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CoordinateSharp_Core", "..\Librarys\Coordinates\CoordinateSharp\CoordinateSharp_Core.csproj", "{D9D4C842-5818-4E96-9BFE-7ADFB4D811BA}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -27,47 +36,43 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {95D6F48A-9488-42A6-A973-941B45B26DB8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {95D6F48A-9488-42A6-A973-941B45B26DB8}.Debug|Any CPU.Build.0 = Debug|Any CPU - {95D6F48A-9488-42A6-A973-941B45B26DB8}.Release|Any CPU.ActiveCfg = Release|Any CPU - {95D6F48A-9488-42A6-A973-941B45B26DB8}.Release|Any CPU.Build.0 = Release|Any CPU - {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B870E4D5-6806-4A0B-B233-8907EEDC5AFC}.Release|Any CPU.Build.0 = Release|Any CPU - {EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EE6C8F68-ED46-4C1C-ABDD-CFCDF75104F2}.Release|Any CPU.Build.0 = Release|Any CPU - {91A14CD2-2940-4500-8193-56D37EDDDBAA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {91A14CD2-2940-4500-8193-56D37EDDDBAA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {91A14CD2-2940-4500-8193-56D37EDDDBAA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {91A14CD2-2940-4500-8193-56D37EDDDBAA}.Release|Any CPU.Build.0 = Release|Any CPU - {A11AEF5A-B246-4FE8-8330-06DB73CC8074}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A11AEF5A-B246-4FE8-8330-06DB73CC8074}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A11AEF5A-B246-4FE8-8330-06DB73CC8074}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A11AEF5A-B246-4FE8-8330-06DB73CC8074}.Release|Any CPU.Build.0 = Release|Any CPU - {BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}.Debug|Any CPU.Build.0 = Debug|Any CPU - {BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}.Release|Any CPU.ActiveCfg = Release|Any CPU - {BB7BFCB5-3DB0-49E1-802A-3CE3EECC59F9}.Release|Any CPU.Build.0 = Release|Any CPU - {FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FAC8CE64-BF13-4ECE-8097-AEB5DD060098}.Release|Any CPU.Build.0 = Release|Any CPU - {E2CA132E-E85C-40AD-BE94-B138AA68772B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E2CA132E-E85C-40AD-BE94-B138AA68772B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E2CA132E-E85C-40AD-BE94-B138AA68772B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E2CA132E-E85C-40AD-BE94-B138AA68772B}.Release|Any CPU.Build.0 = Release|Any CPU - {DA8510CE-7899-49DD-9E17-7C974382288D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {DA8510CE-7899-49DD-9E17-7C974382288D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {DA8510CE-7899-49DD-9E17-7C974382288D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {DA8510CE-7899-49DD-9E17-7C974382288D}.Release|Any CPU.Build.0 = Release|Any CPU + {78136B15-FF0B-4DCE-94CA-1D6148DEA232}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {78136B15-FF0B-4DCE-94CA-1D6148DEA232}.Debug|Any CPU.Build.0 = Debug|Any CPU + {78136B15-FF0B-4DCE-94CA-1D6148DEA232}.Release|Any CPU.ActiveCfg = Release|Any CPU + {78136B15-FF0B-4DCE-94CA-1D6148DEA232}.Release|Any CPU.Build.0 = Release|Any CPU + {ED37370F-AE65-498D-A425-413FEE69C0A8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ED37370F-AE65-498D-A425-413FEE69C0A8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ED37370F-AE65-498D-A425-413FEE69C0A8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ED37370F-AE65-498D-A425-413FEE69C0A8}.Release|Any CPU.Build.0 = Release|Any CPU + {E8268FE5-D6F0-4805-9BDE-9DBC9CB517FF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E8268FE5-D6F0-4805-9BDE-9DBC9CB517FF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E8268FE5-D6F0-4805-9BDE-9DBC9CB517FF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E8268FE5-D6F0-4805-9BDE-9DBC9CB517FF}.Release|Any CPU.Build.0 = Release|Any CPU + {04CF6328-3976-44D3-9959-A3B1A2C5C45A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {04CF6328-3976-44D3-9959-A3B1A2C5C45A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {04CF6328-3976-44D3-9959-A3B1A2C5C45A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {04CF6328-3976-44D3-9959-A3B1A2C5C45A}.Release|Any CPU.Build.0 = Release|Any CPU + {E40D29CB-B499-4FA6-AEA1-18E8CEAA911B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E40D29CB-B499-4FA6-AEA1-18E8CEAA911B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E40D29CB-B499-4FA6-AEA1-18E8CEAA911B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E40D29CB-B499-4FA6-AEA1-18E8CEAA911B}.Release|Any CPU.Build.0 = Release|Any CPU + {FFC66B7F-B4FB-4E42-B896-2C6772D899AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FFC66B7F-B4FB-4E42-B896-2C6772D899AA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FFC66B7F-B4FB-4E42-B896-2C6772D899AA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FFC66B7F-B4FB-4E42-B896-2C6772D899AA}.Release|Any CPU.Build.0 = Release|Any CPU + {00C678EE-6BAA-4FCB-AAA5-7755E65C6CC5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {00C678EE-6BAA-4FCB-AAA5-7755E65C6CC5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {00C678EE-6BAA-4FCB-AAA5-7755E65C6CC5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {00C678EE-6BAA-4FCB-AAA5-7755E65C6CC5}.Release|Any CPU.Build.0 = Release|Any CPU + {D9D4C842-5818-4E96-9BFE-7ADFB4D811BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D9D4C842-5818-4E96-9BFE-7ADFB4D811BA}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D9D4C842-5818-4E96-9BFE-7ADFB4D811BA}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D9D4C842-5818-4E96-9BFE-7ADFB4D811BA}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {1534B636-9FC8-49BB-BB14-FC403ECDF889} + SolutionGuid = {7B1C516B-2EDC-4F6A-A1A5-A9BCA14C8603} EndGlobalSection EndGlobal diff --git a/Lora-Map/Adminrights.manifest b/Lora-Map/Adminrights.manifest index f21a980..6250b4f 100644 --- a/Lora-Map/Adminrights.manifest +++ b/Lora-Map/Adminrights.manifest @@ -4,73 +4,8 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Lora-Map/Lora-Map.csproj b/Lora-Map/Lora-Map.csproj index 216558a..8a0d913 100644 --- a/Lora-Map/Lora-Map.csproj +++ b/Lora-Map/Lora-Map.csproj @@ -1,257 +1,206 @@ - - - + + - Debug - AnyCPU - {95D6F48A-9488-42A6-A973-941B45B26DB8} Exe + netcoreapp3.0 Fraunhofer.Fit.IoT.LoraMap Lora-Map - v4.7.1 - 512 - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - Adminrights.manifest + Lora-Map + Displays Items with Coordinates from Mqtt on a Map + Fraunhofer FIT + LoraMap.IoT.Fit.Fraunhofer + Copyright © Fraunhofer FIT, BlubbFish 2018 - 11.12.2019 + BlubbFish + 1.2.10 + LICENSE + https://github.com/MONICA-Project/lora-map + https://github.com/MONICA-Project/lora-map.git + git + de-DE + 1.2.10 Refactoring is the thing +1.2.9 The PüMa Release +1.2.8 Improving the UI +1.2.7 Reorganise a lot of things, add Support for Cameradata +1.2.6 New Types of marker for person +1.2.5 Set textsize for every zoomlevel +1.2.4 Can draw Textmarkers on the Map, use MGRS (UTM) on the Map +1.2.3 #9 display polygons and marker on the map +1.2.2 Bugfix, if only recieve panic packet with gps data, update the marker on the map also +1.2.1 #6 Load the map from the Device +1.2.0 #4 Possible to Ex and Import Setting +1.1.7 #8 Editor for Names +1.1.6 #5 Create admin area +1.1.5 Add support for alert button +1.1.4 #3 Create icons for devices +1.1.3 #1 Click on icon and show details +1.1.2 #2 Show versions number in Site +1.1.1 Add Debian package config + lora mqtt map lagekarte + Fraunhofer.Fit.IoT.LoraMap.Program + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - + + + + + + - - - + PreserveNewest - - - - - - - - - + PreserveNewest - - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - Designer - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - - PreserveNewest - - + PreserveNewest - + PreserveNewest - - + + PreserveNewest - - - - - {da8510ce-7899-49dd-9e17-7c974382288d} - CoordinateSharp - - - {91a14cd2-2940-4500-8193-56d37edddbaa} - litjson_4.7.1 - - - {a11aef5a-b246-4fe8-8330-06db73cc8074} - M2Mqtt_4.7.1 - - - {bb7bfcb5-3db0-49e1-802a-3ce3eecc59f9} - Bot-Utils - - - {ee6c8f68-ed46-4c1c-abdd-cfcdf75104f2} - ConnectorDataMqtt - - - {b870e4d5-6806-4a0b-b233-8907eedc5afc} - Utils-IoT - - - {fac8ce64-bf13-4ece-8097-aeb5dd060098} - Utils - - - - + + PreserveNewest - - - - + + PreserveNewest - + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + PreserveNewest + + + True + + - - - \ No newline at end of file + + diff --git a/Lora-Map/Model/AlarmItem.cs b/Lora-Map/Model/AlarmItem.cs index 8160ad0..36c3854 100644 --- a/Lora-Map/Model/AlarmItem.cs +++ b/Lora-Map/Model/AlarmItem.cs @@ -23,34 +23,34 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model { public AlarmItem(JsonData json) => this.Update(json); public void Update(JsonData json) { - this.Rssi = (Double)json["Rssi"]; - this.Snr = (Double)json["Snr"]; - if(DateTime.TryParse((String)json["Receivedtime"], DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AssumeUniversal, out DateTime updatetime)) { + this.Rssi = json["Rssi"].IsInt ? (Int32)json["Rssi"] : (Double)json["Rssi"]; + this.Snr = json["Snr"].IsInt ? (Int32)json["Snr"] : (Double)json["Snr"]; + if (DateTime.TryParse((String)json["Receivedtime"], DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AssumeUniversal, out DateTime updatetime)) { this.Lorarecievedtime = updatetime.ToUniversalTime(); } this.Recievedtime = DateTime.UtcNow; - this.Latitude = (Double)json["Gps"]["Latitude"]; - this.Longitude = (Double)json["Gps"]["Longitude"]; + this.Latitude = json["Gps"]["Latitude"].IsInt ? (Int32)json["Gps"]["Latitude"] : (Double)json["Gps"]["Latitude"]; + this.Longitude = json["Gps"]["Longitude"].IsInt ? (Int32)json["Gps"]["Longitude"] : (Double)json["Gps"]["Longitude"]; this.Fix = (Boolean)json["Gps"]["Fix"]; - if(!this.Fix) { - this.Latitude = (Double)json["Gps"]["LastLatitude"]; - this.Longitude = (Double)json["Gps"]["LastLongitude"]; + if (!this.Fix) { + this.Latitude = json["Gps"]["LastLatitude"].IsInt ? (Int32)json["Gps"]["LastLatitude"] : (Double)json["Gps"]["LastLatitude"]; + this.Longitude = json["Gps"]["LastLongitude"].IsInt ? (Int32)json["Gps"]["LastLongitude"] : (Double)json["Gps"]["LastLongitude"]; } this.UTM = new UTMData(this.Latitude, this.Longitude); - this.Hdop = (Double)json["Gps"]["Hdop"]; - this.Height = (Double)json["Gps"]["Height"]; + this.Hdop = json["Gps"]["Hdop"].IsInt ? (Int32)json["Gps"]["Hdop"] : (Double)json["Gps"]["Hdop"]; + this.Height = json["Gps"]["Height"].IsInt ? (Int32)json["Gps"]["Height"] : (Double)json["Gps"]["Height"]; this.SetHistory(json); } private void SetHistory(JsonData json) { - String key = ((Double)json["BatteryLevel"]).ToString(); - key += "_" + ((Int32)json["Calculatedcrc"]).ToString(); - key += "_" + ((Double)json["Gps"]["Hdop"]).ToString(); - key += "_" + ((Double)json["Gps"]["Height"]).ToString(); - key += "_" + ((Boolean)json["Gps"]["Fix"]).ToString(); - key += "_" + ((Double)json["Gps"]["LastLatitude"]).ToString(); - key += "_" + ((Double)json["Gps"]["LastLongitude"]).ToString(); - key += "_" + ((String)json["Gps"]["Time"]); + String key = json["BatteryLevel"].ToString(); + key += "_" + json["Calculatedcrc"].ToString(); + key += "_" + json["Gps"]["Hdop"].ToString(); + key += "_" + json["Gps"]["Height"].ToString(); + key += "_" + json["Gps"]["Fix"].ToString(); + key += "_" + json["Gps"]["LastLatitude"].ToString(); + key += "_" + json["Gps"]["LastLongitude"].ToString(); + key += "_" + json["Gps"]["Time"].ToString(); if(!this.buttonhistory.ContainsValue(key)) { this.buttonhistory.Add(DateTime.UtcNow, key); if(this.buttonhistory.Count > 10) { @@ -61,21 +61,21 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model { public static String GetId(JsonData json) => (String)json["Name"]; - public static Boolean CheckJson(JsonData json) => - json.ContainsKey("Rssi") && json["Rssi"].IsDouble && - json.ContainsKey("Snr") && json["Snr"].IsDouble && - json.ContainsKey("Receivedtime") && json["Receivedtime"].IsString && - json.ContainsKey("Gps") && json["Gps"].IsObject && - json["Gps"].ContainsKey("Latitude") && json["Gps"]["Latitude"].IsDouble && - json["Gps"].ContainsKey("Longitude") && json["Gps"]["Longitude"].IsDouble && - json["Gps"].ContainsKey("LastLatitude") && json["Gps"]["LastLatitude"].IsDouble && - json["Gps"].ContainsKey("LastLongitude") && json["Gps"]["LastLongitude"].IsDouble && - json["Gps"].ContainsKey("Hdop") && json["Gps"]["Hdop"].IsDouble && - json["Gps"].ContainsKey("Fix") && json["Gps"]["Fix"].IsBoolean && - json["Gps"].ContainsKey("Height") && json["Gps"]["Height"].IsDouble && - json["Gps"].ContainsKey("Time") && json["Gps"]["Time"].IsString && - json.ContainsKey("Name") && json["Name"].IsString && - json.ContainsKey("Calculatedcrc") && json["Calculatedcrc"].IsInt && - json.ContainsKey("BatteryLevel") && json["BatteryLevel"].IsDouble; + public static Boolean CheckJson(JsonData json) => + json.ContainsKey("Rssi") && (json["Rssi"].IsDouble || json["Rssi"].IsInt) + && json.ContainsKey("Snr") && (json["Snr"].IsDouble || json["Snr"].IsInt) + && json.ContainsKey("Receivedtime") && json["Receivedtime"].IsString + && json.ContainsKey("BatteryLevel") && (json["BatteryLevel"].IsDouble || json["BatteryLevel"].IsInt) + && json.ContainsKey("Gps") && json["Gps"].IsObject + && json["Gps"].ContainsKey("Latitude") && (json["Gps"]["Latitude"].IsDouble || json["Gps"]["Latitude"].IsInt) + && json["Gps"].ContainsKey("Longitude") && (json["Gps"]["Longitude"].IsDouble || json["Gps"]["Longitude"].IsInt) + && json["Gps"].ContainsKey("LastLatitude") && (json["Gps"]["LastLatitude"].IsDouble || json["Gps"]["LastLatitude"].IsInt) + && json["Gps"].ContainsKey("LastLongitude") && (json["Gps"]["LastLongitude"].IsDouble || json["Gps"]["LastLongitude"].IsInt) + && json["Gps"].ContainsKey("LastGPSPos") && json["Gps"]["LastGPSPos"].IsString + && json["Gps"].ContainsKey("Hdop") && (json["Gps"]["Hdop"].IsDouble || json["Gps"]["Hdop"].IsInt) + && json["Gps"].ContainsKey("Fix") && json["Gps"]["Fix"].IsBoolean + && json["Gps"].ContainsKey("Height") && (json["Gps"]["Height"].IsDouble || json["Gps"]["Height"].IsInt) + && json.ContainsKey("Name") && json["Name"].IsString && + json.ContainsKey("Calculatedcrc") && json["Calculatedcrc"].IsInt; } } \ No newline at end of file diff --git a/Lora-Map/Model/EnviromentData.cs b/Lora-Map/Model/EnviromentData.cs new file mode 100644 index 0000000..920563f --- /dev/null +++ b/Lora-Map/Model/EnviromentData.cs @@ -0,0 +1,41 @@ +using System; +using System.Globalization; + +using LitJson; + +namespace Fraunhofer.Fit.IoT.LoraMap.Model { + class EnviromentData { + public String Name { get; private set; } + public Double Rssi { get; private set; } + public Double Snr { get; private set; } + public Double Temperature { get; private set; } + public Double Humidity { get; private set; } + public Double Windspeed { get; private set; } + public DateTime Lorarecievedtime { get; private set; } + + public EnviromentData(JsonData json) => this.Update(json); + + public void Update(JsonData json) { + this.Name = GetId(json); + this.Rssi = json["Rssi"].IsInt ? (Int32)json["Rssi"] : (Double)json["Rssi"]; + this.Snr = json["Snr"].IsInt ? (Int32)json["Snr"] : (Double)json["Snr"]; + this.Temperature = json["Temperature"].IsInt ? (Int32)json["Temperature"] : (Double)json["Temperature"]; + this.Humidity = json["Humidity"].IsInt ? (Int32)json["Humidity"] : (Double)json["Humidity"]; + this.Windspeed = json["Windspeed"].IsInt ? (Int32)json["Windspeed"] : (Double)json["Windspeed"]; + if(DateTime.TryParse((String)json["Receivedtime"], DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AssumeUniversal, out DateTime updatetime)) { + this.Lorarecievedtime = updatetime.ToUniversalTime(); + } + } + + public static Boolean CheckJson(JsonData json) => + json.ContainsKey("Name") && json["Name"].IsString && + json.ContainsKey("Rssi") && (json["Rssi"].IsDouble || json["Rssi"].IsInt) && + json.ContainsKey("Snr") && (json["Snr"].IsDouble || json["Snr"].IsInt) && + json.ContainsKey("Temperature") && (json["Temperature"].IsDouble || json["Temperature"].IsInt) && + json.ContainsKey("Humidity") && (json["Humidity"].IsDouble || json["Humidity"].IsInt) && + json.ContainsKey("Windspeed") && (json["Windspeed"].IsDouble || json["Windspeed"].IsInt) && + json.ContainsKey("Receivedtime") && json["Receivedtime"].IsString; + + public static String GetId(JsonData json) => (String)json["Name"]; + } +} diff --git a/Lora-Map/Model/PositionItem.cs b/Lora-Map/Model/PositionItem.cs index 9149ba6..f94c1c5 100644 --- a/Lora-Map/Model/PositionItem.cs +++ b/Lora-Map/Model/PositionItem.cs @@ -37,45 +37,46 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model { this.Group = null; } } - public static Boolean CheckJson(JsonData json) => json.ContainsKey("Rssi") && json["Rssi"].IsDouble - && json.ContainsKey("Snr") && json["Snr"].IsDouble + public static Boolean CheckJson(JsonData json) => + json.ContainsKey("Rssi") && (json["Rssi"].IsDouble || json["Rssi"].IsInt) + && json.ContainsKey("Snr") && (json["Snr"].IsDouble || json["Snr"].IsInt) && json.ContainsKey("Receivedtime") && json["Receivedtime"].IsString - && json.ContainsKey("BatteryLevel") && json["BatteryLevel"].IsDouble + && json.ContainsKey("BatteryLevel") && (json["BatteryLevel"].IsDouble || json["BatteryLevel"].IsInt) && json.ContainsKey("Gps") && json["Gps"].IsObject - && json["Gps"].ContainsKey("Latitude") && json["Gps"]["Latitude"].IsDouble - && json["Gps"].ContainsKey("Longitude") && json["Gps"]["Longitude"].IsDouble - && json["Gps"].ContainsKey("LastLatitude") && json["Gps"]["LastLatitude"].IsDouble - && json["Gps"].ContainsKey("LastLongitude") && json["Gps"]["LastLongitude"].IsDouble + && json["Gps"].ContainsKey("Latitude") && (json["Gps"]["Latitude"].IsDouble || json["Gps"]["Latitude"].IsInt) + && json["Gps"].ContainsKey("Longitude") && (json["Gps"]["Longitude"].IsDouble || json["Gps"]["Longitude"].IsInt) + && json["Gps"].ContainsKey("LastLatitude") && (json["Gps"]["LastLatitude"].IsDouble || json["Gps"]["LastLatitude"].IsInt) + && json["Gps"].ContainsKey("LastLongitude") && (json["Gps"]["LastLongitude"].IsDouble || json["Gps"]["LastLongitude"].IsInt) && json["Gps"].ContainsKey("LastGPSPos") && json["Gps"]["LastGPSPos"].IsString - && json["Gps"].ContainsKey("Hdop") && json["Gps"]["Hdop"].IsDouble + && json["Gps"].ContainsKey("Hdop") && (json["Gps"]["Hdop"].IsDouble || json["Gps"]["Hdop"].IsInt) && json["Gps"].ContainsKey("Fix") && json["Gps"]["Fix"].IsBoolean - && json["Gps"].ContainsKey("Height") && json["Gps"]["Height"].IsDouble + && json["Gps"].ContainsKey("Height") && (json["Gps"]["Height"].IsDouble || json["Gps"]["Height"].IsInt) && json.ContainsKey("Name") && json["Name"].IsString; public static String GetId(JsonData json) => (String)json["Name"]; public void Update(JsonData json) { - this.Rssi = (Double)json["Rssi"]; - this.Snr = (Double)json["Snr"]; + this.Rssi = json["Rssi"].IsInt ? (Int32)json["Rssi"] : (Double)json["Rssi"]; + this.Snr = json["Snr"].IsInt ? (Int32)json["Snr"] : (Double)json["Snr"]; if(DateTime.TryParse((String)json["Receivedtime"], DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AssumeUniversal, out DateTime updatetime)) { this.Lorarecievedtime = updatetime.ToUniversalTime(); } this.Recievedtime = DateTime.UtcNow; - this.Battery = Math.Round((Double)json["BatteryLevel"], 2); + this.Battery = Math.Round(json["BatteryLevel"].IsInt ? (Int32)json["BatteryLevel"] : (Double)json["BatteryLevel"], 2); this.Batterysimple = this.Battery < 3.44 ? 0 : this.Battery < 3.53 ? 1 : this.Battery < 3.6525 ? 2 : this.Battery < 3.8825 ? 3 : 4; - this.Latitude = (Double)json["Gps"]["Latitude"]; - this.Longitude = (Double)json["Gps"]["Longitude"]; + this.Latitude = json["Gps"]["Latitude"].IsInt ? (Int32)json["Gps"]["Latitude"] : (Double)json["Gps"]["Latitude"]; + this.Longitude = json["Gps"]["Longitude"].IsInt ? (Int32)json["Gps"]["Longitude"] : (Double)json["Gps"]["Longitude"]; this.Fix = (Boolean)json["Gps"]["Fix"]; if(!this.Fix) { - this.Latitude = (Double)json["Gps"]["LastLatitude"]; - this.Longitude = (Double)json["Gps"]["LastLongitude"]; + this.Latitude = json["Gps"]["LastLatitude"].IsInt ? (Int32)json["Gps"]["LastLatitude"] : (Double)json["Gps"]["LastLatitude"]; + this.Longitude = json["Gps"]["LastLongitude"].IsInt ? (Int32)json["Gps"]["LastLongitude"] : (Double)json["Gps"]["LastLongitude"]; } this.UTM = new UTMData(this.Latitude, this.Longitude); if(DateTime.TryParse((String)json["Gps"]["LastGPSPos"], DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AssumeUniversal, out DateTime lastgpstime)) { this.Lastgpspostime = lastgpstime.ToUniversalTime(); } - this.Hdop = (Double)json["Gps"]["Hdop"]; - this.Height = (Double)json["Gps"]["Height"]; + this.Hdop = json["Gps"]["Hdop"].IsInt ? (Int32)json["Gps"]["Hdop"] : (Double)json["Gps"]["Hdop"]; + this.Height = json["Gps"]["Height"].IsInt ? (Int32)json["Gps"]["Height"] : (Double)json["Gps"]["Height"]; } diff --git a/Lora-Map/Model/Settings.cs b/Lora-Map/Model/Settings.cs index ed88be4..b2b7001 100644 --- a/Lora-Map/Model/Settings.cs +++ b/Lora-Map/Model/Settings.cs @@ -12,8 +12,9 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model { public Double Startloclat { get; private set; } public Double Startloclon { get; private set; } public Dictionary>>> Grid { get; private set; } - public Dictionary>> FightDedection { get; private set; } + public Dictionary FightDedection { get; private set; } public Dictionary DensityArea { get; private set; } + public Dictionary Sensors { get; private set; } public Settings() => this.ParseJson(); @@ -21,9 +22,7 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model { private void ParseJson() { JsonData json = JsonMapper.ToObject(File.ReadAllText("json/settings.json")); - if(json.ContainsKey("StartPos") && json["StartPos"].IsObject && - json["StartPos"].ContainsKey("lat") && json["StartPos"]["lat"].IsDouble && - json["StartPos"].ContainsKey("lon") && json["StartPos"]["lon"].IsDouble) { + if(json.ContainsKey("StartPos") && json["StartPos"].IsObject && json["StartPos"].ContainsKey("lat") && json["StartPos"]["lat"].IsDouble && json["StartPos"].ContainsKey("lon") && json["StartPos"]["lon"].IsDouble) { this.Startloclat = (Double)json["StartPos"]["lat"]; this.Startloclon = (Double)json["StartPos"]["lon"]; } else { @@ -31,7 +30,7 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model { this.Startloclon = 0; } this.weatherCellIDs.Clear(); - if (json.ContainsKey("CellIds") && json["CellIds"].IsArray && json["CellIds"].Count > 0) { + if(json.ContainsKey("CellIds") && json["CellIds"].IsArray && json["CellIds"].Count > 0) { foreach (JsonData item in json["CellIds"]) { if(Int32.TryParse(item.ToString(), out Int32 cellid)) { this.weatherCellIDs.Add(cellid); @@ -39,9 +38,11 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model { } } if(json.ContainsKey("FightDedection") && json["FightDedection"].IsObject) { - Dictionary>> fight = new Dictionary>>(); + Dictionary fights = new Dictionary(); foreach (KeyValuePair entry in json["FightDedection"]) { - List> poly = new List>(); + Fight fight = new Fight { + Polygon = new List>() + }; if(entry.Value.ContainsKey("Poly") && entry.Value["Poly"].IsArray) { foreach (JsonData coord in entry.Value["Poly"]) { List coords = new List(); @@ -49,18 +50,25 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model { coords.Add((Double)coord["Lat"]); coords.Add((Double)coord["Lon"]); } - poly.Add(coords); + fight.Polygon.Add(coords); } } - fight.Add(entry.Key, poly); + if (entry.Value.ContainsKey("Level") && entry.Value["Level"].IsDouble) { + fight.Level = (Double)entry.Value["Level"]; + } + if (entry.Value.ContainsKey("Alias") && entry.Value["Alias"].IsString) { + fight.Alias = (String)entry.Value["Alias"]; + } + fights.Add(entry.Key, fight); } - this.FightDedection = fight; + this.FightDedection = fights; } - if (json.ContainsKey("CrwodDensity") && json["CrwodDensity"].IsObject) { + if(json.ContainsKey("CrwodDensity") && json["CrwodDensity"].IsObject) { Dictionary densitys = new Dictionary(); foreach (KeyValuePair entry in json["CrwodDensity"]) { - Density density = new Density(); - density.Polygon = new List>(); + Density density = new Density { + Polygon = new List>() + }; if (entry.Value.ContainsKey("Poly") && entry.Value["Poly"].IsArray) { foreach (JsonData coord in entry.Value["Poly"]) { List coords = new List(); @@ -74,16 +82,48 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model { if(entry.Value.ContainsKey("Count") && (entry.Value["Count"].IsInt || entry.Value["Count"].IsDouble)) { density.Maximum = (Int32)entry.Value["Count"]; } + if(entry.Value.ContainsKey("Alias") && entry.Value["Alias"].IsString) { + density.Alias = (String)entry.Value["Alias"]; + } densitys.Add(entry.Key, density); } this.DensityArea = densitys; } + if(json.ContainsKey("Sensors") && json["Sensors"].IsObject) { + Dictionary sensors = new Dictionary(); + foreach(KeyValuePair entry in json["Sensors"]) { + Sensor sensor = new Sensor { + Coordinates = new List() + }; + if(entry.Value.ContainsKey("Poly") && entry.Value["Poly"].IsObject) { + JsonData coord = entry.Value["Poly"]; + List coords = new List(); + if(coord.ContainsKey("Lat") && coord["Lat"].IsDouble && coord.ContainsKey("Lon") && coord["Lon"].IsDouble) { + coords.Add((Double)coord["Lat"]); + coords.Add((Double)coord["Lon"]); + } + sensor.Coordinates = coords; + if(entry.Value.ContainsKey("Level") && (entry.Value["Level"].IsInt || entry.Value["Level"].IsDouble)) { + sensor.Level = entry.Value["Level"].IsInt ? (Int32)entry.Value["Level"] : (Double)entry.Value["Level"]; + } + if(entry.Value.ContainsKey("Alias") && entry.Value["Alias"].IsString) { + sensor.Alias = (String)entry.Value["Alias"]; + } + sensors.Add(entry.Key, sensor); + } + } + this.Sensors = sensors; + } this.gridradius = json.ContainsKey("GridRadius") && json["GridRadius"].IsInt && this.Startloclat != 0 && this.Startloclon != 0 ? (Int32)json["GridRadius"] : 0; this.GenerateGrid(); } private void GenerateGrid() { - if(this.Startloclat == 0 || this.Startloclon == 0 || this.gridradius == 0) { + this.Grid = new Dictionary>>> { + { "Major", new List>>() }, + { "Minor", new List>>() } + }; + if (this.Startloclat == 0 || this.Startloclon == 0 || this.gridradius == 0) { return; } MilitaryGridReferenceSystem start = new Coordinate(this.Startloclat, this.Startloclon).MGRS; @@ -92,10 +132,6 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model { Double bottom = start.Northing - this.gridradius - (start.Northing - this.gridradius) % 100; Double right = start.Easting + this.gridradius + (100 - (start.Easting + this.gridradius) % 100); Double top = start.Northing + this.gridradius + (100 - (start.Northing + this.gridradius) % 100); - this.Grid = new Dictionary>>> { - { "Major", new List>>() }, - { "Minor", new List>>() } - }; for (Double i = left; i <= right; i += 50) { Coordinate TopLeft = MilitaryGridReferenceSystem.MGRStoLatLong(new MilitaryGridReferenceSystem(start.LatZone, start.LongZone, start.Digraph, i, top)); Coordinate BottomLeft = MilitaryGridReferenceSystem.MGRStoLatLong(new MilitaryGridReferenceSystem(start.LatZone, start.LongZone, start.Digraph, i, bottom)); @@ -165,6 +201,19 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model { public struct Density { public List> Polygon { get; set; } public Int32 Maximum { get; set; } + public String Alias { get; set; } + } + + public struct Fight { + public List> Polygon { get; set; } + public Double Level { get; set; } + public String Alias { get; set; } + } + + public struct Sensor { + public List Coordinates { get; set; } + public Double Level { get; set; } + public String Alias { get; set; } } } } diff --git a/Lora-Map/Model/WeatherWarnings.cs b/Lora-Map/Model/WeatherWarnings.cs index 7620277..39d6214 100644 --- a/Lora-Map/Model/WeatherWarnings.cs +++ b/Lora-Map/Model/WeatherWarnings.cs @@ -10,6 +10,7 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model { public class WeatherWarnings { private readonly Settings settings; private Thread bgthread; + private Boolean backgroundrunnerAlive; private readonly WebRequests webrequests = new WebRequests(); public List Warnungen { get; private set; } @@ -21,11 +22,12 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model { private void StartBackgroundThread() { this.bgthread = new Thread(this.BackGroundRunner); + this.backgroundrunnerAlive = true; this.bgthread.Start(); } private void BackGroundRunner() { - while(true) { + while(this.backgroundrunnerAlive) { List ret = new List(); foreach(Int32 item in this.settings.GetWeatherCellIds()) { try { @@ -40,11 +42,23 @@ namespace Fraunhofer.Fit.IoT.LoraMap.Model { } catch { } } this.Warnungen = ret; - Thread.Sleep(60 * 1000); + for (Int32 i = 0; i < 1000; i++) { + if (this.backgroundrunnerAlive) { + Thread.Sleep(60); + } + } } } - internal void Dispose() => this.bgthread.Abort(); + internal void Dispose() { + try { + this.backgroundrunnerAlive = false; + while (this.bgthread.IsAlive) { + Thread.Sleep(10); + } + this.bgthread = null; + } catch { } + } public class Warning { public Warning(JsonData warning) { diff --git a/Lora-Map/Program.cs b/Lora-Map/Program.cs index 80f7cb6..687c249 100644 --- a/Lora-Map/Program.cs +++ b/Lora-Map/Program.cs @@ -5,7 +5,7 @@ using BlubbFish.Utils.IoT.Connector; namespace Fraunhofer.Fit.IoT.LoraMap { class Program { - static void Main(String[] args) { + static void Main(String[] _1) { InIReader.SetSearchPath(new List() { "/etc/loramap", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\loramap" }); if (!InIReader.ConfigExist("settings")) { Helper.WriteError("settings.ini not found!"); diff --git a/Lora-Map/Properties/AssemblyInfo.cs b/Lora-Map/Properties/AssemblyInfo.cs deleted file mode 100644 index 01d1089..0000000 --- a/Lora-Map/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,57 +0,0 @@ -using System.Resources; -using System.Reflection; -using System.Runtime.InteropServices; - -// Allgemeine Informationen über eine Assembly werden über die folgenden -// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, -// die einer Assembly zugeordnet sind. -[assembly: AssemblyTitle("Lora-Map")] -[assembly: AssemblyDescription("Displays Items with Coordinates from Mqtt on a Map")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Fraunhofer FIT")] -[assembly: AssemblyProduct("Lora-Map")] -[assembly: AssemblyCopyright("Copyright © 2018 - 30.08.2019")] -[assembly: AssemblyTrademark("Fraunhofer FIT, BlubbFish")] -[assembly: AssemblyCulture("")] -[assembly: NeutralResourcesLanguage("de-DE")] - -// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly -// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von -// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. -[assembly: ComVisible(false)] - -// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird -[assembly: Guid("95d6f48a-9488-42a6-a973-941b45b26db8")] - -// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: -// -// Hauptversion -// Nebenversion -// Buildnummer -// Revision -// -// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, -// übernehmen, indem Sie "*" eingeben: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.2.9")] -[assembly: AssemblyFileVersion("1.2.9")] - -/* -* 1.1.1 Add Debian package config -* 1.1.2 #2 Show versions number in Site -* 1.1.3 #1 Click on icon and show details -* 1.1.4 #3 Create icons for devices -* 1.1.5 Add support for alert button -* 1.1.6 #5 Create admin area -* 1.1.7 #8 Editor for Names -* 1.2.0 #4 Possible to Ex and Import Setting -* 1.2.1 #6 Load the map from the Device -* 1.2.2 Bugfix, if only recieve panic packet with gps data, update the marker on the map also -* 1.2.3 #9 display polygons and marker on the map -* 1.2.4 Can draw Textmarkers on the Map, use MGRS (UTM) on the Map -* 1.2.5 #10 text Letzer Datenempfang is too long when scrollbar is there and #11 set textsize for every zoomlevel -* 1.2.6 New Types of marker for person -* 1.2.7 Reorganise a lot of things, add Support for Cameradata -* 1.2.8 Improving the UI -* 1.2.9 The PüMa Release -*/ diff --git a/Lora-Map/Server.cs b/Lora-Map/Server.cs index f23f307..0383c3c 100644 --- a/Lora-Map/Server.cs +++ b/Lora-Map/Server.cs @@ -18,6 +18,7 @@ namespace Fraunhofer.Fit.IoT.LoraMap { private readonly SortedDictionary counter = new SortedDictionary(); private readonly SortedDictionary density = new SortedDictionary(); private readonly SortedDictionary fights = new SortedDictionary(); + private readonly SortedDictionary sensors = new SortedDictionary(); private JsonData marker; private readonly Settings settings; private readonly WeatherWarnings weather; @@ -28,6 +29,7 @@ namespace Fraunhofer.Fit.IoT.LoraMap { private readonly Object lockFight = new Object(); private readonly Object lockCount = new Object(); private readonly Object lockDensy = new Object(); + private readonly Object lockSensor = new Object(); public Server(ADataBackend backend, Dictionary settings, InIReader requests) : base(backend, settings, requests) { this.logger.SetPath(settings["loggingpath"]); @@ -98,18 +100,17 @@ namespace Fraunhofer.Fit.IoT.LoraMap { Console.WriteLine("PANIC erhalten!"); } else if(Camera.CheckJson(d) && ((String)mqtt.From).Contains("camera/count")) { String cameraid = Camera.GetId(d); - lock (this.lockCount) { - if (this.counter.ContainsKey(cameraid)) { + lock(this.lockCount) { + if(this.counter.ContainsKey(cameraid)) { this.counter[cameraid].Update(d); } else { this.counter.Add(cameraid, new Camera(d)); } } - } else if(((((String)mqtt.From).Contains("sfn/crowd_density_local") || ((String)mqtt.From).Contains("camera/crowd")) && Crowd.CheckJsonCrowdDensityLocal(d)) || - (((String)mqtt.From).Contains("sfn/flow") && Crowd.CheckJsonFlow(d))) { + } else if((((String)mqtt.From).Contains("sfn/crowd_density_local") || ((String)mqtt.From).Contains("camera/crowd")) && Crowd.CheckJsonCrowdDensityLocal(d) || ((String)mqtt.From).Contains("sfn/flow") && Crowd.CheckJsonFlow(d)) { String cameraid = Crowd.GetId(d); - lock (this.lockDensy) { - if (this.density.ContainsKey(cameraid)) { + lock(this.lockDensy) { + if(this.density.ContainsKey(cameraid)) { this.density[cameraid].Update(d); } else { this.density.Add(cameraid, new Crowd(d)); @@ -117,13 +118,23 @@ namespace Fraunhofer.Fit.IoT.LoraMap { } } else if((((String)mqtt.From).Contains("camera/fighting_detection") || ((String)mqtt.From).Contains("sfn/fighting_detection")) && Fight.CheckJsonFightingDetection(d)) { String cameraid = Fight.GetId(d); - lock (this.lockFight) { - if (this.fights.ContainsKey(cameraid)) { + lock(this.lockFight) { + if(this.fights.ContainsKey(cameraid)) { this.fights[cameraid].Update(d); } else { this.fights.Add(cameraid, new Fight(d)); } } + } else if(((String)mqtt.From).Contains("lora/sensor") && EnviromentData.CheckJson(d)) { + String sensorid = EnviromentData.GetId(d); + lock(this.lockSensor) { + if(this.sensors.ContainsKey(sensorid)) { + this.sensors[sensorid].Update(d); + } else { + this.sensors.Add(sensorid, new EnviromentData(d)); + } + } + Console.WriteLine("Umweltdaten erhalten!"); } } catch(Exception e) { Helper.WriteError("Backend_MessageIncomming(): "+e.Message + "\n\n" + e.StackTrace); @@ -139,7 +150,8 @@ namespace Fraunhofer.Fit.IoT.LoraMap { { "cameracount", this.counter }, { "crowdcount", this.density }, { "fightdedect", this.fights }, - { "weatherwarnings", this.weather.Warnungen } + { "weatherwarnings", this.weather.Warnungen }, + { "sensors", this.sensors } }, cont); } else if (cont.Request.Url.PathAndQuery.StartsWith("/get60000")) { return SendJsonResponse(new Dictionary() { @@ -147,7 +159,7 @@ namespace Fraunhofer.Fit.IoT.LoraMap { }, cont); } else if (cont.Request.Url.PathAndQuery.StartsWith("/getonce")) { return SendJsonResponse(new Dictionary() { - { "getlayer", this.FindMapLayer(cont.Request) }, + { "getlayer", this.FindMapLayer() }, { "getgeo", JsonMapper.ToObject(File.ReadAllText("json/geo.json")) }, { "startup", this.settings } }, cont); @@ -175,14 +187,14 @@ namespace Fraunhofer.Fit.IoT.LoraMap { return SendFileResponse(cont); } - private Dictionary> FindMapLayer(HttpListenerRequest request) { + private Dictionary> FindMapLayer() { Dictionary> ret = new Dictionary> { { "online", new Dictionary() { { "title", "Online Map" }, { "url", "https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" }, { "attribution", "© OpenStreetMap contributors" }, { "minZoom", 1 }, - { "maxZoom", 18 } + { "maxZoom", 19 } } } }; if(Directory.Exists("resources" + Path.DirectorySeparatorChar + "maps")) { diff --git a/Lora-Map/dpkg/control b/Lora-Map/dpkg/control index ba69c20..1e0a7ed 100644 --- a/Lora-Map/dpkg/control +++ b/Lora-Map/dpkg/control @@ -3,7 +3,7 @@ Version: x.x-x Section: base Priority: optional Architecture: any -Depends: mono-runtime (>= 5.18), libmono-posix4.0-cil (>= 5.18), libmono-system-web4.0-cil (>= 5.18) +Depends: dotnet-runtime-3.0 (>= 3.0.1) Maintainer: BlubbFish Description: Lora-Map Lora-Map shows a Map to control the Lora Tracker diff --git a/Lora-Map/dpkg/loramap-logrotate b/Lora-Map/dpkg/logrotate-loramap similarity index 100% rename from Lora-Map/dpkg/loramap-logrotate rename to Lora-Map/dpkg/logrotate-loramap diff --git a/Lora-Map/dpkg/make-deb.sh b/Lora-Map/dpkg/make-deb.sh index 2b916f4..33bf55a 100644 --- a/Lora-Map/dpkg/make-deb.sh +++ b/Lora-Map/dpkg/make-deb.sh @@ -2,26 +2,35 @@ HOMEDIR=$HOME ROOT="$HOMEDIR/deb" -OUTPUT="../bin/Release" +OUTPUT="../bin/Release/netcoreapp3.0" -EXEC="$ROOT/usr/local/bin/loramap" -CONFIG="$ROOT/etc/loramap" +DEBNAME="loramap" +CSPROJFILE="Lora-Map.csproj" + +EXEC="$ROOT/usr/local/bin/$DEBNAME" +CONFIG="$ROOT/etc/$DEBNAME" SYSTEMD="$ROOT/lib/systemd/system" LOGROTATE="$ROOT/etc/logrotate.d" +echo "Catch all paths together for $DEBNAME." + DEBIAN="$ROOT/DEBIAN" -VMAJOR=$(grep -e "^\[assembly: AssemblyVersion(\"" ../Properties/AssemblyInfo.cs | cut -d'"' -f 2 | cut -d'.' -f 1) -VMINOR=$(grep -e "^\[assembly: AssemblyVersion(\"" ../Properties/AssemblyInfo.cs | cut -d'"' -f 2 | cut -d'.' -f 2) -VBUILD=$(grep -e "^\[assembly: AssemblyVersion(\"" ../Properties/AssemblyInfo.cs | cut -d'"' -f 2 | cut -d'.' -f 3) +VMAJOR=$(grep -e "" ../$CSPROJFILE | cut -d'>' -f 2 | cut -d'<' -f 1 | cut -d'.' -f 1) +VMINOR=$(grep -e "" ../$CSPROJFILE | cut -d'>' -f 2 | cut -d'<' -f 1 | cut -d'.' -f 2) +VBUILD=$(grep -e "" ../$CSPROJFILE | cut -d'>' -f 2 | cut -d'<' -f 1 | cut -d'.' -f 3) ARCHT=$1 +echo "Versionsumber parsed: $VMAJOR.$VMINOR-$VBUILD." + mkdir -p $EXEC mkdir -p $CONFIG mkdir -p $DEBIAN mkdir -p $SYSTEMD mkdir -p $LOGROTATE -cp control $DEBIAN +echo "Created directorys." + +cp control $DEBIAN/control cp preinst $DEBIAN cp postinst $DEBIAN cp prerm $DEBIAN @@ -29,26 +38,49 @@ sed -i s/Version:\ x\.x-x/"Version: $VMAJOR.$VMINOR-$VBUILD"/ $DEBIAN/control sed -i s/Architecture:\ any/"Architecture: $ARCHT"/ $DEBIAN/control chmod 755 $DEBIAN -R -cp loramap.service $SYSTEMD -chmod 644 $SYSTEMD/loramap.service +echo "Copy deb control files." -cp $OUTPUT/*.exe $EXEC/ -#cp $OUTPUT/gpio.2.44 $EXEC/ -#cp $OUTPUT/libwiringPi.so.2.44 $EXEC/ +cp "service-$DEBNAME" "$SYSTEMD/$DEBNAME.service" +chmod 644 $SYSTEMD/"$DEBNAME.service" + +echo "Copy $DEBNAME.service to $SYSTEMD." + +cp $OUTPUT/*.runtimeconfig.json $EXEC/ find $OUTPUT -name \*.dll -exec cp {} $EXEC/ \; chmod 644 $EXEC/* chmod 755 $EXEC +echo "Copy programm files to $EXEC." + cp $OUTPUT/resources $EXEC -r sed -i s/"
vx.x.x"/"
$VMAJOR.$VMINOR.$VBUILD"/ $EXEC/resources/index.html +echo "Change Versionnumber in index.html" + cp $OUTPUT/config-example/* $CONFIG chmod 644 $CONFIG/* chmod 755 $CONFIG -cp loramap-logrotate $LOGROTATE/loramap +echo "Copy example-conf to $CONFIG." + +cp "logrotate-$DEBNAME" "$LOGROTATE/$DEBNAME.conf" chmod 644 $LOGROTATE/* +echo "Copy $DEBNAME.conf to $LOGROTATE." + dpkg-deb --build $ROOT -mv $HOMEDIR/deb.deb ../../../Builds/"$ARCHT-loramap_$VMAJOR.$VMINOR-$VBUILD.deb" -rm $HOMEDIR/deb -r \ No newline at end of file + +echo "Build deb packet." + + +TARGETFILE="$DEBNAME""_$VMAJOR.$VMINOR-$VBUILD.deb" +mv $HOMEDIR/deb.deb "../../../Builds/$ARCHT-$TARGETFILE" + +echo "Move $ARCHT-$TARGETFILE to Builds." + +rm $HOMEDIR/deb -r + +echo "Remove $HOMEDIR/deb." + +echo "##[set-output name=debuilderfile;]$TARGETFILE" +echo "##[set-output name=builddaterelease;]$(date +"%F_%H%M%S")" \ No newline at end of file diff --git a/Lora-Map/dpkg/postinst b/Lora-Map/dpkg/postinst index 27417e8..29de190 100644 --- a/Lora-Map/dpkg/postinst +++ b/Lora-Map/dpkg/postinst @@ -1,9 +1,17 @@ #!/bin/bash -systemctl enable loramap +DEBNAME="loramap" + +systemctl enable $DEBNAME systemctl daemon-reload -if [ -f /tmp/loramap_service_runner ]; then - service loramap start - rm /tmp/loramap_service_runner +touch /var/log/loramap.log +chown loramapbot:loramapbot /var/log/loramap.log +chmod 644 /var/log/loramap.log + +chown -R loramapbot:loramapbot /usr/local/bin/$DEBNAME + +if [ -f /tmp/$DEBNAME_service_runner ]; then + service $DEBNAME start + rm /tmp/$DEBNAME_service_runner fi \ No newline at end of file diff --git a/Lora-Map/dpkg/preinst b/Lora-Map/dpkg/preinst index 05a7907..ac749ec 100644 --- a/Lora-Map/dpkg/preinst +++ b/Lora-Map/dpkg/preinst @@ -1,2 +1,6 @@ #!/bin/bash +useradd -M loramapbot +usermod -L loramapbot +groupadd loramapbot +usermod -G loramapbot,adm loramapbot \ No newline at end of file diff --git a/Lora-Map/dpkg/prerm b/Lora-Map/dpkg/prerm index 77d10d3..c26ba9f 100644 --- a/Lora-Map/dpkg/prerm +++ b/Lora-Map/dpkg/prerm @@ -1,7 +1,9 @@ #!/bin/bash -if [[ $(systemctl is-active loramap || true) == "active" ]] +DEBNAME="loramap" + +if [[ $(systemctl is-active $DEBNAME || true) == "active" ]] then - touch /tmp/loramap_service_runner - service loramap stop + touch /tmp/$DEBNAME_service_runner + service $DEBNAME stop fi \ No newline at end of file diff --git a/Lora-Map/dpkg/loramap.service b/Lora-Map/dpkg/service-loramap similarity index 62% rename from Lora-Map/dpkg/loramap.service rename to Lora-Map/dpkg/service-loramap index 203bcac..bc7f0fb 100644 --- a/Lora-Map/dpkg/loramap.service +++ b/Lora-Map/dpkg/service-loramap @@ -5,10 +5,12 @@ Description=Lora-Map After=network-online.target [Service] -User=root -Group=root +User=loramapbot +Group=loramapbot WorkingDirectory=/usr/local/bin/loramap -ExecStart=/usr/bin/mono /usr/local/bin/loramap/Lora-Map.exe +PermissionsStartOnly=true +ExecStartPre=setcap 'cap_net_bind_service=+ep' /usr/share/dotnet/dotnet +ExecStart=/usr/bin/dotnet /usr/local/bin/loramap/Lora-Map.dll KillMode=control-group TimeoutStopSec=5 Restart=on-failure diff --git a/Lora-Map/resources/admin/js/menu.js b/Lora-Map/resources/admin/js/menu.js index 1a61b29..704d969 100644 --- a/Lora-Map/resources/admin/js/menu.js +++ b/Lora-Map/resources/admin/js/menu.js @@ -372,12 +372,19 @@ var Settings = { if (typeof jsonsettings.CrwodDensity === "undefined") { jsonsettings.CrwodDensity = []; } + if (typeof jsonsettings.Counting === "undefined") { + jsonsettings.Counting = []; + } + if (typeof jsonsettings.Sensors === "undefined") { + jsonsettings.Sensors = []; + } var html = "
Einstellungen
"; html += "
Startpunkt: Lat, Lon
"; html += "
CellId's für DWD-Wetterwarnungen: (Trennen durch \";\", cap_warncellids_csv)
"; html += "
Radius für das Grid um den Startpunkt: m
"; html += "
Fight Dedection Kameras:
" + this._renderFightDedection(jsonsettings.FightDedection) + "
"; html += "
Crowd Density Kameras:
" + this._renderCrowdDensity(jsonsettings.CrwodDensity) + "
"; + html += "
Sensors:
" + this._renderSensorSettings(jsonsettings.Sensors) + "
"; html += "
"; document.getElementById("content").innerHTML = html + "
"; }, @@ -403,7 +410,7 @@ var Settings = { var coord = coords[j].split(";"); polyjson[j] = { "Lat": this._filterFloat(coord[0]), "Lon": this._filterFloat(coord[1]) }; } - fightjson[id] = { "Poly": polyjson }; + fightjson[id] = { "Poly": polyjson, "Alias": rowsf[i].children[2].innerText, "Level": this._filterFloat(rowsf[i].children[3].innerText) }; } ret.FightDedection = fightjson; @@ -425,11 +432,32 @@ var Settings = { } crowdjson[id] = { "Poly": polyjson, - "Count": num + "Count": num, + "Alias": rowsc[i].children[3].innerText }; } ret.CrwodDensity = crowdjson; + var rowss = document.getElementById("sensortable").children[1].children; + var sensorjson = {}; + for (i = 0; i < rowss.length; i++) { + if (rowss[i].children[0].children.length === 1) { + alert("Bitte zuerst alle Zeilen speichern oder Löschen!"); + return; + } + id = rowss[i].children[0].innerText; + coord = rowss[i].children[2].innerHTML.split(";"); + sensorjson[id] = { + "Poly": { + "Lat": this._filterFloat(coord[0]), + "Lon": this._filterFloat(coord[1]) + }, + "Level": this._filterFloat(rowss[i].children[3].innerText), + "Alias": rowss[i].children[1].innerText + }; + } + ret.Sensors = sensorjson; + var savesettings = new XMLHttpRequest(); savesettings.onreadystatechange = function () { if (savesettings.readyState === 4) { @@ -442,11 +470,32 @@ var Settings = { }; savesettings.open("POST", "/admin/set_json_settings", true); savesettings.send(JSON.stringify(ret)); - }, + }, + _renderSensorSettings: function (json) { + var ret = ""; + ret += ""; + ret += ""; + + ret += ""; + for (var id in json) { + ret += "" + + "" + + "" + + "" + + "" + + "" + + ""; + } + ret += ""; + + ret += ""; + ret += "
IDAliasKoordinatenWarn above
" + id + "" + json[id].Alias + "" + json[id].Poly.Lat + ";" + json[id].Poly.Lon + "" + json[id].Level + "
"; + return ret; + }, _renderFightDedection: function (json) { var ret = ""; ret += ""; - ret += ""; + ret += ""; ret += ""; for (var id in json) { var coords = []; @@ -456,18 +505,20 @@ var Settings = { ret += "" + "" + "" + + "" + + "" + "" + ""; } ret += ""; - ret += ""; + ret += ""; ret += "
IDKoordinaten
IDKoordinatenAliasAlertlimit
" + id + "" + coords.join("
") + "
" + json[id].Alias + "" + json[id].Level + "
"; return ret; }, _renderCrowdDensity: function (json) { var ret = ""; ret += ""; - ret += ""; + ret += ""; ret += ""; for (var id in json) { var coords = []; @@ -478,18 +529,30 @@ var Settings = { "" + "" + "" + + "" + "" + ""; } ret += ""; - ret += ""; + ret += ""; ret += "
IDPersonenanzahlKoordinaten
IDPersonenanzahlKoordinatenAlias
" + id + "" + json[id].Count + "" + coords.join("
") + "
" + json[id].Alias + "
"; return ret; }, + AddSensor: function () { + var newrow = document.createElement("tr"); + newrow.innerHTML = ""; + newrow.innerHTML += ""; + newrow.innerHTML += ""; + newrow.innerHTML += ""; + newrow.innerHTML += " "; + document.getElementById("sensortable").children[1].appendChild(newrow); + }, AddFight: function () { var newrow = document.createElement("tr"); newrow.innerHTML = ""; newrow.innerHTML += ""; + newrow.innerHTML += ""; + newrow.innerHTML += ""; newrow.innerHTML += " "; document.getElementById("fighttable").children[1].appendChild(newrow); }, @@ -498,12 +561,36 @@ var Settings = { newrow.innerHTML = ""; newrow.innerHTML += ""; newrow.innerHTML += ""; + newrow.innerHTML += ""; newrow.innerHTML += " "; document.getElementById("crowdtable").children[1].appendChild(newrow); }, Abort: function (el) { el.parentNode.removeChild(el); }, + SaveRowSensor: function (el) { + var coords = el.children[2].children[0].value; + var coord = coords.split(";"); + var fail = false; + if (coord.length !== 2) { + fail = true; + } else if (isNaN(this._filterFloat(coord[0])) || isNaN(this._filterFloat(coord[1]))) { + fail = true; + } + if (isNaN(this._filterFloat(el.children[3].children[0].value))) { + alert("Die Eingabe des Alertlevel erwartet einen Float"); + return; + } + if (fail) { + alert("Die Eingabe der Koordinaten ist nicht Korrekt!\n\nBeispiel:\n50.7;7.8"); + return; + } + el.innerHTML = "" + el.children[0].children[0].value + "" + + "" + el.children[1].children[0].value + "" + + "" + coords + "" + + "" + this._filterFloat(el.children[3].children[0].value) + "" + + " "; + }, SaveRowfight: function (el) { var coords = el.children[1].children[0].value.replace(/\n/gi, "
"); var coordscheck = coords.split("
"); @@ -519,13 +606,19 @@ var Settings = { break; } } + if (isNaN(this._filterFloat(el.children[3].children[0].value))) { + alert("Die Eingabe des Alertlevel erwartet einen Float"); + return; + } if (fail) { alert("Die Eingabe der Koordinaten ist nicht Korrekt!\n\nBeispiel:\n50.7;7.8\n50.6;7.9"); return; } el.innerHTML = "" + el.children[0].children[0].value + "" + "" + coords + "" + - " "; + "" + el.children[2].children[0].value + "" + + "" + this._filterFloat(el.children[3].children[0].value) + "" + + " "; }, SaveRowdensity: function (el) { var coords = el.children[2].children[0].value.replace(/\n/gi, "
"); @@ -553,7 +646,8 @@ var Settings = { el.innerHTML = "" + el.children[0].children[0].value + "" + "" + el.children[1].children[0].value + "" + "" + coords + "" + - " "; + "" + el.children[3].children[0].value + "" + + " "; }, Delete: function (el) { var answ = window.prompt("Wollen sie den Eintrag für \"" + el.firstChild.innerHTML + "\" wirklich löschen?", ""); @@ -561,15 +655,25 @@ var Settings = { el.parentNode.removeChild(el); } }, + EditSensor: function (el) { + el.innerHTML = "" + + "" + + "" + + "" + + " "; + }, EditFight: function (el) { el.innerHTML = "" + "" + + "" + + "" + " "; }, EditDensity: function (el) { el.innerHTML = "" + "" + "" + + "" + " "; }, _filterFloat: function (value) { @@ -586,7 +690,6 @@ var ExImport = { html += "
names.json (Namen und Icons)
"; html += "
geo.json (Layer on the MAP) Kml Konverter
"; html += "
settings.json (Settings of the Map)
"; - html += "
"; document.getElementById("content").innerHTML = html; document.getElementById("ex_names").value = jsonnames; diff --git a/Lora-Map/resources/css/global.css b/Lora-Map/resources/css/global.css index 57a9bff..09f193e 100644 --- a/Lora-Map/resources/css/global.css +++ b/Lora-Map/resources/css/global.css @@ -13,6 +13,7 @@ #bigmap .leaflet-map-pane .leaflet-marker-pane .snumber-icon { font-weight: bold; font-size: 5px; + white-space: nowrap; } #bigmap .leaflet-map-pane .leaflet-marker-pane .coord-icon { font-size: 13px; @@ -20,6 +21,28 @@ color: #ffffff; font-weight: bold; } +#bigmap .leaflet-map-pane .leaflet-marker-pane .mapsensor { + background-color: white; + border: 2px solid black; + padding: 5px; + border-radius: 10px; +} +#bigmap .leaflet-map-pane .leaflet-marker-pane .mapsensor.alert { + border: 2px solid red; +} +#bigmap .leaflet-map-pane .leaflet-marker-pane .mapsensor span { + display: block; + text-align: center; +} +#bigmap .leaflet-map-pane .leaflet-marker-pane .mapsensor .name { + font-weight: bold; +} +#bigmap .leaflet-map-pane .leaflet-marker-pane .mapsensor .wind { + font-size: 18px; +} +#bigmap .leaflet-map-pane .leaflet-marker-pane .mapsensor.alert .wind { + color: red; +} /* Optional: Makes the sample page fill the window. */ html, body { @@ -324,12 +347,14 @@ object { font-size: 11px; font-family: "Verdana"; padding: 3px; + display: inline-flex; } #overlays #cameracount .camera { background-color: white; border: rgba(0,0,0,0.3) solid 2px; border-radius: 5px; padding: 4px; + margin-right: 5px; } #overlays #cameracount .camera span { display: block; diff --git a/Lora-Map/resources/index.html b/Lora-Map/resources/index.html index 90f4854..57ac1db 100644 --- a/Lora-Map/resources/index.html +++ b/Lora-Map/resources/index.html @@ -26,7 +26,7 @@

Angezeigte Gruppen