Exemple #1
0
        private void btnInsert__Click(object sender, EventArgs e)
        {
            if (this.dataGridParams_.SelectedRows.Count == 1)
            {
                VVIP vdata = new VVIP();
                vdata.sym = true;
                FormEditValign formedit = new FormEditValign(vdata);
                formedit.Owner = this;

                if (formedit.ShowDialog() == DialogResult.OK)
                {
                    int iIndex = this.dataGridParams_.SelectedRows[0].Index;

                    DataRow row = dtParams.NewRow();
                    row[strColIndex]       = 0;
                    row[strColVipChain]    = formedit.VVIPData.chainx;
                    row[strColVipLevel]    = formedit.VVIPData.chainy;
                    row[strColGrade]       = 0;
                    row[strColSymmetrical] = formedit.VVIPData.sym;
                    row[strColVCL1]        = formedit.VVIPData.vcl1;
                    row[strColVCL2]        = formedit.VVIPData.vcl2;

                    this.dtParams.Rows.InsertAt(row, iIndex);
                    this.UpadteGradeValue();
                }
            }
        }
Exemple #2
0
        public static VVIP FromStream(System.IO.BinaryReader br)
        {
            VVIP obj = new VVIP();

            obj.chainx = br.ReadDouble();
            obj.chainy = br.ReadDouble();
            obj.sym    = br.ReadBoolean();
            obj.grade  = br.ReadDouble();
            obj.vcl1   = br.ReadDouble();
            obj.vcl2   = br.ReadDouble();

            return(obj);
        }
Exemple #3
0
        VVIP GetRow(int iIndex)
        {
            DataRow row  = this.dtParams.Rows[iIndex];
            VVIP    data = new VVIP();

            data.chainx = (double)row[FormValignment.strColVipChain];
            data.chainy = (double)row[FormValignment.strColVipLevel];
            data.grade  = (double)row[FormValignment.strColGrade];
            data.sym    = (bool)row[FormValignment.strColSymmetrical];
            data.vcl1   = (double)row[FormValignment.strColVCL1];
            data.vcl2   = (double)row[FormValignment.strColVCL2];
            return(data);
        }
Exemple #4
0
        void AddRow(VVIP data)
        {
            int rows = dtParams.Rows.Count;

            DataRow row = dtParams.NewRow();

            row[strColIndex]       = rows;
            row[strColVipChain]    = data.chainx;
            row[strColVipLevel]    = data.chainy;
            row[strColGrade]       = data.grade;
            row[strColSymmetrical] = data.sym;
            row[strColVCL1]        = data.vcl1;
            row[strColVCL2]        = data.vcl2;

            dtParams.Rows.Add(row);
        }
Exemple #5
0
        void FillDetails(List <VVIP> listVipData)
        {
            if (listVipData.Count > 1)
            {
                for (int iIndex = 0; iIndex < listVipData.Count; iIndex++)
                {
                    VVIP data = listVipData[iIndex];
                    data.sym = true;
                    this.AddRow(data);
                }

                UpadteGradeValue();

                this.tbStartChainage_.Value = listVipData[0].chainx;
                this.tbEndChainage_.Value   = listVipData[listVipData.Count - 1].chainx;
            }
        }
Exemple #6
0
        void GetDataFromPolyLine(IHdPolyline3D polyline, ref List <VVIP> listVipData)
        {
            CCfgtype cfg = this.app.ActiveDocument.ConfigParam;

            listVipData.Clear();
            if (polyline != null)
            {
                CPoint3D[] ptCords = polyline.Coordinates;
                for (int iIndex = 0; iIndex < ptCords.Length; iIndex++)
                {
                    VVIP data = new VVIP();
                    data.chainx = ptCords[iIndex].X / cfg.XMetric;
                    data.chainy = ptCords[iIndex].Y / cfg.YMetric;

                    listVipData.Add(data);
                }
            }
        }
Exemple #7
0
        void WriteDataFile()
        {
            List <VVIP>  listparam    = this.GetParamData();
            string       TempFilePath = Path.Combine(this.app.AppDataPath, "VAL1.TMP");
            BinaryWriter bw           = new BinaryWriter(new FileStream(TempFilePath, FileMode.Create), Encoding.Default);

            FirstLine firstline = new FirstLine();

            firstline.ModelName  = this.tbModelName_.Text;
            firstline.StringName = this.tbStringlabel_.Text;
            firstline.Code       = 1;
            firstline.AcceptCode = 0;
            firstline.ToStream(bw);

            SecondLineVIP secondline = new SecondLineVIP();

            secondline.TotalVIPs  = this.dataGridParams_.Rows.Count;
            secondline.StartChain = this.tbStartChainage_.Value;
            secondline.EndChain   = this.tbEndChainage_.Value;
            secondline.Interval   = this.tbChainageInterval_.Value;
            secondline.ToStream(bw);


            for (int i = 0; i < listparam.Count; i++)
            {
                VVIP    data  = listparam[i];
                VIPData vdata = new VIPData();
                vdata.VIPNo     = i + 1;
                vdata.VIP_Chain = data.chainx;
                vdata.VIP_level = data.chainy;
                if (data.sym == true)
                {
                    vdata.VCL1 = data.vcl1 / 2;
                    vdata.VCL2 = data.vcl1 / 2;
                }
                else
                {
                    vdata.VCL1 = data.vcl1;
                    vdata.VCL2 = data.vcl2;
                }
                vdata.ToStream(bw);
            }
            bw.Close();
        }
Exemple #8
0
        void GetDetailsFromExistingData(CValignInfo info, ref List <VVIP> listVipData)
        {
            double tx = 0, ty = 0, tgrade = 0, tv1 = 0;//, tv2 = 0;
            bool   tsym = true;

            listVipData.Clear();
            this.tbModelName_.Text   = info.ModelName;
            this.tbStringlabel_.Text = info.StringLabel;
            VVIP vd = null;

            for (int nLN = 0; nLN < info.DataList.Count; nLN++)
            {
                CValignFilData data = info.DataList[nLN];

                if (nLN == 0)
                {
                    if (data.eltype == 1)
                    {
                        vd        = new VVIP();
                        vd.chainx = data.xs;
                        vd.chainy = data.ys;
                        vd.grade  = data.b1;
                        if (data.rad != data.l)
                        {
                            vd.sym  = false;
                            vd.vcl1 = data.rad;
                            vd.vcl2 = data.l;
                        }
                        else
                        {
                            vd.sym  = true;
                            vd.vcl1 = data.rad + data.l;
                            vd.vcl2 = 0.0;
                        }

                        vd.vcl1 = 0.0;
                        vd.vcl2 = 0.0;
                        listVipData.Add(vd);
                    }
                }
                else
                {
                    if (data.eltype == 3)
                    {
                        vd = new VVIP();

                        vd.chainx = data.hipx;
                        vd.chainy = data.hipy;
                        vd.grade  = data.b1;
                        if (data.rad != data.l)
                        {
                            vd.sym  = false;
                            vd.vcl1 = data.rad;
                            vd.vcl2 = data.l;
                        }
                        else
                        {
                            vd.sym  = true;
                            vd.vcl1 = data.rad + data.l;
                            vd.vcl2 = 0.0;
                        }

                        listVipData.Add(vd);
                    }
                    else // if eltype == 1
                    { // for last line
                        tx     = data.xe;
                        ty     = data.ye;
                        tgrade = data.b2;
                        tsym   = true;
                        tv1    = data.l;
                        //tv2 = 0;
                    }
                }
            }

            vd = new VVIP();

            vd.chainx = tx;
            vd.chainy = ty;
            vd.grade  = tgrade;
            vd.sym    = tsym;
            vd.vcl1   = 0; //tv1;
            vd.vcl2   = 0; //tv2;

            listVipData.Add(vd);
        }