Example #1
0
        internal static CircleModel Polyline2DModel(Polyline2d line, AttributeModel atModel)
        {
            CircleModel dbModel = new CircleModel();


            double length = line.Length;

            dbModel.pointList = MethodCommand.GetArcPoints(line, length);

            dbModel.Color = line.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(line.LayerId) : System.Drawing.ColorTranslator.ToHtml(line.Color.ColorValue);
            foreach (AttributeItemModel item in atModel.attributeItems)
            {
                string attValue = "";

                switch (item.AtItemType)
                {
                case AttributeItemType.Area:
                    attValue = line.Area.ToString();
                    break;

                case AttributeItemType.TxtHeight:

                    break;

                case AttributeItemType.Color:
                    attValue = dbModel.Color;
                    break;

                case AttributeItemType.Content:

                    break;

                case AttributeItemType.LayerName:
                    attValue = line.Layer;
                    break;

                case AttributeItemType.LineScale:
                    attValue = line.LinetypeScale.ToString();
                    break;

                case AttributeItemType.LineType:
                    attValue = GetLayerLineTypeByID(line);
                    break;

                case AttributeItemType.Overallwidth:
                    attValue = line.ConstantWidth.ToString();
                    break;

                case AttributeItemType.TotalArea:

                    break;
                }
                if (!string.IsNullOrEmpty(attValue))
                {
                    item.AtValue = attValue;
                    dbModel.attItemList.Add(item);
                }
            }
            return(dbModel);
        }
Example #2
0
        public PipeItemModel GetPipeItemInfo(Polyline line, List <MText> txtList)
        {
            PipeItemModel item = new PipeItemModel();

            try
            {
                item.PipeLength      = line.Length.ToString();
                item.Style.LineWidth = line.ConstantWidth.ToString();
                item.ColorIndex      = line.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(line.LayerId) : System.Drawing.ColorTranslator.ToHtml(line.Color.ColorValue);
                Document doc = Application.DocumentManager.MdiActiveDocument;
                Database db  = doc.Database;
                using (Transaction tran = db.TransactionManager.StartTransaction())
                {
                    int   vtnum = line.NumberOfVertices;
                    MText mText = MethodCommand.FindMTextIsInPolyineForPipe(line, txtList);
                    if (mText != null)
                    {
                        item.TxtLocation = new System.Drawing.PointF((float)mText.Location.X, (float)mText.Location.Y);
                        item.PipeType    = mText.Text; //Replace(" ", "").Replace(" ", "");
                        item.PipeLayer   = mText.Layer;
                    }
                }
                item.pipeList = PolylineMethod.GetPolyLineInfoPt(line);
            }
            catch
            { }
            return(item);
        }
Example #3
0
        public static DbTextModel DbText2Model(DBText dbText, AttributeModel atModel)
        {
            DbTextModel dbModel = new DbTextModel();

            dbModel.attItemList = new List <AttributeItemModel>();
            dbModel.Height      = dbText.Height;
            //dbModel.Position = new System.Drawing.PointF((float)dbText.Position.X, (float)dbText.Position.Y);
            dbModel.Position  = Point3d2Pointf(dbText.Position);
            dbModel.Rotation  = dbText.Rotation;
            dbModel.ThickNess = dbText.Thickness;
            dbModel.Text      = dbText.TextString.Replace(" ", "").Replace("\n", "").Replace("\r", "");
            if (dbText.TextString.Replace("      ", "").Replace("\n", "").Replace("\r", "") == "纬三路")
            {
            }
            dbModel.Color = dbText.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(dbText.LayerId) : System.Drawing.ColorTranslator.ToHtml(dbText.Color.ColorValue);
            foreach (AttributeItemModel item in atModel.attributeItems)
            {
                string attValue = "";

                switch (item.AtItemType)
                {
                case AttributeItemType.TxtHeight:
                    attValue = dbText.Height.ToString();
                    break;

                case AttributeItemType.Color:
                    attValue = dbModel.Color;
                    break;

                case AttributeItemType.Content:
                    attValue = dbText.TextString.Replace(" ", "").Replace("      ", "").Replace("\n", "").Replace("\r", "");
                    break;

                case AttributeItemType.LayerName:
                    attValue = dbText.Layer;
                    break;

                case AttributeItemType.LineScale:
                    attValue = dbText.LinetypeScale.ToString();
                    break;

                case AttributeItemType.LineType:
                    attValue = GetLayerLineTypeByID(dbText);
                    break;
                }
                if (!string.IsNullOrEmpty(attValue))
                {
                    item.AtValue = attValue;
                    dbModel.attItemList.Add(item);
                }
            }
            return(dbModel);
        }
Example #4
0
        public static DbTextModel DbText2Model(MText dbText)
        {
            DbTextModel dbModel = new DbTextModel();

            dbModel.Height = dbText.ActualHeight;
            //dbModel.Position = new System.Drawing.PointF((float)dbText.Position.X, (float)dbText.Position.Y);
            dbModel.Position = Point3d2Pointf(dbText.Location);
            dbModel.Rotation = dbText.Rotation;
            //      dbModel.ThickNess = dbText.TextHeight;
            dbModel.Text  = dbText.Text;
            dbModel.Color = dbText.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(dbText.LayerId) : System.Drawing.ColorTranslator.ToHtml(dbText.Color.ColorValue);
            return(dbModel);
        }
Example #5
0
        internal static CircleModel Polyline2DModel(Polyline2d line)
        {
            CircleModel dbModel = new CircleModel();


            double length = line.Length;

            dbModel.pointList = MethodCommand.GetArcPoints(line, length);
            dbModel.isDashed  = GetLayerLineTypeByIDEx(line);

            dbModel.Color = line.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(line.LayerId) : System.Drawing.ColorTranslator.ToHtml(line.Color.ColorValue);
            return(dbModel);
        }
Example #6
0
        public static LineModel Line2Model(Line line)
        {
            LineModel dbModel = new LineModel();

            dbModel.StartPoint = Point3d2Pointf(line.StartPoint);

            dbModel.EndPoint = Point3d2Pointf(line.EndPoint);

            dbModel.Angle = line.Angle;

            dbModel.Length   = line.Length;
            dbModel.Color    = line.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(line.LayerId) : System.Drawing.ColorTranslator.ToHtml(line.Color.ColorValue);
            dbModel.isDashed = GetLayerLineTypeByIDEx(line);
            return(dbModel);
        }
Example #7
0
        public static CircleModel Circle2Model(Circle line)
        {
            CircleModel dbModel = new CircleModel();

            dbModel.Center  = Point3d2Pointf(line.Center);
            dbModel.Radius  = line.Radius;
            dbModel.GeoType = "Circle";
            MyPoint spt    = new MyPoint(line.StartPoint.X, line.StartPoint.Y);
            MyPoint ept    = new MyPoint(line.EndPoint.X, line.EndPoint.Y);
            MyPoint center = new MyPoint(dbModel.Center.X, dbModel.Center.Y);

            dbModel.pointList = MethodCommand.GetArcPoints(line, line.Circumference);
            dbModel.Color     = line.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(line.LayerId) : System.Drawing.ColorTranslator.ToHtml(line.Color.ColorValue);
            dbModel.isDashed  = GetLayerLineTypeByIDEx(line);
            return(dbModel);
        }
Example #8
0
        public static EllipseModel Ellipse2Model(Ellipse line)
        {
            EllipseModel dbModel = new EllipseModel();

            dbModel.Center    = Point3d2Pointf(line.Center);
            dbModel.MajorAxis = line.MajorRadius;
            dbModel.MinorAxis = line.MinorRadius;
            dbModel.GeoType   = "Ellipse";
            MyPoint spt    = new MyPoint(line.StartPoint.X, line.StartPoint.Y);
            MyPoint ept    = new MyPoint(line.EndPoint.X, line.EndPoint.Y);
            MyPoint center = new MyPoint(dbModel.Center.X, dbModel.Center.Y);

            double length = line.RadiusRatio * (line.MinorRadius + line.MajorRadius);

            dbModel.pointList = MethodCommand.GetArcPoints(line, length);
            dbModel.isDashed  = GetLayerLineTypeByIDEx(line);

            dbModel.Color = line.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(line.LayerId) : System.Drawing.ColorTranslator.ToHtml(line.Color.ColorValue);
            return(dbModel);
        }
Example #9
0
        public static DbTextModel DbText2Model(DBText dbText)
        {
            DbTextModel dbModel = new DbTextModel();

            dbModel.Height = dbText.Height;
            //dbModel.Position = new System.Drawing.PointF((float)dbText.Position.X, (float)dbText.Position.Y);
            dbModel.Position  = Point3d2Pointf(dbText.Position);
            dbModel.Rotation  = dbText.Rotation;
            dbModel.ThickNess = dbText.Thickness;
            dbModel.Text      = dbText.TextString;
            dbModel.Color     = dbText.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(dbText.LayerId) : System.Drawing.ColorTranslator.ToHtml(dbText.Color.ColorValue);

            ////获取文本
            //string text = dbModel.Text;
            ////得到Bitmap(传入Rectangle.Empty自动计算宽高)
            //Bitmap bmp = TextToBitmap(text, new Font("Arial", 16), Rectangle.Empty, Color.FromName(dbModel.Color), Color.FromName("White"));

            ////保存到桌面save.jpg
            //string directory = System.Environment.GetFolderPath(System.Environment.SpecialFolder.DesktopDirectory);
            //bmp.Save(directory + "\\save.png", System.Drawing.Imaging.ImageFormat.Png);

            return(dbModel);
        }
Example #10
0
        internal static ArcModel Arc2Model(Arc line)
        {
            ArcModel dbModel = new ArcModel();

            dbModel.Center     = Point3d2Pointf(line.Center);
            dbModel.EndAngel   = line.EndAngle;
            dbModel.EndPoint   = MethodCommand.Point3d2Pointf(line.EndPoint);
            dbModel.Startangel = line.StartAngle;
            dbModel.StartPoint = MethodCommand.Point3d2Pointf(line.StartPoint);
            dbModel.GeoType    = "Arc";
            //dbModel.MajorAxis= line.MajorRadius;
            //dbModel.MinorAxis = line.MinorRadius;
            MyPoint spt    = new MyPoint(line.StartPoint.X, line.StartPoint.Y);
            MyPoint ept    = new MyPoint(line.EndPoint.X, line.EndPoint.Y);
            MyPoint center = new MyPoint(dbModel.Center.X, dbModel.Center.Y);

            double length = line.Length;

            dbModel.pointList = MethodCommand.GetArcPoints(line, length);
            dbModel.isDashed  = GetLayerLineTypeByIDEx(line);
            dbModel.Color     = line.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(line.LayerId) : System.Drawing.ColorTranslator.ToHtml(line.Color.ColorValue);
            return(dbModel);
        }
Example #11
0
        public static HatchModel Hatch2Model(Hatch dbText)
        {
            HatchModel dbModel = new HatchModel();

            int cont = dbText.NumberOfLoops;

            for (int i = 0; i < cont; i++)
            {
                dbModel.loopPoints.Add(i, new ColorAndPointItemModel());
                HatchLoop loop = dbText.GetLoopAt(i);

                ColorAndPointItemModel cpModel = new ColorAndPointItemModel();
                if (i == 0)
                {
                    cpModel.Color = dbText.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(dbText.LayerId) : System.Drawing.ColorTranslator.ToHtml(dbText.Color.ColorValue);
                }
                else
                {
                    cpModel.Color = "#FFFFFF";
                    //  cpModel.ZIndex = "1";
                }

                //if (loop.Polyline.Count == 3)
                //{
                //}

                if (loop.IsPolyline && loop.Polyline.Count > 3)
                {
                    for (int j = 0; j < loop.Polyline.Count - 1; j++)
                    {
                        BulgeVertex vertex  = loop.Polyline[j];
                        BulgeVertex vertex1 = loop.Polyline[j + 1];
                        if (vertex.Bulge != 0)
                        {
                            cpModel.loopPoints.AddRange(MethodCommand.GetArcPointsByBulge(vertex.Vertex, vertex1.Vertex, vertex.Bulge));
                        }
                        else
                        {
                            cpModel.loopPoints.Add(Point2d2Pointf(vertex.Vertex));
                        }
                    }


                    if (dbText.NumberOfHatchLines > 0)
                    {
                        Line2dCollection cl = dbText.GetHatchLinesData();
                    } //foreach (Line2d itemi in )
                      //{

                    //}
                }
                else
                {
                    Curve2dCollection col_cur2d = loop.Curves;
                    foreach (Curve2d item in col_cur2d)
                    {
                        Point2d[] M_point2d = item.GetSamplePoints(20);
                        foreach (Point2d point in M_point2d)
                        {
                            cpModel.loopPoints.Add(Point2d2Pointf(point));
                        }
                    }
                }

                if (cpModel.loopPoints[0] != cpModel.loopPoints[cpModel.loopPoints.Count - 1])
                {
                    cpModel.loopPoints.Add(cpModel.loopPoints[0]);
                }
                dbModel.loopPoints[i] = cpModel;
            }

            for (int i = 0; i < dbModel.loopPoints.Count; i++)
            {
                for (int j = 0; j < dbModel.loopPoints.Count; j++)
                {
                    if (i != j)
                    {
                        if (MethodCommand.PointsAllInPoints(dbModel.loopPoints[j].loopPoints, dbModel.loopPoints[i].loopPoints))
                        {
                            dbModel.loopPoints[j].ZIndex = "2";
                        }
                    }
                }
            }
            try
            {
                dbModel.Area = dbText.Area;
            }
            catch
            { }
            //   dbModel.Color =
            return(dbModel);
        }
Example #12
0
        public static PolyLineModel Polyline2Model(Autodesk.AutoCAD.DatabaseServices.Polyline polyLine, AttributeModel atModel)
        {
            PolyLineModel polylineModel = new PolyLineModel();

            polylineModel.individualName   = "";
            polylineModel.individualFactor = "";
            polylineModel.individualCode   = "";
            polylineModel.individualStage  = "";

            // 增加个体编码、个体要素、个体名称
            System.Data.DataTable tb = Method.AutoGenerateNumMethod.GetAllPolylineNumsEx(polyLine);
            if (tb.Rows != null && tb.Rows.Count > 0)
            {
                foreach (System.Data.DataRow row in tb.Rows)
                {
                    if ((string)row["多段线id"] == polyLine.Id.Handle.Value.ToString())
                    {
                        polylineModel.individualName   = (string)row["个体名称"];
                        polylineModel.individualFactor = (string)row["个体要素"];
                        polylineModel.individualCode   = (string)row["个体编码"];
                        polylineModel.individualStage  = (string)row["个体阶段"];
                    }
                }
            }
            polylineModel.Area     = polyLine.Area;
            polylineModel.Closed   = polyLine.Closed;
            polylineModel.Color    = polyLine.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(polyLine.LayerId) : System.Drawing.ColorTranslator.ToHtml(polyLine.Color.ColorValue);
            polylineModel.Vertices = new System.Collections.ArrayList();
            int vn = polyLine.NumberOfVertices;  //lwp已知的多段线

            for (int i = 0; i < vn; i++)
            {
                Point2d     pt = polyLine.GetPoint2dAt(i);
                SegmentType st = polyLine.GetSegmentType(i);
                if (st == SegmentType.Arc)
                {
                    ArcModel      arc = new ArcModel();
                    CircularArc2d cir = polyLine.GetArcSegment2dAt(i);
                    //  arc.Center = new System.Drawing.PointF((float)cir.Center.X,(float)cir.Center.Y);
                    arc.Center     = Point2d2Pointf(cir.Center);
                    arc.Radius     = cir.Radius;
                    arc.Startangel = cir.StartAngle;
                    arc.EndAngel   = cir.EndAngle;
                    //  arc.StartPoint = new System.Drawing.PointF((float)cir.StartPoint.X, (float)cir.StartPoint.Y);
                    if (cir.HasStartPoint)
                    {
                        arc.StartPoint = Point2d2Pointf(cir.StartPoint);
                    }
                    //  arc.EndPoint = new System.Drawing.PointF((float)cir.EndPoint.X, (float)cir.EndPoint.Y);
                    if (cir.HasEndPoint)
                    {
                        arc.EndPoint = Point2d2Pointf(cir.EndPoint);
                    }


                    MyPoint spt    = new MyPoint(arc.StartPoint.X, arc.StartPoint.Y);
                    MyPoint ept    = new MyPoint(arc.EndPoint.X, arc.EndPoint.Y);
                    MyPoint center = new MyPoint(arc.Center.X, arc.Center.Y);
                    arc.Color = polylineModel.Color;
                    // arc.pointList = MethodCommand.GetRoationPoint(spt, ept, center, arc.Startangel,arc.EndAngel,cir.IsClockWise);
                    arc.pointList = MethodCommand.GetArcPointsByPoint2d(cir.GetSamplePoints(20));
                    //arc.pointList = MethodCommand.GetArcPoints(arc.Center,arc.Startangel,arc.EndAngel,arc.Radius);
                    //  arc.pointList.Insert(0, arc.StartPoint);
                    //   arc.pointList.Add(arc.EndPoint);
                    foreach (AttributeItemModel item in atModel.attributeItems)
                    {
                        string attValue = "";

                        switch (item.AtItemType)
                        {
                        case AttributeItemType.Area:
                            attValue = polyLine.Area.ToString();
                            break;

                        case AttributeItemType.TxtHeight:

                            break;

                        case AttributeItemType.Color:
                            attValue = polylineModel.Color;
                            break;

                        case AttributeItemType.Content:

                            break;

                        case AttributeItemType.LayerName:
                            attValue = polyLine.Layer;
                            break;

                        case AttributeItemType.LineScale:
                            attValue = polyLine.LinetypeScale.ToString();
                            break;

                        case AttributeItemType.LineType:
                            attValue = GetLayerLineTypeByID(polyLine);
                            break;

                        case AttributeItemType.Overallwidth:
                            attValue = polyLine.ConstantWidth.ToString();
                            break;

                        case AttributeItemType.TotalArea:

                            break;
                        }
                        if (!string.IsNullOrEmpty(attValue))
                        {
                            item.AtValue = attValue;
                            arc.attItemList.Add(item);
                        }
                    }
                    polylineModel.Vertices.Add(arc);
                }
                else if (st == SegmentType.Line)
                {
                    LineModel     line   = new LineModel();
                    LineSegment2d lineSe = polyLine.GetLineSegment2dAt(i);
                    if (lineSe.HasStartPoint)
                    {
                        line.StartPoint = Point2d2Pointf(lineSe.StartPoint);
                    }
                    if (lineSe.HasEndPoint)
                    {
                        line.EndPoint = Point2d2Pointf(lineSe.EndPoint);
                    }
                    if (line.StartPoint.X == line.EndPoint.X && line.StartPoint.Y == line.EndPoint.Y)
                    {
                        line.Angle  = 0;
                        line.Length = 0;
                    }
                    else if (line.StartPoint.X == line.EndPoint.X)
                    {
                        line.Angle = 90;
                    }
                    line.Color = polylineModel.Color;
                    foreach (AttributeItemModel item in atModel.attributeItems)
                    {
                        string attValue = "";

                        switch (item.AtItemType)
                        {
                        case AttributeItemType.Area:
                            attValue = polyLine.Area.ToString();
                            break;

                        case AttributeItemType.TxtHeight:

                            break;

                        case AttributeItemType.Color:
                            attValue = polylineModel.Color;
                            break;

                        case AttributeItemType.Content:

                            break;

                        case AttributeItemType.LayerName:
                            attValue = polyLine.Layer;
                            break;

                        case AttributeItemType.LineScale:
                            attValue = polyLine.LinetypeScale.ToString();
                            break;

                        case AttributeItemType.LineType:
                            attValue = GetLayerLineTypeByID(polyLine);
                            break;

                        case AttributeItemType.Overallwidth:
                            attValue = polyLine.ConstantWidth.ToString();
                            break;

                        case AttributeItemType.TotalArea:

                            break;
                        }

                        item.AtValue = attValue;
                        line.attItemList.Add(item);
                    }
                    polylineModel.Vertices.Add(line);
                }
            }

            return(polylineModel);
        }
Example #13
0
        public static CircleModel Ellipse2Model(Ellipse line, AttributeModel atModel)
        {
            CircleModel dbModel = new CircleModel();

            dbModel.Center = Point3d2Pointf(line.Center);
            //dbModel.MajorAxis= line.MajorRadius;
            //dbModel.MinorAxis = line.MinorRadius;
            MyPoint spt    = new MyPoint(line.StartPoint.X, line.StartPoint.Y);
            MyPoint ept    = new MyPoint(line.EndPoint.X, line.EndPoint.Y);
            MyPoint center = new MyPoint(dbModel.Center.X, dbModel.Center.Y);

            double length = line.RadiusRatio * (line.MinorRadius + line.MajorRadius);

            dbModel.pointList = MethodCommand.GetArcPoints(line, length);

            dbModel.Color = line.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(line.LayerId) : System.Drawing.ColorTranslator.ToHtml(line.Color.ColorValue);
            foreach (AttributeItemModel item in atModel.attributeItems)
            {
                string attValue = "";

                switch (item.AtItemType)
                {
                case AttributeItemType.Area:
                    attValue = line.Area.ToString();
                    break;

                case AttributeItemType.TxtHeight:

                    break;

                case AttributeItemType.Color:
                    attValue = dbModel.Color;
                    break;

                case AttributeItemType.Content:

                    break;

                case AttributeItemType.LayerName:
                    attValue = line.Layer;
                    break;

                case AttributeItemType.LineScale:
                    attValue = line.LinetypeScale.ToString();
                    break;

                case AttributeItemType.LineType:
                    attValue = GetLayerLineTypeByID(line);
                    break;

                case AttributeItemType.Overallwidth:
                    break;

                case AttributeItemType.TotalArea:

                    break;
                }
                if (!string.IsNullOrEmpty(attValue))
                {
                    item.AtValue = attValue;
                    dbModel.attItemList.Add(item);
                }
            }
            return(dbModel);
        }
Example #14
0
        public static LineModel Line2Model(Line line, AttributeModel atModel)
        {
            LineModel dbModel = new LineModel();

            dbModel.StartPoint = Point3d2Pointf(line.StartPoint);

            dbModel.EndPoint = Point3d2Pointf(line.EndPoint);

            dbModel.Angle = line.Angle;

            dbModel.Length = line.Length;
            dbModel.Color  = line.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(line.LayerId) : System.Drawing.ColorTranslator.ToHtml(line.Color.ColorValue);
            foreach (AttributeItemModel item in atModel.attributeItems)
            {
                string attValue = "";

                switch (item.AtItemType)
                {
                case AttributeItemType.Area:

                    break;

                case AttributeItemType.TxtHeight:

                    break;

                case AttributeItemType.Color:
                    attValue = dbModel.Color;
                    break;

                case AttributeItemType.Content:

                    break;

                case AttributeItemType.LayerName:
                    attValue = line.Layer;
                    break;

                case AttributeItemType.LineScale:
                    attValue = line.LinetypeScale.ToString();
                    break;

                case AttributeItemType.LineType:
                    attValue = GetLayerLineTypeByID(line);
                    break;

                case AttributeItemType.Overallwidth:

                    break;

                case AttributeItemType.TotalArea:

                    break;
                }
                if (!string.IsNullOrEmpty(attValue))
                {
                    item.AtValue = attValue;
                    dbModel.attItemList.Add(item);
                }
            }
            return(dbModel);
        }
Example #15
0
        public static PolyLineModel Polyline2Model(Autodesk.AutoCAD.DatabaseServices.Polyline polyLine)
        {
            PolyLineModel polylineModel = new PolyLineModel();

            polylineModel.individualName   = "";
            polylineModel.individualFactor = "";
            polylineModel.individualCode   = "";
            polylineModel.individualStage  = "";

            // 增加个体编码、个体要素、个体名称
            System.Data.DataTable tb = Method.AutoGenerateNumMethod.GetAllPolylineNumsEx(polyLine);
            if (tb.Rows != null && tb.Rows.Count > 0)
            {
                foreach (System.Data.DataRow row in tb.Rows)
                {
                    if ((string)row["多段线id"] == polyLine.Id.Handle.Value.ToString())
                    {
                        polylineModel.individualName   = (string)row["个体名称"];
                        polylineModel.individualFactor = (string)row["个体要素"];
                        polylineModel.individualCode   = (string)row["个体编码"];
                        polylineModel.individualStage  = (string)row["个体阶段"];
                    }
                }
            }

            polylineModel.Area     = polyLine.Area;
            polylineModel.Closed   = polyLine.Closed;
            polylineModel.Color    = polyLine.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(polyLine.LayerId) : System.Drawing.ColorTranslator.ToHtml(polyLine.Color.ColorValue);
            polylineModel.Vertices = new System.Collections.ArrayList();
            int vn = polyLine.NumberOfVertices;  //lwp已知的多段线

            //if(polylineModel.Closed)
            //{
            //    for (int i = 0; i < vn; i++)
            //    {
            //        Point2d pt = polyLine.GetPoint2dAt(i);

            //        PointF ptf = new PointF((float)pt.X, (float)pt.Y);

            //        polylineModel.Vertices.Add(ptf);
            //    }
            //}
            //else
            //{


            for (int i = 0; i < vn; i++)
            {
                Point2d     pt = polyLine.GetPoint2dAt(i);
                SegmentType st = polyLine.GetSegmentType(i);
                if (st == SegmentType.Arc)
                {
                    ArcModel      arc = new ArcModel();
                    CircularArc2d cir = polyLine.GetArcSegment2dAt(i);
                    //  arc.Center = new System.Drawing.PointF((float)cir.Center.X,(float)cir.Center.Y);
                    arc.Center     = Point2d2Pointf(cir.Center);
                    arc.Radius     = cir.Radius;
                    arc.Startangel = cir.StartAngle;
                    arc.EndAngel   = cir.EndAngle;
                    //  arc.StartPoint = new System.Drawing.PointF((float)cir.StartPoint.X, (float)cir.StartPoint.Y);
                    if (cir.HasStartPoint)
                    {
                        arc.StartPoint = Point2d2Pointf(cir.StartPoint);
                    }
                    //  arc.EndPoint = new System.Drawing.PointF((float)cir.EndPoint.X, (float)cir.EndPoint.Y);
                    if (cir.HasEndPoint)
                    {
                        arc.EndPoint = Point2d2Pointf(cir.EndPoint);
                    }


                    MyPoint spt    = new MyPoint(arc.StartPoint.X, arc.StartPoint.Y);
                    MyPoint ept    = new MyPoint(arc.EndPoint.X, arc.EndPoint.Y);
                    MyPoint center = new MyPoint(arc.Center.X, arc.Center.Y);
                    arc.Color = polylineModel.Color;
                    // arc.pointList = MethodCommand.GetRoationPoint(spt, ept, center, arc.Startangel,arc.EndAngel,cir.IsClockWise);
                    arc.pointList = MethodCommand.GetArcPointsByPoint2d(cir.GetSamplePoints(20));
                    //arc.pointList = MethodCommand.GetArcPoints(arc.Center,arc.Startangel,arc.EndAngel,arc.Radius);
                    //  arc.pointList.Insert(0, arc.StartPoint);
                    //   arc.pointList.Add(arc.EndPoint);
                    polylineModel.Vertices.Add(arc);
                }
                else if (st == SegmentType.Line)
                {
                    LineModel     line   = new LineModel();
                    LineSegment2d lineSe = polyLine.GetLineSegment2dAt(i);
                    if (lineSe.HasStartPoint)
                    {
                        line.StartPoint = Point2d2Pointf(lineSe.StartPoint);
                    }
                    if (lineSe.HasEndPoint)
                    {
                        line.EndPoint = Point2d2Pointf(lineSe.EndPoint);
                    }
                    if (line.StartPoint.X == line.EndPoint.X && line.StartPoint.Y == line.EndPoint.Y)
                    {
                        line.Angle  = 0;
                        line.Length = 0;
                    }
                    else if (line.StartPoint.X == line.EndPoint.X)
                    {
                        line.Angle = 90;
                    }
                    line.Color = polylineModel.Color;
                    polylineModel.Vertices.Add(line);
                }
            }
            //}
            polylineModel.isDashed = GetLayerLineTypeByIDEx(polyLine);
            return(polylineModel);
        }
Example #16
0
        public RoadInfoItemModel GetRoadItemInfo(Polyline line, List <DBText> txtList, List <Polyline> sectionLineList, List <DBText> sectionTextList)
        {
            RoadInfoItemModel item = new RoadInfoItemModel();

            item.RoadLength = line.Length.ToString();
            item.RoadWidth  = line.ConstantWidth.ToString();
            item.RoadType   = "polyline";
            item.ColorIndex = line.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(line.LayerId) : System.Drawing.ColorTranslator.ToHtml(line.Color.ColorValue);
            item.roadList   = PolylineMethod.GetPolyLineInfoPt(line);
            Document doc = Application.DocumentManager.MdiActiveDocument;
            Database db  = doc.Database;

            using (Transaction tran = db.TransactionManager.StartTransaction())
            {
                int vtnum = line.NumberOfVertices;
                for (int i = 0; i < vtnum - 1; i++)
                {
                    foreach (DBText mText in txtList)
                    {
                        if (item.RoadName != null)
                        {
                            break;
                        }
                        Point2d pt = mText.AlignmentPoint.Convert2d(new Plane());



                        if (PolylineMethod.PtInPolyLine(pt, line.GetPoint2dAt(i), line.GetPoint2dAt(i + 1), 20) == 1)
                        {
                            item.RoadName         = mText.TextString.Replace(" ", "").Replace(" ", "");
                            item.RoadNameLocaiton = new List <System.Drawing.PointF>();
                            item.sectionList      = new List <RoadSectionItemModel>();

                            double middleLen  = MethodCommand.DistancePointToPoint(mText.Position, mText.AlignmentPoint);
                            double textLen    = MethodCommand.GetEndLengthByTheorem(middleLen, mText.Height / 2) * 2;
                            double partLength = textLen / item.RoadName.Length;

                            for (int j = 1; j < item.RoadName.Length + 1; j++)
                            {
                                item.RoadNameLocaiton.Add(MethodCommand.GetEndPointByTrigonometricHu(mText.Rotation, MethodCommand.Point3d2Pointf(mText.Position), partLength * j));
                            }

                            item.RoadNameLayer = mText.Layer;
                            item.RoadNameType  = "text";

                            break;
                        }
                    }
                    //获取横截面


                    foreach (Polyline pl in sectionLineList)
                    {
                        for (int j = 0; j < pl.NumberOfVertices; j++)
                        {
                            double dic = MethodCommand.DistancePointToSegment(pl.GetPoint2dAt(j), line.GetPoint2dAt(i), line.GetPoint2dAt(i + 1));
                            if (dic < 60)
                            {
                                RoadSectionItemModel modelsc = new RoadSectionItemModel();
                                modelsc.Line = AutoCad2ModelTools.Polyline2Model(pl);
                                DBText secMtext = MethodCommand.FindMTextIsInPolyineForPipe(pl, sectionTextList);
                                if (secMtext != null)
                                {
                                    modelsc.SectionName = AutoCad2ModelTools.DbText2Model(secMtext);
                                }
                                item.sectionList.Add(modelsc);
                            }
                        }
                    }
                }

                item.isDashed = MethodCommand.GetLayerLineTypeByIDEx(line);

                item.individualName   = "";
                item.individualFactor = "";
                item.individualCode   = "";
                item.individualStage  = "";

                // 增加个体编码、个体要素、个体名称
                System.Data.DataTable tb = Method.AutoGenerateNumMethod.GetAllPolylineNumsEx(line);
                if (tb.Rows != null && tb.Rows.Count > 0)
                {
                    foreach (System.Data.DataRow row in tb.Rows)
                    {
                        if ((string)row["多段线id"] == line.Id.Handle.Value.ToString())
                        {
                            item.individualName   = (string)row["个体名称"];
                            item.individualFactor = (string)row["个体要素"];
                            item.individualCode   = (string)row["个体编码"];
                            item.individualStage  = (string)row["个体阶段"];
                        }
                    }
                }
                return(item);
            }
        }
Example #17
0
        public static HatchModel Hatch2Model(Hatch dbText, AttributeModel atModel)
        {
            HatchModel dbModel = new HatchModel();

            try
            {
                dbModel.Area = dbText.Area;
            }
            catch
            { }

            int    cont  = dbText.NumberOfLoops;
            string color = "";

            for (int i = 0; i < cont; i++)
            {
                dbModel.loopPoints.Add(i, new ColorAndPointItemModel());
                HatchLoop loop = dbText.GetLoopAt(i);

                ColorAndPointItemModel cpModel = new ColorAndPointItemModel();
                if (i == 0)
                {
                    color = cpModel.Color = dbText.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(dbText.LayerId) : System.Drawing.ColorTranslator.ToHtml(dbText.Color.ColorValue);
                }
                else
                {
                    cpModel.Color = "#FFFFFF";
                    //  cpModel.ZIndex = "1";
                }
                if (loop.IsPolyline)
                {
                    for (int j = 0; j < loop.Polyline.Count - 1; j++)
                    {
                        BulgeVertex vertex  = loop.Polyline[j];
                        BulgeVertex vertex1 = loop.Polyline[j + 1];
                        if (vertex.Bulge != 0)
                        {
                            cpModel.loopPoints.AddRange(MethodCommand.GetArcPointsByBulge(vertex.Vertex, vertex1.Vertex, vertex.Bulge));
                        }
                        else
                        {
                            cpModel.loopPoints.Add(Point2d2Pointf(vertex.Vertex));
                        }
                    }


                    if (dbText.NumberOfHatchLines > 0)
                    {
                        Line2dCollection cl = dbText.GetHatchLinesData();
                    } //foreach (Line2d itemi in )
                      //{

                    //}
                }
                else
                {
                    Curve2dCollection col_cur2d = loop.Curves;
                    foreach (Curve2d item in col_cur2d)
                    {
                        Point2d[] M_point2d = item.GetSamplePoints(20);
                        foreach (Point2d point in M_point2d)
                        {
                            cpModel.loopPoints.Add(Point2d2Pointf(point));
                        }
                    }
                }

                if (cpModel.loopPoints[0] != cpModel.loopPoints[cpModel.loopPoints.Count - 1])
                {
                    cpModel.loopPoints.Add(cpModel.loopPoints[0]);
                }
                cpModel.attItemList = new List <AttributeItemModel>();
                foreach (AttributeItemModel item in atModel.attributeItems)
                {
                    string attValue = "";

                    switch (item.AtItemType)
                    {
                    case AttributeItemType.Area:
                        attValue = dbModel.Area.ToString();
                        break;

                    case AttributeItemType.TxtHeight:

                        break;

                    case AttributeItemType.Color:
                        attValue = color;
                        break;

                    case AttributeItemType.Content:

                        break;

                    case AttributeItemType.LayerName:
                        attValue = dbText.Layer;
                        break;

                    case AttributeItemType.LineScale:
                        attValue = dbText.LinetypeScale.ToString();
                        break;

                    case AttributeItemType.LineType:
                        attValue = GetLayerLineTypeByID(dbText);
                        break;

                    case AttributeItemType.Overallwidth:
                        break;

                    case AttributeItemType.TotalArea:
                        attValue = dbModel.Area.ToString();
                        break;
                    }
                    if (!string.IsNullOrEmpty(attValue))
                    {
                        item.AtValue = attValue;
                        cpModel.attItemList.Add(item);
                    }
                    else
                    {
                    }
                }
                dbModel.loopPoints[i] = cpModel;
            }

            for (int i = 0; i < dbModel.loopPoints.Count; i++)
            {
                for (int j = 0; j < dbModel.loopPoints.Count; j++)
                {
                    if (i != j)
                    {
                        if (MethodCommand.PointsAllInPoints(dbModel.loopPoints[j].loopPoints, dbModel.loopPoints[i].loopPoints))
                        {
                            dbModel.loopPoints[j].ZIndex = "2";
                        }
                    }
                }
            }

            //   dbModel.Color =
            return(dbModel);
        }
Example #18
0
        // 获取实体信息
        public void GetEntitiesInfo(ArrayList entities, Transaction trans, BlockTableRecord btr, int numSample, Document doc, Editor ed)
        {
            ArrayList uuid      = new ArrayList();
            ArrayList geom      = new ArrayList(); // 坐标点集合
            ArrayList colorList = new ArrayList(); // 颜色集合
            ArrayList type      = new ArrayList(); // 类型集合

            ArrayList layerName = new ArrayList();
            ArrayList tableName = new ArrayList();                                  // 表名

            System.Data.DataTable attributeList      = new System.Data.DataTable(); // 属性集合
            ArrayList             attributeIndexList = new ArrayList();             //属性索引集合

            ArrayList tuliList  = new ArrayList();                                  //图例集合
            string    projectId = "";                                               //项目ID
            string    chartName = "";                                               //表名称
            ArrayList kgGuide   = new ArrayList();                                  //控规引导

            string    srid         = "";                                            //地理坐标系统编号
            ArrayList parentId     = new ArrayList();                               //配套设施所在地块集合
            ArrayList textContent  = new ArrayList();                               // 文字内容(GIS端展示)
            ArrayList blockContent = new ArrayList();                               // 块内容(GIS端展示)

            Dictionary <string, string> result = new Dictionary <string, string>(); // 汇总

            // 遍历所有实体
            foreach (object entity in entities)
            {
                ArrayList singlePositionList = new ArrayList(); // 单个实体坐标点集合

                //取得边界数
                int loopNum = 1;
                if (entity is Hatch)
                {
                    loopNum = (entity as Hatch).NumberOfLoops;
                    type.Add("polygon");
                }

                Point3dCollection     col_point3d = new Point3dCollection();
                BulgeVertexCollection col_ver     = new BulgeVertexCollection();
                Curve2dCollection     col_cur2d   = new Curve2dCollection();

                for (int i = 0; i < loopNum; i++)
                {
                    col_point3d.Clear();
                    HatchLoop hatLoop = null;
                    if (entity is Hatch)
                    {
                        try
                        {
                            hatLoop = (entity as Hatch).GetLoopAt(i);
                        }
                        catch (System.Exception)
                        {
                            continue;
                        }

                        //如果HatchLoop为PolyLine
                        if (hatLoop.IsPolyline)
                        {
                            col_ver = hatLoop.Polyline;
                            foreach (BulgeVertex vertex in col_ver)
                            {
                                col_point3d.Add(new Point3d(vertex.Vertex.X, vertex.Vertex.Y, 0));
                            }
                        }
                    }

                    // 如果实体为Polyline
                    if (entity is Polyline)
                    {
                        // 类型
                        type.Add("polyline");

                        Polyline polyline = (Polyline)entity;

                        int vn = polyline.NumberOfVertices;
                        for (int w = 0; w < vn; w++)
                        {
                            Point2d pt = polyline.GetPoint2dAt(w);

                            col_point3d.Add(new Point3d(pt.X, pt.Y, 0));
                        }
                    }
                    //// 如果实体为Curve
                    //if (entity is Curve)
                    //{
                    //    col_cur2d = hatLoop.Curves;
                    //    foreach (Curve2d item in col_cur2d)
                    //    {
                    //        Point2d[] M_point2d = item.GetSamplePoints(numSample);
                    //        foreach (Point2d pt in M_point2d)
                    //        {
                    //            if (!col_point3d.Contains(new Point3d(pt.X, pt.Y, 0)))
                    //                col_point3d.Add(new Point3d(pt.X, pt.Y, 0));
                    //        }
                    //    }
                    //}
                    // 如果实体为Point2d
                    if (entity is DBPoint)
                    {
                        type.Add("point");

                        DBPoint entity3 = (DBPoint)entity;
                        col_point3d.Add(new Point3d(entity3.Position.X, entity3.Position.Y, 0));
                    }

                    // 如果实体为Point
                    if (entity is Point3d)
                    {
                        type.Add("point");

                        Point3d entity3 = (Point3d)entity;
                        col_point3d.Add(entity3);
                    }

                    // 如果实体为文字
                    if (entity is MText)
                    {
                        type.Add("text");

                        col_point3d.Add(new Point3d((entity as MText).Location.X, (entity as MText).Location.Y, 0));
                    }

                    // 如果实体为文字
                    if (entity is DBText)
                    {
                        type.Add("text");

                        col_point3d.Add(new Point3d((entity as DBText).Position.X, (entity as DBText).Position.Y, 0));
                    }

                    // 块参照
                    if (entity is BlockReference)
                    {
                        type.Add("block");

                        col_point3d.Add(new Point3d((entity as BlockReference).Position.X, (entity as BlockReference).Position.Y, 0));
                    }

                    double[] pointPositionList = new double[2]; //单个点的坐标点集合
                    // 经纬度转换
                    foreach (Point3d point in col_point3d)
                    {
                        pointPositionList = new double[2] {
                            Transform(point)[0], Transform(point)[1]
                        };
                        singlePositionList.Add(pointPositionList);
                    } // 经纬度转换结束
                }     // 单个实体几何坐标数量循环结束

                // UUID
                Entity entityLayer = (Entity)entity;

                Guid guid = new Guid();
                guid = Guid.NewGuid();
                string str = guid.ToString();
                uuid.Add(str);

                // 坐标
                geom.Add(singlePositionList);

                // 颜色
                if (entity is Point3d)
                {
                    colorList.Add("");
                    // 图层名
                    layerName.Add("无");
                }
                else
                {
                    LayerTableRecord ltr = (LayerTableRecord)trans.GetObject(entityLayer.LayerId, OpenMode.ForRead);

                    string color;
                    color = entityLayer.ColorIndex == 256 ? MethodCommand.GetLayerColorByID(entityLayer.LayerId) : ColorTranslator.ToHtml(entityLayer.Color.ColorValue);

                    colorList.Add(color);
                    // 图层名
                    layerName.Add(ltr.Name);
                }

                // 表名
                tableName.Add("a");

                // 属性索引
                // 获取每个闭合多段线对应的个体编号和用地代号
                ArrayList             tagList = new ArrayList();
                PromptSelectionResult psrss   = ed.SelectCrossingPolygon(col_point3d); // 获取闭合区域内实体方法

                if (psrss.Status == PromptStatus.OK)
                {
                    tagList.Clear();

                    SelectionSet SS      = psrss.Value;
                    ObjectId[]   idArray = SS.GetObjectIds();

                    // 如果读取的块参照数量大于1,取中心点在闭合多段线的块参照
                    if (idArray.Length > 1)
                    {
                        for (int i = 0; i < idArray.Length; i++)
                        {
                            Entity ent1 = (Entity)idArray[i].GetObject(OpenMode.ForRead);
                            if (ent1 is BlockReference)
                            {
                                BlockReference ent2 = (BlockReference)ent1;
                                if (IsInPolygon(ent2.Position, col_point3d))
                                {
                                    foreach (ObjectId rt in ((BlockReference)ent1).AttributeCollection)
                                    {
                                        DBObject           dbObj    = trans.GetObject(rt, OpenMode.ForRead) as DBObject;
                                        AttributeReference acAttRef = dbObj as AttributeReference;

                                        tagList.Add(acAttRef.TextString);

                                        //MessageBox.Show("Tag: " + acAttRef.Tag + "\n" +
                                        //                "Value: " + acAttRef.TextString + "\n");
                                    }
                                }
                            }
                        }
                    }
                    // 如果读取的块参照数量等于1,取中心点在闭合多段线的块参照
                    else
                    {
                        for (int i = 0; i < idArray.Length; i++)
                        {
                            Entity ent1 = (Entity)idArray[i].GetObject(OpenMode.ForRead);
                            if (ent1 is BlockReference)
                            {
                                foreach (ObjectId rt in ((BlockReference)ent1).AttributeCollection)
                                {
                                    DBObject           dbObj    = trans.GetObject(rt, OpenMode.ForRead) as DBObject;
                                    AttributeReference acAttRef = dbObj as AttributeReference;

                                    tagList.Add(acAttRef.TextString);
                                }
                            }
                        }
                    }
                }
                // 如果地块编码属性只有两个属性值,attributeIndexList,如果少于2个或者多于2个都视为异常,添加空。
                if (tagList.Count == 2)
                {
                    attributeIndexList.Add(tagList[0] + "_" + tagList[1]);
                }
                else
                {
                    attributeIndexList.Add("");
                }

                // 属性
                readAttributeList attributeListObj = new readAttributeList();
                attributeList = attributeListObj.AttributeList();

                // 配套设施所属的地块UUID

                // 获取块参照的属性值
                ArrayList blockAttribute = new ArrayList();
                // 是否是地块编码本身
                string isBlockNum = "";

                // 如果这个块标注是幼儿园、公厕等,找对对应的地块编号或UUID
                if (entity is BlockReference)
                {
                    // 清除原有内容
                    blockAttribute.Clear();

                    // 如果entity有两个属性值,可以判断这是一个地块编码
                    if (((BlockReference)entity).AttributeCollection.Count == 2)
                    {
                        isBlockNum = "Block";
                    }

                    // 获取地块界限图层上的所有实体
                    ArrayList polylineEntities = new ArrayList();

                    // 找出地块界限里的所有闭合多段线,并判断当前块标注实体是否在某一个闭合多段线内,如果在,找出该闭合多段线内的块参照个体编号
                    TypedValue[] tvs =
                        new TypedValue[1] {
                        new TypedValue(
                            (int)DxfCode.LayerName,
                            "地块界限"
                            )
                    };

                    SelectionFilter       sf  = new SelectionFilter(tvs);
                    PromptSelectionResult psr = ed.SelectAll(sf);

                    if (psr.Status == PromptStatus.OK)
                    {
                        SelectionSet SS      = psr.Value;
                        ObjectId[]   idArray = SS.GetObjectIds();

                        //MessageBox.Show(idArray.Length.ToString());

                        Point3dCollection polylinePoint3d = new Point3dCollection();

                        for (int j = 0; j < idArray.Length; j++)
                        {
                            // 清除原有内容
                            polylinePoint3d.Clear();

                            Entity ent1 = trans.GetObject(idArray[j], OpenMode.ForWrite) as Entity;
                            if (ent1 is Polyline && (ent1 as Polyline).Closed)
                            {
                                Polyline polyline = (Polyline)ent1;

                                int vn = polyline.NumberOfVertices;
                                for (int w = 0; w < vn; w++)
                                {
                                    Point2d pt = polyline.GetPoint2dAt(w);
                                    polylinePoint3d.Add(new Point3d(pt.X, pt.Y, 0));
                                }

                                // 获取闭合多段线(地块)内的所有实体
                                PromptSelectionResult psrss2 = ed.SelectCrossingPolygon(polylinePoint3d);
                                if (psrss2.Status == PromptStatus.OK)
                                {
                                    SelectionSet SS2      = psrss2.Value;
                                    ObjectId[]   idArray2 = SS2.GetObjectIds();

                                    // 如果读取的块参照数量大于1,且包含当前实体,找出当前块参照所在的闭合多段线
                                    if (idArray2.Length > 1)
                                    {
                                        for (int i = 0; i < idArray2.Length; i++)
                                        {
                                            Entity ent2 = (Entity)idArray2[i].GetObject(OpenMode.ForRead);

                                            // 判断是否是配套设施开始
                                            if (ent2 is BlockReference && (ent2 as BlockReference).Position.X == (entity as BlockReference).Position.X)
                                            {
                                                for (int k = 0; k < idArray2.Length; k++)
                                                {
                                                    Entity ent3 = (Entity)idArray2[k].GetObject(OpenMode.ForRead);
                                                    if (ent3 is BlockReference)
                                                    {
                                                        // 判断块参照中心点是否在闭合多段线内,只读取中心点在闭合多段线内的块参照
                                                        if (IsInPolygon((ent3 as BlockReference).Position, polylinePoint3d))
                                                        {
                                                            foreach (ObjectId rt in ((BlockReference)ent3).AttributeCollection)
                                                            {
                                                                DBObject           dbObj    = trans.GetObject(rt, OpenMode.ForRead) as DBObject;
                                                                AttributeReference acAttRef = dbObj as AttributeReference;

                                                                blockAttribute.Add(acAttRef.TextString);
                                                            }
                                                        }
                                                    }
                                                }
                                            } // 判断是否是配套设施结束
                                        }
                                    }
                                } // 获取闭合多段线(地块)内的所有实体结束
                            }
                        }
                    }
                } // 如果这个块标注是幼儿园、公厕等,找对对应的地块编号或UUID 结束

                // 如果地块编码属性只有两个属性值,而且不是地块编码块参照,添加到parentId,如果少于2个或者多于2个都视为异常,添加空。
                if (blockAttribute.Count == 2 && isBlockNum != "Block")
                {
                    parentId.Add(blockAttribute[0] + "_" + blockAttribute[1]);
                }
                else
                {
                    parentId.Add("");
                }

                // 文字内容(GIS端展示)
                if (entity is DBText)
                {
                    textContent.Add((entity as DBText).TextString);
                }
                else if (entity is MText)
                {
                    textContent.Add((entity as MText).Text);
                }
                else if (entity is BlockReference)
                {
                    List <string> singleBlockContent = new List <string>();
                    string        text = "";

                    if ((entity as BlockReference).AttributeCollection.Count > 0)
                    {
                        foreach (ObjectId rt in ((BlockReference)entity).AttributeCollection)
                        {
                            DBObject           dbObj    = trans.GetObject(rt, OpenMode.ForRead) as DBObject;
                            AttributeReference acAttRef = dbObj as AttributeReference;

                            text = text + acAttRef.TextString + "//";
                        }
                        text = text.Substring(0, text.Length - 2);
                    }

                    textContent.Add(text);
                }
                else
                {
                    textContent.Add("");
                }

                // 块内容(GIS端展示)
                if (entity is BlockReference)
                {
                    List <string> singleBlockContent = new List <string>();
                    string        text = "//";

                    foreach (ObjectId rt in ((BlockReference)entity).AttributeCollection)
                    {
                        DBObject           dbObj    = trans.GetObject(rt, OpenMode.ForRead) as DBObject;
                        AttributeReference acAttRef = dbObj as AttributeReference;

                        text = acAttRef.TextString + text;
                        //singleBlockContent.Add(acAttRef.TextString);
                    }
                    blockContent.Add(text);
                    //blockContent.Add(singleBlockContent);
                }
                else
                {
                    blockContent.Add("");
                }
            } // 所有的实体循环结束

            // 图例
            readAttributeList attributeListObj3 = new readAttributeList();

            //tuliList.Add(attributeListObj3.TuliList());
            tuliList.Add("");

            // 项目名
            //string projectIdBaseAddress = "http://172.18.84.70:8081/PDD/pdd/individual-manage!findAllProject.action";
            //var projectIdHttp = (HttpWebRequest)WebRequest.Create(new Uri(projectIdBaseAddress));

            //var response = projectIdHttp.GetResponse();

            //var stream = response.GetResponseStream();
            //var sr = new StreamReader(stream, Encoding.UTF8);
            //var content = sr.ReadToEnd();

            //MessageBox.Show(content);

            projectId = "D3DEC178-2C05-C5F1-F6D3-45729EB9436A";

            // 图表名或者叫文件名
            chartName = Path.GetFileName(ed.Document.Name);

            // 控规引导
            readAttributeList attributeListObj2 = new readAttributeList();

            kgGuide = attributeListObj2.KgGuide();

            //地理坐标系统编号
            srid = "4326";

            // 发文字信息
            RegulatoryPost.FenTuZe.FenTuZe.SendData(result, uuid, geom, colorList, type, layerName, tableName, attributeIndexList, attributeList, tuliList, projectId, chartName, kgGuide, srid, parentId, textContent, blockContent);
        }