I’m doing some work in overriden DrawCore() functions in some custom point style classes. The features using these styles are custom classes which inherit from Feature. However, in the DrawCore() functions, these features lose their derived type and are just Feature. Is there anything in particular that can cause this? The layer they are added to is just an InMemoryFeatureLayer, and are being added via the InternalFeatures.Add function, with a .BuildIndex() called after the .Add.
Looking at the InternalFeatures, I can confirm they are the derived type.
I am also overriding the DrawCore of that particular layer, if it matters. In the layer’s DrawCore, I’m simply doing a canvas.DrawLine, and then calling base.DrawCore(canvas, labelsInAllLayers); which leads to the style’s DrawCore function eventually.
Here’s what I can see in the stack trace:
In Style.cs, in the public void Draw( function, the features at this point are showing as the base Feature type.
I’m guessing somewhere along the line it’s using the layer’s projection converter. When I use ConvertToExternalProjection on a derived type, it always returns the base Feature type.