private static bool DetermineIfPolygonIsOuter(LocationCollection poly, List <LocationCollection> LoopList, int currentIndex)
        {
            //Assumption is that all points are inside.
            //therefore it is necessary to only test one point
            bool     IsInside = false;
            bool     FoundPolyOutsideThisOne = false;
            Location point = poly[0];

            for (int i = 0; i < LoopList.Count; i++)
            {
                if (i != currentIndex) // make sure to exclude current loop from checking
                {
                    LocationCollection loop = LoopList[i];
                    IsInside = PolygonLocationChecking.IsLocationInComplexPolygon(loop, null, point);
                    if (IsInside == true)
                    {
                        FoundPolyOutsideThisOne = true;
                        break;
                    }
                }
            }
            if (FoundPolyOutsideThisOne == true)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }
        public string GetActiveLocationId(Location point, string Layer)
        {
            string Id = null;

            if (Layer != null)
            {
                if (polygonDictionary == null)
                {
                    this.InitializeShapes(Layer);
                }
                if (polygonDictionary != null)
                {
                    List <MapAnalyticalPolygon> activeLayerData = polygonDictionary[Layer];
                    if (activeLayerData != null)
                    {
                        foreach (MapAnalyticalPolygon ap in activeLayerData)
                        {
                            bool IsInside = PolygonLocationChecking.IsLocationInComplexPolygon(ap.OuterLoop, ap.InnerLoops, point);
                            if (IsInside)
                            {
                                Id = ap.ObjectId;
                            }
                        }
                    }
                }
            }
            return(Id);
        }