gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
阅读:1083回复:0

创建一个点符号在线的中间的线符号

楼主#
更多 发布于:2005-07-21 10:21
<TABLE width="100%">

<TR>
<TD class=subtitle colSpan=6>内容摘要</TD></TR>
<TR>
<TD class=txt colSpan=6>带有一个点符号在中间的线符号可以通过ArcObjects来实现,一旦这样的符号被创建,线和点的符号都可以通过符号编辑器来修改了。只是点符号的位置不能修改。</TD></TR>
<TR>
<TD class=subtitle colSpan=6>过程描述</TD></TR>
<TR>
<TD class=txt colSpan=6>1 启动ArcMap。<BR>2 打开Visual Basic Editor。<BR>3 在工程浏览窗口中展开Project.mxt,选择ArcMap Objects〉ThisDocument,右击并选择浏览代码。<BR>注意:在项目的This Document中的代码将仅仅在当前的地图文档中运行。如果你想存储你的代码在所有的地<BR>图文档中,那么请打开Normal.mxt。<BR>4 拷贝下面的代码到代码模块,根据自己的情况注意替换输出样式文件的路径。<BR>Private pCartoRGB As IRgbColor<BR>Private pMarkerRGB As IRgbColor<BR>Private pStyItem As IStyleGalleryItem<BR>Private pStyGall As IStyleGallery<BR>Private pStyStor As IStyleGalleryStorage<BR>Private pMultiLine As IMultiLayerLineSymbol<BR>Private pCartoLine As ICartographicLineSymbol<BR>Private pLineDec As ILineDecoration<BR>Private pLineProps As ILineProperties<BR>Private pLineDecElem As ISimpleLineDecorationElement<BR>Private pCharMarker As ICharacterMarkerSymbol<BR>Private pMrkFont As StdFont<BR><BR>Sub ToArrowCentered()<BR>'Create a new style file<BR>Set pStyGall = New StyleGallery<BR>Set pStyStor = pStyGall<BR>'Change the path and name of the output style if needed<BR>pStyStor.TargetFile = "D:\MidArrow.style"<BR><BR>'Create the new item for the style<BR>Set pStyItem = New StyleGalleryItem<BR>pStyItem.Name = "To Arrow"<BR>pStyItem.Category = "Mid Point"<BR><BR>'Create the line symbol<BR>Set pMultiLine = New MultiLayerLineSymbol<BR>Set pCartoLine = New CartographicLineSymbol<BR>Set pLineProps = pCartoLine<BR>'Properties for the Cartographic Line Layer<BR>Set pCartoRGB = New RgbColor<BR>With pCartoRGB<BR>.Red = 0<BR>.Green = 0<BR>.Blue = 0<BR>End With<BR>With pCartoLine<BR>.Color = pCartoRGB<BR>.Width = 1<BR>End With<BR>'Properties for the Line Decoration (Arrow)<BR>Set pMarkerRGB = New RgbColor<BR>With pMarkerRGB<BR>.Red = 255<BR>.Green = 0<BR>.Blue = 0<BR>End With<BR>Set pCharMarker = New CharacterMarkerSymbol<BR>Set pMrkFont = New StdFont<BR>With pMrkFont<BR>.Name = "ESRI Arrowhead"<BR>End With<BR>With pCharMarker<BR>.Angle = 0 'Set the angle to the desired rotation value<BR>.CharacterIndex = 63<BR>.Color = pMarkerRGB<BR>.Font = pMrkFont<BR>.Size = 12<BR>End With<BR>Set pLineDecElem = New SimpleLineDecorationElement<BR>With pLineDecElem<BR>.AddPosition 0.5<BR>.MarkerSymbol = pCharMarker<BR>.PositionAsRatio = True<BR>.Rotate = True<BR>End With<BR>Set pLineDec = New LineDecoration<BR>pLineDec.AddElement pLineDecElem<BR>Set pLineProps.LineDecoration = pLineDec<BR>'Add it to the MultiLayer Line<BR>pMultiLine.AddLayer pCartoLine<BR>pStyItem.Item = pMultiLine<BR>pStyGall.AddItem pStyItem<BR>'Change the path and name of the output style if needed<BR>pStyStor.RemoveFile "D:\MidArrow.style"<BR>End Sub<BR><BR>5 关闭Visual Basic Editor。<BR>6 运行此段代码。<BR>A. 单击工具> 宏> 宏 ,为了显示宏对话框.。<BR>B. 选择一个宏并单击运行。<BR>7 使用样式参考对话框,可以从工具菜单下打开,然后添加刚刚新创建的样式文件。<BR>8 试着打开一个线性的图层,来使用刚刚引进的样式文件中的符号。</TD></TR></TABLE>
喜欢0 评分0
GIS麦田守望者,期待与您交流。
游客

返回顶部