本文整理匯總了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");
}
}