Ejemplo n.º 1
0
 public void Integration2(List <Jzx> jzxList)
 {
     for (int i = 0; i < jzxList.Count; i++)
     {
         Jzx jzx = jzxList[i];
         this.MergeJzx2(jzx);
     }
 }
Ejemplo n.º 2
0
        public void RepairJzxSm(Jzx jzx)
        {
            List <string> list  = new List <string>();
            List <string> jzxSm = jzx.getJzxSm();
            int           num   = this.findJzDh(jzxSm, "J1-");

            for (int i = num; i < jzxSm.Count; i++)
            {
                list.Add(jzxSm[i]);
            }
            for (int i = 0; i < num; i++)
            {
                list.Add(jzxSm[i]);
            }
            jzx.setJzxSm(list);
        }
Ejemplo n.º 3
0
        public void MergeJzx(Jzx jzx)
        {
            List <string> list = new List <string>();

            string[]      array = new string[3];
            List <string> jzxSm = jzx.getJzxSm();

            for (int i = 0; i < jzxSm.Count; i++)
            {
                string   text   = jzxSm[i];
                string[] array2 = text.Split(this.jzxCh);
                if (array2.Length != 3 && !text.Equals("partition"))
                {
                    return;
                }
                if (text.Equals("partition") || (array[2] != null && !array[2].Equals(array2[2])))
                {
                    array[1] = jzxSm[i - 1].Split(this.jzxCh)[1];
                    list.Add(string.Concat(new string[]
                    {
                        array[0],
                        "-",
                        array[1],
                        "_",
                        array[2]
                    }));
                    array = new string[3];
                    if (!text.Equals("partition"))
                    {
                        array[0] = array2[0];
                        array[1] = array2[1];
                        array[2] = array2[2];
                    }
                }
                else if (array[0] == null)
                {
                    array[0] = array2[0];
                    array[1] = array2[1];
                    array[2] = array2[2];
                }
            }
            jzx.setJzxSm(list);
        }
Ejemplo n.º 4
0
        public void MergeJzx2(Jzx jzx)
        {
            List <string> list = new List <string>();

            string[]      array = new string[3];
            List <string> jzxSm = jzx.getJzxSm();

            string[] array2 = jzxSm[0].Split(this.jzxCh);
            for (int i = 0; i < jzxSm.Count - 1; i++)
            {
                string[] array3 = jzxSm[i + 1].Split(this.jzxCh);
                if (array3.Length == 3)
                {
                    if (!array2[2].Equals(array3[2]))
                    {
                        list.Add(string.Concat(new string[]
                        {
                            array2[0],
                            "_",
                            array3[0],
                            "_",
                            array2[2]
                        }));
                        array2[0] = array3[0];
                        array2[2] = array3[2];
                        if (i == jzxSm.Count - 2)
                        {
                            list.Add(string.Concat(new string[]
                            {
                                array3[0],
                                "_",
                                array3[1],
                                "_",
                                array3[2]
                            }));
                        }
                    }
                    else if (i == jzxSm.Count - 2 && list.Count != 0)
                    {
                        list.Add(string.Concat(new string[]
                        {
                            array2[0],
                            "_",
                            array3[1],
                            "_",
                            array2[2]
                        }));
                    }
                    if (i == jzxSm.Count - 2 && list.Count == 0)
                    {
                        list.Add(string.Concat(new string[]
                        {
                            array2[0],
                            "_",
                            array3[0],
                            "_",
                            array2[2]
                        }));
                        list.Add(string.Concat(new string[]
                        {
                            array3[0],
                            "_",
                            array3[1],
                            "_",
                            array3[2]
                        }));
                    }
                }
            }
            jzx.setJzxSm(list);
        }
Ejemplo n.º 5
0
        public List <Jzx> SetJzxBs()
        {
            Dictionary <string, string> dictionary = ExcelUtils.ReadExcelToDic("C:\\ZJDTemplete\\行政代码.xls", 0);
            List <Jzx> list   = new List <Jzx>();
            Editor     editor = this.utils.GetEditor();

            TypedValue[] array = new TypedValue[]
            {
                new TypedValue(8, "JZD"),
                new TypedValue(0, "LWPOLYLINE")
            };
            SelectionFilter        selectionFilter        = new SelectionFilter(array);
            PromptSelectionOptions promptSelectionOptions = new PromptSelectionOptions();

            promptSelectionOptions.MessageForAdding = ("\n请选择要生成标示表的JZD图层的权属线");
            PromptSelectionResult selection = editor.GetSelection(promptSelectionOptions, selectionFilter);
            List <Jzx>            result;

            if (selection.Status == PromptStatus.Cancel)
            {
                result = list;
            }
            else
            {
                DBObjectCollection entityCollection = this.utils.GetEntityCollection(selection);
                if (entityCollection.Count == 0)
                {
                    editor.WriteMessage("\n你没有选择对象");
                    result = list;
                }
                else
                {
                    Database workingDatabase = HostApplicationServices.WorkingDatabase;
                    using (Transaction transaction = workingDatabase.TransactionManager.StartTransaction())
                    {
                        foreach (DBObject dBObject in entityCollection)
                        {
                            if (dBObject is Polyline)
                            {
                                Jzx jzx = new Jzx("");
                                if (dBObject is Polyline)
                                {
                                    Polyline     polyline     = (Polyline)transaction.GetObject(dBObject.ObjectId, OpenMode.ForWrite, true);
                                    ResultBuffer resultBuffer = polyline.XData;
                                    if (!(resultBuffer == null))
                                    {
                                        resultBuffer = polyline.GetXDataForApplication("SOUTH");
                                        TypedValue[] array2 = resultBuffer.AsArray();
                                        if (array2 != null && array2.Length >= 5)
                                        {
                                            if (!polyline.Closed)
                                            {
                                                editor.WriteMessage(array2[2].Value.ToString() + ",多段线没有闭合\n");
                                            }
                                            else
                                            {
                                                jzx.setCbfbm(array2[2].Value.ToString());
                                                jzx.setCbfmc(array2[3].Value.ToString());
                                                Point3dCollection point3dCollection = new Point3dCollection();
                                                polyline.GetStretchPoints(point3dCollection);
                                                point3dCollection = this.utils.RePoint(point3dCollection);
                                                List <string> list2 = new List <string>();
                                                double        num;
                                                double        num2;
                                                double        num3;
                                                double        num4;
                                                string        text;
                                                for (int i = 0; i < point3dCollection.Count - 1; i++)
                                                {
                                                    num  = Math.Round(point3dCollection[i].X, 3);
                                                    num2 = Math.Round(point3dCollection[i].Y, 3);
                                                    num3 = Math.Round(point3dCollection[i + 1].X, 3);
                                                    num4 = Math.Round(point3dCollection[i + 1].Y, 3);
                                                    text = this.utils.selectFw_JzxSur(point3dCollection[i], point3dCollection[i + 1], polyline);
                                                    list2.Add(string.Concat(new object[]
                                                    {
                                                        "J",
                                                        i + 1,
                                                        "_J",
                                                        i + 2,
                                                        "_",
                                                        text,
                                                        "_",
                                                        Math.Round(this.utils.CalculateTwoPt(point3dCollection[i], point3dCollection[i + 1]), 6),
                                                        "_",
                                                        num,
                                                        ",",
                                                        num2,
                                                        "_",
                                                        num3,
                                                        ",",
                                                        num4
                                                    }));
                                                }
                                                num  = Math.Round(point3dCollection[point3dCollection.Count - 1].X, 3);
                                                num2 = Math.Round(point3dCollection[point3dCollection.Count - 1].Y, 3);
                                                num3 = Math.Round(point3dCollection[0].X, 3);
                                                num4 = Math.Round(point3dCollection[0].Y, 3);
                                                text = this.utils.selectFw_JzxSur(point3dCollection[point3dCollection.Count - 1], point3dCollection[0], polyline);
                                                list2.Add(string.Concat(new object[]
                                                {
                                                    "J",
                                                    point3dCollection.Count,
                                                    "_J1_",
                                                    text,
                                                    "_",
                                                    Math.Round(this.utils.CalculateTwoPt(point3dCollection[point3dCollection.Count - 1], point3dCollection[0]), 6),
                                                    "_",
                                                    num,
                                                    ",",
                                                    num2,
                                                    "_",
                                                    num3,
                                                    ",",
                                                    num4
                                                }));
                                                jzx.setJzxBs(list2);
                                                list.Add(jzx);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        transaction.Commit();
                    }
                    result = list;
                }
            }
            return(result);
        }
Ejemplo n.º 6
0
        public List <Jzx> createJzxList(object[] formText)
        {
            List <Jzx> list   = new List <Jzx>();
            Editor     editor = this.utils.GetEditor();

            TypedValue[] array = new TypedValue[]
            {
                new TypedValue(8, "JZD"),
                new TypedValue(0, "LWPOLYLINE")
            };
            SelectionFilter        selectionFilter        = new SelectionFilter(array);
            PromptSelectionOptions promptSelectionOptions = new PromptSelectionOptions();

            promptSelectionOptions.MessageForAdding = ("\n请选择要生成四至的JZD图层权属线");
            PromptSelectionResult selection = editor.GetSelection(promptSelectionOptions, selectionFilter);
            List <Jzx>            result;

            if (selection.Status == PromptStatus.Cancel)
            {
                result = list;
            }
            else
            {
                DBObjectCollection entityCollection = this.utils.GetEntityCollection(selection);
                if (entityCollection.Count == 0)
                {
                    editor.WriteMessage("\n你没有选择对象");
                    result = list;
                }
                else
                {
                    Database workingDatabase = HostApplicationServices.WorkingDatabase;
                    using (Transaction transaction = workingDatabase.TransactionManager.StartTransaction())
                    {
                        Dictionary <string, string> addressDic = ExcelUtils.ReadExcelToDic((string)formText[0], 0);
                        foreach (DBObject dBObject in entityCollection)
                        {
                            if (dBObject is Polyline)
                            {
                                Polyline     polyline     = (Polyline)transaction.GetObject(dBObject.ObjectId, OpenMode.ForWrite, true);
                                string       surAddress   = this.jzdSrevice.GetSurAddress(polyline, addressDic);
                                Jzx          jzx          = new Jzx(surAddress);
                                ResultBuffer resultBuffer = polyline.XData;
                                if (!(resultBuffer == null))
                                {
                                    resultBuffer = polyline.GetXDataForApplication("SOUTH");
                                    TypedValue[] array2 = resultBuffer.AsArray();
                                    if (array2 != null && array2.Length >= 5)
                                    {
                                        jzx.setCbfbm(array2[2].Value.ToString());
                                        jzx.setCbfmc(array2[3].Value.ToString());
                                        this.jzdSrevice.GetSurAddress(polyline, addressDic);
                                        Point3dCollection point3dCollection = new Point3dCollection();
                                        polyline.GetStretchPoints(point3dCollection);
                                        point3dCollection = this.utils.RePoint(point3dCollection);
                                        double[]          dou = this.utils.FindFourPoints(point3dCollection);
                                        Point3dCollection point3dCollection2 = this.utils.createFourPoint(dou);
                                        Polyline3d        polyline3d         = this.utils.CreatePolye(point3dCollection2, false);
                                        int   num    = this.utils.PolyDiPoly(point3dCollection, point3dCollection2);
                                        int[] array3 = new int[4];
                                        if (num > 3)
                                        {
                                            int[]   array4 = this.utils.FindPointsDic(point3dCollection);
                                            int[]   array5 = this.utils.FindPointsDic(point3dCollection, point3dCollection2);
                                            int[][] max    = new int[][]
                                            {
                                                array4,
                                                array5
                                            };
                                            int num2 = this.utils.SelectPc1PC2(max, point3dCollection);
                                            if (num2 == 0)
                                            {
                                                array3 = array4;
                                            }
                                            else if (num2 == 1)
                                            {
                                                array3 = array5;
                                            }
                                        }
                                        else
                                        {
                                            array3 = this.utils.FindPointsDic(point3dCollection, point3dCollection2);
                                        }
                                        List <string> list2 = new List <string>();
                                        list2.AddRange(this.GetJzxSm(point3dCollection, array3[0], array3[1], surAddress, polyline, (double)formText[2]));
                                        if (list2.Count != 0 && !list2[list2.Count - 1].Equals("partition"))
                                        {
                                            list2.Add("partition");
                                        }
                                        list2.AddRange(this.GetJzxSm(point3dCollection, array3[1], array3[2], surAddress, polyline, (double)formText[2]));
                                        if (list2.Count != 0 && !list2[list2.Count - 1].Equals("partition"))
                                        {
                                            list2.Add("partition");
                                        }
                                        if (array3[2] < array3[3])
                                        {
                                            list2.AddRange(this.GetJzxSm(point3dCollection, array3[2], array3[3], surAddress, polyline, (double)formText[2]));
                                            if (list2.Count != 0 && !list2[list2.Count - 1].Equals("partition"))
                                            {
                                                list2.Add("partition");
                                            }
                                        }
                                        if (array3[3] != 0)
                                        {
                                            if (array3[3] < array3[2])
                                            {
                                                list2.AddRange(this.GetJzxSm(point3dCollection, array3[2], point3dCollection.Count - 1, surAddress, polyline, (double)formText[2]));
                                                list2.AddRange(this.GetJzxSm(point3dCollection, point3dCollection.Count - 1, array3[3], surAddress, polyline, (double)formText[2]));
                                            }
                                            else
                                            {
                                                list2.AddRange(this.GetJzxSm(point3dCollection, array3[3], point3dCollection.Count - 1, surAddress, polyline, (double)formText[2]));
                                            }
                                        }
                                        else
                                        {
                                            list2.AddRange(this.GetJzxSm(point3dCollection, array3[2], point3dCollection.Count - 1, surAddress, polyline, (double)formText[2]));
                                        }
                                        list2.AddRange(this.GetSingleJzxSm(point3dCollection, point3dCollection.Count - 1, 0, surAddress, polyline, (double)formText[2]));
                                        if (list2.Count != 0 && !list2[list2.Count - 1].Equals("partition"))
                                        {
                                            list2.Add("partition");
                                        }
                                        if (this.findJzDh(list2, "J1_") == -1 || this.findJzDh(list2, "J1-") == -1)
                                        {
                                            list2.AddRange(this.GetJzxSm(point3dCollection, 0, array3[0], surAddress, polyline, (double)formText[2]));
                                            if (list2.Count != 0 && !list2[list2.Count - 1].Equals("partition"))
                                            {
                                                list2.Add("partition");
                                            }
                                        }
                                        jzx.setJzxSm(list2);
                                        list.Add(jzx);
                                    }
                                }
                            }
                        }
                        transaction.Commit();
                    }
                    result = list;
                }
            }
            return(result);
        }