Example #1
0
        private Task Opened(MapDocument doc)
        {
            var ch = new Change(doc);

            ch.AddRange(doc.Map.Root.FindAll());
            foreach (var d in doc.Map.Data)
            {
                ch.Update(d);
            }
            return(Changed(ch));
        }
Example #2
0
        public async Task <Change> Reverse(MapDocument document)
        {
            var ch = new Change(document);

            var par = document.Map.Root.FindByID(_parentId);

            _idsToDetatch = _detatchedObjects.Select(x => x.ID).ToList();

            foreach (var o in _detatchedObjects)
            {
                // Add parent
                ch.Add(o);

                // Add all descendants
                ch.AddRange(o.FindAll());

                o.Hierarchy.Parent = par;
            }
            _detatchedObjects = null;

            return(ch);
        }
Example #3
0
        public async Task <Change> Perform(MapDocument document)
        {
            var ch = new Change(document);

            var par = document.Map.Root.FindByID(_parentId);

            _attachedIds = _objectsToAttach.Select(x => x.ID).ToList();

            foreach (var o in _objectsToAttach)
            {
                // Add parent
                ch.Add(o);

                // Add all descendants
                ch.AddRange(o.FindAll());

                o.Hierarchy.Parent = par;
            }
            _objectsToAttach = null;

            return(ch);
        }