private static void GetGeoAtrrs(GeoInfos geoInfo, XElement geoInfoElement) { XElement geoAtrrs = geoInfoElement.Element("GeoAtrrs"); if (geoAtrrs != null) { GeoAtrributes geoAtrr = null; if (!string.IsNullOrEmpty(geoAtrrs.Attribute("location").Value)) { geoAtrr = new GeoAtrributes(); geoAtrr.Location = (enumGeoAttType)Enum.Parse(typeof(enumGeoAttType), geoAtrrs.Attribute("location").Value); geoAtrr.GeoDataset = geoAtrrs.Attribute("datasetname").Value; geoAtrr.LeftTopLonAtrrName = geoAtrrs.Attribute("lefttoplon").Value; geoAtrr.LeftTopLatAtrrName = geoAtrrs.Attribute("lefttoplat").Value; geoAtrr.RightBottomLonAtrrName = geoAtrrs.Attribute("rightbottomlon").Value; geoAtrr.RightBottomLatAtrrName = geoAtrrs.Attribute("rightbottomlat").Value; geoAtrr.Unit = geoAtrrs.Attribute("unit").Value; } if (geoAtrr == null || (string.IsNullOrEmpty(geoAtrr.GeoDataset) && geoAtrr.Location == enumGeoAttType.Dataset) || string.IsNullOrEmpty(geoAtrr.LeftTopLonAtrrName) || string.IsNullOrEmpty(geoAtrr.LeftTopLatAtrrName) || string.IsNullOrEmpty(geoAtrr.RightBottomLonAtrrName) || string.IsNullOrEmpty(geoAtrr.RightBottomLatAtrrName)) { geoInfo.GeoAtrrs = null; } else { geoInfo.GeoAtrrs = geoAtrr; } } }
private CoordEnvelope GetCoordEnvelope(GeoAtrributes geoAtrrs) { double lulat = 0.0, lulon = 0.0, rdlat = 0.0, rdlon = 0.0; string lulatstr = geoAtrrs.LeftTopLatAtrrName; string lulonstr = geoAtrrs.LeftTopLonAtrrName; string rdlatstr = geoAtrrs.RightBottomLatAtrrName; string rdlonstr = geoAtrrs.RightBottomLonAtrrName; string unitstr = geoAtrrs.Unit; using (IHdfOperator oper = HdfOperatorFactory(_fileName)) { if (geoAtrrs.Location == enumGeoAttType.File) { _fileAttributes = oper.GetAttributes(); if (_fileAttributes == null) { return(null); } if (!GetExtentPoints(lulatstr, lulonstr, rdlatstr, rdlonstr, out lulat, out lulon, out rdlat, out rdlon)) { return(null); } if (!string.IsNullOrEmpty(unitstr) && _fileAttributes.ContainsKey(unitstr)) { string unit = _fileAttributes[unitstr]; if (!string.IsNullOrEmpty(unit)) { UpdateRDLonLat(unit, ref lulat, ref lulon, ref rdlat, ref rdlon); } } } else { string geoDataset = geoAtrrs.GeoDataset; lulat = GetDoubleAtrr(oper, geoDataset, lulatstr); lulon = GetDoubleAtrr(oper, geoDataset, lulonstr); rdlat = GetDoubleAtrr(oper, geoDataset, rdlatstr); rdlon = GetDoubleAtrr(oper, geoDataset, rdlonstr); if (Math.Abs(lulat - double.MinValue) < double.Epsilon || Math.Abs(lulon - double.MinValue) < double.Epsilon || Math.Abs(rdlat - double.MinValue) < double.Epsilon || Math.Abs(rdlon - double.MinValue) < double.Epsilon) { return(null); } } return(new CoordEnvelope(lulon, rdlon, rdlat, lulat)); } }
public GeoInfos(string proj4Str, GeoAtrributes geoAtrrs) : this(proj4Str) { GeoAtrrs = geoAtrrs; }