Click here to Skip to main content
15,894,180 members
Articles / Desktop Programming / WPF

Integration: Kinematics + Digital Image Processing + 3D Graphics

Rate me:
Please Sign up or sign in to vote.
5.00/5 (4 votes)
9 Sep 2012CPOL12 min read 25.4K   3.4K   18  
Further promotion of integration ideas
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using CategoryTheory;
using DiagramUI.Labels;
using DiagramUI;

using DiagramUI.Interfaces;

using DataPerformer.Interfaces;
using DataPerformer.Helpers;


namespace DataPerformer.Runtime
{
    /// <summary>
    /// Simplest runtime fatory
    /// </summary>
    public class DataPerformerRuntimeFactory : IDataPerformerRuntimeFactory
    {

        #region Fields

        /// <summary>
        /// Singleton
        /// </summary>
        public static readonly DataPerformerRuntimeFactory Object = new DataPerformerRuntimeFactory();

        private ITimeMeasureProvider provider = new TimeMeasureProvider();

        /// <summary>
        /// Check level
        /// </summary>
        protected int priority = 0;

        #endregion

        #region Ctor

        /// <summary>
        /// Default constructor
        /// </summary>
        protected DataPerformerRuntimeFactory()
        {
        }

        #endregion

        #region IDataPerformerRuntimeFactory Members

        /// <summary>
        /// Creates runtime from collection
        /// </summary>
        /// <param name="collection">The collection</param>
        /// <param name="priority">Priority</param>
        /// <returns>The runtime</returns>
        public virtual IDataPerformerRuntime Create(IComponentCollection collection, int priority)
        {
            return new DataPerformerRuntime(collection, priority);
        }


        /// <summary>
        /// Time provider
        /// </summary>
        ITimeMeasureProvider IDataPerformerRuntimeFactory.TimeProvider
        {
            get { return provider; }
        }


        /// <summary>
        /// Creates collection
        /// </summary>
        /// <param name="consumer">Data consumer</param>
        /// <param name="priority">Priority</param>
        /// <returns>Collection</returns>
        public virtual IComponentCollection CreateCollection(IDataConsumer consumer, int priority)
        {
            Action<object> act = (object obj)=>{};
            List<object> list = new List<object>();
            return CreateCollection(consumer, list, act, priority);
        }

 

        /// <summary>
        /// Level of check
        /// </summary>
        public int Priority
        {
            get { return priority; }
            set { priority = value; }
        }
 

        #endregion

        #region Specific Members

        #region Public Members
        
        /// <summary>
        /// Gets differential equation solver from object
        /// </summary>
        /// <param name="obj">The object</param>
        /// <returns>The solver</returns>
        public virtual IDifferentialEquationSolver GetDifferentialEquationSolver(object obj)
        {
            return null;
        }

        #endregion

        #region Protected Members

        /// <summary>
        /// Creates component collection
        /// </summary>
        /// <param name="consumer">Data consumer</param>
        /// <param name="list">List of objects</param>
        /// <param name="action">Action</param>
        /// <param name="priority">Priorty</param>
        /// <returns>Component collection</returns>
        protected IComponentCollection CreateCollection(IDataConsumer consumer, List<object> list, Action<object> action, int priority)
        {
            CreateDataConsumerCollection(consumer, list, action, priority);
            IDesktop desktop = (consumer as IAssociatedObject).GetDesktop();
            return new ComponentCollection(list, desktop);
       }

        /// <summary>
        /// Creates collection of components
        /// </summary>
        /// <param name="consumer">Data consumer</param>
        /// <param name="list">List of objects</param>
        /// <param name="action">Additional acton</param>
        /// <param name="priority">Priority</param>
        /// <returns>Collection of components</returns>
        protected void CreateDataConsumerCollection(IDataConsumer consumer, List<object> list, 
            Action<object> action, int priority)
        {
            IList ll = consumer.GetDependentObjects();
            foreach (object o in ll)
            {
                if (o is INamedComponent)
                {
                    action(o);
                    if (!list.Contains(o))
                    {
                        list.Add(o);
                    }
                    continue;
                }
                if (o is IAssociatedObject)
                {
                    IAssociatedObject ao = o as IAssociatedObject;
                    object ob = ao.Object;
                    action(ob);
                    if (ob is INamedComponent)
                    {
                        if (!list.Contains(ob))
                        {
                           list.Add(ob);
                        }
                        continue;
                    }
                }
            }
        }

        #endregion

        #endregion

    }
}

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 Code Project Open License (CPOL)


Written By
Architect
Russian Federation Russian Federation
Ph. D. Petr Ivankov worked as scientific researcher at Russian Mission Control Centre since 1978 up to 2000. Now he is engaged by Aviation training simulators http://dinamika-avia.com/ . His additional interests are:

1) Noncommutative geometry

http://front.math.ucdavis.edu/author/P.Ivankov

2) Literary work (Russian only)

http://zhurnal.lib.ru/editors/3/3d_m/

3) Scientific articles
http://arxiv.org/find/all/1/au:+Ivankov_Petr/0/1/0/all/0/1

Comments and Discussions