public virtual void ApplySizeTheme(IDataSizeTheme theme) { if (LayerData.GeoType == "1") { for (int i = 0; i < Features.Count; i++) { var feature = LayerData.Features[i]; var shape = Features[feature]; double size = MapControl.Current.GetMagFactor(MapControl.Current.InitialScale) * theme.GetSize(feature); ElementPositionHelper.CenterElementInCanvas(shape, size, size); } } else if (LayerData.GeoType == "2") { // done: 流量图 for (int i = 0; i < Features.Count; i++) { var feature = LayerData.Features[i]; var shape = Features[feature]; double size = theme.GetSize(feature); (shape as Polyline).StrokeThickness = size; } } _hasSizeTheme = true; _sizeTheme = theme; }
public virtual void SetMagFactor(double magFactor) { if (this.LayerData.GeoType == "1" && !_hasSizeTheme) { foreach (Ellipse ep in this.Features.Values) { double size = this.LayerStyle.SpotSize * magFactor; ep.StrokeThickness = this.LayerStyle.StrokeWeight * magFactor; ElementPositionHelper.CenterElementInCanvas(ep, size, size); } } else if (this.LayerData.GeoType == "2" && !IsRoad()) { if (_hasSizeTheme) { foreach (var feature in this.Features) { feature.Value.StrokeThickness = _sizeTheme.GetSize(feature.Key) * magFactor; } } else { foreach (var poly in this.Features.Values) { poly.StrokeThickness = this.LayerStyle.StrokeWeight * magFactor; } } } else if (this.LayerData.GeoType == "4") { foreach (Polygon poly in this.Features.Values) { poly.StrokeThickness = this.LayerStyle.StrokeWeight * magFactor; } } }
public override void ApplySizeTheme(IDataSizeTheme theme) { if (LayerData.GeoType == "1") { for (int i = 0; i < Features.Count; i++) { var feature = LayerData.Features[i]; var drawing = Features[feature]; var geometry = drawing.Geometry as EllipseGeometry; if (geometry != null) { double radius = MapControl.Current.GetMagFactor(MapControl.Current.InitialScale) * theme.GetSize(feature) / 2; geometry.RadiusX = radius; geometry.RadiusY = radius; } } } else if (LayerData.GeoType == "2") { // done: 流量图 for (int i = 0; i < Features.Count; i++) { var feature = LayerData.Features[i]; var drawing = Features[feature]; double weight = MapControl.Current.GetMagFactor(MapControl.Current.InitialScale) * theme.GetSize(feature); drawing.Pen.Thickness = weight; } } _hasSizeTheme = true; }