Exemple #1
0
        /// <summary>
        ///     根据坐标绘制导线点
        /// </summary>
        /// <params name="lstWpie">导线坐标(List)</params>
        /// <params name="addOrChange"></params>
        private void DrawWirePoint(List <WirePoint> lstWpie, string addOrChange)
        {
            IPoint pt = new Point();

            //找到导线点图层
            var          map          = DataEditCommon.g_pMap;
            const string layerName    = LayerNames.DEFALUT_WIRE_PT; //“导线点”图层
            var          featureLayer = LayerHelper.GetLayerByName(map, layerName);

            if (featureLayer == null)
            {
                MessageBox.Show(@"没有找到" + layerName + @"图层,将不能绘制导线点。", @"提示", MessageBoxButtons.OK);
                return;
            }

            var drawWirePt = new DrawTunnels();

            //修改导线点操作,要先删除原有导线点要素
            if (addOrChange == "CHANGE")
            {
                foreach (var t in lstWpie)
                {
                    var wirePtInfo = t;
                    DataEditCommon.DeleteFeatureByBId(featureLayer, wirePtInfo.bid);
                }
            }

            foreach (var t in lstWpie)
            {
                pt.X = t.coordinate_x;
                pt.Y = t.coordinate_y;
                pt.Z = t.coordinate_z;
                drawWirePt.CreatePoint(featureLayer, pt, t.bid, t);
            }
        }
Exemple #2
0
        private bool RedrawHengChuanPolygon(TunnelHChuan entity)
        {
            //找到导线点图层
            IMap map = new MapClass();

            map = DataEditCommon.g_pMap;
            var           layerName    = LayerNames.DEFALUT_HENGCHUAN; //“默认_导线点”图层
            IFeatureLayer featureLayer = new FeatureLayerClass();

            featureLayer = LayerHelper.GetLayerByName(map, layerName); //获得图层

            if (featureLayer == null)
            {
                MessageBox.Show("没有找到" + layerName + "图层,将不能绘制导线点。", "提示", MessageBoxButtons.OK);
                return(false);
            }

            var point1 = new PointClass {
                X = entity.X1, Y = entity.Y1, Z = entity.Z1, ZAware = true
            };
            var point2 = new PointClass {
                X = entity.X2, Y = entity.Y2, Z = entity.Z2, ZAware = true
            };
            var line = new LineClass {
                FromPoint = point1, ToPoint = point2
            };
            var polygon = new PolygonClass {
                ZAware = true
            };
            var width = entity.Width / 2;

            polygon.AddPoint(ConstructPoint(point2, line.Angle / Deg2Rad + 90, width));
            polygon.AddPoint(ConstructPoint(point2, line.Angle / Deg2Rad - 90, width));
            polygon.AddPoint(ConstructPoint(point1, line.Angle / Deg2Rad + 180 + 90, width));
            polygon.AddPoint(ConstructPoint(point1, line.Angle / Deg2Rad + 180 - 90, width));
            polygon.SimplifyPreserveFromTo();

            var list = new List <ziduan>
            {
                new ziduan("BID", entity.Id.ToString()),
                new ziduan("BID0", entity.TunnelId1.ToString()),
                new ziduan("BID1", entity.TunnelId2.ToString()),
                new ziduan("NAME", entity.NameHChuan)
            };

            var feature = DataEditCommon.ModifyFeature(featureLayer, entity.Id, polygon, list);

            return(feature != null);
        }