Что-то сильно запутался, создавая аннотации. CreateAnnotationClass???
Нужно создать аннотации с AnnotationClasses, да так чтобы и SubClasses образовались как если вручную через ArcCatalog.
С AnnotationClasses создать удается, но подгружаешь в Мап, у слоя подслои образуются, а при редактировании Субклассов нет.
Объясните на словах как все увязано:
AnnotationFeatureClass в нем AnnotationClasses к ним подвязаны SymbolCollection, с какого боку SubClasses&Domains (это совсем не получается).
А еще ILabelEngineLayerProperties2 за что отвечает.
Если не на словах, то может код есть.Все примеры изучил, еще больше погряз.
код:
Dim myTxtSym As IFormattedTextSymbol
Private Sub NewAnnoClass()
' get a reference to the linked feature class
Dim pWS As IWorkspace
Dim pWSF As IWorkspaceFactory
Set pWSF = New AccessWorkspaceFactory
Set pWS = pWSF.OpenFromFile("D:\Map\test.mdb", 0)
Dim PFWSAnno As IFeatureWorkspaceAnno
Set PFWSAnno = pWS
Dim pFWS As IFeatureWorkspace
Set pFWS = pWS
Dim pFDataset As IFeatureDataset
Set pFDataset = pFWS.OpenFeatureDataset("TestDS")
Dim psrcFClass As IFeatureClass
Set psrcFClass = pFWS.OpenFeatureClass("test2")
' set up reference scale
Dim pGLS As IGraphicsLayerScale
Set pGLS = New GraphicsLayerScale
Dim pGeoDS As IGeoDataset
Set pGeoDS = pFDataset
pGLS.Units = esriMeters
pGLS.ReferenceScale = 10000
' set up symbol collection
Dim pSymbolColl As ISymbolCollection2
Dim pSymbolIdentifier As ISymbolIdentifier2
Set pSymbolColl = New SymbolCollection
MakeText
' set up the annotation labeling properties including the expression
Dim pAnnoPropsColl As IAnnotateLayerPropertiesCollection
Set pAnnoPropsColl = New AnnotateLayerPropertiesCollection
For i = 0 To 1
pSymbolColl.AddSymbol myTxtSym, "myClass" & i, pSymbolIdentifier
Dim pAnnoProps As IAnnotateLayerProperties
Set pAnnoProps = New LabelEngineLayerProperties
pAnnoProps.FeatureLinked = False
pAnnoProps.AddUnplacedToGraphicsContainer = False
pAnnoProps.CreateUnplacedElements = True
pAnnoProps.DisplayAnnotation = True
pAnnoProps.UseOutput = True
pAnnoProps.Class = "myClass" & i
'Dim aAnnoVBScriptEngine As IAnnotationExpressionEngine
'Set aAnnoVBScriptEngine = New AnnotationVBScriptEngine
Dim pLELayerProps As ILabelEngineLayerProperties
Set pLELayerProps = pAnnoProps
'Set pLELayerProps.ExpressionParser = aAnnoVBScriptEngine
'pLELayerProps.Expression = "[DESCRIPTION]"
pLELayerProps.IsExpressionSimple = True
pLELayerProps.Offset = 0
pLELayerProps.SymbolID = pSymbolIdentifier.ID
Set pLELayerProps.Symbol = pSymbolColl.Symbol(pSymbolIdentifier.ID)
Dim pATP As IAnnotateLayerTransformationProperties
Set pATP = pAnnoProps
pATP.ReferenceScale = pGLS.ReferenceScale
pATP.Units = esriMeters
pATP.ScaleRatio = 1
pAnnoPropsColl.Add pAnnoProps
Next
' use the AnnotationFeatureClassDescription co-class to get the list of required fields and the default name of the shape field
Dim pOCDesc As IObjectClassDescription
Set pOCDesc = New AnnotationFeatureClassDescription
Dim pFDesc As IFeatureClassDescription
Set pFDesc = pOCDesc
'populate with additional fields
Dim pAnnoObjectClassDesc As IObjectClassDescription
Dim pAnnoFeatureClassDesc As IFeatureClassDescription
Set pAnnoFeatureClassDesc = New AnnotationFeatureClassDescription
Set pAnnoObjectClassDesc = pAnnoFeatureClassDesc
Dim pFields As IFields
Set pFields = pAnnoObjectClassDesc.RequiredFields
'******** добавление своих полей
Dim pFieldsEdit As IFieldsEdit
Set pFieldsEdit = pFields
Dim pFieldEdit As IFieldEdit
Set pField = New Field
Set pFieldEdit = pField
pFieldEdit.Name = "MyField1"
pFieldEdit.AliasName = "MyField1"
pFieldEdit.Type = esriFieldTypeString
pFieldsEdit.AddField pField
Set pFields = pFieldsEdit
Dim pShapeField As IField
Set pShapeField = pFields.Field(pFields.FindField(pAnnoFeatureClassDesc.ShapeFieldName))
' create the new class
Dim pNewClass As IFeatureClass
Set pNewClass = PFWSAnno.CreateAnnotationClass("AnnoTest3", _
pFields, _
pAnnoObjectClassDesc.InstanceCLSID, _
pAnnoObjectClassDesc.ClassExtensionCLSID, _
pAnnoFeatureClassDesc.ShapeFieldName, _
"", _
pFDataset, _
Nothing, _
pAnnoPropsColl, _
pGLS, _
pSymbolColl, _
True)
MsgBox "done"
End Sub
Public Sub MakeText()
' helper function to create the text symbol
Set myTxtSym = New TextSymbol
'** Set the font for myTxtSym
Dim myFont As IFontDisp
Set myFont = New StdFont
myFont.Name = "Courier New"
myFont.size = 9
myTxtSym.Font = myFont
&nb