Ejemplo n.º 1
0
        public ICollection <IAdornerSet> GetAdornerSets(SceneElement sceneElement)
        {
            List <IAdornerSet> list          = new List <IAdornerSet>();
            Base3DElement      base3Delement = sceneElement as Base3DElement;

            foreach (AdornerElementSet adornerElementSet in (IEnumerable <AdornerElementSet>) this.GetAdornerElementSetsContainingElement(base3Delement != null ? (SceneElement)base3Delement.Viewport : sceneElement))
            {
                AdornerLayer.ElementInfo elementInfo = this.GetElementInfo(adornerElementSet);
                if (elementInfo != null)
                {
                    if (base3Delement != null && elementInfo.AdornerSet3DContainer != null)
                    {
                        foreach (AdornerSet3D adornerSet3D in elementInfo.AdornerSet3DContainer.AdornerSets)
                        {
                            if (adornerSet3D.Element == base3Delement)
                            {
                                list.Add((IAdornerSet)adornerSet3D);
                            }
                        }
                    }
                    foreach (AdornerSet adornerSet in elementInfo.AdornerSets)
                    {
                        list.Add((IAdornerSet)adornerSet);
                    }
                }
            }
            return((ICollection <IAdornerSet>)list);
        }
Ejemplo n.º 2
0
        private void RemoveAdornerSet3D(AdornerSet3D adornerSet3D)
        {
            Viewport3DElement adornedViewport = adornerSet3D.AdornerSet3DContainer.AdornedViewport;

            if (adornedViewport == null)
            {
                throw new InvalidOperationException(ExceptionStringTable.AdornedViewport3DElementMayNotBeNull);
            }
            IList <AdornerElementSet> containingElement = this.GetAdornerElementSetsContainingElement((SceneElement)adornedViewport);

            if (containingElement.Count <= 0)
            {
                return;
            }
            foreach (AdornerElementSet adornerElementSet in (IEnumerable <AdornerElementSet>)containingElement)
            {
                AdornerLayer.ElementInfo elementInfo = this.GetElementInfo(adornerElementSet);
                if (elementInfo.AdornerSet3DContainer != null && elementInfo.AdornerSet3DContainer.AdornerSets.Contains(adornerSet3D) && (elementInfo != null && elementInfo.RemoveAdornerSet(adornerSet3D)))
                {
                    AdornerSet3DContainer adornerSet3Dcontainer = elementInfo.AdornerSet3DContainer;
                    if (adornerSet3Dcontainer.AdornerSetCount == 0)
                    {
                        elementInfo.AdornerSet3DContainer = (AdornerSet3DContainer)null;
                        this.children.Remove((Visual)adornerSet3Dcontainer);
                        this.adornerSet3DContainers.Remove(adornerSet3Dcontainer);
                    }
                    if (elementInfo.IsEmpty)
                    {
                        this.elementMap.Remove(adornerElementSet);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void AddAdornerSet3D(AdornerSet3D adornerSet3D)
        {
            Base3DElement element = adornerSet3D.Element;

            if (element == null)
            {
                throw new InvalidOperationException(ExceptionStringTable.AdornedBase3DElementMayNotBeNull);
            }
            Viewport3DElement viewport = element.Viewport;

            if (viewport == null)
            {
                throw new InvalidOperationException(ExceptionStringTable.AdornedViewport3DElementMayNotBeNull);
            }
            AdornerLayer.ElementInfo createElementInfo = this.GetOrCreateElementInfo(this.CreateOrGetAdornerElementSetForElement((SceneElement)viewport));
            if (createElementInfo.AdornerSet3DContainer == null)
            {
                createElementInfo.AdornerSet3DContainer = new AdornerSet3DContainer(viewport);
                this.adornerSet3DContainers.Add(createElementInfo.AdornerSet3DContainer);
            }
            createElementInfo.Update((SceneElement)viewport, this, AdornerLayer.ElementInfoUpdateSource.Explicit);
            createElementInfo.AddAdornerSet(adornerSet3D);
            if (createElementInfo.AdornerSet3DContainer.Parent == this)
            {
                return;
            }
            this.children.Add((Visual)createElementInfo.AdornerSet3DContainer);
        }
Ejemplo n.º 4
0
 private AdornerLayer.ElementInfo GetOrCreateElementInfo(AdornerElementSet adornerElementSet)
 {
     AdornerLayer.ElementInfo elementInfo = this.GetElementInfo(adornerElementSet);
     if (elementInfo == null)
     {
         elementInfo = new AdornerLayer.ElementInfo();
         this.elementMap.Add(adornerElementSet, elementInfo);
     }
     return(elementInfo);
 }
Ejemplo n.º 5
0
 internal AdornerSet3DContainer GetAdornerSet3DContainer(Viewport3DElement viewport3DElement)
 {
     foreach (AdornerElementSet adornerElementSet in (IEnumerable <AdornerElementSet>) this.GetAdornerElementSetsContainingElement((SceneElement)viewport3DElement))
     {
         AdornerLayer.ElementInfo elementInfo = this.GetElementInfo(adornerElementSet);
         if (elementInfo != null && elementInfo.AdornerSet3DContainer != null)
         {
             return(elementInfo.AdornerSet3DContainer);
         }
     }
     return((AdornerSet3DContainer)null);
 }
Ejemplo n.º 6
0
        public ICollection <AdornerSet> Get2DAdornerSets(SceneElement sceneElement)
        {
            List <AdornerSet> list = new List <AdornerSet>();

            foreach (AdornerElementSet adornerElementSet in (IEnumerable <AdornerElementSet>) this.GetAdornerElementSetsContainingElement(sceneElement))
            {
                AdornerLayer.ElementInfo elementInfo = this.GetElementInfo(adornerElementSet);
                if (elementInfo != null)
                {
                    list.AddRange((IEnumerable <AdornerSet>)elementInfo.AdornerSets);
                }
            }
            return((ICollection <AdornerSet>) new ReadOnlyCollection <AdornerSet>((IList <AdornerSet>)list));
        }
Ejemplo n.º 7
0
 private void RemoveAllAdornerSets(AdornerElementSet adornerElementSet)
 {
     AdornerLayer.ElementInfo elementInfo = this.GetElementInfo(adornerElementSet);
     foreach (AdornerSet adornerSet in elementInfo.AdornerSets)
     {
         this.children.Remove((Visual)adornerSet);
         adornerSet.OnRemove();
     }
     if (elementInfo.AdornerSet3DContainer != null)
     {
         this.children.Remove((Visual)elementInfo.AdornerSet3DContainer);
         this.adornerSet3DContainers.Remove(elementInfo.AdornerSet3DContainer);
     }
     this.elementMap.Remove(adornerElementSet);
 }
Ejemplo n.º 8
0
        private void AddAdornerSet2D(AdornerSet adornerSet2D)
        {
            AdornerElementSet elementSet = adornerSet2D.ElementSet;

            if (elementSet == null)
            {
                throw new InvalidOperationException(ExceptionStringTable.AdornerElementSetMayNotBeNull);
            }
            if (adornerSet2D.Parent != this)
            {
                this.children.Add((Visual)adornerSet2D);
            }
            AdornerLayer.ElementInfo createElementInfo = this.GetOrCreateElementInfo(elementSet);
            createElementInfo.Update(elementSet, this, AdornerLayer.ElementInfoUpdateSource.Explicit);
            createElementInfo.AddAdornerSet(adornerSet2D);
        }
Ejemplo n.º 9
0
        private void RemoveAdornerSet2D(AdornerSet adornerSet2D)
        {
            AdornerElementSet elementSet = adornerSet2D.ElementSet;

            if (elementSet == null)
            {
                throw new InvalidOperationException(ExceptionStringTable.AdornerElementSetMayNotBeNull);
            }
            AdornerLayer.ElementInfo elementInfo = this.GetElementInfo(elementSet);
            if (elementInfo != null && elementInfo.RemoveAdornerSet(adornerSet2D))
            {
                if (elementInfo.IsEmpty)
                {
                    this.elementMap.Remove(elementSet);
                }
                this.children.Remove((Visual)adornerSet2D);
            }
            adornerSet2D.OnRemove();
        }
Ejemplo n.º 10
0
 public void InvalidateAdornersStructure(SceneElement sceneElement)
 {
     if (sceneElement == null)
     {
         throw new ArgumentNullException("sceneElement");
     }
     if (!sceneElement.IsAttached)
     {
         return;
     }
     foreach (AdornerElementSet adornerElementSet in (IEnumerable <AdornerElementSet>) this.GetAdornerElementSetsContainingElement(sceneElement))
     {
         AdornerLayer.ElementInfo elementInfo = this.GetElementInfo(adornerElementSet);
         if (elementInfo != null)
         {
             elementInfo.InvalidateStructure();
         }
     }
 }
Ejemplo n.º 11
0
        public void InvalidateAdornerVisuals(SceneElement sceneElement)
        {
            if (sceneElement == null)
            {
                throw new ArgumentNullException("sceneElement");
            }
            if (!sceneElement.IsAttached)
            {
                return;
            }
            Base3DElement optionalBase3DElement = sceneElement as Base3DElement;

            foreach (AdornerElementSet adornerElementSet in (IEnumerable <AdornerElementSet>) this.GetAdornerElementSetsContainingElement(sceneElement))
            {
                AdornerLayer.ElementInfo elementInfo = this.GetElementInfo(adornerElementSet);
                if (elementInfo != null)
                {
                    elementInfo.InvalidateRender(optionalBase3DElement);
                }
                adornerElementSet.Invalidate();
            }
            if (optionalBase3DElement == null)
            {
                return;
            }
            Viewport3DElement viewport = optionalBase3DElement.Viewport;

            if (viewport == null)
            {
                return;
            }
            foreach (AdornerElementSet adornerElementSet in (IEnumerable <AdornerElementSet>) this.GetAdornerElementSetsContainingElement((SceneElement)viewport))
            {
                AdornerLayer.ElementInfo elementInfo = this.GetElementInfo(adornerElementSet);
                if (elementInfo != null)
                {
                    elementInfo.InvalidateRender(optionalBase3DElement);
                }
            }
        }
Ejemplo n.º 12
0
 private AdornerLayer.ElementInfo GetElementInfo(AdornerElementSet adornerElementSet)
 {
     AdornerLayer.ElementInfo elementInfo = (AdornerLayer.ElementInfo)null;
     this.elementMap.TryGetValue(adornerElementSet, out elementInfo);
     return(elementInfo);
 }