I develop an application using Vb and Mapsuite 10 for WPF.
I have created 2 classes that inherit TextStyle and PointStyle. The problem is that the mask of the textstyle is always below the image of the pointstyle and on the other hand the text of the textstyle is always above the image.
Etc.
The custom classes are below
Public Class PxPointStyle
Inherits PointStyle
Dim iconpath As String
Public Sub New()
MyBase.New()
End Sub
Protected Overrides Function GetRequiredColumnNamesCore() As Collection(Of String)
Dim columns As Collection(Of String) = New Collection(Of String)()
columns.Add("VehicleImage")
Return columns
End Function
Protected Overrides Sub DrawCore(ByVal features As IEnumerable(Of Feature), ByVal canvas As GeoCanvas, ByVal labelsInThisLayer As Collection(Of SimpleCandidate), ByVal labelsInAllLayers As Collection(Of SimpleCandidate))
For Each feature As Feature In features
Dim vehicleImagePath As String = feature.ColumnValues("VehicleImage")
Dim location As PointShape = CType(feature.GetShape(), PointShape)
canvas.DrawWorldImageWithoutScaling(New GeoImage(vehicleImagePath), location.X, location.Y, DrawingLevel.LevelFour, 0, 0, angle)
Next
End Sub
End Class
Public Class PxTextStyle
Inherits TextStyle
Dim areastyle As Boolean
Dim Type As String
Public Sub New(type As String, column As String, xoffset As Integer, yoffset As Integer, areastyle As Boolean, color As GeoSolidBrush)
Me.Type = type
Me.areastyle = areastyle
Me.TextColumnName = column
Me.Font = New GeoFont("Arial ", 7.5, DrawingFontStyles.Bold)
Me.TextSolidBrush = color
Me.XOffsetInPixel = xoffset
Me.YOffsetInPixel = yoffset
Me.Mask = OnCreateMask()
Me.MaskType = ThinkGeo.MapSuite.Styles.MaskType.RoundedCorners
Me.DuplicateRule = ThinkGeo.MapSuite.Styles.LabelDuplicateRule.NoDuplicateLabels
If type = "Vehicle" Then
Me.BestPlacement = True
Me.PointPlacement = ThinkGeo.MapSuite.Styles.PointPlacement.UpperRight
Me.OverlappingRule = ThinkGeo.MapSuite.Styles.LabelOverlappingRule.NoOverlapping
Else
Me.BestPlacement = False
Me.PointPlacement = ThinkGeo.MapSuite.Styles.PointPlacement.Center
Me.OverlappingRule = ThinkGeo.MapSuite.Styles.LabelOverlappingRule.AllowOverlapping
End If
End Sub
Public Overridable Function OnCreateMask() As AreaStyle
If areastyle Then
Dim aStyle As ThinkGeo.MapSuite.Styles.AreaStyle = New ThinkGeo.MapSuite.Styles.AreaStyle
aStyle.FillSolidBrush = New GeoSolidBrush(GeoColor.FromArgb(255, 255, 255, 255))
aStyle.OutlinePen = New GeoPen(GeoColor.StandardColors.Gray, 1.0)
Return aStyle
Else
Return Nothing
End If
End Function
Protected Overrides Sub DrawCore(features As IEnumerable(Of Feature), canvas As GeoCanvas, labelsInThisLayer As Collection(Of SimpleCandidate), labelsInAllLayers As Collection(Of SimpleCandidate))
Try
If Type = "Vehicle" Then
Dim drawn_features = features.ToList.FindAll(Function(f As Feature) DirectCast(f.Tag, PxVehicle).Draw And DirectCast(f.Tag, PxVehicle).Focus).AsEnumerable
MyBase.DrawCore(drawn_features, canvas, labelsInThisLayer, labelsInAllLayers)
Else
MyBase.DrawCore(features, canvas, labelsInThisLayer, labelsInAllLayers)
End If
Catch ex As Exception
RadMessageBox.Show(ex.Message, projectName & " Information", MessageBoxButtons.OK, RadMessageIcon.Error)
errLog.WriteLog(ex.Message.ToString, Me.Name, System.Reflection.MethodBase.GetCurrentMethod().Name.ToString())
End Try
End Sub
End Class