using System;
using GeoAPI.Geometries;
using GisSharpBlog.NetTopologySuite.Geometries;
using GisSharpBlog.NetTopologySuite.IO;
#if SILVERLIGHT
using ApplicationException = System.Exception;
#endif
namespace GisSharpBlog.NetTopologySuite.Triangulate
{
///
/// Indicates a failure during constraint enforcement.
///
/// Martin Davis
/// 1.0
public class ConstraintEnforcementException : ApplicationException
{
private readonly ICoordinate _pt;
///
/// Creates a new instance with a given message.
///
/// a string
public ConstraintEnforcementException(string msg)
: base(msg) {}
///
/// Creates a new instance with a given message and approximate location.
///
/// a string
/// the location of the error
public ConstraintEnforcementException(String msg, ICoordinate pt)
: base(MsgWithCoord(msg, pt))
{
_pt = new Coordinate(pt);
}
///
/// Gets the approximate location of this error.
///
/// a location
public ICoordinate Coordinate
{
get
{
return _pt;
}
}
//private long serialVersionUID = 386496846550080140L;
private static String MsgWithCoord(String msg, ICoordinate pt)
{
if (pt != null)
{
return msg + " [ " + WKTWriter.ToPoint(pt) + " ]";
}
return msg;
}
}
}