Hello,
I need to show the zip codes group by my "sales area". I need to show the sales areas in different color and I also need to show the name of sales area.
So, I added a custom column "SALES_AREA" (still working on it) with will have multiple zip codes.
Following code works - to show the red color for the AreaStyle for a sales area.
ShapeFileFeatureLayer saLayer = new ShapeFileFeatureLayer(@"C:\temp\WebSites\ThinkGeo\Data\NJ\tl_2010_34_zcta510.shp", @"C:\temp\WebSites\ThinkGeo\Data\NJ\tl_2010_34_zcta510.idx");
ValueStyle valueStyle = new ValueStyle();
valueStyle.ColumnName = "SALES_AREA";
valueStyle.ValueItems.Add(new ValueItem("SALES_AREA10", new AreaStyle(new GeoSolidBrush(GeoColor.StandardColors.Red))));
saLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(valueStyle);
saLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;//20 is zoomest
//saLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("SALES_AREA", "Arial", 8, DrawingFontStyles.Italic, GeoColor.StandardColors.Black, 3, 3);
LayerOverlay salesareaOverlay = new LayerOverlay();
salesareaOverlay.Layers.Add("saLayer", saLayer);
salesareaOverlay.IsBaseOverlay = false;
Map1.CustomOverlays.Add(salesareaOverlay);
saLayer.FeatureSource.CustomColumnFetch += new EventHandler<CustomColumnFetchEventArgs>(FeatureSource_CustomColumnFetch);
To be able to see the sales area name, I uncommented a line as below.
ShapeFileFeatureLayer saLayer = new ShapeFileFeatureLayer(@"C:\temp\WebSites\ThinkGeo\Data\NJ\tl_2010_34_zcta510.shp", @"C:\temp\WebSites\ThinkGeo\Data\NJ\tl_2010_34_zcta510.idx");
ValueStyle valueStyle = new ValueStyle();
valueStyle.ColumnName = "SALES_AREA";
valueStyle.ValueItems.Add(new ValueItem("SALES_AREA10", new AreaStyle(new GeoSolidBrush(GeoColor.StandardColors.Red))));
saLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(valueStyle);
saLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;//20 is zoomest
saLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("SALES_AREA", "Arial", 8, DrawingFontStyles.Italic, GeoColor.StandardColors.Black, 3, 3);
LayerOverlay salesareaOverlay = new LayerOverlay();
salesareaOverlay.Layers.Add("saLayer", saLayer);
salesareaOverlay.IsBaseOverlay = false;
Map1.CustomOverlays.Add(salesareaOverlay);
saLayer.FeatureSource.CustomColumnFetch += new EventHandler<CustomColumnFetchEventArgs>(FeatureSource_CustomColumnFetch);
And I got error saying 'You are trying to use both a default style and the custom style..'.
I believe you have a way to show the custom text styles.
Can you please advise?
Thank you
shwe