/// <summary> /// 向当前编辑的图层中添加一个几何对象 /// </summary> public void AddGeometry(WEGeometry newGeo) { if (CurrentEdit == -1) { Console.WriteLine("非编辑状态"); throw new Exception("非编辑状态"); } WEFeature newFea = new WEFeature(); WEVectorLayer _lay = (WEVectorLayer)(AllLayer[CurrentEdit]); int id = _lay.Features.Count(); switch (AllLayer[CurrentEdit].FeatureType) { case FeatureType.WEEntityPoint: newFea = new WEEntityPoint(id, newGeo, _lay.Field); break; case FeatureType.WEEntityPolyline: newFea = new WEEntityPolyline(id, (WEMultiPolyline)newGeo, _lay.Field); break; case FeatureType.WEEntityPolygon: newFea = new WEEntityPolygon(id, (WEMultiPolygon)newGeo, _lay.Field); break; } _lay.AddFeature(newFea); AllLayer[CurrentEdit] = _lay; }
/// <summary> /// 在多线序列末尾增加一条线 /// </summary> /// <param name="polyline"></param> public override void Add(WEGeometry polyline) { if (polyline.FeatureType != FeatureType.WEPolyline) { throw new Exception("不能给 WEMultiPolyline 添加 WEPolyline 以外的元素."); } _Polylines.Add(polyline); _MBR += polyline.MBR; }
/// <summary> /// 增加一个点 /// </summary> /// <param name="point"></param> public override void Add(WEGeometry point) { if (point.FeatureType != FeatureType.WEPoint) { throw new Exception("不能给 WEMultiPoint 添加 WEPoint 以外的元素."); } _Points.Add((WEPoint)point); _MBR += point.MBR; }
/// <summary> /// 在复合多边形序列末尾增加一个简单多边形边界 /// </summary> /// <param name="polygon"></param> public override void Add(WEGeometry polygon) { if (polygon.FeatureType != FeatureType.WEPolygon) { throw new Exception("不能给 WEMultiPolygon 添加 WEPolygon 以外的元素."); } _Polygons.Add(polygon); _MBR += polygon.MBR; }
public WEEntityPoint(int id, WEGeometry points, Dictionary <string, object> attributes) { _FeatureType = FeatureType.WEEntityPoint; _ID = id; _Geometries = points.Clone(); foreach (var i in attributes) { _Attributes.Add(i.Key, i.Value); } }
public WEFeature(int id, WEGeometry fea, Dictionary <string, object> attributes) { _FeatureType = FeatureType.WENULL; _ID = id; _Geometries = fea; foreach (var i in attributes) { _Attributes.Add(i.Key, i.Value); } }
public virtual void Add(WEGeometry newGeo) { }
public override void Add(WEGeometry newGeo) { _Points.Add((WEPoint)newGeo); _MBR += newGeo.MBR; }