예제 #1
0
        public AreaPoints GetPoints(string areaId)
        {
            TEntity    area   = GetEntity(areaId);
            AreaPoints points = new AreaPoints(area);

            return(points);
        }
예제 #2
0
 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);
     }
 }
예제 #3
0
        private void RecalculateCenter(AreaPoints areaPoints)
        {
            var recalculatedCenter = areaPoints.GetRecalculatedCenter();

            if (!areaPoints.CompareCore(recalculatedCenter))
            {
                areaPoints.ChangeCore(recalculatedCenter);

                lock (_lock)
                {
                    _isRecalculateNecessary = true;
                }
            }
        }
예제 #4
0
        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);
        }
예제 #5
0
        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);
        }
예제 #6
0
 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);
     }
 }
예제 #7
0
        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);
        }
예제 #8
0
        /// <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;
        }