public bool IsNonNested() { BuildQuadtree(); for (int i = 0; i < _rings.Count; i++) { LinearRing innerRing = (LinearRing)_rings[i]; Coordinates innerRingPts = innerRing.GetCoordinates(); ArrayList results = _quadtree.Query(innerRing.GetEnvelopeInternal()); //System.out.println(results.size()); for (int j = 0; j < results.Count; j++) { LinearRing searchRing = (LinearRing)results[j]; Coordinates searchRingPts = searchRing.GetCoordinates(); if (innerRing == searchRing) { continue; } if (!innerRing.GetEnvelopeInternal().Intersects(searchRing.GetEnvelopeInternal())) { continue; } Coordinate innerRingPt = IsValidOp.FindPtNotNode(innerRingPts, searchRing, _graph); if (innerRingPt == null) { throw new InvalidOperationException("Unable to find a ring point not a node of the search ring."); } //Coordinate innerRingPt = innerRingPts[0]; bool isInside = _cga.IsPointInRing(innerRingPt, searchRingPts); if (isInside) { _nestedPt = innerRingPt; return(false); } } } return(true); }
private bool IsInside(LinearRing innerRing, LinearRing searchRing) { Coordinates innerRingPts = innerRing.GetCoordinates(); Coordinates searchRingPts = searchRing.GetCoordinates(); if (!innerRing.GetEnvelopeInternal().Intersects(searchRing.GetEnvelopeInternal())) { return(false); } Coordinate innerRingPt = IsValidOp.FindPtNotNode(innerRingPts, searchRing, _graph); //Assert.isTrue(innerRingPt != null, "Unable to find a ring point not a node of the search ring"); bool isInside = _cga.IsPointInRing(innerRingPt, searchRingPts); if (isInside) { _nestedPt = innerRingPt; return(true); } return(false); }
public bool IsNonNested() { for (int i = 0; i < _rings.Count; i++) { LinearRing innerRing = (LinearRing)_rings[i]; Coordinates innerRingPts = innerRing.GetCoordinates(); for (int j = 0; j < _rings.Count; j++) { LinearRing searchRing = (LinearRing)_rings[j]; Coordinates searchRingPts = searchRing.GetCoordinates(); if (innerRing == searchRing) { continue; } if (!innerRing.GetEnvelopeInternal().Intersects(searchRing.GetEnvelopeInternal())) { continue; } Coordinate innerRingPt = IsValidOp.FindPtNotNode(innerRingPts, searchRing, _graph); //Assert.isTrue(innerRingPt != null, "Unable to find a ring point not a node of the search ring"); //Coordinate innerRingPt = innerRingPts[0]; bool isInside = _cga.IsPointInRing(innerRingPt, searchRingPts); if (isInside) { _nestedPt = innerRingPt; return(false); } } } return(true); }
///<summary> /// Returns sTopologyValidationError object available if IsValid() returns false or null if no error exists. ///</summary> ///<returns>Returns string corresponding to error message if IsValid fails.</returns> public virtual TopologyValidationError GetValidOpError() { IsValidOp isValidOp = new IsValidOp(this); return isValidOp.GetValidationError(); }
///<summary> /// Returns false if the Geometry is invlaid. ///</summary> ///<remarks>Subclasses provide their own definition of "valid". /// If this Geometry is empty, returns true.</remarks> ///<returns>Returns true if this Geometry is valid.</returns> public virtual bool IsValid() { IsValidOp isValidOp = new IsValidOp(this); return isValidOp.IsValid(); }