public static Marker CreateMarker(GraphicsLayer graLayer, Feature feature, UGCLayer layer, Recordset recordset, MarkerType type) { Marker marker = new Marker( feature.Id.ToString() + "@" + layer.DatasetInfo.Name + "@" + layer.DatasetInfo.DataSourceName + "@" + "0", feature.Geometry.Points[0], type, new SuperMap.Connector.Control.Forms.ToolTip(feature.Id.ToString(), new Draw.Font(Draw.FontFamily.Families.First(c => c.Name == "微软雅黑"), 12), Draw.StringFormat.GenericDefault, Draw.Color.White, Draw.Color.Black, Draw.Color.Black, 1)); Dictionary<string, string> property = new Dictionary<string, string>(); property[PropertyName.LayerName] = recordset.DatasetName; property[PropertyName.GraphicsLayerID] = graLayer.ID; property[PropertyName.SMID] = feature.Id.ToString(); marker.Tag = property; graLayer.Markers.Add(marker); return marker; }
public static List<Polygon> CreatePolygon(GraphicsLayer graLayer, Feature feature, UGCLayer layer, Recordset recordset, Draw.Color fillColor, Draw.Color strokeColor) { int index = 0; List<Polygon> list = new List<Polygon>(); int all = feature.Geometry.Parts.Sum(); for (int i = 0; i < feature.Geometry.Parts.Length; i++) { Point2D[] points = feature.Geometry.Points.Skip(index).Take(feature.Geometry.Parts[i]).ToArray(); Polygon polygon = new Polygon(feature.Id.ToString() + "@" + layer.DatasetInfo.Name + "@" + layer.DatasetInfo.DataSourceName + "@" + i.ToString(), points.ToList(), fillColor, strokeColor, 1); Dictionary<string, string> property = new Dictionary<string, string>(); property[PropertyName.LayerName] = recordset.DatasetName; property[PropertyName.GraphicsLayerID] = graLayer.ID; property[PropertyName.SMID] = feature.Id.ToString(); polygon.Tag = property; graLayer.Polygons.Add(polygon); list.Add(polygon); index += feature.Geometry.Parts[i]; } return list; }
public static Line CreateLine(GraphicsLayer graLayer, Feature feature, UGCLayer layer, Recordset recordset, Draw.Color color) { Line line = new Line(feature.Id.ToString() + "@" + layer.DatasetInfo.Name + "@" + layer.DatasetInfo.DataSourceName + "@" + "0", feature.Geometry.Points.ToList(), 2.0, color); Dictionary<string, string> property = new Dictionary<string, string>(); property[PropertyName.LayerName] = recordset.DatasetName; property[PropertyName.GraphicsLayerID] = graLayer.ID; property[PropertyName.SMID] = feature.Id.ToString(); line.Tag = property; graLayer.Lines.Add(line); return line; }