예제 #1
0
파일: JzdService.cs 프로젝트: lyon913/BDCDC
        public List <JZX> getJzxListFromJzd(ZDJBXX zdjbxx, List <JZD> jzdList)
        {
            if (jzdList == null || jzdList.Count < 2)
            {
                return(null);
            }
            List <JZX> jzxList = new List <JZX>();

            for (int i = 0; i < jzdList.Count; i++)
            {
                JZD start    = jzdList[i];
                int endIndex = i + 1;
                if (endIndex == jzdList.Count)
                {
                    endIndex = 0;
                }
                JZD end = jzdList[endIndex];

                JZX x = new JZX();
                x.ZDDM = zdjbxx.ZDDM;
                x.QDH  = start.JZDH;
                x.ZDH  = end.JZDH;
                double cd = distance((double)start.X, (double)start.Y, (double)end.X, (double)end.Y);
                x.JZXCD = Decimal.Round((decimal)cd, 2);
                x.JXXZ  = "600001";
                x.JZXLB = "6";
                x.JZXWZ = "2";
                x.ZT    = 0;
                jzxList.Add(x);
            }
            return(jzxList);
        }
예제 #2
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();
        }