Click here to Skip to main content
15,897,167 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.5K   3.4K   18  
Further promotion of integration ideas
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

using DiagramUI;
using DiagramUI.Interfaces;

using TestCategory;


using DataWarehouse;
using DataWarehouse.Interfaces;

using DataPerformer.TestInterface;





namespace Aviation.Test
{
    class Program
    {
        private static DatabaseInterface data;

        static void Main(string[] args)
        {
            if (args == null)
            {
                return;
            }
            List<IApplicationInitializer> ini = new List<IApplicationInitializer>();
            ini.Add(Motion6D.ApplicationInitializer.Object);
          //  ini.Add(DataSetService.Initialization.DatabaseInitializer.GetInitializer(ODBCTableProvider.ODBCDataSetFactory.Object));
            IApplicationInitializer bi =
                new EngineeringInitializer.BasicEngineeringInitializer(OrdinaryDifferentialEquations.Runge4Solver.Singleton,
                    DataPerformer.RungeProcessor.Processor,
                    Motion6D.Runtime.Motion6DDataPerformerRuntimeFactory.Object, ini.ToArray(),
                    true);
            bi.InitializeApplication();
            init();
            DataWarehouse.StaticExtensionDataWarehouse.SetAppBaseCoordinator();
            string conn = "";
            foreach (string s in args)
            {
                if (!s.Contains('/'))
                {
                    conn += s + " ";
                }
            }
            conn = conn.Substring(0, conn.Length - 1);
            CreateData(conn);
            foreach (string s in args)
            {
                if (s.Equals("/t"))
                {
                    test();
                }
                if (s.Equals("/c"))
                {
                    refresh();
                }
            }
        }


        static private void init()
        {
            // Motion6D.PositionObjectFactory.Factory = InterfaceOpenGL.OpenGLFactory.Object;

        }

        static void CreateData(string s)
        {
            if (data != null)
            {
                return;
            }
            try
            {
                IDatabaseInterface inter = DataWarehouse.StaticExtensionDataWarehouse.Coordinator[s];
                data = new DatabaseInterface(new User(null, null, null), inter);
            }
            catch (Exception)
            {
            }
        }


        static void test()
        {
            testData(data);
        }

        static void change()
        {
            Change(data);
        }



        static void testData(DatabaseInterface data)
        {
            string[] ss = new string[] { /*"826959ff-f086-4dfd-af8e-2ae0fabf056e", */"3c034003-b63c-4d4c-b96b-317cbc605f69" };


            System.IO.StreamWriter sr = new System.IO.StreamWriter("1.txt");
            TestPerformer performer = new TestPerformer(DataPerformer.TestInterface.DataPerformerTestEventHandler.Singleton, 
               new SoundService.Test.TestInterface(new TextWriter[] {sr, Console.Out}));
            performer.Add(new StandardTextExceptionWriter(sr, true));
          /* !!! Delete after Action<byte[]> act = (byte[] b) =>
                {
                  object o =  b.ToStream().Test();
                  List<string> l = o.ToTestStringList();
                  for (int i = 0; i < l.Count; i++)
                  {
                      Console.Out.WriteLine((i + 1) + ". " + l[i]);
                  }
                };
            performer.ByteTest += act;*/
            performer.Add(new StandardTextExceptionWriter(Console.Out, true));
            performer.TestData(data, "cfa");
            System.Console.WriteLine("Test has been finished. Press any key to stop");
            System.Console.ReadKey();
        }

        static void Change(DatabaseInterface data)
        {
            TestPerformer performer = new TestPerformer(DataPerformer.TestInterface.DataPerformerTestEventHandler.Singleton, 
              new  SoundService.Test.TestInterface(new TextWriter[]{Console.Out}));
            performer.TestChange(data, "cfa", true);
            System.Console.WriteLine("Changing is completed. Press any key to stop");
            System.Console.ReadKey();
        }

        static void refresh()
        {
            Refresh(data);
        }

        static void Refresh(DatabaseInterface data)
        {
            TestPerformer.Refresh(data, "cfa");
            System.Console.WriteLine("Refreshing is completed. Press any key to stop");
            System.Console.ReadKey();

        }





        static private void test(IDesktop d)
        {
            /* DataPerformer.StaticDataPerformer.Strategy.PrepareAll(d);
             DataPerformer.StaticDataPerformer.Strategy.StartAll(d, 0);
             DataPerformer.StaticDataPerformer.Strategy.Time = 0;
             DataPerformer.StaticDataPerformer.Strategy.UpdateAll(d);
             Regression.AliasRegression.Test(d, 1);
             DataPerformer.DataConsumer.Test(d);
             Regression.IteratorGLM.Test(d, 1);
             DataPerformer.StaticDataPerformer.Strategy.ClearAll();*/
        }
        /*
                static private bool check(string id)
                {
                    if (id == null)
                    {
                        return
                    string s = null;
                    byte[] buffer = data.GetData("f7da5584-8384-45e1-b06d-dd59f08a421f", ref s);
                    PureDesktopPeer p = new PureDesktopPeer();
                    bool b = p.Load(buffer);
          
                }*/

    }
}

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