public virtual void TestOffsetPoint() { try { com.epl.geometry.Point point = new com.epl.geometry.Point(); point.SetXY(0, 0); com.epl.geometry.OperatorOffset offset = (com.epl.geometry.OperatorOffset)com.epl.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.epl.geometry.Operator.Type.Offset); com.epl.geometry.Geometry outputGeom = offset.Execute(point, null, 2, com.epl.geometry.OperatorOffset.JoinType.Round, 2, 0, null); NUnit.Framework.Assert.IsNull(outputGeom); } catch (System.Exception) { } try { com.epl.geometry.MultiPoint mp = new com.epl.geometry.MultiPoint(); mp.Add(0, 0); mp.Add(10, 10); com.epl.geometry.OperatorOffset offset = (com.epl.geometry.OperatorOffset)com.epl.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.epl.geometry.Operator.Type.Offset); com.epl.geometry.Geometry outputGeom = offset.Execute(mp, null, 2, com.epl.geometry.OperatorOffset.JoinType.Round, 2, 0, null); NUnit.Framework.Assert.IsNull(outputGeom); } catch (System.Exception) { } }
//This is a writeReplace class for Point /// <exception cref="java.io.ObjectStreamException"/> public virtual object ReadResolve() { com.epl.geometry.Point point = null; try { com.epl.geometry.VertexDescription vd = com.epl.geometry.VertexDescriptionDesignerImpl.GetVertexDescription(descriptionBitMask); point = new com.epl.geometry.Point(vd); if (attribs != null) { point.SetXY(attribs[0], attribs[1]); int index = 2; for (int i = 1, n = vd.GetAttributeCount(); i < n; i++) { int semantics = vd.GetSemantics(i); int comps = com.epl.geometry.VertexDescription.GetComponentCount(semantics); for (int ord = 0; ord < comps; ord++) { point.SetAttribute(semantics, ord, attribs[index++]); } } } } catch (System.Exception) { throw new System.IO.InvalidDataException("Cannot read geometry from stream"); } return(point); }
// recalculate coordinates of the vertices by averaging them using weights. // return true if the coordinates has changed. internal static bool MergeVertices(com.epl.geometry.Point pt_1, com.epl.geometry.Point pt_2, double w_1, int rank_1, double w_2, int rank_2, com.epl.geometry.Point pt_res, double[] w_res, int[] rank_res) { System.Diagnostics.Debug.Assert((!pt_1.IsEmpty() && !pt_2.IsEmpty())); bool res = pt_1.Equals(pt_2); if (rank_1 > rank_2) { pt_res = pt_1; if (w_res != null) { rank_res[0] = rank_1; w_res[0] = w_1; } return(res); } else { if (rank_2 > rank_1) { pt_res = pt_2; if (w_res != null) { rank_res[0] = rank_1; w_res[0] = w_1; } return(res); } } pt_res = pt_1; com.epl.geometry.Point2D pt2d = new com.epl.geometry.Point2D(); MergeVertices2D(pt_1.GetXY(), pt_2.GetXY(), w_1, rank_1, w_2, rank_2, pt2d, w_res, rank_res); pt_res.SetXY(pt2d); return(res); }
private static com.epl.geometry.Point MakePoint() { com.epl.geometry.Point point = new com.epl.geometry.Point(); com.epl.geometry.Point2D pt = new com.epl.geometry.Point2D(); pt.SetCoords(0, 15); point.SetXY(pt); return(point); }
public virtual void TestPt() { com.epl.geometry.Point pt = new com.epl.geometry.Point(); NUnit.Framework.Assert.IsTrue(pt.IsEmpty()); pt.SetXY(10, 2); NUnit.Framework.Assert.IsFalse(pt.IsEmpty()); pt.ToString(); }
public static com.epl.geometry.Point MakePoint2() { com.epl.geometry.Point point = new com.epl.geometry.Point(); com.epl.geometry.Point2D pt = new com.epl.geometry.Point2D(); pt.SetCoords(7, 7); point.SetXY(pt); return(point); }
internal static com.epl.geometry.Point MakePoint() { com.epl.geometry.Point point = new com.epl.geometry.Point(); com.epl.geometry.Point2D pt = new com.epl.geometry.Point2D(); pt.SetCoords(10, 20); point.SetXY(pt); return(point); }
public virtual void TestCopy() { com.epl.geometry.Point pt = new com.epl.geometry.Point(); com.epl.geometry.Point copyPt = (com.epl.geometry.Point)pt.Copy(); NUnit.Framework.Assert.IsTrue(copyPt.Equals(pt)); pt.SetXY(11, 13); copyPt = (com.epl.geometry.Point)pt.Copy(); NUnit.Framework.Assert.IsTrue(copyPt.Equals(pt)); NUnit.Framework.Assert.IsTrue(copyPt.GetXY().IsEqual(new com.epl.geometry.Point2D(11, 13))); NUnit.Framework.Assert.IsTrue(copyPt.GetXY().Equals((object)new com.epl.geometry.Point2D(11, 13))); }
internal static com.epl.geometry.Geometry PointTaggedText(int import_flags, com.epl.geometry.WktParser wkt_parser) { com.epl.geometry.Point point = new com.epl.geometry.Point(); int current_token = wkt_parser.NextToken(); if (current_token == com.epl.geometry.WktParser.WktToken.attribute_z) { point.AddAttribute(com.epl.geometry.VertexDescription.Semantics.Z); wkt_parser.NextToken(); } else { if (current_token == com.epl.geometry.WktParser.WktToken.attribute_m) { point.AddAttribute(com.epl.geometry.VertexDescription.Semantics.M); wkt_parser.NextToken(); } else { if (current_token == com.epl.geometry.WktParser.WktToken.attribute_zm) { point.AddAttribute(com.epl.geometry.VertexDescription.Semantics.Z); point.AddAttribute(com.epl.geometry.VertexDescription.Semantics.M); wkt_parser.NextToken(); } } } // At start of PointText current_token = wkt_parser.CurrentToken(); if (current_token != com.epl.geometry.WktParser.WktToken.empty) { wkt_parser.NextToken(); double x = wkt_parser.CurrentNumericLiteral(); wkt_parser.NextToken(); double y = wkt_parser.CurrentNumericLiteral(); wkt_parser.NextToken(); point.SetXY(x, y); if (wkt_parser.HasZs()) { double z = wkt_parser.CurrentNumericLiteral(); wkt_parser.NextToken(); point.SetZ(z); } if (wkt_parser.HasMs()) { double m = wkt_parser.CurrentNumericLiteral(); wkt_parser.NextToken(); point.SetM(m); } } return(point); }
public virtual void TestReplaceNaNs() { com.epl.geometry.Envelope env = new com.epl.geometry.Envelope(); com.epl.geometry.Point pt = new com.epl.geometry.Point(); pt.SetXY(1, 2); pt.SetZ(double.NaN); pt.QueryEnvelope(env); pt.ReplaceNaNs(com.epl.geometry.VertexDescription.Semantics.Z, 5); NUnit.Framework.Assert.IsTrue(pt.Equals(new com.epl.geometry.Point(1, 2, 5))); NUnit.Framework.Assert.IsTrue(env.HasZ()); NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.epl.geometry.VertexDescription.Semantics.Z, 0).IsEmpty()); env.ReplaceNaNs(com.epl.geometry.VertexDescription.Semantics.Z, 5); NUnit.Framework.Assert.IsTrue(env.QueryInterval(com.epl.geometry.VertexDescription.Semantics.Z, 0).Equals(new com.epl.geometry.Envelope1D(5, 5))); }
public static void TestUnion__() { com.epl.geometry.Point pt = new com.epl.geometry.Point(10, 20); com.epl.geometry.Point pt2 = new com.epl.geometry.Point(); pt2.SetXY(10, 10); com.epl.geometry.Envelope env1 = new com.epl.geometry.Envelope(10, 10, 30, 50); com.epl.geometry.Envelope env2 = new com.epl.geometry.Envelope(30, 10, 60, 50); com.epl.geometry.Geometry[] geomArray = new com.epl.geometry.Geometry[] { env1, env2 }; com.epl.geometry.SimpleGeometryCursor inputGeometries = new com.epl.geometry.SimpleGeometryCursor(geomArray); com.epl.geometry.OperatorUnion union = (com.epl.geometry.OperatorUnion)com.epl.geometry.OperatorFactoryLocal.GetInstance().GetOperator(com.epl.geometry.Operator.Type.Union); com.epl.geometry.SpatialReference sr = com.epl.geometry.SpatialReference.Create(4326); com.epl.geometry.GeometryCursor outputCursor = union.Execute(inputGeometries, sr, null); com.epl.geometry.Geometry result = outputCursor.Next(); }
internal virtual void QueryCoord(double t, com.epl.geometry.Point point) { point.AssignVertexDescription(m_description); point.SetXY(GetCoord2D(t)); for (int iattrib = 1, nattrib = m_description.GetAttributeCount(); iattrib < nattrib; iattrib++) { int semantics = m_description._getSemanticsImpl(iattrib); int ncomp = com.epl.geometry.VertexDescription.GetComponentCount(semantics); for (int iord = 0; iord < ncomp; iord++) { double value = GetAttributeAsDbl(t, semantics, iord); point.SetAttribute(semantics, iord, value); } } }
public static void TestProximity2D_3() { com.epl.geometry.OperatorFactoryLocal factory = com.epl.geometry.OperatorFactoryLocal.GetInstance(); com.epl.geometry.OperatorProximity2D proximity = (com.epl.geometry.OperatorProximity2D)factory.GetOperator(com.epl.geometry.Operator.Type.Proximity2D); com.epl.geometry.Polygon polygon = new com.epl.geometry.Polygon(); polygon.StartPath(new com.epl.geometry.Point(-120, 22)); polygon.LineTo(new com.epl.geometry.Point(-120, 10)); polygon.LineTo(new com.epl.geometry.Point(-110, 10)); polygon.LineTo(new com.epl.geometry.Point(-110, 22)); com.epl.geometry.Point point = new com.epl.geometry.Point(); point.SetXY(-110, 20); com.epl.geometry.Proximity2DResult result = proximity.GetNearestCoordinate(polygon, point, false); com.epl.geometry.Point point2 = new com.epl.geometry.Point(); point2.SetXY(-120, 12); com.epl.geometry.Proximity2DResult[] results = proximity.GetNearestVertices(polygon, point2, 10, 12); }
/// <summary>Returns the center point of the envelope.</summary> /// <returns>The center point of the envelope.</returns> public virtual com.epl.geometry.Point GetCenter() { com.epl.geometry.Point pointOut = new com.epl.geometry.Point(m_description); if (IsEmpty()) { return(pointOut); } int nattrib = m_description.GetAttributeCount(); for (int i = 1; i < nattrib; i++) { int semantics = m_description._getSemanticsImpl(i); int ncomp = com.epl.geometry.VertexDescription.GetComponentCount(semantics); for (int iord = 0; iord < ncomp; iord++) { double v = 0.5 * (_getAttributeAsDbl(0, semantics, iord) + _getAttributeAsDbl(1, semantics, iord)); pointOut.SetAttribute(semantics, iord, v); } } pointOut.SetXY(m_envelope.GetCenterX(), m_envelope.GetCenterY()); return(pointOut); }
public virtual void GetCenter(com.epl.geometry.Point point_out) { point_out.AssignVertexDescription(m_description); if (IsEmpty()) { point_out.SetEmpty(); return; } int nattrib = m_description.GetAttributeCount(); for (int i = 1; i < nattrib; i++) { int semantics = m_description.GetSemantics(i); int ncomp = com.epl.geometry.VertexDescription.GetComponentCount(semantics); for (int iord = 0; iord < ncomp; iord++) { double v = 0.5 * (GetAttributeAsDblImpl_(0, semantics, iord) + GetAttributeAsDblImpl_(1, semantics, iord)); point_out.SetAttribute(semantics, iord, v); } } point_out.SetXY(m_envelope.GetCenter()); }
public virtual void TestRotationInvariance() { com.epl.geometry.Point pt_0 = new com.epl.geometry.Point(10, 40); com.epl.geometry.Point pt_1 = new com.epl.geometry.Point(20, 60); com.epl.geometry.Point pt_2 = new com.epl.geometry.Point(20, 40); double length = 0.0; length += com.epl.geometry.GeometryEngine.GeodesicDistanceOnWGS84(pt_0, pt_1); length += com.epl.geometry.GeometryEngine.GeodesicDistanceOnWGS84(pt_1, pt_2); length += com.epl.geometry.GeometryEngine.GeodesicDistanceOnWGS84(pt_2, pt_0); NUnit.Framework.Assert.IsTrue(System.Math.Abs(length - 5409156.3896271614) < 1e-12 * 5409156.3896271614); for (int i = -540; i < 540; i += 5) { pt_0.SetXY(i + 10, 40); pt_1.SetXY(i + 20, 60); pt_2.SetXY(i + 20, 40); length = 0.0; length += com.epl.geometry.GeometryEngine.GeodesicDistanceOnWGS84(pt_0, pt_1); length += com.epl.geometry.GeometryEngine.GeodesicDistanceOnWGS84(pt_1, pt_2); length += com.epl.geometry.GeometryEngine.GeodesicDistanceOnWGS84(pt_2, pt_0); NUnit.Framework.Assert.IsTrue(System.Math.Abs(length - 5409156.3896271614) < 1e-12 * 5409156.3896271614); } }
public virtual void TestPoint() { com.epl.geometry.Point pt = new com.epl.geometry.Point(); pt.SetXY(100, 200); NUnit.Framework.Assert.IsFalse(pt.HasAttribute(com.epl.geometry.VertexDescription.Semantics.M)); pt.AddAttribute(com.epl.geometry.VertexDescription.Semantics.M); NUnit.Framework.Assert.IsTrue(pt.HasAttribute(com.epl.geometry.VertexDescription.Semantics.M)); NUnit.Framework.Assert.IsTrue(double.IsNaN(pt.GetM())); pt.SetAttribute(com.epl.geometry.VertexDescription.Semantics.M, 0, 13); NUnit.Framework.Assert.IsTrue(pt.GetM() == 13); pt.AddAttribute(com.epl.geometry.VertexDescription.Semantics.Z); NUnit.Framework.Assert.IsTrue(pt.GetZ() == 0); NUnit.Framework.Assert.IsTrue(pt.GetM() == 13); pt.SetAttribute(com.epl.geometry.VertexDescription.Semantics.Z, 0, 11); NUnit.Framework.Assert.IsTrue(pt.GetZ() == 11); NUnit.Framework.Assert.IsTrue(pt.GetM() == 13); pt.AddAttribute(com.epl.geometry.VertexDescription.Semantics.ID); NUnit.Framework.Assert.IsTrue(pt.GetID() == 0); NUnit.Framework.Assert.IsTrue(pt.GetZ() == 11); NUnit.Framework.Assert.IsTrue(pt.GetM() == 13); pt.SetAttribute(com.epl.geometry.VertexDescription.Semantics.ID, 0, 1); NUnit.Framework.Assert.IsTrue(pt.GetID() == 1); NUnit.Framework.Assert.IsTrue(pt.GetZ() == 11); NUnit.Framework.Assert.IsTrue(pt.GetM() == 13); pt.DropAttribute(com.epl.geometry.VertexDescription.Semantics.M); NUnit.Framework.Assert.IsTrue(pt.GetID() == 1); NUnit.Framework.Assert.IsTrue(pt.GetZ() == 11); NUnit.Framework.Assert.IsFalse(pt.HasAttribute(com.epl.geometry.VertexDescription.Semantics.M)); com.epl.geometry.Point pt1 = new com.epl.geometry.Point(); NUnit.Framework.Assert.IsFalse(pt1.HasAttribute(com.epl.geometry.VertexDescription.Semantics.M)); NUnit.Framework.Assert.IsFalse(pt1.HasAttribute(com.epl.geometry.VertexDescription.Semantics.Z)); NUnit.Framework.Assert.IsFalse(pt1.HasAttribute(com.epl.geometry.VertexDescription.Semantics.ID)); pt1.MergeVertexDescription(pt.GetDescription()); NUnit.Framework.Assert.IsFalse(pt1.HasAttribute(com.epl.geometry.VertexDescription.Semantics.M)); NUnit.Framework.Assert.IsTrue(pt1.HasAttribute(com.epl.geometry.VertexDescription.Semantics.Z)); NUnit.Framework.Assert.IsTrue(pt1.HasAttribute(com.epl.geometry.VertexDescription.Semantics.ID)); }
public virtual void TestProximity_2D_1() { com.epl.geometry.OperatorFactoryLocal engine = com.epl.geometry.OperatorFactoryLocal.GetInstance(); com.epl.geometry.OperatorProximity2D proximityOp = (com.epl.geometry.OperatorProximity2D)engine.GetOperator(com.epl.geometry.Operator.Type.Proximity2D); com.epl.geometry.Point inputPoint = new com.epl.geometry.Point(3, 2); com.epl.geometry.Point point0 = new com.epl.geometry.Point(2.75, 2); // Point point1 = new Point(3, 2.5); // Point point2 = new Point(3.75, 2); // Point point3 = new Point(2.25, 2.5); // Point point4 = new Point(4, 2.25); // GetNearestVertices for Polygon (Native and DotNet) com.epl.geometry.Polygon polygon = MakePolygon(); com.epl.geometry.Proximity2DResult[] resultArray = com.epl.geometry.GeometryEngine.GetNearestVertices(polygon, inputPoint, 2.0, 8); NUnit.Framework.Assert.IsTrue(resultArray.Length == 8); double lastdistance; double distance; com.epl.geometry.Proximity2DResult result0 = resultArray[0]; lastdistance = result0.GetDistance(); NUnit.Framework.Assert.IsTrue(lastdistance <= 2.0); com.epl.geometry.Proximity2DResult result1 = resultArray[1]; distance = result1.GetDistance(); NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance); lastdistance = distance; com.epl.geometry.Proximity2DResult result2 = resultArray[2]; distance = result2.GetDistance(); NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance); lastdistance = distance; com.epl.geometry.Proximity2DResult result3 = resultArray[3]; distance = result3.GetDistance(); NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance); lastdistance = distance; com.epl.geometry.Proximity2DResult result4 = resultArray[4]; distance = result4.GetDistance(); NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance); lastdistance = distance; com.epl.geometry.Proximity2DResult result5 = resultArray[5]; distance = result5.GetDistance(); NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance); lastdistance = distance; com.epl.geometry.Proximity2DResult result6 = resultArray[6]; distance = result6.GetDistance(); NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance); lastdistance = distance; com.epl.geometry.Proximity2DResult result7 = resultArray[7]; distance = result7.GetDistance(); NUnit.Framework.Assert.IsTrue(distance <= 2.0 && distance >= lastdistance); // lastdistance = distance; // Point[] coordinates = polygon.get.getCoordinates2D(); // int pointCount = polygon.getPointCount(); // // int hits = 0; // for (int i = 0; i < pointCount; i++) // { // Point ipoint = coordinates[i]; // distance = Point::Distance(ipoint, inputPoint); // // if (distance < lastdistance) // hits++; // } // assertTrue(hits < 8); // GetNearestVertices for Point com.epl.geometry.Point point = MakePoint(); resultArray = com.epl.geometry.GeometryEngine.GetNearestVertices(point, inputPoint, 1.0, 1); NUnit.Framework.Assert.IsTrue(resultArray.Length == 1); result0 = resultArray[0]; com.epl.geometry.Point resultPoint0 = result0.GetCoordinate(); NUnit.Framework.Assert.IsTrue(resultPoint0.GetX() == point.GetX() && resultPoint0.GetY() == point.GetY()); // GetNearestVertex for Polygon result0 = com.epl.geometry.GeometryEngine.GetNearestVertex(polygon, inputPoint); resultPoint0 = result0.GetCoordinate(); NUnit.Framework.Assert.IsTrue(resultPoint0.GetX() == point0.GetX() && resultPoint0.GetY() == point0.GetY()); // GetNearestVertex for Point result0 = com.epl.geometry.GeometryEngine.GetNearestVertex(point, inputPoint); resultPoint0 = result0.GetCoordinate(); NUnit.Framework.Assert.IsTrue(resultPoint0.GetX() == point.GetX() && resultPoint0.GetY() == point.GetY()); // GetNearestCoordinate for Polygon com.epl.geometry.Polygon polygon2 = MakePolygon2(); result0 = com.epl.geometry.GeometryEngine.GetNearestCoordinate(polygon2, inputPoint, true); resultPoint0 = result0.GetCoordinate(); NUnit.Framework.Assert.IsTrue(resultPoint0.GetX() == inputPoint.GetX() && resultPoint0.GetY() == inputPoint.GetY()); // GetNearestCoordinate for Polyline com.epl.geometry.Polyline polyline = MakePolyline(); result0 = com.epl.geometry.GeometryEngine.GetNearestCoordinate(polyline, inputPoint, true); resultPoint0 = result0.GetCoordinate(); NUnit.Framework.Assert.IsTrue(resultPoint0.GetX() == 0.0 && resultPoint0.GetY() == 2.0); com.epl.geometry.Polygon pp = new com.epl.geometry.Polygon(); pp.StartPath(0, 0); pp.LineTo(0, 10); pp.LineTo(10, 10); pp.LineTo(10, 0); inputPoint.SetXY(15, -5); result0 = proximityOp.GetNearestCoordinate(pp, inputPoint, true, true); bool is_right = result0.IsRightSide(); NUnit.Framework.Assert.IsTrue(!is_right); }
/// <summary> /// Sets the point's coordinates to the coordinates of the envelope at the /// given corner. /// </summary> /// <param name="index"> /// The index of the envelope's corners from 0 to 3. /// <p> /// 0 = lower left corner /// <p> /// 1 = top-left corner /// <p> /// 2 = top right corner /// <p> /// 3 = bottom right corner /// </param> /// <param name="ptDst"> /// The point whose coordinates are used to set the envelope's /// coordinate at a specified corner. /// </param> public virtual void QueryCornerByVal(int index, com.epl.geometry.Point ptDst) { ptDst.AssignVertexDescription(m_description); int nattrib = GetDescription().GetAttributeCount() - 1; switch (index) { case 0: { for (int i = 0; i < nattrib; i++) { int semantics = m_description.GetSemantics(i); int ncomp = com.epl.geometry.VertexDescription.GetComponentCount(semantics); for (int iord = 0; iord < ncomp; iord++) { ptDst.SetAttribute(semantics, iord, _getAttributeAsDbl(0, semantics, iord)); } } ptDst.SetXY(m_envelope.xmin, m_envelope.ymin); return; } case 1: { for (int i = 0; i < nattrib; i++) { int semantics = m_description.GetSemantics(i); int ncomp = com.epl.geometry.VertexDescription.GetComponentCount(semantics); for (int iord = 0; iord < ncomp; iord++) { ptDst.SetAttribute(semantics, iord, _getAttributeAsDbl(1, semantics, iord)); } } ptDst.SetXY(m_envelope.xmin, m_envelope.ymax); return; } case 2: { for (int i = 0; i < nattrib; i++) { int semantics = m_description.GetSemantics(i); int ncomp = com.epl.geometry.VertexDescription.GetComponentCount(semantics); for (int iord = 0; iord < ncomp; iord++) { ptDst.SetAttribute(semantics, iord, _getAttributeAsDbl(0, semantics, iord)); } } ptDst.SetXY(m_envelope.xmax, m_envelope.ymax); return; } case 3: { for (int i = 0; i < nattrib; i++) { int semantics = m_description.GetSemantics(i); int ncomp = com.epl.geometry.VertexDescription.GetComponentCount(semantics); for (int iord = 0; iord < ncomp; iord++) { ptDst.SetAttribute(semantics, iord, _getAttributeAsDbl(1, semantics, iord)); } } ptDst.SetXY(m_envelope.xmax, m_envelope.ymin); return; } default: { throw new System.IndexOutOfRangeException(); } } }
public virtual void Intersect(double tolerance, com.epl.geometry.Point pt_intersector_point, int point_rank, double point_weight, bool b_intersecting) { pt_intersector_point.CopyTo(m_point); if (m_input_segments.Count != 1) { throw com.epl.geometry.GeometryException.GeometryInternalError(); } m_tolerance = tolerance; com.epl.geometry.SegmentIntersector.IntersectionPart part1 = m_input_segments[0]; if (b_intersecting || part1.seg._isIntersectingPoint(pt_intersector_point.GetXY(), tolerance, true)) { if (part1.seg.GetType().Value() == com.epl.geometry.Geometry.GeometryType.Line) { com.epl.geometry.Line line_1 = (com.epl.geometry.Line)(part1.seg); double t1 = line_1.GetClosestCoordinate(pt_intersector_point.GetXY(), false); m_param_1[0] = t1; // For each point of intersection, we calculate a weighted point // based on the ranks and weights of the endpoints and the // interior. int rank1 = part1.rank_interior; double weight1 = 1.0; if (t1 == 0) { rank1 = part1.rank_start; weight1 = part1.weight_start; } else { if (t1 == 1.0) { rank1 = part1.rank_end; weight1 = part1.weight_end; } } int rank2 = point_rank; double weight2 = point_weight; double ptWeight; com.epl.geometry.Point2D pt = new com.epl.geometry.Point2D(); if (rank1 == rank2) { // for equal ranks use weighted sum com.epl.geometry.Point2D pt_1 = new com.epl.geometry.Point2D(); line_1.GetCoord2D(t1, pt_1); com.epl.geometry.Point2D pt_2 = pt_intersector_point.GetXY(); ptWeight = weight1 + weight2; double t = weight2 / ptWeight; com.epl.geometry.MathUtils.Lerp(pt_1, pt_2, t, pt); } else { // for non-equal ranks, the higher rank wins if (rank1 > rank2) { pt = new com.epl.geometry.Point2D(); line_1.GetCoord2D(t1, pt); ptWeight = weight1; } else { pt = pt_intersector_point.GetXY(); ptWeight = weight2; } } // Split the line_1, making sure the endpoints are adusted to // the weighted double t0 = 0; int i0 = -1; int count = 1; for (int i = 0; i <= count; i++) { double t = i < count ? m_param_1[i] : 1.0; if (t != t0) { com.epl.geometry.SegmentBuffer seg_buffer = NewSegmentBuffer_(); line_1.Cut(t0, t, seg_buffer); if (i0 != -1) { seg_buffer.Get().SetStartXY(pt); } if (i != count) { seg_buffer.Get().SetEndXY(pt); } t0 = t; m_result_segments_1.Add(NewIntersectionPart_(seg_buffer.Get())); } i0 = i; } m_point.SetXY(pt); return; } throw com.epl.geometry.GeometryException.GeometryInternalError(); } }
public static void TestCreation() { { // simple create com.epl.geometry.MultiPoint mpoint = new com.epl.geometry.MultiPoint(); NUnit.Framework.Assert.IsTrue(mpoint.GetType() == Geometry.Type.MultiPoint); // assertFalse(mpoint.getClass() == Polyline.class); NUnit.Framework.Assert.IsTrue(mpoint != null); NUnit.Framework.Assert.IsTrue(mpoint.GetType() == com.epl.geometry.Geometry.Type.MultiPoint); NUnit.Framework.Assert.IsTrue(mpoint.IsEmpty()); NUnit.Framework.Assert.IsTrue(mpoint.GetPointCount() == 0); mpoint = null; NUnit.Framework.Assert.IsFalse(mpoint != null); } { // play with default attributes com.epl.geometry.MultiPoint mpoint = new com.epl.geometry.MultiPoint(); SimpleTest(mpoint); } { // simple create 2D com.epl.geometry.MultiPoint mpoint = new com.epl.geometry.MultiPoint(); NUnit.Framework.Assert.IsTrue(mpoint != null); com.epl.geometry.MultiPoint mpoint1 = new com.epl.geometry.MultiPoint(); NUnit.Framework.Assert.IsTrue(mpoint1 != null); mpoint.SetEmpty(); com.epl.geometry.Point pt = new com.epl.geometry.Point(0, 0); mpoint.Add(pt); com.epl.geometry.Point pt3 = mpoint.GetPoint(0); NUnit.Framework.Assert.IsTrue(pt3.GetX() == 0 && pt3.GetY() == 0); // assertFalse(mpoint->HasAttribute(VertexDescription::Semantics::Z)); // pt3.setZ(115.0); mpoint.SetPoint(0, pt3); pt3 = mpoint.GetPoint(0); NUnit.Framework.Assert.IsTrue(pt3.GetX() == 0 && pt3.GetY() == 0); } { /* && pt3.getZ() == 115 */ // assertTrue(mpoint->HasAttribute(VertexDescription::Semantics::Z)); // CompareGeometryContent(mpoint, &pt, 1); // move 3d com.epl.geometry.MultiPoint mpoint = new com.epl.geometry.MultiPoint(); NUnit.Framework.Assert.IsTrue(mpoint != null); com.epl.geometry.Point pt = new com.epl.geometry.Point(0, 0); mpoint.Add(pt); com.epl.geometry.Point pt3 = mpoint.GetPoint(0); NUnit.Framework.Assert.IsTrue(pt3.GetX() == 0 && pt3.GetY() == 0); } { /* && pt3.getZ() == 0 */ // test QueryInterval com.epl.geometry.MultiPoint mpoint = new com.epl.geometry.MultiPoint(); com.epl.geometry.Point pt1 = new com.epl.geometry.Point(0.0, 0.0); // pt1.setZ(-1.0); com.epl.geometry.Point pt2 = new com.epl.geometry.Point(0.0, 0.0); // pt2.setZ(1.0); mpoint.Add(pt1); mpoint.Add(pt2); // Envelope1D e = // mpoint->QueryInterval(enum_value2(VertexDescription, Semantics, // Z), 0); com.epl.geometry.Envelope e = new com.epl.geometry.Envelope(); mpoint.QueryEnvelope(e); } { // assertTrue(e.get == -1.0 && e.vmax == 1.0); com.epl.geometry.MultiPoint geom = new com.epl.geometry.MultiPoint(); } { // int sz = sizeof(openString) / sizeof(openString[0]); // for (int i = 0; i < sz; i++) // geom.add(openString[i]); // CompareGeometryContent(geom, openString, sz); com.epl.geometry.MultiPoint geom = new com.epl.geometry.MultiPoint(); } { // int sz = sizeof(openString) / sizeof(openString[0]); // Point point = GCNEW Point; // for (int i = 0; i < sz; i++) // { // point.setXY(openString[i]); // geom.add(point); // } // CompareGeometryContent(geom, openString, sz); // Test AddPoints com.epl.geometry.MultiPoint geom = new com.epl.geometry.MultiPoint(); } { // int sz = sizeof(openString) / sizeof(openString[0]); // geom.addPoints(openString, sz, 0, -1); // CompareGeometryContent((MultiVertexGeometry)geom, openString, // sz); // Test InsertPoint(Point2D) com.epl.geometry.MultiPoint mpoint = new com.epl.geometry.MultiPoint(); com.epl.geometry.Point pt0 = new com.epl.geometry.Point(0.0, 0.0); // pt0.setZ(-1.0); // pt0.setID(7); com.epl.geometry.Point pt1 = new com.epl.geometry.Point(0.0, 0.0); // pt1.setZ(1.0); // pt1.setID(11); com.epl.geometry.Point pt2 = new com.epl.geometry.Point(0.0, 1.0); // pt2.setZ(1.0); // pt2.setID(13); mpoint.Add(pt0); mpoint.Add(pt1); mpoint.Add(pt2); com.epl.geometry.Point pt3 = new com.epl.geometry.Point(-11.0, -13.0); mpoint.Add(pt3); mpoint.InsertPoint(1, pt3); NUnit.Framework.Assert.IsTrue(mpoint.GetPointCount() == 5); com.epl.geometry.Point pt; pt = mpoint.GetPoint(0); NUnit.Framework.Assert.IsTrue(pt.GetX() == pt0.GetX() && pt.GetY() == pt0.GetY()); /* * && * pt. * getZ * () == * pt0 * .getZ * () */ pt = mpoint.GetPoint(1); NUnit.Framework.Assert.IsTrue(pt.GetX() == pt3.GetX() && pt.GetY() == pt3.GetY()); pt = mpoint.GetPoint(2); NUnit.Framework.Assert.IsTrue(pt.GetX() == pt1.GetX() && pt.GetY() == pt1.GetY()); /* * && * pt. * getZ * () == * pt1 * .getZ * () */ pt = mpoint.GetPoint(3); NUnit.Framework.Assert.IsTrue(pt.GetX() == pt2.GetX() && pt.GetY() == pt2.GetY()); /* * && * pt. * getZ * () == * pt2 * .getZ * () */ com.epl.geometry.Point point = new com.epl.geometry.Point(); point.SetXY(17.0, 19.0); // point.setID(12); // point.setM(5); mpoint.InsertPoint(2, point); mpoint.Add(point); NUnit.Framework.Assert.IsTrue(mpoint.GetPointCount() == 7); } // double m; // int id; // pt = mpoint.getXYZ(2); // assertTrue(pt.x == 17.0 && pt.y == 19.0 && pt.z == defaultZ); // m = mpoint.getAttributeAsDbl(enum_value2(VertexDescription, // Semantics, M), 2, 0); // assertTrue(m == 5); // id = mpoint.getAttributeAsInt(enum_value2(VertexDescription, // Semantics, ID), 2, 0); // assertTrue(id == 23); // // pt = mpoint.getXYZ(3); // assertTrue(pt.x == pt1.x && pt.y == pt1.y && pt.z == pt1.z); // m = mpoint.getAttributeAsDbl(enum_value2(VertexDescription, // Semantics, M), 3, 0); // assertTrue(NumberUtils::IsNaN(m)); // id = mpoint.getAttributeAsInt(enum_value2(VertexDescription, // Semantics, ID), 3, 0); // assertTrue(id == 11); com.epl.geometry.MultiPoint mpoint_1 = new com.epl.geometry.MultiPoint(); com.epl.geometry.Point pt0_1 = new com.epl.geometry.Point(0.0, 0.0, -1.0); com.epl.geometry.Point pt1_1 = new com.epl.geometry.Point(0.0, 0.0, 1.0); com.epl.geometry.Point pt2_1 = new com.epl.geometry.Point(0.0, 1.0, 1.0); mpoint_1.Add(pt0_1); mpoint_1.Add(pt1_1); mpoint_1.Add(pt2_1); mpoint_1.RemovePoint(1); com.epl.geometry.Point pt_1; pt_1 = mpoint_1.GetPoint(0); NUnit.Framework.Assert.IsTrue(pt_1.GetX() == pt0_1.GetX() && pt_1.GetY() == pt0_1.GetY()); pt_1 = mpoint_1.GetPoint(1); NUnit.Framework.Assert.IsTrue(pt_1.GetX() == pt2_1.GetX() && pt_1.GetY() == pt2_1.GetY()); NUnit.Framework.Assert.IsTrue(mpoint_1.GetPointCount() == 2); }
public static void TestPointTypes() { com.epl.geometry.OperatorFactoryLocal engine = com.epl.geometry.OperatorFactoryLocal.GetInstance(); com.epl.geometry.OperatorDifference difference = (com.epl.geometry.OperatorDifference)engine.GetOperator(com.epl.geometry.Operator.Type.Difference); com.epl.geometry.OperatorSymmetricDifference sym_difference = (com.epl.geometry.OperatorSymmetricDifference)engine.GetOperator(com.epl.geometry.Operator.Type.SymmetricDifference); { // point/point com.epl.geometry.Point point_1 = new com.epl.geometry.Point(); com.epl.geometry.Point point_2 = new com.epl.geometry.Point(); point_1.SetXY(0, 0); point_2.SetXY(0.000000009, 0.000000009); com.epl.geometry.Point differenced = (com.epl.geometry.Point)(difference.Execute(point_1, point_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(differenced.IsEmpty()); com.epl.geometry.MultiPoint sym_differenced = (com.epl.geometry.MultiPoint)(sym_difference.Execute(point_1, point_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(sym_differenced.IsEmpty()); } { // point/point com.epl.geometry.Point point_1 = new com.epl.geometry.Point(); com.epl.geometry.Point point_2 = new com.epl.geometry.Point(); point_1.SetXY(0, 0); point_2.SetXY(0.000000009, 0.0); com.epl.geometry.Point differenced = (com.epl.geometry.Point)(difference.Execute(point_1, point_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(differenced.IsEmpty()); com.epl.geometry.MultiPoint sym_differenced = (com.epl.geometry.MultiPoint)(sym_difference.Execute(point_1, point_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(sym_differenced.IsEmpty()); } { // point/point com.epl.geometry.Point point_1 = new com.epl.geometry.Point(); com.epl.geometry.Point point_2 = new com.epl.geometry.Point(); point_1.SetXY(0, 0); point_2.SetXY(0.00000002, 0.00000002); com.epl.geometry.Point differenced_1 = (com.epl.geometry.Point)(difference.Execute(point_1, point_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty()); com.epl.geometry.Point differenced_2 = (com.epl.geometry.Point)(difference.Execute(point_2, point_1, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(!differenced_2.IsEmpty()); com.epl.geometry.MultiPoint sym_differenced = (com.epl.geometry.MultiPoint)(sym_difference.Execute(point_1, point_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(!sym_differenced.IsEmpty()); NUnit.Framework.Assert.IsTrue(sym_differenced.GetXY(0).x == 0 && sym_differenced.GetXY(0).y == 0); NUnit.Framework.Assert.IsTrue(sym_differenced.GetXY(1).x == 0.00000002 && sym_differenced.GetXY(1).y == 0.00000002); } { // multi_point/point com.epl.geometry.MultiPoint multi_point_1 = new com.epl.geometry.MultiPoint(); com.epl.geometry.Point point_2 = new com.epl.geometry.Point(); multi_point_1.Add(0, 0); multi_point_1.Add(1, 1); point_2.SetXY(0.000000009, 0.000000009); com.epl.geometry.MultiPoint differenced_1 = (com.epl.geometry.MultiPoint)(difference.Execute(multi_point_1, point_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty()); NUnit.Framework.Assert.IsTrue(differenced_1.GetPointCount() == 1); NUnit.Framework.Assert.IsTrue(differenced_1.GetXY(0).x == 1 && differenced_1.GetXY(0).y == 1); com.epl.geometry.Point differenced_2 = (com.epl.geometry.Point)(difference.Execute(point_2, multi_point_1, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(differenced_2.IsEmpty()); } { // multi_point/point com.epl.geometry.MultiPoint multi_point_1 = new com.epl.geometry.MultiPoint(); com.epl.geometry.Point point_2 = new com.epl.geometry.Point(); multi_point_1.Add(0, 0); multi_point_1.Add(1, 1); point_2.SetXY(0.000000009, 0.0); com.epl.geometry.MultiPoint differenced_1 = (com.epl.geometry.MultiPoint)(difference.Execute(multi_point_1, point_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty()); NUnit.Framework.Assert.IsTrue(differenced_1.GetXY(0).x == 1.0 && differenced_1.GetXY(0).y == 1.0); com.epl.geometry.Point differenced_2 = (com.epl.geometry.Point)(difference.Execute(point_2, multi_point_1, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(differenced_2.IsEmpty()); com.epl.geometry.MultiPoint sym_differenced = (com.epl.geometry.MultiPoint)(sym_difference.Execute(multi_point_1, point_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(!sym_differenced.IsEmpty()); NUnit.Framework.Assert.IsTrue(sym_differenced.GetPointCount() == 1); NUnit.Framework.Assert.IsTrue(sym_differenced.GetXY(0).x == 1 && sym_differenced.GetXY(0).y == 1); } { // multi_point/point com.epl.geometry.MultiPoint multi_point_1 = new com.epl.geometry.MultiPoint(); com.epl.geometry.Point point_2 = new com.epl.geometry.Point(); multi_point_1.Add(0, 0); multi_point_1.Add(0, 0); point_2.SetXY(0.000000009, 0.0); com.epl.geometry.MultiPoint differenced_1 = (com.epl.geometry.MultiPoint)(difference.Execute(multi_point_1, point_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(differenced_1.IsEmpty()); com.epl.geometry.MultiPoint sym_differenced = (com.epl.geometry.MultiPoint)(sym_difference.Execute(multi_point_1, point_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(sym_differenced.IsEmpty()); } { // multi_point/polygon com.epl.geometry.MultiPoint multi_point_1 = new com.epl.geometry.MultiPoint(); com.epl.geometry.Polygon polygon_2 = new com.epl.geometry.Polygon(); multi_point_1.Add(0, 0); multi_point_1.Add(0, 0); multi_point_1.Add(2, 2); polygon_2.StartPath(-1, -1); polygon_2.LineTo(-1, 1); polygon_2.LineTo(1, 1); polygon_2.LineTo(1, -1); com.epl.geometry.MultiPoint differenced_1 = (com.epl.geometry.MultiPoint)(difference.Execute(multi_point_1, polygon_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty()); NUnit.Framework.Assert.IsTrue(differenced_1.GetPointCount() == 1); NUnit.Framework.Assert.IsTrue(differenced_1.GetXY(0).x == 2 && differenced_1.GetXY(0).y == 2); } { // multi_point/polygon com.epl.geometry.MultiPoint multi_point_1 = new com.epl.geometry.MultiPoint(); com.epl.geometry.Polygon polygon_2 = new com.epl.geometry.Polygon(); multi_point_1.Add(0, 0); multi_point_1.Add(0, 0); multi_point_1.Add(1, 1); polygon_2.StartPath(-1, -1); polygon_2.LineTo(-1, 1); polygon_2.LineTo(1, 1); polygon_2.LineTo(1, -1); com.epl.geometry.MultiPoint differenced_1 = (com.epl.geometry.MultiPoint)(difference.Execute(multi_point_1, polygon_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(differenced_1.IsEmpty()); } { // multi_point/envelope com.epl.geometry.MultiPoint multi_point_1 = new com.epl.geometry.MultiPoint(); com.epl.geometry.Envelope envelope_2 = new com.epl.geometry.Envelope(); multi_point_1.Add(-2, 0); multi_point_1.Add(0, 2); multi_point_1.Add(2, 0); multi_point_1.Add(0, -2); envelope_2.SetCoords(-1, -1, 1, 1); com.epl.geometry.MultiPoint differenced_1 = (com.epl.geometry.MultiPoint)(difference.Execute(multi_point_1, envelope_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty() && differenced_1 == multi_point_1); } { // multi_point/polygon com.epl.geometry.MultiPoint multi_point_1 = new com.epl.geometry.MultiPoint(); com.epl.geometry.Polygon polygon_2 = new com.epl.geometry.Polygon(); multi_point_1.Add(2, 2); multi_point_1.Add(2, 2); multi_point_1.Add(-2, -2); polygon_2.StartPath(-1, -1); polygon_2.LineTo(-1, 1); polygon_2.LineTo(1, 1); polygon_2.LineTo(1, -1); com.epl.geometry.MultiPoint differenced_1 = (com.epl.geometry.MultiPoint)(difference.Execute(multi_point_1, polygon_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty() && differenced_1 == multi_point_1); } { // point/polygon com.epl.geometry.Point point_1 = new com.epl.geometry.Point(); com.epl.geometry.Polygon polygon_2 = new com.epl.geometry.Polygon(); point_1.SetXY(0, 0); polygon_2.StartPath(-1, -1); polygon_2.LineTo(-1, 1); polygon_2.LineTo(1, 1); polygon_2.LineTo(1, -1); com.epl.geometry.Point differenced_1 = (com.epl.geometry.Point)(difference.Execute(point_1, polygon_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(differenced_1.IsEmpty()); polygon_2.SetEmpty(); polygon_2.StartPath(1, 1); polygon_2.LineTo(1, 2); polygon_2.LineTo(2, 2); polygon_2.LineTo(2, 1); differenced_1 = (com.epl.geometry.Point)(difference.Execute(point_1, polygon_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty()); NUnit.Framework.Assert.IsTrue(differenced_1 == point_1); } { // point/polygon com.epl.geometry.Point point_1 = new com.epl.geometry.Point(); com.epl.geometry.Polygon polygon_2 = new com.epl.geometry.Polygon(); point_1.SetXY(0, 0); polygon_2.StartPath(1, 0); polygon_2.LineTo(0, 1); polygon_2.LineTo(1, 1); com.epl.geometry.Point differenced_1 = (com.epl.geometry.Point)(difference.Execute(point_1, polygon_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty()); NUnit.Framework.Assert.IsTrue(differenced_1 == point_1); point_1.SetEmpty(); point_1.SetXY(0.5, 0.5); polygon_2.SetEmpty(); polygon_2.StartPath(1, 0); polygon_2.LineTo(0, 1); polygon_2.LineTo(1, 1); differenced_1 = (com.epl.geometry.Point)(difference.Execute(point_1, polygon_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(differenced_1.IsEmpty()); } { // point/envelope com.epl.geometry.Point point_1 = new com.epl.geometry.Point(); com.epl.geometry.Envelope envelope_2 = new com.epl.geometry.Envelope(); point_1.SetXY(0, 0); envelope_2.SetCoords(-1, -1, 1, 1); com.epl.geometry.Point differenced_1 = (com.epl.geometry.Point)(difference.Execute(point_1, envelope_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(differenced_1.IsEmpty()); envelope_2.SetEmpty(); envelope_2.SetCoords(1, 1, 2, 2); differenced_1 = (com.epl.geometry.Point)(difference.Execute(point_1, envelope_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty()); NUnit.Framework.Assert.IsTrue(differenced_1 == point_1); } { // point/polyline com.epl.geometry.Point point_1 = new com.epl.geometry.Point(); com.epl.geometry.Polyline polyline_2 = new com.epl.geometry.Polyline(); point_1.SetXY(0, 0); polyline_2.StartPath(-1, 0); polyline_2.LineTo(1, 0); com.epl.geometry.Point differenced_1 = (com.epl.geometry.Point)(difference.Execute(point_1, polyline_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(differenced_1.IsEmpty()); polyline_2.SetEmpty(); polyline_2.StartPath(1, 0); polyline_2.LineTo(2, 0); differenced_1 = (com.epl.geometry.Point)(difference.Execute(point_1, polyline_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty()); NUnit.Framework.Assert.IsTrue(differenced_1 == point_1); polyline_2.SetEmpty(); polyline_2.StartPath(-1, -1); polyline_2.LineTo(-1, 1); polyline_2.LineTo(1, 1); polyline_2.LineTo(1, -1); differenced_1 = (com.epl.geometry.Point)(difference.Execute(point_1, polyline_2, com.epl.geometry.SpatialReference.Create(4326), null)); NUnit.Framework.Assert.IsTrue(!differenced_1.IsEmpty()); NUnit.Framework.Assert.IsTrue(differenced_1 == point_1); } }