本文整理汇总了C#中IProjection.ToPixel方法的典型用法代码示例。如果您正苦于以下问题:C# IProjection.ToPixel方法的具体用法?C# IProjection.ToPixel怎么用?C# IProjection.ToPixel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProjection
的用法示例。
在下文中一共展示了IProjection.ToPixel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetLayout
/// <summary>
/// Sets the layout.
/// </summary>
/// <param name="pixelsWidth">Pixels width.</param>
/// <param name="pixelsHeight">Pixels height.</param>
/// <param name="view">View.</param>
/// <param name="projection">Projection.</param>
internal bool SetLayout(double pixelsWidth, double pixelsHeight, View2D view, IProjection projection)
{
double[] projected = projection.ToPixel (this.Location);
double[] locationPixel = view.ToViewPort (pixelsWidth, pixelsHeight, projected [0], projected [1]);
// if (locationPixel [0] > 0 && locationPixel [0] < pixelsWidth &&
// locationPixel [1] > 0 && locationPixel [1] < pixelsHeight) {
// set the new location depending on the size of the image and the alignment parameter.
double leftMargin = locationPixel [0];// - this.Bitmap.Size.Width / 2.0;
double topMargin = locationPixel [1];
switch (_alignment) {
case MapMarkerAlignmentType.CenterTop:
topMargin = locationPixel [1] + this.Image.Size.Height / 2.0;
break;
case MapMarkerAlignmentType.CenterBottom:
topMargin = locationPixel [1] - this.Image.Size.Height / 2.0;
break;
}
this.Center = new System.Drawing.PointF ((float)leftMargin, (float)topMargin);
return true;
// }
// return false;
}
示例2: SetLayout
/// <summary>
/// Sets the layout.
/// </summary>
/// <param name="pixelsWidth">Pixels width.</param>
/// <param name="pixelsHeight">Pixels height.</param>
/// <param name="view">View.</param>
/// <param name="projection">Projection.</param>
internal bool SetLayout(double pixelsWidth, double pixelsHeight, View2D view, IProjection projection)
{
double[] projected = projection.ToPixel (this.Location);
double[] locationPixel = view.ToViewPort (pixelsWidth, pixelsHeight, projected [0], projected [1]);
// if (locationPixel [0] > 0 && locationPixel [0] < pixelsWidth &&
// locationPixel [1] > 0 && locationPixel [1] < pixelsHeight) {
// set the new location depending on the size of the image and the alignment parameter.
double leftMargin = locationPixel [0];
double topMargin = locationPixel [1];
switch (_alignment) {
case MapMarkerAlignmentType.CenterBottom:
topMargin = locationPixel [1] - (this.LayoutParameters as FrameLayout.LayoutParams).Height / 2.0;
break;
case MapMarkerAlignmentType.CenterTop:
topMargin = locationPixel [1] + (this.LayoutParameters as FrameLayout.LayoutParams).Height / 2.0;
break;
}
(this.LayoutParameters as FrameLayout.LayoutParams).LeftMargin = (int)leftMargin;
(this.LayoutParameters as FrameLayout.LayoutParams).TopMargin = (int)topMargin;
return true;
// }
// return false;
}