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);
        }
Пример #2
0
        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);
        }
Пример #3
0
        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);
        }