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


C# Plane.AddPosition方法代码示例

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


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

示例1: TestPlaneToJson

    public static void TestPlaneToJson()
    {
        //The one thing we want to check
        //  -a valid plane object converts to a valid JSON object
        //We could do some tests here as far as malformed/invalid objects, but that ObjectTests should probably be ensuring we are getting a proper object

        //make some planes
        Plane plane1 = new Plane("abcd", new PlaneAttributes("abcd", 2, 45, 20, 100, 19000)); //valid plane object
        Plane plane2 = new Plane("DEF328", new PlaneAttributes("483CBA50", 1, 35, 15, 50, 12000));  //valid plane object

        //Give them a current position - AddPosition(GPSData data)
        GPSData gps1 = new GPSData (-90, 90, 20000, 232050);
        GPSData gps2 = new GPSData (-45, 45, 15000, 190000);
        plane1.AddPosition(gps1);
        plane2.AddPosition(gps2);

        //convert the objects to JSON
        string jsonPlane1 = plane1.ToJson();
        string jsonPlane2 = plane2.ToJson();

        JsonObject correctJSONObject1 = (JsonObject)Json.Parse(createCorrectDataSet());
        JsonObject correctJSONObject2 = (JsonObject)Json.Parse(createCorrectDataSet2());

        //test them
        jsonPlane1.ShouldBe(correctJSONObject1.PrettyPrint());
        jsonPlane2.ShouldBe(correctJSONObject2.PrettyPrint());
    }
开发者ID:2015SoftwarePrinciples,项目名称:GTKTestWindow,代码行数:27,代码来源:OutputTests.cs

示例2: createTestSet

    //Method for Initializing an array of planes for testing
    public static Plane[][] createTestSet()
    {
        //TBD: Add some plane data for 'successful' collisions tests here
        //The test data needs to be pretty precise (down to the .001 lat/long and a number of entries over a few seconds)
        PlaneAttributes atts = new PlaneAttributes("default", 1, 150, 150, 150, 3000);
        long zeroTime = 0x7000000010000000;
        double denverLat = 39.7392;
        double denverLong = 104.9903;

        double sydneyLat = -33.8830555556;
        double sydneyLong = 151.216666667;

        double moscowLat = 55.7522222;
        double moscowLong = 37.6155556;

        //head on collision
        Plane a = new Plane("a", atts);
        Plane aa = new Plane("aa", atts);

        for (int i = 0; i < 100; i++) {
            a.AddPosition(new GPSData(denverLat, denverLong + .0223 - i * .0001, 2000, zeroTime + 1000 * i));
            aa.AddPosition(new GPSData(denverLat, denverLong - .0223 + i * .0001, 2000, zeroTime + 1000 * i));
        }

        Console.WriteLine(a.GetPosition() + " : " +  a.GetVelocity());
        Console.WriteLine(aa.GetPosition() + " : " +  aa.GetVelocity());

        //right angle collision
        Plane b = new Plane("b", atts);
        Plane bb = new Plane("bb", atts);

        for (int i = 0; i < 100; i++) {
            b.AddPosition(new GPSData(sydneyLat - .0223 + i * .0001, sydneyLong, 2000, zeroTime + 1000 * i));
            bb.AddPosition(new GPSData(sydneyLat, sydneyLong - .0223 + i * .0001, 2000, zeroTime + 1000 * i));
        }

        //Collision from behind
        Plane c = new Plane("c", atts);
        Plane cc = new Plane("cc", atts);

        for (int i = 0; i < 100; i++) {
            c.AddPosition(new GPSData(moscowLat, moscowLong - .0200 + i * .0002, 2000, zeroTime + 1000 * i));
            cc.AddPosition(new GPSData(moscowLat, moscowLong - .0400 + i * .00035, 2000, zeroTime + 1000 * i));
        }

        Plane[][] planeArray = new Plane[][] {
            new Plane[] { a, aa },
            new Plane[] { b, bb },
            new Plane[] { c, cc }
        };

        return planeArray;
    }
开发者ID:2015SoftwarePrinciples,项目名称:GTKTestWindow,代码行数:54,代码来源:CollisionTests.cs

示例3: createFailTestSet

    //Method for initializing an array of planes for fail tests
    private static Plane[][] createFailTestSet()
    {
        //Add some plane data for fail tests here
        //The test data needs to be pretty precise (down to the .001 lat/long and a number of entries over a few seconds)
        PlaneAttributes atts = new PlaneAttributes("default", 1, 150, 150, 150, 3000);
        long zeroTime = 0x7000000010000000;
        double denverLat = 39.7392;
        double denverLong = 104.9903;

        Plane a = new Plane("a", atts);
        Plane aa = new Plane("aa", atts);
        Plane b = new Plane("b", atts);
        Plane bb = new Plane("bb", atts);
        Plane c = new Plane("c", atts);
        Plane cc = new Plane("cc", atts);

        for (int i = 0; i < 100; i++) {
            //Running somewhat parralel on different latitudes
            a.AddPosition(new GPSData(denverLat+.0050, denverLong + .0223 + i * .0001, 2000, zeroTime + 1000 * i));
            aa.AddPosition(new GPSData(denverLat, denverLong + .0213 + i * .0001, 2000, zeroTime + 1000 * i));

            //Running parralel on same latitude and different altitudes
            b.AddPosition(new GPSData(denverLat, denverLong + .0223 + i * .0001, 2500, zeroTime + 1000 * i));
            bb.AddPosition(new GPSData(denverLat, denverLong + .0223 + i * .0001, 2000, zeroTime + 1000 * i));

            //cross at different times
            c.AddPosition(new GPSData(denverLat + i * .0001, denverLong + .0213 + i * .0001, 2500, zeroTime + 1000 * i));
            cc.AddPosition(new GPSData(denverLat + i * .0001, denverLong + .0223 - i * .0001, 2000, zeroTime + 1000 * i));
        }

        Plane[][] failPlaneArray = new Plane[][] {
            new Plane[] { a, aa },
            new Plane[] { b, bb },
            new Plane[] { c, cc }
        };

        return failPlaneArray;
    }
开发者ID:2015SoftwarePrinciples,项目名称:GTKTestWindow,代码行数:39,代码来源:CollisionTests.cs


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