using GeoAPI.Geometries;
using GisSharpBlog.NetTopologySuite.Algorithm;
using GisSharpBlog.NetTopologySuite.GeometriesGraph;
namespace GisSharpBlog.NetTopologySuite.Operation
{
///
/// The base class for operations that require GeometryGraphs.
///
public class GeometryGraphOperation
{
///
///
///
protected IPrecisionModel resultPrecisionModel;
///
/// The operation args into an array so they can be accessed by index.
///
protected GeometryGraph[] arg;
private LineIntersector li = new RobustLineIntersector();
///
///
///
///
///
public GeometryGraphOperation(IGeometry g0, IGeometry g1)
{
// use the most precise model for the result
ComputationPrecision = g0.PrecisionModel.CompareTo(g1.PrecisionModel) >= 0 ? g0.PrecisionModel : g1.PrecisionModel;
arg = new GeometryGraph[2];
arg[0] = new GeometryGraph(0, g0);
arg[1] = new GeometryGraph(1, g1);
}
///
///
///
///
public GeometryGraphOperation(IGeometry g0)
{
ComputationPrecision = g0.PrecisionModel;
arg = new GeometryGraph[1];
arg[0] = new GeometryGraph(0, g0);
}
///
///
///
///
///
public IGeometry GetArgGeometry(int i)
{
return arg[i].Geometry;
}
///
///
///
protected LineIntersector lineIntersector
{
get
{
return li;
}
set
{
li = value;
}
}
///
///
///
protected IPrecisionModel ComputationPrecision
{
get
{
return resultPrecisionModel;
}
set
{
resultPrecisionModel = value;
lineIntersector.PrecisionModel = resultPrecisionModel;
}
}
}
}