Ejemplo n.º 1
0
        public static IntBox Length(StringBox source)
        {
            IntBox      result = new IntBox();
            XmlDocument doc    = new XmlDocument();

            XmlNode nodeValue = doc.CreateElement("null");

            nodeValue.AppendChild(doc.CreateElement("Value"));
            nodeValue.FirstChild.InnerText = source.text.Length.ToString();
            List <XmlNode> listres = new List <XmlNode>();

            listres.Add(nodeValue);
            result.SetValue(listres);

            return(result);
        }
Ejemplo n.º 2
0
        public static IntBox Distance(VEMap map1, VEMap map2)
        {
            double lat1 = 0, lon1 = 0, lat2 = 0, lon2 = 0, dist = 0;

            if (!double.TryParse(map1.latitude, out lat1))
            {
                dist = double.PositiveInfinity;
            }
            else if (!double.TryParse(map1.longitude, out lat1))
            {
                dist = double.PositiveInfinity;
            }
            else if (!double.TryParse(map2.latitude, out lat1))
            {
                dist = double.PositiveInfinity;
            }
            else if (!double.TryParse(map2.longitude, out lat1))
            {
                dist = double.PositiveInfinity;
            }
            else
            {
                dist = distance(lat1, lon1, lat2, lon2);
            }

            XmlDocument doc       = new XmlDocument();
            XmlNode     nodeValue = doc.CreateElement("null");

            nodeValue.AppendChild(doc.CreateElement("Value"));
            nodeValue.FirstChild.InnerText = dist.ToString();

            IntBox         result  = new IntBox();
            List <XmlNode> listres = new List <XmlNode>();

            listres.Add(nodeValue);
            result.SetValue(listres);


            return(result);
        }