示例#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);
        }
        internal static void SetAnnotationToEditMode(Feature foundFeature)
        {
            var shape = foundFeature.GetShape();

            //if it's area, line or point
            if (!(shape is PointBaseShape) ||
                (string.IsNullOrEmpty(foundFeature.ColumnValues[AnnotationTrackInteractiveOverlay.AnnotationTextColumnName])))
            {
                ViewModel.CurrentEditOverlay.EditShapesLayer.InternalFeatures.Add(foundFeature.Id, foundFeature);
            }
            //if it's text annotation
            else
            {
                string styleValue = String.Empty;
                if (foundFeature.ColumnValues.ContainsKey(AnnotationTrackInteractiveOverlay.ValueStyleMatchColumnName))
                {
                    styleValue = foundFeature.ColumnValues[AnnotationTrackInteractiveOverlay.ValueStyleMatchColumnName];
                }

                MarkerHelper.AddMarker((PointShape)shape,
                                       foundFeature.ColumnValues[AnnotationTrackInteractiveOverlay.AnnotationTextColumnName],
                                       foundFeature.Id, styleValue);
            }
        }