// Copyright (C) Stichting Deltares 2020. All rights reserved.
//
// This file is part of the Layer On Slope Tool.
//
// The Layer On Slope Tool 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;
namespace Deltares.LayerOnSlopeTool.Data
{
///
/// Defines the surface line
///
public class SurfaceLine
{
private readonly List surfaceLinePoints = new List();
public string SurfaceLineId { get; set; }
///
/// Gets the surface line points.
///
///
/// The surface line points.
///
public List SurfaceLinePoints
{
get { return surfaceLinePoints; }
}
///
/// Gets the surface line point by location.
///
/// The x.
/// The z.
///
public SurfaceLinePoint GetSurfaceLinePointByLocation(double x, double z)
{
var index = 0;
var searchPoint = new SurfaceLinePoint {XCoordinate = x, ZCoordinate = z};
SurfaceLinePoint surfaceLinePoint = null;
while (surfaceLinePoint == null && index < surfaceLinePoints.Count)
{
if (surfaceLinePoints[index].LocationEquals(searchPoint))
{
surfaceLinePoint = surfaceLinePoints[index];
}
index++;
}
return surfaceLinePoint;
}
///
/// Gets the type of the surface line point by.
///
/// Type of the point.
///
public SurfaceLinePoint GetSurfaceLinePointByType(CharacteristicPointType pointType)
{
var index = 0;
SurfaceLinePoint surfaceLinePoint = null;
while (surfaceLinePoint == null && index < surfaceLinePoints.Count)
{
if (surfaceLinePoints[index].PointType == pointType)
{
surfaceLinePoint = surfaceLinePoints[index];
}
index++;
}
return surfaceLinePoint;
}
}
}