예제 #1
0
 public void TestFillBasicBoundary()
 {
     Map map = new Map(2, 2);
     map.SetTerrain(1, 0, maskTerrain);
     Rectangle expectedRect = new Rectangle(0, 0, 2, 2);
     Rectangle rect = map.Fill(0, 1, fillTerrain);
     HashSet<PointI2D> fillBoundary = map.FillBoundary;
     // diagonal fill boundary
     Assert.AreEqual(2, fillBoundary.Count);
 }
예제 #2
0
        public void TestBasicFill()
        {
            Map map = new Map(2, 2);
            Rectangle expectedRect = new Rectangle(0, 0, 2, 2);
            Rectangle rect = map.Fill(0, 1, fillTerrain);
            Assert.AreEqual(expectedRect, rect);

            foreach (Terrain terrain in map.GetTerrainData())
            {
                Assert.AreEqual(fillTerrain, terrain);
            }
        }
예제 #3
0
        public MainPage()
        {
            map = new Map(20, 60);
            CreateTestLibrary();

            mapView = new MapView();
            mapView.Map = map;

            InitializeComponent();
            LibraryView.Library = testLibrary;
            LibraryView.PropertyChanged += LibraryView_OnPropertyChanged;

            MapCanvas.Width = mapView.Width;
            MapCanvas.Height = mapView.Height;
            mapViewFeaturesTree = new QuadTree<Core.TextBlock>(MapCanvas.Width, MapCanvas.Height);
        }
예제 #4
0
 public void TestFillComplexBoundary()
 {
     Map map = new Map(5, 5);
     // mask top and bottom rows
     for(int i=0; i<5; i++)
     {
         map.SetTerrain(i, 0, maskTerrain);
         map.SetTerrain(i, 4, maskTerrain);
     }
     // mask sides
     for(int i=1; i<4; i++)
     {
         map.SetTerrain(0, i, maskTerrain);
         map.SetTerrain(4, i, maskTerrain);
     }
     // mask center inset
     map.SetTerrain(1, 2, maskTerrain);
     Rectangle rect = map.Fill(1, 1, fillTerrain);
     Assert.AreEqual(8, map.FillBoundary.Count);
     Assert.IsTrue(map.FillBoundary.Contains(new PointI2D(1, 1)));
     Assert.IsTrue(map.FillBoundary.Contains(new PointI2D(3, 2)));
     Assert.IsTrue(map.FillBoundary.Contains(new PointI2D(1, 3)));
 }
예제 #5
0
        public void TestLargeFill()
        {
            Map map = new Map(50, 100);
            Rectangle expectedRect = new Rectangle(0, 0, 50, 100);
            Rectangle rect = map.Fill(5, 5, fillTerrain);
            Assert.AreEqual(expectedRect, rect);

            foreach (Terrain terrain in map.GetTerrainData())
            {
                Assert.AreEqual(fillTerrain, terrain);
            }
        }
예제 #6
0
        public void TestSimpleMaskFill()
        {
            Map map = new Map(2, 2);
            map.SetTerrain(1, 0, maskTerrain);
            Rectangle expectedRect = new Rectangle(0, 0, 2, 2);
            Rectangle rect = map.Fill(0, 1, fillTerrain);
            Assert.AreEqual(expectedRect, rect);
            Assert.AreEqual(maskTerrain, map.GetTerrain(1, 0));

            Assert.AreEqual(fillTerrain, map.GetTerrain(1, 1));
            Assert.AreEqual(fillTerrain, map.GetTerrain(0, 0));
        }