This project is read-only.

GenerateLabels vs. the old way

Jan 19, 2011 at 6:39 PM
Edited Jan 19, 2011 at 6:42 PM

I am trying to wean myself away from generating the labels the old way and use the 'GenerateLabels' function. For some reason, they never become visible, even though the return count is accurate, in this case 26,252 labels generated. I am using vb6 on current project. Below is the code:

Public sub GenLabels( iLayer As Long, iField As Long )

      Dim sf As New MapWinGIS.Shapefile, LabelCount As Long

     Map.ShapeDrawingMethod = MapWinGIS.tkShapeDrawingMethod.dmNewWithLabels

     Set sf = Map.GetObject( iLayer )

     If sf.ShapefileType = SHP_POLYGON Then      

          LabelCount = sf.GenerateLabels( iField, lpCentroid )  

Else      

LabelCount = sf.GenerateLabels( iField, lpLongestSegement )    

End If

Map.Redraw

End Sub

comments and error trapping have been removed. All arguments are valid and the return value 'LabelCount' indicates appropriate totals. Labels never appear.

Would there be support library issues? I am using MapWinGIS.ocx 4.82. I receive no errors with library loading. Any ideas?

Thanks,

Brad

 

Jan 19, 2011 at 10:05 PM

Brad,

actually we compile MapWinGis in 2 variants now: with old drawing procedures and the new ones.

The fast method to determine the one you are using is to check Map.VersionNumber property:

0 - old mehods (old labels will be visible; new one - not);

1 - new methods (new labels will be visible).

The idea was to prevent user from utilizing both old and new procedures simultaneously.

You can obtain the latest ocx on the download page (VersionNumber = 1).

Hope it'll help

Sergei

Jan 20, 2011 at 12:01 AM

Sergei,

Thanks!

Brad