Hello again,
I am working on implementing dynamic segmentation in our application and have successfully used the ThinkGeo code example to get part of it working. However, in addition to applying a different style along the length of a line I would like to label each of the sections according to the style, say 'Asphalt', 'Gravel', 'Concrete'.
I have inherited from the ShapefileFeatureLayer and overriden the DrawCore function. I can successfully use the Draw method on LineStyles, but it does not work for me with TextStyles, no text ever appears on the map.
Here is a brief code snippet:
For Each oRow As DataRow In oRows
dStartDistance = CType(oRow("DistanceFrom"), Double)
dDistance = CType(oRow("DistanceTo"), Double) - dStartDistance
Dim oSegmentLineShape As LineBaseShape = LineShape.GetLineOnALine(
StartingPoint.FirstPoint,
dStartDistance,
dDistance,
GeographyUnit.Meter,
DistanceUnit.Meter)
oShapes.Clear()
oShapes.Add(oSegmentLineShape)
Select Case oRow("Description").ToString
Case "Asphalt"
AsphaltSym.Draw(oShapes, canvas, labelsInAllLayers, labelsInAllLayers)
oTextStyle.TextColumnName = "Asphalt"
Case "Gravel"
GravelSym.Draw(oShapes, canvas, labelsInAllLayers, labelsInAllLayers)
oTextStyle.TextColumnName = "Gravel"
Case "Concrete"
ConcreteSym.Draw(oShapes, canvas, labelsInAllLayers, labelsInAllLayers)
oTextStyle.TextColumnName = "Concrete"
End Select
oTextStyle.Draw(oShapes, canvas, labelsInAllLayers, labelsInAllLayers)
Next oRow
I have attached a sample project to demonstrate the problem I am having.
Thanks!
Steve
DynamicSegmentationDemo.zip (23.5 KB)