// Copyright (C) Stichting Deltares 2019. 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.Xml.Serialization;
namespace Deltares.DamEngine.Data.Geometry
{
///
/// Class holding the waternet.
///
public class Waternet : GeometryObject
{
private readonly List headLineList = new List();
private PhreaticLine phreaticLine;
private double unitWeight = GeometryConstants.VolumicWeightOfWater;
private readonly List waternetLineList = new List();
///
/// Initializes a new instance of the class.
///
public Waternet()
{
IsGenerated = false;
}
///
/// Gets or sets the phreatic line.
///
///
/// The phreatic line.
///
public PhreaticLine PhreaticLine
{
get
{
return phreaticLine;
}
set
{
phreaticLine = value;
if (phreaticLine != null)
{
if (phreaticLine.Points.Count == 0 && phreaticLine.CalcPoints.Count > 0)
phreaticLine.SyncPoints();
phreaticLine.Waternet = this;
}
}
}
///
/// Gets the head line list.
///
///
/// The head line list.
///
[XmlArray("HeadLines")]
public List HeadLineList
{
get
{
return headLineList;
}
}
///
/// Gets the waternet line list.
///
///
/// The waternet line list.
///
[XmlArray("WaternetLines")]
public List WaternetLineList
{
get
{
return waternetLineList;
}
}
///
/// Gets or sets the unit weight.
///
///
/// The unit weight.
///
public double UnitWeight
{
get
{
return unitWeight;
}
set
{
unitWeight = value;
}
}
///
/// Gets or sets a value indicating whether this instance is generated.
///
///
/// true if this instance is generated; otherwise, false.
///
public bool IsGenerated { get; set; }
///
/// The water level of the phreatic line at the left side
///
public double ExternalWaterLevel
{
get
{
if (PhreaticLine != null)
return PhreaticLine.CalcPoints[0].Z;
return 0.0;
}
}
///
/// Adds the waternet line.
///
/// A waternet line.
public void AddWaternetLine(WaternetLine aWaternetLine)
{
if (!WaternetLineList.Contains(aWaternetLine))
{
aWaternetLine.SyncPoints();
WaternetLineList.Add(aWaternetLine);
}
}
}
}