using GeoAPI.Geometries;
using GisSharpBlog.NetTopologySuite.Triangulate.QuadEdge;
namespace GisSharpBlog.NetTopologySuite.Triangulate
{
///
/// A vertex in a Constrained Delaunay Triangulation.
/// The vertex may or may not lie on a constraint.
/// If it does it may carry extra information about the original constraint.
///
/// Martin Davis
public class ConstraintVertex : Vertex
{
private object constraint;
///
/// Creates a new constraint vertex
///
/// the location of the vertex
public ConstraintVertex(ICoordinate p)
: base(p) {}
///
/// Gets or sets whether this vertex lies on a constraint.
///
/// true if the vertex lies on a constraint
public bool IsOnConstraint { get; set; }
///
/// Gets or sets the external constraint object
///
/// object which carries information about the constraint this vertex lies on
public object Constraint
{
get
{
return constraint;
}
set
{
IsOnConstraint = true;
constraint = value;
}
}
///
/// Merges the constraint data in the vertex other into this vertex.
/// This method is called when an inserted vertex is
/// very close to an existing vertex in the triangulation.
///
/// the constraint vertex to merge
protected internal void Merge(ConstraintVertex other)
{
if (other.IsOnConstraint)
{
IsOnConstraint = true;
constraint = other.constraint;
}
}
}
}