protected override void DrawCore(GeoCanvas geoCanvas, Style style) { Bitmap bitmap = new Bitmap(35, 20); ClassBreakStyle classBreakStyle = style as ClassBreakStyle; RectangleShape worldExtent = new RectangleShape(-180, 90, 180, -90); // Draw Icon geoCanvas.BeginDrawing(bitmap, worldExtent, GeographyUnit.DecimalDegree); if (StartClassBreak.DefaultAreaStyle != null) { StartClassBreak.DefaultAreaStyle.Draw(new BaseShape[] { worldExtent }, geoCanvas, new System.Collections.ObjectModel.Collection <SimpleCandidate>(), new System.Collections.ObjectModel.Collection <SimpleCandidate>()); } geoCanvas.DrawArea(worldExtent, new GeoPen(GeoColor.FromHtml("#cccccc"), 2), DrawingLevel.LabelLevel); geoCanvas.EndDrawing(); this.Image = bitmap; if (EndClassBreak != null) { this.Title = string.Format("{0:#,0.####} ~ {1:#,0.####}", MapSuiteSampleHelper.GetFormatedStringForLegendItem(classBreakStyle.ColumnName, StartClassBreak.Value), MapSuiteSampleHelper.GetFormatedStringForLegendItem(classBreakStyle.ColumnName, EndClassBreak.Value)); } else { this.Title = string.Format("> {0:#,0.####}", MapSuiteSampleHelper.GetFormatedStringForLegendItem(classBreakStyle.ColumnName, StartClassBreak.Value)); } }
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); ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(Samples.RootDirectory + @"Data\Countries02.shp"); worldLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green))); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // Draw a feature based on a value and hue family colors. Collection <GeoColor> colorsInFamily = GeoColor.GetColorsInHueFamily(GeoColor.StandardColors.Red, 5); ValueStyle valueStyle = new ValueStyle(); valueStyle.ColumnName = "CNTRY_NAME"; valueStyle.ValueItems.Add(new ValueItem("United States", new AreaStyle(new GeoSolidBrush(colorsInFamily[0])))); valueStyle.ValueItems.Add(new ValueItem("China", new AreaStyle(new GeoSolidBrush(colorsInFamily[1])))); valueStyle.ValueItems.Add(new ValueItem("Brazil", new AreaStyle(new GeoSolidBrush(colorsInFamily[2])))); valueStyle.ValueItems.Add(new ValueItem("Australia", new AreaStyle(new GeoSolidBrush(colorsInFamily[3])))); valueStyle.ValueItems.Add(new ValueItem("South Africa", new AreaStyle(new GeoSolidBrush(colorsInFamily[4])))); worldLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(valueStyle); LayerOverlay worldOverlay = new LayerOverlay(); worldOverlay.Layers.Add("WorldLayer", worldLayer); winformsMap1.Overlays.Add(worldOverlay); winformsMap1.CurrentExtent = new RectangleShape(-139.2, 92.4, 120.9, -93.2); winformsMap1.Refresh(); }
private InMemoryGridFeatureLayer GetGridFeatureLayer() { //Get the line breaks Collection <double> isoLineBreaks = GridIsoLineLayer.GetIsoLineLevels(wellDepthPointData, Convert.ToInt32(txtGridIsoLineLevelCount.Text)); //Load a new GridFeatureLayer based on the current grid file InMemoryGridFeatureLayer gridFeatureLayer = new InMemoryGridFeatureLayer(gridCellMatrix); //Create a series of colors from blue to red that we will use for the breaks Collection <GeoColor> colors = GeoColor.GetColorsInQualityFamily(GeoColor.StandardColors.Blue, GeoColor.StandardColors.Red, isoLineBreaks.Count, ColorWheelDirection.CounterClockwise); //Create a class break style ClassBreakStyle classBreakLineStyle = new ClassBreakStyle(gridFeatureLayer.DataValueColumnName); //Setup a class break style based on the isoline levels and the colors AreaStyle firstStyle = new AreaStyle(new GeoPen(GeoColor.FromArgb(50, colors[0]), 1), new GeoSolidBrush(GeoColor.FromArgb(50, colors[0]))); classBreakLineStyle.ClassBreaks.Add(new ClassBreak(double.MinValue, firstStyle)); for (int i = 1; i < colors.Count - 1; i++) { AreaStyle style = new AreaStyle(new GeoPen(GeoColor.FromArgb(50, colors[i]), 1), new GeoSolidBrush(GeoColor.FromArgb(50, colors[i]))); classBreakLineStyle.ClassBreaks.Add(new ClassBreak(isoLineBreaks[i], style)); } gridFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(classBreakLineStyle); gridFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; return(gridFeatureLayer); }
private void DrawAndLabelWaterFeatures_Load(object sender, EventArgs e) { winformsMap1.MapUnit = GeographyUnit.DecimalDegree; winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 233, 232, 214)); ShapeFileFeatureLayer utahWaterShapeLayer = new ShapeFileFeatureLayer(Samples.RootDirectory + @"Data\UtahWater.shp"); utahWaterShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Water1; utahWaterShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ShapeFileFeatureLayer utahWaterLabelLayer = new ShapeFileFeatureLayer(Samples.RootDirectory + @"Data\UtahWater.shp"); utahWaterLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.Water1("Landname"); utahWaterLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.Layers.Add("UtahWaterShapes", utahWaterShapeLayer); staticOverlay.Layers.Add("UtahWaterLabels", utahWaterLabelLayer); winformsMap1.Overlays.Add(staticOverlay); winformsMap1.CurrentExtent = new RectangleShape(-113.11473388671875, 41.949816894531253, -111.08226318359375, 40.499621582031253); winformsMap1.Refresh(); }
private void LoadGeoDatabaseFeatureLayer_Load(object sender, EventArgs e) { try { winformsMap1.MapUnit = GeographyUnit.Meter; winformsMap1.CurrentExtent = new RectangleShape(2149408.38465815, 246471.365609125, 2204046.63635703, 213231.081162168); winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 233, 232, 214)); PersonalGeoDatabaseFeatureLayer worldLayer = new PersonalGeoDatabaseFeatureLayer(Samples.RootDirectory + @"Data\JORWD6gdb.mdb", null, null, "Mains"); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.LocalRoad1; worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.Layers.Add("WorldLayer", worldLayer); winformsMap1.Overlays.Add(staticOverlay); winformsMap1.Refresh(); } catch (FileNotFoundException ex) { string message = "Could not find MapSuiteFdoExtension.dll assembly.\r\n" + "This dll is expected to be found in the MapSuiteFDOExtensionX86(X64) folder so you need to make this folder available within the System32 folder of your computer. Simply copy the MapSuiteFDOExtensionX86 or MapSuiteFDOExtensionX64 folder from [Install-Path}\\Developer Reference\\System32 to the ‘System32’ (‘System’ for x64) folder of your computer.\r\n" + "Additionally you need to add the FdoExtension.dll to this sample. You can reference this DLL from [Install-Path]\\Developer Reference\\Spatial Extensions\\Fdo Extension\\.\r\n\r\n" + ex.Message; MessageBox.Show(message, "FileNotFound", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, (MessageBoxOptions)0); } }
private void Map1_Loaded(object sender, RoutedEventArgs e) { Map1.MapUnit = GeoUnit.Meter; Map1.UseOpenStreetMapAsBaseMap(); ShapefileSource dataSource = new ShapefileSource("SampleData/countries-900913.shp"); dataSource.Open(); highlightFeature = dataSource.GetFeatureById("1", RequireColumnsType.None); GeoBound highlightBound = highlightFeature.GetBound(); highlightBoundFeature = new Feature(highlightBound); MemoryLayer highlightLayer = new MemoryLayer() { Name = "HighlightLayer" }; highlightLayer.Features.Add(highlightFeature); highlightLayer.Features.Add(highlightBoundFeature); highlightLayer.Styles.Add(new FillStyle(GeoColor.FromHtml("#55FAB04D"))); highlightLayer.Styles.Add(new LineStyle(GeoColor.FromHtml("#00BCD4"), 4)); Map1.AddStaticLayers("HighlightOverlay", highlightLayer); MemoryLayer resultLayer = new MemoryLayer { Name = "ResultLayer" }; resultLayer.Styles.Add(new FillStyle(GeoColor.FromHtml("#55FAB04D"), GeoColors.White)); Map1.AddDynamicLayers("ResultOverlay", resultLayer); Map1.ZoomTo(highlightFeature); }
private void Map1_Loaded(object sender, RoutedEventArgs e) { Map1.MapUnit = GeoUnit.Meter; Map1.UseOpenStreetMapAsBaseMap(); ShapefileLayer sectionLayer = new ShapefileLayer("SampleData/sections-900913.shp"); sectionLayer.Styles.Add(new FillStyle(GeoColors.Transparent, GeoColor.FromHtml("#99FAB04D"), 1)); Map1.AddStaticLayers("SectionOverlay", sectionLayer); GeoBound sectionBound = sectionLayer.GetBound(); GeoBound queryArea = (GeoBound)sectionBound.Clone(); queryArea.ScaleDown(60); MemoryLayer queryAreaLayer = new MemoryLayer { Name = "QueryAreaLayer" }; queryAreaLayer.Styles.Add(new FillStyle(GeoColors.Transparent, GeoColor.FromHtml("#9900BCD4"), 4)); queryAreaLayer.Features.Add(new Feature(queryArea)); Map1.AddStaticLayers("SectionOverlay", queryAreaLayer); MemoryLayer highlightLayer = new MemoryLayer { Name = "HighlightLayer" }; highlightLayer.Styles.Add(new FillStyle(GeoColor.FromHtml("#66FFFF00"), GeoColors.White)); Map1.AddDynamicLayers("HighlightOverlay", highlightLayer); Map1.ZoomTo(sectionLayer.GetBound()); }
private void MapView_Loaded(object sender, RoutedEventArgs e) { try { mapView.MapUnit = GeographyUnit.Meter; mapView.CurrentExtent = new RectangleShape(2149408.38465815, 246471.365609125, 2204046.63635703, 213231.081162168); PersonalGeoDatabaseFeatureLayer worldLayer = new PersonalGeoDatabaseFeatureLayer(SampleHelper.Get("wsb57.mdb")); worldLayer.EnableEmbeddedStyle = false; worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyle.CreateSimpleAreaStyle(GeoColors.LightGray); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyle.CreateSimpleLineStyle(GeoColor.FromArgb(255, 169, 195, 221), 2F, GeoColors.Black, 4F, false); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyle.CreateCompoundPointStyle(PointSymbolType.Square, GeoColors.White, GeoColors.Black, 1F, 6F, PointSymbolType.Square, GeoColors.Maroon, GeoColors.Transparent, 0F, 2F); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; worldLayer.Open(); LayerOverlay worldOverlay = new LayerOverlay(); worldOverlay.DrawingExceptionMode = DrawingExceptionMode.DrawException; worldOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColor.FromArgb(255, 233, 232, 214)))); worldOverlay.Layers.Add("WorldLayer", worldLayer); mapView.Overlays.Add("WorldOverlay", worldOverlay); mapView.CurrentExtent = worldOverlay.GetBoundingBox(); mapView.Refresh(); } catch (FileNotFoundException ex) { string message = "You have to reference ThinkGeo.PersonalGeoDatabase.nupkg\r\n\r\n" + ex.Message; MessageBox.Show(message, "FileNotFound", MessageBoxButton.OK, MessageBoxImage.Error, MessageBoxResult.OK, (MessageBoxOptions)0); } }
private void mapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.Meter; LayerOverlay layerOverlay = new LayerOverlay(); UsgsDemFeatureLayer layer = new UsgsDemFeatureLayer(SampleHelper.Get("mobile-e.dem")); layer.DrawingQuality = DrawingQuality.HighSpeed; layer.Open(); DataTable informations = CreateInformationTable((UsgsDemFeatureSource)layer.FeatureSource); informationDataGrid.ItemsSource = informations.DefaultView; ClassBreakStyle classBreakStyle = new ClassBreakStyle(); classBreakStyle.ColumnName = layer.DataValueColumnName; Collection <GeoColor> colors = GeoColor.GetColorsInQualityFamily(GeoColors.Blue, 100); double cellValue = (layer.MaxElevation - layer.MinElevation) / 100; for (int i = 0; i < colors.Count; i++) { classBreakStyle.ClassBreaks.Add(new ClassBreak(layer.MinElevation + cellValue * i, new AreaStyle(new GeoSolidBrush(colors[i])))); } layer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(classBreakStyle); layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; layerOverlay.Layers.Add(layer); mapView.Overlays.Add(layerOverlay); mapView.CurrentExtent = layer.GetBoundingBox(); mapView.Refresh(); }
private void TestForm_Load(object sender, EventArgs e) { winformsMap1.MapUnit = GeographyUnit.Meter; winformsMap1.ZoomLevelSet = new ThinkGeoCloudMapsZoomLevelSet(); winformsMap1.CurrentExtent = new RectangleShape(-10777598, 3912998, -10776008, 3912026); winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255)); // Please input your ThinkGeo Cloud Client ID / Client Secret to enable the background map. ThinkGeoCloudRasterMapsOverlay thinkGeoCloudMapsOverlay = new ThinkGeoCloudRasterMapsOverlay("ThinkGeo Cloud Client ID", "ThinkGeo Cloud Client Secret"); winformsMap1.Overlays.Add(thinkGeoCloudMapsOverlay); KmlFeatureLayer kmlFeatureLayer = new KmlFeatureLayer("../../App_Data/ThinkGeoHeadquarters.kml"); kmlFeatureLayer.StylingType = KmlStylingType.StandardStyling; // Set area style,line style,point style and text style. TextStyle textStyle = new TextStyle("name", (new GeoFont("Arial", 12)), new GeoSolidBrush(GeoColor.StandardColors.DarkOliveGreen)); textStyle.HaloPen = new GeoPen(GeoColor.StandardColors.FloralWhite, 5); textStyle.SplineType = SplineType.ForceSplining; kmlFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.FillSolidBrush = new GeoSolidBrush(new GeoColor(50, GeoColor.SimpleColors.Orange)); kmlFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.OutlinePen = new GeoPen(GeoColor.SimpleColors.Black); kmlFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = new LineStyle(new GeoPen(GeoColor.SimpleColors.Orange, 5)); kmlFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.SymbolPen = new GeoPen(GeoColor.FromArgb(255, GeoColor.StandardColors.Green), 8); kmlFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = textStyle; kmlFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay overlay = new LayerOverlay(); overlay.Layers.Add("KmlLayer", kmlFeatureLayer); winformsMap1.Overlays.Add("Overlay", overlay); winformsMap1.Refresh(); }
private void TestForm_Load(object sender, EventArgs e) { // Set the full extent and the background color winformsMap1.CurrentExtent = new RectangleShape(-120, 25, 20, -30); winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255)); // Add the static layers to the MapEngine ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"..\..\Data\Countries02.shp", ShapeFileReadWriteMode.ReadOnly); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.County1; worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // mapEngine.StaticLayers.Add("WorldLayer", worldLayer); LayerOverlay overLayer = new LayerOverlay(); overLayer.Layers.Add(worldLayer); winformsMap1.Overlays.Add("Overlay", overLayer); //Add the GraticuleAdormentLayer to the Adornment Layers of the MapEngine GraticuleAdornmentLayer graticuleAdornmentLayer = new GraticuleAdornmentLayer(); winformsMap1.AdornmentOverlay.Layers.Add("graticule", graticuleAdornmentLayer); winformsMap1.Refresh(); }
public PieSlice(double value, GeoColor color, double displacement, string label) { this.Value = value; this.Color = color; this.Displacement = displacement; this.Label = label; }
private DynamicGridFeatureLayer GetDynamicGridFeatureLayer() { DynamicGridFeatureLayer dynamicGridFeatureLayer = new DynamicGridFeatureLayer(wellDepthPointData); dynamicGridFeatureLayer.CellHeightInPixel = Map1.ActualHeight / double.Parse(txtDynamicIsoLineCellRowCount.Text); dynamicGridFeatureLayer.CellWidthInPixel = Map1.ActualWidth / double.Parse(txtDynamicIsoLineCellColumnCount.Text); Collection <double> isoLineBreaks = GridIsoLineLayer.GetIsoLineLevels(wellDepthPointData, Convert.ToInt32(txtGridIsoLineLevelCount.Text)); //Create a series of colors from blue to red that we will use for the breaks Collection <GeoColor> colors = GeoColor.GetColorsInQualityFamily(GeoColor.StandardColors.Blue, GeoColor.StandardColors.Red, isoLineBreaks.Count, ColorWheelDirection.CounterClockwise); //Create a class break style ClassBreakStyle classBreakLineStyle = new ClassBreakStyle(dynamicGridFeatureLayer.DataValueColumnName); //Setup a class break style based on the isoline levels and the colors AreaStyle firstStyle = new AreaStyle(new GeoPen(GeoColor.FromArgb(50, colors[0]), 1), new GeoSolidBrush(GeoColor.FromArgb(50, colors[0]))); classBreakLineStyle.ClassBreaks.Add(new ClassBreak(double.MinValue, firstStyle)); for (int i = 1; i < colors.Count - 1; i++) { AreaStyle style = new AreaStyle(new GeoPen(GeoColor.FromArgb(50, colors[i]), 1), new GeoSolidBrush(GeoColor.FromArgb(50, colors[i]))); classBreakLineStyle.ClassBreaks.Add(new ClassBreak(isoLineBreaks[i], style)); } dynamicGridFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(classBreakLineStyle); dynamicGridFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; return(dynamicGridFeatureLayer); }
// // GET: /LoadAHeatLayer/ public ActionResult LoadAHeatLayer() { Map map = new Map("Map1", new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage), new System.Web.UI.WebControls.Unit(100, System.Web.UI.WebControls.UnitType.Percentage)); map.MapBackground = new GeoSolidBrush(GeoColor.FromHtml("#E5E3DF")); map.CurrentExtent = new RectangleShape(-91.88, 43.17, -69.88, 29.86); map.MapUnit = GeographyUnit.DecimalDegree; WorldMapKitWmsWebOverlay worldMapKitOverlay = new WorldMapKitWmsWebOverlay(); map.CustomOverlays.Add(worldMapKitOverlay); //Shapefile Containing historical earthquake data ShapeFileFeatureSource featureSource = new ShapeFileFeatureSource(Server.MapPath("~/App_Data/quksigx020.shp")); featureSource.CustomColumnFetch += new EventHandler <CustomColumnFetchEventArgs>(featureSource_CustomColumnFetch); HeatLayer heatLayer = new HeatLayer(featureSource); heatLayer.HeatStyle = new HeatStyle(180, "EarthQuakeMagnitude", 0, 12); LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.IsBaseOverlay = false; staticOverlay.Layers.Add(heatLayer); map.CustomOverlays.Add(staticOverlay); return(View(map)); }
private string GetPolygonStyleKml(int id, GeoPen outlinePen, GeoColor fillColor) { StringBuilder styleBuilder = new StringBuilder(); styleBuilder.AppendLine(); styleBuilder.AppendFormat(@"<Style id=""{0}"">", id); styleBuilder.AppendLine(); styleBuilder.AppendLine(@"<IconStyle>"); styleBuilder.AppendLine(@"<Icon>"); styleBuilder.AppendLine(@"</Icon>"); styleBuilder.AppendLine(@"</IconStyle>"); styleBuilder.AppendLine(@"<LineStyle>"); if (outlinePen != null) { styleBuilder.AppendFormat(@"<color>{0}</color>", GetGoogleHTMLColor(outlinePen.Color)); styleBuilder.AppendLine(); styleBuilder.AppendFormat(@"<width>{0}</width>", outlinePen.Width); } styleBuilder.AppendLine(); styleBuilder.AppendLine(@"</LineStyle>"); styleBuilder.AppendLine(@"<PolyStyle>"); styleBuilder.AppendFormat(@"<color>{0}</color>", GetGoogleHTMLColor(fillColor)); styleBuilder.AppendLine(); styleBuilder.AppendLine(@"</PolyStyle>"); styleBuilder.AppendLine(@"</Style>"); return(styleBuilder.ToString()); }
// // 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 = 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; map.CustomOverlays.Add(markerOverlay); return(View(map)); }
private void Map1_Loaded(object sender, RoutedEventArgs e) { Map1.MapUnit = GeoUnit.Meter; LayerOverlay staticOverlay = new LayerOverlay { Name = "Static Overlay" }; staticOverlay.Layers.Add(new OpenStreetMapLayer()); Map1.Overlays.Add(staticOverlay); ShapefileLayer dynamicLayer = new ShapefileLayer("SampleData/countries-900913.shp"); dynamicLayer.Styles.Add(new FillStyle(GeoColor.FromHtml("#55FAB04D"), GeoColors.White)); LayerOverlay dynamicOverlay = new LayerOverlay { Name = "Dynamic Overlay" }; dynamicOverlay.Layers.Add(dynamicLayer); Map1.Overlays.Add(dynamicOverlay); Map1.ZoomToFullBound(); Collection <OverlayViewModel> viewModel = new Collection <OverlayViewModel>(); viewModel.Add(new OverlayViewModel(staticOverlay)); viewModel.Add(new OverlayViewModel(dynamicOverlay)); OverlayListGrid.DataContext = viewModel; }
private void Form_Load(object sender, EventArgs e) { // It is important to set the map unit first to either feet, meters or decimal degrees. mapView.MapUnit = GeographyUnit.Meter; // Create the background world maps using vector tiles requested from the ThinkGeo Cloud Service and add it to the map. ThinkGeoCloudVectorMapsOverlay thinkGeoCloudVectorMapsOverlay = new ThinkGeoCloudVectorMapsOverlay("itZGOI8oafZwmtxP-XGiMvfWJPPc-dX35DmESmLlQIU~", "bcaCzPpmOG6le2pUz5EAaEKYI-KSMny_WxEAe7gMNQgGeN9sqL12OA~~", ThinkGeoCloudVectorMapsMapType.Light); mapView.Overlays.Add(thinkGeoCloudVectorMapsOverlay); // Create a new overlay that will hold our new layer and add it to the map. LayerOverlay layerOverlay = new LayerOverlay(); mapView.Overlays.Add(layerOverlay); // Create the new layer and set the projection as the data is in srid 4326 and our background is srid 3857 (spherical mercator). GraticuleFeatureLayer graticuleFeatureLayer = new GraticuleFeatureLayer(); graticuleFeatureLayer.FeatureSource.ProjectionConverter = new ProjectionConverter(4326, 3857); // We set the pen color to the graticule layer. graticuleFeatureLayer.GraticuleLineStyle.OuterPen.Color = GeoColor.FromArgb(125, GeoColors.Navy); // Add the layer to the overlay we created earlier. layerOverlay.Layers.Add("graticule", graticuleFeatureLayer); // Set the current extent of the map to start in Frisco TX mapView.CurrentExtent = new RectangleShape(-10782364.041857453, 3914916.6811720245, -10772029.75569071, 3908067.923475721); //Refresh the map. mapView.Refresh(); }
private void Map1_Loaded(object sender, RoutedEventArgs e) { Map1.MapUnit = GeoUnit.Meter; Map1.UseOpenStreetMapAsBaseMap(); GeoBound bound = new GeoBound(2171997.6512, 8356849.2669, 3515687.9933, 11097616.86); GeoPoint center = bound.GetCentroid(); double x1 = bound.MinX + bound.Width * .25; double y = center.Y; double x2 = bound.MaxX - bound.Width * .25; double radius = bound.Width * 3 / 8; feature1 = new Feature(new GeoEllipse(new GeoPoint(x1, y), radius)); feature2 = new Feature(new GeoEllipse(new GeoPoint(x2, y), radius)); MemoryLayer highlightLayer = new MemoryLayer { Name = "HighlightLayer" }; highlightLayer.Features.Add(feature1); highlightLayer.Features.Add(feature2); highlightLayer.Styles.Add(new FillStyle(GeoColor.FromHtml("#55FAB04D"), GeoColors.White)); Map1.AddStaticLayers("HighlightOverlay", highlightLayer); MemoryLayer resultLayer = new MemoryLayer { Name = "ResultLayer" }; resultLayer.Styles.Add(new FillStyle(GeoColor.FromHtml("#99FF5722"), GeoColors.White)); Map1.AddDynamicLayers("ResultOverlay", resultLayer); Map1.ZoomTo(bound); }
public StandardDotDensityLegendItem(int dotCount) : base() { DotCount = dotCount; LabelFont = new GeoFont("Arial", 20, DrawingFontStyles.Bold); LabelBrush = new GeoSolidBrush(GeoColor.FromArgb(180, GeoColor.FromHtml("#d3d3d3"))); }
/// <summary> /// Adds a ClassBreakStyle to the housingUnitsLayer that changes colors based on the numerical value of the H_UNITS column as they fall within the range of a ClassBreak /// </summary> private static void AddClassBreakStyle(ShapeFileFeatureLayer layer, LegendAdornmentLayer legend) { // Create the ClassBreakStyle based on the H_UNITS numerical column var housingUnitsStyle = new ClassBreakStyle("H_UNITS"); var classBreakIntervals = new double[] { 0, 1000, 2000, 3000, 4000, 5000 }; var colors = GeoColor.GetColorsInHueFamily(GeoColors.Red, classBreakIntervals.Count()).Reverse().ToList(); // Create ClassBreaks for each of the classBreakIntervals for (var i = 0; i < classBreakIntervals.Count(); i++) { // Create the classBreak using one of the intervals and colors defined above var classBreak = new ClassBreak(classBreakIntervals[i], AreaStyle.CreateSimpleAreaStyle(new GeoColor(192, colors[i]), GeoColors.White)); // Add the classBreak to the housingUnitsStyle ClassBreaks collection housingUnitsStyle.ClassBreaks.Add(classBreak); // Add a LegendItem to the legend adornment to represent the classBreak var legendItem = new LegendItem() { ImageStyle = classBreak.DefaultAreaStyle, TextStyle = new TextStyle($@">{classBreak.Value} units", new GeoFont("Verdana", 10), GeoBrushes.Black) }; legend.LegendItems.Add(legendItem); } // Add and apply the ClassBreakStyle to the housingUnitsLayer layer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(housingUnitsStyle); layer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; }
private void MapView_Loaded(object sender, RoutedEventArgs e) { mapView.MapUnit = GeographyUnit.Meter; ShapeFileFeatureLayer austinStreetsShapeLayer = new ShapeFileFeatureLayer(SampleHelper.Get("austinstreets_3857.shp")); austinStreetsShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; austinStreetsShapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(LineStyle.CreateSimpleLineStyle(GeoColors.White, 9.2F, GeoColors.DarkGray, 12.2F, true)); ShapeFileFeatureLayer austinStreetsLabelLayer = new ShapeFileFeatureLayer(SampleHelper.Get("austinstreets_3857.shp")); austinStreetsLabelLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(TextStyle.CreateSimpleTextStyle("FENAME", "Arial", 9, DrawingFontStyles.Regular, GeoColors.Black, 0, 0)); austinStreetsLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColor.FromArgb(255, 233, 232, 214)))); staticOverlay.Layers.Add("AustinStreetsShapeLayer", austinStreetsShapeLayer); staticOverlay.Layers.Add("AustinStreetsLabelLayer", austinStreetsLabelLayer); mapView.Overlays.Add(staticOverlay); mapView.CurrentExtent = new RectangleShape(-10881385, 3542247, -10880501, 3541517); mapView.Refresh(); }
private void RenderMap() { winformsMap1.MapUnit = GeographyUnit.DecimalDegree; winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#e6e5d1")); winformsMap1.CurrentExtent = new RectangleShape(-97.763384, 30.299707, -97.712382, 30.259309); OleDbLineFeatureLayer austinstreetsLayer = new OleDbLineFeatureLayer(featureSource); austinstreetsLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.LocalRoad3; austinstreetsLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay austinstreetsOverlay = new LayerOverlay(); austinstreetsOverlay.Layers.Add("AustinstreetsLayer", austinstreetsLayer); winformsMap1.Overlays.Add("AustinstreetsOverlay", austinstreetsOverlay); RoutingLayer routingLayer = new RoutingLayer(); austinstreetsLayer.Open(); routingLayer.StartPoint = austinstreetsLayer.FeatureSource.GetFeatureById(txtStartId.Text, ReturningColumnsType.NoColumns).GetShape().GetCenterPoint(); routingLayer.EndPoint = austinstreetsLayer.FeatureSource.GetFeatureById(txtEndId.Text, ReturningColumnsType.NoColumns).GetShape().GetCenterPoint(); austinstreetsLayer.Close(); LayerOverlay routingOverlay = new LayerOverlay(); routingOverlay.Layers.Add("RoutingLayer", routingLayer); winformsMap1.Overlays.Add("RoutingOverlay", routingOverlay); winformsMap1.Refresh(); }
private void Map1_Loaded(object sender, RoutedEventArgs e) { Map1.MapUnit = GeoUnit.Meter; Map1.UseOpenStreetMapAsBaseMap(); GeoLine greatCircle = CreateGreatCircle(); MemoryLayer baselineLayer = new MemoryLayer { Name = "BaseLineLayer" }; baselineLayer.Styles.Add(new LineStyle(GeoColors.White, 8)); baselineLayer.Styles.Add(new LineStyle(GeoColor.FromHtml("#88FAB04D"), 4)); baselineLayer.Features.Add(new Feature(greatCircle)); Map1.AddStaticLayers(baselineLayer); Stream airplaneIconStream = Application.GetResourceStream(new Uri("/SlimGis.WpfSamples;component/Images/airplane.png", UriKind.RelativeOrAbsolute)).Stream; MemoryLayer highlightLayer = new MemoryLayer { Name = "HighlightLayer" }; highlightLayer.Styles.Add(new LineStyle(GeoColor.FromHtml("#9903A9F4"), 4)); highlightLayer.Styles.Add(new IconStyle(new GeoImage(airplaneIconStream)) { AspectRatio = 0.6667 }); Map1.AddDynamicLayers("HighlightOverlay", highlightLayer); GeoBound bound = baselineLayer.GetBound(); bound.ScaleUp(25); Map1.ZoomTo(bound); }
protected override Collection <Style> GetStylesCore(FeatureSource featureSource) { double totalValue = 0; featureSource.Open(); int featureCount = featureSource.GetCount(); for (int i = 0; i < featureCount; i++) { Feature feature = featureSource.GetFeatureById((i + 1).ToString(CultureInfo.InvariantCulture), SelectedColumns); double columnValue; double.TryParse(feature.ColumnValues[SelectedColumns[0]], out columnValue); totalValue += columnValue; } featureSource.Close(); CustomDotDensityStyle dotDensityStyle = new CustomDotDensityStyle(); dotDensityStyle.ColumnName = SelectedColumns[0]; dotDensityStyle.PointToValueRatio = DotDensityValue / (totalValue / featureCount); dotDensityStyle.CustomPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(Opacity, Color), 4); return(new Collection <Style>() { dotDensityStyle }); }
public ColorComboBox() { simpleColors = new Dictionary <string, Color>(); DrawMode = DrawMode.OwnerDrawFixed; DropDownStyle = ComboBoxStyle.DropDownList; ItemHeight = 25; Type type = GeoColor.SimpleColors.GetType(); PropertyInfo[] propertyInfos = type.GetProperties(); foreach (PropertyInfo propertypInfo in propertyInfos.Where(p => !p.Name.Equals("TRANSPARENT", StringComparison.InvariantCultureIgnoreCase))) { string name = propertypInfo.Name; object value = propertypInfo.GetValue(GeoColor.SimpleColors, null); if (value.GetType() == typeof(GeoColor)) { GeoColor geoColor = (GeoColor)value; simpleColors.Add(name, Color.FromArgb(geoColor.RedComponent, geoColor.GreenComponent, geoColor.BlueComponent)); if (!Items.Contains(name)) { Items.Add(name); } } } Text = "Black"; }
public RadiusLayer() { RingDistanceUnit = DistanceUnit.Mile; RingGeography = GeographyUnit.Meter; RingDistance = 1; RingAreaStyle = new AreaStyle(new GeoPen(new GeoSolidBrush(GeoColor.FromArgb(50, GeoColors.Blue)), 4)); }
//Structure used for labeling the meridians and parallels at the desired location on the map in screen coordinates. public MyGraticuleAdornmentLayer() { //This property gives the approximate density of lines that the map will have. _graticuleDensity = 10; //The color of the lines _graticuleColor = GeoColor.FromArgb(255, GeoColor.StandardColors.LightBlue); //Sets all the intervals in degree to be displayed. //The intervals need to be added from the smallest to the largest. _intervals.Add(0.0005); _intervals.Add(0.001); _intervals.Add(0.002); _intervals.Add(0.005); _intervals.Add(0.01); _intervals.Add(0.02); _intervals.Add(0.05); _intervals.Add(0.1); _intervals.Add(0.2); _intervals.Add(0.5); _intervals.Add(1); _intervals.Add(2); _intervals.Add(5); _intervals.Add(10); _intervals.Add(20); _intervals.Add(40); _intervals.Add(50); }
private Style GetRoadStyle() { ValueStyle valueStyle = new ValueStyle(); valueStyle.ColumnName = "CFCC"; LineStyle highwayStyle = new LineStyle(new GeoPen(GeoColor.FromHtml("#b8ac9c"), 7), new GeoPen(GeoColor.FromHtml("#f9de4d"), 5)); ValueItem highwayItem1 = new ValueItem("A11", highwayStyle); ValueItem highwayItem2 = new ValueItem("A21", highwayStyle); ValueItem highwayItem3 = new ValueItem("A25", highwayStyle); ValueItem highwayItem4 = new ValueItem("A31", highwayStyle); ValueItem highwayItem5 = new ValueItem("A35", highwayStyle); LineStyle localroadStyle = new LineStyle(new GeoPen(GeoColor.FromHtml("#b8ac9c"), 5), new GeoPen(GeoColor.StandardColors.White, 3)); ValueItem localroadItem1 = new ValueItem("A41", localroadStyle); ValueItem localroadItem2 = new ValueItem("A51", localroadStyle); ValueItem localroadItem3 = new ValueItem("A63", localroadStyle); ValueItem localroadItem4 = new ValueItem("A64", localroadStyle); ValueItem localroadItem5 = new ValueItem("A74", localroadStyle); ValueItem unknownItem = new ValueItem("P41", localroadStyle); valueStyle.ValueItems.Add(highwayItem1); valueStyle.ValueItems.Add(highwayItem2); valueStyle.ValueItems.Add(highwayItem3); valueStyle.ValueItems.Add(highwayItem4); valueStyle.ValueItems.Add(highwayItem5); valueStyle.ValueItems.Add(localroadItem1); valueStyle.ValueItems.Add(localroadItem2); valueStyle.ValueItems.Add(localroadItem3); valueStyle.ValueItems.Add(localroadItem4); valueStyle.ValueItems.Add(localroadItem5); valueStyle.ValueItems.Add(unknownItem); return(valueStyle); }
private void RenderMap() { winformsMap1.MapUnit = GeographyUnit.DecimalDegree; winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromHtml("#e6e5d1")); winformsMap1.CurrentExtent = new RectangleShape(-96.905564, 32.926216, -96.651506, 32.744942); WorldStreetsAndImageryOverlay worldStreetsAndImageryOverlay = new WorldStreetsAndImageryOverlay(); winformsMap1.Overlays.Add(worldStreetsAndImageryOverlay); ShapeFileFeatureLayer streetsLayer = new ShapeFileFeatureLayer(Path.Combine(rootPath, "DallasCounty-4326.shp")); streetsLayer.Open(); RoutingLayer routingLayer = new RoutingLayer(); streetsLayer.Open(); routingLayer.StartPoint = streetsLayer.FeatureSource.GetFeatureById(txtStartId.Text, ReturningColumnsType.NoColumns).GetShape().GetCenterPoint(); routingLayer.EndPoint = streetsLayer.FeatureSource.GetFeatureById(txtEndId.Text, ReturningColumnsType.NoColumns).GetShape().GetCenterPoint(); streetsLayer.Close(); LayerOverlay routingOverlay = new LayerOverlay(); routingOverlay.Layers.Add("RoutingLayer", routingLayer); winformsMap1.Overlays.Add("RoutingOverlay", routingOverlay); InMemoryFeatureLayer routingExtentLayer = new InMemoryFeatureLayer(); routingExtentLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(new GeoPen(GeoColor.SimpleColors.Green)); routingExtentLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; routingExtentLayer.InternalFeatures.Add(new Feature(new RectangleShape(-97.080185, 33.013491, -96.465213, 32.490127))); routingOverlay.Layers.Add("RoutingExtentLayer", routingExtentLayer); winformsMap1.Refresh(); }
private void MapControl_Loaded(object sender, RoutedEventArgs e) { mapControl.MapUnit = GeoUnit.Meter; baseOverlay = new LayerOverlay(); CssDocument doc = CssDocument.Load(@"SampleData/Default.sgcss"); baseOverlay.LoadStyledLayers("SampleData", doc); mapControl.Overlays.Add(baseOverlay); buildingOverlay = new LayerOverlay(); altitudeFillStyle = new AltitudeFillStyle(GeoColor.FromHtml("#E6E1DF"), GeoColor.FromHtml("#80D3CDCA"), 1); altitudeFillStyle.AltitudeUnit = LengthUnit.Meter; ShapefileLayer buildingsLayer = new ShapefileLayer(@"SampleData/Buildings.shp"); buildingsLayer.Styles.Add(altitudeFillStyle); buildingOverlay.Layers.Add(buildingsLayer); ShapefileLayer stadiumLayer = new ShapefileLayer(@"SampleData/Stadium.shp"); stadiumLayer.Styles.Add(altitudeFillStyle); buildingOverlay.Layers.Add(stadiumLayer); mapControl.Overlays.Add(buildingOverlay); mapControl.CurrentBound = new GeoBound(11586390.5663, 3584893.2152, 11586849.1885, 3585104.8502); mapControl.Refresh(); directionComboBox.SelectedIndex = 2; altitudeComboBox.SelectedIndex = 0; }
public ValueCircleStyle() : base() { ZoomLevelSet zoomLevelSet = new ZoomLevelSet(); defaultZoomLevel = zoomLevelSet.ZoomLevel04; baseScale = zoomLevelSet.ZoomLevel05.Scale; drawingRadiusRatio = 1; outerColor = GeoColor.FromArgb(255, 10, 20, 255); innerColor = GeoColor.FromArgb(100, 10, 20, 255); minCircleRadiusInDefaultZoomLevel = 10; maxCircleRadiusInDefaultZoomLevel = 100; }
protected DemographicStyleBuilder(IEnumerable<string> selectedColumns) { this.Opacity = 100; this.color = GeoColor.FromHtml("#F1F369"); this.selectedColumns = new Collection<string>(selectedColumns.ToList()); }
public GeoColorViewModel(GeoColor color, string colorName) { ColorBrush = new SolidColorBrush(Color.FromArgb(color.AlphaComponent, color.RedComponent, color.GreenComponent, color.BlueComponent)); ColorName = colorName; GeoColor = color; }
private static Color GetColorFromGeoColor(GeoColor geoColor) { return Color.FromArgb(geoColor.AlphaComponent, geoColor.RedComponent, geoColor.GreenComponent, geoColor.BlueComponent); }