ThinkGeo.com    |     Documentation    |     Premium Support

Custom point styles

I’m trying to override the DrawCore function in a class that inherits from PointStyle. Basically I’m looping the features in that DrawCore and doing some calculations to create a circle around the point feature. But how do I actually draw the point at the end?

For example, I see canvas.DrawText and canvas.DrawImage, etc., but what do I use just for a normal point using this style?

Hi Dan,

You can modify the feature collection, and pass the modified collection as parameter to base.DrawCore(features,xxx).

It should works I think.

Regards,

Ethan

Do you mean I modify the feature collection in my overriden DrawCore function and then call base.DrawCore? Maybe you have an example handy for something like this: A normal point style, but a circle drawn around it using an inherited pointstyle class and overriding the DrawCore function.

Hi Dan,

I double check your requirement, and found you don’t need to write a custom point style for it.

You can just implement that like this:

            layer1.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColors.Green, 18));
        layer1.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColors.Transparent, 25, GeoColors.Red, 3));
        layer1.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

And it looks like:

You can adjust the size to make it follow your need.

Wish that’s helpful.

Regards,

Ethan

My custom point styles are more complex than that and each feature might be a different style. For example, I might have a feature that has a half-circle that rotates with the feature or maybe a line coming out of the feature at a certain angle. I do all these calculations in an overridden drawcore function in my custom point style.

Hi Dan,

Thanks to let me know more detail about that, here is a sample about how to implement the custom style, and you can write logic you want follow your requirement.

9535.zip (101.7 KB)

Wish that’s helpful.

Regards,

Ethan