// Copyright (C) Stichting Deltares 2023. All rights reserved. // // This file is part of the Dam Engine. // // The Dam Engine is free software: you can redistribute it and/or modify // it under the terms of the GNU Affero General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Affero General Public License for more details. // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . // // All names, logos, and references to "Deltares" are registered trademarks of // Stichting Deltares and remain full property of Stichting Deltares at all times. // All rights reserved. using System.Collections.Generic; using System.Linq; namespace Deltares.DamEngine.Data.General.Sensors; /// /// Class to hold the collected sensor data /// public class SensorData { /// /// Gets or sets the sensors. /// /// /// The sensors. /// public List Sensors { get; set; } = new List(); /// /// Gets or sets the sensor groups. /// /// /// The sensor groups. /// public List SensorGroups { get; set; } = new List(); /// /// Gets or sets the sensor locations. /// /// /// The sensor locations. /// public List SensorLocations { get; } = new List(); /// /// Gets the sensor by identifier. /// /// The identifier. /// public Sensor GetSensorById(int id) { return Sensors.FirstOrDefault(sensor => sensor.ID == id); } /// /// Gets the group by identifier. /// /// The identifier. /// public SensorGroup GetGroupById(int id) { return SensorGroups.FirstOrDefault(sensorGroup => sensorGroup.ID == id); } /// /// Gets the name of the sensor location by location. /// /// The name. /// public SensorLocation GetSensorLocationByLocationName(string name) { return SensorLocations.FirstOrDefault(sensorLocation => sensorLocation.LocationName == name); } /// /// Gets the groups for use in selection lists in de UI. /// /// The sensoLocation. /// public IEnumerable GetGroups(SensorLocation sensorLocation) { var list = new List(); list.AddRange(SensorGroups); return list; } }