///<summary>
 /// Creates a new locator for a given <see cref="IGeometry"/>.
 ///</summary>
 /// <param name="g">the Geometry to locate in</param>
 public IndexedPointInAreaLocator(IGeometry g)
 {
     if (!(g is IPolygonal))
     {
         throw new ArgumentException("Argument must be Polygonal");
     }
     _index = new IntervalIndexedGeometry(g);
 }
Exemple #2
0
 private void CreateIndex()
 {
     if (_index == null)
     {
         _index = new IntervalIndexedGeometry(_geom);
         // no need to hold onto geom
         _geom = null;
     }
 }
Exemple #3
0
        /// <summary>
        /// Determines the <see cref="Location"/> of a point in an areal <see cref="Geometry"/>.
        /// </summary>
        /// <param name="p">The point to test</param>
        /// <returns>The location of the point in the geometry
        /// </returns>
        public Location Locate(Coordinate p)
        {
            if (_index == null)
            {
                _index = new IntervalIndexedGeometry(_geom);
                // no need to hold onto geom
                _geom = null;
            }
            var rcc = new RayCrossingCounter(p);

            var visitor = new SegmentVisitor(rcc);

            _index.Query(p.Y, p.Y, visitor);

            /*
             * // MD - slightly slower alternative
             * List segs = index.query(p.y, p.y);
             * countSegs(rcc, segs);
             */

            return(rcc.Location);
        }
Exemple #4
0
 private void BuildIndex(IGeometry g)
 {
     _index = new IntervalIndexedGeometry(g);
 }