Beispiel #1
0
        public void PointMutatorCreationWithoutMapControlTest()
        {
            MapControl mapControl = new MapControl();

            mapControl.Map.ZoomToFit(new Envelope(new Coordinate(0, 0), new Coordinate(1000, 1000)));
            ICoordinateConverter coordinateConverter = new CoordinateConverter(mapControl);
            LineStringEditor     lineStringMutator   = new LineStringEditor(coordinateConverter, null, sampleFeature, GetStyle(), null);

            Assert.AreEqual(null, lineStringMutator.TargetFeature);
            Assert.AreNotEqual(null, lineStringMutator.SourceFeature);
            // There are no default focused trackers
            IList <ITrackerFeature> trackers = lineStringMutator.GetFocusedTrackers();

            Assert.AreEqual(0, trackers.Count);

            ITrackerFeature tracker = lineStringMutator.GetTrackerByIndex(2);

            Assert.AreNotEqual(null, tracker);
            Assert.AreEqual(20.0, tracker.Geometry.Coordinates[0].X);
            Assert.AreEqual(0.0, tracker.Geometry.Coordinates[0].Y);

            lineStringMutator.Start();
            lineStringMutator.Select(tracker, true);

            trackers = lineStringMutator.GetFocusedTrackers();
            Assert.AreEqual(1, trackers.Count);
            Assert.AreNotEqual(null, lineStringMutator.TargetFeature);
            Assert.AreNotEqual(lineStringMutator.SourceFeature, lineStringMutator.TargetFeature);
        }
Beispiel #2
0
        public void SelectionTestViaCoordinates()
        {
            MapControl mapControl = new MapControl {
                Map = { Size = new Size(1000, 1000) }
            };
            ICoordinateConverter coordinateConverter        = new CoordinateConverter(mapControl);
            LineStringEditor     lineStringMutator          = new LineStringEditor(coordinateConverter, null, sampleFeature, GetStyle(), null);
            ITrackerFeature      trackerFeatureAtCoordinate = lineStringMutator.GetTrackerAtCoordinate(new Coordinate(20, 0));
            ITrackerFeature      trackerFeatureAtIndex      = lineStringMutator.GetTrackerByIndex(2);

            Assert.AreEqual(trackerFeatureAtIndex, trackerFeatureAtCoordinate);
            trackerFeatureAtCoordinate.Selected = true;
            Assert.AreEqual(1, lineStringMutator.GetFocusedTrackers().Count);
        }
Beispiel #3
0
        public void MultipleSelectionTestViaCoordinatesNullFallOff()
        {
            // todo write
            MapControl mapControl = new MapControl {
                Map = { Size = new Size(1000, 1000) }
            };
            ICoordinateConverter coordinateConverter          = new CoordinateConverter(mapControl);
            LineStringEditor     lineStringMutator            = new LineStringEditor(coordinateConverter, null, sampleFeature, GetStyle(), null);
            ITrackerFeature      trackerFeatureAtCoordinate10 = lineStringMutator.GetTrackerAtCoordinate(new Coordinate(10, 0));

            trackerFeatureAtCoordinate10.Selected = true;
            ITrackerFeature trackerFeatureAtCoordinate30 = lineStringMutator.GetTrackerAtCoordinate(new Coordinate(30, 0));

            trackerFeatureAtCoordinate30.Selected = true;
            Assert.AreEqual(2, lineStringMutator.GetFocusedTrackers().Count);
            lineStringMutator.Start();
            lineStringMutator.MoveTracker(trackerFeatureAtCoordinate30, 0, 5, null);
            // only tracker at 10 is moved
            Assert.AreEqual(5.0, trackerFeatureAtCoordinate30.Geometry.Coordinates[0].Y);
            Assert.AreEqual(0.0, trackerFeatureAtCoordinate10.Geometry.Coordinates[0].Y);
            lineStringMutator.Stop();
        }