skyseesea
路人甲
路人甲
  • 注册日期2005-02-23
  • 发帖数103
  • QQ
  • 铜币443枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1646回复:3

根据比例设置图层可见

楼主#
更多 发布于:2006-06-07 10:56
用什么代码来是实现根据比例设置图层可见?
喜欢0 评分0
skyseesea
路人甲
路人甲
  • 注册日期2005-02-23
  • 发帖数103
  • QQ
  • 铜币443枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2006-06-07 13:29
<P>ArcGis ArcObjects中如何实现</P>
<P>设置图层显示的比例尺范围</P>
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15947
  • QQ554730525
  • 铜币25339枚
  • 威望15364点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
2楼#
发布于:2006-06-09 15:00
<P>在开发帮助里看看DocumentProperties Sample</P>
<P>++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++</P>
<P><FONT color=#0000ff>Option Explicit<BR><BR>Private Sub</FONT> chkTOC_Click()<BR><BR>  <CODE><FONT color=#008000>'Toggle TOC visibility</FONT></CODE><BR>  <CODE><FONT color=#0000ff>If</FONT></CODE> chkTOC.Value = 1 <CODE><FONT color=#0000ff>Then</FONT></CODE><BR>    ArcReaderControl1.TOCVisible = <CODE><FONT color=#0000ff>True<BR>  Else</FONT></CODE><BR>    ArcReaderControl1.TOCVisible = <CODE><FONT color=#0000ff>False<BR>  End If<BR><BR>End Sub<BR><BR>Private Sub</FONT></CODE> cmdLoad_Click()<BR><BR>  <CODE><FONT color=#008000>'Open a file dialog for selecting map documents</FONT></CODE><BR>  CommonDialog1.DialogTitle = "Select Published Map Document"<BR>  CommonDialog1.Filter = "Published Map Documents (*.pmf)|*.pmf"<BR>  CommonDialog1.ShowOpen<BR><BR>  <CODE><FONT color=#008000>'Exit if no map document is selected</FONT></CODE><BR>  <CODE><FONT color=#0000ff>Dim</FONT></CODE> sFilePath <CODE><FONT color=#0000ff>As String</FONT></CODE><BR>  sFilePath = CommonDialog1.FileName<BR>  <CODE><FONT color=#0000ff>If</FONT></CODE> sFilePath = "" <CODE><FONT color=#0000ff>Then Exit Sub</FONT></CODE><BR><BR>  <CODE><FONT color=#008000>'Load the specified pmf</FONT></CODE><BR>  <CODE><FONT color=#0000ff>If</FONT></CODE> ArcReaderControl1.CheckDocument(sFilePath) = <CODE><FONT color=#0000ff>True Then</FONT></CODE><BR>    ArcReaderControl1.LoadDocument sFilePath<BR>  <CODE><FONT color=#0000ff>Else</FONT></CODE><BR>    MsgBox "This document cannot be loaded!"<BR>    <CODE><FONT color=#0000ff>Exit Sub<BR>  End If</FONT></CODE><BR><BR>  <CODE><FONT color=#008000>'Determine whether permission to toggle TOC visibility</FONT></CODE><BR>  <CODE><FONT color=#0000ff>If</FONT></CODE> ArcReaderControl1.HasDocumentPermission(esriARDocumentPermissionsViewTOC) = <CODE><FONT color=#0000ff>True Then</FONT></CODE><BR>    chkTOC.Enabled = <CODE><FONT color=#0000ff>True<BR>    If</FONT></CODE> ArcReaderControl1.TOCVisible = <CODE><FONT color=#0000ff>True Then</FONT></CODE><BR>      chkTOC.Value = 1<BR>    <CODE><FONT color=#0000ff>Else</FONT></CODE><BR>      chkTOC.Value = 0<BR>    <CODE><FONT color=#0000ff>End If<BR>  Else</FONT></CODE><BR>    MsgBox "You do not have permission to toggle TOC visibility!"<BR>  <CODE><FONT color=#0000ff>End If</FONT></CODE><BR><BR>  RichTextBox1.Text = ""<BR><BR><CODE><FONT color=#0000ff>End Sub<BR><BR>Private Sub</FONT></CODE> cmdMapProperties_Click()<BR><BR>  <CODE><FONT color=#008000>'Determine whether a document is loaded</FONT></CODE><BR>  <CODE><FONT color=#0000ff>If</FONT></CODE> ArcReaderControl1.CurrentViewType = esriARViewTypeNone <CODE><FONT color=#0000ff>Then</FONT></CODE><BR>    MsgBox "You must load a map document first!"<BR>    <CODE><FONT color=#0000ff>Exit Sub<BR>  End If<BR><BR>  Dim</FONT></CODE> i <CODE><FONT color=#0000ff>As Integer<BR>  Dim</FONT></CODE> j <CODE><FONT color=#0000ff>As Integer<BR>  Dim</FONT></CODE> pMap <CODE><FONT color=#0000ff>As</FONT></CODE> IARMap<BR>  <CODE><FONT color=#0000ff>Dim</FONT></CODE> pLayer <CODE><FONT color=#0000ff>As</FONT></CODE> IARLayer<BR>  <CODE><FONT color=#0000ff>Dim</FONT></CODE> sProps <CODE><FONT color=#0000ff>As String<BR>  Dim</FONT></CODE> pExtent <CODE><FONT color=#0000ff>As</FONT></CODE> esriARExtentType<BR><BR>  sProps = "Map and Layer Properties" ; Chr(10) ; Chr(10)<BR><BR>  <CODE><FONT color=#008000>'Loop through each map in the document (Chr(9)->tab, Chr(10)->new line)</FONT></CODE><BR>  <CODE><FONT color=#0000ff>For</FONT></CODE> i = 0 <CODE><FONT color=#0000ff>To</FONT></CODE> ArcReaderControl1.ARPageLayout.ARMapCount - 1<BR><BR>    <CODE><FONT color=#008000>'Get the IARMap interface</FONT></CODE><BR>    <CODE><FONT color=#0000ff>Set</FONT></CODE> pMap = ArcReaderControl1.ARPageLayout.ARMap(i)<BR>    <CODE><FONT color=#008000>'Get map properties</FONT></CODE><BR>    sProps = sProps ; UCase(pMap.Name) ; Chr(10) ; _<BR>    "Description:" ; pMap.Description ; Chr(10) ; _<BR>    "Spatial Reference:" ; Chr(9) ; pMap.SpatialReferenceName ; Chr(10) ; _<BR>    "Units:" ; Chr(9) ; Chr(9) ; ArcReaderControl1.ARUnitConverter.EsriUnitsAsString(pMap.DistanceUnits, esriARCaseAppearanceUnchanged, <CODE><FONT color=#0000ff>True</FONT></CODE>) ; Chr(10)<BR>    <CODE><FONT color=#008000>'Get map extent type</FONT></CODE><BR>    pExtent = ArcReaderControl1.ARPageLayout.MapExtentType(pMap)<BR>    <CODE><FONT color=#0000ff>If</FONT></CODE> pExtent = esriARExtentTypeFixedExtent <CODE><FONT color=#0000ff>Then</FONT></CODE><BR>      sProps = sProps ; "Extent Type:" ; Chr(9) ; "Fixed Extent" ; Chr(10)<BR>    <CODE><FONT color=#0000ff>ElseIf</FONT></CODE> pExtent = esriARExtentTypeFixedScale <CODE><FONT color=#0000ff>Then</FONT></CODE><BR>      sProps = sProps ; "Extent Type:" ; Chr(9) ; "Fixed Scale" ; Chr(10)<BR>    <CODE><FONT color=#0000ff>Else</FONT></CODE><BR>      sProps = sProps ; "Extent Type:" ; Chr(9) ; "Automatic" ; Chr(10)<BR>    <CODE><FONT color=#0000ff>End If</FONT></CODE><BR>    sProps = sProps ; Chr(10)<BR><BR>    <CODE><FONT color=#008000>'Loop through each layer in the map</FONT></CODE><BR>    <CODE><FONT color=#0000ff>For</FONT></CODE> j = 0 <CODE><FONT color=#0000ff>To</FONT></CODE> pMap.ARLayerCount - 1<BR><BR>      <CODE><FONT color=#008000>'Get the IARLayer interface</FONT></CODE><BR>      <CODE><FONT color=#0000ff>Set</FONT></CODE> pLayer = pMap.ARLayer(j)<BR><BR>      <CODE><FONT color=#008000>'Get the layer properties</FONT></CODE><BR>      sProps = sProps ; pLayer.Name ; Chr(10) ; _<BR>      "Description:" ; Chr(9) ; pLayer.Description ; Chr(10) ; _<BR>      "Minimum Scale:" ; Chr(9) ; pLayer.MinimumScale ; Chr(10) ; _<BR>      "Maximum Scale:" ; Chr(9) ; pLayer.MaximumScale ; Chr(10) ; Chr(10)<BR>    <CODE><FONT color=#0000ff>Next</FONT></CODE> j<BR><BR>    sProps = sProps ; Chr(10) ; Chr(10)<BR>  <CODE><FONT color=#0000ff>Next</FONT></CODE> i<BR><BR>  RichTextBox1.Text = sProps<BR><BR><CODE><FONT color=#0000ff>End Sub<BR><BR>Private Sub</FONT></CODE> cmdProperties_Click()<BR><BR>  <CODE><FONT color=#008000>'Show map properties</FONT></CODE><BR>  <CODE><FONT color=#0000ff>If</FONT></CODE> ArcReaderControl1.CurrentViewType = esriARViewTypeNone <CODE><FONT color=#0000ff>Then</FONT></CODE><BR>    MsgBox "You must load a map document first!"<BR>  <CODE><FONT color=#0000ff>Else</FONT></CODE><BR>    ArcReaderControl1.ShowARWindow esriARWindowsFileProperties, <CODE><FONT color=#0000ff>True<BR>  End If<BR><BR>End Sub<BR><BR>Private Sub</FONT></CODE> Form_Load()<BR><BR>  <CODE><FONT color=#008000>'Load command button images from the resource editor</FONT></CODE><BR>  <CODE><FONT color=#0000ff>Dim</FONT></CODE> pBitmap <CODE><FONT color=#0000ff>As</FONT></CODE> IPictureDisp<BR>  <CODE><FONT color=#0000ff>Set</FONT></CODE> pBitmap = LoadResPicture("Load", vbResBitmap)<BR>  cmdLoad.Picture = pBitmap<BR>  <CODE><FONT color=#0000ff>Set</FONT></CODE> pBitmap = LoadResPicture("Properties", vbResBitmap)<BR>  cmdProperties.Picture = pBitmap<BR>  cmdMapProperties.Picture = pBitmap<BR>  chkTOC.Enabled = <CODE><FONT color=#0000ff>False<BR><BR>End Sub</FONT></CODE><BR><BR></P>
举报 回复(0) 喜欢(0)     评分
skyseesea
路人甲
路人甲
  • 注册日期2005-02-23
  • 发帖数103
  • QQ
  • 铜币443枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2006-07-10 14:05
<P> Thanks </P>
举报 回复(0) 喜欢(0)     评分
游客

返回顶部