Click here to Skip to main content
15,891,529 members
Articles / Desktop Programming / WPF

Animation of graph algorithms with WPF 3D

Rate me:
Please Sign up or sign in to vote.
4.82/5 (13 votes)
20 Jan 2010Apache4 min read 50K   3.7K   39  
Overview of data structures and animations.
using System;

namespace Palmmedia.WpfGraph.Core
{
    /// <summary>
    /// Base class for all <see cref="IGraph&lt;TNodeType, TEdgeType&gt;"/> implementations.
    /// </summary>
    /// <typeparam name="TNodeType">The type of the data attached to a <see cref="Palmmedia.WpfGraph.Core.Node&lt;TNodeType, TEdgeType&gt;"/>.</typeparam>
    /// <typeparam name="TEdgeType">The type of the data attached to an <see cref="Palmmedia.WpfGraph.Core.Edge&lt;TNodeType, TEdgeType&gt;"/>.</typeparam>
    public abstract class GraphBase<TNodeType, TEdgeType>
    {
        /// <summary>
        /// Occurs after an <see cref="Edge&lt;TNodeType, TEdgeType&gt;"/> has been added.
        /// </summary>
        public event EventHandler<EdgeEventArgs<TNodeType, TEdgeType>> EdgeAdded;

        /// <summary>
        /// Occurs after an <see cref="Node&lt;TNodeType, TEdgeType&gt;"/> has been added.
        /// </summary>
        public event EventHandler<NodeEventArgs<TNodeType, TEdgeType>> NodeAdded;

        /// <summary>
        /// Occurs after an <see cref="Edge&lt;TNodeType, TEdgeType&gt;"/> has been removed.
        /// </summary>
        public event EventHandler<EdgeEventArgs<TNodeType, TEdgeType>> EdgeRemoved;

        /// <summary>
        /// Occurs after an <see cref="Node&lt;TNodeType, TEdgeType&gt;"/> has been removed.
        /// </summary>
        public event EventHandler<NodeEventArgs<TNodeType, TEdgeType>> NodeRemoved;

        /// <summary>
        /// Raises the <see cref="E:EdgeAdded"/> event.
        /// </summary>
        /// <param name="args">The <see cref="Palmmedia.WpfGraph.Core.EdgeEventArgs&lt;TNodeType,TEdgeType&gt;"/> instance containing the event data.</param>
        protected virtual void OnEdgeAdded(EdgeEventArgs<TNodeType, TEdgeType> args)
        {
            if (this.EdgeAdded != null)
            {
                this.EdgeAdded(this, args);
            }
        }

        /// <summary>
        /// Raises the <see cref="E:NodeAdded"/> event.
        /// </summary>
        /// <param name="args">The <see cref="Palmmedia.WpfGraph.Core.NodeEventArgs&lt;TNodeType,TEdgeType&gt;"/> instance containing the event data.</param>
        protected virtual void OnNodeAdded(NodeEventArgs<TNodeType, TEdgeType> args)
        {
            if (this.NodeAdded != null)
            {
                this.NodeAdded(this, args);
            }
        }

        /// <summary>
        /// Raises the <see cref="E:EdgeRemoved"/> event.
        /// </summary>
        /// <param name="args">The <see cref="Palmmedia.WpfGraph.Core.EdgeEventArgs&lt;TNodeType,TEdgeType&gt;"/> instance containing the event data.</param>
        protected virtual void OnEdgeRemoved(EdgeEventArgs<TNodeType, TEdgeType> args)
        {
            if (this.EdgeRemoved != null)
            {
                this.EdgeRemoved(this, args);
            }
        }

        /// <summary>
        /// Raises the <see cref="E:NodeRemoved"/> event.
        /// </summary>
        /// <param name="args">The <see cref="Palmmedia.WpfGraph.Core.NodeEventArgs&lt;TNodeType,TEdgeType&gt;"/> instance containing the event data.</param>
        protected virtual void OnNodeRemoved(NodeEventArgs<TNodeType, TEdgeType> args)
        {
            if (this.NodeRemoved != null)
            {
                this.NodeRemoved(this, args);
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Apache License, Version 2.0


Written By
Software Developer
Germany Germany
Blog: http://www.palmmedia.de

Comments and Discussions