本文整理汇总了C#中GPoint.Offset方法的典型用法代码示例。如果您正苦于以下问题:C# GPoint.Offset方法的具体用法?C# GPoint.Offset怎么用?C# GPoint.Offset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GPoint
的用法示例。
在下文中一共展示了GPoint.Offset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GoToCurrentPositionOnZoom
/// <summary>
/// moves current position into map center
/// </summary>
internal void GoToCurrentPositionOnZoom()
{
compensationOffset = positionPixel; // TODO: fix
// reset stuff
renderOffset = GPoint.Empty;
dragPoint = GPoint.Empty;
// goto location and centering
if(MouseWheelZooming)
{
if(MouseWheelZoomType != MouseWheelZoomType.MousePositionWithoutCenter)
{
GPoint pt = new GPoint(-(positionPixel.X - Width / 2), -(positionPixel.Y - Height / 2));
pt.Offset(compensationOffset);
renderOffset.X = pt.X - dragPoint.X;
renderOffset.Y = pt.Y - dragPoint.Y;
}
else // without centering
{
renderOffset.X = -positionPixel.X - dragPoint.X;
renderOffset.Y = -positionPixel.Y - dragPoint.Y;
renderOffset.Offset(mouseLastZoom);
renderOffset.Offset(compensationOffset);
}
}
else // use current map center
{
mouseLastZoom = GPoint.Empty;
GPoint pt = new GPoint(-(positionPixel.X - Width / 2), -(positionPixel.Y - Height / 2));
pt.Offset(compensationOffset);
renderOffset.X = pt.X - dragPoint.X;
renderOffset.Y = pt.Y - dragPoint.Y;
}
UpdateCenterTileXYLocation();
}
示例2: FromLocalToLatLng
/// <summary>
/// gets lat/lng from local control coordinates
/// </summary>
/// <param name="x"></param>
/// <param name="y"></param>
/// <returns></returns>
public PointLatLng FromLocalToLatLng(long x, long y)
{
GPoint p = new GPoint(x, y);
p.OffsetNegative(renderOffset);
p.Offset(compensationOffset);
return Provider.Projection.FromPixelToLatLng(p, Zoom);
}