Пример #1
0
        public PositionInLatLonAlt GetReferencePosition(string locationName)
        {
            PositionInLatLonAlt alt = new PositionInLatLonAlt();

            alt.name = "Error";
            string str = string.Empty;

            if (locationName == "Default")
            {
                str = this.m_XMLDocument.SelectSingleNode("/referenceLocation/location[@name='" + locationName + "']/field[@name='REF']").Attributes["default"].Value;
            }
            else
            {
                str = locationName;
            }
            XmlNodeList list = this.m_XMLDocument.SelectNodes("/referenceLocation/location[@name='" + str + "']/field");

            try
            {
                foreach (XmlNode node2 in list)
                {
                    string str2 = node2.Attributes["name"].Value;
                    string str3 = node2.Attributes["default"].Value;
                    if (str3.Length == 0)
                    {
                        str3 = "-9999";
                    }
                    switch (str2)
                    {
                    case "LAT":
                        alt.latitude = Convert.ToDouble(str3);
                        break;

                    case "LON":
                        alt.longitude = Convert.ToDouble(str3);
                        break;

                    case "ALT":
                        alt.altitude = Convert.ToDouble(str3);
                        break;
                    }
                }
                alt.name = str;
            }
            catch (Exception exception)
            {
                MessageBox.Show("Get Reference Location: " + exception.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            return(alt);
        }
Пример #2
0
        public PositionInLatLonAlt GetReferencePosition(string locationName)
        {
            PositionInLatLonAlt alt = new PositionInLatLonAlt();
            alt.name = "Error";
            string str = string.Empty;
            if (locationName == "Default")
            {
                str = this.m_XMLDocument.SelectSingleNode("/referenceLocation/location[@name='" + locationName + "']/field[@name='REF']").Attributes["default"].Value;
            }
            else
            {
                str = locationName;
            }
            XmlNodeList list = this.m_XMLDocument.SelectNodes("/referenceLocation/location[@name='" + str + "']/field");
            try
            {
                foreach (XmlNode node2 in list)
                {
                    string str2 = node2.Attributes["name"].Value;
                    string str3 = node2.Attributes["default"].Value;
                    if (str3.Length == 0)
                    {
                        str3 = "-9999";
                    }
                    switch (str2)
                    {
                        case "LAT":
                            alt.latitude = Convert.ToDouble(str3);
                            break;

                        case "LON":
                            alt.longitude = Convert.ToDouble(str3);
                            break;

                        case "ALT":
                            alt.altitude = Convert.ToDouble(str3);
                            break;
                    }
                }
                alt.name = str;
            }
            catch (Exception exception)
            {
                MessageBox.Show("Get Reference Location: " + exception.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
            return alt;
        }