showing customized markers on map

Oct 29, 2008 at 5:52 PM
Hello,

Good work, putting together such an easy to use control. I just downloaded and checked out ver "16684" ... works great!
However, I want to know that is it possible to create databound markers on the map? Supposedly yes, well then how do I make them appear only when I zoom in to a certain zoom level. Can you give me some hints so that I can start exploring in that direction.

Thanks.
Developer
Oct 30, 2008 at 1:31 AM
This is properly not the best way to do it...? the other guys may have a better method...
but... this is a quick and easy way

first I add the MaxZoomLevel & MinZoomLevel valuse to the shape layer when I add it to the map...
e.g. in the "GeoServices.xaml control" in the Prototype sample project

        private void AddPolygon_Click(object sender, RoutedEventArgs e)

        {

            //Sample Polygon added to the map

            if (shapeLayer == null)

            {

                shapeLayer = new ShapeLayer { ID = "POLYGONLAYER", MaxZoomLevel=7, MinZoomLevel = 2};

                MapControl.Layers.Add(shapeLayer);

            }

            var points = new List<Point> { new Point(0, 0), new Point(20, 0), new Point(20, 20), new Point(0, 20) };

            var polygon = new DeepEarth.Polygon { Points = points };

            shapeLayer.List.Add(polygon);

        }

<!--EndFragment-->

then in the "DeepEarth" Project in the "Layer" class, I just added this little test in the ZoomLevel in the "IsVisible" Property

        public bool IsVisible

        {

            get

            {

                if (Map.ZoomLevel < this.MinZoomLevel || Map.ZoomLevel > this.MaxZoomLevel)

                {

                    return false;

                }

                return isVisible;

            }

            set

            {

                if (isVisible != value)

                {

                    isVisible = value;

                    OnIsVisibleChanged();

                    OnPropertyChanged(new PropertyChangedEventArgs("IsVisible"));

                }

            }

        }

<!--EndFragment-->
the bits of code I added are in Bold + Italics and I only tested it on the "Add Polygon" button/shape in the GeoServices.xaml control, but it is a "ShapeLayer" so I assume it will work ok, atleast untill someone offers a better solution or the "Layer" class MaxZoomLevel and MinZoomLevel properties are hooked up/implemented into the control, they seem to just be properties right now.
Nov 1, 2008 at 5:38 AM
hi! thanks for the reply, ill code to try it out today. Appreciate your help.
BTW, can we setup the "prototype project" (DeepEarthPrototype) to use OSM instead of VE?
Developer
Nov 2, 2008 at 11:37 AM
There is an OSM project already in the source under the 'Examples' folder. Does that not work for you?