private List <PointOfInterestGroup> GetPlaces()
        {
            List <PointOfInterest> pointsOfInterest = GetPointsOfInterest();

            if (pointsOfInterest == null || pointsOfInterest.Count == 0)
            {
                return(null);
            }

            List <PointOfInterestGroup> pointsOfInterestGroup = new List <PointOfInterestGroup>();

            foreach (PointOfInterest pointOfInterest in pointsOfInterest)
            {
                List <PlaceCollection> places = GetPlaceCluster(pointOfInterest);

                if (places != null)
                {
                    PointOfInterestGroup pointOfInterestGroup = new PointOfInterestGroup(pointOfInterest, places);
                    pointOfInterestGroup.CachePlaces();
                    pointsOfInterestGroup.Add(pointOfInterestGroup);
                }
            }

            return(pointsOfInterestGroup);
        }
        private bool Internal_PlaceHasTrivia(Place place)
        {
            bool evaluation = false;

            for (int i = 0; i < pointsOfInterestGroup.Count; i++)
            {
                PointOfInterestGroup pointOfInterest = pointsOfInterestGroup[i];

                for (int j = 0; j < pointOfInterest.placeCollectionCount; j++)
                {
                    PlaceCollection placeCollection = pointOfInterest.GetPlaceCollection(j);

                    if (placeCollection == null)
                    {
                        continue;
                    }

                    if (placeCollection.GetPlace() == place)
                    {
                        evaluation = place.trivia != null;
                        break;
                    }
                }
            }

            return(evaluation);
        }
        private Place[] Internal_GetAllBuildings()
        {
            List <Place> buildings = new List <Place>();

            for (int i = 0; i < pointsOfInterestGroup.Count; i++)
            {
                PointOfInterestGroup pointOfInterest = pointsOfInterestGroup[i];

                for (int j = 0; j < pointOfInterest.placeCollectionCount; j++)
                {
                    PlaceCollection placeCollection = pointOfInterest.GetPlaceCollection(j);

                    if (placeCollection == null)
                    {
                        continue;
                    }

                    Place place = placeCollection.GetPlace();

                    if (place != null)
                    {
                        buildings.Add(place);
                    }
                }
            }

            return(buildings.ToArray());
        }
        private Place Internal_GetBuildingFromRoom(Room room)
        {
            Place building = null;

            for (int i = 0; i < pointsOfInterestGroup.Count; i++)
            {
                PointOfInterestGroup pointOfInterest = pointsOfInterestGroup[i];

                for (int j = 0; j < pointOfInterest.placeCollectionCount; j++)
                {
                    PlaceCollection placeCollection = pointOfInterest.GetPlaceCollection(j);

                    if (placeCollection == null)
                    {
                        continue;
                    }

                    if (placeCollection.HasRoom(room))
                    {
                        building = placeCollection.GetPlace();
                        break;
                    }
                }
            }

            return(building);
        }
 private void SearchByCategory(string keyword, SearchCategory category, bool deepSearch)
 {
     for (int i = 0; i < pointsOfInterestGroup.Count; i++)
     {
         PointOfInterestGroup pointOfInterestGroup = pointsOfInterestGroup[i];
         pointOfInterestGroup.Search(keyword, i, searchKeys, category, deepSearch);
     }
 }
        private Location Internal_GetLocationFromSearch(int index, out PointOfInterest pointOfInterest)
        {
            pointOfInterest = null;

            if (index < 0 || searchKeys == null || searchKeys.Count == 0 || index >= searchKeys.Count)
            {
                return(null);
            }

            SearchKey searchItem = searchKeys[index];

            if (pointsOfInterestGroup == null || pointsOfInterestGroup.Count == 0 || searchItem.poiIndex >= pointsOfInterestGroup.Count || searchItem.poiIndex < 0)
            {
                return(null);
            }

            PointOfInterestGroup pointOfInterestGroup = pointsOfInterestGroup[searchItem.poiIndex];

            if (pointOfInterestGroup == null)
            {
                return(null);
            }

            pointOfInterest = pointOfInterestGroup.pointOfInterest;

            PlaceCollection placeCollection = pointOfInterestGroup.GetPlaceCollection(searchItem.placeIndex);
            Location        location        = null;

            if (placeCollection == null)
            {
                return(null);
            }

            int locationIndex = searchItem.locationIndex - 1;

            if (locationIndex == -1)
            {
                location = placeCollection.GetPlaceLocation();
            }
            else
            {
                location = placeCollection.GetRoomLocation(locationIndex);
            }

            return(location);
        }