Beispiel #1
0
        private void RestoreSnapshot(AnnotationSnapshot snapshot)
        {
            CurrentAnnotationOverlay.TrackShapeLayer.InternalFeatures.Clear();
            CurrentAnnotationOverlay.TrackShapeLayer.FeatureIdsToExclude.Clear();
            CurrentEditOverlay.EditShapesLayer.InternalFeatures.Clear();

            if (MarkerHelper.CurrentMarkerOverlay != null)
            {
                MarkerHelper.CurrentMarkerOverlay.Markers.Clear();
            }

            foreach (var feature in snapshot.AnnotationFeatures)
            {
                CurrentAnnotationOverlay.TrackShapeLayer.InternalFeatures.Add(feature.Id, feature.CloneDeep(ReturningColumnsType.AllColumns));
            }

            foreach (var featureId in snapshot.FeatureIdsToExclude)
            {
                CurrentAnnotationOverlay.TrackShapeLayer.FeatureIdsToExclude.Add(featureId);
            }

            foreach (var feature in snapshot.EditingVectorFeatures)
            {
                CurrentEditOverlay.EditShapesLayer.InternalFeatures.Add(feature);
            }

            foreach (var markerFeature in snapshot.EditingMarkerFeatures)
            {
                MarkerHelper.AddMarker((PointShape)markerFeature.GetShape()
                                       , markerFeature.ColumnValues[AnnotationTrackInteractiveOverlay.AnnotationTextColumnName]
                                       , markerFeature.Id
                                       , markerFeature.ColumnValues[AnnotationTrackInteractiveOverlay.ValueStyleMatchColumnName]);
            }

            if (CurrentAnnotationOverlay.MapArguments != null)
            {
                CurrentAnnotationOverlay.Refresh();
            }

            CurrentEditOverlay.CalculateAllControlPoints();

            if (CurrentEditOverlay.MapArguments != null)
            {
                CurrentEditOverlay.Refresh();
            }

            if (MarkerHelper.CurrentMarkerOverlay != null)
            {
                MarkerHelper.CurrentMarkerOverlay.Refresh();
            }

            RaisePropertyChanged(() => CanUndo);
            RaisePropertyChanged(() => CanRedo);
        }
Beispiel #2
0
        private void ClearAllAnnotations()
        {
            CurrentAnnotationOverlay.TrackShapeLayer.InternalFeatures.Clear();
            CurrentAnnotationOverlay.TrackShapeLayer.FeatureIdsToExclude.Clear();
            CurrentAnnotationOverlay.Refresh();

            CurrentEditOverlay.EditShapesLayer.InternalFeatures.Clear();
            CurrentEditOverlay.CalculateAllControlPoints();
            GisEditor.ActiveMap.Refresh(CurrentEditOverlay);

            SyncUIState();
        }
Beispiel #3
0
        private void DeleteSelectedAnnotations()
        {
            var idsToDelete       = CurrentEditOverlay.EditShapesLayer.InternalFeatures.Select(f => f.Id).ToList();
            var markerIdsToDelete = new List <string>();

            if (MarkerHelper.CurrentMarkerOverlay != null && MarkerHelper.CurrentMarkerOverlay.Markers.Count > 0)
            {
                markerIdsToDelete = MarkerHelper.CurrentMarkerOverlay.Markers.Select(tmpMarker => tmpMarker.Tag as string).ToList();
                MarkerHelper.CurrentMarkerOverlay.Markers.Clear();
            }

            CurrentEditOverlay.EditShapesLayer.InternalFeatures.Clear();

            bool needMarkerOverlayRefreshed = false;

            for (int i = CurrentAnnotationOverlay.TrackShapeLayer.InternalFeatures.Count - 1; i >= 0; i--)
            {
                var featureIdToDelete = CurrentAnnotationOverlay.TrackShapeLayer.InternalFeatures[i].Id;
                if (idsToDelete.Contains(featureIdToDelete))
                {
                    CurrentAnnotationOverlay.TrackShapeLayer.InternalFeatures.RemoveAt(i);
                }
                else if (markerIdsToDelete.Contains(featureIdToDelete))
                {
                    needMarkerOverlayRefreshed = true;
                    CurrentAnnotationOverlay.TrackShapeLayer.InternalFeatures.RemoveAt(i);
                }
            }

            if (needMarkerOverlayRefreshed)
            {
                MarkerHelper.CurrentMarkerOverlay.Refresh();
            }

            CurrentAnnotationOverlay.TrackShapeLayer.FeatureIdsToExclude.Clear();
            CurrentAnnotationOverlay.Refresh();
            CurrentEditOverlay.CalculateAllControlPoints();
            CurrentEditOverlay.Refresh();

            SyncUIState();
        }
Beispiel #4
0
        private void AnnotationOverlay_SelectionFinished(object sender, TrackEndedTrackInteractiveOverlayEventArgs e)
        {
            bool isShiftKeyDown = Keyboard.Modifiers == ModifierKeys.Shift;

            if (!isShiftKeyDown)
            {
                AnnotationHelper.CommitEdit();
            }

            var selectionArea = e.TrackShape.GetBoundingBox();

            CurrentAnnotationOverlay.TrackShapeLayer.SafeProcess(() =>
            {
                var tmpFeatureIdsToExclude = new Collection <string>();
                foreach (var id in CurrentAnnotationOverlay.TrackShapeLayer.FeatureIdsToExclude)
                {
                    tmpFeatureIdsToExclude.Add(id);
                }
                CurrentAnnotationOverlay.TrackShapeLayer.FeatureIdsToExclude.Clear();

                var selectedFeatures = CurrentAnnotationOverlay.TrackShapeLayer.QueryTools.GetFeaturesInsideBoundingBox(selectionArea, CurrentAnnotationOverlay.TrackShapeLayer.GetDistinctColumnNames());

                foreach (var id in tmpFeatureIdsToExclude)
                {
                    CurrentAnnotationOverlay.TrackShapeLayer.FeatureIdsToExclude.Add(id);
                }

                bool needMarkerOverlayRefreshed = false;
                foreach (var selectedFeature in selectedFeatures)
                {
                    bool isEditing = true;
                    if (!CurrentAnnotationOverlay.TrackShapeLayer.FeatureIdsToExclude.Contains(selectedFeature.Id))
                    {
                        CurrentAnnotationOverlay.TrackShapeLayer.FeatureIdsToExclude.Add(selectedFeature.Id);
                    }
                    else
                    {
                        isEditing = false;
                        if (isShiftKeyDown)
                        {
                            CurrentAnnotationOverlay.TrackShapeLayer.FeatureIdsToExclude.Remove(selectedFeature.Id);
                            if (CurrentEditOverlay.EditShapesLayer.InternalFeatures.Contains(selectedFeature.Id))
                            {
                                CurrentEditOverlay.EditShapesLayer.InternalFeatures.Remove(selectedFeature.Id);
                            }
                            else if (MarkerHelper.CurrentMarkerOverlay.Markers.Contains(selectedFeature.Id))
                            {
                                MarkerHelper.CurrentMarkerOverlay.Markers.Remove(selectedFeature.Id);
                                needMarkerOverlayRefreshed = true;
                            }
                        }
                    }

                    if (needMarkerOverlayRefreshed)
                    {
                        MarkerHelper.CurrentMarkerOverlay.Refresh();
                    }

                    if (isEditing)
                    {
                        AnnotationHelper.SetAnnotationToEditMode(selectedFeature);
                    }
                }
            });

            CurrentEditOverlay.CalculateAllControlPoints();
            CurrentEditOverlay.Refresh();
            CurrentAnnotationOverlay.Refresh();
            SyncUIState();

            TakeSnapshot();
        }