Esempio n. 1
0
        public void ReadCurve(MouldCurve c)
        {
            if (c == null)
            {
                Panel.Clear();
                return;
            }
            //Label = c.Label;
            Length = c.Length;
            SuspendLayout();
            if (m_edits == null || c.FitPoints.Length != m_edits.Length)
            {
                Panel.Clear();
                m_girths = new CheckBox[c.FitPoints.Length - 1];
                m_combos = new ImageComboBox[c.FitPoints.Length];
                m_edits = new IFitEditor[c.FitPoints.Length];
            }
            Control ptBox = null;
            Control old = null;
            ////get the list of available curves from the sail
            //object[] autofill =  c.Sail.GetAutoFillData(c).ToArray();

            //create the point controls and add them to the panel
            for (int i = 0; i < c.FitPoints.Length; i++)
            {
                //create the type-speific point editor
                old = m_edits[i] as Control;
                ptBox = c[i].WriteEditor(ref m_edits[i]);
                if( AutoFill != null )
                    m_edits[i].AutoFillData = AutoFill;
                //remove old control if new pointeditor
                if (old != ptBox)
                    Panel.Remove(old);
                Panel.Add(ptBox);

                //create the type selection combobox
                if (m_combos[i] == null)
                    m_combos[i] = ImageBox(m_edits[i].FitType);
                else
                    SetCombo(m_combos[i], m_edits[i].FitType);
                Panel.Add(m_combos[i]);

                //create the segment checkboxes
                if (i < c.FitPoints.Length - 1)
                {
                    old = m_girths[i];
                    m_girths[i] = GirthCheck(c.IsGirth(i));
                    if (old != m_girths[i])
                        Panel.Remove(old);
                    Panel.Add(m_girths[i]);
                }
            }
            //force the layout of the panel controls
            ResumeLayout(true);
            PerformLayout();
            m_panel.Invalidate();//invalidate the panel for next redraw
        }
Esempio n. 2
0
        public bool AddRemoveWarp(MouldCurve curve)
        {
            if (!m_selectingWarp)
                return false;

            if (m_warpListView.Items.ContainsKey(curve.Label))
            {
                m_warpListView.Items.RemoveByKey(curve.Label);
                m_warpListView.Refresh();
                return false;
            }
            else
            {
                m_warpListView.Items.Add(curve.Label, curve.Label, curve.GetType().Name);
                m_warpListView.Refresh();
                return true;
            }
        }
Esempio n. 3
0
        public void WriteCurve(MouldCurve c)
        {
            //c.Label = Label;

            bool[] girths = new bool[m_girths.Length];
            int i =0;
            foreach (CheckBox b in m_girths)
                girths[i++] = b.Checked;

            i = 0;
            IFitPoint[] points =  new IFitPoint[m_edits.Length];
            foreach (IFitEditor fe in m_edits)
            {
                points[i++] = fe.CreatePoint();
                points[i - 1].Update(c.Sail);
            }

            c.Fit(points, girths);
        }