void SaveAndFinish() { CHalignElementUtil.SaveHalign(this.m_app.AppDataPath); // delete halign.tmp ViewerUtils.DeleteFileIfExists(System.IO.Path.Combine(this.m_app.AppDataPath, "halign.tmp")); ViewerUtils.RenameFile(System.IO.Path.Combine(this.m_app.AppDataPath, "~halign.fil"), "~*halign.fil"); }
void FillFromExistingData(CHIPInfo info) { if (info.IsHipData == false) { ViewerUtils.DeleteFileIfExists(System.IO.Path.Combine(this.m_app.AppDataPath, "halign.tmp")); int nidxED = 0; this.txtModelName_.Text = info.ModelName; this.txtStringlabel_.Text = info.StringLabel; for (int iCnt = 0; iCnt < info.DataList.Count; iCnt++) { CHalignFilData fildata = info.DataList[iCnt]; if (carED[nidxED] == null) { carED[nidxED] = new CElementData(); } carED[nidxED].dBearings = fildata.dB1; carED[nidxED].dChainInterval = 10; carED[nidxED].dLength = fildata.dEllength; if (fildata.iTurn == 1) { fildata.dRadius = -1 * fildata.dRadius; } carED[nidxED].dRadius = fildata.dRadius; carED[nidxED].dStartChain = fildata.dStartchn; carED[nidxED].dXvalue = fildata.dStartx; carED[nidxED].dYvalue = fildata.dStarty; carED[nidxED].nElementNo = nidxED + 1; carED[nidxED].nType = fildata.iEltype; CHalignElementUtil code = new CHalignElementUtil(); code.Funcmain(this.m_app.AppDataPath, 2, 1, info.ModelName, info.StringLabel , (short)(nidxED + 1), fildata.iEltype, fildata.dStartchn , 10.0, fildata.dStartx, fildata.dStarty, fildata.dB1 , fildata.dEllength, fildata.dRadius); carED[nidxED].npLineID = DrawingUtil.DrawData(this.m_app, System.IO.Path.Combine(this.m_app.AppDataPath, "HAL2.TMP"), "ELE", true); nidxED++; this.SelectedElementType = fildata.iEltype; this.txtChainageInterval_.Value = 10.0; this.txtLength_.Value = fildata.dEllength; this.txtModelName_.Text = fildata.sMod; this.txtRadius_.Value = fildata.dRadius; this.txtStartInterval_.Value = fildata.dEndchn; this.txtStringlabel_.Text = fildata.sString; this.txtWCBearings_.Value = fildata.dB2; this.txtXVal_.Value = fildata.dEndx; this.txtYVal_.Value = fildata.dEndy; this.StartEleNo = nidxED + 1; ElementNo = nidxED + 1; nTotED = ElementNo - 1; TotalEleDrawn = nidxED; lastED.dStartChain = this.txtStartInterval_.Value; lastED.dChainInterval = this.txtChainageInterval_.Value; lastED.dXvalue = this.txtXVal_.Value; lastED.dYvalue = this.txtYVal_.Value; lastED.nType = this.SelectedElementType; lastED.dBearings = this.txtWCBearings_.Value; lastED.dLength = this.txtLength_.Value; lastED.dRadius = this.txtRadius_.Value; lastED.nElementNo = this.StartEleNo; } this.m_app.ActiveDocument.RefreshDocument(); this.m_app.ZoomExtents(); //ViewerUtils.DeleteFileIfExists(this.m_app.AppDataPath + @"\~halign.fil"); } }
void ApplyData() { if (this.txtModelName_.Text.Trim() == "" || this.txtStringlabel_.Text.Trim() == "") { MessageBox.Show("Input Model Name and String Level" , Resources.ST_ERROR_MSGBOX_CAPTION , System.Windows.Forms.MessageBoxButtons.OK , System.Windows.Forms.MessageBoxIcon.Information); return; } else { if (this.txtModelName_.ReadOnly == false) { string strHalignFilFilePath = System.IO.Path.Combine(this.m_app.AppDataPath, "HALIGN.FIL"); CHIPInfo[] infoarr = CHalignHipUtil.ReadHaligns(strHalignFilFilePath); foreach (CHIPInfo info in infoarr) { if (info.ModelName.Trim().ToLower() == this.txtModelName_.Text.Trim().ToLower() && info.StringLabel.Trim().ToLower() == this.txtStringlabel_.Text.Trim().ToLower()) { MessageBox.Show("Model Name and String Level already exists\nPlease specify unique Model Name and String Level" , Resources.ST_ERROR_MSGBOX_CAPTION , System.Windows.Forms.MessageBoxButtons.OK , System.Windows.Forms.MessageBoxIcon.Information); return; } } } } this.Cursor = System.Windows.Forms.Cursors.WaitCursor; this.btnSaveFinish_.Enabled = false; ViewerUtils.DeleteFileIfExists(System.IO.Path.Combine(this.m_app.AppDataPath, "halign.tmp")); int loop = nTotED; while (loop > 0) { loop--; //Delete existing hip line IHdEntity entity = this.m_app.ActiveDocument.GetObjectById(carED[loop].npLineID); if (entity != null) { entity.Erase(); } } CHalignElementUtil code = new CHalignElementUtil(); for (loop = 0; loop < ElementNo - 1; loop++) { ViewerUtils.DeleteFileIfExists(System.IO.Path.Combine(this.m_app.AppDataPath, "HAL2.TMP")); code.Funcmain(this.m_app.AppDataPath, 2, 1, this.txtModelName_.Text, this.txtStringlabel_.Text , (short)carED[loop].nElementNo, (short)carED[loop].nType, carED[loop].dStartChain , carED[loop].dChainInterval, carED[loop].dXvalue, carED[loop].dYvalue , carED[loop].dBearings, carED[loop].dLength, carED[loop].dRadius); this.m_iLastAppliedPolyLine = DrawingUtil.DrawData(this.m_app, System.IO.Path.Combine(this.m_app.AppDataPath, "HAL2.TMP"), "ELE", true); carED[loop].npLineID = this.m_iLastAppliedPolyLine; } //end for ViewerUtils.DeleteFileIfExists(Path.Combine(this.m_app.AppDataPath, "HAL2.TMP")); //writes hal2.tmp, appends halign.tmp code.Funcmain(this.m_app.AppDataPath, 2, 1, this.txtModelName_.Text, this.txtStringlabel_.Text , (short)ElementNo, this.SelectedElementType, this.txtStartInterval_.Value , this.txtChainageInterval_.Value, this.txtXVal_.Value, this.txtYVal_.Value , this.txtWCBearings_.Value, this.txtLength_.Value, this.txtRadius_.Value); this.m_iLastAppliedPolyLine = DrawingUtil.DrawData(this.m_app, Path.Combine(this.m_app.AppDataPath, "HAL2.TMP"), "ELE", true); GetDlgED((ElementNo - 1), (int)this.SelectedElementType, this.m_iLastAppliedPolyLine); nTotED = ElementNo; // AcceptCode = 1; ElementNo = ElementNo + 1; this.StartEleNo = ElementNo; this.txtXVal_.Value = code.xe; this.txtYVal_.Value = code.ye; this.txtWCBearings_.Value = code.b2; this.txtStartInterval_.Value += this.txtLength_.Value; this.TotalEleDrawn = nTotED; lastED.dXvalue = code.xe; lastED.dYvalue = code.ye; lastED.dBearings = code.b2; lastED.dChainInterval = this.txtChainageInterval_.Value; lastED.dStartChain = this.txtStartInterval_.Value; lastED.nType = (int)this.SelectedElementType; lastED.dLength = this.txtLength_.Value; lastED.dRadius = this.txtRadius_.Value; lastED.nElementNo = ElementNo; this.m_app.ActiveDocument.RefreshDocument(); this.btnSaveFinish_.Enabled = true; this.Cursor = System.Windows.Forms.Cursors.Default; }