You are here: > ESRI Forums > arcgis desktop discussion forums > Thread Replies

ArcGIS Desktop Discussion Forums

ArcGIS Desktop - ArcMap Layers and Symbology forum

ILabelEngineLayerProperties and ILineLabelP...   Steve Broatch Nov 29, 2006
Re: ILabelEngineLayerProperties and ILineLa...   Steve Broatch Nov 29, 2006
Re: ILabelEngineLayerProperties and ILineLa...   eddie quinlan Dec 07, 2006
Re: ILabelEngineLayerProperties and ILineLa...   Steve Broatch Dec 11, 2006
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject ILabelEngineLayerProperties and ILineLabelPosition bugs? 
Author Steve Broatch 
Date Nov 29, 2006 
Message Can anyone tell if there is a bug(s) with the ILabelEngineLayerProperties object. I'm having nothing but problems with it. Setting its properties seem have to no effect whatsoever on my labels. So the following doesn't work. (pLabelProps being my
ILabelEngineLayerProperties object)

pLabelProps.Symbol.Font.Bold = True
pLabelProps.Symbol.Font.Size = 18
pLabelProps.Symbol.Font.Name = "Courier New"

If I set up a textsymbol first then point it at pLabelprops, it partly works. The size property works correctly. However none of the font ones do.

Dim pTextSymbol As ITextSymbol
Set pTextSymbol = New TextSymbol
pTextSymbol.Size = 18
pTextSymbol.Font.Bold = True
pTextSymbol.Font.Name = "Courier New"

Set pLabelProps.Symbol = pTextSymbol

I'm having similar problems with ILineLabelPosition. The following code actually works in that when I look at the layer properties the 'Location along the line' property is set to 'At Start' as it should be. But it hasn't taken effect - the labels on the map aren't 'At Start', unless I go back into the properties manaully and re-select 'At Start' then it repositions the labels. I have the appropriate refresh statements in my code so maybe its another bug?

Dim pLineLabelPos As ILineLabelPosition

Set pLineLabelPos = New LineLabelPosition
With pLineLabelPos
.AtStart = True
End With


Can anyone help?

Thanks,

Steve
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ILabelEngineLayerProperties and ILineLabelPosition bugs? 
Author Steve Broatch 
Date Nov 29, 2006 
Message Hi,

In case anyone is interested, I managed to solve these two problems.

Re:ILabelEngineLayerProperties

I managed to get round the problem using the below code. I set up a IFontDisp object, assigned all the properties to that then pointed an ITextSymbol object's Font property to look at it. I then pointed the ILabelEngineLayerProperties object's symbol property to look at the Textsymbol. Don't know why it has to be this longwinded, but it works.

Dim pTextSymbol As ITextSymbol
Set pTextSymbol = New TextSymbol

Dim pFont As IFontDisp
Set pFont = New StdFont

pFont.Name = "Arial"
pFont.Bold = True
pFont.Size = 12
pTextSymbol.Font = pFont

Set pLabelProps.Symbol = pTextSymbol

Re: ILineLabelPosition

It seems to get this to work correctly you have to set all the properties to true or false regardless of whether you're wanting to use them or not. I only used three - see code below. Again this seems crazy to me, and I found no mention of it in the developer help, just happened to stumble across it in another posting by a guy called Steve Clark. Well done Steve.

Dim pLineLabelPos As ILineLabelPosition

Set pLineLabelPos = New LineLabelPosition
With pLineLabelPos
.Above = True
.AtEnd = False
.AtStart = True
.Below = False
.Horizontal = False
.InLine = False
.Left = False
.Offset = 0
.OnTop = False
.Parallel = True
.Perpendicular = False
.ProduceCurvedLabels = False
.Right = False
End With

Cheers,

Steve 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ILabelEngineLayerProperties and ILineLabelPosition bugs? 
Author eddie quinlan 
Date Dec 07, 2006 
Message Thanx to both of you for the help....
How did you then set the symbol properties to the shapefile/layer in question?

This is the part I'm stuck on, any suggestions are appreciated.

Sincerely,
Eddie Q. 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: ILabelEngineLayerProperties and ILineLabelPosition bugs? 
Author Steve Broatch 
Date Dec 11, 2006 
Message Eddie,

First assign a geofeaturelayer object to point at your featurelayer object like below.

Dim pFeatureLayer As IFeatureLayer

'Create a new FeatureLayer and assign a shapefile to it
Set pFeatureLayer = New FeatureLayer
Set pFeatureLayer.FeatureClass = pFeatureWorkspace.OpenFeatureClass("gridline_1km")
pFeatureLayer.Name = "1km Gridlines"

Dim pGeoFeatureLayer As IGeoFeatureLayer
Set pGeoFeatureLayer = pFeatureLayer


Then you just deal with the geofeaturelayer like below;


'Sets position of label
Dim pBOLayerProps As IBasicOverposterLayerProperties
Set pBOLayerProps = New BasicOverposterLayerProperties

Dim pLineLabelPos As ILineLabelPosition

Set pLineLabelPos = New LineLabelPosition
With pLineLabelPos
.Above = True
.AtEnd = False
.AtStart = True
.Below = False
.Horizontal = False
.InLine = False
.Left = False
.Offset = 0
.OnTop = False
.Parallel = True
.Perpendicular = False
.ProduceCurvedLabels = False
.Right = Fals

pBOLayerProps.LineLabelPosition = pLineLabelPos

Set pLabelProps.BasicOverposterLayerProperties = pBOLayerProps
pLabelProps.BasicOverposterLayerProperties.LineLabelPosition = pLineLabelPos

pGeoFeatureLayer.AnnotationProperties.Clear
pGeoFeatureLayer.AnnotationProperties.Add pLabelProps

pGeoFeatureLayer.DisplayAnnotation = True

pMxDoc.UpdateContents
pMxDoc.ActiveView.Refresh

regards,

Steve