// Copyright (C) Stichting Deltares 2024. 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;
using Deltares.DamEngine.Data.Geometry;
using Deltares.DamEngine.Data.Standard.Language;
namespace Deltares.DamEngine.Data.Geotechnics;
///
/// Represents a point on a surface line of a particular .
///
///
public class CharacteristicPoint : IComparable
{
// Aggregation relationship
///
/// Initializes a new instance of the class.
///
public CharacteristicPoint()
{
//geometryPoint = new GeometryPoint();
}
///
/// Initializes a new instance of the class.
///
/// The containing characteristic point set.
/// The geometry point.
public CharacteristicPoint(CharacteristicPointSet set, Point2D point)
: this()
{
PointSet = set;
Point = point;
}
///
/// Gets or sets the characteristic type 'marker' of a geometry point on a surface line.
///
public CharacteristicPointType CharacteristicPointType { get; set; } = CharacteristicPointType.None;
///
/// Gets or sets the geometry point.
///
///
/// The geometry point.
///
public Point2D Point { get; set; }
///
/// Gets or sets the characteristic point set associated containing this point.
///
public CharacteristicPointSet PointSet { get; set; }
///
/// Determines whether is equal to .
///
/// The point at the left of the operator.
/// The point at the right of the operator.
/// true if the point is equal to the point; otherwise, false.
public static bool operator ==(CharacteristicPoint left, CharacteristicPoint right)
{
if (ReferenceEquals(left, null))
{
return ReferenceEquals(right, null);
}
return left.Equals(right);
}
public static bool operator >(CharacteristicPoint left, CharacteristicPoint right)
{
throw new NotImplementedException();
}
public static bool operator <(CharacteristicPoint left, CharacteristicPoint right)
{
throw new NotImplementedException();
}
///
/// Determines whether is different from .
///
/// The point at the left of the operator.
/// The point at the right of the operator.
/// true if the point is different from the point; otherwise, false.
public static bool operator !=(CharacteristicPoint left, CharacteristicPoint right)
{
return !(left == right);
}
public override bool Equals(object obj)
{
var a = obj as CharacteristicPoint;
if (a == null)
{
return false;
}
return this == a;
}
public override int GetHashCode()
{
int hash;
hash = Point.GetHashCode();
hash += CharacteristicPointType.GetHashCode();
return hash;
}
///
/// Returns a that represents this instance.
///
///
/// A that represents this instance.
///
public override string ToString()
{
return LocalizationManager.GetTranslatedText(GetType(), CharacteristicPointType.ToString());
}
///
/// Compares the Point of the object.
///
///
///
public int CompareTo(object obj)
{
var characteristicPoint = obj as CharacteristicPoint;
if (characteristicPoint != null)
{
Point2D comparePoint = characteristicPoint.Point;
if (comparePoint != null)
{
return Point.X.CompareTo(comparePoint.X);
}
}
return string.Compare(ToString(), obj.ToString(), StringComparison.Ordinal);
}
}