ServerSide: using System; using System.Web.Mvc; using ThinkGeo.MapSuite.Core; using ThinkGeo.MapSuite.MvcEdition; namespace CSharp_HowDoISamples { public partial class InteractiveMapController : Controller { // // GET: /AddAClickEvent/ public ActionResult AddAClickEvent() { Map map = new Map("Map1", new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), 510); map.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF")); map.CurrentExtent = new RectangleShape(-125, 72, 50, -46); map.MapUnit = GeographyUnit.DecimalDegree; WorldMapKitWmsWebOverlay worldMapKitOverlay = new WorldMapKitWmsWebOverlay("WorldMapKitOverlay"); map.CustomOverlays.Add(worldMapKitOverlay); InMemoryMarkerOverlay markerOverlay = new InMemoryMarkerOverlay("MarkerOverlay"); markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage.ImageWidth = 21; markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage.ImageHeight = 25; markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage.ImageOffsetX = -10.5f; markerOverlay.ZoomLevelSet.ZoomLevel01.DefaultMarkerStyle.WebImage.ImageOffsetY = -25f; markerOverlay.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; FeatureLayer layer = new ShapeFileFeatureLayer(Server.MapPath("~/App_Data/STATES.SHP")); layer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(100, 212, 220, 184), GeoColor.FromArgb(255, 132, 132, 154), 1); layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay layo = new LayerOverlay("la"); layo.Layers.Add(layer); map.CustomOverlays.Add(layo); return View(map); } [MapActionFilter] public void ClickEvent(Map map, GeoCollection args) { ShapeFileFeatureLayer shpLayer = (map.CustomOverlays["la"] as LayerOverlay).Layers[0] as ShapeFileFeatureLayer; var overlay = map.CustomOverlays[1]; shpLayer.Open(); shpLayer.FeatureSource.Open(); for (int i = 0; i < 1000; i++) { shpLayer.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns); } shpLayer.FeatureSource.Close(); shpLayer.Close(); } [MapActionFilter] public void ClickEvent1(Map map, GeoCollection args) { ShapeFileFeatureLayer shpLayer = (map.CustomOverlays["la"] as LayerOverlay).Layers[0] as ShapeFileFeatureLayer; shpLayer.Open(); shpLayer.FeatureSource.Open(); for (int i = 0; i < 1000; i++) { shpLayer.FeatureSource.GetAllFeatures(ReturningColumnsType.AllColumns); } shpLayer.FeatureSource.Close(); shpLayer.Close(); } } } ClientSide: @using ThinkGeo.MapSuite.Core; @using ThinkGeo.MapSuite.MvcEdition; @model ThinkGeo.MapSuite.MvcEdition.Map
@{ Html.ThinkGeo().Map(Model).Render(); }