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


C# Envelope.Min方法代码示例

本文整理汇总了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;
        }
开发者ID:sridhar19091986,项目名称:sharpmapx,代码行数:38,代码来源:GeometryTransform.cs

示例2: LineFromBbox

 private IGeometry LineFromBbox(Envelope bbox)
 {
     var pointColl = new[] {bbox.Min(), bbox.Max()};
     return Factory.CreateLineString(pointColl);
 }
开发者ID:geobabbler,项目名称:SharpMap,代码行数:5,代码来源:SpatiaLite.cs

示例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...
                }

            }

        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:37,代码来源:MapBox.cs

示例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;
 }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:9,代码来源:SpatialIndexing.cs

示例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...
            }

        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:28,代码来源:TileAsyncLayer.cs

示例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...
            }

        }
开发者ID:lishxi,项目名称:_SharpMap,代码行数:34,代码来源:TileAsyncLayer.cs


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