Ejemplo n.º 1
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.º 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);
                    }
                }
            }
        }