阅读:1556回复:2
engine下标注如何随着地图变化而变大,变小
<P>以下是地图标注的代码,哪位知道这些标注如何随着地图的变化而变化</P>
<P>'在pFeatureLayer上以strField字段作标注专题图<BR>Public Function LabelRender(pFeatureLayer As IFeatureLayer, strField As String) ', dMax As Double, dMin As Double)<BR> Dim pGeoFeatureLayer As IGeoFeatureLayer<BR> Dim plinelablePosition As ILineLabelPosition<BR> Dim pLableEnginep As ILabelEngineLayerProperties<BR> Dim pAnnotateLayer As IAnnotateLayerProperties<BR> Dim pAnnoLayerPropsColl As IAnnotateLayerPropertiesCollection<BR> <BR> Set pGeoFeatureLayer = pFeatureLayer<BR> Set plinelablePosition = New LineLabelPosition<BR> pGeoFeatureLayer.AnnotationProperties.Clear<BR> plinelablePosition.Above = False<BR> plinelablePosition.AtEnd = False<BR> plinelablePosition.Below = False<BR> plinelablePosition.Horizontal = False<BR> plinelablePosition.InLine = True<BR> plinelablePosition.OnTop = True<BR> plinelablePosition.Parallel = True<BR> plinelablePosition.ProduceCurvedLabels = True<BR> Set pLableEnginep = New LabelEngineLayerProperties<BR> pLableEnginep.IsExpressionSimple = True<BR> pLableEnginep.Expression = "[" ; strField ; "]"<BR> pLableEnginep.BasicOverposterLayerProperties.LineLabelPosition = plinelablePosition<BR> Set pAnnotateLayer = pLableEnginep<BR> With pAnnotateLayer<BR> .DisplayAnnotation = True<BR> End With<BR> pGeoFeatureLayer.AnnotationProperties.Add pAnnotateLayer<BR>' Set pAnnotateLayer = pGeoFeatureLayer.AnnotationProperties.QueryItem(0)<BR>' pAnnotateLayer.AnnotationMaximumScale = dMax<BR>' pAnnotateLayer.AnnotationMinimumScale = dMin<BR>' Set pAnnoLayerPropsColl = pGeoFeatureLayer.AnnotationProperties<BR>' pAnnoLayerPropsColl.QueryItem 0, pAnnotateLayer, Nothing, Nothing<BR>' pAnnotateLayer.AnnotationMaximumScale = 1# / 496712<BR>' pAnnotateLayer.AnnotationMinimumScale = 1# / 1286358<BR> <BR> pGeoFeatureLayer.DisplayAnnotation = True<BR> <BR>End Function</P> |
|
1楼#
发布于:2006-11-07 18:04
<P>一般情况是不应该变的,如果想变的话是可以的,自己把要标注的信息画上去了</P>
<P>public void Draw(ref IActiveView pActiveView)<BR> { <BR> if(m_Array.Count<1)return;<BR> else<BR> {<BR> ClsFunction m_Function = new ClsFunction(pActiveView);//调用公共函数<BR> double pTempDis=m_Function.ConvetToMapDistance(10,pActiveView.ScreenDisplay);<BR> IEnvelope pEnve = pActiveView.Extent; <BR> for(int i=0;i<m_Array.Count;i++)<BR> { <BR> IGeometry pGeom ;<BR> IClone pClone; <BR> LabelInfo pLabelInfo = m_Array.GetByIndex(i) as LabelInfo;<BR> IPoint pPoit = new PointClass(); <BR> pGeom =pLabelInfo.m_Geometry;<BR> pClone=pGeom as IClone ;<BR> pPoit =pClone.Clone () as IPoint; <BR> if(ClsGlobal.InEnve(pPoit.X,pPoit.Y,ref pEnve))//判断是否当前屏幕可视范围内<BR> {<BR> string strValue = pLabelInfo.Label;<BR> IPoint mPoit = new PointClass(); <BR> mPoit.X = pPoit.X+ pTempDis;<BR> mPoit.Y =pPoit.Y+ pTempDis; <BR> IFormattedTextSymbol pTextSymbol = new TextSymbolClass();<BR> System.Drawing.Font drawFont = new System.Drawing.Font(nFont, int.Parse(pFont), FontStyle.Regular);<BR> pTextSymbol.Font =(stdole.IFontDisp) OLE.GetIFontDispFromFont(drawFont);//字体<BR> pTextSymbol.Color=m_Function.CreateColor(panel1.BackColor.R,panel1.BackColor.G,panel1.BackColor.B);<BR> pActiveView.ScreenDisplay.SetSymbol(pTextSymbol as ISymbol);<BR> pActiveView.ScreenDisplay.DrawText(mPoit,strValue);<BR> }<BR> <BR> } <BR> }<BR> }</P> |
|
|
2楼#
发布于:2006-11-08 09:17
二楼,你好,谢谢你的回答,能不能把全部的思路讲一下
|
|