Exemple #1
0
            public override void LayoutDiagram(LayoutInitial init, bool immediate)
            {
                Overview ov = this.Diagram as Overview;

                if (ov != null && ov.UsesObservedNodeLocation)
                {
                    return;
                }
                base.LayoutDiagram(init, immediate);
            }
Exemple #2
0
        private void ResetAllLayouts(LayoutInitial reason)
        {
            if (reason == LayoutInitial.None)
            {
                return;
            }
            VerifyAccess();
            Diagram diagram = this.Diagram;

            if (diagram == null)
            {
                return;
            }
            if (reason == LayoutInitial.InvalidateAll || reason == LayoutInitial.ValidateAll)
            {
                // invalidate or validate all layouts
                foreach (Node n in diagram.Nodes)
                {
                    Group g = n as Group;
                    if (g != null)
                    {
                        ResetOneLayout(reason, g.Layout);
                    }
                }
                ResetOneLayout(reason, diagram.Layout);
            }
            else if (reason == LayoutInitial.InvalidateIfNodesUnlocated)
            {
                // validate all layouts ...
                foreach (Node n in diagram.Nodes)
                {
                    Group g = n as Group;
                    if (g != null)
                    {
                        ResetOneLayout(LayoutInitial.ValidateAll, g.Layout);
                    }
                }
                ResetOneLayout(LayoutInitial.ValidateAll, diagram.Layout);
                // ... unless they have unlocated nodes
                foreach (Node n in diagram.Nodes)
                {
                    Point loc = n.Location;
                    if (Double.IsNaN(loc.X) || Double.IsNaN(loc.Y))
                    {
                        IDiagramLayout layout = GetLayoutBy(n);
                        if (layout != null && layout.ValidLayout && layout.CanLayoutPart(n))
                        {
                            layout.ValidLayout = false;
                        }
                    }
                }
            }
        }
Exemple #3
0
        private void ResetOneLayout(LayoutInitial reason, IDiagramLayout layout)
        {
            if (layout == null)
            {
                return;
            }
            switch (reason)
            {
            case LayoutInitial.InvalidateAll:
                layout.ValidLayout = false;
                break;

            case LayoutInitial.ValidateAll:
                layout.ValidLayout = true;
                break;

            default: break;
            }
        }
Exemple #4
0
 /// <summary>
 /// Request a re-layout of all invalidated layouts in this diagram.
 /// </summary>
 /// <param name="init">
 /// If the value is <see cref="LayoutInitial.InvalidateAll"/>,
 /// all <see cref="IDiagramLayout"/>s will be declared invalid, and they will all be performed
 /// at the time given by the <paramref name="immediate"/> argument.
 /// If the value is <see cref="LayoutInitial.InvalidateIfNodesUnlocated"/>,
 /// <see cref="IDiagramLayout"/>s will be declared invalid only if they are responsible
 /// for <see cref="Node"/>s that do not have a <see cref="Node.Location"/>,
 /// because their X and/or Y values are <c>Double.NaN</c>.
 /// If the value is <see cref="LayoutInitial.ValidateAll"/>,
 /// all <see cref="IDiagramLayout"/>s will be declared valid, and no layout will occur
 /// until after something else happens to invalidate a layout.
 /// If the value is <see cref="LayoutInitial.None"/>,
 /// no layout validity is changed -- any invalid layouts will be performed at the specified time.
 /// </param>
 /// <param name="immediate">
 /// If true this method performs an immediate layout.
 /// If false this method schedules a layout to occur soon.
 /// </param>
 /// <remarks>
 /// The value for the <paramref name="init"/> parameter usually comes from the
 /// <see cref="Initial"/> property.
 /// This method changes the validity of layouts by setting the <see cref="IDiagramLayout.ValidLayout"/> property.
 /// </remarks>
 public virtual void LayoutDiagram(LayoutInitial init, bool immediate)
 {
     if (init == LayoutInitial.ValidateAll)
     {
         ResetAllLayouts(LayoutInitial.ValidateAll);
         // don't need to call DoLayoutDiagram!
     }
     else if (immediate)
     {
         ResetAllLayouts(init);
         DoLayoutDiagram();
     }
     else
     {
         // this is delayed for Silverlight to allow nodes to data-bind Location,
         // which occurs later than in WPF
         Diagram.InvokeLater(this, () => { ResetAllLayouts(init); });
         InvokeLayoutDiagram("UpdateLayout");
     }
 }
 private void ResetOneLayout(LayoutInitial reason, IDiagramLayout layout) {
   if (layout == null) return;
   switch (reason) {
     case LayoutInitial.InvalidateAll:
       layout.ValidLayout = false;
       break;
     case LayoutInitial.ValidateAll:
       layout.ValidLayout = true;
       break;
     default: break;
   }
 }
 private void ResetAllLayouts(LayoutInitial reason) {
   if (reason == LayoutInitial.None) return;
   VerifyAccess();
   Diagram diagram = this.Diagram;
   if (diagram == null) return;
   if (reason == LayoutInitial.InvalidateAll || reason == LayoutInitial.ValidateAll) {
     // invalidate or validate all layouts
     foreach (Node n in diagram.Nodes) {
       Group g = n as Group;
       if (g != null) ResetOneLayout(reason, g.Layout);
     }
     ResetOneLayout(reason, diagram.Layout);
   } else if (reason == LayoutInitial.InvalidateIfNodesUnlocated) {
     // validate all layouts ...
     foreach (Node n in diagram.Nodes) {
       Group g = n as Group;
       if (g != null) ResetOneLayout(LayoutInitial.ValidateAll, g.Layout);
     }
     ResetOneLayout(LayoutInitial.ValidateAll, diagram.Layout);
     // ... unless they have unlocated nodes
     foreach (Node n in diagram.Nodes) {
       Point loc = n.Location;
       if (Double.IsNaN(loc.X) || Double.IsNaN(loc.Y)) {
         IDiagramLayout layout = GetLayoutBy(n);
         if (layout != null && layout.ValidLayout) layout.ValidLayout = false;
       }
     }
   }
 }
 /// <summary>
 /// Request a re-layout of all invalidated layouts in this diagram.
 /// </summary>
 /// <param name="init">
 /// If the value is <see cref="LayoutInitial.InvalidateAll"/>,
 /// all <see cref="IDiagramLayout"/>s will be declared invalid, and they will all be performed
 /// at the time given by the <paramref name="immediate"/> argument.
 /// If the value is <see cref="LayoutInitial.InvalidateIfNodesUnlocated"/>,
 /// <see cref="IDiagramLayout"/>s will be declared invalid only if they are responsible
 /// for <see cref="Node"/>s that do not have a <see cref="Node.Location"/>,
 /// because their X and/or Y values are <c>Double.NaN</c>.
 /// If the value is <see cref="LayoutInitial.ValidateAll"/>,
 /// all <see cref="IDiagramLayout"/>s will be declared valid, and no layout will occur
 /// until after something else happens to invalidate a layout.
 /// If the value is <see cref="LayoutInitial.None"/>,
 /// no layout validity is changed -- any invalid layouts will be performed at the specified time.
 /// </param>
 /// <param name="immediate">
 /// If true this method performs an immediate layout.
 /// If false this method schedules a layout to occur soon.
 /// </param>
 /// <remarks>
 /// The value for the <paramref name="init"/> parameter usually comes from the
 /// <see cref="Initial"/> property.
 /// This method changes the validity of layouts by setting the <see cref="IDiagramLayout.ValidLayout"/> property.
 /// </remarks>
 public virtual void LayoutDiagram(LayoutInitial init, bool immediate) {
   if (init == LayoutInitial.ValidateAll) {
     ResetAllLayouts(LayoutInitial.ValidateAll);
     // don't need to call DoLayoutDiagram!
   } else if (immediate) {
     ResetAllLayouts(init);
     DoLayoutDiagram();
   } else {
     // this is delayed for Silverlight to allow nodes to data-bind Location,
     // which occurs later than in WPF
     Diagram.InvokeLater(this, () => { ResetAllLayouts(init); });
     InvokeLayoutDiagram("UpdateLayout");
   }
 }
Exemple #8
0
 public override void LayoutDiagram(LayoutInitial init, bool immediate) { return; }
Exemple #9
0
 public override void LayoutDiagram(LayoutInitial init, bool immediate)
 {
     return;
 }
Exemple #10
0
 public override void LayoutDiagram(LayoutInitial init, bool immediate) {
   Overview ov = this.Diagram as Overview;
   if (ov != null && ov.UsesObservedNodeLocation) return;
   base.LayoutDiagram(init, immediate);
 }