Пример #1
0
        /// <summary>
        /// !!! 在每一次更改选择项时刷新滚动条和日历的时间跨度,以及终结旧线程,创建新的线程
        /// </summary>
        /// <remarks></remarks>
        private DateSpan Refesh_FocusOn_DateSpan(Drawings_For_Rolling Selected_Drawings)
        {
            // -------------------------------------  包含所有要进行滚动的线程的数组
            //
            bool     blnDateSpanInitialized = false;
            DateSpan DateSpan = new DateSpan();
            //
            // ------------------------------------------ 标高剖面图
            ClsDrawing_ExcavationElevation ele = Selected_Drawings.SectionalView;

            if (ele != null)
            {
                //更新滚动界面的时间跨度
                DateSpan = RenewTimeSpan(ref blnDateSpanInitialized, DateSpan, ele.DateSpan);
            }

            // ------------------------------------------ 开挖平面图
            ClsDrawing_PlanView Plan = Selected_Drawings.PlanView;

            if (Plan != null)
            {
                //更新滚动界面的时间跨度
                DateSpan = RenewTimeSpan(ref blnDateSpanInitialized, DateSpan, Plan.DateSpan);
            }

            // ------------------------------------------ 监测曲线图
            foreach (clsDrawing_Mnt_RollingBase Moni in Selected_Drawings.RollingMnt)
            {
                //更新滚动界面的时间跨度
                DateSpan = RenewTimeSpan(ref blnDateSpanInitialized, DateSpan, Moni.DateSpan);
            }
            return(DateSpan);
        }
Пример #2
0
        /// <summary>
        /// 在整个程序中的可以滚动的图表发生增加或者减少时触发的事件:
        /// 刷新窗口中的列表框的数据与其UI显示
        /// </summary>
        /// <remarks></remarks>
        private Drawings_For_Rolling RefreshUI_RollingDrawings()
        {
            Drawings_For_Rolling SelectedDrawings = new Drawings_For_Rolling(this);
            // 主程序中所有可以滚动的图形的汇总()
            RollingEnabledDrawings RollingMethods = GlobalApplication.Application.ExposeRollingDrawings();

            //
            ClsDrawing_PlanView plan = RollingMethods.PlanView;

            SelectedDrawings.PlanView = plan;
            CheckBox_PlanView.Tag     = plan;
            if (plan != null)
            {
                CheckBox_PlanView.Checked = true;
                CheckBox_PlanView.Enabled = true;
            }
            else
            {
                CheckBox_PlanView.Checked = false;
                CheckBox_PlanView.Enabled = false;
            }
            //
            ClsDrawing_ExcavationElevation Sectional = RollingMethods.SectionalView;

            SelectedDrawings.SectionalView = Sectional;
            CheckBox_SectionalView.Tag     = Sectional;
            if (Sectional != null)
            {
                CheckBox_SectionalView.Checked = true;
                CheckBox_SectionalView.Enabled = true;
            }
            else
            {
                CheckBox_SectionalView.Checked = false;
                CheckBox_SectionalView.Enabled = false;
            }

            // --------------  为窗口中的控件赋值  ------------------------
            //
            List <LstbxDisplayAndItem> listMnt = new List <LstbxDisplayAndItem>();

            foreach (clsDrawing_Mnt_RollingBase M in RollingMethods.MonitorData)
            {
                listMnt.Add(new LstbxDisplayAndItem(DisplayedText: M.Chart_App_Title, Value:
                                                    M));
            }
            this.ListBoxMonitorData.DisplayMember = LstbxDisplayAndItem.DisplayMember;
            this.ListBoxMonitorData.DataSource    = listMnt;
            SelectedDrawings.RollingMnt.Clear();
            foreach (LstbxDisplayAndItem item in this.ListBoxMonitorData.SelectedItems)
            {
                SelectedDrawings.RollingMnt.Add((clsDrawing_Mnt_RollingBase)item.Value);
            }

            return(SelectedDrawings);
        }
Пример #3
0
        /// <summary>
        /// 为每一个选择的要进行滚动的图形构造一个线程
        /// </summary>
        /// <param name="Selected_Drawings"></param>
        /// <remarks></remarks>
        private void ConstructRollingThreads(Drawings_For_Rolling Selected_Drawings)
        {
            AbortAllThread(F_arrThread);

            // -------------------------------------  包含所有要进行滚动的线程的数组
            short SelectedDrawingsCount = Selected_Drawings.Count();

            //
            F_arrThread         = new Thread[SelectedDrawingsCount - 1 + 1];
            F_arrThreadDelegete = new ParameterizedThreadStart[SelectedDrawingsCount - 1 + 1];
            //'
            short btThread = (short)0;
            //
            //
            // ------------------------------------------ 标高剖面图
            ClsDrawing_ExcavationElevation ele = Selected_Drawings.SectionalView;

            if (ele != null)
            {
                //为线程数组中的元素线程赋值
                F_arrThreadDelegete[btThread] = new ParameterizedThreadStart(ele.Rolling);
                Thread thd = new Thread(F_arrThreadDelegete[btThread]);
                thd.Name = "滚动标高剖面图";
                F_arrThread[btThread] = thd;
                F_arrThread[btThread].IsBackground = true;
                btThread++;
            }

            // ------------------------------------------ 开挖平面图
            ClsDrawing_PlanView Plan = Selected_Drawings.PlanView;

            if (Plan != null)
            {
                //为线程数组中的元素线程赋值
                F_arrThreadDelegete[btThread] = new ParameterizedThreadStart(Plan.Rolling);
                Thread thd = new Thread(F_arrThreadDelegete[btThread]);
                thd.Name = "滚动开挖平面图";
                F_arrThread[btThread] = thd;
                F_arrThread[btThread].IsBackground = true;
                btThread++;
            }

            // ------------------------------------------ 监测曲线图
            foreach (clsDrawing_Mnt_RollingBase Moni in Selected_Drawings.RollingMnt)
            {
                //为线程数组中的元素线程赋值
                F_arrThreadDelegete[btThread] = new ParameterizedThreadStart(Moni.Rolling);
                Thread thd = new Thread(F_arrThreadDelegete[btThread]);
                thd.Name = "滚动监测曲线图";
                F_arrThread[btThread] = thd;
                F_arrThread[btThread].IsBackground = true;
                btThread++;
            }
        }
Пример #4
0
        /// <summary>
        /// 从主程序中提取所有的图表,以进行输出之用。同时刷新窗口中的可供输出的图形
        /// </summary>
        /// <param name="AllDrawing">主程序对象中所有的图表</param>
        /// <remarks>在此方法中,将提取主程序中的所有图表对象,而且将其显示在输入窗口的列表框中</remarks>
        private void RefreshUI(AmeDrawings AllDrawing)
        {
            //-------------------------1、剖面图---------------------------------------------
            ClsDrawing_ExcavationElevation Sectional = AllDrawing.SectionalView;

            CheckBox_SectionalView.Tag = Sectional;
            if (Sectional != null)
            {
                CheckBox_SectionalView.Enabled = true;
            }
            else
            {
                CheckBox_SectionalView.Checked = false;
                CheckBox_SectionalView.Enabled = false;
            }
            //--------------------------2、开挖平面图----------------------------------------------
            ClsDrawing_PlanView Plan = AllDrawing.PlanView;

            CheckBox_PlanView.Tag = Plan;
            if (Plan != null)
            {
                CheckBox_PlanView.Enabled = true;
            }
            else
            {
                CheckBox_PlanView.Checked = false;
                CheckBox_PlanView.Enabled = false;
            }

            //---------------------------------3、监测曲线图---------------------------------------

            //清空两个列表框中的所有项目
            foreach (ListBox lstbox in F_arrListBoxes)
            {
                lstbox.Items.Clear();
                lstbox.DisplayMember = LstbxDisplayAndItem.DisplayMember;
            }
            foreach (ClsDrawing_Mnt_Base sht in AllDrawing.MonitorData)
            {
                switch (sht.Type)
                {
                case DrawingType.Monitor_Incline_Dynamic:
                case DrawingType.Monitor_Dynamic:
                    ListBoxMonitor_Dynamic.Items.Add(new LstbxDisplayAndItem(sht.Chart_App_Title, sht));
                    break;

                case DrawingType.Monitor_Static:
                case DrawingType.Monitor_Incline_MaxMinDepth:
                    ListBoxMonitor_Static.Items.Add(new LstbxDisplayAndItem(sht.Chart_App_Title, sht));
                    break;
                }
            }
        }
 public void Close(bool SaveChanges = false)
 {
     try
     {
         ClsDrawing_ExcavationElevation          with_1 = this;
         Microsoft.Office.Interop.Excel.Workbook wkbk   = with_1.P_Sheet_Drawing.Parent;
         wkbk.Close(false);
         with_1.Application.Quit();
     }
     catch (Exception ex)
     {
         MessageBox.Show("关闭开挖剖面图出错!" + "\r\n" + ex.Message,
                         "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Пример #6
0
        /// <summary>
        /// 打开用于绘图的Excel程序,并进行界面设计
        /// </summary>
        /// <returns></returns>
        /// <remarks></remarks>
        private Microsoft.Office.Interop.Excel.Worksheet GetDrawingSheet()
        {
            Microsoft.Office.Interop.Excel.Application app  = default(Microsoft.Office.Interop.Excel.Application);
            Microsoft.Office.Interop.Excel.Workbook    wkbk = default(Microsoft.Office.Interop.Excel.Workbook);
            Microsoft.Office.Interop.Excel.Worksheet   sht  = default(Microsoft.Office.Interop.Excel.Worksheet);
            //获取绘图的Application对象
            ClsDrawing_ExcavationElevation ElevationDrawing = GlobalApp.ElevationDrawing;

            if (ElevationDrawing == null)
            {
                app = new Microsoft.Office.Interop.Excel.Application();
            }
            else
            {
                app = ElevationDrawing.Application;
            }
            app.Visible = false;

            //获取绘图的工作簿
            Microsoft.Office.Interop.Excel.Workbooks wkbks = app.Workbooks;
            if (wkbks.Count == 0)
            {
                wkbk = wkbks.Add();
            }
            else
            {
                wkbk = wkbks.Item(1);
            }

            //获取绘图的工作表
            sht = wkbk.Worksheets.Add();

            sht.Activate();
            //'绘图的标题
            //Static DrawingNum As Integer = 0
            //DrawingNum += 1
            //app.Caption = "绘图" & DrawingNum.ToString
            //sht.Name = "绘图" & DrawingNum.ToString
            //'
            //
            return(sht);
        }
Пример #7
0
        /// <summary>
        /// 开始生成整个绘图图表
        /// </summary>
        /// <param name="SelectedRegion">窗口中所有选择的要进行绘图的基坑区域</param>
        /// <remarks></remarks>
        private void GenerateChart(List <clsData_ProcessRegionData> SelectedRegion)
        {
            //列表中选择的基坑区域
            int count = System.Convert.ToInt32(SelectedRegion.Count);

            if (count > 0)
            {
                //---------------- 打开用于绘图的Excel程序,并进行界面设计
                Microsoft.Office.Interop.Excel.Worksheet   DrawingSheet = this.GetDrawingSheet();
                Microsoft.Office.Interop.Excel.Application DrawingApp   = DrawingSheet.Application;
                try
                {
                    //------------------- 在绘图工作表中进行绘图
                    this.F_DrawingChart = DrawChart(DrawingSheet, SelectedRegion);

                    //  ----------- 绘制数据系列图 ---------------------------
                    Microsoft.Office.Interop.Excel.SeriesCollection src = this.F_DrawingChart.SeriesCollection();
                    Series   series_DeepestExca = src.Item(1);
                    Series   series_Depth       = src.Item(2);
                    Series[] DataSeries         = new Series[2];
                    DataSeries = SetDataSeries(this.F_DrawingChart, series_DeepestExca, series_Depth, SelectedRegion);

                    //-------------------------------------------------------
                    DateSpan date_Span = GetDateSpan(SelectedRegion);
                    //-------------------------------------------------------
                    ClsDrawing_ExcavationElevation shtEle =
                        new ClsDrawing_ExcavationElevation(series_DeepestExca, series_Depth, SelectedRegion, date_Span,
                                                           this.F_Textbox_Info, DrawingType.Xls_SectionalView);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("绘制基坑区域开挖标高图失败!" + "\r\n" + ex.Message + "\r\n" + "报错位置:" + ex.TargetSite.Name,
                                    "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                finally
                {
                    //------- Excel的界面美化 --------------------
                    ExcelAppBeauty(DrawingApp);
                }
            }
        }
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="Series_Static">表示基坑区域的坑底深度的数据系列</param>
        /// <param name="Series_Depth">表示基坑区域的即时开挖标高的数据系列</param>
        /// <param name="ChosenRegion">此绘图中所包含的矩形方块与对应的数据范围</param>
        /// <param name="textbox">记录信息的文本框</param>
        /// <param name="type">此图表所属的类型,由枚举DrawingType提供</param>
        public ClsDrawing_ExcavationElevation(Microsoft.Office.Interop.Excel.Series Series_Static, Series Series_Depth,
                                              List <clsData_ProcessRegionData> ChosenRegion, DateSpan DateSpan,
                                              Microsoft.Office.Interop.Excel.TextFrame2 textbox, DrawingType type)
        {
            ClsDrawing_ExcavationElevation with_1 = this;

            with_1.F_Series_Static     = Series_Static;
            with_1.F_Series_Depth      = Series_Depth;
            with_1.F_textbox_Info      = textbox;
            with_1.P_Chart             = Series_Static.Parent.Parent;
            with_1.P_Sheet_Drawing     = this.P_Chart.Parent.parent;
            with_1.Application         = this.P_Sheet_Drawing.Application;
            with_1.F_Regions           = ChosenRegion;
            with_1.DateSpan            = DateSpan;
            with_1.P_Type              = type;
            with_1.Application.Caption = "";
            with_1.P_UniqueID          = GeneralMethods.GetUniqueID();

            // -------------------------------------------------------------
            GlobalApplication.Application.ElevationDrawing = this;
        }
Пример #9
0
 public Drawings_For_Output(Diafrm_Output_Word Sender)
 {
     MntDrawings   = new List <ClsDrawing_Mnt_Base>();
     PlanView      = null;
     SectionalView = null;
 }
Пример #10
0
        private void ExportToWord(Application WdApp, Drawings_For_Output selectedDrawings)
        {
            Word.Range rg = WdDoc.Range(Start: 0);
            //在写入标题部分内容时所占的进度
            int intProgressForStartPart = 10;
            //一共要导出的元素个数
            int intElementsCount = selectedDrawings.Count();
            //每一个导出的元素所占的进度
            float sngUnit = (float)((double)(100 - intProgressForStartPart) / intElementsCount);
            //实时的进度值
            int intProgress = intProgressForStartPart;

            try
            {
                //写入标题项
                Export_OverView(ref rg);
            }
            catch (Exception)
            {
                MessageBox.Show("写入概述部分出错,但可以继续工作。", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            finally
            {
                APPLICATION_MAINFORM.MainForm.ShowProgressBar_Continue(intProgressForStartPart);
            }

            // ------------- 取消绘图窗口的禁用 ------------------
            //一定要在将绘图窗口中的图形导出到Word之前取消窗口的禁用,
            //否则的话,当调用这些窗口的Application属性时,就会出现报错:应用程序正在使用中。
            foreach (IntPtr H in WindowHandles)
            {
                APIWindows.EnableWindow(H, true);
            }

            //输出每一个选定的图形
            // ------------- 开挖平面图 ------------------
            try
            {
                ClsDrawing_PlanView D = selectedDrawings.PlanView;
                if (D != null)
                {
                    Page page = D.Page;
                    //
                    NewLine(rg, ParagraphStyle.Title_2);
                    rg.InsertAfter("开挖平面图:");
                    //
                    Export_VisioPlanview(page, ref rg);
                    //
                    intProgress += (int)sngUnit;
                    APPLICATION_MAINFORM.MainForm.ShowProgressBar_Continue(intProgress);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    "导出Visio开挖平面图出错,但可以继续工作。" + "\r\n" + ex.Message + "\r\n" + "报错位置:" + ex.TargetSite.Name, "Warning",
                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            // ------------- 剖面标高图 -------------------------
            try
            {
                ClsDrawing_ExcavationElevation D = selectedDrawings.SectionalView;
                if (D != null)
                {
                    //
                    NewLine(rg, ParagraphStyle.Title_2);
                    rg.InsertAfter("开挖剖面图:");
                    //
                    Export_ExcelChart(D.Chart, ref rg);
                    //
                    intProgress += (int)sngUnit;
                    APPLICATION_MAINFORM.MainForm.ShowProgressBar_Continue(intProgress);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(
                    "导出Excel开挖剖面图出错,但可以继续工作。" + "\r\n" + ex.Message + "\r\n" + "报错位置:" + ex.TargetSite.Name, "Warning",
                    MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            // ---------------------- 监测曲线图 --------------------
            Chart cht = default(Chart);

            foreach (ClsDrawing_Mnt_Base Drawing in selectedDrawings.MntDrawings)
            {
                try
                {
                    switch (Drawing.Type)
                    {
                    // ------------- 测斜曲线图 ---------------------------------------------------
                    case DrawingType.Monitor_Incline_Dynamic:
                        ClsDrawing_Mnt_Incline D_1 = (ClsDrawing_Mnt_Incline)Drawing;
                        cht = D_1.Chart;
                        //
                        NewLine(rg, ParagraphStyle.Title_2);
                        rg.InsertAfter(D_1.Chart_App_Title);
                        //
                        Export_ExcelChart(cht, ref rg);
                        break;

                    // ------------- 动态监测曲线图 ---------------------------------------------
                    case DrawingType.Monitor_Dynamic:
                        ClsDrawing_Mnt_OtherDynamics D_2 = (ClsDrawing_Mnt_OtherDynamics)Drawing;
                        cht = D_2.Chart;

                        //
                        NewLine(rg, ParagraphStyle.Title_2);
                        rg.InsertAfter(D_2.Chart_App_Title);

                        Export_ExcelChart(cht, ref rg);
                        break;

                    // ------------- 静态监测曲线图 ---------------------------------------------
                    case DrawingType.Monitor_Static:
                        ClsDrawing_Mnt_Static D_3 = (ClsDrawing_Mnt_Static)Drawing;
                        cht = D_3.Chart;
                        //
                        NewLine(rg, ParagraphStyle.Title_2);
                        rg.InsertAfter(D_3.Chart_App_Title);

                        Export_ExcelChart(cht, ref rg);
                        break;

                    // ------------- 静态监测曲线图 ---------------------------------------------
                    case DrawingType.Monitor_Incline_MaxMinDepth:
                        ClsDrawing_Mnt_MaxMinDepth D = (ClsDrawing_Mnt_MaxMinDepth)Drawing;
                        cht = D.Chart;
                        //
                        NewLine(rg, ParagraphStyle.Title_2);
                        rg.InsertAfter(D.Chart_App_Title);

                        Export_ExcelChart(cht, ref rg);
                        break;

                    default:
                        break;
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("导出监测曲线图\"" + Drawing.Chart_App_Title.ToString() + "\"出错,但可以继续工作。" +
                                    "\r\n" + ex.Message + "\r\n" + "报错位置:" +
                                    ex.TargetSite.Name, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                finally
                {
                    intProgress += (int)sngUnit;
                    APPLICATION_MAINFORM.MainForm.ShowProgressBar_Continue(intProgress);
                }
            }
        }
Пример #11
0
 public Drawings_For_Rolling(frmRolling Sender)
 {
     RollingMnt    = new List <clsDrawing_Mnt_RollingBase>();
     SectionalView = null;
     PlanView      = null;
 }