Ejemplo n.º 1
0
        public void PanTwoRightOneLeftUp()
        {
            ttr = new TestTileRenderer();
            tm  = new TileDrawingManager(ttr);

            tm.UpdateViewportSize(new Size(750, 750));

            ttr.ClearLog();
            tm.UpdateVisibleRegion(new System.Numerics.Vector3(251, 0, 0));
            Assert.AreEqual(ttr.Impressions.Count, 4);

            ttr.ClearLog();
            tm.UpdateVisibleRegion(new System.Numerics.Vector3(501, 0, 0));
            Assert.AreEqual(ttr.Impressions.Count, 4);

            ttr.ClearLog();
            tm.UpdateVisibleRegion(new System.Numerics.Vector3(499, 0, 0));

            Assert.AreEqual(tm.drawnLeftTileColumn, 1);
            Assert.AreEqual(tm.drawnRightTileColumn, 3);
            Assert.AreEqual(tm.drawnTopTileRow, 0);
            Assert.AreEqual(tm.drawnBottomTileRow, 2);

            ttr.ClearLog();
            tm.UpdateVisibleRegion(new System.Numerics.Vector3(251.0f, 251.0f, 0f));
            Assert.AreEqual(ttr.Impressions.Count, 4);
        }
Ejemplo n.º 2
0
        public void PanRightThenLeft()
        {
            PanRightCrossingThreshold();

            ttr.ClearLog();

            tm.UpdateVisibleRegion(new System.Numerics.Vector3(0.0f, 0f, 0f));

            Assert.AreEqual(ttr.Impressions.Count, 4);

            //Column 1 redraw (since it was cleared above)
            Assert.AreEqual(ttr.Impressions[0].tileRow, 0);
            Assert.AreEqual(ttr.Impressions[0].tileColumn, 0);
            Assert.AreEqual(ttr.Impressions[1].tileRow, 1);
            Assert.AreEqual(ttr.Impressions[1].tileColumn, 0);
            Assert.AreEqual(ttr.Impressions[2].tileRow, 2);
            Assert.AreEqual(ttr.Impressions[2].tileColumn, 0);

            Assert.AreEqual(ttr.Impressions[3].type, OperationType.Clear);
            Assert.AreEqual(ttr.Impressions[3].rect, new Rect()
            {
                X = 0, Y = 0, Width = 1000, Height = 750
            });

            Assert.AreEqual(tm.drawnLeftTileColumn, 0);
            Assert.AreEqual(tm.drawnRightTileColumn, 2);
        }
Ejemplo n.º 3
0
        public void ValuesChanged(InteractionTracker sender, InteractionTrackerValuesChangedArgs args)
        {
            try
            {
                string diags = string.Empty;

                if (lastTrackerScale == args.Scale)
                {
                    diags = visibleRegionManager.UpdateVisibleRegion(sender.Position);
                }
                else
                {
                    // Don't run tilemanager during a zoom
                    // TODO need custom logic here eg for zoom out
                    zooming = true;
                }

                lastTrackerScale = args.Scale;

                hud.Display = $"X:{sender.Position.X:00000.00} Y:{sender.Position.Y:00000.00} Scale:{sender.Scale:00000.00} " + diags;
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 4
0
        public void PanRightCrossingThreshold()
        {
            ttr = new TestTileRenderer();
            tm  = new TileDrawingManager(ttr);

            tm.UpdateViewportSize(new Size(750, 750));

            ttr.ClearLog();

            tm.UpdateVisibleRegion(new System.Numerics.Vector3(251.0f, 0f, 0f));

            Assert.AreEqual(ttr.Impressions.Count, 4);

            //Column 5
            Assert.AreEqual(ttr.Impressions[0].tileRow, 0);
            Assert.AreEqual(ttr.Impressions[0].tileColumn, 3);
            Assert.AreEqual(ttr.Impressions[1].tileRow, 1);
            Assert.AreEqual(ttr.Impressions[1].tileColumn, 3);
            Assert.AreEqual(ttr.Impressions[2].tileRow, 2);
            Assert.AreEqual(ttr.Impressions[2].tileColumn, 3);

            Assert.AreEqual(ttr.Impressions[3].type, OperationType.Clear);
            Assert.AreEqual(ttr.Impressions[3].rect, new Rect()
            {
                X = 250, Y = 0, Width = 1000, Height = 750
            });

            Assert.AreEqual(tm.drawnLeftTileColumn, 1);
            Assert.AreEqual(tm.drawnRightTileColumn, 3);
        }
Ejemplo n.º 5
0
        public void PanUpLessThanThreshold()
        {
            ttr = new TestTileRenderer();
            tm  = new TileDrawingManager(ttr);

            tm.UpdateViewportSize(new Size(750, 750));
            tm.UpdateVisibleRegion(new System.Numerics.Vector3(0.0f, 251.0f, 0f));
            tm.UpdateVisibleRegion(new System.Numerics.Vector3(0.0f, 501.0f, 0f));
            tm.UpdateVisibleRegion(new System.Numerics.Vector3(0.0f, 752.0f, 0f));

            ttr.ClearLog();

            tm.UpdateVisibleRegion(new System.Numerics.Vector3(0.0f, 751.0f, 0f));

            Assert.AreEqual(ttr.Impressions.Count, 0);

            Assert.AreEqual(tm.drawnTopTileRow, 3);
            Assert.AreEqual(tm.drawnBottomTileRow, 5);
        }
Ejemplo n.º 6
0
 public void ValuesChanged(InteractionTracker sender, InteractionTrackerValuesChangedArgs args)
 {
     try
     {
         var diags = visibleRegionManager.UpdateVisibleRegion(sender.Position);
         hud.Display = $"X:{sender.Position.X:00000.00} Y:{sender.Position.Y:00000.00} " + diags;
     }
     catch (Exception ex)
     {
         Debug.WriteLine(ex.Message);
     }
 }
Ejemplo n.º 7
0
        public void PanLeftLessThanThreshold()
        {
            ttr = new TestTileRenderer();
            tm  = new TileDrawingManager(ttr);

            tm.UpdateViewportSize(new Size(750, 750));

            tm.UpdateVisibleRegion(new System.Numerics.Vector3(251.0f, 0f, 0f));
            tm.UpdateVisibleRegion(new System.Numerics.Vector3(501.0f, 0f, 0f));
            tm.UpdateVisibleRegion(new System.Numerics.Vector3(755.0f, 0f, 0f));

            ttr.ClearLog();

            tm.UpdateVisibleRegion(new System.Numerics.Vector3(753.0f, 0f, 0f));
            //tm.UpdateVisibleRegion(new System.Numerics.Vector3(251.0f, 0f, 0f));

            Assert.AreEqual(ttr.Impressions.Count, 0);

            Assert.AreEqual(tm.drawnLeftTileColumn, 3);
            Assert.AreEqual(tm.drawnRightTileColumn, 5);
        }
Ejemplo n.º 8
0
        public void PanRightCrossingThresholdContinue()
        {
            ttr = new TestTileRenderer();
            tm  = new TileDrawingManager(ttr);

            PanRightCrossingThreshold();
            ttr.ClearLog();

            tm.UpdateVisibleRegion(new System.Numerics.Vector3(252.0f, 0f, 0f));

            Assert.AreEqual(ttr.Impressions.Count, 0);
        }