// Copyright (C) Stichting Deltares 2017. All rights reserved.
//
// This file is part of Ringtoets.
//
// Ringtoets is free software: you can redistribute it and/or modify
// it under the terms of the GNU 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 General Public License for more details.
//
// You should have received a copy of the GNU 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;
using System.Collections.Generic;
using System.Linq;
using Core.Common.Base.Geometry;
using Ringtoets.Common.Data.DikeProfiles;
namespace Ringtoets.Common.Data.TestUtil
{
///
/// Simple foreshore profile that can be used for testing.
///
public class TestForeshoreProfile : ForeshoreProfile
{
///
/// Creates a new instance of the at a specified
/// .
///
/// Location of the profile.
/// Thrown when
/// is null.
public TestForeshoreProfile(Point2D worldReferencePoint)
: this("id", "name", worldReferencePoint, null, Enumerable.Empty()) {}
///
/// Creates a new instance of .
///
/// If true, create the ForeshoreProfile with a default .
public TestForeshoreProfile(bool useBreakWater = false)
: this("id", "name", new Point2D(0, 0), useBreakWater ? new BreakWater(BreakWaterType.Dam, 10) : null, Enumerable.Empty()) {}
///
/// Creates a new instance of the with a given
/// name and no .
///
/// The id of the profile.
/// Thrown when
/// is null, empty or whitespaces.
public TestForeshoreProfile(string profileId)
: this(profileId, "name", new Point2D(0, 0), null, Enumerable.Empty()) {}
///
/// Creates a new instance of the with a given
/// name and id and no .
///
/// The name of the profile.
/// The id of the profile.
/// Thrown when
/// is null, empty or whitespaces.
public TestForeshoreProfile(string profileName, string profileId)
: this(profileId, profileName, new Point2D(0, 0), null, Enumerable.Empty()) {}
///
/// Creates a new instance of with a specified .
///
/// The which needs to be set on the .
public TestForeshoreProfile(BreakWater breakWater)
: this("id", "name", new Point2D(0, 0), breakWater, Enumerable.Empty()) {}
///
/// Creates a new instance of with a specified geometry.
///
/// The geometry of the profile.
/// Thrown when
/// is null.
/// Thrown when
/// any element of is null.
public TestForeshoreProfile(IEnumerable geometry)
: this("id", "name", new Point2D(0, 0), null, geometry) {}
///
/// Creates a new instance of the with a given
/// name and geometry.
///
/// The id of the profile.
/// The geometry of the profile.
/// Thrown when
/// is null.
/// Thrown when:
///
/// - Any element of is null.
/// - is null, empty or whitespaces.
///
public TestForeshoreProfile(string profileId, IEnumerable geometry)
: this(profileId, "name", new Point2D(0, 0), null, geometry) {}
///
/// Creates a new instance of with given properties.
///
/// The id of the foreshore profile.
/// The name of the foreshore profile.
/// The location of the foreshore profile.
/// The breakwater of the foreshore profile.
/// The geometry of the foreshore profile.
/// Thrown when
/// or is null.
/// Thrown when:
///
/// - Any element of is null.
/// - is null, empty or whitespaces.
///
private TestForeshoreProfile(string profileId, string profileName, Point2D worldCoordinate, BreakWater breakWater, IEnumerable geometry)
: base(worldCoordinate,
geometry,
breakWater,
new ConstructionProperties
{
Id = profileId,
Name = profileName
}) {}
///
/// Modifies some properties of the current instance of the foreshore profile
/// to different values.
///
/// The current instance of which the properties which
/// need to be modified.
/// Thrown when
/// is null.
public static void ModifyForeshoreProfileProperties(TestForeshoreProfile foreshoreProfile)
{
if (foreshoreProfile == null)
{
throw new ArgumentNullException(nameof(foreshoreProfile));
}
BreakWater differentBreakWater = null;
if (!foreshoreProfile.HasBreakWater)
{
differentBreakWater = new BreakWater(BreakWaterType.Caisson, 12.34);
}
var foreshoreProfileToUpdateFrom = new TestForeshoreProfile(differentBreakWater);
foreshoreProfile.CopyProperties(foreshoreProfileToUpdateFrom);
}
}
}