public void SceneFilterShouldReturnTheCorrectAmount()
        {
            const int MAX_MARKERS           = 200;
            const int INITIAL_SCENES_AMOUNT = 20;  // Smaller than MAX_MARKERS
            const int FINAL_SCENES_AMOUNT   = 237; // Greater than MAX_MARKERS

            List <HotScenesController.HotSceneInfo> initialScenes = new List <HotScenesController.HotSceneInfo>();
            List <HotScenesController.HotSceneInfo> finalScenes   = new List <HotScenesController.HotSceneInfo>();

            for (int i = 0; i < FINAL_SCENES_AMOUNT; i++)
            {
                var scene = CreateSceneInfo(Vector2Int.zero);
                if (i < INITIAL_SCENES_AMOUNT)
                {
                    initialScenes.Add(scene);
                }

                finalScenes.Add(scene);
            }

            ScenesFilter filter = new ScenesFilter();

            Assert.AreEqual(INITIAL_SCENES_AMOUNT, filter.Filter(initialScenes, MAX_MARKERS).Count);
            Assert.AreEqual(MAX_MARKERS, filter.Filter(finalScenes, MAX_MARKERS).Count);
        }
Exemple #2
0
        /// <summary>
        /// Set scenes to set markers to. Scenes will be filtered and it coordinates will be extracted.
        /// Then markers will be set and will be shown or hidden according to the current exclusion area.
        /// </summary>
        /// <param name="hotScenes">list of populated scenes</param>
        public void SetMarkers(List <HotScenesController.HotSceneInfo> hotScenes)
        {
            var parcelList = scenesFilter.Filter(hotScenes, maxMarkers);

            ResfreshMarkersPoolLists(parcelList.Count);
            for (int i = 0; i < parcelList.Count && i < usedMarkers.Count; i++)
            {
                SetMarker(usedMarkers[i], parcelList[i]);
            }
        }