示例#1
0
        private Dictionary <int, SWATUnit> readUnitBasicInfo(SWATUnitType type)
        {
            Dictionary <int, SWATUnit> units = new Dictionary <int, SWATUnit>();
            List <int> ids = new List <int>();

            DataTable dt = GetDataTable("select * from " + getInfoTableFromType(type));

            foreach (DataRow r in dt.Rows)
            {
                SWATUnit unit = null;
                switch (type)
                {
                case SWATUnitType.HRU: unit = new HRU(r, this); break;

                case SWATUnitType.SUB: unit = new Subbasin(r, this); break;

                case SWATUnitType.RCH: unit = new Reach(r, this); break;

                case SWATUnitType.RES: unit = new Reservoir(r, this); break;
                }
                if (unit != null && unit.ID != ScenarioResultStructure.UNKONWN_ID && !units.ContainsKey(unit.ID))
                {
                    units.Add(unit.ID, unit);
                    ids.Add(unit.ID);
                }
            }

            _units.Add(type, units);
            _unitIds.Add(type, ids);

            return(units);
        }
示例#2
0
 public void addHRU(HRU hru)
 {
     if (hru == null)
     {
         return;
     }
     if (_hrus.ContainsKey(hru.ID))
     {
         return;
     }
     _hrus.Add(hru.ID, hru);
 }
        private Dictionary<int, SWATUnit> readUnitBasicInfo(SWATUnitType type)
        {
            Dictionary<int, SWATUnit> units = new Dictionary<int, SWATUnit>();
            List<int> ids = new List<int>();

            DataTable dt = GetDataTable("select * from " + getInfoTableFromType(type));
            foreach (DataRow r in dt.Rows)
            {
                SWATUnit unit = null;
                switch (type)
                {
                    case SWATUnitType.HRU: unit = new HRU(r, this); break;
                    case SWATUnitType.SUB: unit = new Subbasin(r, this); break;
                    case SWATUnitType.RCH: unit = new Reach(r, this); break;
                    case SWATUnitType.RES: unit = new Reservoir(r, this); break;
                }
                if (unit != null && unit.ID != ScenarioResultStructure.UNKONWN_ID && !units.ContainsKey(unit.ID))
                {
                    units.Add(unit.ID, unit);
                    ids.Add(unit.ID);
                }
            }

            _units.Add(type,units);
            _unitIds.Add(type, ids);

            return units;
        }