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


C# Line.MoveOnLineFromBaseForUnits方法代码示例

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


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

示例1: GPSFromPercentilePosition

        public static Coordinate GPSFromPercentilePosition(this Map This, Point pos)
        {
            double percX = pos.X;
            double percY = pos.Y;
            Point A = new Point(This.NWLong, This.NWLat);
            Point B = new Point(This.NELong, This.NELat);
            Point C = new Point(This.SELong, This.SELat);
            Point D = new Point(This.SWLong, This.SWLat);
            Line AB = new Line(A, new Vector(A, B));
            Line DC = new Line(D, new Vector(D, C));
            Line AD = new Line(A, new Vector(A, D));
            Line BC = new Line(B, new Vector(B, C));

            Point X0 = AB.MoveOnLineFromBaseForUnits(percX);
            Point X1 = DC.MoveOnLineFromBaseForUnits(percX);
            Point Y0 = AD.MoveOnLineFromBaseForUnits(percY);
            Point Y1 = BC.MoveOnLineFromBaseForUnits(percY);

            Line X0X1 = new Line(X0, new Vector(X0, X1));
            Line Y0Y1 = new Line(Y0, new Vector(Y0, Y1));

            Point? p = Line.Intersection(X0X1, Y0Y1);

            if (p != null)
            {
                Coordinate gps = new Coordinate();
                gps.Longitude = p.Value.X;
                gps.Latitude = p.Value.Y;
                gps.Altitude = double.NaN;
                return gps;
            }
            else
            {
                throw new ArithmeticException("Lines do not cross. Mapdata are corrupted");
            }
        }
开发者ID:rollingthunder,项目名称:DiversityMobile,代码行数:36,代码来源:MapProjection.cs


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