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


C# IEnvelope.Intersection方法代码示例

本文整理汇总了C#中IEnvelope.Intersection方法的典型用法代码示例。如果您正苦于以下问题:C# IEnvelope.Intersection方法的具体用法?C# IEnvelope.Intersection怎么用?C# IEnvelope.Intersection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEnvelope的用法示例。


在下文中一共展示了IEnvelope.Intersection方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GetBitmap

 public virtual Bitmap GetBitmap(IEnvelope envelope, Size pixelSize)
 {
     Bitmap result = new Bitmap(pixelSize.Width, pixelSize.Height);
     Graphics g = Graphics.FromImage(result);
     foreach (ImageData image in _images)
     {
         IEnvelope bounds = envelope.Intersection(image.Envelope);
         
         Size ps = new Size((int)((double)pixelSize.Width * bounds.Width/envelope.Width),(int)((double)pixelSize.Height * bounds.Height/envelope.Height));
         int x = pixelSize.Width*(int)((bounds.X - envelope.X)/envelope.Width);
         int y = pixelSize.Height*(int) ((envelope.Y - bounds.Y)/envelope.Height);
         if(ps.Width > 0 && ps.Height > 0)
         {
             Bitmap tile = image.GetBitmap(bounds, ps);
             g.DrawImageUnscaled(tile, x, y);
         }
     }
     return result;
 }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:19,代码来源:ImageCoverage.cs

示例2: Draw2D

        /// <summary>
        /// This draws the back buffer image onto a graphics object that has been scaled and
        /// translated via the graphics transforms into world coordinates.  The bounds
        /// are specified in geographic coordinates, as are the extents for this graphics object.
        /// </summary>
        /// <param name="g">The System.Drawing.Graphics surface to draw on.</param>
        /// <param name="bounds">The geographic extents to draw</param>
        public virtual void Draw2D(Graphics g, IEnvelope bounds)
        {
            // Ensure we have something on the backbuffer that we want to draw
            if (_extents == null) return;
            if (_extents.Width == 0 || _extents.Height == 0) return;
            if (bounds.Intersects(_extents) == false) return;

            IEnvelope sourceBounds = bounds.Intersection(_extents);
            RectangleF sourceRect = ProjToPixel(sourceBounds);
            //RectangleF destRect = new RectangleF(0, 0,Convert.ToSingle(sourceBounds.Width), Convert.ToSingle(sourceBounds.Height));

            float sx = Convert.ToSingle(_extents.Width/bounds.Width);
            float sy = Convert.ToSingle(_extents.Height/bounds.Height);
            float tx = 0f;
            float ty = 0f;

            if (bounds.Minimum.X < _extents.Minimum.X) tx = Convert.ToSingle((bounds.Minimum.X - _extents.Minimum.X) * Width / bounds.Width);
            if (bounds.Maximum.Y > _extents.Maximum.Y)ty = Convert.ToSingle((bounds.Maximum.Y - _extents.Maximum.Y) * Height / bounds.Height);
            RectangleF destRect = new RectangleF(-tx, ty, sourceRect.Width * sx, sourceRect.Height * sy);
            g.DrawImage(_image, destRect, sourceRect, GraphicsUnit.Pixel);
           
        }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:29,代码来源:BackBuffer.cs

示例3: ProjectRegionToWindow

 /// <summary>
 /// Calculates a ratio so that the specified rectangle represents the portion on the window rectangle
 /// that is equivalent to the region on the view. 
 /// </summary>
 /// <param name="view"></param>
 /// <param name="window"></param>
 /// <param name="region"></param>
 /// <returns></returns>
 private Rectangle ProjectRegionToWindow(IEnvelope view, Rectangle window, IEnvelope region)
 {
     IEnvelope env = view.Intersection(region);
     int x = (int)((window.Width / view.Width) * env.X - window.X);
     int y = (int)(window.Y - (window.Height / env.Height) * env.Y);
     int w = (int)((window.Width / view.Width) * env.Width);
     int h = (int)((window.Height / view.Height) * env.Height);
     return new Rectangle(x, y, w, h);
 }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:17,代码来源:PyramidImage.cs


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