0

ArcGIS 10.1 with VB.NET

I have been trying to figure this out for days but can't seem to make the connection. For a layer I am trying to create a label. I create a new BasicOverposterLayerProperties

Dim pBasicOverposterLayerProps As IBasicOverposterLayerProperties4 = New BasicOverposterLayerProperties
        <setup properties>
        Dim pAnnoLayerProps As IAnnotateLayerProperties = Nothing
        Dim pAnnoLayerPropsColl As IAnnotateLayerPropertiesCollection = pGeoFeatLayer.AnnotationProperties
        pAnnoLayerPropsColl.QueryItem(0, pAnnoLayerProps, Nothing, Nothing)
        Dim pLabelEngineLayerProps As ILabelEngineLayerProperties2 = CType(pAnnoLayerProps, ILabelEngineLayerProperties2)

pLabelEngineLayerProps.BasicOverposterLayerProperties = CType(pBasicOverposterLayerProps, IBasicOverposterLayerProperties)

Setup all my label properties and apply it and it works great for the ESRI Standard Labeling Engine. Now with the widespread use of Maplex I want to convert the labeling properties before applying.

Dim pUidOld As UID = New UID
Dim pUidNew As UID = New UID
pUidOld.Value = "{01004145-0D1C-11D2-A26F-080009B6F22B}" 'ESRI Standard Label Engine
pUidNew.Value = "{20664808-0D1C-11D2-A26F-080009B6F22B}" 'ESRI Maplex Label Engine
Dim pAnnotationPropertiesConverter As MaplexAnnotationPropertiesConverter = New MaplexAnnotationPropertiesConverter

Dim pGeomType As esriGeometryType = pFeatCls.ShapeType 
Dim pDisplayTrans As IDisplayTransformation = MyDoc.ActiveView.ScreenDisplay.DisplayTransformation
Dim pAnnotateLayerPropertiesCollectionOld As IAnnotateLayerPropertiesCollection = ???

Dim pAnnotateLayerPropertiesCollectionNew As IAnnotateLayerPropertiesCollection = pAnnotationPropertiesConverter.Convert(pGeomType, pDisplayTrans, pUidOld, pAnnotateLayerPropertiesCollectionOld, pUidNew)

I can't figure out how to get the pAnnotateLayerPropertiesCollectionOld object from the pBasicOverposterLayerProps.

1

I think you need to use the Maplex Overposter?

Something like (it's in C# but you should be able to convert to VB):

IAnnotateMap maplexEngine = (IAnnotateMap) new MaplexAnnotateMapClass();
map.AnnotationEngine = maplexEngine;

// Set the label placement to be "best" quality
IMapOverposter mapOverposter = (IMapOverposter)map;
IMaplexOverposterProperties mapOverposterProps = (IMaplexOverposterProperties)mapOverposter.OverposterProperties;
mapOverposterProps.PlacementQuality = esriMaplexPlacementQuality.esriMaplexPlacementQualityHigh;
mapOverposter.OverposterProperties = (IOverposterProperties)mapOverposterProps;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.