From 7cfb763eaf599b2e5a3365c7f390f38f7eb2d9a7 Mon Sep 17 00:00:00 2001 From: Xavier Fischer Date: Wed, 29 Jan 2020 15:16:13 +0100 Subject: [PATCH] intervisibility contains points --- .../IntervisibilityReport.cs | 16 +++++++++------- .../Services/Elevation/ElevationService.cs | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/DEM.Net.Core/Model/IntervisibilityReport/IntervisibilityReport.cs b/DEM.Net.Core/Model/IntervisibilityReport/IntervisibilityReport.cs index 91be7983..ed6ae4ae 100644 --- a/DEM.Net.Core/Model/IntervisibilityReport/IntervisibilityReport.cs +++ b/DEM.Net.Core/Model/IntervisibilityReport/IntervisibilityReport.cs @@ -24,6 +24,7 @@ // THE SOFTWARE. using System; using System.Collections.Generic; +using System.Linq; namespace DEM.Net.Core { @@ -33,18 +34,19 @@ namespace DEM.Net.Core /// public class IntervisibilityReport { - public GeoPoint Origin { get; set; } - public GeoPoint Target { get; set; } + public GeoPoint Origin { get; internal set; } + public GeoPoint Target { get; internal set; } public bool HasObstacles => Metrics?.Intervisible == false; public int ObstacleCount => Metrics?.Obstacles?.Count ?? 0; - //public List GeoPoints { get; set; } - public IntervisibilityMetrics Metrics { get; set; } + public List GeoPoints { get; internal set; } + public IntervisibilityMetrics Metrics { get; internal set; } - public IntervisibilityReport(GeoPoint origin, GeoPoint target, IntervisibilityMetrics visibilityMetrics) + public IntervisibilityReport(List pointsWithElevation, IntervisibilityMetrics visibilityMetrics) { - this.Origin = origin; - this.Target = target; + this.Origin = pointsWithElevation.First(); + this.Target = pointsWithElevation.Last(); this.Metrics = visibilityMetrics; + this.GeoPoints = pointsWithElevation; } } } diff --git a/DEM.Net.Core/Services/Elevation/ElevationService.cs b/DEM.Net.Core/Services/Elevation/ElevationService.cs index a0603000..9007c755 100644 --- a/DEM.Net.Core/Services/Elevation/ElevationService.cs +++ b/DEM.Net.Core/Services/Elevation/ElevationService.cs @@ -959,7 +959,7 @@ public IntervisibilityReport GetIntervisibilityReport(GeoPoint source, GeoPoint var metrics = geoPoints.ComputeVisibilityMetrics(); - return new IntervisibilityReport(geoPoints.First(), geoPoints.Last(), metrics); + return new IntervisibilityReport(geoPoints, metrics); } catch (Exception ex) {