Imports System.Collections.ObjectModel Imports System.Web.Mvc Imports ThinkGeo.MapSuite.Core Imports ThinkGeo.MapSuite.MvcEdition Namespace CSharp_HowDoISamples Public Partial Class InteractiveOverlaysController Inherits Controller ' ' GET: /DrawEditShapes/ Public Function DrawEditShapes() As ActionResult Return View() End Function _ Public Sub SaveMap(map As Map, args As GeoCollection(Of Object)) Dim features As Collection(Of Feature) = MapHelper.ConvertJsonToFeatures(args(0).ToString()) Dim dynamicOverlay As LayerOverlay = DirectCast(map.CustomOverlays("DynamicOverlay"), LayerOverlay) Dim msSqlFeatureLayer As MsSql2008FeatureLayer = DirectCast(dynamicOverlay.Layers("shapeLayer"), MsSql2008FeatureLayer) msSqlFeatureLayer.Open() For Each feature As Feature In features msSqlFeatureLayer.EditTools.BeginTransaction() msSqlFeatureLayer.EditTools.Update(feature) msSqlFeatureLayer.EditTools.CommitTransaction() Next If msSqlFeatureLayer.IsVisible = False Then msSqlFeatureLayer.IsVisible = True End If map.EditOverlay.Features.Clear() End Sub _ Public Function EditShape(map As Map, args As GeoCollection(Of Object)) As String Dim dynamicOverlay As LayerOverlay = DirectCast(map.CustomOverlays("DynamicOverlay"), LayerOverlay) Dim msSqlFeatureLayer As MsSql2008FeatureLayer = DirectCast(dynamicOverlay.Layers("shapeLayer"), MsSql2008FeatureLayer) msSqlFeatureLayer.Open() Dim features As Collection(Of Feature) = msSqlFeatureLayer.FeatureSource.GetFeaturesByIds(New Collection(Of String)() From { _ "10", _ "20", _ "30" _ }, ReturningColumnsType.NoColumns) If msSqlFeatureLayer.IsVisible = True Then msSqlFeatureLayer.IsVisible = False End If Dim featuresJson As String = MapHelper.ConvertFeaturesToJson(features) Return featuresJson End Function End Class End Namespace