当前位置: 首页>>代码示例>>C#>>正文


C# Line.Count方法代码示例

本文整理汇总了C#中Line.Count方法的典型用法代码示例。如果您正苦于以下问题:C# Line.Count方法的具体用法?C# Line.Count怎么用?C# Line.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Line的用法示例。


在下文中一共展示了Line.Count方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: shouldInitializeLabelsAndAddHistoryValuesWhenAddingFirstHisoryValue

        public void shouldInitializeLabelsAndAddHistoryValuesWhenAddingFirstHisoryValue()
        {
            Line line = new Line(new Dictionary<DateTime, decimal> {{ DateTime.Now, 123  }} );
            Graph graph = new Graph(line);

            Assert.That(graph.Labels, Is.Not.Null);
            Assert.That(graph.Labels.Length, Is.EqualTo(line.Count()));

            Assert.That(graph.LinesContainer.Lines.Count(), Is.EqualTo(1));
            Assert.That(graph.LinesContainer.Lines[0].Count(), Is.EqualTo(line.Count()));
        }
开发者ID:yodiz,项目名称:CarbonFitness,代码行数:11,代码来源:HistoryValuesContainerTest.cs

示例2: shouldHaveIndex

        public void shouldHaveIndex()
        {
            var historyValuesDictonary = new Dictionary<DateTime, decimal>();
            historyValuesDictonary.Add(DateTime.Now.AddDays(-1), 123);
            historyValuesDictonary.Add(DateTime.Now.AddDays(-0), 123);
            historyValuesDictonary.Add(DateTime.Now.AddDays(1), 1234);

            var historyValues = new Line(historyValuesDictonary);
            Assert.That(historyValues.Count(), Is.EqualTo(3));
            var count = 0;
            foreach (var item in historyValues) {
                Assert.That(item.Index, Is.EqualTo(count));
                count++;
            }
        }
开发者ID:yodiz,项目名称:CarbonFitness,代码行数:15,代码来源:LineTest.cs

示例3: ToPoints

        //static Point[] ToPoints(Line[] lines)
        //Converts an array of Lines to an array of Points.
        public static Point[] ToPoints(Line[] lines)
        {
            Point[] points = new Point[lines.Count() * 2];

            for (int l = 0; l < lines.Count(); l++)
            {
                int index = l * 2;

                points[index]     = lines[l].start;
                points[index + 1] = lines[l].end;
            }

            return points;
        }
开发者ID:kjinks,项目名称:SVGWrapper,代码行数:16,代码来源:Geometry.cs

示例4: TestLine

        //static void TestLine()
        //Tests every method and accessor of the Line() class using the precribed
        //float testData[]; marked down below down below.
        public static void TestLine()
        {
            //TEST DATA----------------!
            float[] testData = new float[] { -2.0f, (float)Math.Sqrt(2.0), 1.0f, 0.333f, -0.0f, 22.0f, 1000.0001f, };

            Console.WriteLine("\nTesting Line class...\n");

            float  angleStep = (float)Math.PI / testData.Count();

            int     numLines = testData.Count();

            Line[] lines = new Line[numLines];

            for (int t = 0; t < testData.Count(); t++)
            {
                Console.WriteLine("\nTest {0}\n", t + 1);

                int indexA = (t * 2) % testData.Count();
                int indexB = ((t * 2) + 1) % testData.Count();
                int indexC = ((t * 2) + 2) % testData.Count();
                int indexD = ((t * 2) + 3) % testData.Count();

                float valueA = testData[indexA];
                float valueB = testData[indexB];
                float valueC = testData[indexC];
                float valueD = testData[indexD];

                //Line paraA = lines[indexA] + lines[indexD];

                Point p1 = new Point(valueA, valueB);
                Point p2 = new Point(valueC, valueD);

                Line l = new Line(p1, p2);

                lines[t] = l;

                Console.WriteLine("Testing with values {0}, {1}, {2}", valueA, valueB, valueC);
                Console.WriteLine("ToString() : " + l.ToString());
                Console.WriteLine("Length     : {0}", l.Length);
                Console.WriteLine("Midpoint   : {0}", l.Midpoint);
                Console.WriteLine("Delta      : {0}", l.Delta);

                float angle = angleStep * t;

                Polar polar = new Polar(angle, 10.0f);

                l.Polar = new Polar(angle, 10.0f);

                Console.WriteLine("SetPolar   : Angle:{0}, Radius:{1} -> Result: {2}", polar.angle, polar.radius, l);

                polar = l.Polar;

                Console.WriteLine("GetPolar   : Angle:{0}, Radius:{1}", polar.angle, polar.radius);
            }

            Console.WriteLine("\nTesting IsParallel method...\n");

            for (int l = 0; l < lines.Count(); l++)
            {
                Console.WriteLine("Is ({0}) parallel with ({1}) ?", lines[0], lines[l]);

                if (lines[0].IsParallel(lines[l]))
                {
                    Console.WriteLine("They are parallel.");
                }
                else
                {
                    Console.WriteLine("They are not parallel.");
                }
            }

            Console.WriteLine("\nTesting ToPoints method...\n");

            Point[] points = Line.ToPoints(lines);

            Console.WriteLine("Lines:");

            for (int l = 0; l < lines.Count(); l++)
            {
                Console.Write(lines[l].ToString() + " | ");
            }

            Console.WriteLine("\nPoints:");

            for (int p = 0; p < points.Count(); p++)
            {
                Console.Write(points[p].ToString() + " | ");
            }
        }
开发者ID:kjinks,项目名称:SVGWrapper,代码行数:92,代码来源:Geometry_Test.cs


注:本文中的Line.Count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。