コード例 #1
0
ファイル: AdornerLayer.cs プロジェクト: radtek/Shopdrawing
        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);
        }
コード例 #2
0
ファイル: AdornerLayer.cs プロジェクト: radtek/Shopdrawing
        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);
                    }
                }
            }
        }
コード例 #3
0
ファイル: AdornerLayer.cs プロジェクト: radtek/Shopdrawing
        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);
        }
コード例 #4
0
ファイル: AdornerLayer.cs プロジェクト: radtek/Shopdrawing
 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);
 }
コード例 #5
0
ファイル: AdornerLayer.cs プロジェクト: radtek/Shopdrawing
 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);
 }
コード例 #6
0
ファイル: AdornerLayer.cs プロジェクト: radtek/Shopdrawing
        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));
        }
コード例 #7
0
ファイル: AdornerLayer.cs プロジェクト: radtek/Shopdrawing
 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);
 }
コード例 #8
0
ファイル: AdornerLayer.cs プロジェクト: radtek/Shopdrawing
        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);
        }
コード例 #9
0
ファイル: AdornerLayer.cs プロジェクト: radtek/Shopdrawing
        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();
        }
コード例 #10
0
ファイル: AdornerLayer.cs プロジェクト: radtek/Shopdrawing
 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();
         }
     }
 }
コード例 #11
0
ファイル: AdornerLayer.cs プロジェクト: radtek/Shopdrawing
        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);
                }
            }
        }
コード例 #12
0
ファイル: AdornerLayer.cs プロジェクト: radtek/Shopdrawing
 private AdornerLayer.ElementInfo GetElementInfo(AdornerElementSet adornerElementSet)
 {
     AdornerLayer.ElementInfo elementInfo = (AdornerLayer.ElementInfo)null;
     this.elementMap.TryGetValue(adornerElementSet, out elementInfo);
     return(elementInfo);
 }