Hi,
I'm trying to display feature labels with Map Suite Desktop.
My map consist in a list of shape files. I have added fixed label by a featurelayer.
I've already used the solution below succesfully in one project of mine.
Protected Function AddTestoMap(ByVal AddNewLayer As StructLayer) As Boolean
Dim bReturn As Boolean = False
Dim OverlayAdd As LayerOverlay = ControlNameGroup(AddNewLayer.strNomeLayerOverlay)
Dim bitmapLayer As New InMemoryFeatureLayer()
bitmapLayer.Name = AddNewLayer.strNomeLayer
bitmapLayer.ZoomLevelSet.ZoomLevel01.Scale = Me._MapThinkGeo.ZoomLevelSet.ZoomLevel01.Scale
bitmapLayer.ZoomLevelSet.ZoomLevel02.Scale = Me._MapThinkGeo.ZoomLevelSet.ZoomLevel02.Scale
bitmapLayer.ZoomLevelSet.ZoomLevel03.Scale = Me._MapThinkGeo.ZoomLevelSet.ZoomLevel03.Scale
bitmapLayer.ZoomLevelSet.ZoomLevel04.Scale = Me._MapThinkGeo.ZoomLevelSet.ZoomLevel04.Scale
bitmapLayer.ZoomLevelSet.ZoomLevel05.Scale = Me._MapThinkGeo.ZoomLevelSet.ZoomLevel05.Scale
bitmapLayer.ZoomLevelSet.ZoomLevel06.Scale = Me._MapThinkGeo.ZoomLevelSet.ZoomLevel06.Scale
bitmapLayer.ZoomLevelSet.ZoomLevel07.Scale = Me._MapThinkGeo.ZoomLevelSet.ZoomLevel07.Scale
bitmapLayer.ZoomLevelSet.ZoomLevel08.Scale = Me._MapThinkGeo.ZoomLevelSet.ZoomLevel08.Scale
bitmapLayer.ZoomLevelSet.ZoomLevel09.Scale = Me._MapThinkGeo.ZoomLevelSet.ZoomLevel09.Scale
bitmapLayer.ZoomLevelSet.ZoomLevel10.Scale = Me._MapThinkGeo.ZoomLevelSet.ZoomLevel10.Scale
bitmapLayer.ZoomLevelSet.ZoomLevel11.Scale = Me._MapThinkGeo.ZoomLevelSet.ZoomLevel11.Scale
bitmapLayer.ZoomLevelSet.ZoomLevel12.Scale = Me._MapThinkGeo.ZoomLevelSet.ZoomLevel12.Scale
bitmapLayer.ZoomLevelSet.ZoomLevel13.Scale = Me._MapThinkGeo.ZoomLevelSet.ZoomLevel13.Scale
bitmapLayer.ZoomLevelSet.ZoomLevel14.Scale = Me._MapThinkGeo.ZoomLevelSet.ZoomLevel14.Scale
bitmapLayer.ZoomLevelSet.ZoomLevel15.Scale = Me._MapThinkGeo.ZoomLevelSet.ZoomLevel15.Scale
bitmapLayer.ZoomLevelSet.ZoomLevel16.Scale = Me._MapThinkGeo.ZoomLevelSet.ZoomLevel16.Scale
bitmapLayer.ZoomLevelSet.ZoomLevel17.Scale = Me._MapThinkGeo.ZoomLevelSet.ZoomLevel17.Scale
bitmapLayer.ZoomLevelSet.ZoomLevel18.Scale = Me._MapThinkGeo.ZoomLevelSet.ZoomLevel18.Scale
bitmapLayer.ZoomLevelSet.ZoomLevel19.Scale = Me._MapThinkGeo.ZoomLevelSet.ZoomLevel19.Scale
bitmapLayer.ZoomLevelSet.ZoomLevel20.Scale = Me._MapThinkGeo.ZoomLevelSet.ZoomLevel20.Scale
bitmapLayer.Open()
bitmapLayer.Columns.Add(New FeatureSourceColumn(AddNewLayer.strNomeLayer))
bitmapLayer.Close()
Dim ptPosition As New PointShape(AddNewLayer.dblX, AddNewLayer.dblY)
Dim testFeature As Feature = New Feature(ptPosition)
testFeature.ColumnValues.Add(AddNewLayer.strNomeLayer, AddNewLayer.strTestoWrite)
bitmapLayer.InternalFeatures.Add(testFeature)
Select Case AddNewLayer.enCodiceStile
[...]
Case MapStyle.TestoOrdineNP
bitmapLayer.ZoomLevelSet.ZoomLevel15.DefaultTextStyle = TextStyles.CreateMaskTextStyle(AddNewLayer.strNomeLayer, "Arial", 9, DrawingFontStyles.Bold, GeoColor.StandardColors.Black, New GeoColor(255, 255, 255))
bitmapLayer.ZoomLevelSet.ZoomLevel15.DefaultTextStyle.BestPlacement = False
bitmapLayer.ZoomLevelSet.ZoomLevel15.DefaultTextStyle.OverlappingRule = LabelOverlappingRule.AllowOverlapping
bitmapLayer.ZoomLevelSet.ZoomLevel15.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
bitmapLayer.ZoomLevelSet.ZoomLevel15.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.White, 6, GeoColor.SimpleColors.Black, 1)
bitmapLayer.ZoomLevelSet.ZoomLevel15.DefaultTextStyle.PointPlacement = PointPlacement.CenterRight
bitmapLayer.ZoomLevelSet.ZoomLevel15.DefaultTextStyle.XOffsetInPixel = 5
bitmapLayer.ZoomLevelSet.ZoomLevel15.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
Case Else
bitmapLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.State1(AddNewLayer.strNomeLayer)
bitmapLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20
End Select
Try
'-- Aggiungo il layer al gruppo
OverlayAdd.Lock.EnterWriteLock()
OverlayAdd.Layers.Add(bitmapLayer.Name, bitmapLayer)
If AddNewLayer.bAddTopList Then
OverlayAdd.Layers.MoveToTop(OverlayAdd.Layers.Count - 1)
End If
bReturn = True
Catch ex As Exception
Finally
OverlayAdd.Lock.ExitWriteLock()
End Try
Return bReturn
End Function
Me._MapThinkGeo is the map component.
StructLayer is a temporary structure for store data.
Now I have to use the same solution in another project.
The only thing that has changed is the scale of shapes files.
Everything works well but I can't see text labels on my map. On the other project, the same code works well and I see everything correctly.
John