the_way
路人甲
路人甲
  • 注册日期2004-08-25
  • 发帖数30
  • QQ
  • 铜币166枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1800回复:2

如何用代码设置图层在特定比例尺下显示?(急)

楼主#
更多 发布于:2005-03-29 14:01
如题
喜欢0 评分0
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
1楼#
发布于:2005-03-30 13:31
<P>Option Explicit</P><P>Implements ICommand
Implements ICommandSubType</P><P>Private m_pHookHelper As IHookHelper
Private m_pMapControl As IMapControl3
Private m_lSubType As Long</P><P>Private Sub Class_Initialize()
  
  Set m_pHookHelper = New HookHelper
  
End Sub</P><P>Private Sub Class_Terminate()
  
  Set m_pHookHelper = Nothing
  
End Sub</P><P>Private Property Get ICommand_Enabled() As Boolean
  
  Dim bEnabled As Boolean
  bEnabled = True</P><P>  Dim pLayer As ILayer
  Set pLayer = m_pMapControl.CustomProperty</P><P>  If (m_lSubType = 3) Then
    If (pLayer.MaximumScale = 0) And (pLayer.MinimumScale = 0) Then bEnabled = False
  End If
  
  ICommand_Enabled = bEnabled
  
End Property
 
Private Property Get ICommand_Checked() As Boolean
  
  ICommand_Checked = False
  
End Property
 
Private Property Get ICommand_Name() As String
  
  ICommand_Name = "ScaleThresholds"
  
End Property</P><P>Private Property Get ICommand_Caption() As String
  
  If (m_lSubType = 1) Then
    ICommand_Caption = "Set Maximum Scale"
  ElseIf (m_lSubType = 2) Then
    ICommand_Caption = "Set Minimum Scale"
  Else
    ICommand_Caption = "Remove Scale Thresholds"
  End If</P><P>End Property
 
Private Property Get ICommand_Tooltip() As String
  
  'Not implemented
  
End Property
 
Private Property Get ICommand_Message() As String
  
  'Not implemented
  
End Property
 
Private Property Get ICommand_HelpFile() As String
  
  'Not implemented
  
End Property
 
Private Property Get ICommand_HelpContextID() As Long
  
  'Not implemented
  
End Property
 
Private Property Get ICommand_Bitmap() As esriSystem.OLE_HANDLE
  
  'Not implemented</P><P>End Property
 
Private Property Get ICommand_Category() As String
  
  'Not implemented
  
End Property
 
Private Sub ICommand_OnCreate(ByVal hook As Object)</P><P>  Set m_pHookHelper.hook = hook
  Set m_pMapControl = m_pHookHelper.hook
  
End Sub
 
Private Sub ICommand_OnClick()
  
  Dim pLayer As ILayer
  Set pLayer = m_pMapControl.CustomProperty
  If (m_lSubType = 1) Then pLayer.MaximumScale = m_pMapControl.MapScale
  If (m_lSubType = 2) Then pLayer.MinimumScale = m_pMapControl.MapScale
  If (m_lSubType = 3) Then
    pLayer.MaximumScale = 0
    pLayer.MinimumScale = 0
  End If
  m_pMapControl.Refresh esriViewDrawPhase.esriViewGeography</P><P>End Sub</P><P>Private Sub ICommandSubType_SetSubType(ByVal SubType As Long)</P><P>  m_lSubType = SubType</P><P>End Sub</P><P>Private Function ICommandSubType_GetCount() As Long</P><P>  ICommandSubType_GetCount = 3</P><P>End Function</P>
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
kilojin
路人甲
路人甲
  • 注册日期2005-03-10
  • 发帖数22
  • QQ
  • 铜币188枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2005-03-31 09:17
<P>thanks</P><img src="images/post/smile/dvbbs/em01.gif" /><img src="images/post/smile/dvbbs/em02.gif" />
举报 回复(0) 喜欢(0)     评分
游客

返回顶部