这两个功能,和全图一样简单,也是继承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平米的屏幕上显示。