OK, finally i found the solution, which is a bit confusing to me ;-)
The problem was that we created our LineString features from code like this:
featureSet.AddFeature(new Feature(FeatureType.Line, coordinates));
instead of:
featureSet.AddFeature(new LineString(coordinates));
One would expect the result to be the same but it is not, now in the MapLabelLayer.PlaceLineLabel() method the first statement uses:
Geometry.FromBasicGeometry(lineString)
which unexpectedly converts it into a MultiLineString geometry and there it stops because this cannot be cast to ILineString
I suppose we could adapt the labeling code to work for MultiLineString features as well, but i would say there is a more fundamental issue here in the way the Geometry.FromBasicGeometry() method converts the LineString back to a MultiLineString unexpectedly ?
I am not sure how i could fix that, and i am running out of time in the project i am working on.
Kudos to you Jany, even for a linestring which twists and bends along a river the labeling works well enough for us now !
The problem was that we created our LineString features from code like this:
featureSet.AddFeature(new Feature(FeatureType.Line, coordinates));
instead of:
featureSet.AddFeature(new LineString(coordinates));
One would expect the result to be the same but it is not, now in the MapLabelLayer.PlaceLineLabel() method the first statement uses:
Geometry.FromBasicGeometry(lineString)
which unexpectedly converts it into a MultiLineString geometry and there it stops because this cannot be cast to ILineString
I suppose we could adapt the labeling code to work for MultiLineString features as well, but i would say there is a more fundamental issue here in the way the Geometry.FromBasicGeometry() method converts the LineString back to a MultiLineString unexpectedly ?
I am not sure how i could fix that, and i am running out of time in the project i am working on.
Kudos to you Jany, even for a linestring which twists and bends along a river the labeling works well enough for us now !