Example #1
0
        public static List <ItemLogHeadInfor> readLogDic2Struct(string filePath)
        {
            List <ItemLogHeadInfor> listItemLogHeadInfors = new List <ItemLogHeadInfor>();

            try
            {
                using (StreamReader sr = new StreamReader(filePath, System.Text.Encoding.UTF8))
                {
                    String line;
                    while ((line = sr.ReadLine()) != null) //delete the line whose legth is 0
                    {
                        ItemLogHeadInfor logItem = new ItemLogHeadInfor();
                        string[]         split   = line.Trim().Split(new char[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
                        logItem.sJH         = split[0];
                        logItem.sLogName    = split[2];
                        logItem.sUnit       = split[3];
                        logItem.fLeftValue  = float.Parse(split[4]);
                        logItem.fRightValue = float.Parse(split[5]);
                        logItem.iIsLog      = int.Parse(split[6]);
                        logItem.sLogColor   = split[7];
                        logItem.fLineWidth  = float.Parse(split[8]);
                        logItem.iLineType   = int.Parse(split[9]);
                        listItemLogHeadInfors.Add(logItem);
                    }
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.ToString());
            }
            return(listItemLogHeadInfors);
        }
 private void tsmiDataImport_Click(object sender, EventArgs e)
 {
     //先写入测井头,再写入数据
     for (int i = dgvDataTable.ColumnCount - 1; i > 0; i--)
     {
         string           sLogName  = dgvDataTable.Rows[0].Cells[i].Value.ToString();
         ItemLogHeadInfor logHead   = new ItemLogHeadInfor(this.sJH, sLogName);
         Random           random    = new Random();
         string           sHexColor = cPublicMethodBase.HexConverter(Color.FromArgb(random.Next(0, 255), random.Next(0, 255), random.Next(0, 255)));
         logHead.sFill = sHexColor;
         //此处写入配置文件xml,tn.name 是 id
         string sLogID = cXmlDocSectionWell.addLog(this.filePathOper, sTrackID, logHead);
         ltWordRet.Clear();
         for (int jLine = 1; jLine < dgvDataTable.RowCount - 1; jLine++)
         {
             ltWordRet.Add(dgvDataTable.Rows[jLine].Cells[0].Value.ToString()); //加深度;
             float fValue = 0;
             for (int k = 1; k <= i; k++)                                       //数值相加求和
             {
                 float fCurCellValue = 0;
                 float.TryParse(dgvDataTable.Rows[jLine].Cells[k].Value.ToString(), out fCurCellValue);
                 fValue = fValue + fCurCellValue;
             }
             ltWordRet.Add(fValue.ToString());
         }
         cXmlDocSectionWell.updateTrackData(filePathOper, sLogID, string.Join(cProjectData.splitMark, ltWordRet));
     }
     //数据写人对应的道
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
Example #3
0
        public ItemLogHeadInfor selectLogHeadItem(string sJH, string sLogName)
        {
            ItemLogHeadInfor itemHeadInfor = new ItemLogHeadInfor();

            itemHeadInfor.sJH         = sJH;
            itemHeadInfor.sLogName    = sLogName;
            itemHeadInfor.sLogColor   = "red";
            itemHeadInfor.fRightValue = 100.0f;
            itemHeadInfor.fLeftValue  = 0.0f;
            return(itemHeadInfor);
        }
Example #4
0
        public static string item2Line(ItemLogHeadInfor itemLogHeadInfor)
        {
            List <string> ltStrWrited = new List <string>();

            ltStrWrited.Add(itemLogHeadInfor.sJH);
            ltStrWrited.Add(itemLogHeadInfor.sLogName);
            ltStrWrited.Add(itemLogHeadInfor.sUnit);
            ltStrWrited.Add(itemLogHeadInfor.fLeftValue.ToString());
            ltStrWrited.Add(itemLogHeadInfor.fRightValue.ToString());
            ltStrWrited.Add(itemLogHeadInfor.iIsLog.ToString());
            ltStrWrited.Add(itemLogHeadInfor.sLogColor);
            ltStrWrited.Add(itemLogHeadInfor.fLineWidth.ToString());
            ltStrWrited.Add(itemLogHeadInfor.iLineType.ToString());
            return(string.Join("\t", ltStrWrited.ToArray()));
        }
Example #5
0
        private void tsmiAddLog_Click(object sender, EventArgs e)
        {
            TreeNode tn  = tvSectionEdit.SelectedNode;
            string   sJH = tn.Parent.Text;

            if (tn.Tag.ToString() == TypeTrack.曲线道.ToString())
            {
                FormSectionAddWellLog formAddLog = new FormSectionAddWellLog(sJH);
                if (formAddLog.ShowDialog() == DialogResult.OK)
                {
                    ItemLogHeadInfor logHead = formAddLog.logHeadRet;
                    //此处写入配置文件xml,tn.name 是 id
                    cXmlDocSectionWell.addLog(this.filePathOper, tn.Name, logHead);
                }
            }
        }
Example #6
0
 private void tsmiTrackAddLogCurve_Click(object sender, EventArgs e)
 {
     if (sIDcurrentTrack.StartsWith("idTrack"))
     {
         if (cXmlDocSectionWell.getTrackTypeByID(filePathTemple, sIDcurrentTrack) == TypeTrack.曲线道.ToString())
         {
             string sJH = cXmlDocSectionWell.getNodeInnerText(this.filePathTemple, cXmlDocSectionWell.fullPathJH);
             FormSectionAddWellLog formAddLog = new FormSectionAddWellLog(sJH);
             if (formAddLog.ShowDialog() == DialogResult.OK)
             {
                 ItemLogHeadInfor logHead = formAddLog.logHeadRet;
                 //此处写入配置文件xml,tn.name 是 id
                 string sLogID   = cXmlDocSectionWell.addLog(this.filePathTemple, sIDcurrentTrack, logHead);
                 string sLogName = cIDmake.getLogNameByID(sLogID);
                 //如果测井文件存在,自动加载数据
                 //cIOtemplate.addLogData2Track(filePathSVG, sJH, sLogName, sLogID);
             }
             userFunctionPointer.DynamicInvoke(0);
         }
     }
 }