Click here to Skip to main content
15,892,674 members
Articles / Programming Languages / C#

Universal Framework for Science and Engineering - Part 6: Determination of Orbits of Artificial Satellites

Rate me:
Please Sign up or sign in to vote.
4.88/5 (28 votes)
8 Jul 2011CPOL19 min read 82.5K   6.6K   82  
An article on framework applications to determine the orbits of artificial satellites
using System;
using System.Collections.Generic;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using CategoryTheory;
using DiagramUI;
using DataPerformer;
using Chart;
using Chart.Interfaces;
using ToolBox;
using DiagramUI.Labels;
using DiagramUI.Utils;
using Diagram.UI.Interfaces;
using Chart.Drawing.Interfaces;
using Chart.Objects;
using Chart.Panels;

namespace DataPerformerUI
{
    /// <summary>
    /// Editor of propreties of collection of points
    /// </summary>
    public partial class FormPointCollection : Form, IUpdatableForm
    {
        private IObjectLabel label;
        private DrawSeries draw;
        private IPointCollecionChooser chooser;
        private ChartPerformer performer;


        private FormPointCollection()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="label">Label of component</param>
        public FormPointCollection(IObjectLabel label)
        {
            InitializeComponent();
            this.LoadResources();
            this.label = label;
            draw = label.Object as DrawSeries;
            Text = label.Name;
            string[] names = PointCollectionChooserFactory.Factory.Names;
            comboBoxType.FillCombo(names);
            PanelChart panel = new PanelChart(new int[,] { { 80, 20 }, { 30, 40 } });
            panel.Width = panelChart.Width - 100;
            panel.Height = panelChart.Height - 100;
            panel.Top = 50;
            panel.Left = 50;
            panel.Dock = DockStyle.Fill;
            performer = panel.Performer;
            performer.Resize();
            panelChart.Controls.Add(panel);
            panelChart.LoadResources();

            SimpleCoordinator coordinator = new SimpleCoordinator(5, 5, performer);
            performer.Coordinator = coordinator;
            setChooser();
            string fn = draw.FactoryName;
            if (fn != null)
            {
                comboBoxType.SelectCombo(fn);
            }
        }


        #region IUpdatableForm Members

        void IUpdatableForm.UpdateFormUI()
        {
            Text = label.Name;
        }

        #endregion


        void setChooser()
        {
            if (chooser != null)
            {
                Control c = chooser as Control;
                Control p = c.Parent;
                p.Controls.Remove(c);
            }
            IPointFactory f = draw.Factory;
            if (f == null)
            {
                return;
            }
            chooser = PointCollectionChooserFactory.Factory[f];
            chooser.Consumer = draw;
            chooser.Measurements = draw.Measurements;
            Control control = chooser as Control;
            splitContainerMain.Panel2.Controls.Add(control);
            control.LoadResources();
            if (performer.Count > 0)
            {
                performer.Remove(draw);
            }
            ISeriesPainter painter = f.GetPainter(performer);
            performer.AddSeries(draw, painter);
            performer.Resize();
            performer.RefreshAll();
        }

        private void comboBoxType_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBoxType.SelectedItem == null)
            {
                return;
            }
            string s = comboBoxType.SelectedItem + "";
            if (s.Length == 0)
            {
                return;
            }
            draw.FactoryName = s;
            setChooser();
        }

        private void buttonAccept_Click(object sender, EventArgs e)
        {
            try
            {
                if (chooser == null)
                {
                    return;
                }
                draw.Measurements = chooser.Measurements;
                performer.RefreshAll();
                Refresh();
            }
            catch (Exception ex)
            {
                ex.Log();
                this.ShowError(ex);
            }
        }
    }
}

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