Exemplo n.º 1
0
 private void lbcoord_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lbcoord.SelectedIndex != -1)
     {
         CoordInfo crood = ListCoords[this.lbcoord.SelectedIndex];
         this.txtoutputname.Text = crood.CoordName;
         this.txtminx.Text       = crood.MinX.ToString();
         this.txtmaxx.Text       = crood.MaxX.ToString();
         this.txtminy.Text       = crood.MinY.ToString();
         this.txtmaxy.Text       = crood.MaxY.ToString();
     }
 }
Exemplo n.º 2
0
        public InputArgs GetConfigByXml(string xmlfile)
        {
            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(xmlfile);
                InputArgs  input        = new InputArgs();
                XmlElement inputfileele = doc.DocumentElement.SelectSingleNode("InputDir") as XmlElement;
                string     localfile    = inputfileele.GetAttribute("dir");
                input.InputDir = localfile;
                string[] listfiles = GetDirFiles(localfile);
                input.ListInputFiles = listfiles == null?new List <string>(): listfiles.ToList();
                XmlElement outfileele = doc.DocumentElement.SelectSingleNode("OutputDir") as XmlElement;
                input.OutDir = outfileele.GetAttribute("dir");

                XmlNodeList listnodecoord = doc.DocumentElement.SelectNodes("CoordEnv");
                for (int i = 0; i < listnodecoord.Count; i++)
                {
                    CoordInfo  corrd        = new CoordInfo();
                    XmlElement coordnameele = listnodecoord[i].SelectSingleNode("CoordName") as XmlElement;
                    string     coorname     = coordnameele.GetAttribute("value");
                    corrd.CoordName = coorname;
                    XmlElement minxele = listnodecoord[i].SelectSingleNode("MinX") as XmlElement;
                    double     MinX    = double.Parse(minxele.GetAttribute("value"));
                    corrd.MinX = MinX;
                    XmlElement maxele = listnodecoord[i].SelectSingleNode("MaxX") as XmlElement;
                    double     MaxX   = double.Parse(maxele.GetAttribute("value"));
                    corrd.MaxX = MaxX;
                    XmlElement minyele = listnodecoord[i].SelectSingleNode("MinY") as XmlElement;
                    double     MinY    = double.Parse(minyele.GetAttribute("value"));
                    corrd.MinY = MinY;
                    XmlElement maxyele = listnodecoord[i].SelectSingleNode("MaxY") as XmlElement;
                    double     MaxY    = double.Parse(maxyele.GetAttribute("value"));
                    corrd.MaxY = MaxY;
                    input.ListCoord.Add(corrd);
                }
                return(input);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Exemplo n.º 3
0
 private void btnAddcoord_Click(object sender, EventArgs e)
 {
     try
     {
         CoordInfo coord = new CoordInfo();
         coord.CoordName = string.IsNullOrEmpty(this.txtoutputname.Text) ? "DXX" : this.txtoutputname.Text;
         coord.MinX      = double.Parse(this.txtminx.Text.Trim());
         coord.MaxX      = double.Parse(this.txtmaxx.Text.Trim());
         coord.MinY      = double.Parse(this.txtminy.Text.Trim());
         coord.MaxY      = double.Parse(this.txtmaxy.Text.Trim());
         if (ListCoords.Count(o => o.CoordName == coord.CoordName) > 0)
         {
             MessageBox.Show("坐标范围名称不能重复!", "提示信息");
             return;
         }
         this.ListCoords.Add(coord);
         LoadListBoxByCoords();
     }
     catch (Exception ex)
     {
         MessageBox.Show("输入内容不符合规范", "提示信息");
     }
 }