zoukankan      html  css  js  c++  java
  • 一起学习ArcEngine(6)固定比例放大缩小

    这两个功能,和全图一样简单,也是继承CommandBase基类

       1:    public FixedZoomIn()
       2:              : base("FixedZoomIn")
       3:         {
       4:         }
       5:          public override void OnClick()
       6:          {
       7:              //Get IEnvelope interface
       8:              IEnvelope pEnvelope = (IEnvelope)m_pActiveView.FullExtent;
       9:              //Expand envelope and refresh the view
      10:              pEnvelope.Expand(0.75, 0.75, true);
      11:              m_pActiveView.Extent = pEnvelope;
      12:              m_pActiveView.Refresh();
      13:          }
      14:      }
    pEnvelope 是当前的地图视图,假定是1平米,屏幕大小也是1平米,现在将0.75平米的地图在1平米的屏幕上显示,也就是放大了,呵呵(这样描述可能容易理解一点)pEnvelope.Expand(0.75, 0.75, true);就是获得0.75平米的地图视图,m_pActiveView 相当于屏幕。
       1:   public class FixedZoomOut : CommandBase
       2:      {
       3:          public FixedZoomOut()
       4:              : base("FixedZoomOut")
       5:          { }
       6:   
       7:          public override void OnClick()
       8:          {
       9:              //Get IEnvelope interface
      10:              IEnvelope pEnvelope = (IEnvelope)m_pActiveView.FullExtent;
      11:              //Expand envelope and refresh the view
      12:              pEnvelope.Expand(1.25, 1.25, true);
      13:              m_pActiveView.Extent = pEnvelope;
      14:              m_pActiveView.Refresh();
      15:          }
      16:      }

    同理,缩小就是将1.25平米的地图视图,在1平米的屏幕上显示。

  • 相关阅读:
    台州 OJ 3847 Mowing the Lawn 线性DP 单调队列
    洛谷 OJ P1417 烹调方案 01背包
    快速幂取模
    台州 OJ 2649 More is better 并查集
    UVa 1640
    UVa 11971
    UVa 10900
    UVa 11346
    UVa 10288
    UVa 1639
  • 原文地址:https://www.cnblogs.com/liuyh208/p/1571453.html
Copyright © 2011-2022 走看看