ThinkGeo.com    |     Documentation    |     Premium Support

Different default styles and types

I have a question that should be simple, but I am having trouble implementing.



Basically, we have a number of polygon’s that we want to show on the map at a given time.  we would like the polygon’s to show up on zoom level 12-20, but if the user is in zoom level 1-11 then we want push pin’s to show up instead of the polygons.  I have the following code setup, and it will start showing the polygon’s at level 12, but before that it does not show the pins.  



thank you for your help.



       // other stuff



        private void CreateProposalOverlay()


        {
            var proposalLayer = new InMemoryFeatureLayer();
            proposalLayer.ZoomLevelSet = new GoogleMapsZoomLevelSet();
            proposalLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            var proposalStyle = new AreaStyle
            {
                OutlinePen = new GeoPen(GeoColor.FromArgb(100, 0, 255, 0), FEATURE_LINE_WIDTH),
                FillSolidBrush = new GeoSolidBrush(GeoColor.FromArgb(30, 0, 255, 0))
            };
            proposalLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = proposalStyle;



            var proposalsLayer = new InMemoryFeatureLayer();
            var proposalsPointLayer = new InMemoryFeatureLayer();



            proposalsLayer.ZoomLevelSet = new GoogleMapsZoomLevelSet();
            proposalsPointLayer.ZoomLevelSet = new GoogleMapsZoomLevelSet();



            proposalsLayer.ZoomLevelSet.ZoomLevel12.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
            proposalsPointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;



            var proposalsStyle = new AreaStyle
            {
                OutlinePen = new GeoPen(GeoColor.FromArgb(100, 0, 255, 0), FEATURE_LINE_WIDTH),
                FillSolidBrush = new GeoSolidBrush(GeoColor.FromArgb(30, 0, 255, 0))
            };
            var proposalsPointStyle = new PointStyle
            {
                PointType = PointType.Symbol,
                SymbolType = PointSymbolType.Diamond,
                SymbolSize = 10,
                SymbolPen = new GeoPen(GeoColor.StandardColors.Red)
            };
            proposalsPointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = proposalsPointStyle;
            proposalsPointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;



            proposalsLayer.ZoomLevelSet.ZoomLevel12.DefaultAreaStyle = proposalsStyle;
            proposalsLayer.ZoomLevelSet.ZoomLevel12.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;



            var overlay = new LayerOverlay();
            overlay.Layers.Add(PROPOSAL_LAYER, proposalLayer);
            overlay.Layers.Add(PROPOSALS_LAYER, proposalsLayer);
            wpfMap1.Overlays.Add(PROPOSAL_OVERLAY, overlay);



            var pointOverlay = new LayerOverlay();
            pointOverlay.Layers.Add(“proposalsPointLayer”, proposalsPointLayer);
            wpfMap1.Overlays.Add(“proposalsPointOverlay”, pointOverlay);
        }



       // other stuff

        private void LoadProposals()
        {
            var proposalService = RxApp.DependencyResolver.GetService<IProposalService>();
            var proposalResult = proposalService.GetProposals();



            var overlay = wpfMap1.Overlays[PROPOSAL_OVERLAY] as LayerOverlay;
            var pointOverlay = wpfMap1.Overlays[“proposalsPointOverlay”] as LayerOverlay;



            var layer = overlay.Layers[PROPOSALS_LAYER] as InMemoryFeatureLayer;
            var pointLayer = pointOverlay.Layers[“proposalsPointLayer”] as InMemoryFeatureLayer;



            foreach (var proposal in proposalResult.Data)
            {
                var color = System.Drawing.Color.FromName(proposal.ColorOptionsValue);
                var geoColor = GeoColor.FromArgb(100, color.R, color.G, color.B);



                var style = new AreaStyle
                {
                    FillSolidBrush = new GeoSolidBrush(GeoColor.FromArgb(40, geoColor)),
                    OutlinePen = new GeoPen(GeoColor.FromArgb(100, geoColor), FEATURE_LINE_WIDTH)
                };



                var pointStyle = new PointStyle
                {
                    PointType = PointType.Symbol,
                    SymbolType = PointSymbolType.Diamond,
                    SymbolPen = new GeoPen(geoColor),
                    SymbolSize = 50
                };



                pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = pointStyle;
                pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;



                layer.ZoomLevelSet.ZoomLevel12.DefaultAreaStyle = style;
                layer.ZoomLevelSet.ZoomLevel12.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;



                var feature = Feature.CreateFeatureFromWellKnownData(proposal.MasterZone.Geometry.WellKnownText as string);



                layer.InternalFeatures.Add(feature);
                pointLayer.InternalFeatures.Add(feature);
            }
            var extent = layer.GetBoundingBox();
            wpfMap1.CurrentExtent = extent;
            wpfMap1.Refresh();
        }




Hi Scott, 
  
 Would you please try to replace: 
   
       var pointStyle = new PointStyle 
                 { 
                     PointType = PointType.Symbol, 
                     SymbolType = PointSymbolType.Diamond, 
                     SymbolPen = new GeoPen(geoColor), 
                     SymbolSize = 50 
                 }; 
 With: 
       var pointStyle = new PointStyle 
                 { 
                     PointType = PointType.Symbol, 
                     SymbolType = PointSymbolType.Diamond, 
                     SymbolSolidBrush= new GeoPen(geoColor), 
                     SymbolSize = 50 
                 }; 
 Now it should work. If you have any more question , please feel free to let us know. 
  
 Best Regards 
  
 Summer 


that still didn’t help, the point won’t show up at the zoom level it is supposed to, though the polygon is shutting off at that point.

It of course will work if i set different area styles at various zoom levels.  the issues comes when i try to do a pointstyle at one and an area style at the other.  it’s almost like it doesn’t know it is supposed to switch to points at zoom levels 1-11.

Hi Scott, 


We tried to recreate your problem, but it didn't show up, following is a test vedio on our end for your information: screencast.com/t/XUS3Sg2s7O7W , attached is the test code on our end, would you please check if there are anything we missed?


Waiting for your further information.


Best Regards


Summer



Post11568.txt (949 Bytes)