public AreaPoints GetPoints(string areaId) { TEntity area = GetEntity(areaId); AreaPoints points = new AreaPoints(area); return(points); }
public AreaPoints GetPoints(string areaId) { try { TEntity area = GetEntity(areaId); AreaPoints points = new AreaPoints(area); return(points); } catch (System.Exception ex) { Log.Error(tag, "GetPoints", ex.ToString()); return(null); } }
private void RecalculateCenter(AreaPoints areaPoints) { var recalculatedCenter = areaPoints.GetRecalculatedCenter(); if (!areaPoints.CompareCore(recalculatedCenter)) { areaPoints.ChangeCore(recalculatedCenter); lock (_lock) { _isRecalculateNecessary = true; } } }
public List <AreaPoints> GetPointsByPid(string pid) { var areas = GetListByPid(pid); if (areas == null) { return(null); } List <AreaPoints> list = new List <AreaPoints>(); for (int i = 0; i < areas.Count; i++) { TEntity area = areas[i]; AreaPoints points = new AreaPoints(area); list.Add(points); } return(list); }
private PointDistance GetMaxPointDistance(AreaPoints areaPoints) { var maxPoint = new PointDistance(); Parallel.ForEach(areaPoints.GetPoints(), point => { var distance = areaPoints.GetDistanceToCenter(point); if (distance > maxPoint.Distance) { maxPoint = new PointDistance { Distance = distance, Point = point }; } }); return(maxPoint); }
public List <AreaPoints> GetPointsByPid(string pid) { try { var areas = GetListByPid(pid); if (areas == null) { return(null); } List <AreaPoints> list = new List <AreaPoints>(); for (int i = 0; i < areas.Count; i++) { TEntity area = areas[i]; AreaPoints points = new AreaPoints(area); list.Add(points); } return(list); } catch (System.Exception ex) { Log.Error(tag, "GetPointsByPid", ex.ToString()); return(null); } }
public static void DrawClass(this DrawingGroup drawingGroup, int colorNumber, AreaPoints areaPoints) { var ellipses = new GeometryGroup(); foreach (var point in areaPoints.GetPoints()) { var pointSize = areaPoints.CompareCore(point) ? 4 : 1; ellipses.Children.Add(new EllipseGeometry(point, pointSize, pointSize)); } var classColor = colorNumber.GetColor(); var brush = new SolidColorBrush(classColor); var geometryDrawing = new GeometryDrawing(brush, new Pen(brush, 1), ellipses) { Geometry = ellipses }; drawingGroup.Children.Add(geometryDrawing); }
/// <summary> /// Generates the datas. /// </summary> override public void GenerateDatas() { AreaPoints.Clear(); if (!IsPointsGenerated) { Parts.Clear(); } Point endPoint; Point startPoint = new Point(0, 0); int index = 0; if (this.Points != null && this.SeriesContainer != null && this.Points.Count > 1) { CalculateMinAndMax(); ChartPoint oldPoint = new ChartPoint() { XValue = double.MinValue, YValue = double.MinValue }; IntializePoints(); AreaPoints.Add(startPoint); foreach (ChartPoint point in this.Points) { if (CheckValuePoint(oldPoint, point)) { Point linePoint = NormalizePoint(new Point(point.XValue, point.YValue)); if (index == 0) { linePoint.X = linePoint.X - this.StrokeThickness; } AreaPoints.Add(linePoint); } } if (this.RenderingMode == RenderingMode.Default) { if (!IsPointsGenerated) { for (int i = 0; i < AreaPoints.Count - 2; i++) { startPoint = NormalizePoint(new Point(this.Points[i].XValue, YMin)); endPoint = NormalizePoint(new Point(this.Points[i + 1].XValue, YMin)); AreaPart areaPart = new AreaPart(AreaPoints[i + 1], startPoint, endPoint, AreaPoints[i + 2]); SetBindingForStrokeandStrokeThickness(areaPart); this.Parts.Add(areaPart); } IsPointsGenerated = true; } else { int i = 0; foreach (AreaPart part in this.Parts) { startPoint = NormalizePoint(new Point(this.Points[i].XValue, YMin)); endPoint = NormalizePoint(new Point(this.Points[i + 1].XValue, YMin)); part.StartPoint = AreaPoints[i + 1]; part.AreaStartPoint = startPoint; part.AreaEndPoint = endPoint; part.EndPoint = AreaPoints[i + 2]; part.Refresh(); i++; } } } endPoint = NormalizePoint(new Point(this.Points[this.Points.Count - 1].XValue, YMin)); startPoint = NormalizePoint(new Point(this.Points[0].XValue, YMin)); startPoint.X = startPoint.X - this.StrokeThickness; if (AreaPoints.Count > 0) { AreaPoints[0] = startPoint; AreaPoints.Add(endPoint); } } else { Parts.Clear(); } if (this.SeriesContainer != null) { this.SeriesContainer.Invalidate(); } IsRefreshed = false; }