Beispiel #1
0
        private void BuildNet(WKSEnvelope verificationEnvelope,
                              WKSEnvelope tileEnvelope,
                              double tolerance)
        {
            var xElements = new List <NetElementXY>(_netCache.Count);

            foreach (NetElement elem in _netCache)
            {
                var elemXY = new NetElementXY(elem, _queryPnt);
                xElements.Add(elemXY);
            }

            SortElements(xElements, tolerance,
                         neigbors => AddElements(neigbors, verificationEnvelope, tileEnvelope));
        }
Beispiel #2
0
        private bool HandleInCurrentTile([NotNull] NetElementXY netElem,
                                         WKSEnvelope verificationEnvelope,
                                         WKSEnvelope tileEnvelope)
        {
            double x = netElem.X;
            double y = netElem.Y;

            if (Math.Abs(verificationEnvelope.XMin - tileEnvelope.XMin) < double.Epsilon)
            {
                if (_includeBorderNodes == false &&
                    x < verificationEnvelope.XMin)
                {
                    return(false);
                }
            }
            else if (x <= tileEnvelope.XMin)
            {
                // the point was handled in a previous tile
                return(false);
            }

            if (Math.Abs(tileEnvelope.XMax - verificationEnvelope.XMax) < double.Epsilon)
            {
                if (_includeBorderNodes == false &&
                    x > verificationEnvelope.XMax)
                {
                    return(false);
                }
            }
            else if (x > tileEnvelope.XMax)
            {
                // the point will be handled in a following tile
                return(false);
            }

            if (Math.Abs(verificationEnvelope.YMin - tileEnvelope.YMin) < double.Epsilon)
            {
                if (_includeBorderNodes == false &&
                    y < verificationEnvelope.YMin)
                {
                    return(false);
                }
            }
            else if (y <= tileEnvelope.YMin)
            {
                // the point was handled in a previous tile
                return(false);
            }

            if (Math.Abs(tileEnvelope.YMax - verificationEnvelope.YMax) < double.Epsilon)
            {
                if (_includeBorderNodes == false &&
                    y > verificationEnvelope.YMax)
                {
                    return(false);
                }
            }
            else if (y > tileEnvelope.YMax)
            {
                // the point will be handled in a following tile
                return(false);
            }

            return(true);
        }