技术开发 频道

AE创建各种类型的featureclass代码


【IT168技术文档】

''' <summary> ''' 创建Annotation类型的featureclass ''' </summary> ''' <param name="pWorkspace">annotation的工作空间</param> ''' <param name="pTextSymbol">annotation的symbol</param> ''' <param name="pRefeScale">annotation的比例</param> ''' <param name="pAnnoFeatName">annotation的名称</param> ''' <returns>创建的Annotation Featureclass</returns> ''' <remarks></remarks> Private Function CreateAnnoFeatCls(ByVal pWorkspace As IFeatureWorkspace, ByVal pTextSymbol As ITextSymbol, ByVal pRefeScale As Double, ByVal pAnnoFeatName As String, Optional ByVal pSymbolID As Integer = 0) As IFeatureClass Dim pField As IField Dim pFields As IFields Dim pSource As IClone Dim pObjectClassDesc As IObjectClassDescription Dim pFeatClassDesc As IFeatureClassDescription ''创建Annotation的Fields pObjectClassDesc = New AnnotationFeatureClassDescription pFeatClassDesc = pObjectClassDesc pSource = pObjectClassDesc.RequiredFields pFields = pSource.Clone ''创建Annotation的Geometry defintion pField = pFields.Field(pFields.FindField(pFeatClassDesc.ShapeFieldName)) ''创建Reference scale Dim pGraphicsLayerScale As IGraphicsLayerScale pGraphicsLayerScale = New GraphicsLayerScale pGraphicsLayerScale.ReferenceScale = pRefeScale pGraphicsLayerScale.Units = esriUnits.esriMeters ''创建Symbolcollection Dim pSymbolColl As ISymbolCollection2 Dim pSymbolIdent As ISymbolIdentifier2 = New SymbolIdentifier pSymbolColl = New SymbolCollection pSymbolColl.AddSymbol(pTextSymbol, "Default", pSymbolIdent) If pSymbolID = 1 Then pSymbolColl.AddSymbol(pTextSymbol, "Default 1", pSymbolIdent) ''创建Label的相关属性 Dim pOverposterProperties As IOverposterProperties Dim pAnnoPropsColl As IAnnotateLayerPropertiesCollection Dim pLabelEngineLP As ILabelEngineLayerProperties Dim pAnnotateLayerProps As IAnnotateLayerProperties pOverposterProperties = New BasicOverposterProperties pAnnoPropsColl = New AnnotateLayerPropertiesCollection pLabelEngineLP = New LabelEngineLayerProperties pAnnotateLayerProps = pLabelEngineLP pAnnotateLayerProps.Class = "Default" pLabelEngineLP.Symbol = pTextSymbol pLabelEngineLP.SymbolID = pSymbolIdent.ID pAnnoPropsColl.Add(pLabelEngineLP) ''创建Annotation layer Dim pAnnoLayerFactory As IAnnotationLayerFactory Dim pAnnoLayer As IAnnotationLayer pAnnoLayerFactory = New FDOGraphicsLayerFactory pAnnoLayer = pAnnoLayerFactory.CreateAnnotationLayer(pWorkspace, Nothing, pAnnoFeatName, pField.GeometryDef, Nothing, pAnnoPropsColl, pGraphicsLayerScale, pSymbolColl, False, False, False, True, pOverposterProperties, "") Return CType(pAnnoLayer, IFeatureLayer).FeatureClass End Function
0
相关文章