ThinkGeo.com    |     Documentation    |     Premium Support

Moveable Label - Change Label Orientation

Using ThinkGeo Version 10.

In our latest production release, we have implemented Moveable Label code provided by ThinkGeo. All is working well. Users are able to change label position, anchor line length, and anchor point.

Users are now requesting to be able to dynamically change label orientation from horizontal to vertical, while keeping shape position adjustment handle functions the same.

Attached is a screen shot showing a moveable label in edit mode. Label is displayed horizontally. User wants to be able to change display position to vertical, including text within label.

Is this feasible? If so, please provide code sample.

For reference, I have also uploaded moveable label code provided by ThinkGeo.

Thank You,
Rudolph

MoveableLabelInteractiveOverlay.vb (663 Bytes) MoveableLableStyle.vb (7.0 KB)

Thanks RudoIph,
Yes. This is possible by set the RotationAngle = 90 or 270

Here is the code.

Public Sub MoveableLabelStyle(textColumnName As String)
        Me.TextColumnName = textColumnName

        Dim oGC As New GeoColor(175, GeoColor.StandardColors.White)

        Dim fontStyles As New DrawingFontStyles
        fontStyles = DrawingFontStyles.Regular
        Me.Font = New GeoFont("Arial", 8, fontStyles)
        Me.RotationAngle = 90 // Or 270

        Me.PointPlacement = PointPlacement.Center
        Me.DuplicateRule = LabelDuplicateRule.UnlimitedDuplicateLabels
        Me.OverlappingRule = LabelOverlappingRule.AllowOverlapping
        'Me.Mask = AreaStyles.CreateSimpleAreaStyle(GeoColors.White, GeoColor.SimpleColors.Black, 2)
        Me.Mask = AreaStyles.CreateSimpleAreaStyle(oGC, GeoColor.SimpleColors.Black, 2)
        Me.MaskType = MaskType.RoundedCorners
        Me.MaskMargin = 3
        Me.LeaderLineStyle = New LineStyle(New GeoPen(GeoColor.SimpleColors.Black, 2))
    End Sub

Thanks

Frank

Thanks Frank for the input.

I’m considering giving the user the ability to change label orientation dynamically in label position edit mode.

One way I thought about would be to capture a combination of keyboard keystroke and mouse click. For instance, positioning cursor over label, hold the Shift Key down, and click Left Mouse button. Each click would rotate the label between 0, 90, and 270 degrees. With each mouse click I would have to apply the appropriate rotational angle style.

Do you have any suggestions / recommendations regarding my proposed solution? Or alternative solution.

Thank You,
Rudolph

Thanks RudoIph,
Yes. You could either have some button or use the mouse/keyboard event to handle this. as as following code.

 Private Sub btnIncrease_Click(sender As Object, e As EventArgs) Handles btnIncrease.Click
        CType(gMap.EditOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.CustomStyles(0), MoveableLableStyle).AddAngle(5)
        gMap.Refresh()
    End Sub

    Private Sub btnDecrease_Click(sender As Object, e As EventArgs) Handles btnDecrease.Click
        CType(gMap.EditOverlay.EditShapesLayer.ZoomLevelSet.ZoomLevel01.CustomStyles(0), MoveableLableStyle).AddAngle(-5)
        gMap.Refresh()
    End Sub

Public Sub AddAngle(ByVal mStep As Integer)
        Me.RotationAngle = Me.RotationAngle + mStep
    End Sub

Thanks

Frank