Beispiel #1
0
        public void ExportCun_GongShiTuActions(XZDM cunXZDM, string saveDir)
        {
            //IList<JTSYQ> jtsyqs = null;
            //得到所有界址短线
            IList <JZX> jzxs = JZXCustom.SetJZX(cunXZDM.JTSYQS);

            //从中删除本村的界址短线
            for (int a = 0; a < jzxs.Count; a++)
            {
                JZX    jzx = jzxs[a];
                string str = jzx.BM.Substring(0, 12);
                if (str == cunXZDM.DJZQDM)
                {
                    jzxs.RemoveAt(a);
                    a--;
                }
            }

            string mxdPath = saveDir + "\\" + System.IO.Path.GetFileName(JTSYQCustom.JTSYQGSTMxd);
            string mdbPath = saveDir + "\\" + System.IO.Path.GetFileName(JTSYQCustom.JTSYQGSTMDB);

            //1、复制maxd
            FileUtils.CopyFile(JTSYQCustom.JTSYQGSTMxd, mxdPath);
            //2、复制数据库
            FileUtils.CopyFile(JTSYQCustom.JTSYQZDTMdb, mdbPath);

            //打开工作文件
            MapDocumentClass mapDocument = new MapDocumentClass();

            mapDocument.Open(mxdPath, "");
            AxMapControl mapControl = ArcGisUtils.axMapControl;
            IMap         map        = mapDocument.Map[0];

            mapControl.Map = map;
            //3、设置数据源,数据源是相对路径,不需要设置
            //4、复制 本村的界址线shap
            JTSYQCustom.SaveMap(cunXZDM.JTSYQS);
            //设置本村的界址点标注
            JTSYQCustom.SaveJTSYQBZMap(map, cunXZDM.JTSYQS);


            JZXCustom.SaveJZXMap(jzxs);
            JZXCustom.SaveJZXBZMap(map, jzxs);

            double scale = 100.0;

            // mapControl.Extent = JTSYQCustom.SetExtent(cunXZDM.JTSYQS);
            ArcGisUtils.axMapControl.Extent = JTSYQCustom.GetLayer().AreaOfInterest;
            double num = (double)((int)((map.MapScale + 30.0) / scale) * scale + scale);

            //mapControl.MapScale = 329;
            ArcGisUtils.ChangeMapScale(mapDocument, num);
            //5、替换文字内容,
            Dictionary <string, XMLObject> xmlObjectDic = XMLRead.XmlToObjects(JTSYQCustom.XZDM_Reflect, true);
            XMLObject xmlObject = new XMLObject {
                Column = "BLC", Deafult = "1:" + num
            };

            xmlObjectDic.Add("BLC", xmlObject);
            ArcGisService.ReplaceText(cunXZDM, xmlObjectDic, mapDocument);
            //使用的xml缓存,必须移除
            xmlObjectDic.Remove("BLC");
            //6、工程文件保留
            mapDocument.Save();
            mapDocument.Close();
            ArcGisUtils.Refresh();
        }
Beispiel #2
0
        public void ExportZu_ZhongDiTu(JTSYQ jtsyqGroup, string saveDir)
        {
            IList <JZX> jzxs    = JZXCustom.SetJZX(jtsyqGroup.GroupJTSYQ);
            string      mxdPath = saveDir + "\\" + System.IO.Path.GetFileName(JTSYQCustom.JTSYQZDTMxd);
            string      mdbPath = saveDir + "\\" + System.IO.Path.GetFileName(JTSYQCustom.JTSYQZDTMdb);

            //1、复制maxd
            FileUtils.CopyFile(JTSYQCustom.JTSYQZDTMxd, mxdPath);
            //2、复制数据库
            FileUtils.CopyFile(JTSYQCustom.JTSYQZDTMdb, mdbPath);
            //打开工作文件
            MapDocumentClass mapDocument = new MapDocumentClass();

            mapDocument.Open(mxdPath, "");
            AxMapControl mapControl = ArcGisUtils.axMapControl;
            IMap         map        = mapDocument.Map[0];

            mapControl.Map = map;
            //3、设置数据源,数据源是相对路径,不需要设置
            //4、复制shap

            JTSYQCustom.SaveMap(jtsyqGroup.GroupJTSYQ);
            JTSYQCustom.SaveJTSYQBZMap(map, jtsyqGroup.GroupJTSYQ);
            IList <JZD> jzds = JZDCustom.SaveMap(jtsyqGroup);

            JZXCustom.SaveJZXMap(jzxs);
            JZXCustom.SaveJZXBZMap(map, jzxs);
            JZDCustom.SaveJZDBZMap(map, jzds);

            double scale = 100.0;

            mapControl.Extent = JTSYQCustom.SetExtent(jtsyqGroup.GroupJTSYQ);

            double num = (double)((int)((map.MapScale + 30.0) / scale) * scale + scale);

            //mapControl.MapScale = 329;
            ArcGisUtils.ChangeMapScale(mapDocument, num);
            //5、替换文字内容,
            int index = 0;

            for (int a = 0; a > -1; a++)
            {
                string tufu = jtsyqGroup.TuFu;
                if (Utils.IsStrNull(tufu))
                {
                    MessageBox.Show("你还没有生成图幅号!!!:" + jtsyqGroup.QLR);
                    ArcGisUtils.Refresh();
                    return;
                }
                index = tufu.IndexOf("、", index + 1);
                if (index == -1)
                {
                    break;
                }
                if (a % 2 != 0)
                {
                    jtsyqGroup.TuFu = tufu.Insert(index + 1, "\n");
                }
            }
            Dictionary <string, XMLObject> xmlObjectDic = XMLRead.XmlToObjects(JTSYQCustom.JTSYQ_Reflect, true);
            XMLObject xmlObject = new XMLObject {
                Column = "BLC", Deafult = "1:" + num
            };

            xmlObjectDic.Add("BLC", xmlObject);
            ArcGisService.ReplaceText(jtsyqGroup, xmlObjectDic, mapDocument);
            //使用的xml缓存,必须移除
            xmlObjectDic.Remove("BLC");
            //6、工程文件保留
            mapDocument.Save();
            mapDocument.Close();
            ArcGisUtils.Refresh();
        }