ThinkGeo.com    |     Documentation    |     Premium Support

PointShape Zooming

I’m trying to display a PointShape (PointSymbolType.Circle) at a specified Lat/Lon. This works fine, but what I want is to NOT have the circle shrink as I zoom in. I want the radius to stay constant (n meters from center). How can I accomplish this?

Hi Ryan,



We can define a custom point style to achieve this:


public class CustomPointStyle : PointStyle
    {
        public CustomPointStyle (PointSymbolType symbolType, GeoSolidBrush symbolSolidBrush, GeoPen symbolPen, int symbolSize)
            base(symbolType, symbolSolidBrush, symbolPen, symbolSize)
        {
        }
        protected override void DrawCore(IEnumerable<Feature> features, GeoCanvas canvas, Collection<SimpleCandidate> labelsInThisLayer, Collection<SimpleCandidate> labelsInAllLayers)
        {
            Collection<ZoomLevel> zoomLevels = (new ZoomLevelSet()).GetZoomLevels();
            int zoomLevelNumber = 0;
            for (int i = 1; i <= zoomLevels.Count; i++)
            {
                if (zoomLevels<i>.Scale == canvas.CurrentScale)
                {
                    zoomLevelNumber = i;
                    break;
                }
            }
            this.SymbolSize = this.SymboSize* zoomLevelNumber;
            base.DrawCore(features, canvas, labelsInThisLayer, labelsInAllLayers);
        }
    }

Hope it works for you.

Regards,

Troy