Esempio n. 1
0
        public override void Run(object sender, System.EventArgs e)
        {
            try
            {
                FrmLayoutPage dialog  = new FrmLayoutPage();
                IMap2DView    mapView = UCService.GetContent(typeof(Map2DView)) as Map2DView;
                if (mapView == null)
                {
                    return;
                }
                DF2DApplication app = DF2DApplication.Application;
                if (app == null || app.Current2DMapControl == null)
                {
                    return;
                }
                string            path = Config.GetConfigValue("2DMdbPipe");
                IWorkspaceFactory pWsF = new AccessWorkspaceFactory();
                IWorkspace        pWs  = pWsF.OpenFromFile(path, 0);

                if (pWs == null)
                {
                    return;
                }

                FrmStandardOutput sOutput = new FrmStandardOutput(pWs);

                sOutput.ShowDialog();

                if (sOutput.DialogResult == DialogResult.OK)
                {
                    this.DoSomething(sOutput, dialog);
                    dialog.Show();
                }
            }
            catch (System.Exception ex)
            {
                return;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 使用标准图幅输出的参数改变布局视图的内容
        /// </summary>
        /// <param name="opt">标准图廓对话框</param>
        private void DoSomething(FrmStandardOutput output, FrmLayoutPage dialog)
        {
            try
            {
                this.DeleteElements(dialog);
                this.AddDataFrame(dialog);
                this.CopyAndOverwriteMap(dialog);

                ClassOutline oline = new ClassOutline();
                ClassOutline.SetDefault();

                oline.SetCoord(output.Coord);
                oline.SetHeightBase(output.Height);
                oline.SetIsoDistance(output.IsoDistance);
                oline.SetMapChecker(output.MapChecker);
                oline.SetMapMaker(output.MapDrawer);
                oline.SetMapName(output.MapName);
                oline.SetMapNumber(output.MapNumber);
                oline.SetMapSurveyor(output.Surveyor);
                oline.SetProduceMethod(output.MakemapMethod);
                oline.SetProductUnit(output.ProductUnit);

                if (output.RadioGroup.SelectedIndex == 0)
                {
                    oline.SetMapSize(500, 400); // 单位: 毫米
                }
                else if (output.RadioGroup.SelectedIndex == 1)
                {
                    oline.SetMapSize(500, 400); // 单位: 毫米
                }
                else
                {
                    oline.SetMapSize(400, 400); // 单位: 毫米
                }

                oline.SetMapScale(output.MapScale);

                // 坐标要在比例尺后面初始化
                if (output.OrigX.Length > 0 && output.OrigY.Length > 0)
                {
                    oline.SetOrig(
                        System.Convert.ToDouble(output.OrigY),
                        System.Convert.ToDouble(output.OrigY));
                }
                else
                {
                }

                oline.CurMapCode = output.mapCode;      //接图表

                oline.XPrefix = output.XPrefix;
                oline.YPrefix = output.YPrefix;

                ClassOutline.MarginLeft   = output.MarginLeft;
                ClassOutline.MarginBottom = output.MarginDown;

                dialog.PageControl.Page.FormID = esriPageFormID.esriPageFormCUSTOM;
                dialog.PageControl.Page.PutCustomSize(60, 60);
                oline.SetPageLayout(dialog.PageControl);
                //IPageLayoutControl2 pageControl = dialog.PageControl as IPageLayoutControl2;
                //pageControl.Page.FormID = esriPageFormID.esriPageFormCUSTOM;
                //pageControl.Page.PutCustomSize(60, 60);
                //oline.SetPageLayout(pageControl);
                oline.DrawFrame();
                IGraphicsContainer gc        = dialog.PageControl.PageLayout as IGraphicsContainer;
                IMapFrame          pMapFrame = gc.FindFrame(dialog.PageControl.ActiveView.FocusMap) as IMapFrame;
                pMapFrame.ExtentType = esriExtentTypeEnum.esriAutoExtentScale;
            }
            catch (System.Exception ex)
            {
            }
        }