本文整理汇总了C#中Envelope.Min方法的典型用法代码示例。如果您正苦于以下问题:C# Envelope.Min方法的具体用法?C# Envelope.Min怎么用?C# Envelope.Min使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Envelope
的用法示例。
在下文中一共展示了Envelope.Min方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TransformBox
/// <summary>
/// Transforms a <see cref="Envelope"/>.
/// </summary>
/// <param name="box">BoundingBox to transform</param>
/// <param name="transform">Math Transform</param>
/// <returns>Transformed object</returns>
public static Envelope TransformBox(Envelope box, IMathTransform transform)
{
if (box == null)
return null;
var corners = new Coordinate[4];
#if PCL
var ll = new Coordinate(box.MinX, box.MinY);
var ur = new Coordinate(box.MaxX, box.MaxY);
var llTrans = transform.Transform(ll);
var urTrans = transform.Transform(ur);
corners[0] = new Coordinate(llTrans.X, llTrans.Y); //lower left
corners[2] = new Coordinate(llTrans.X, urTrans.Y); //upper left
corners[1] = new Coordinate(urTrans.X, urTrans.Y); //upper right
corners[3] = new Coordinate(urTrans.X, llTrans.Y); //lower right
#else
var ll = box.Min().ToDoubleArray();
var ur = box.Max().ToDoubleArray();
var llTrans = transform.Transform(ll);
var urTrans = transform.Transform(ur);
corners[0] = new Coordinate(llTrans[0], llTrans[1]); //lower left
corners[2] = new Coordinate(llTrans[0], urTrans[1]); //upper left
corners[1] = new Coordinate(urTrans[0], urTrans[1]); //upper right
corners[3] = new Coordinate(urTrans[0], llTrans[1]); //lower right
#endif
var result = new Envelope(corners[0]);
for (var i = 1; i < 4; i++)
result.ExpandToInclude(corners[i]);
return result;
}
示例2: LineFromBbox
private IGeometry LineFromBbox(Envelope bbox)
{
var pointColl = new[] {bbox.Min(), bbox.Max()};
return Factory.CreateLineString(pointColl);
}
示例3: HandleMapNewTileAvaliable
private void HandleMapNewTileAvaliable(TileLayer sender, Envelope box, Bitmap bm, int sourceWidth,
int sourceHeight, ImageAttributes imageAttributes)
{
lock (_backgroundImagesLocker)
{
try
{
var min = Point.Round(_map.WorldToImage(box.Min()));
var max = Point.Round(_map.WorldToImage(box.Max()));
if (IsDisposed == false && _isDisposed == false)
{
using (var g = Graphics.FromImage(_imageBackground))
{
g.DrawImage(bm,
new Rectangle(min.X, max.Y, (max.X - min.X), (min.Y - max.Y)),
0, 0,
sourceWidth, sourceHeight,
GraphicsUnit.Pixel,
imageAttributes);
}
UpdateImage(false);
}
}
catch (Exception ex)
{
Logger.Warn(ex.Message, ex);
//this can be a GDI+ Hell Exception...
}
}
}
示例4: ErrorMetric
/// <summary>
/// Calculate the floating point error metric
/// </summary>
/// <returns></returns>
public static double ErrorMetric(Envelope box)
{
var temp = new Coordinate(1, 1).Add(box.Max().Subtract(box.Min()));
return temp.X*temp.Y;
}
示例5: HandleMapNewTileAvaliable
static void HandleMapNewTileAvaliable(Map map, Graphics g, Envelope box, Bitmap bm, int sourceWidth, int sourceHeight, ImageAttributes imageAttributes)
{
try
{
var min = map.WorldToImage(box.Min());
var max = map.WorldToImage(box.Max());
min = new PointF((float)Math.Round(min.X), (float)Math.Round(min.Y));
max = new PointF((float)Math.Round(max.X), (float)Math.Round(max.Y));
g.DrawImage(bm,
new Rectangle((int)min.X, (int)max.Y, (int)(max.X - min.X), (int)(min.Y - max.Y)),
0, 0,
sourceWidth, sourceHeight,
GraphicsUnit.Pixel,
imageAttributes);
// g.Dispose();
}
catch (Exception ex)
{
Logger.Warn(ex.Message, ex);
//this can be a GDI+ Hell Exception...
}
}
示例6: HandleMapNewTileAvaliable
static void HandleMapNewTileAvaliable(Map map, IGraphics g, Envelope box, Bitmap bm, int sourceWidth, int sourceHeight, ImageAttributes imageAttributes)
{
try
{
PointF min_f = map.WorldToImage(box.Min());
PointF max_f = map.WorldToImage(box.Max());
double minx = Math.Round(min_f.X);
double miny = Math.Round(min_f.Y);
double maxx = Math.Round(max_f.X);
double maxy = Math.Round(max_f.Y);
Point min = new Point(
Convert.ToInt32(minx),
Convert.ToInt32(miny));
Point max = new Point(
Convert.ToInt32(maxx),
Convert.ToInt32(maxy));
g.DrawImage(bm,
min.X, max.Y, max.X - min.X, min.Y - max.Y,
0, 0, sourceWidth, sourceHeight,
GraphicsUnitType.Pixel,
imageAttributes);
// g.Dispose();
}
catch (Exception ex)
{
Logger.Warn(ex.Message, ex);
//this can be a GDI+ Hell Exception...
}
}