Example #1
0
        public static IEnumerable <Region> FindRegions(Point3D p, Map map)
        {
            if (map == null)
            {
                yield return(Map.Internal.DefaultRegion);
            }
            else
            {
                Sector            sector = map.GetSector(p);
                List <RegionRect> list   = sector.RegionRects;
                bool found = false;

                for (int i = 0; i < list.Count; ++i)
                {
                    RegionRect regRect = list[i];

                    if (regRect.Contains(p))
                    {
                        if (!found)
                        {
                            found = true;
                        }

                        yield return(regRect.Region);
                    }
                }

                if (!found)
                {
                    yield return(map.DefaultRegion);
                }
            }
        }
Example #2
0
        public static Region Find(Point3D p, Map map)
        {
            if (map == null)
            {
                return(Map.Internal.DefaultRegion);
            }

            Sector            sector = map.GetSector(p);
            List <RegionRect> list   = sector.RegionRects;

            for (int i = 0; i < list.Count; ++i)
            {
                RegionRect regRect = list[i];

                if (regRect.Contains(p))
                {
                    return(regRect.Region);
                }
            }

            return(map.DefaultRegion);
        }