示例#1
0
        public object GetGeometry(PointNS[] points, PointNS[] previousPoints)
        {
            var arr  = ConvertToStepPoints(points);
            var arr2 = ConvertToStepPoints(previousPoints);

            return(PolyLineGeometryBuilder.CreateGeometry(arr, arr2));
        }
示例#2
0
        public object GetGeometry(PointNS[] points, PointNS[] previousPoints)
        {
            if (points.Length < 2)
            {
                return(PolyLineGeometryBuilder.CreateGeometry(points, previousPoints));
            }

            var             curvePoints  = CreateCurvePoints(points, this.Tension);
            PointCollection curvePoints2 = null;

            if (previousPoints != null)
            {
                if (previousPoints.Length < 2)
                {
                    throw new MvvmChartUnexpectedTypeException($"GetGeometry: previousPoints.Length={previousPoints.Length < 2}");
                }

                if (previousPoints.Length == 2)
                {
                    curvePoints2 = new PointCollection();
                    for (int i = 0; i < previousPoints.Length; i++)
                    {
                        curvePoints2.Add(previousPoints[previousPoints.Length - 1 - i].ToPoint());
                    }
                }
                else
                {
                    curvePoints2 = CreateCurvePoints(previousPoints, this.Tension);
                }
            }

            var figure       = CreateSpline(curvePoints, curvePoints2);
            var pathGeometry = new PathGeometry();

            pathGeometry.Figures.Add(figure);
            figure.IsClosed = previousPoints != null;
            figure.Freeze();

            return(pathGeometry);
        }