Esempio n. 1
0
        private void RecalculateBasisNode(int index)
        {
            SceneNodeSubscription <basisT, pathT> .BasisNodeHolder basisNodeHolder = this.basisNodeList.ValueAt(index);
            if ((int)this.currentViewModel.XamlDocument.ChangeStamp == (int)basisNodeHolder.lastRecalcChangeStamp)
            {
                return;
            }
            SceneNodeSubscription <basisT, pathT> .BasisNodeInfo basisNodeInfo = this.BasisNodeAt(index);
            DocumentNodeMarkerSortedList markerSortedList = basisNodeHolder.PathNodeList;

            basisNodeHolder.PathNodeList = SceneNode.GetMarkerList <SceneNode>(this.path.Query(basisNodeHolder.Node), true);
            foreach (DocumentNodeMarkerSortedListBase.IntersectionResult intersectionResult in markerSortedList.UnionIdentity((DocumentNodeMarkerSortedListBase)basisNodeHolder.PathNodeList))
            {
                if (intersectionResult.RightHandSideIndex == -1)
                {
                    this.RemovePathNode(basisNodeInfo, this.pathNodeList.FindPosition(markerSortedList.MarkerAt(intersectionResult.LeftHandSideIndex)));
                }
                else if (intersectionResult.LeftHandSideIndex == -1)
                {
                    DocumentNodeMarker newMarker = basisNodeHolder.PathNodeList.MarkerAt(intersectionResult.RightHandSideIndex);
                    this.AddPathNode(basisNodeInfo, newMarker);
                }
            }
            basisNodeHolder.lastRecalcChangeStamp = this.currentViewModel.XamlDocument.ChangeStamp;
        }
Esempio n. 2
0
        private void IncrementalRecalculateBasisNode(int index, DocumentNodeChangeList damage, uint documentChangeStamp)
        {
            SceneNodeSubscription <basisT, pathT> .BasisNodeHolder basisNodeHolder = this.basisNodeList.ValueAt(index);
            DocumentNodeMarker ancestor = this.basisNodeList.MarkerAt(index);

            if ((int)basisNodeHolder.lastRecalcChangeStamp == (int)documentChangeStamp)
            {
                return;
            }
            SceneNodeSubscription <basisT, pathT> .BasisNodeInfo basisNodeInfo = this.BasisNodeAt(index);
            if (damage.Count == 0)
            {
                this.RecalculateBasisNode(index);
            }
            foreach (int index1 in damage.FindDescendants(ancestor))
            {
                DocumentNodeMarker documentNodeMarker = damage.MarkerAt(index1);
                if (documentNodeMarker.IsDeleted)
                {
                    this.RemovePathNodes(basisNodeInfo, documentNodeMarker);
                    basisNodeHolder.PathNodeList.RemoveSelfAndDescendants(documentNodeMarker);
                }
                else
                {
                    foreach (SceneNode sceneNode in this.IncrementalTraverseWithSearchPath(basisNodeHolder.Node, documentNodeMarker))
                    {
                        this.AddPathNode(basisNodeInfo, sceneNode.DocumentNode.Marker);
                        basisNodeHolder.PathNodeList.Add(sceneNode.DocumentNode.Marker);
                    }
                }
            }
            basisNodeHolder.lastRecalcChangeStamp = documentChangeStamp;
        }
Esempio n. 3
0
        private void SetBasisNodesWorker(SceneViewModel viewModel, DocumentNodeMarkerSortedListOf <SceneNodeSubscription <basisT, pathT> .BasisNodeHolder> newBasisNodeList)
        {
            this.ValidateBasisNodeStateWithViewModel(viewModel);
            DocumentNodeMarkerSortedListOf <SceneNodeSubscription <basisT, pathT> .BasisNodeHolder> markerSortedListOf = this.basisNodeList;

            this.basisNodeList = newBasisNodeList;
            foreach (DocumentNodeMarkerSortedListBase.IntersectionResult intersectionResult in markerSortedListOf.UnionIdentity((DocumentNodeMarkerSortedListBase)this.basisNodeList))
            {
                if (intersectionResult.RightHandSideIndex == -1)
                {
                    this.OnBasisNodeRemoved(markerSortedListOf.ValueAt(intersectionResult.LeftHandSideIndex));
                    this.CleanOutPathNodesForBasisNode(markerSortedListOf.ValueAt(intersectionResult.LeftHandSideIndex), -1);
                }
                else if (intersectionResult.LeftHandSideIndex == -1)
                {
                    SceneNodeSubscription <basisT, pathT> .BasisNodeHolder holder = new SceneNodeSubscription <basisT, pathT> .BasisNodeHolder(this.currentViewModel.GetSceneNode(this.basisNodeList.MarkerAt(intersectionResult.RightHandSideIndex).Node), default(basisT));

                    this.basisNodeList.SetValueAt(intersectionResult.RightHandSideIndex, holder);
                    this.FireBasisNodeInsertedHandler(holder);
                    this.OnBasisNodeInserted(holder);
                    this.RecalculateBasisNode(intersectionResult.RightHandSideIndex);
                }
                else
                {
                    this.basisNodeList.SetValueAt(intersectionResult.RightHandSideIndex, markerSortedListOf.ValueAt(intersectionResult.LeftHandSideIndex));
                }
            }
        }
Esempio n. 4
0
 private void RemoveBasisNode(int index)
 {
     SceneNodeSubscription <basisT, pathT> .BasisNodeHolder basisNodeHolder = this.basisNodeList.ValueAt(index);
     this.OnBasisNodeRemoved(basisNodeHolder);
     this.CleanOutPathNodesForBasisNode(basisNodeHolder, index);
     this.basisNodeList.RemoveAt(index);
 }
Esempio n. 5
0
 private void OnPathNodeContentChanged(SceneNodeSubscription <basisT, pathT> .PathNodeHolder holder, DocumentNodeMarker damageMarker, DocumentNodeChange damage)
 {
     ++this.pathNodesChangeStamp;
     if (this.PathNodeContentChanged == null)
     {
         return;
     }
     this.PathNodeContentChanged((object)this, holder.Node, holder.Content, damageMarker, damage);
 }
Esempio n. 6
0
 private void OnBasisNodeInserted(SceneNodeSubscription <basisT, pathT> .BasisNodeHolder holder)
 {
     ++this.basisNodesChangeStamp;
     if (this.BasisNodeInserted == null)
     {
         return;
     }
     this.BasisNodeInserted((object)this, holder.Node, holder.Content);
 }
Esempio n. 7
0
 private void OnPathNodeRemoved(SceneNodeSubscription <basisT, pathT> .BasisNodeInfo basisNodeInfo, SceneNodeSubscription <basisT, pathT> .PathNodeHolder holder)
 {
     ++this.pathNodesChangeStamp;
     if (this.PathNodeRemoved == null)
     {
         return;
     }
     this.PathNodeRemoved((object)this, basisNodeInfo.Node, basisNodeInfo.Info, holder.Node, holder.Content);
 }
Esempio n. 8
0
 public SceneNodeSubscription <basisT, pathT> .PathNodeInfo PathNodeAt(int index)
 {
     SceneNodeSubscription <basisT, pathT> .PathNodeHolder pathNodeHolder = this.pathNodeList.ValueAt(index);
     return(new SceneNodeSubscription <basisT, pathT> .PathNodeInfo()
     {
         Index = index,
         Info = pathNodeHolder.Content,
         Node = pathNodeHolder.Node
     });
 }
Esempio n. 9
0
 private void FirePathNodeInsertedHandler(SceneNodeSubscription <basisT, pathT> .BasisNodeInfo basisNodeInfo, SceneNodeSubscription <basisT, pathT> .PathNodeHolder holder)
 {
     if (this.pathNodeInsertedHandler != null)
     {
         holder.Content = this.pathNodeInsertedHandler((object)this, basisNodeInfo.Node, basisNodeInfo.Info, holder.Node);
     }
     else
     {
         holder.Content = default(pathT);
     }
 }
Esempio n. 10
0
 private void FireBasisNodeInsertedHandler(SceneNodeSubscription <basisT, pathT> .BasisNodeHolder holder)
 {
     if (this.basisNodeInsertedHandler != null)
     {
         holder.Content = this.basisNodeInsertedHandler((object)this, holder.Node);
     }
     else
     {
         holder.Content = default(basisT);
     }
 }
Esempio n. 11
0
 private void RemovePathNode(SceneNodeSubscription <basisT, pathT> .BasisNodeInfo basisNodeInfo, int pathNodeListIndex)
 {
     SceneNodeSubscription <basisT, pathT> .PathNodeHolder holder = this.pathNodeList.ValueAt(pathNodeListIndex);
     --holder.ReferenceCount;
     if (holder.ReferenceCount != 0)
     {
         return;
     }
     this.pathNodeList.RemoveAt(pathNodeListIndex);
     this.OnPathNodeRemoved(basisNodeInfo, holder);
 }
Esempio n. 12
0
 public IEnumerable <SceneNodeSubscription <basisT, pathT> .PathNodeInfo> PathNodesFor(SceneNode basisNode)
 {
     SceneNodeSubscription <basisT, pathT> .BasisNodeHolder holder = this.basisNodeList.Find(basisNode.DocumentNode.Marker);
     if (holder != null)
     {
         foreach (DocumentNodeMarker marker in holder.PathNodeList.Markers)
         {
             int index = this.pathNodeList.FindPosition(marker);
             yield return(this.PathNodeAt(index));
         }
     }
 }
Esempio n. 13
0
 private void CleanOutPathNodesForBasisNode(SceneNodeSubscription <basisT, pathT> .BasisNodeHolder basisNodeHolder, int basisNodeIndex)
 {
     SceneNodeSubscription <basisT, pathT> .BasisNodeInfo basisNodeInfo = new SceneNodeSubscription <basisT, pathT> .BasisNodeInfo()
     {
         Index = basisNodeIndex,
         Info  = basisNodeHolder.Content,
         Node  = basisNodeHolder.Node
     };
     foreach (DocumentNodeMarker ancestor in basisNodeHolder.PathNodeList.Markers)
     {
         this.RemovePathNodes(basisNodeInfo, ancestor);
     }
 }
Esempio n. 14
0
 private void RemovePathNodes(SceneNodeSubscription <basisT, pathT> .BasisNodeInfo basisNodeInfo, DocumentNodeMarker ancestor)
 {
     foreach (int index in this.pathNodeList.FindSelfAndDescendants(ancestor))
     {
         SceneNodeSubscription <basisT, pathT> .PathNodeHolder holder = this.pathNodeList.ValueAt(index);
         --holder.ReferenceCount;
         if (holder.ReferenceCount == 0)
         {
             this.OnPathNodeRemoved(basisNodeInfo, holder);
         }
     }
     this.pathNodeList.RemoveSelfAndDescendants(ancestor);
 }
Esempio n. 15
0
        public void InsertBasisNode(SceneNode newBasisNode)
        {
            this.ValidateBasisNodeStateWithViewModel(newBasisNode.ViewModel);
            if (newBasisNode == null || this.basisNodeList.FindPosition(newBasisNode.DocumentNode.Marker) >= 0)
            {
                return;
            }
            SceneNodeSubscription <basisT, pathT> .BasisNodeHolder holder = new SceneNodeSubscription <basisT, pathT> .BasisNodeHolder(newBasisNode, default(basisT));

            int index = this.basisNodeList.Add(newBasisNode.DocumentNode.Marker, holder);

            this.FireBasisNodeInsertedHandler(holder);
            this.OnBasisNodeInserted(holder);
            this.RecalculateBasisNode(index);
        }
Esempio n. 16
0
        private void AddPathNode(SceneNodeSubscription <basisT, pathT> .BasisNodeInfo basisNodeInfo, DocumentNodeMarker newMarker)
        {
            SceneNodeSubscription <basisT, pathT> .PathNodeHolder pathNodeHolder = this.pathNodeList.Find(newMarker);
            if (pathNodeHolder != null)
            {
                ++pathNodeHolder.ReferenceCount;
            }
            else
            {
                SceneNodeSubscription <basisT, pathT> .PathNodeHolder holder = new SceneNodeSubscription <basisT, pathT> .PathNodeHolder(default(pathT), this.currentViewModel.GetSceneNode(newMarker.Node), 1);

                this.pathNodeList.Add(newMarker, holder);
                this.FirePathNodeInsertedHandler(basisNodeInfo, holder);
                this.OnPathNodeInserted(basisNodeInfo, holder);
            }
        }
Esempio n. 17
0
 public void SetPathNodeInsertedHandler(SceneNodeSubscription <basisT, pathT> .PathNodeInsertedHandler value)
 {
     this.pathNodeInsertedHandler = value;
 }