예제 #1
0
 public HecRasModel()
 {
     rivers = new SerializableDictionary<string, River>("RiverReachDictionaryItem", "Key", "Value");
     profiles = new List<string>();
     controller = new HECRASController();
     controller.Compute_HideComputationWindow();
 }
예제 #2
0
    void Start()
    {
        hrc = new HECRASController();
        //--------------------------------------------
        int   nmsg  = 0;
        bool  block = true;
        Array sa    = null;

        hrc.Project_Open("C:/Users/admin/Documents/HEC Data/HEC-RAS/Example Projects/1D Steady Flow Hydraulics/Chapter 4 Example Data/Ex1.prj");
        Debug.Log(hrc.Project_Current());
        Debug.Log(hrc.CurrentGeomFile());
        Debug.Log(hrc.CurrentSteadyFile());
        Debug.Log(hrc.CurrentProjectFile());
        Debug.Log(hrc.CurrentPlanFile());
        hrc.Compute_ShowComputationWindow();

        try
        {
            hrc.Compute_CurrentPlan(ref nmsg, ref sa, ref block);
        }
        catch (Exception e)
        {
            Console.WriteLine(e.ToString());
        }
        //hrc = null; //kills the process faster than waiting for GC
        //--------------------------------------------
        //Console.WriteLine("Press any key to quit.");
        //Console.ReadKey();
        hrc.Project_Save();
        hrc.Project_Close();
        hrc.QuitRas();
    }
        public String ReadData()
        {
            HECRASController hrc = new HECRASController();

            hrc.Project_Open(@"C:\Users\hqngh\OneDrive\Documents\Hello World Coupling\HelloWorldCoupling.prj");

            int    nmsg   = 0;
            bool   block  = true;
            Array  sa     = null;
            String result = "";

            try
            {
                hrc.Compute_HideComputationWindow();

                hrc.Compute_CurrentPlan(ref nmsg, ref sa);
            }
            catch (Exception ex)
            {
                result = ex.ToString();
            }
            hrc.Project_Close();
            hrc.QuitRas();
            return(result);
        }
        public string Compute_CurrentPlan()
        {
            int   nmsg  = 0;
            bool  block = true;
            Array arr   = null;// CreateInstance(typeof(string), 0);
            //string[] arr = new string[1] {null};
            string result = "";

            try
            {
                hrc.Compute_HideComputationWindow();
                result = hrc.CurrentGeomHDFFile();
                hrc.Compute_CurrentPlan(0, null, true);

                /*
                 * hrc.Output_Initialize();
                 * hrc.Output_ComputationLevel_Export("E:\\aa.txt", result, true,true,true,true);
                 * //hrc.ShowRasMapper();
                 * hrc.ExportGIS();
                 * hrc.Output_GetProfiles(0,arr);
                 * hrc.PlotPFGeneral("", "");
                 * hrc.ShowRas();
                 * hrc.Geometry().Save();
                 */
                //Console.WriteLine(hrc.Plan_GetFilename());
            }
            catch (Exception ex)
            {
                result = ex.ToString();
            }
            //hrc.Project_Close();
            //hrc.QuitRas();
            hrc = null;
            return(result);
        }
        public string Init_hecras()
        {
            hrc = new HECRASController();
            string result = "";

            return(result);
        }
예제 #6
0
    public HecRasModel(FileInfo projectFile)
    {
        controller = new HECRASController();
        controller.Compute_HideComputationWindow();

        if (File.Exists(projectFile.FullName))
        {
            this.projectFile = projectFile.FullName;
            OpenHECRASProjectFile();

        }
        else
        {
            throw new FileNotFoundException("Project file was not found", projectFile.FullName);
        }

        rivers = new SerializableDictionary<string, River>("RiverReachDictionaryItem", "Key", "Value");
        profiles = new List<string>();
    }