Hello,
I am using a ShapeFileFeatureLayer "worldLayer" as shown in the code below.
I have to clear the "worldLayer" after its operation are performed in function called clear_click(). How to achieve this ??
load()
{
ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(filename);
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green));
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen.LineJoin = DrawingLineJoin.Round;
worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
LayerOverlay staticOverlay = new LayerOverlay();
staticOverlay.Layers.Add("WorldLayer", worldLayer);
winformsMap1.Overlays.Add(staticOverlay);
InMemoryFeatureLayer highlightLayer = new InMemoryFeatureLayer();
highlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
highlightLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(100, GeoColor.StandardColors.DarkGreen));
LayerOverlay highlightOverlay = new LayerOverlay();
highlightOverlay.Layers.Add("HighlightLayer", highlightLayer);
winformsMap1.Overlays.Add("HighlightOverlay", highlightOverlay);
winformsMap1.CurrentExtent = new RectangleShape(-165.7421875, 80.23046875, -35.6640625, 13.08203125);
winformsMap1.Refresh();
worldLayer.Open();
DataTable dataTable = worldLayer.QueryTools.ExecuteQuery("Select * from USStates Where PERIMETER > 30 Order by PERIMETER");
worldLayer.Close();
}
private void Result_SelectionChanged(object sender, EventArgs e)
{
FeatureLayer worldLayer = winformsMap1.FindFeatureLayer("WorldLayer");
InMemoryFeatureLayer highlightLayer = (InMemoryFeatureLayer)winformsMap1.FindFeatureLayer("HighlightLayer");
and some other operations are performed here....
winformsMap1.Refresh(winformsMap1.Overlays["HighlightOverlay"]);
}