I testing with your sample code in page name : DrawEditShape
this code :
public partial class DrawEditShapes : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
Map1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF"));
Map1.CurrentExtent = new RectangleShape(10836250.0472719, 2328225.56066376, 11759466.9830867, 625833.622052803);
Map1.MapUnit = GeographyUnit.Meter;
WorldMapKitWmsWebOverlay worldMapKitWmsWebOverlay = new WorldMapKitWmsWebOverlay("WorldMapKitOverlay");
worldMapKitWmsWebOverlay.Projection = WorldMapKitProjection.SphericalMercator;
//Map1.CustomOverlays.Add(worldMapKitWmsWebOverlay);
BingMapsOverlay bing = new BingMapsOverlay("Bing Map");
bing.JavaScriptLibraryUri = new Uri(ConfigurationManager.AppSettings["VEUri"]);
bing.MapType = ThinkGeo.MapSuite.WebEdition.BingMapsStyle.BirdseyeHybrid;
//Map1.CustomOverlays.Add(bing);
GoogleOverlay google = new GoogleOverlay("Google Map");
google.GoogleMapType = GoogleMapType.Normal;
google.JavaScriptLibraryUri = new Uri(ConfigurationManager.AppSettings["GoogleUriV3"]);
Map1.CustomOverlays.Add(google);
OpenStreetMapOverlay osmOverlay = new OpenStreetMapOverlay("Open Street Map");
//Map1.CustomOverlays.Add(osmOverlay);
WmsOverlay wms = new WmsOverlay("WMS Overlay");
wms.Parameters.Add("layers", "Countries02,USSTATES,USMAJORCITIES");
wms.Parameters.Add("STYLE", "SIMPLE");
wms.ServerUris.Add(new Uri("wmssamples.thinkgeo.com/WmsServer.aspx"));
wms.SetBaseEpsgProjection("EPSG:900913");
//Map1.CustomOverlays.Add(wms);
YahooOverlay yahoo = new YahooOverlay("Yahoo Map");
yahoo.YahooMapType = YahooMapType.Regular;
yahoo.JavaScriptLibraryUri = new Uri(ConfigurationManager.AppSettings["YahooUri"]);
//Map1.CustomOverlays.Add(yahoo);
InMemoryFeatureLayer shapeLayer = new InMemoryFeatureLayer();
shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(180, 102, 255, 102), 10, GeoColor.StandardColors.DarkGreen, 1);
shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Green, 4, true);
shapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(180, 102, 255, 102), GeoColor.StandardColors.DarkGreen, 1);
shapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
shapeLayer.DrawingQuality = DrawingQuality.HighQuality;
LayerOverlay dynamicOverlay = new LayerOverlay("DynamicOverlay");
dynamicOverlay.IsBaseOverlay = false;
dynamicOverlay.TileType = TileType.SingleTile;
dynamicOverlay.Layers.Add("shapeLayer", shapeLayer);
Map1.CustomOverlays.Add(dynamicOverlay);
Map1.MapTools.OverlaySwitcher.Enabled = true;
}
}
protected void buttonSubmit_Click(object sender, ImageClickEventArgs e)
{
LayerOverlay dynamicOverlay = (LayerOverlay)Map1.CustomOverlays["DynamicOverlay"];
InMemoryFeatureLayer shapeLayer = (InMemoryFeatureLayer)dynamicOverlay.Layers["shapeLayer"];
foreach (Feature feature in Map1.EditOverlay.Features)
{
if (!shapeLayer.InternalFeatures.Contains(feature.Id))
{
shapeLayer.InternalFeatures.Add(feature.Id, feature);
}
}
Map1.EditOverlay.Features.Clear();
Map1.EditOverlay.TrackMode = TrackMode.None;
dynamicOverlay.Redraw();
}
protected void buttonEditShape_Click(object sender, ImageClickEventArgs e)
{
LayerOverlay dynamicOverlay = (LayerOverlay)Map1.CustomOverlays["DynamicOverlay"];
InMemoryFeatureLayer shapeLayer = (InMemoryFeatureLayer)dynamicOverlay.Layers["shapeLayer"];
foreach (Feature feature in shapeLayer.InternalFeatures)
{
Map1.EditOverlay.Features.Add(feature.Id, feature);
}
shapeLayer.InternalFeatures.Clear();
Map1.EditOverlay.TrackMode = TrackMode.Edit;
dynamicOverlay.Redraw();
}
protected void Map1_TrackShapeFinished(object sender, EventArgs e)
{
LayerOverlay dynamicOverlay = (LayerOverlay)Map1.CustomOverlays["DynamicOverlay"];
InMemoryFeatureLayer shapeLayer = (InMemoryFeatureLayer)dynamicOverlay.Layers["shapeLayer"];
foreach (Feature feature in Map1.EditOverlay.Features)
{
var a = feature.GetWellKnownText();
shapeLayer.InternalFeatures.Add(feature.Id, feature);
}
Map1.EditOverlay.Features.Clear();
dynamicOverlay.Redraw();
}
}
I draw feature and add to inmemory feature, then I resize window I get this error.
Update :
I test by add Map_Click event.
then, I Click on map.
and next, I get same error