//--------------------------------------------------------------------- /// <summary> /// Checks whether Icc data is avaliable. /// </summary> /// <param name="p"> /// The included point. /// </param> /// <returns> /// TRUE if there is avaliable data. /// Otherwise, FALSE. /// </returns> //--------------------------------------------------------------------- private static bool couldBeICCInfo(Point p) { //TODO:: Hemisphere issues? HayPoint hayPoint = new HayPoint(p.toWgs()); double utmX = hayPoint.getUtmX(); double utmY = hayPoint.getUtmY(); if (utmX > Icc.MINHAYUTMX && utmX < Icc.MAXHAYUTMX && utmY > Icc.MINHAYUTMY && utmY < Icc.MAXHAYUTMY) { return(true); } else { return(false); } }
//--------------------------------------------------------------------- /// <summary> /// Checks whether Icc data is avaliable. /// </summary> /// <param name="p"> /// The included point. /// </param> /// <returns> /// TRUE if there is avaliable data. /// Otherwise, FALSE. /// </returns> //--------------------------------------------------------------------- private static bool couldBeICCInfo(Point p) { //TODO:: Hemisphere issues? HayPoint hayPoint = new HayPoint(p.toWgs()); double utmX = hayPoint.getUtmX(); double utmY = hayPoint.getUtmY(); if (utmX > Icc.MINHAYUTMX && utmX < Icc.MAXHAYUTMX && utmY > Icc.MINHAYUTMY && utmY < Icc.MAXHAYUTMY) return true; else return false; }
//--------------------------------------------------------------------- /// <summary> /// Builds the specified file path. /// </summary> /// <param name="p">The included waypoint.</param> /// <param name="demType">The DEM type</param> /// <returns>The file path(s)</returns> //--------------------------------------------------------------------- private static string buildPath(Point p, DemType demType) { string path = string.Empty; HayPoint hayPoint = new HayPoint(p.toWgs()); WgsPoint wgsPoint = p.toWgs(); if (demType == DemType.Icc) { if (couldBeICCInfo(p)) { if (hayPoint.getUtmX() < (Icc.MAXHAYUTMX + Icc.MINHAYUTMX) / 2) path = Icc.PATHWEST; else path = Icc.PATHEAST; } else path = string.Empty; } else if (demType == DemType.Srtm3) { int lon = Convert.ToInt32(Math.Floor(wgsPoint.getLongitude())); int lat = Convert.ToInt32(Math.Floor(wgsPoint.getLatitude())); if (lat < 0) path += "S"; else path += "N"; if (Math.Abs(lat) < 10) path += "0" + Math.Abs(lat); else path += Math.Abs(lat); if (lon < 0) path += "W"; else path += "E"; if (Math.Abs(lon) < 10) path += "00" + Math.Abs(lon); else if (Math.Abs(lon) < 100) path += "0" + Math.Abs(lon); else path += Math.Abs(lon); path += ".hgt"; } else if (demType == DemType.Srtm30) { int lon = Convert.ToInt32(Math.Floor(wgsPoint.getLongitude())); int lat = Convert.ToInt32(Math.Floor(wgsPoint.getLatitude())); if (lat > -60) { if (lon < -140) path += "w180"; else if (lon < -100) path += "w140"; else if (lon < -60) path += "w100"; else if (lon < -20) path += "w060"; else if (lon < 20) path += "w020"; else if (lon < 60) path += "e020"; else if (lon < 100) path += "e060"; else if (lon < 140) path += "e100"; else path += "e140"; } else { if(lon < -120) path += "w180"; else if(lon < -60) path += "w120"; else if(lon < 0) path += "w060"; else if(lon < 60) path += "e000"; else if(lon < 120) path += "e060"; else path += "e120"; } if (lat < -60) path += "s60"; else if (lat < -10) path += "s10"; else if (lat < 40) path += "n40"; else path += "n90"; path += ".dem"; } return path; }
//--------------------------------------------------------------------- /// <summary> /// Builds the specified file path. /// </summary> /// <param name="p">The included waypoint.</param> /// <param name="demType">The DEM type</param> /// <returns>The file path(s)</returns> //--------------------------------------------------------------------- private static string buildPath(Point p, DemType demType) { string path = string.Empty; HayPoint hayPoint = new HayPoint(p.toWgs()); WgsPoint wgsPoint = p.toWgs(); if (demType == DemType.Icc) { if (couldBeICCInfo(p)) { if (hayPoint.getUtmX() < (Icc.MAXHAYUTMX + Icc.MINHAYUTMX) / 2) { path = Icc.PATHWEST; } else { path = Icc.PATHEAST; } } else { path = string.Empty; } } else if (demType == DemType.Srtm3) { int lon = Convert.ToInt32(Math.Floor(wgsPoint.getLongitude())); int lat = Convert.ToInt32(Math.Floor(wgsPoint.getLatitude())); if (lat < 0) { path += "S"; } else { path += "N"; } if (Math.Abs(lat) < 10) { path += "0" + Math.Abs(lat); } else { path += Math.Abs(lat); } if (lon < 0) { path += "W"; } else { path += "E"; } if (Math.Abs(lon) < 10) { path += "00" + Math.Abs(lon); } else if (Math.Abs(lon) < 100) { path += "0" + Math.Abs(lon); } else { path += Math.Abs(lon); } path += ".hgt"; } else if (demType == DemType.Srtm30) { int lon = Convert.ToInt32(Math.Floor(wgsPoint.getLongitude())); int lat = Convert.ToInt32(Math.Floor(wgsPoint.getLatitude())); if (lat > -60) { if (lon < -140) { path += "w180"; } else if (lon < -100) { path += "w140"; } else if (lon < -60) { path += "w100"; } else if (lon < -20) { path += "w060"; } else if (lon < 20) { path += "w020"; } else if (lon < 60) { path += "e020"; } else if (lon < 100) { path += "e060"; } else if (lon < 140) { path += "e100"; } else { path += "e140"; } } else { if (lon < -120) { path += "w180"; } else if (lon < -60) { path += "w120"; } else if (lon < 0) { path += "w060"; } else if (lon < 60) { path += "e000"; } else if (lon < 120) { path += "e060"; } else { path += "e120"; } } if (lat < -60) { path += "s60"; } else if (lat < -10) { path += "s10"; } else if (lat < 40) { path += "n40"; } else { path += "n90"; } path += ".dem"; } return(path); }