Exemple #1
0
 public override void Reset()
 {
     if (_allGdalSubDatasetFullpaths != null)
     {
         _allGdalSubDatasetFullpaths.Clear();
         _allGdalSubDatasetFullpaths = null;
     }
     _provider = null;
     _matchedBandProviderDef = null;
 }
Exemple #2
0
 public override void Dispose()
 {
     base.Dispose();
     if (_allGdalSubDatasetFullpaths != null)
     {
         _allGdalSubDatasetFullpaths.Clear();
         _allGdalSubDatasetFullpaths = null;
     }
     _provider = null;
     _matchedBandProviderDef = null;
 }
        public BandProviderDef[] GetBandProviderDefs()
        {
            XDocument doc     = XDocument.Load(_cnfgFile);
            XElement  root    = doc.Root;
            var       elePrds = root.Elements(XName.Get("BandProvider"));

            if (elePrds == null || elePrds.Count() == 0)
            {
                return(null);
            }
            List <BandProviderDef> prds = new List <BandProviderDef>();

            foreach (XElement ele in elePrds)
            {
                BandProviderDef prd = BandProviderDef.FromXElement(ele);
                if (prd != null)
                {
                    prds.Add(prd);
                }
            }
            return(prds.Count > 0 ? prds.ToArray() : null);
        }
Exemple #4
0
        private void TryGetBandProviderDefinition(string fname, Dictionary <string, string> subdatasets)
        {
            List <string> datasetNames = null;

            if (subdatasets != null)
            {
                datasetNames = GetDatasetNames(subdatasets);
            }
            BandProviderDef[] bandProviderDefs = null;
            string            configfile       = Path.Combine(Path.GetDirectoryName(this.GetType().Assembly.Location), "GeoDo.RSS.DF.GDAL.H5BandPrd.xml");

            using (H5BandProviderXmlParser xml = new H5BandProviderXmlParser(configfile))
            {
                bandProviderDefs = xml.GetBandProviderDefs();
            }
            if (bandProviderDefs == null)
            {
                return;
            }
            string orbitDirection = "";
            string dayornight     = "";

            using (Hdf5Operator hdf5 = new Hdf5Operator(fname))
            {
                foreach (BandProviderDef prddef in bandProviderDefs)
                {
                    bool isMatched = true;
                    if (datasetNames != null)
                    {
                        foreach (DefaultBandDatasetDef bandDef in prddef.DefaultBandDatasetDefs)
                        {
                            if (!datasetNames.Contains(bandDef.Name))
                            {
                                isMatched = false;
                                break;
                            }
                        }
                        if (!isMatched)
                        {
                            continue;
                        }
                    }
                    foreach (IdentifyAttDef id in prddef.IdentifyAttDefs)
                    {
                        string attvalue = hdf5.GetAttributeValue(id.Name);
                        if (attvalue != id.Value)
                        {
                            isMatched = false;
                            break;
                        }
                    }
                    if (isMatched)
                    {
                        _matchedBandProviderDef = prddef;
                        break;
                    }
                }
                orbitDirection = hdf5.GetAttributeValue("Orbit Direction");
                dayornight     = hdf5.GetAttributeValue("Day Or Night Flag");
            }
            if (_matchedBandProviderDef != null)
            {
                _dataIdentify         = new DataIdentify(_matchedBandProviderDef.Satellite, _matchedBandProviderDef.Sensor);
                _dataIdentify.IsOrbit = true;
                TryGetOrbitDirection(orbitDirection);
                TryGetDayOrNight(dayornight);
            }
        }