Example #1
0
        public Attitude(Screen form)
        {
            this.form      = form;
            this.chartData = form.form.chartData;
            screenStreams  = new StreamCollection(form.connection);

            this.width  = 60;
            this.height = 30;

            this.updateRate = 500;
        }
Example #2
0
        public Screen(Form1 form, int id, Connection connection, StreamCollection streamCollection, DataStorage dataStorage)
        {
            this.form             = form;
            this.ID               = id;
            this.connection       = connection;
            this.streamCollection = streamCollection;
            this.dataStorage      = dataStorage;
            this.pxPrLine         = form.pxPrLine;
            this.pxPrChar         = form.pxPrChar;
            this.padding_top      = form.padding_top;
            this.padding_left     = form.padding_left;
            this.padding_right    = form.padding_right;
            this.padding_bottom   = form.padding_bottom;

            this.font  = form.font;
            this.fontB = form.fontB;

            this.buttonFont     = form.buttonFont;
            this.smallFont      = form.smallFont;
            this.smallFontB     = form.smallFontB;
            this.tinyFont       = form.tinyFont;
            this.foreColor      = form.foreColor;
            this.chartAxisColor = form.chartAxisColor;
            this.charOffset     = form.charOffset;
            this.lineOffset     = form.lineOffset;
            this.chartData      = form.chartData;

            this.CRTfont1 = form.CRTfont1;
            this.CRTfont2 = form.CRTfont2;
            this.CRTfont3 = form.CRTfont3;
            this.CRTfont4 = form.CRTfont4;
            this.CRTfont5 = form.CRTfont5;

            this.BackColor = form.BackColor;

            this.FormClosing += ScreenClosing;

            this.KeyPreview = true;

            this.KeyDown += localKeyDown;
            this.KeyUp   += localKeyUp;

            this.DoubleBuffered = true;


            // Initiate Screen Timer
            screenTimer = new System.Timers.Timer();
            screenTimer.SynchronizingObject = this;
            screenTimer.Stop();
            screenTimer.AutoReset = false;
            screenTimer.Interval  = 1000;
            screenTimer.Elapsed  += screenTick;
        }
Example #3
0
        public FDO(Screen form)
        {
            this.form      = form;
            this.chartData = form.form.chartData;
            screenStreams  = new StreamCollection(form.connection);

            this.width  = 120;
            this.height = 40;

            this.updateRate = 500;

            body       = form.connection.SpaceCenter().ActiveVessel.Orbit.Body;
            bodyRadius = body.EquatorialRadius;
            bodyName   = body.Name;

            format.NumberGroupSeparator   = "";
            format.NumberDecimalDigits    = 10;
            format.NumberDecimalSeparator = ".";
        }
Example #4
0
        private void Form1_FormClosing(object sender, FormClosingEventArgs e)
        {
            // Close screens
            foreach (Screen scr in screens)
            {
                scr.Close();
            }

            streamCollection = null;
            if (graphTimer != null && graphTimer.Enabled)
            {
                graphTimer.Stop();
            }
            if (screenTimer != null && screenTimer.Enabled)
            {
                screenTimer.Stop();
            }
            if (connection != null)
            {
                connection.Dispose();
            }
        }
Example #5
0
        //abstract public void destroyStreams();

        public void destroy()
        {
            lock (updateLock)
            {
                // Clear old lables
                foreach (Control label in screenLabels)
                {
                    if (label != null)
                    {
                        label.Dispose();
                    }
                }
                screenLabels.Clear();
                screenLabels.TrimExcess();

                // Clear old Inputs
                foreach (TextBox box in screenInputs)
                {
                    if (box != null)
                    {
                        box.Dispose();
                    }
                }
                screenInputs.Clear();
                screenInputs.TrimExcess();

                // Clear old Buttons
                foreach (MocrButton button in screenButtons)
                {
                    if (button != null)
                    {
                        button.Dispose();
                    }
                }
                screenButtons.Clear();
                screenButtons.TrimExcess();

                // Clear old charts
                foreach (Plot chart in screenCharts)
                {
                    if (chart != null)
                    {
                        chart.Dispose();
                    }
                }
                screenCharts.Clear();
                screenCharts.TrimExcess();

                // Clear old indicators
                foreach (Indicator indicator in screenIndicators)
                {
                    if (indicator != null)
                    {
                        indicator.Dispose();
                    }
                }
                screenIndicators.Clear();
                screenIndicators.TrimExcess();

                // Clear old EngineIndicators
                foreach (EngineIndicator indicator in screenEngines)
                {
                    if (indicator != null)
                    {
                        indicator.Dispose();
                    }
                }
                screenEngines.Clear();
                screenEngines.TrimExcess();

                // Clear old VerticalMeters
                foreach (VerticalMeter meter in screenVMeters)
                {
                    if (meter != null)
                    {
                        meter.Dispose();
                    }
                }
                screenVMeters.Clear();
                screenVMeters.TrimExcess();

                // Clear old 7-segment displays
                foreach (SegDisp disp in screenSegDisps)
                {
                    if (disp != null)
                    {
                        disp.Dispose();
                    }
                }
                screenSegDisps.Clear();
                screenSegDisps.TrimExcess();

                // Clear Drop Downs
                foreach (MocrDropdown drop in screenDropdowns)
                {
                    if (drop != null)
                    {
                        drop.Dispose();
                    }
                }
                screenDropdowns.Clear();
                screenDropdowns.TrimExcess();

                // Clear Maps
                foreach (Map map in screenMaps)
                {
                    if (map != null)
                    {
                        map.Dispose();
                    }
                }
                screenMaps.Clear();
                screenMaps.TrimExcess();

                // Clear Screws
                foreach (Screw screw in screenScrews)
                {
                    if (screw != null)
                    {
                        screw.Dispose();
                    }
                }
                screenScrews.Clear();
                screenScrews.TrimExcess();

                // Clear EventIndicators
                foreach (EventIndicator indicator in screenEventIndicators)
                {
                    if (indicator != null)
                    {
                        indicator.Dispose();
                    }
                }
                screenEventIndicators.Clear();
                screenEventIndicators.TrimExcess();

                // Clear ConsoleDigits
                foreach (ConsoleDigit digit in screenDigits)
                {
                    if (digit != null)
                    {
                        digit.Dispose();
                    }
                }
                screenDigits.Clear();
                screenDigits.TrimExcess();

                // Clear misc controls
                foreach (Control control in screenControls)
                {
                    if (control != null)
                    {
                        control.Dispose();
                    }
                }
                screenControls.Clear();
                screenControls.TrimExcess();

                // Clear old FDAI
                if (screenFDAI != null)
                {
                    screenFDAI.Dispose();
                    screenFDAI = null;
                }

                // Clear old Orbit
                if (screenOrbit != null)
                {
                    screenOrbit.Dispose();
                    screenOrbit = null;
                }

                // Clear all streams
                if (screenStreams != null)
                {
                    screenStreams.CloseStreams();
                    screenStreams = null;
                }
            }
        }
Example #6
0
        private void Form1_Load(object sender, EventArgs e)
        {
            logger = new Logger();
            Console.SetOut(logger);
            setLogOut(true);             // SET TRUE TO WRITE CONSOLE TO log.txt

            Console.WriteLine("FORM LOADING");

            // Set up fonts and graphics
            if (Environment.OSVersion.Platform == PlatformID.Unix)
            {
                system = OS.UNIX;
                Console.WriteLine("SYSTEM SET TO UNIX");

                font  = new Font("Ubuntu Mono", 12, FontStyle.Regular);
                fontB = new Font("Ubuntu Mono", 12, FontStyle.Bold);

                buttonFont = new Font("Ubuntu Mono", 10, FontStyle.Regular);
                smallFont  = new Font("Ubuntu Mono", 8, FontStyle.Regular);
                smallFontB = new Font("Ubuntu Mono", 8, FontStyle.Bold);
                tinyFont   = new Font("Ubuntu Mono", 7, FontStyle.Bold);

                CRTfont1 = new Font("Ubuntu Mono", 7, FontStyle.Regular);
                CRTfont2 = new Font("Ubuntu Mono", 9, FontStyle.Regular);
                CRTfont3 = new Font("Ubuntu Mono", 12, FontStyle.Regular);
                CRTfont4 = new Font("Ubuntu Mono", 14, FontStyle.Regular);
                CRTfont5 = new Font("Ubuntu Mono", 18, FontStyle.Regular);

                pxPrChar   = 8;
                pxPrLine   = 16;
                charOffset = -1;
                lineOffset = -1;

                // Load Images
                logo = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "Resources/logo.png");
            }
            else
            {
                system = OS.WINDOWS;
                Console.WriteLine("SYSTEM SET TO WINDOWS");

                font  = GetCustomFont(GetBytesFromFile(AppDomain.CurrentDomain.BaseDirectory + "Resources\\consola.ttf"), 12, FontStyle.Regular);
                fontB = GetCustomFont(GetBytesFromFile(AppDomain.CurrentDomain.BaseDirectory + "Resources\\consola.ttf"), 12, FontStyle.Bold);

                buttonFont = GetCustomFont(GetBytesFromFile(AppDomain.CurrentDomain.BaseDirectory + "Resources\\consola.ttf"), 10, FontStyle.Regular);
                smallFont  = GetCustomFont(GetBytesFromFile(AppDomain.CurrentDomain.BaseDirectory + "Resources\\consola.ttf"), 8, FontStyle.Regular);
                smallFontB = GetCustomFont(GetBytesFromFile(AppDomain.CurrentDomain.BaseDirectory + "Resources\\consola.ttf"), 8, FontStyle.Bold);
                tinyFont   = GetCustomFont(GetBytesFromFile(AppDomain.CurrentDomain.BaseDirectory + "Resources\\consola.ttf"), 7, FontStyle.Bold);

                CRTfont1 = GetCustomFont(GetBytesFromFile(AppDomain.CurrentDomain.BaseDirectory + "Resources\\consola.ttf"), 7, FontStyle.Regular);
                CRTfont2 = GetCustomFont(GetBytesFromFile(AppDomain.CurrentDomain.BaseDirectory + "Resources\\consola.ttf"), 9, FontStyle.Regular);
                CRTfont3 = GetCustomFont(GetBytesFromFile(AppDomain.CurrentDomain.BaseDirectory + "Resources\\consola.ttf"), 12, FontStyle.Regular);
                CRTfont4 = GetCustomFont(GetBytesFromFile(AppDomain.CurrentDomain.BaseDirectory + "Resources\\consola.ttf"), 14, FontStyle.Regular);
                CRTfont5 = GetCustomFont(GetBytesFromFile(AppDomain.CurrentDomain.BaseDirectory + "Resources\\consola.ttf"), 18, FontStyle.Regular);

                pxPrChar   = 9;
                pxPrLine   = 19;
                charOffset = -2.5;
                lineOffset = 0;

                try
                {
                    this.Icon = new Icon(AppDomain.CurrentDomain.BaseDirectory + "Resources\\MOCR.ico");
                }
                catch (Exception ex) { Console.WriteLine(ex.GetType().ToString() + ":" + ex.Message + "\n" + ex.StackTrace); }

                // Load Images
                logo = new Bitmap(AppDomain.CurrentDomain.BaseDirectory + "Resources\\logo.png");
            }

            // Setup DataStorage
            dataStorage = new DataStorage(pySSSMQ);

            // Initiate SteamCollection
            streamCollection = StreamCollection.Instance;

            // Setup PySSSMQ Handler
            pySSSMQ_handler         = new PySSSMQ_Handler();
            pySSSMQ_handler.storage = dataStorage;

            // Setup AGC
            agc = new AGC(dataStorage, streamCollection, this);

            // Enable key preview
            this.KeyPreview = true;

            // Setup form style
            this.BackColor  = Color.FromArgb(255, 24, 24, 24);
            this.ForeColor  = foreColor;
            this.ClientSize = new Size((int)(pxPrChar * 44) + padding_left + padding_right, (int)(pxPrLine * 24) + padding_top + padding_bottom);

            // Initiate Graph Timer
            graphTimer = new System.Timers.Timer();
            graphTimer.SynchronizingObject = this;
            graphTimer.AutoReset           = false;
            graphTimer.Interval            = 1000;
            graphTimer.Elapsed            += graphTick;
            graphTimer.Start();

            // Initiate Status Check
            statusCheck = new System.Timers.Timer();
            statusCheck.SynchronizingObject = this;
            statusCheck.AutoReset           = true;
            statusCheck.Interval            = 1000;
            statusCheck.Elapsed            += statusCheckTick;
            statusCheck.Start();


            // Load the connection screen
            //SetScreen(0);
            //makeScreen(0);
            //activeScreen = screens[0].activeScreen;

            // Fill form with connection-stuff
            fillForm();
        }
Example #7
0
        private KeyValuePair <double, double?> prevAlt = new KeyValuePair <double, double?>(0, 0);      // Storage of previous MET and altitude for calculation of Hdot (HDOT = m/s)

        public void setupChartData(StreamCollection streamCollection)
        {
            graphStreams = streamCollection;

            chartData.Add("altitudeTime", new List <KeyValuePair <double, double?> >());
            for (int i = 0; i < 600; i++)
            {
                chartData["altitudeTime"].Add(new KeyValuePair <double, double?>(i, null));
            }

            chartData.Add("apoapsisTime", new List <KeyValuePair <double, double?> >());
            for (int i = 0; i < 600; i++)
            {
                chartData["apoapsisTime"].Add(new KeyValuePair <double, double?>(i, null));
            }

            chartData.Add("periapsisTime", new List <KeyValuePair <double, double?> >());
            for (int i = 0; i < 600; i++)
            {
                chartData["periapsisTime"].Add(new KeyValuePair <double, double?>(i, null));
            }

            chartData.Add("geeTime", new List <KeyValuePair <double, double?> >());
            for (int i = 0; i < 600; i++)
            {
                chartData["geeTime"].Add(new KeyValuePair <double, double?>(i, null));
            }

            chartData.Add("terrainTime", new List <KeyValuePair <double, double?> >());
            for (int i = 0; i < 600; i++)
            {
                chartData["terrainTime"].Add(new KeyValuePair <double, double?>(i, null));
            }

            chartData.Add("dynPresTime", new List <KeyValuePair <double, double?> >());
            for (int i = 0; i < 600; i++)
            {
                chartData["dynPresTime"].Add(new KeyValuePair <double, double?>(i, null));
            }

            chartData.Add("rollTime", new List <KeyValuePair <double, double?> >());
            for (int i = 0; i < 600; i++)
            {
                chartData["rollTime"].Add(new KeyValuePair <double, double?>(i, null));
            }

            chartData.Add("pitchTime", new List <KeyValuePair <double, double?> >());
            for (int i = 0; i < 600; i++)
            {
                chartData["pitchTime"].Add(new KeyValuePair <double, double?>(i, null));
            }

            chartData.Add("yawTime", new List <KeyValuePair <double, double?> >());
            for (int i = 0; i < 600; i++)
            {
                chartData["yawTime"].Add(new KeyValuePair <double, double?>(i, null));
            }

            chartData.Add("altitudeSpeed", new List <KeyValuePair <double, double?> >());
            for (int i = 0; i < 3000; i++)
            {
                chartData["altitudeSpeed"].Add(new KeyValuePair <double, double?>(i, null));
            }

            chartData.Add("timeToApoSpeed", new List <KeyValuePair <double, double?> >());
            for (int i = 0; i < 3000; i++)
            {
                chartData["timeToApoSpeed"].Add(new KeyValuePair <double, double?>(i, null));
            }

            chartData.Add("altitudeRange", new List <KeyValuePair <double, double?> >());

            chartData.Add("lat", new List <KeyValuePair <double, double?> >());
            chartData.Add("lon", new List <KeyValuePair <double, double?> >());

            chartData.Add("hdot", new List <KeyValuePair <double, double?> >());
            chartData.Add("hhdot", new List <KeyValuePair <double, double?> >());

            chartData.Add("FlightangleVelocity", new List <KeyValuePair <double, double?> >());

            chartData.Add("geeVel", new List <KeyValuePair <double, double?> >());
        }
Example #8
0
 public AGC(DataStorage ds, StreamCollection streamCollection, Form1 f)
 {
     dataStorage = ds;
     streams     = streamCollection;
     form        = f;
 }