/// <summary>
        /// Delegate that's called whenever the index finds a point that's inside the query window
        /// </summary>
        /// <param name="item">The item to process (expected to be some sort of <c>PointFeature</c>)</param>
        /// <returns>True (always), indicating that the query should continue.</returns>
        private bool OnPointFound(ISpatialObject item)
        {
            PointFeature p = (PointFeature)item;

            if (m_ClosedShape.IsOverlap(p))
            {
                m_Points.Add(p);
            }

            return(true);
        }
Beispiel #2
0
        /// <summary>
        /// Does any edge of this closed shape intersect the edge of another shape.
        /// This assumes that a window-window overlap has already been checked for.
        /// </summary>
        /// <param name="that">The closed shape to compare with (preferably the one
        /// with the smaller spatial extent).
        /// </param>
        /// <returns>True if the edges of the shapes intersect</returns>
        bool IsIntersect(ClosedShape that)
        {
            IPointGeometry[] data = this.Data;

            for (int i = 1; i < data.Length; i++)
            {
                if (that.IsOverlap(data[i - 1], data[i]))
                {
                    return(true);
                }
            }

            return(false);
        }
        /// <summary>
        /// Delegate that's called whenever the index finds text with a window that overlaps the query window
        /// </summary>
        /// <param name="item">The item to process (expected to be some sort of <c>TextFeature</c>)</param>
        /// <returns>True (always), indicating that the query should continue.</returns>
        private bool OnTextFound(ISpatialObject item)
        {
            TextFeature text = (TextFeature)item;

            // Get the outline for the text
            IPosition[] outline = text.TextGeometry.Outline;

            // If any corner of the text outline is inside the closed shape (or any edge of
            // the outline intersects), remember the text in the results
            ClosedShape cs = new ClosedShape(outline);

            if (cs.IsOverlap(m_ClosedShape))
            {
                m_Result.Add(text);
            }

            return(true);
        }
Beispiel #4
0
        /// <summary>
        /// Does this closed shape overlap another closed shape?
        /// </summary>
        /// <param name="that">The closed shape to compare with</param>
        /// <returns>True if the shapes overlap</returns>
        /// <remarks>It should be more efficient to make <c>this</c> closed shape the
        ///	smaller one.</remarks>
        internal bool IsOverlap(ClosedShape that)
        {
            // The window of this shape must overlap the window of the other shape
            if (!m_Extent.IsOverlap(that.Extent))
            {
                return(false);
            }

            // If any position in this shape falls inside the other one, we've got overlap.
            foreach (IPointGeometry p in this.Data)
            {
                if (that.IsOverlap(p))
                {
                    return(true);
                }
            }

            // NONE of the positions in this shape fall inside the
            // other shape. So check if any segment intersects the other shape.

            // To try to maximize efficiency, compare the shape that
            // has the larger spatial extent. That way, we should be
            // able to eliminate the max number of segments with a
            // simple segment-window test.

            double areaThis = this.Extent.Width * this.Extent.Height;
            double areaThat = that.Extent.Width * that.Extent.Height;

            if (areaThis > areaThat)
            {
                return(this.IsIntersect(that));
            }
            else
            {
                return(that.IsIntersect(this));
            }
        }
Beispiel #5
0
        /// <summary>
        /// Does any edge of this closed shape intersect the edge of another shape.
        /// This assumes that a window-window overlap has already been checked for.
        /// </summary>
        /// <param name="that">The closed shape to compare with (preferably the one
        /// with the smaller spatial extent).
        /// </param>
        /// <returns>True if the edges of the shapes intersect</returns>
        bool IsIntersect(ClosedShape that)
        {
            IPointGeometry[] data = this.Data;

            for (int i=1; i<data.Length; i++)
            {
                if (that.IsOverlap(data[i-1], data[i]))
                    return true;
            }

            return false;
        }
Beispiel #6
0
        /// <summary>
        /// Does this closed shape overlap another closed shape?
        /// </summary>
        /// <param name="that">The closed shape to compare with</param>
        /// <returns>True if the shapes overlap</returns>
        /// <remarks>It should be more efficient to make <c>this</c> closed shape the
        ///	smaller one.</remarks>
        internal bool IsOverlap(ClosedShape that)
        {
            // The window of this shape must overlap the window of the other shape
            if (!m_Extent.IsOverlap(that.Extent))
                return false;

            // If any position in this shape falls inside the other one, we've got overlap.
            foreach (IPointGeometry p in this.Data)
            {
                if (that.IsOverlap(p))
                    return true;
            }

            // NONE of the positions in this shape fall inside the
            // other shape. So check if any segment intersects the other shape.

            // To try to maximize efficiency, compare the shape that
            // has the larger spatial extent. That way, we should be
            // able to eliminate the max number of segments with a
            // simple segment-window test.

            double areaThis = this.Extent.Width * this.Extent.Height;
            double areaThat = that.Extent.Width * that.Extent.Height;

            if (areaThis > areaThat)
                return this.IsIntersect(that);
            else
                return that.IsIntersect(this);
        }
        /// <summary>
        /// Delegate that's called whenever the index finds text with a window that overlaps the query window
        /// </summary>
        /// <param name="item">The item to process (expected to be some sort of <c>TextFeature</c>)</param>
        /// <returns>True (always), indicating that the query should continue.</returns>
        private bool OnTextFound(ISpatialObject item)
        {
            TextFeature text = (TextFeature)item;

            // Get the outline for the text
            IPosition[] outline = text.TextGeometry.Outline;

            // If any corner of the text outline is inside the closed shape (or any edge of
            // the outline intersects), remember the text in the results
            ClosedShape cs = new ClosedShape(outline);
            if (cs.IsOverlap(m_ClosedShape))
                m_Result.Add(text);

            return true;
        }