Esempio n. 1
0
        public static HydroFeature CreateHydroFeature(int id, string name, string descrip, HydroFeatureType type)
        {
            HydroFeature feature = null;

            switch (type)
            {
            case HydroFeatureType.Basin:
                feature = new Basin(id);
                break;

            case HydroFeatureType.Watershed:
                feature = new  Watershed(id);
                break;

            case HydroFeatureType.River:
                feature = new  River(id);
                break;

            case HydroFeatureType.Site:
                feature = new HydroPoint(id);
                break;

            case HydroFeatureType.HydroPoint:
                feature = new HydroPoint(id);
                break;

            case HydroFeatureType.IrrigationSystem:
                feature = new  IrrigationSystem(id);
                break;
            }
            feature.Name     = name;
            feature.Comments = descrip;
            return(feature);
        }
Esempio n. 2
0
        /// <summary>
        ///  Add all sub-features to the parent feature recursively.
        /// </summary>
        /// <param name="parent"></param>
        public void CreateTopDownNetwork(HydroFeature parent)
        {
            string    sql = "select * from " + Configuration.HydroFeaturesTableName + " where ParentFeatureID=" + parent.ID;
            DataTable dt  = mDBase.QueryDataTable(sql);

            if (dt != null)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    int              id      = Convert.ToInt32(dr["FeatureID"].ToString());
                    string           type    = dr["FeatureType"].ToString();
                    string           name    = dr["FeatureName"].ToString();
                    string           des     = dr["Descriptions"].ToString();
                    HydroFeatureType htype   = HydroFeatureFactory.GetHydroFeaturetype(type);
                    HydroFeature     feature = HydroFeatureFactory.CreateHydroFeature(id, name, des, htype);
                    if (feature.HydroFeatureType == HydroFeatureType.HydroPoint)
                    {
                        feature = mODMDataAdaptor.GetSiteInfo(id);
                    }
                    parent.SubFeatures.Add(feature);
                    feature.ParentFeatures.Add(parent);
                    if (feature.HydroFeatureType != HydroFeatureType.HydroPoint)
                    {
                        CreateTopDownNetwork(feature);
                    }
                }
            }
        }