コード例 #1
0
ファイル: Aircraft_Info.cs プロジェクト: Bome1/AVLInterface
        private void addSurfButton_Click(object sender, EventArgs e)
        {
            InputBox ib = new InputBox("Create a new surface for this aircraft", "Enter name for the new lifting surface:");

            if (ib.ShowDialog() == DialogResult.OK)
            {
                if (ib.InputText != string.Empty)
                {
                    AVL_File.Surface         surf = new AVL_File.Surface(ib.InputText, m_ap.Initial_AVL_File);
                    AVL_File.Surface.Section sec1 = new AVL_File.Surface.Section(surf);
                    sec1.Chord = 10;
                    AVL_File.Surface.Section sec2 = new AVL_File.Surface.Section(surf);
                    sec2.Chord         = 10;
                    sec2.Y_LeadingEdge = 10;

                    surf.Sections.Add(sec1);
                    surf.Sections.Add(sec2);

                    m_ap.Initial_AVL_File.Surfaces.Add(surf);

                    SurfaceUC suc = new SurfaceUC(surf);
                    this.flowLayoutPanel1.Controls.Add(suc);
                }
            }
        }
コード例 #2
0
        public SurfaceUC(AVL_File.Surface surf) : this()
        {
            m_surf                       = surf;
            ribbonTab1.Text              = "SURFACE: " + surf.Name;
            ydupTextBox.TextBoxText      = surf.YDUPLICATE.ToString();
            componentTextBox.TextBoxText = surf.COMPONENT.ToString();
            scaleTextBox.TextBoxText     = surf.SCALE[0].ToString() + "," + surf.SCALE[1].ToString() + "," + surf.SCALE[2].ToString();
            translateTextBox.TextBoxText = surf.TRANSLATE[0].ToString() + "," + surf.TRANSLATE[1].ToString() + "," + surf.TRANSLATE[2].ToString();
            angleTextBox.TextBoxText     = surf.ANGLE.ToString();

            nowakeCheck.Checked = surf.NOWAKE;
            noableCheck.Checked = surf.NOALBE;
            noloadCheck.Checked = surf.NOLOAD;

            chordwiseUpDown.TextBoxText = surf.Nchordwise.ToString();
            spanwiseUpDown.TextBoxText  = surf.Nspanwise.ToString();

            string[] ControlNames = ControlSurfNames();
            for (int i = 0; i < ControlNames.Length; i++)
            {
                var lab = new RibbonLabel();
                lab.Text = ControlNames[i];
                controlSurfDropDown.DropDownItems.Add(lab);
                if (i == 0)
                {
                    controlSurfDropDown.SelectedItem = lab;
                }
            }

            ChangeSection(0);
            RecalculateStats();
            OnChangedSelection(this, new SectionSelectEventArgs(-1));
        }
コード例 #3
0
ファイル: SurfaceUC.cs プロジェクト: Bome1/AVLInterface
        public SurfaceUC(AVL_File.Surface surf)
            : this()
        {
            m_surf = surf;
            ribbonTab1.Text = "SURFACE: " + surf.Name;
            ydupTextBox.TextBoxText = surf.YDUPLICATE.ToString();
            componentTextBox.TextBoxText = surf.COMPONENT.ToString();
            scaleTextBox.TextBoxText = surf.SCALE[0].ToString() + "," + surf.SCALE[1].ToString() + "," + surf.SCALE[2].ToString();
            translateTextBox.TextBoxText = surf.TRANSLATE[0].ToString() + "," + surf.TRANSLATE[1].ToString() + "," + surf.TRANSLATE[2].ToString();
            angleTextBox.TextBoxText = surf.ANGLE.ToString();

            nowakeCheck.Checked = surf.NOWAKE;
            noableCheck.Checked = surf.NOALBE;
            noloadCheck.Checked = surf.NOLOAD;

            chordwiseUpDown.TextBoxText = surf.Nchordwise.ToString();
            spanwiseUpDown.TextBoxText = surf.Nspanwise.ToString();

            string[] ControlNames = ControlSurfNames();
            for (int i = 0; i < ControlNames.Length; i++)
            {
                var lab = new RibbonLabel();
                lab.Text = ControlNames[i];
                controlSurfDropDown.DropDownItems.Add(lab);
                if (i == 0)
                    controlSurfDropDown.SelectedItem = lab;
            }

            ChangeSection(0);
            RecalculateStats();
            OnChangedSelection(this, new SectionSelectEventArgs(-1));
        }
コード例 #4
0
        private void newFileButton_Click(object sender, EventArgs e)
        {
            //here we create a new default airplane
            InputBox ib = new InputBox("Create a new aircraft design", "Name of new design:");

            if (ib.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (ib.InputText == string.Empty)
                {
                    return;
                }

                Aircraft ac = new Aircraft();
                ac.Initial_AVL_File.Title = ib.InputText;

                //make wing surface
                AVL_File.Surface         wingSurf = new AVL_File.Surface("Wing", ac.Initial_AVL_File);
                AVL_File.Surface.Section startSec = new AVL_File.Surface.Section(wingSurf);
                startSec.Chord = 12;
                wingSurf.Sections.Add(startSec);
                AVL_File.Surface.Section endsec = new AVL_File.Surface.Section(wingSurf);
                endsec.Chord         = 12;
                endsec.Y_LeadingEdge = 20;
                wingSurf.Sections.Add(endsec);

                ac.Initial_AVL_File.Surfaces.Add(wingSurf);

                //make hstab surface
                AVL_File.Surface         hSurf     = new AVL_File.Surface("HTail", ac.Initial_AVL_File);
                AVL_File.Surface.Section startHSec = new AVL_File.Surface.Section(hSurf);
                startHSec.Chord         = 7;
                startHSec.X_LeadingEdge = 30;
                hSurf.Sections.Add(startHSec);
                AVL_File.Surface.Section endHsec = new AVL_File.Surface.Section(hSurf);
                endHsec.Chord         = 7;
                endHsec.X_LeadingEdge = 30;
                endHsec.Y_LeadingEdge = 9;
                hSurf.Sections.Add(endHsec);

                ac.Initial_AVL_File.Surfaces.Add(hSurf);

                ac.Initial_AVL_File.Sref = 480;
                ac.Initial_AVL_File.Bref = 40;
                ac.Initial_AVL_File.Cref = 12;
                ac.Initial_AVL_File.Xref = 3;

                this.designs.Add(ac);

                InstanceUC iuc = new InstanceUC(ac);
                this.flowLayoutPanel1.Controls.Add(iuc);
                iuc.Click += new EventHandler(iuc_Click);

                System.Threading.Thread.Sleep(75);
                ConstraintsUC cuc = new ConstraintsUC(ac);
                cuc.Height = flowLayoutPanel2.Height - 25;
                this.flowLayoutPanel2.Controls.Add(cuc);
            }
        }
コード例 #5
0
ファイル: GeometryModeler.cs プロジェクト: Bome1/AVLInterface
        private static List <Line3D> DrawSurface(AVL_File.Surface surf, int SecHighlight)
        {
            List <Line3D> lines = new List <Line3D>();

            for (int i = 0; i < surf.Sections.Count - 1; i++)
            {
                lines.AddRange(DrawSection(surf.Sections[i], surf.Sections[i + 1], surf.Nchordwise, surf.Cspace, surf.Nspanwise, surf.Sspace, surf.YDUPLICATE, i == SecHighlight));
            }

            lines.Add(DrawBorder(surf));
            return(lines);
        }
コード例 #6
0
ファイル: GeometryModeler.cs プロジェクト: Bome1/AVLInterface
        /// <summary>
        /// Draws the border around the surface
        /// Still not quite right, if you duplicate off the y-axis then it doesnt quite outline each surface on its own
        /// Maybe code for the edges, skipping the last return point if ydup = 0, then mirror all points
        /// </summary>
        /// <param name="surf">Surface to draw border around</param>
        /// <returns>Points representing the border</returns>
        private static Line3D DrawBorder(AVL_File.Surface surf)
        {
            Point3D[] pts;
            if (!double.IsNaN(surf.YDUPLICATE))
            {
                pts = new Point3D[surf.Sections.Count * 4];
            }
            else
            {
                pts = new Point3D[surf.Sections.Count * 2 + 1];
            }

            int i = 0;

            foreach (AVL_File.Surface.Section sec in surf.Sections)
            {
                pts[i] = new Point3D(sec.X_LeadingEdge, sec.Y_LeadingEdge, sec.Z_LeadingEdge);

                if (double.IsNaN(surf.YDUPLICATE))
                {
                    pts[(pts.Length - 2) - i] = new Point3D(sec.X_LeadingEdge + sec.Chord, sec.Y_LeadingEdge, sec.Z_LeadingEdge);
                }
                else
                {
                    pts[(pts.Length - 1) - i] = pts[i].InvertY(surf.YDUPLICATE);                                                        //mirrored leading edge

                    pts[((pts.Length) / 2) - 1 - i] = new Point3D(sec.X_LeadingEdge + sec.Chord, sec.Y_LeadingEdge, sec.Z_LeadingEdge); //trailing edge
                    pts[((pts.Length) / 2) + i]     = Point3D.Translate(pts[(pts.Length - 1) - i], sec.Chord, 0, 0);
                }
                i++;
            }

            if (double.IsNaN(surf.YDUPLICATE))
            {
                pts[pts.Length - 1] = pts[0];
            }

            return(new Line3D(pts, BorderColor));
        }
コード例 #7
0
ファイル: Aircraft_Info.cs プロジェクト: Bome1/AVLInterface
        private void addSurfButton_Click(object sender, EventArgs e)
        {
            InputBox ib = new InputBox("Create a new surface for this aircraft", "Enter name for the new lifting surface:");
            if (ib.ShowDialog() == DialogResult.OK)
            {
                if (ib.InputText != string.Empty)
                {
                    AVL_File.Surface surf = new AVL_File.Surface(ib.InputText, m_ap.Initial_AVL_File);
                    AVL_File.Surface.Section sec1 = new AVL_File.Surface.Section(surf);
                    sec1.Chord = 10;
                    AVL_File.Surface.Section sec2 = new AVL_File.Surface.Section(surf);
                    sec2.Chord = 10;
                    sec2.Y_LeadingEdge = 10;

                    surf.Sections.Add(sec1);
                    surf.Sections.Add(sec2);

                    m_ap.Initial_AVL_File.Surfaces.Add(surf);

                    SurfaceUC suc = new SurfaceUC(surf);
                    this.flowLayoutPanel1.Controls.Add(suc);
                }
            }
        }
コード例 #8
0
ファイル: Form1.cs プロジェクト: Bome1/AVLInterface
        private void newFileButton_Click(object sender, EventArgs e)
        {
            //here we create a new default airplane
            InputBox ib = new InputBox("Create a new aircraft design", "Name of new design:");
            if(ib.ShowDialog()== System.Windows.Forms.DialogResult.OK)
            {
                if (ib.InputText == string.Empty)
                    return;

                Aircraft ac = new Aircraft();
                ac.Initial_AVL_File.Title = ib.InputText;

                //make wing surface
                AVL_File.Surface wingSurf = new AVL_File.Surface("Wing", ac.Initial_AVL_File);
                AVL_File.Surface.Section startSec = new AVL_File.Surface.Section(wingSurf);
                startSec.Chord = 12;
                wingSurf.Sections.Add(startSec);
                AVL_File.Surface.Section endsec = new AVL_File.Surface.Section(wingSurf);
                endsec.Chord = 12;
                endsec.Y_LeadingEdge = 20;
                wingSurf.Sections.Add(endsec);

                ac.Initial_AVL_File.Surfaces.Add(wingSurf);

                //make hstab surface
                AVL_File.Surface hSurf = new AVL_File.Surface("HTail", ac.Initial_AVL_File);
                AVL_File.Surface.Section startHSec = new AVL_File.Surface.Section(hSurf);
                startHSec.Chord = 7;
                startHSec.X_LeadingEdge = 30;
                hSurf.Sections.Add(startHSec);
                AVL_File.Surface.Section endHsec = new AVL_File.Surface.Section(hSurf);
                endHsec.Chord = 7;
                endHsec.X_LeadingEdge = 30;
                endHsec.Y_LeadingEdge = 9;
                hSurf.Sections.Add(endHsec);

                ac.Initial_AVL_File.Surfaces.Add(hSurf);

                ac.Initial_AVL_File.Sref = 480;
                ac.Initial_AVL_File.Bref = 40;
                ac.Initial_AVL_File.Cref = 12;
                ac.Initial_AVL_File.Xref = 3;

                this.designs.Add(ac);

                InstanceUC iuc = new InstanceUC(ac);
                this.flowLayoutPanel1.Controls.Add(iuc);
                iuc.Click += new EventHandler(iuc_Click);

                System.Threading.Thread.Sleep(75);
                ConstraintsUC cuc = new ConstraintsUC(ac);
                cuc.Height = flowLayoutPanel2.Height - 25;
                this.flowLayoutPanel2.Controls.Add(cuc);
            }
        }
コード例 #9
0
ファイル: GeometryModeler.cs プロジェクト: Bome1/AVLInterface
 private static List <Line3D> DrawSurface(AVL_File.Surface surf)
 {
     return(DrawSurface(surf, -1));
 }