Пример #1
0
        public void MultipleSelectionTestViaCoordinatesNoFallOffPolicy()
        {
            // todo write
            var mapControl = new MapControl {
                Map = { Size = new Size(1000, 1000) }
            };
            var lineStringEditor = new LineStringInteractor(new VectorLayer {
                Map = mapControl.Map
            }, sampleFeature, GetStyle(), null);

            var trackerFeatureAtCoordinate10 = lineStringEditor.GetTrackerAtCoordinate(new Coordinate(10, 0));

            trackerFeatureAtCoordinate10.Selected = true;

            var trackerFeatureAtCoordinate30 = lineStringEditor.GetTrackerAtCoordinate(new Coordinate(30, 0));

            trackerFeatureAtCoordinate30.Selected = true;
            lineStringEditor.FallOffPolicy        = new NoFallOffPolicy();
            lineStringEditor.Start();
            lineStringEditor.MoveTracker(trackerFeatureAtCoordinate30, 0, 5);

            // both tracker at 10 and 30 is moved
            Assert.AreEqual(5.0, trackerFeatureAtCoordinate30.Geometry.Coordinates[0].Y);
            Assert.AreEqual(5.0, trackerFeatureAtCoordinate10.Geometry.Coordinates[0].Y);
            lineStringEditor.Stop();
        }
Пример #2
0
        public void AllTrackerTest()
        {
            var mapControl = new MapControl {
                Map = { Size = new Size(1000, 1000) }
            };
            var lineStringEditor = new LineStringInteractor(new VectorLayer {
                Map = mapControl.Map
            }, sampleFeature, GetStyle(), null);

            var trackerFeature = lineStringEditor.GetTrackerAtCoordinate(new Coordinate(15, 0));

#if DEBUG
            Assert.That(trackerFeature == lineStringEditor.AllTracker, Is.True);
#endif
            lineStringEditor.Start();
            lineStringEditor.MoveTracker(trackerFeature, 0.0, 5.0);

            Assert.AreEqual(5.0, lineStringEditor.TargetFeature.Geometry.Coordinates[0].Y);
            Assert.AreEqual(5.0, lineStringEditor.TargetFeature.Geometry.Coordinates[1].Y);
            Assert.AreEqual(5.0, lineStringEditor.TargetFeature.Geometry.Coordinates[2].Y);
            Assert.AreEqual(5.0, lineStringEditor.TargetFeature.Geometry.Coordinates[3].Y);
            Assert.AreEqual(5.0, lineStringEditor.TargetFeature.Geometry.Coordinates[4].Y);

            lineStringEditor.Stop();
        }
Пример #3
0
        public void MoveTestWithLinearFalOffPolicy()
        {
            var lineStringEditor = new LineStringInteractor(null, sampleFeature, GetStyle(), null);

            lineStringEditor.FallOffPolicy = new LinearFallOffPolicy();
            var tracker = lineStringEditor.Trackers[2]; // 20,0

            tracker.Selected = true;
            lineStringEditor.Start();
            lineStringEditor.MoveTracker(tracker, 0, 5);

            // todo redesign .Stop
            //lineStringMutator.Stop();
            //Assert.AreEqual(20, sampleFeature.Geometry.Coordinates[2].X);
            //Assert.AreEqual(5, sampleFeature.Geometry.Coordinates[2].Y);
        }
Пример #4
0
        public void MoveTrackerWithSelection()
        {
            var            lineStringEditor = new LineStringInteractor(null, sampleFeature, GetStyle(), null);
            TrackerFeature tracker          = lineStringEditor.Trackers[2]; // 20,0

            tracker.Selected = true;
            lineStringEditor.Start();
            lineStringEditor.MoveTracker(tracker, 0, 5);

            Assert.AreEqual(20, tracker.Geometry.Coordinates[0].X);
            Assert.AreEqual(5, tracker.Geometry.Coordinates[0].Y);

            // check if changed coordinate is NOT set to sampleFeature
            Assert.AreEqual(20, sampleFeature.Geometry.Coordinates[2].X);
            Assert.AreEqual(0, sampleFeature.Geometry.Coordinates[2].Y);

            // todo redesign .Stop
            //lineStringMutator.Stop();
            //// check if changed coordinate IS set to sampleFeature
            //Assert.AreEqual(20, sampleFeature.Geometry.Coordinates[2].X);
            //Assert.AreEqual(5, sampleFeature.Geometry.Coordinates[2].Y);
        }