/// <summary> /// Ares the quadrilateral vertices valid. /// </summary> /// <param name="quadrilateralArea">The quadrilateral area.</param> /// <returns><c>true</c> if XXXX, <c>false</c> otherwise.</returns> private bool AreQuadrilateralVerticesValid(QuadrilateralArea quadrilateralArea) { List <Location> locations = new List <Location>(); locations.AddRange(new[] { quadrilateralArea.NEPoint.ToLocation(), quadrilateralArea.NWPoint.ToLocation(), quadrilateralArea.SEPoint.ToLocation(), quadrilateralArea.SWPoint.ToLocation(), quadrilateralArea.NEPoint.ToLocation() }); for (int locationIndex = 0; locationIndex < locations.Count - 1; locationIndex++) { var distance = GeoCalculations.GetDistance(locations[locationIndex], locations[locationIndex + 1]); if (distance.InKm() > 3) { return(false); } } return(true); }
/// <summary> /// constructs the Quadrilateral Area for LP-AUX Registration /// </summary> /// <param name="xmlNodeList">XML Node list</param> /// <param name="namespaceManager">Name Space Manager which has all xml name spaces</param> /// <returns>QuadrilateralArea array</returns> private QuadrilateralArea[] BuildLPAuxQuadArea(XmlNodeList xmlNodeList, XmlNamespaceManager namespaceManager) { QuadrilateralArea[] quadrilArea = null; char[] delimiterChars = { ' ' }; string[] pos = new string[2]; Position position = null; if (xmlNodeList != null) { quadrilArea = new QuadrilateralArea[xmlNodeList.Count]; for (int index = 0; index < xmlNodeList.Count; index++) { // Ne Point quadrilArea[index] = new QuadrilateralArea(); position = new Position(); pos = xmlNodeList[index].SelectSingleNode("ren:NE_Point/gml:pos", namespaceManager).InnerText.Split(delimiterChars); position.Latitude = Convert.ToDouble(pos[0]); position.Longitude = Convert.ToDouble(pos[1]); quadrilArea[index].NEPoint = position; // NW point position = new Position(); pos = xmlNodeList[index].SelectSingleNode("ren:NW_Point/gml:pos", namespaceManager).InnerText.Split(delimiterChars); position.Latitude = Convert.ToDouble(pos[0]); position.Longitude = Convert.ToDouble(pos[1]); quadrilArea[index].NWPoint = position; // SE point position = new Position(); pos = xmlNodeList[index].SelectSingleNode("ren:SE_Point/gml:pos", namespaceManager).InnerText.Split(delimiterChars); position.Latitude = Convert.ToDouble(pos[0]); position.Longitude = Convert.ToDouble(pos[1]); quadrilArea[index].SEPoint = position; // SW point position = new Position(); pos = xmlNodeList[index].SelectSingleNode("ren:SW_Point/gml:pos", namespaceManager).InnerText.Split(delimiterChars); position.Latitude = Convert.ToDouble(pos[0]); position.Longitude = Convert.ToDouble(pos[1]); quadrilArea[index].SWPoint = position; } } return(quadrilArea); }