Exemple #1
0
        public static ItemLogHeadInfor getLogHeadInfor(string xmlFilePath, string sJH, string sLogName)
        {
            ItemLogHeadInfor item = new ItemLogHeadInfor();

            item.sJH         = sJH;
            item.sLogName    = sLogName;
            item.sLogColor   = "black";
            item.iIsLog      = 0;
            item.fLeftValue  = 0;
            item.fRightValue = 100;
            XDocument xDoc = XDocument.Load(xmlFilePath);

            foreach (var track in xDoc.Element("SectionMap").Elements("TrackLog").ToList())
            {
                if (track.Element("logName").Value == sLogName)
                {
                    item.sLogColor = track.Element("curveColor").Value;
                    float.TryParse(track.Element("leftValue").Value, out item.fLeftValue);
                    float.TryParse(track.Element("rightValue").Value, out item.fRightValue);
                    break;
                }
            }
            return(item);
        }
Exemple #2
0
        //sTrackID 是 曲线道
        public static string addLog(string pathTemplate, string sTrackID, ItemLogHeadInfor logHead)
        {
            //传入一个参数, sIDTrack 根据 sIDTrack 找到插入的位置,

            XmlDocument wellTemplateXML = new XmlDocument();

            wellTemplateXML.Load(pathTemplate);
            string  sPath = string.Format("//*[@id='{0}']", sTrackID);
            XmlNode XNode = wellTemplateXML.SelectSingleNode(sPath);

            string     sLogID      = cIDmake.idLogCurve(logHead.sLogName);
            XmlElement eleLogTrack = wellTemplateXML.CreateElement("Log");

            eleLogTrack.SetAttribute("id", sLogID);

            XmlElement newNode;

            newNode           = wellTemplateXML.CreateElement("visible");
            newNode.InnerText = "1";
            eleLogTrack.AppendChild(newNode);

            newNode           = wellTemplateXML.CreateElement("hasGrid");
            newNode.InnerText = "1";
            eleLogTrack.AppendChild(newNode);

            newNode           = wellTemplateXML.CreateElement("is2Log10");
            newNode.InnerText = "0";
            eleLogTrack.AppendChild(newNode);

            newNode           = wellTemplateXML.CreateElement("sparsePoint");
            newNode.InnerText = "2";
            eleLogTrack.AppendChild(newNode);

            newNode           = wellTemplateXML.CreateElement("gridLineWidth");
            newNode.InnerText = "0.5";
            eleLogTrack.AppendChild(newNode);

            newNode           = wellTemplateXML.CreateElement("typeMode");
            newNode.InnerText = TypeTrack.曲线.ToString();
            eleLogTrack.AppendChild(newNode);

            newNode           = wellTemplateXML.CreateElement("fill");
            newNode.InnerText = logHead.sFill;
            eleLogTrack.AppendChild(newNode);

            newNode           = wellTemplateXML.CreateElement("fill-rule");
            newNode.InnerText = "nonzero";
            eleLogTrack.AppendChild(newNode);

            newNode           = wellTemplateXML.CreateElement("logName");
            newNode.InnerText = logHead.sLogName;
            eleLogTrack.AppendChild(newNode);

            newNode           = wellTemplateXML.CreateElement("logText");
            newNode.InnerText = logHead.sLogName;
            eleLogTrack.AppendChild(newNode);

            newNode           = wellTemplateXML.CreateElement("unit");
            newNode.InnerText = logHead.sUnit;
            eleLogTrack.AppendChild(newNode);

            newNode           = wellTemplateXML.CreateElement("lineWidth");
            newNode.InnerText = logHead.fLineWidth.ToString();
            eleLogTrack.AppendChild(newNode);

            newNode           = wellTemplateXML.CreateElement("lineType");
            newNode.InnerText = logHead.iLineType.ToString();
            eleLogTrack.AppendChild(newNode);

            newNode           = wellTemplateXML.CreateElement("curveColor");
            newNode.InnerText = logHead.sLogColor;
            eleLogTrack.AppendChild(newNode);

            newNode           = wellTemplateXML.CreateElement("leftValue");
            newNode.InnerText = logHead.fLeftValue.ToString();
            eleLogTrack.AppendChild(newNode);

            newNode           = wellTemplateXML.CreateElement("rightValue");
            newNode.InnerText = logHead.fRightValue.ToString();
            eleLogTrack.AppendChild(newNode);

            XNode.AppendChild(eleLogTrack);

            wellTemplateXML.Save(pathTemplate);


            return(sLogID);
        }