Exemplo n.º 1
0
        private void btn_runCommand_Click(object sender, EventArgs e)
        {
            IGeoPy geopy = CSScript.Evaluator
                           .LoadFile <IGeoPy>(Application.StartupPath + @"\HelloScript.cs");

            currentCmd = textEdit_cmdline.Text;
            string msg;

            if (currentCmd.Equals("GeoPy.Version()"))
            {
                msg = GepPySystem.Version();

                memoEdit_cmdMsg.Text += string.Format("{0}{1}", msg, "\r\n");
            }



            if (currentCmd.StartsWith("GeoPy.Add"))
            {
                string[] sArray1 = currentCmd.Split(new string[] { "(", ")" }, StringSplitOptions.RemoveEmptyEntries);
                string   str1    = sArray1[1];
                string[] sArray2 = str1.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);


                int a = Convert.ToInt32(sArray2[0]);
                int b = Convert.ToInt32(sArray2[1]);

                memoEdit_cmdMsg.Text += string.Format("执行语句:{0}", "\r\n");
                memoEdit_cmdMsg.Text += string.Format("{0}{1}", currentCmd, "\r\n");
                memoEdit_cmdMsg.Text += string.Format("执行结果:{0}", "\r\n");
                memoEdit_cmdMsg.Text += string.Format("{0}{1}", (geopy.Add(a, b)), "\r\n");
                memoEdit_cmdMsg.Text += string.Format("{0}{1}", "------------------------------------------------------------------------------------------------------------", "\r\n");
            }
            if (currentCmd.StartsWith("GeoPy.GetPopFlowData"))
            {
                if (currentCmd.Equals("GeoPy.GetPopFlowData()"))
                {
                    memoEdit_cmdMsg.Text += string.Format("{0}{1}", "------------------------------------------------------------------------------------------------------------", "\r\n");
                    memoEdit_cmdMsg.Text += string.Format("{0}{1}", "调用人口流量数据采集工具完成!", "\r\n");
                    memoEdit_cmdMsg.Text += string.Format("{0}{1}", "------------------------------------------------------------------------------------------------------------", "\r\n");

                    PopflowForm dlg = new PopflowForm(this, spreadsheetControl1);
                    dlg.Show();
                }
                else
                {
                    string[] sArray1 = currentCmd.Split(new string[] { "(", ")" }, StringSplitOptions.RemoveEmptyEntries);
                    string   str1    = sArray1[1];
                    string[] sArray2 = str1.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries);


                    string a_path         = sArray2[0].ToString();
                    string b_areaNum      = sArray2[1].ToString();
                    int    c_timeInterval = Convert.ToInt32(sArray2[2]);

                    string from_date = sArray2[3].ToString();
                    string to_date   = sArray2[4].ToString();

                    int f_yy = Convert.ToInt32(from_date.Split('-')[0].ToString());
                    int f_mm = Convert.ToInt32(from_date.Split('-')[1].ToString());
                    int f_dd = Convert.ToInt32(from_date.Split('-')[2].ToString());

                    int t_yy = Convert.ToInt32(to_date.Split('-')[0].ToString());
                    int t_mm = Convert.ToInt32(to_date.Split('-')[1].ToString());
                    int t_dd = Convert.ToInt32(to_date.Split('-')[2].ToString());


                    PopflowForm dlg = new PopflowForm(this, spreadsheetControl1);

                    for (DateTime dt = new DateTime(f_yy, f_mm, f_dd); dt < new DateTime(t_yy, t_mm, t_dd); dt = dt.AddDays(1))
                    {
                        string date = dt.ToString("yyyy-MM-dd").Replace("/", "-");

                        string codate = date.Replace("-", "");

                        string str_p = string.Format(@"{0}\f{1}", a_path, codate);

                        bool exi = Directory.Exists(str_p);
                        if (!exi)
                        {
                            Directory.CreateDirectory(str_p);

                            memoEdit_cmdMsg.Text += string.Format("{0}{1}", "------------------------------------------------------------------------------------------------------------", "\r\n");
                            memoEdit_cmdMsg.Text += string.Format("文件夹{0}创建完成!{1}", str_p, "\r\n");
                            memoEdit_cmdMsg.Text += string.Format("任务执行正常{0}", "\r\n");
                            memoEdit_cmdMsg.Text += string.Format("{0}{1}", "------------------------------------------------------------------------------------------------------------", "\r\n");

                            memoEdit_cmdMsg.SelectionStart = memoEdit_cmdMsg.Text.Length;
                            memoEdit_cmdMsg.ScrollToCaret();
                            Application.DoEvents();

                            dlg.Execute_by_command(str_p, b_areaNum, c_timeInterval, date);
                        }
                    }

                    if ("aa" == "bb")
                    {
                        // (G:\数据采集\景点人流\test7,5381,60,2018-5-1,2018-5-7)
                        //dlg.Execute_by_command(a_path, b_areaNum, c_timeInterval, d_date);

                        //memoEdit_cmdMsg.Text += string.Format("{0}{1}", "------------------------------------------------------------------------------------------------------------", "\r\n");
                        //memoEdit_cmdMsg.Text += string.Format("正在执行任务:{0}{1}", i, "\r\n");
                        //memoEdit_cmdMsg.Text += string.Format("{0}{1}", "------------------------------------------------------------------------------------------------------------", "\r\n");

                        //memoEdit_cmdMsg.SelectionStart = memoEdit_cmdMsg.Text.Length;
                        //memoEdit_cmdMsg.ScrollToCaret();
                        //Application.DoEvents();
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void treeList_toolbox_DoubleClick(object sender, EventArgs e)
        {
            string nodeName = treeList_toolbox.FocusedNode[0].ToString();

            if (nodeName == "AMap geocoding tool")
            {
                GaodeGeocodingForm dlg = new GaodeGeocodingForm(this, this.spreadsheetControl1);
                dlg.ShowDialog();
            }
            if (nodeName == "AMap reverse geocoding tool")
            {
                GaodeDegeocodingForm dlg = new GaodeDegeocodingForm(this, this.spreadsheetControl1);
                dlg.ShowDialog();
            }
            if (nodeName == "AMap reverse geocoding pro tool")
            {
                GaodeDegeocodingAdForm dlg = new GaodeDegeocodingAdForm(this, this.spreadsheetControl1);
                dlg.ShowDialog();
            }
            if (nodeName == "Baidu map geocoding tool")
            {
                BaiduGeocodingForm dlg = new BaiduGeocodingForm(this, this.spreadsheetControl1);
                dlg.ShowDialog();
            }
            if (nodeName == "Tencent geocoding tool")
            {
                TenxunGeocodingForm dlg = new TenxunGeocodingForm(this, this.spreadsheetControl1);
                dlg.ShowDialog();
            }

            if (nodeName == "Real time weather forecast tool")
            {
                ForecastColleForm dlg = new ForecastColleForm(this, this.spreadsheetControl1);
                dlg.ShowDialog();
            }
            if (nodeName == "Weather forecast tool")
            {
                ForecastAllColleForm dlg = new ForecastAllColleForm(this, this.spreadsheetControl1);
                dlg.ShowDialog();
            }

            if (nodeName == "GCJ_to_WGS84")
            {
                Gaode2WGS84Form dlg = new Gaode2WGS84Form(this, this.spreadsheetControl1);
                dlg.ShowDialog();
            }
            if (nodeName == "WGS84_to_GCJ")
            {
                WGS842GaodeForm dlg = new WGS842GaodeForm(this, this.spreadsheetControl1);
                dlg.ShowDialog();
            }

            if (nodeName == "WGS84_to_Baidu")
            {
                WGS842BaiduForm dlg = new WGS842BaiduForm(this, this.spreadsheetControl1);
                dlg.ShowDialog();
            }
            if (nodeName == "Baidu_to_WGS84")
            {
                Baidu2WGS84Form dlg = new Baidu2WGS84Form(this, this.spreadsheetControl1);
                dlg.ShowDialog();
            }
            if (nodeName == "Baidu_to_GCJ")
            {
                Baidu2GaodeForm dlg = new Baidu2GaodeForm(this, this.spreadsheetControl1);
                dlg.ShowDialog();
            }
            if (nodeName == "GCJ_to_Baidu")
            {
                Gaode2BaiduForm dlg = new Gaode2BaiduForm(this, this.spreadsheetControl1);
                dlg.ShowDialog();
            }
            if (nodeName == "Tencent big data tool")
            {
                TenxunQianxiForm dlg = new TenxunQianxiForm(this, this.spreadsheetControl1);
                dlg.ShowDialog();
            }

            if (nodeName == "Tencent big data batch tool")
            {
                TenxunQianxiBatchForm dlg = new TenxunQianxiBatchForm(this, this.spreadsheetControl1);
                dlg.ShowDialog();
            }

            if (nodeName == "Walk trajectory tool")
            {
                WalkRouteForm dlg = new WalkRouteForm(this, this.spreadsheetControl1);
                dlg.ShowDialog();
            }

            if (nodeName == "Population flow data tool")
            {
                PopflowForm dlg = new PopflowForm(this, this.spreadsheetControl1);
                dlg.ShowDialog();
            }
            if (nodeName == "AMap POI tool")
            {
                GaodePOIGetForm dlg = new GaodePOIGetForm(this, this.spreadsheetControl1);
                dlg.ShowDialog();
            }
            if (nodeName == "Traffic data tool")
            {
                TrafficSituationGetByRecForm dlg = new TrafficSituationGetByRecForm(this, this.spreadsheetControl1);
                dlg.ShowDialog();
            }
            if (nodeName == "AMap AOI collection tool")
            {
                GaodeAOIGetForm dlg = new GaodeAOIGetForm(this, this.spreadsheetControl1);
                dlg.ShowDialog();
            }
        }