Пример #1
0
        public void PointMutatorCreationWithMapControlTest()
        {
            var mapControl = new MapControl {
                Map = { Size = new Size(1000, 1000) }
            };
            var pointEditor = new PointInteractor(new VectorLayer {
                Map = mapControl.Map
            }, sampleFeature, GetStyle(Pens.Red), null);

            Assert.AreEqual(null, pointEditor.TargetFeature);
            Assert.AreNotEqual(null, pointEditor.SourceFeature);

            var tracker = pointEditor.GetTrackerAtCoordinate(new Coordinate(0, 0));

            Assert.AreNotEqual(null, tracker);

            pointEditor.Start();
            pointEditor.MoveTracker(tracker, 5.0, 5.0);
            pointEditor.Stop();

            Assert.AreEqual(5.0, tracker.Geometry.Coordinates[0].X);
            Assert.AreEqual(5.0, tracker.Geometry.Coordinates[0].Y);
            Assert.AreEqual(5.0, sampleFeature.Geometry.Coordinates[0].X);
            Assert.AreEqual(5.0, sampleFeature.Geometry.Coordinates[0].Y);
        }
Пример #2
0
        public void SelectionTest()
        {
            var pointEditor = new PointInteractor(null, sampleFeature, GetStyle(Pens.Red), null);
            var tracker     = pointEditor.Trackers[0];

            // The tracker has focus by default; is this ok
            Assert.AreEqual(true, tracker.Selected);

            pointEditor.SetTrackerSelection(tracker, false);
            Assert.AreEqual(false, tracker.Selected);
        }
Пример #3
0
        public void PointMutatorCreationWithoutMapControlTest()
        {
            var pointEditor = new PointInteractor(null, sampleFeature, GetStyle(Pens.Red), null);

            Assert.AreEqual(null, pointEditor.TargetFeature);
            Assert.AreNotEqual(null, pointEditor.SourceFeature);

            // The tracker has focus by default; is this ok
            var trackers = pointEditor.Trackers.Where(t => t.Selected);

            Assert.AreEqual(1, trackers.Count());

            var tracker = pointEditor.Trackers[0];

            Assert.AreNotEqual(null, tracker);

            pointEditor.Start();
            Assert.AreNotEqual(null, pointEditor.TargetFeature);
            Assert.AreNotEqual(pointEditor.SourceFeature, pointEditor.TargetFeature);
        }