using System; using System.Configuration; using System.Data; using System.Linq; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Xml.Linq; using System.IO; using ThinkGeo.MapSuite.Core; using ThinkGeo.MapSuite.WebEdition; using System.Collections.Generic; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Map1.MapUnit = GeographyUnit.DecimalDegree; ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\CSharpSamples\World\cntry02.shp"); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1; worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay layerOverlay = new LayerOverlay("StaticOverlay"); layerOverlay.Layers.Add(worldLayer); Map1.CustomOverlays.Add(layerOverlay); Map1.CurrentExtent = new RectangleShape(5, 78, 30, 26); Map1.MapBackground.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean); } } protected void addCapitals(object sender, EventArgs e) { ShapeFileFeatureLayer capitalLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\CSharpSamples\World\capital.shp"); capitalLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.White, 7, GeoColor.StandardColors.Brown); capitalLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ShapeFileFeatureLayer capitalLabelLayer = new ShapeFileFeatureLayer(@"C:\Program Files\ThinkGeo\CSharpSamples\World\capital.shp"); capitalLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("CITY_NAME", "Arial", 8, DrawingFontStyles.Italic, GeoColor.StandardColors.Black, 3, 3); capitalLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay dynamicOverlay = new LayerOverlay("customLayer", false, TileType.SingleTile); dynamicOverlay.Layers.Add(capitalLayer); dynamicOverlay.Layers.Add(capitalLabelLayer); Map1.CustomOverlays.Add(dynamicOverlay); /* capitalLayer.Open(); Map1.CurrentExtent = capitalLayer.GetBoundingBox(); capitalLayer.Close(); */ ScriptManager.RegisterStartupScript(this, this.GetType(), "UpdateOverlay", "UpdateOverlay('customLayer')", true); } }