private void WpfMap_Loaded(object sender, RoutedEventArgs e) { wpfMap1.MapUnit = GeographyUnit.DecimalDegree; wpfMap1.CurrentExtent = new RectangleShape(-133.2515625, 89.2484375, 126.9046875, -88.290625); WorldMapKitWmsWpfOverlay worldMapKitDesktopOverlay = new WorldMapKitWmsWpfOverlay(); wpfMap1.Overlays.Add(worldMapKitDesktopOverlay); // Highlight the countries that are land locked and have a population greater than 10 million string expression = "(ToInt32(POP_CNTRY)>10000000) AND (ToChar(LANDLOCKED)='Y')"; FleeBooleanStyle landLockedCountryStyle = new FleeBooleanStyle(expression); // You can access the static methods on these types. We use this // to access the Convert.Toxxx methods to convert variable types landLockedCountryStyle.StaticTypes.Add(typeof(System.Convert)); // The math class might be handy to include but in this sample we do not use it //landLockedCountryStyle.StaticTypes.Add(typeof(System.Math)); landLockedCountryStyle.ColumnVariables.Add("POP_CNTRY"); landLockedCountryStyle.ColumnVariables.Add("LANDLOCKED"); landLockedCountryStyle.CustomTrueStyles.Add(new AreaStyle(new GeoPen(GeoColor.SimpleColors.Green, 2), new GeoSolidBrush(GeoColor.FromArgb(100, GeoColor.SimpleColors.Green)))); landLockedCountryStyle.CustomFalseStyles.Add(AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green))); ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"..\..\SampleData\Data\Countries02.shp", ShapeFileReadWriteMode.ReadOnly); worldLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(landLockedCountryStyle); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay worldOverlay = new LayerOverlay(); worldOverlay.TileType = TileType.SingleTile; worldOverlay.Layers.Add("WorldLayer", worldLayer); wpfMap1.Overlays.Add("WorldOverlay", worldOverlay); wpfMap1.Refresh(); }
private Style GetRoadStyle() { string expression = "CFCC.CompareTo(\"A4\")<0"; FleeBooleanStyle roadCFCCStyle = new FleeBooleanStyle(expression); // You can access the static methods on these types. We use this // to access the Convert.Toxxx methods to convert variable types roadCFCCStyle.StaticTypes.Add(typeof(System.Convert)); // The math class might be handy to include but in this sample we do not use it //landLockedCountryStyle.StaticTypes.Add(typeof(System.Math)); roadCFCCStyle.ColumnVariables.Add("CFCC"); roadCFCCStyle.CustomTrueStyles.Add(new LineStyle(new GeoPen(GeoColor.StandardColors.Goldenrod, 2))); roadCFCCStyle.CustomFalseStyles.Add(new LineStyle(new GeoPen(GeoColor.StandardColors.DodgerBlue))); return(roadCFCCStyle); }
private void MapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.Meter; mapView.ZoomLevelSet = new ThinkGeoCloudMapsZoomLevelSet(); // Create background world map with vector tile requested from ThinkGeo Cloud Service. ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay(SampleHelper.ThinkGeoCloudId, SampleHelper.ThinkGeoCloudSecret, ThinkGeoCloudVectorMapsMapType.Light); mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay); // Highlight the countries that are land locked and have a population greater than 10 million string expression = "(POP_CNTRY>10000000) && (LANDLOCKED=='Y')"; FleeBooleanStyle landLockedCountryStyle = new FleeBooleanStyle(expression); // You can access the static methods on these types. We use this // to access the Convert.Toxxx methods to convert variable types landLockedCountryStyle.StaticTypes.Add(typeof(System.Convert)); // The math class might be handy to include but in this sample we do not use it //landLockedCountryStyle.StaticTypes.Add(typeof(System.Math)); landLockedCountryStyle.ColumnVariables.Add("POP_CNTRY"); landLockedCountryStyle.ColumnVariables.Add("LANDLOCKED"); landLockedCountryStyle.CustomTrueStyles.Add(new AreaStyle(new GeoPen(GeoColors.Green, 2), new GeoSolidBrush(GeoColor.FromArgb(100, GeoColors.Green)))); landLockedCountryStyle.CustomFalseStyles.Add(AreaStyle.CreateSimpleAreaStyle(GeoColors.Transparent, GeoColor.FromArgb(100, GeoColors.Green))); ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(SampleHelper.Get("Countries02_3857.shp"), FileAccess.Read); worldLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(landLockedCountryStyle); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay worldOverlay = new LayerOverlay(); worldOverlay.TileType = TileType.SingleTile; worldOverlay.Layers.Add("WorldLayer", worldLayer); mapView.Overlays.Add("WorldOverlay", worldOverlay); mapView.Refresh(); }
private void DisplayMap_Load(object sender, EventArgs e) { winformsMap1.MapUnit = GeographyUnit.DecimalDegree; winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean); WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new WorldMapKitWmsDesktopOverlay(); winformsMap1.Overlays.Add(worldMapKitDesktopOverlay); // Highlight the countries that are land locked and have a population greater than 10 million string expression = "(ToInt32(POP_CNTRY)>10000000) AND (ToChar(LANDLOCKED)='Y')"; FleeBooleanStyle landLockedCountryStyle = new FleeBooleanStyle(expression); // You can access the static methods on these types. We use this // to access the Convert.Toxxx methods to convert variable types landLockedCountryStyle.StaticTypes.Add(typeof(System.Convert)); // The math class might be handy to include but in this sample we do not use it //landLockedCountryStyle.StaticTypes.Add(typeof(System.Math)); landLockedCountryStyle.ColumnVariables.Add("POP_CNTRY"); landLockedCountryStyle.ColumnVariables.Add("LANDLOCKED"); landLockedCountryStyle.CustomTrueStyles.Add(new AreaStyle(new GeoPen(GeoColor.SimpleColors.Green, 2), new GeoSolidBrush(GeoColor.FromArgb(100, GeoColor.SimpleColors.Green)))); landLockedCountryStyle.CustomFalseStyles.Add(AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green))); ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(Samples.RootDirectory + @"Data\Countries02.shp", GeoFileReadWriteMode.Read); worldLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(landLockedCountryStyle); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay worldOverlay = new LayerOverlay(); worldOverlay.Layers.Add("WorldLayer", worldLayer); winformsMap1.Overlays.Add("WorldOverlay", worldOverlay); winformsMap1.CurrentExtent = new RectangleShape(-139.2, 92.4, 120.9, -93.2); winformsMap1.Refresh(); }