Hi Don,
I have 2 layers (Load using WmsOverlay), I set the second layer isVisible = false.
When I check to choose the second layer on OverlaySwitcher, the second layer is displayed but it overlaps the first layer. I have some layers used InMemoryFeatureLayer which are contained on Overlay of OverlaySwitcher and they don’t overlay any layers.
=> How can i treat the second layer as InMemoryFeatureLayer ???
This my source:
public static void AddBasedMap(Map map)
{
map.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#B3C6D4"));
map.MapUnit = GeographyUnit.DecimalDegree;
map.MapTools.MouseCoordinate.Enabled = true;
map.MapTools.MouseCoordinate.MouseCoordinateType = MouseCoordinateType.DegreesMinutesSecondsLatitudeLongitude;
map.MapTools.MouseMapTool.Enabled = true;
map.MapTools.ScaleLine.Enabled = true;
map.MapTools.PanZoomBar.Enabled = false;
map.MapTools.PanZoom.Enabled = true;
map.MapTools.AnimationPanMapTool.Enabled = false;
map.MapTools.Logo.Enabled = false;
map.MapTools.LoadingImage.Enabled = true;
map.MapTools.LoadingImage.Width = 105;
map.MapTools.LoadingImage.Height = 16;
map.MapTools.LoadingImage.ImageUri = new Uri(new Uri(HttpContext.Current.Request.Url.AbsoluteUri), “loading.gif”);
map.MapTools.OverlaySwitcher.Enabled = true;
WmsOverlay wmsOverlay = new WmsOverlay(“NYC”, new Uri(“192.168.1.203:8781/geoserver/wms”));
wmsOverlay.Parameters.Add(“LAYERS”, “BanDoNen”);
//wmsOverlay.IsVisible = true;
wmsOverlay.IsBaseOverlay = true;
wmsOverlay.IsVisibleInOverlaySwitcher = false;
map.CustomOverlays.Add(wmsOverlay);
WmsOverlay wmsOverlay1 = new WmsOverlay(“Block”, new Uri(“192.168.1.203:8781/geoserver/elcomWS/wms”));
wmsOverlay1.Parameters.Add(“LAYERS”, “elcomWS:Blocks”);
wmsOverlay1.IsBaseOverlay = false;
wmsOverlay1.IsVisibleInOverlaySwitcher = true;
wmsOverlay1.IsVisible = false;
map.CustomOverlays.Add(wmsOverlay1);
}
protected void AddAreaLayer(Map map) {
InMemoryFeatureLayer shapeFeatureLayer = new InMemoryFeatureLayer();
shapeFeatureLayer.FeatureSource.Open();
shapeFeatureLayer.Columns.Add(new FeatureSourceColumn(AREA_ID_PROPERTY_NAME));
shapeFeatureLayer.Columns.Add(new FeatureSourceColumn(AREA_NAME_PROPERTY_NAME));
shapeFeatureLayer.DrawingQuality = DrawingQuality.HighQuality;
InMemoryFeatureLayer labelFeatureLayer = new InMemoryFeatureLayer();
labelFeatureLayer.FeatureSource.Open();
labelFeatureLayer.Columns.Add(new FeatureSourceColumn(AREA_ID_PROPERTY_NAME));
labelFeatureLayer.Columns.Add(new FeatureSourceColumn(AREA_NAME_PROPERTY_NAME));
labelFeatureLayer.DrawingQuality = DrawingQuality.HighQuality;
ValueStyle shapeValueStyle = new ValueStyle();
shapeValueStyle.ColumnName = AREA_ID_PROPERTY_NAME;
shapeFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(shapeValueStyle);
shapeFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
ValueStyle labelValueStyle = new ValueStyle();
labelValueStyle.ColumnName = AREA_ID_PROPERTY_NAME;
labelFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(labelValueStyle);
labelFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
//labelFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle(AREA_NAME_PROPERTY_NAME, “Verdana”, 10, ThinkGeo.MapSuite.Core.DrawingFontStyles.Bold, GeoColor.StandardColors.Gray, 10, 0);
//labelFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
shapeFeatureLayer.FeatureSource.Close();
labelFeatureLayer.FeatureSource.Close();
LayerOverlay areaLayerOverlay = new LayerOverlay(AREA_LAYER_OVERLAY_NAME);
areaLayerOverlay.Layers.Add(SHAPE_FEATURE_LAYER_NAME, shapeFeatureLayer);
areaLayerOverlay.Layers.Add(LABEL_FEATURE_LAYER_NAME, labelFeatureLayer);
areaLayerOverlay.IsBaseOverlay = false;
map.CustomOverlays.Add(areaLayerOverlay);
}
Hope you can understand my question!!!
Thanhks.