protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.DisplayMapView); TinyGeoFeatureLayer tinyGeoFeatureLayer = new TinyGeoFeatureLayer(SampleHelper.GetDataPath(@"Frisco/Frisco.tgeo")); tinyGeoFeatureLayer.ZoomLevelSet.ZoomLevel11.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.DarkGray, 1F, false); tinyGeoFeatureLayer.ZoomLevelSet.ZoomLevel11.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level14; tinyGeoFeatureLayer.ZoomLevelSet.ZoomLevel15.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.White, 3F, GeoColor.StandardColors.DarkGray, 5F, true); tinyGeoFeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.White, 8F, GeoColor.StandardColors.DarkGray, 10F, true); tinyGeoFeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("[fedirp] [fename] [fetype] [fedirs]", "Arial", 10f, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, 0, -1); tinyGeoFeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle.SuppressPartialLabels = true; tinyGeoFeatureLayer.ZoomLevelSet.ZoomLevel16.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; tinyGeoFeatureLayer.Open(); LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add(tinyGeoFeatureLayer); WorldMapKitOverlay worldMapKitOverlay = new WorldMapKitOverlay(); androidMap = FindViewById <MapView>(Resource.Id.androidmap); androidMap.MapUnit = GeographyUnit.DecimalDegree; androidMap.Overlays.Add(worldMapKitOverlay); androidMap.Overlays.Add(layerOverlay); androidMap.CurrentExtent = tinyGeoFeatureLayer.GetBoundingBox(); SampleViewHelper.InitializeInstruction(this, FindViewById <RelativeLayout>(Resource.Id.MainLayout), GetType()); }
private static ClassBreakClusterPointStyle GetClusterPointStyle() { ClassBreakClusterPointStyle clusterPointStyle = new ClassBreakClusterPointStyle(); clusterPointStyle.CellSize = 65; PointStyle pointStyle1 = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.FromArgb(250, 222, 226, 153)), new GeoPen(GeoColor.FromArgb(100, 222, 226, 153), 5), 8); clusterPointStyle.ClassBreakPoint.Add(1, pointStyle1); PointStyle pointStyle2 = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.FromArgb(250, 222, 226, 153)), new GeoPen(GeoColor.FromArgb(100, 222, 226, 153), 8), 15); clusterPointStyle.ClassBreakPoint.Add(2, pointStyle2); PointStyle pointStyle3 = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.FromArgb(250, 255, 183, 76)), new GeoPen(GeoColor.FromArgb(100, 255, 183, 76), 10), 25); clusterPointStyle.ClassBreakPoint.Add(50, pointStyle3); PointStyle pointStyle4 = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.FromArgb(250, 243, 193, 26)), new GeoPen(GeoColor.FromArgb(100, 243, 193, 26), 15), 35); clusterPointStyle.ClassBreakPoint.Add(150, pointStyle4); PointStyle pointStyle5 = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.FromArgb(250, 245, 7, 10)), new GeoPen(GeoColor.FromArgb(100, 245, 7, 10), 15), 40); clusterPointStyle.ClassBreakPoint.Add(350, pointStyle5); PointStyle pointStyle6 = new PointStyle(PointSymbolType.Circle, new GeoSolidBrush(GeoColor.FromArgb(250, 245, 7, 10)), new GeoPen(GeoColor.FromArgb(100, 245, 7, 10), 20), 50); clusterPointStyle.ClassBreakPoint.Add(500, pointStyle6); clusterPointStyle.TextStyle = TextStyles.CreateSimpleTextStyle("FeatureCount", "Arail", 10, DrawingFontStyles.Regular, GeoColor.SimpleColors.Black); clusterPointStyle.TextStyle.PointPlacement = PointPlacement.Center; return(clusterPointStyle); }
// // GET: /UsingCustomData/ public ActionResult UsingCustomData() { 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(-125, 72, 50, -46); map.MapUnit = GeographyUnit.DecimalDegree; WorldMapKitWmsWebOverlay worldMapKitOverlay = new WorldMapKitWmsWebOverlay(); map.CustomOverlays.Add(worldMapKitOverlay); ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(Server.MapPath("~/App_Data/cntry02.shp")); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green)); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("Test", "Arial", 10, DrawingFontStyles.Regular, GeoColor.StandardColors.Red, 0, -12); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; worldLayer.FeatureSource.CustomColumnFetch += new EventHandler <CustomColumnFetchEventArgs>(FeatureSource_CustomColumnFetch); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle.RequiredColumnNames.Add("Test"); LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.IsBaseOverlay = false; staticOverlay.Layers.Add(worldLayer); map.CustomOverlays.Add(staticOverlay); return(View(map)); }
private void AddMyOwnCustomDataToAFeatureLayer_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 worldShapeLayer = new ShapeFileFeatureLayer(Samples.RootDirectory + @"Data\Countries02.shp"); worldShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green)); worldShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ShapeFileFeatureLayer worldLabelLayer = new ShapeFileFeatureLayer(Samples.RootDirectory + @"Data\Countries02.shp"); worldLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("DynamicPopulation", "Arial", 10, DrawingFontStyles.Regular, GeoColor.StandardColors.Red, 0, -12); worldLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; worldLabelLayer.FeatureSource.CustomColumnFetch += new EventHandler <CustomColumnFetchEventArgs>(FeatureSource_CustomColumnFetch); LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.Layers.Add("WorldShapeLayer", worldShapeLayer); staticOverlay.Layers.Add("WorldLabelLayer", worldLabelLayer); winformsMap1.Overlays.Add(staticOverlay); winformsMap1.CurrentExtent = new RectangleShape(-139.2, 92.4, 120.9, -93.2); winformsMap1.Refresh(); }
private void LayoutRoot_Loaded(object sender, RoutedEventArgs e) { Map1.MapUnit = GeographyUnit.Meter; // Load roads overlay LayerOverlay roadsOverlay = new LayerOverlay(); Map1.Overlays.Add(roadOverlayName, roadsOverlay); // Load road data from a shape file. ShapeFileFeatureLayer roadsFeatureLayer = new ShapeFileFeatureLayer(@"..\..\Data\Roads.shp"); roadsFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = new LineStyle(GeoPens.Gray); roadsFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("ROAD_NAME", "Arial", 8, DrawingFontStyles.Regular, GeoColors.Black); roadsFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; roadsOverlay.Layers.Add(roadsFeatureLayer); // Add highlight overlay LayerOverlay highlightOverlay = new LayerOverlay(); Map1.Overlays.Add(roadHighlightOverlayName, highlightOverlay); InMemoryFeatureLayer highlightLayer = new InMemoryFeatureLayer(); highlightLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = new LineStyle(new GeoPen(new GeoColor(123, GeoColors.Green), 5.0f)); highlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; highlightOverlay.Layers.Add(highlightLayer); // Add marker overlay SimpleMarkerOverlay markerOverlay = new SimpleMarkerOverlay(); Map1.Overlays.Add(markerOverlayName, markerOverlay); // Set the map extent Map1.CurrentExtent = new RectangleShape(2478794.65996324, 7106797.82702127, 2482540.06498076, 7104117.76042073); Map1.Refresh(); }
private void AddSpatialFenceOverlay(Map Map1) { LayerOverlay spatialFenceOverlay = new LayerOverlay("SpatialFenceOverlay"); spatialFenceOverlay.TileType = TileType.SingleTile; spatialFenceOverlay.IsBaseOverlay = false; spatialFenceOverlay.IsVisibleInOverlaySwitcher = false; Map1.CustomOverlays.Add(spatialFenceOverlay); // Initialize SpatialFenceLayers. InMemoryFeatureLayer spatialFenceLayer = new InMemoryFeatureLayer(); spatialFenceLayer.Open(); spatialFenceLayer.Columns.Add(new FeatureSourceColumn("Restricted", "Charater", 10)); spatialFenceLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(new GeoPen(GeoColor.FromArgb(255, 204, 204, 204), 2), new GeoSolidBrush(GeoColor.FromArgb(112, 255, 0, 0))); spatialFenceLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("Restricted", "Arial", 12, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.SimpleColors.White, 2); spatialFenceLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; spatialFenceOverlay.Layers.Add("SpatialFenceLayer", spatialFenceLayer); // Get the spatial fences from the database and insert fences from database into fence layer Collection <Feature> spatialFences = GetSpatialFences(); foreach (Feature spatialFence in spatialFences) { spatialFence.ColumnValues["Restricted"] = "Restricted"; spatialFenceLayer.InternalFeatures.Add(spatialFence); } }
/// <summary> /// Gets an overlay applied with ZedGraph style. /// </summary> public static LayerOverlay GetOverlayWithZedGraphStyle() { // Get the file path name from its relative path. string shpFilePathName = GetFullPath(@"App_Data/MajorCities.shp"); ShapeFileFeatureLayer shapeFileFeatureLayer = new ShapeFileFeatureLayer(shpFilePathName); shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; TextStyle textStyle = TextStyles.CreateSimpleTextStyle("AREANAME", "Arial", 10, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.SimpleColors.White, 2, -20, 40); shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(new PieChartStyle()); shapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(textStyle); shapeFileFeatureLayer.DrawingMarginInPixel = 100; // Apply projection to the shape file which is used for display. Proj4Projection Proj4Projection = new Proj4Projection(); Proj4Projection.InternalProjectionParametersString = Proj4Projection.GetWgs84ParametersString(); Proj4Projection.ExternalProjectionParametersString = Proj4Projection.GetSphericalMercatorParametersString(); shapeFileFeatureLayer.FeatureSource.Projection = Proj4Projection; LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add(shapeFileFeatureLayer); return(layerOverlay); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.DisplayASimpleMap); ShapeFileFeatureLayer txwatFeatureLayer = new ShapeFileFeatureLayer(SampleHelper.GetDataPath(@"Frisco/TXwat.shp")); txwatFeatureLayer.ZoomLevelSet.ZoomLevel12.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(255, 153, 179, 204); txwatFeatureLayer.ZoomLevelSet.ZoomLevel12.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("LandName", "Arial", 9, DrawingFontStyles.Italic, GeoColor.StandardColors.Navy); txwatFeatureLayer.ZoomLevelSet.ZoomLevel12.DefaultTextStyle.SuppressPartialLabels = true; txwatFeatureLayer.ZoomLevelSet.ZoomLevel12.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ShapeFileFeatureLayer txlkaA40FeatureLayer = new ShapeFileFeatureLayer(SampleHelper.GetDataPath(@"Frisco/TXlkaA40.shp")); txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel14.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.DarkGray, 1F, false); txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel15.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.White, 3F, GeoColor.StandardColors.DarkGray, 5F, true); txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.White, 8F, GeoColor.StandardColors.DarkGray, 10F, true); txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("[fedirp] [fename] [fetype] [fedirs]", "Arial", 10f, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, 0, -1); txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle.SuppressPartialLabels = true; txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel16.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; txlkaA40FeatureLayer.DrawingMarginPercentage = 80; ShapeFileFeatureLayer txlkaA20FeatureLayer = new ShapeFileFeatureLayer(SampleHelper.GetDataPath(@"Frisco/TXlkaA20.shp")); txlkaA20FeatureLayer.ZoomLevelSet.ZoomLevel15.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(255, 255, 255, 128), 6, GeoColor.StandardColors.LightGray, 9, true); txlkaA20FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(255, 255, 255, 128), 9, GeoColor.StandardColors.LightGray, 12, true); txlkaA20FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("[fedirp] [fename] [fetype] [fedirs]", "Arial", 12, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, 0, -1); txlkaA20FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle.SuppressPartialLabels = true; txlkaA20FeatureLayer.ZoomLevelSet.ZoomLevel16.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; WorldMapKitOverlay worldMapKitOverlay = new WorldMapKitOverlay(); Marker thinkGeoMarker = new Marker(BaseContext); thinkGeoMarker.Position = new PointShape(-96.809523, 33.128675); thinkGeoMarker.YOffset = -(int)(22 * ThinkGeo.MapSuite.Android.Resources.DisplayMetrics.Density); thinkGeoMarker.SetImageBitmap(BitmapFactory.DecodeResource(ThinkGeo.MapSuite.Android.Resources, Resource.Drawable.Pin)); thinkGeoMarker.Click += ThinkGeoMarkerClick; LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add(txlkaA40FeatureLayer); layerOverlay.Layers.Add(txwatFeatureLayer); layerOverlay.Layers.Add(txlkaA20FeatureLayer); MarkerOverlay markerOverlay = new MarkerOverlay(); markerOverlay.Markers.Add(thinkGeoMarker); androidMap = FindViewById <MapView>(Resource.Id.androidmap); androidMap.MapUnit = GeographyUnit.DecimalDegree; androidMap.CurrentExtent = new RectangleShape(-96.8172, 33.1299, -96.8050, 33.1226); androidMap.Overlays.Add(worldMapKitOverlay); androidMap.Overlays.Add(layerOverlay); androidMap.Overlays.Add(markerOverlay); androidMap.Overlays.Add("PopupOverlay", new PopupOverlay()); SampleViewHelper.InitializeInstruction(this, FindViewById <RelativeLayout>(Resource.Id.MainLayout), GetType()); }
private InMemoryGridIsoLineLayer GetGridIsoLineLayer() { //Create a grid cell matrix based on the textboxes and the current extent CreateGridCellMatrix(); //Load the grid we just created into the GridIsoLineLayer using the number of breaks defines //on the screen Collection <double> isoLineLevels = GridIsoLineLayer.GetIsoLineLevels(wellDepthPointData, Convert.ToInt32(txtGridIsoLineLevelCount.Text)); InMemoryGridIsoLineLayer isoLineLayer = new InMemoryGridIsoLineLayer(gridCellMatrix, isoLineLevels); if (rdoLinesOnlyType.IsChecked.Value.Equals(true)) { isoLineLayer.IsoLineType = IsoLineType.LinesOnly; } else if (rdoClosedLinesAsPolygonsType.IsChecked.Value.Equals(true)) { isoLineLayer.IsoLineType = IsoLineType.ClosedLinesAsPolygons; } else { isoLineLayer.IsoLineType = IsoLineType.LinesOnly; } //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, isoLineLevels.Count, ColorWheelDirection.CounterClockwise); //Setup a class break style based on the isoline levels and the colors ClassBreakStyle classBreakStyle = new ClassBreakStyle(isoLineLayer.DataValueColumnName); Collection <ThinkGeo.MapSuite.Styles.Style> firstStyles = new Collection <ThinkGeo.MapSuite.Styles.Style>(); firstStyles.Add(new LineStyle(new GeoPen(colors[0], 3))); firstStyles.Add(new AreaStyle(new GeoPen(GeoColor.SimpleColors.LightBlue, 3), new GeoSolidBrush(new GeoColor(150, colors[0])))); classBreakStyle.ClassBreaks.Add(new ClassBreak(double.MinValue, firstStyles)); for (int i = 0; i < colors.Count - 1; i++) { Collection <ThinkGeo.MapSuite.Styles.Style> styles = new Collection <ThinkGeo.MapSuite.Styles.Style>(); styles.Add(new LineStyle(new GeoPen(colors[i + 1], 3))); styles.Add(new AreaStyle(new GeoPen(GeoColor.SimpleColors.LightBlue, 3), new GeoSolidBrush(new GeoColor(150, colors[i + 1])))); classBreakStyle.ClassBreaks.Add(new ClassBreak(isoLineLevels[i], styles)); } isoLineLayer.CustomStyles.Add(classBreakStyle); //Create the text styles to label the lines TextStyle textStyle = TextStyles.CreateSimpleTextStyle(isoLineLayer.DataValueColumnName, "Arial", 8, DrawingFontStyles.Bold, GeoColor.StandardColors.Black, 0, 0); textStyle.HaloPen = new GeoPen(GeoColor.StandardColors.White, 2); textStyle.OverlappingRule = LabelOverlappingRule.NoOverlapping; textStyle.SplineType = SplineType.StandardSplining; textStyle.DuplicateRule = LabelDuplicateRule.UnlimitedDuplicateLabels; textStyle.TextLineSegmentRatio = 9999999; textStyle.FittingLineInScreen = true; textStyle.SuppressPartialLabels = true; isoLineLayer.CustomStyles.Add(textStyle); return(isoLineLayer); }
private DynamicIsoLineLayer GetDynamicIsoLineLayer() { Collection <double> isoLineLevels = GridIsoLineLayer.GetIsoLineLevels(wellDepthPointData, Convert.ToInt32(txtGridIsoLineLevelCount.Text)); //Create the new dynamicIsoLineLayer using the well data and the number of isoline levels from //the screen DynamicIsoLineLayer dynamicIsoLineLayer; if (rdoLinesOnlyType.IsChecked.Value.Equals(true)) { dynamicIsoLineLayer = new DynamicIsoLineLayer(wellDepthPointData, isoLineLevels, new InverseDistanceWeightedGridInterpolationModel(2, double.MaxValue), IsoLineType.LinesOnly); } else if (rdoClosedLinesAsPolygonsType.IsChecked.Value.Equals(true)) { dynamicIsoLineLayer = new DynamicIsoLineLayer(wellDepthPointData, isoLineLevels, new InverseDistanceWeightedGridInterpolationModel(2, double.MaxValue), IsoLineType.ClosedLinesAsPolygons); } else { dynamicIsoLineLayer = new DynamicIsoLineLayer(wellDepthPointData, isoLineLevels, new InverseDistanceWeightedGridInterpolationModel(2, double.MaxValue), IsoLineType.LinesOnly); } dynamicIsoLineLayer.CellHeightInPixel = (int)(Map1.ActualHeight / int.Parse(txtDynamicIsoLineCellRowCount.Text)); dynamicIsoLineLayer.CellWidthInPixel = (int)(Map1.ActualWidth / int.Parse(txtDynamicIsoLineCellColumnCount.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, isoLineLevels.Count, ColorWheelDirection.Clockwise); //Setup a class break style based on the isoline levels and the colors ClassBreakStyle classBreakStyle = new ClassBreakStyle(dynamicIsoLineLayer.DataValueColumnName); Collection <ThinkGeo.MapSuite.Styles.Style> firstStyles = new Collection <ThinkGeo.MapSuite.Styles.Style>(); firstStyles.Add(new LineStyle(new GeoPen(colors[0], 3))); firstStyles.Add(new AreaStyle(new GeoPen(GeoColor.SimpleColors.LightBlue, 3), new GeoSolidBrush(new GeoColor(150, colors[0])))); classBreakStyle.ClassBreaks.Add(new ClassBreak(double.MinValue, firstStyles)); for (int i = 0; i < colors.Count - 1; i++) { Collection <ThinkGeo.MapSuite.Styles.Style> styles = new Collection <ThinkGeo.MapSuite.Styles.Style>(); styles.Add(new LineStyle(new GeoPen(colors[i + 1], 3))); styles.Add(new AreaStyle(new GeoPen(GeoColor.SimpleColors.LightBlue, 3), new GeoSolidBrush(new GeoColor(150, colors[i + 1])))); classBreakStyle.ClassBreaks.Add(new ClassBreak(isoLineLevels[i], styles)); } dynamicIsoLineLayer.CustomStyles.Add(classBreakStyle); //Create the text styles to label the lines TextStyle textStyle = TextStyles.CreateSimpleTextStyle(dynamicIsoLineLayer.DataValueColumnName, "Arial", 8, DrawingFontStyles.Bold, GeoColor.StandardColors.Black, 0, 0); textStyle.HaloPen = new GeoPen(GeoColor.StandardColors.White, 2); textStyle.OverlappingRule = LabelOverlappingRule.NoOverlapping; textStyle.SplineType = SplineType.StandardSplining; textStyle.DuplicateRule = LabelDuplicateRule.UnlimitedDuplicateLabels; textStyle.TextLineSegmentRatio = 9999999; textStyle.FittingLineInScreen = true; textStyle.SuppressPartialLabels = true; dynamicIsoLineLayer.CustomStyles.Add(textStyle); return(dynamicIsoLineLayer); }
/// <summary> /// Returns a ThinkGEO style for the region names. /// </summary> /// <returns></returns> public static Style GetRegionNameStyle() { TextStyle aux = TextStyles.CreateSimpleTextStyle("ermtregionname", "Arial", 9, DrawingFontStyles.Bold, GeoColor.StandardColors.Black, 0, -12); aux.DuplicateRule = LabelDuplicateRule.UnlimitedDuplicateLabels; aux.YOffsetInPixel = 3; return(aux); }
private void LoadStreetData() { winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 233, 232, 214)); ShapeFileFeatureLayer ParksShapeLayer = new ShapeFileFeatureLayer(@"..\..\Data\parks.shp"); ShapeFileFeatureLayer.BuildIndexFile(@"..\..\Data\parks.shp", BuildIndexMode.DoNotRebuild); ParksShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ParksShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Park1; ShapeFileFeatureLayer ParksLabelLayer = new ShapeFileFeatureLayer(@"..\..\Data\parks.shp"); ParksLabelLayer.RequireIndex = false; ParksLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("Name", "Arial", 10, DrawingFontStyles.Bold, GeoColor.StandardColors.SeaGreen, GeoColor.StandardColors.White, 2); ParksLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ShapeFileFeatureLayer StreetsShapeLayer = new ShapeFileFeatureLayer(@"..\..\Data\streets.shp"); ShapeFileFeatureLayer.BuildIndexFile(@"..\..\Data\streets.shp", BuildIndexMode.DoNotRebuild); StreetsShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ValueStyle valueStyle = new ValueStyle(); valueStyle.ColumnName = "Type"; valueStyle.ValueItems.Add(new ValueItem("A", LineStyles.LocalRoad2)); valueStyle.ValueItems.Add(new ValueItem("M", LineStyles.MajorRoad1)); StreetsShapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(valueStyle); ShapeFileFeatureLayer StreetsLabelLayer = new ShapeFileFeatureLayer(@"..\..\Data\streets.shp"); StreetsLabelLayer.RequireIndex = false; TextStyle textStyle = new TextStyle(); textStyle.TextColumnName = "St_name"; textStyle.TextSolidBrush = new GeoSolidBrush(GeoColor.StandardColors.Black); textStyle.Font = new GeoFont("Arial", 7); textStyle.TextLineSegmentRatio = 10; textStyle.GridSize = 100; textStyle.SplineType = SplineType.StandardSplining; textStyle.DuplicateRule = LabelDuplicateRule.OneDuplicateLabelPerQuadrant; StreetsLabelLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(textStyle); StreetsLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.GridSize = 5; StreetsLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.Layers.Add("Parks", ParksShapeLayer); staticOverlay.Layers.Add("Streets", StreetsShapeLayer); staticOverlay.Layers.Add("Parks Labels", ParksLabelLayer); staticOverlay.Layers.Add("Streets Labels", StreetsLabelLayer); winformsMap1.Overlays.Add("Street Overlay", staticOverlay); }
private static DynamicIsoLineLayer GetDynamicIsoLineLayer() { // Define the colors for different earthquake magnitude. Collection <GeoColor> colorsOfMagnitude = new Collection <GeoColor>() { GeoColor.FromHtml("#FFFFBE"), GeoColor.FromHtml("#FDFF9E"), GeoColor.FromHtml("#FDFF37"), GeoColor.FromHtml("#FDDA04"), GeoColor.FromHtml("#FFA701"), GeoColor.FromHtml("#FF6F02"), GeoColor.FromHtml("#EC0000"), GeoColor.FromHtml("#B90000"), GeoColor.FromHtml("#850100"), GeoColor.FromHtml("#620001"), GeoColor.FromHtml("#450005"), GeoColor.FromHtml("#2B0804") }; // Get the file path name from its relative path. string shpFilePathName = GetFullPath("App_Data/usEarthquake.shp"); // Create the layer for IsoLine. ShapeFileFeatureSource featureSource = new ShapeFileFeatureSource(shpFilePathName); Dictionary <PointShape, double> dataPoints = GetDataPoints(featureSource); GridInterpolationModel interpolationModel = new InverseDistanceWeightedGridInterpolationModel(3, double.MaxValue); DynamicIsoLineLayer isoLineLayer = new DynamicIsoLineLayer(dataPoints, GetClassBreakValues(dataPoints.Values, 12), interpolationModel, IsoLineType.ClosedLinesAsPolygons); // Create the style for different level of earthquake magnitude. ClassBreakStyle earthquakeMagnitudeBreakStyle = new ClassBreakStyle(isoLineLayer.DataValueColumnName); earthquakeMagnitudeBreakStyle.ClassBreaks.Add(new ClassBreak(double.MinValue, new AreaStyle(new GeoPen(GeoColor.FromHtml("#FE6B06"), 1), new GeoSolidBrush(new GeoColor(100, colorsOfMagnitude[0]))))); for (int i = 0; i < isoLineLayer.IsoLineLevels.Count - 1; i++) { earthquakeMagnitudeBreakStyle.ClassBreaks.Add(new ClassBreak(isoLineLayer.IsoLineLevels[i + 1], new AreaStyle(new GeoPen(GeoColor.FromHtml("#FE6B06"), 1), new GeoSolidBrush(new GeoColor(100, colorsOfMagnitude[i + 1]))))); } isoLineLayer.CustomStyles.Add(earthquakeMagnitudeBreakStyle); TextStyle textStyle = TextStyles.CreateSimpleTextStyle(isoLineLayer.DataValueColumnName, "Arial", 8, DrawingFontStyles.Bold, GeoColor.StandardColors.Black, 0, 0); textStyle.HaloPen = new GeoPen(GeoColor.StandardColors.White, 2); textStyle.OverlappingRule = LabelOverlappingRule.NoOverlapping; textStyle.SplineType = SplineType.StandardSplining; textStyle.DuplicateRule = LabelDuplicateRule.UnlimitedDuplicateLabels; textStyle.TextLineSegmentRatio = 9999999; textStyle.FittingLineInScreen = true; textStyle.SuppressPartialLabels = true; textStyle.NumericFormat = "{0:0.00}"; isoLineLayer.CustomStyles.Add(textStyle); return(isoLineLayer); }
private void TestForm_Load(object sender, EventArgs e) { winformsMap1.MapUnit = GeographyUnit.DecimalDegree; winformsMap1.CurrentExtent = new RectangleShape(-125, 47, -67, 25); winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255)); ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"..\..\Data\Countries02.shp"); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1; worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ShapeFileFeatureLayer capitalLayer = new ShapeFileFeatureLayer(@"..\..\Data\WorldCapitals.shp"); // We can customize our own Style. Here we passed in a color and a size. capitalLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.White, 7, GeoColor.StandardColors.Brown); // The Style we set here is available from ZoomLevel01 to ZoomLevel05. That means if we zoom in a bit more, the appearance we set here will not be visible anymore. capitalLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level05; capitalLayer.ZoomLevelSet.ZoomLevel06.DefaultPointStyle = PointStyles.Capital3; // The Style we set here is available from ZoomLevel06 to ZoomLevel20. That means if we zoom out a bit more, the appearance we set here will not be visible any more. capitalLayer.ZoomLevelSet.ZoomLevel06.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ShapeFileFeatureLayer capitalLabelLayer = new ShapeFileFeatureLayer(@"..\..\Data\WorldCapitals.shp"); // We can customize our own TextStyle. Here we passed in the font, the size, the style and the color. capitalLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("CITY_NAME", "Arial", 8, DrawingFontStyles.Italic, GeoColor.StandardColors.Black, 3, 3); // The TextStyle we set here is available from ZoomLevel01 to ZoomLevel05. capitalLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level05; capitalLabelLayer.ZoomLevelSet.ZoomLevel06.DefaultTextStyle = TextStyles.Capital3("CITY_NAME"); // The TextStyle we set here is available from ZoomLevel06 to ZoomLevel20. capitalLabelLayer.ZoomLevelSet.ZoomLevel06.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; // As the map is drawn by tiles, it needs to draw on the margin to make sure the text is complete after the tiles are joined together. // Change the number to another one (for example 0) and you can see the difference expecially when panning. capitalLabelLayer.DrawingMarginPercentage = 50; LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add(worldLayer); layerOverlay.Layers.Add(capitalLayer); layerOverlay.Layers.Add(capitalLabelLayer); //Sets the zoom snapping mode to snap up. winformsMap1.ZoomLevelSnapping = ZoomLevelSnappingMode.SnapUp; //Sets the tilecache when in Snap Up mode for zoom snapping. layerOverlay.TileCache = fileBitmapTileCache; winformsMap1.Overlays.Add(layerOverlay); winformsMap1.Refresh(); }
private void Initialize() { Collection <GeoColor> levelAreaColors = new Collection <GeoColor>(); levelAreaColors.Add(GeoColor.FromHtml("#FFFFBE")); levelAreaColors.Add(GeoColor.FromHtml("#FDFF9E")); levelAreaColors.Add(GeoColor.FromHtml("#FDFF37")); levelAreaColors.Add(GeoColor.FromHtml("#FDDA04")); levelAreaColors.Add(GeoColor.FromHtml("#FFA701")); levelAreaColors.Add(GeoColor.FromHtml("#FF6F02")); levelAreaColors.Add(GeoColor.FromHtml("#EC0000")); levelAreaColors.Add(GeoColor.FromHtml("#B90000")); levelAreaColors.Add(GeoColor.FromHtml("#850100")); levelAreaColors.Add(GeoColor.FromHtml("#620001")); levelAreaColors.Add(GeoColor.FromHtml("#450005")); levelAreaColors.Add(GeoColor.FromHtml("#2B0804")); FeatureSource.Open(); Dictionary <PointShape, double> dataPoints = GetDataPoints(); GridInterpolationModel interpolationModel = new InverseDistanceWeightedGridInterpolationModel(3, double.MaxValue); isoLineLayer = new DynamicIsoLineLayer(dataPoints, GetClassBreakValues(dataPoints.Values, 12), interpolationModel, IsoLineType.ClosedLinesAsPolygons); isoLineLayer.CellWidthInPixel = 32; isoLineLayer.CellHeightInPixel = 32; levelClassBreakStyle = new ClassBreakStyle(isoLineLayer.DataValueColumnName); levelClassBreakStyle.ClassBreaks.Add(new ClassBreak(double.MinValue, new AreaStyle(new GeoPen(GeoColor.FromHtml("#FE6B06"), 1), new GeoSolidBrush(new GeoColor(100, levelAreaColors[0]))))); for (int i = 0; i < IsoLineLevels.Count - 1; i++) { if (!levelClassBreakStyle.ClassBreaks.Any(c => c.Value == IsoLineLevels[i + 1])) { levelClassBreakStyle.ClassBreaks.Add(new ClassBreak(IsoLineLevels[i + 1], new AreaStyle(new GeoPen(GeoColor.FromHtml("#FE6B06"), 1), new GeoSolidBrush(new GeoColor(100, levelAreaColors[i + 1]))))); } } isoLineLayer.CustomStyles.Add(levelClassBreakStyle); TextStyle textStyle = TextStyles.CreateSimpleTextStyle(isoLineLayer.DataValueColumnName, "Arial", 8, DrawingFontStyles.Bold, GeoColor.StandardColors.Black, 0, 0); textStyle.HaloPen = new GeoPen(GeoColor.StandardColors.White, 2); textStyle.OverlappingRule = LabelOverlappingRule.NoOverlapping; textStyle.SplineType = SplineType.StandardSplining; textStyle.DuplicateRule = LabelDuplicateRule.UnlimitedDuplicateLabels; textStyle.TextLineSegmentRatio = 9999999; textStyle.FittingLineInScreen = true; textStyle.SuppressPartialLabels = true; textStyle.NumericFormat = "{0:0.00}"; isoLineLayer.CustomStyles.Add(textStyle); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.DisplayASimpleMap); ValueStyle pointStyle = new ValueStyle(); pointStyle.ColumnName = "IsWayPoint"; pointStyle.ValueItems.Add(new ValueItem("0", PointStyles.CreateSimplePointStyle(PointSymbolType.Circle, GeoColor.SimpleColors.Red, 4))); pointStyle.ValueItems.Add(new ValueItem("1", PointStyles.CreateSimplePointStyle(PointSymbolType.Circle, GeoColor.SimpleColors.Green, 8))); LineStyle roadstyle = LineStyles.CreateSimpleLineStyle(GeoColor.SimpleColors.Black, 1, true); TextStyle labelStyle = TextStyles.CreateSimpleTextStyle("name", "Arial", 8, DrawingFontStyles.Bold, GeoColor.SimpleColors.Black); labelStyle.PointPlacement = PointPlacement.UpperCenter; labelStyle.OverlappingRule = LabelOverlappingRule.NoOverlapping; labelStyle.YOffsetInPixel = 8; GpxFeatureLayer gpxFeatureLayer = new GpxFeatureLayer(SampleHelper.GetDataPath(@"Gpx/afoxboro.gpx")); gpxFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(pointStyle); gpxFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(roadstyle); gpxFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; gpxFeatureLayer.Open(); GpxFeatureLayer gpxTextLayer = new GpxFeatureLayer(SampleHelper.GetDataPath(@"Gpx/afoxboro.gpx")); gpxTextLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(labelStyle); gpxTextLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add(gpxFeatureLayer); layerOverlay.Layers.Add(gpxTextLayer); WorldMapKitOverlay worldMapKitOverlay = new WorldMapKitOverlay(); androidMap = FindViewById <MapView>(Resource.Id.androidmap); androidMap.Overlays.Add(worldMapKitOverlay); androidMap.Overlays.Add(layerOverlay); androidMap.CurrentExtent = gpxFeatureLayer.GetBoundingBox(); androidMap.MapUnit = GeographyUnit.DecimalDegree; SampleViewHelper.InitializeInstruction(this, FindViewById <RelativeLayout>(Resource.Id.MainLayout), GetType()); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.DisplayASimpleMap); ShapeFileFeatureLayer txwatFeatureLayer = new ShapeFileFeatureLayer(SampleHelper.GetDataPath(@"Frisco/TXwat.shp")); txwatFeatureLayer.ZoomLevelSet.ZoomLevel12.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(255, 153, 179, 204); txwatFeatureLayer.ZoomLevelSet.ZoomLevel12.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("LandName", "Arial", 9, DrawingFontStyles.Italic, GeoColor.StandardColors.Navy); txwatFeatureLayer.ZoomLevelSet.ZoomLevel12.DefaultTextStyle.SuppressPartialLabels = true; txwatFeatureLayer.ZoomLevelSet.ZoomLevel12.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ShapeFileFeatureLayer txlkaA40FeatureLayer = new ShapeFileFeatureLayer(SampleHelper.GetDataPath(@"Frisco/TXlkaA40.shp")); txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel14.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.DarkGray, 1F, false); txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel15.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.White, 3F, GeoColor.StandardColors.DarkGray, 5F, true); txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.White, 8F, GeoColor.StandardColors.DarkGray, 10F, true); txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("[fedirp] [fename] [fetype] [fedirs]", "Arial", 10f, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, 0, -1); txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle.SuppressPartialLabels = true; txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel16.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; txlkaA40FeatureLayer.DrawingMarginPercentage = 80; ShapeFileFeatureLayer txlkaA20FeatureLayer = new ShapeFileFeatureLayer(SampleHelper.GetDataPath(@"Frisco/TXlkaA20.shp")); txlkaA20FeatureLayer.ZoomLevelSet.ZoomLevel15.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(255, 255, 255, 128), 6, GeoColor.StandardColors.LightGray, 9, true); txlkaA20FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(255, 255, 255, 128), 9, GeoColor.StandardColors.LightGray, 12, true); txlkaA20FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("[fedirp] [fename] [fetype] [fedirs]", "Arial", 12, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, 0, -1); txlkaA20FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle.SuppressPartialLabels = true; txlkaA20FeatureLayer.ZoomLevelSet.ZoomLevel16.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; markerOverlay = new MarkerOverlay(); LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add("TXwat", txwatFeatureLayer); layerOverlay.Layers.Add("TXlkaA20", txlkaA20FeatureLayer); layerOverlay.Layers.Add("TXlkaA40", txlkaA40FeatureLayer); androidMap = FindViewById <MapView>(Resource.Id.androidmap); androidMap.MapUnit = GeographyUnit.DecimalDegree; androidMap.CurrentExtent = new RectangleShape(-96.8172, 33.1299, -96.8050, 33.1226); androidMap.Overlays.Add("markerOverlay", markerOverlay); androidMap.Overlays.Add(layerOverlay); androidMap.MapSingleTap += AndroidMap_MapSingleTap; SampleViewHelper.InitializeInstruction(this, FindViewById <RelativeLayout>(Resource.Id.MainLayout), GetType()); }
private void DrawUsingZedGraphStyle_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 statesLayer = new ShapeFileFeatureLayer(Samples.RootDirectory + @"Data\USStates.shp"); statesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.SimpleColors.Transparent, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green)); statesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay worldOverlay = new LayerOverlay(); worldOverlay.Layers.Add("States", statesLayer); winformsMap1.Overlays.Add("WorldOverlay", worldOverlay); ShapeFileFeatureLayer citiesLayer = new ShapeFileFeatureLayer(Samples.RootDirectory + @"Data\MajorCities.shp"); //Create our Zedgraph Sytle and wire up the event. ZedGraphStyle zedGraphStyle = new ZedGraphStyle(); zedGraphStyle.ZedGraphDrawing += new EventHandler <ZedGraphDrawingEventArgs>(zedGraphStyle_ZedGraphDrawing); zedGraphStyle.RequiredColumnNames.Add("WHITE"); zedGraphStyle.RequiredColumnNames.Add("ASIAN"); zedGraphStyle.RequiredColumnNames.Add("AREANAME"); TextStyle textStyle = TextStyles.CreateSimpleTextStyle("AREANAME", "Arial", 12, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green), 2, 0, -8); citiesLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(zedGraphStyle); citiesLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(textStyle); citiesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay citiesOverlay = new LayerOverlay(); citiesOverlay.Layers.Add("Cities", citiesLayer); citiesOverlay.TileCache = null; winformsMap1.Overlays.Add("CitiesOverlay", citiesOverlay); winformsMap1.CurrentExtent = new RectangleShape(-123.41875, 41.96396484375, -107.158984375, 30.36240234375); winformsMap1.Refresh(); }
private void Initialize() { Dictionary <PointShape, double> dataPoints = new Dictionary <PointShape, double>(); if (!FeatureSource.IsOpen) { FeatureSource.Open(); } Collection <Feature> allFeatures = FeatureSource.GetAllFeatures(new Collection <string>() { Resources.LongitudeColumnName, Resources.LatitudeColumnName, Resources.MagnitudeColumnName }); var featureColumnQuery = allFeatures.Where(n => double.Parse(n.ColumnValues[Resources.MagnitudeColumnName]) > 0).Select(n => new { Longitude = double.Parse(n.ColumnValues[Resources.LongitudeColumnName]), Latitude = double.Parse(n.ColumnValues[Resources.LatitudeColumnName]), Magnitude = double.Parse(n.ColumnValues[Resources.MagnitudeColumnName]) }); foreach (var column in featureColumnQuery) { dataPoints.Add(new PointShape(column.Longitude, column.Latitude), column.Magnitude); } double[] dataCollection = dataPoints.Select(n => n.Value).ToArray(); Collection <double> isoLineLevels = new Collection <double>(GetClassBreakValues(dataCollection, 12).ToList()); isoLineLayer = new DynamicIsoLineLayer(dataPoints, isoLineLevels, new InverseDistanceWeightedGridInterpolationModel(3, double.MaxValue), IsoLineType.ClosedLinesAsPolygons); isoLineLayer.CustomStyles.Add(LevelClassBreakStyle); //Create the text styles to label the lines TextStyle textStyle = TextStyles.CreateSimpleTextStyle(isoLineLayer.DataValueColumnName, "Arial", 8, DrawingFontStyles.Bold, GeoColor.StandardColors.Black, 0, 0); textStyle.HaloPen = new GeoPen(GeoColor.StandardColors.White, 2); textStyle.OverlappingRule = LabelOverlappingRule.NoOverlapping; textStyle.SplineType = SplineType.StandardSplining; textStyle.DuplicateRule = LabelDuplicateRule.UnlimitedDuplicateLabels; textStyle.TextLineSegmentRatio = 9999999; textStyle.FittingLineInScreen = true; textStyle.SuppressPartialLabels = true; textStyle.NumericFormat = "{0:0.00}"; isoLineLayer.CustomStyles.Add(textStyle); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.DisplayASimpleMap); ShapeFileFeatureLayer txlka40FeatureLayer = new ShapeFileFeatureLayer(SampleHelper.GetDataPath(@"Frisco/TXlkaA40.shp")); txlka40FeatureLayer.ZoomLevelSet.ZoomLevel14.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.DarkGray, 1F, false); txlka40FeatureLayer.ZoomLevelSet.ZoomLevel15.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.White, 3F, GeoColor.StandardColors.DarkGray, 5F, true); txlka40FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.White, 8F, GeoColor.StandardColors.DarkGray, 10F, true); txlka40FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("[fedirp] [fename] [fetype] [fedirs]", "Arial", 10f, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, 0, -1); txlka40FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle.SuppressPartialLabels = true; txlka40FeatureLayer.ZoomLevelSet.ZoomLevel16.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; txlka40FeatureLayer.DrawingMarginPercentage = 80; InMemoryFeatureLayer highlightLayer = new InMemoryFeatureLayer(); highlightLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.White, 9.2F, GeoColor.StandardColors.DarkGray, 12.2F, true); highlightLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle.InnerPen.Brush = new GeoSolidBrush(GeoColor.FromArgb(150, GeoColor.SimpleColors.Blue)); highlightLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add("TXlkaA40", txlka40FeatureLayer); LayerOverlay highlightOverlay = new LayerOverlay(); highlightOverlay.Layers.Add("HighlightLayer", highlightLayer); androidMap = FindViewById <MapView>(Resource.Id.androidmap); androidMap.MapUnit = GeographyUnit.DecimalDegree; androidMap.CurrentExtent = new RectangleShape(-96.8172, 33.1299, -96.8050, 33.1226); androidMap.Overlays.Add("RoadOverlay", layerOverlay); androidMap.Overlays.Add("HighlightOverlay", highlightOverlay); androidMap.MapSingleTap += AndroidMap_MapSingleTap; messageLabel = new TextView(this); SampleViewHelper.InitializeInstruction(this, FindViewById <RelativeLayout>(Resource.Id.MainLayout), GetType(), new Collection <View>() { messageLabel }); }
public ActionResult SetImageFormatAndQuality(Map map, GeoCollection <object> args) { if (null == map) { map = new Map("Map1", new System.Web.UI.WebControls.Unit(100, UnitType.Percentage), 510); ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(Server.MapPath("~/App_Data/cntry02.shp")); worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(255, 243, 239, 228), GeoColor.FromArgb(255, 218, 193, 163), 1); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ShapeFileFeatureLayer majorCitiesShapeLayer = new ShapeFileFeatureLayer(Server.MapPath(@"~\App_Data\cities_a.shp")); majorCitiesShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateCompoundCircleStyle(GeoColor.StandardColors.White, 6F, GeoColor.StandardColors.Black, 1F, GeoColor.StandardColors.Black, 3F); majorCitiesShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ShapeFileFeatureLayer majorCitiesLabelLayer = new ShapeFileFeatureLayer(Server.MapPath(@"~\App_Data\cities_a.shp")); majorCitiesLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("AREANAME", "Verdana", 8, DrawingFontStyles.Regular, GeoColor.StandardColors.Black); majorCitiesLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.PointPlacement = PointPlacement.UpperCenter; majorCitiesLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay overlay = new LayerOverlay("mapOverlay"); overlay.TileType = TileType.SingleTile; overlay.Layers.Add("WorldLayer", worldLayer); overlay.Layers.Add("MajorCitiesShapes", majorCitiesShapeLayer); overlay.Layers.Add("MajorCitiesLabels", majorCitiesLabelLayer); map.CustomOverlays.Add(overlay); } else { if (null != args && args.Count > 0) { int quality = System.Convert.ToInt32(args[0]); ((LayerOverlay)map.CustomOverlays["mapOverlay"]).JpegQuality = quality; } } return(View(map)); }
private void ChangeTheLabelPosition_Load(object sender, EventArgs e) { winformsMap1.MapUnit = GeographyUnit.DecimalDegree; winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean); ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(Samples.RootDirectory + @"Data\Countries02.shp"); worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1; ShapeFileFeatureLayer statesLayer = new ShapeFileFeatureLayer(Samples.RootDirectory + @"Data\USStates.shp"); statesLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1; statesLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ShapeFileFeatureLayer worldLabelLayer = new ShapeFileFeatureLayer(Samples.RootDirectory + @"Data\USStates.shp"); worldLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("STATE_NAME", "Arial", 7, DrawingFontStyles.Bold, GeoColor.FromArgb(255, 91, 91, 91)); worldLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.PointPlacement = PointPlacement.Center; worldLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.OverlappingRule = LabelOverlappingRule.NoOverlapping; worldLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.DuplicateRule = LabelDuplicateRule.NoDuplicateLabels; worldLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; worldLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.LabelPositions.Add("33", new WorldLabelingCandidate("Kansas State", new PointShape(-91.3969, 28.1016))); worldLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.LabelPositions.Add("4", new WorldLabelingCandidate("North Dakota State", new PointShape(-101.09, 51.11))); worldLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.LabelPositions.Add("24", new WorldLabelingCandidate("California State", new PointShape(-126.2, 36.27))); LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.Layers.Add("WorldLayer", worldLayer); staticOverlay.Layers.Add("StatesLayer", statesLayer); staticOverlay.Layers.Add("worldLabelLayer", worldLabelLayer); winformsMap1.Overlays.Add(staticOverlay); winformsMap1.CurrentExtent = new RectangleShape(-126.4, 48.8, -67.0, 19.0); winformsMap1.Refresh(); }
protected override Collection <Style> GetStylesCore(FeatureSource featureSource) { // here we generated a class break style and a text style. Collection <GeoColor> familyColors = GeoColor.GetColorsInQualityFamily(Color, EndColor, classBreakCount, ColorWheelDirection); featureSource.Open(); int featureCount = featureSource.GetCount(); double[] values = new double[featureCount]; for (int i = 0; i < featureCount; i++) { Feature feature = featureSource.GetFeatureById((i + 1).ToString(CultureInfo.InvariantCulture), SelectedColumns); double columnValue; if (double.TryParse(feature.ColumnValues[SelectedColumns[0]], out columnValue)) { values[i] = columnValue; } } featureSource.Close(); ClassBreakStyle classBreakStyle = new ClassBreakStyle(SelectedColumns[0]) { BreakValueInclusion = BreakValueInclusion.IncludeValue }; double[] classBreakValues = GetClusterClassBreaks(values, ClassBreakCount - 1); for (int i = 0; i < classBreakValues.Length; i++) { ClassBreak classBreak = new ClassBreak(classBreakValues[i], AreaStyles.CreateSimpleAreaStyle(new GeoColor(this.Opacity, familyColors[i]), GeoColor.FromHtml("#f05133"), 1)); classBreakStyle.ClassBreaks.Add(classBreak); } return(new Collection <Style>() { classBreakStyle, TextStyles.CreateSimpleTextStyle("NAME", "Arial", 8, DrawingFontStyles.Bold, GeoColor.StandardColors.Black, GeoColor.StandardColors.White, 3) }); }
private InMemoryFeatureLayer GetWellDepthPointLayer() { //Create an in memory layer to hold the well data from the text file InMemoryFeatureLayer inMemoryFeatureLayer = new InMemoryFeatureLayer(); inMemoryFeatureLayer.FeatureSource.Open(); //Make sure to specify the depth column inMemoryFeatureLayer.Columns.Add(new FeatureSourceColumn("Depth", "String", 10)); //Loop through all the point data and add it to the in memory layer foreach (KeyValuePair <PointShape, double> wellDepth in wellDepthPointData) { Feature feature = new Feature(wellDepth.Key); feature.ColumnValues.Add("Depth", wellDepth.Value.ToString()); inMemoryFeatureLayer.InternalFeatures.Add(feature); } //Now that all of the data is added we can build an in memory index to make the lookups fast inMemoryFeatureLayer.BuildIndex(); //Create the well point style PointStyle pointStyle1 = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.White, 4, GeoColor.SimpleColors.Black, 2); inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(pointStyle1); //Create the text style with a halo TextStyle textStyle = TextStyles.CreateSimpleTextStyle("Depth", "Arial", 10, DrawingFontStyles.Regular, GeoColor.SimpleColors.Black); textStyle.HaloPen = new GeoPen(GeoColor.StandardColors.White, 3); textStyle.PointPlacement = PointPlacement.UpperCenter; textStyle.YOffsetInPixel = 5; //Apply these styles at all levels and add then to the custom styles for the layer inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(textStyle); return(inMemoryFeatureLayer); }
private void InitializeOverlays() { string cacheFolder = Path.Combine(Path.GetTempPath(), "TileCache"); WorldMapKitWmsWpfOverlay worldMapKitRoadOverlay = new WorldMapKitWmsWpfOverlay(); worldMapKitRoadOverlay.Name = Resources.WorldMapKitOverlayRoadName; worldMapKitRoadOverlay.TileHeight = 512; worldMapKitRoadOverlay.TileWidth = 512; worldMapKitRoadOverlay.Projection = WorldMapKitProjection.SphericalMercator; worldMapKitRoadOverlay.MapType = WorldMapKitMapType.Road; worldMapKitRoadOverlay.IsVisible = true; worldMapKitRoadOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitOverlayRoadName); mapControl.Overlays.Add(worldMapKitRoadOverlay); WorldMapKitWmsWpfOverlay worldMapKitAerialOverlay = new WorldMapKitWmsWpfOverlay(); worldMapKitAerialOverlay.Name = Resources.WorldMapKitOverlayAerialName; worldMapKitAerialOverlay.TileHeight = 512; worldMapKitAerialOverlay.TileWidth = 512; worldMapKitAerialOverlay.Projection = WorldMapKitProjection.SphericalMercator; worldMapKitAerialOverlay.MapType = WorldMapKitMapType.Aerial; worldMapKitAerialOverlay.IsVisible = false; worldMapKitAerialOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitOverlayAerialName); mapControl.Overlays.Add(worldMapKitAerialOverlay); WorldMapKitWmsWpfOverlay worldMapKitAerialWithLabelsOverlay = new WorldMapKitWmsWpfOverlay(); worldMapKitAerialWithLabelsOverlay.Name = Resources.WorldMapKitOverlayAerialWithLabelsName; worldMapKitAerialWithLabelsOverlay.TileHeight = 512; worldMapKitAerialWithLabelsOverlay.TileWidth = 512; worldMapKitAerialWithLabelsOverlay.Projection = WorldMapKitProjection.SphericalMercator; worldMapKitAerialWithLabelsOverlay.MapType = WorldMapKitMapType.AerialWithLabels; worldMapKitAerialWithLabelsOverlay.IsVisible = false; worldMapKitAerialWithLabelsOverlay.TileCache = new FileBitmapTileCache(cacheFolder, Resources.WorldMapKitOverlayAerialWithLabelsName); mapControl.Overlays.Add(worldMapKitAerialWithLabelsOverlay); OpenStreetMapOverlay openStreetMapOverlay = new OpenStreetMapOverlay(); openStreetMapOverlay.Name = Resources.OpenStreetMapName; openStreetMapOverlay.TileHeight = 512; openStreetMapOverlay.TileWidth = 512; openStreetMapOverlay.IsVisible = false; openStreetMapOverlay.TileCache = new FileBitmapTileCache(cacheFolder, "OpenStreetMap"); mapControl.Overlays.Add(Resources.OpenStreetMapKey, openStreetMapOverlay); BingMapsOverlay bingMapsAerialOverlay = new BingMapsOverlay(); bingMapsAerialOverlay.Name = Resources.BingMapsAerialMapName; bingMapsAerialOverlay.TileHeight = 512; bingMapsAerialOverlay.TileWidth = 512; bingMapsAerialOverlay.MapType = Wpf.BingMapsMapType.Aerial; bingMapsAerialOverlay.IsVisible = false; bingMapsAerialOverlay.TileCache = new FileBitmapTileCache(cacheFolder, "BingMapsAerial"); mapControl.Overlays.Add(Resources.BingAerialKey, bingMapsAerialOverlay); BingMapsOverlay bingMapsRoadOverlay = new BingMapsOverlay(); bingMapsRoadOverlay.Name = Resources.BingMapsRoadMapName; bingMapsRoadOverlay.TileHeight = 512; bingMapsRoadOverlay.TileWidth = 512; bingMapsRoadOverlay.MapType = Wpf.BingMapsMapType.Road; bingMapsRoadOverlay.IsVisible = false; bingMapsRoadOverlay.TileCache = new FileBitmapTileCache(cacheFolder, "BingMapsRoad"); mapControl.Overlays.Add(Resources.BingRoadKey, bingMapsRoadOverlay); InMemoryFeatureLayer spatialFenceLayer = new InMemoryFeatureLayer(); spatialFenceLayer.Open(); spatialFenceLayer.Columns.Add(new FeatureSourceColumn(Resources.RestrictedName, "Charater", 10)); spatialFenceLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = new AreaStyle(new GeoPen(GeoColor.FromArgb(255, 204, 204, 204), 2), new GeoSolidBrush(GeoColor.FromArgb(112, 255, 0, 0))); spatialFenceLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle(Resources.RestrictedName, "Arial", 12, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.SimpleColors.White, 2); spatialFenceLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay spatialFenceOverlay = new LayerOverlay(); spatialFenceOverlay.TileType = TileType.SingleTile; spatialFenceOverlay.Name = Resources.SpatialFenceOverlayName; spatialFenceOverlay.Layers.Add(Resources.SpatialFenceLayerName, spatialFenceLayer); mapControl.Overlays.Add(Resources.SpatialFenceOverlayName, spatialFenceOverlay); LayerOverlay traceOverlay = new LayerOverlay(); traceOverlay.Name = Resources.TraceOverlayName; traceOverlay.TileType = TileType.SingleTile; mapControl.Overlays.Add(Resources.TraceOverlayName, traceOverlay); mapControl.Overlays.Add(Resources.PopupOverlayName, new PopupOverlay { Name = Resources.PopupOverlayName }); ScaleBarAdornmentLayer scaleBarAdormentLayer = new ScaleBarAdornmentLayer(); scaleBarAdormentLayer.UnitFamily = UnitSystem.Metric; mapControl.AdornmentOverlay.Layers.Add(Resources.ScaleBarName, scaleBarAdormentLayer); }
private void TestForm_Load(object sender, EventArgs e) { //Sets timer properties timer.Interval = 750; timer.Tick += new EventHandler(timer_Tick); winformsMap1.MapUnit = GeographyUnit.DecimalDegree; winformsMap1.CurrentExtent = new RectangleShape(-97.7591, 30.3126, -97.7317, 30.2964); winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255)); //Displays the World Map Kit as a background. ThinkGeo.MapSuite.DesktopEdition.WorldMapKitWmsDesktopOverlay worldMapKitDesktopOverlay = new ThinkGeo.MapSuite.DesktopEdition.WorldMapKitWmsDesktopOverlay(); winformsMap1.Overlays.Add(worldMapKitDesktopOverlay); //Adds the inMemoryFeatureLayer for car icon and label. InMemoryFeatureLayer inMemoryFeatureLayer = new InMemoryFeatureLayer(); //Adds column to InMemoryFeatureLayer. inMemoryFeatureLayer.Open(); inMemoryFeatureLayer.Columns.Add(new FeatureSourceColumn("VehiclePosition")); inMemoryFeatureLayer.Close(); //Sets PointStyle and TextStyle for the InMemoryFeatureLayer. inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle.PointType = PointType.Bitmap; inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("VehiclePosition", "Arial", 8, DrawingFontStyles.Bold, GeoColor.StandardColors.Black, 20, 0); inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle.Mask = new AreaStyle(new GeoPen(GeoColor.StandardColors.DarkGray, 1), new GeoSolidBrush(GeoColor.FromArgb(150, GeoColor.StandardColors.LightGoldenrodYellow))); inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; //Adds the Feature for the car. inMemoryFeatureLayer.InternalFeatures.Add("Car", new Feature(new PointShape())); LayerOverlay dynamicOverlay = new LayerOverlay(); dynamicOverlay.Layers.Add("CarLayer", inMemoryFeatureLayer); winformsMap1.Overlays.Add("DynamicOverlay", dynamicOverlay); winformsMap1.Refresh(); timer.Start(); }
private void Map1_Loaded(object sender, RoutedEventArgs e) { Map1.MapUnit = GeographyUnit.DecimalDegree; ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(@"../../Data/Countries02.shp"); AreaStyle areaStyle = new AreaStyle(); areaStyle.FillSolidBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 233, 232, 214)); areaStyle.OutlinePen = new GeoPen(GeoColor.FromArgb(255, 118, 138, 69), 1); areaStyle.OutlinePen.DashStyle = LineDashStyle.Solid; worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = areaStyle; worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; PointStyle pointStyle = new PointStyle(); pointStyle.SymbolType = PointSymbolType.Square; pointStyle.SymbolSolidBrush = new GeoSolidBrush(GeoColor.StandardColors.White); pointStyle.SymbolPen = new GeoPen(GeoColor.StandardColors.Black, 1); pointStyle.SymbolSize = 6; PointStyle stackStyle = new PointStyle(); stackStyle.SymbolType = PointSymbolType.Square; stackStyle.SymbolSolidBrush = new GeoSolidBrush(GeoColor.StandardColors.Maroon); stackStyle.SymbolPen = new GeoPen(GeoColor.StandardColors.Transparent, 0); stackStyle.SymbolSize = 2; pointStyle.CustomPointStyles.Add(stackStyle); ShapeFileFeatureLayer capitalLayer = new ShapeFileFeatureLayer(@"../../Data/WorldCapitals.shp"); // We can customize our own Style. Here we passed in a color and a size. capitalLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.StandardColors.White, 7, GeoColor.StandardColors.Brown); // The Style we set here is available from ZoomLevel01 to ZoomLevel05. That means if we zoom in a bit more, the appearance we set here will not be visible anymore. capitalLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; capitalLayer.ZoomLevelSet.ZoomLevel06.DefaultPointStyle = pointStyle; // The Style we set here is available from ZoomLevel06 to ZoomLevel20. That means if we zoom out a bit more, the appearance we set here will not be visible any more. capitalLayer.ZoomLevelSet.ZoomLevel06.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ShapeFileFeatureLayer capitalLabelLayer = new ShapeFileFeatureLayer(@"../../Data/WorldCapitals.shp"); // We can customize our own TextStyle. Here we passed in the font, the size, the style and the color. GeoFont font = new GeoFont("Arial", 9, DrawingFontStyles.Bold); GeoSolidBrush txtBrush = new GeoSolidBrush(GeoColor.StandardColors.Maroon); TextStyle textStyle = new TextStyle("CITY_NAME", font, txtBrush); textStyle.XOffsetInPixel = 0; textStyle.YOffsetInPixel = -6; capitalLabelLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("CITY_NAME", "Arial", 8, DrawingFontStyles.Italic, GeoColor.StandardColors.Black, 3, 3); // The TextStyle we set here is available from ZoomLevel01 to ZoomLevel05. capitalLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level05; capitalLabelLayer.ZoomLevelSet.ZoomLevel06.DefaultTextStyle = textStyle; // The TextStyle we set here is available from ZoomLevel06 to ZoomLevel20. capitalLabelLayer.ZoomLevelSet.ZoomLevel06.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean))); layerOverlay.Layers.Add(worldLayer); layerOverlay.Layers.Add(capitalLayer); layerOverlay.Layers.Add(capitalLabelLayer); Map1.Overlays.Add(layerOverlay); Map1.CurrentExtent = new RectangleShape(-136.60, 60.06, -53.81, 11.63); Map1.Refresh(); }
private void TestForm_Load(object sender, EventArgs e) { winformsMap1.MapUnit = GeographyUnit.Meter; winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255)); GoogleMapsOverlay googleOverlay = new GoogleMapsOverlay(); //(@"Insert your key here!", @"C:\GoogleCache"); googleOverlay.MapType = GoogleMapsMapType.Terrain; winformsMap1.Overlays.Add(googleOverlay); // This sets the zoom levels to map to Googles. We next make sure we snap to the zoomlevels winformsMap1.ZoomLevelSet = new GoogleMapsZoomLevelSet(); InMemoryFeatureLayer pointLayer = new InMemoryFeatureLayer(); pointLayer.Open(); pointLayer.Columns.Add(new FeatureSourceColumn("Text")); pointLayer.Close(); //Sets the projection parameters to go from Geodetic (EPSG 4326) or decimal degrees to Google Map projection (Spherical Mercator). Proj4Projection proj4 = new Proj4Projection(); proj4.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4326); proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString(); //Applies the projection to the InMemoryFeatureLayer so that the point in decimal degrees (Longitude/Latitude) can be //match the projection of Google Map. pointLayer.FeatureSource.Projection = proj4; //Values in Longitude and Latitude. double Longitude = -95.2809; double Latitude = 38.9543; //Creates the feature made of a PointShape with the Longitude and Latitude values. Feature GPSFeature = new Feature(new PointShape(Longitude, Latitude)); //Format the Longitude and Latitude into a nice string as Degrees Minutes and Seconds string LongLat = DecimalDegreesHelper.GetDegreesMinutesSecondsStringFromDecimalDegreePoint(GPSFeature); //Sets the InMemoryFeatureLayer to have it displayed with Square symbol and with text. GPSFeature.ColumnValues.Add("Text", LongLat); pointLayer.InternalFeatures.Add(GPSFeature); pointLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimplePointStyle(PointSymbolType.Square, GeoColor.StandardColors.Red, GeoColor.StandardColors.Black, 2, 12); pointLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("Text", "Arial", 12, DrawingFontStyles.Bold, GeoColor.StandardColors.Black, GeoColor.StandardColors.White, 3, -10, 10); pointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay pointOverlay = new LayerOverlay(); pointOverlay.Layers.Add("PointLayer", pointLayer); winformsMap1.Overlays.Add("PointOverlay", pointOverlay); //Sets the extend of the map based on the GPS point. proj4.Open(); Vertex projVertex = proj4.ConvertToExternalProjection(Longitude, Latitude); proj4.Close(); double extendWidth = 2300; double extendHeight = 1200; winformsMap1.CurrentExtent = new RectangleShape((projVertex.X - extendWidth), (projVertex.Y + extendHeight), (projVertex.X + extendWidth), (projVertex.Y - extendHeight)); winformsMap1.Refresh(); }
private void TestForm_Load(object sender, EventArgs e) { winformsMap1.MapUnit = GeographyUnit.DecimalDegree; winformsMap1.CurrentExtent = new RectangleShape(-120,86,112,-54); winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.FromArgb(255, 198, 255, 255)); //Layer for simply displaying countries as a simple area style. ShapeFileFeatureLayer worldShapeLayer = new ShapeFileFeatureLayer(@"..\..\Data\Countries02.shp"); worldShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.StandardColors.LightGoldenrodYellow, GeoColor.FromArgb(100, GeoColor.SimpleColors.Green)); worldShapeLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; //Layer for displaying the country labels using ClassBreakStyle to have the label size proportinal to the country size. ShapeFileFeatureLayer worldLabelLayer = new ShapeFileFeatureLayer(@"..\..\Data\Countries02.shp"); //For Zoom Levels 01 to 03, displays the country labels for countries above 500,000 sqkm in area with two classes. ClassBreakStyle classBreakStyle1 = new ClassBreakStyle("SQKM"); TextStyle textStyle1a = TextStyles.CreateSimpleTextStyle("CNTRY_NAME", "Arial", 9, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.StandardColors.White, 2, 0, 0); TextStyle textStyle1b = TextStyles.CreateSimpleTextStyle("CNTRY_NAME", "Arial", 12, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.StandardColors.White, 3, 0, 0); classBreakStyle1.ClassBreaks.Add(new ClassBreak(500000, textStyle1a)); classBreakStyle1.ClassBreaks.Add(new ClassBreak(5000000, textStyle1b)); worldLabelLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(classBreakStyle1); worldLabelLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level03; //For Zoom Levels 04 to 05, displays the country labels for countries above 100,000 sqkm in area with three classes. ClassBreakStyle classBreakStyle2 = new ClassBreakStyle("SQKM"); TextStyle textStyle2a = TextStyles.CreateSimpleTextStyle("CNTRY_NAME", "Arial", 9, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.StandardColors.White, 2, 0, 0); TextStyle textStyle2b = TextStyles.CreateSimpleTextStyle("CNTRY_NAME", "Arial", 11, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.StandardColors.White, 2, 0, 0); TextStyle textStyle2c = TextStyles.CreateSimpleTextStyle("CNTRY_NAME", "Arial", 14, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.StandardColors.White, 3, 0, 0); classBreakStyle2.ClassBreaks.Add(new ClassBreak(100000, textStyle2a)); classBreakStyle2.ClassBreaks.Add(new ClassBreak(500000, textStyle2b)); classBreakStyle2.ClassBreaks.Add(new ClassBreak(3000000, textStyle2c)); worldLabelLayer.ZoomLevelSet.ZoomLevel04.CustomStyles.Add(classBreakStyle2); worldLabelLayer.ZoomLevelSet.ZoomLevel04.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level05; //For Zoom Levels 06 to 07, displays the country labels for countries above 20,000 sqkm in area with four classes. ClassBreakStyle classBreakStyle3 = new ClassBreakStyle("SQKM"); TextStyle textStyle3a = TextStyles.CreateSimpleTextStyle("CNTRY_NAME", "Arial", 9, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.StandardColors.White, 2, 0, 0); TextStyle textStyle3b = TextStyles.CreateSimpleTextStyle("CNTRY_NAME", "Arial", 12, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.StandardColors.White, 2, 0, 0); TextStyle textStyle3c = TextStyles.CreateSimpleTextStyle("CNTRY_NAME", "Arial", 14, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.StandardColors.White, 2, 0, 0); TextStyle textStyle3d = TextStyles.CreateSimpleTextStyle("CNTRY_NAME", "Arial", 18, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.StandardColors.White, 3, 0, 0); classBreakStyle3.ClassBreaks.Add(new ClassBreak(20000, textStyle3a)); classBreakStyle3.ClassBreaks.Add(new ClassBreak(100000, textStyle3b)); classBreakStyle3.ClassBreaks.Add(new ClassBreak(500000, textStyle3c)); classBreakStyle3.ClassBreaks.Add(new ClassBreak(3000000, textStyle3d)); worldLabelLayer.ZoomLevelSet.ZoomLevel06.CustomStyles.Add(classBreakStyle3); worldLabelLayer.ZoomLevelSet.ZoomLevel06.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level07; //For Zoom Levels 08 to 20, displays the country labels for all countries with five classes. ClassBreakStyle classBreakStyle4 = new ClassBreakStyle("SQKM"); TextStyle textStyle4a = TextStyles.CreateSimpleTextStyle("CNTRY_NAME", "Arial", 9, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.StandardColors.White, 2, 0, 0); TextStyle textStyle4b = TextStyles.CreateSimpleTextStyle("CNTRY_NAME", "Arial", 12, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.StandardColors.White, 2, 0, 0); TextStyle textStyle4c = TextStyles.CreateSimpleTextStyle("CNTRY_NAME", "Arial", 14, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.StandardColors.White, 2, 0, 0); TextStyle textStyle4d = TextStyles.CreateSimpleTextStyle("CNTRY_NAME", "Arial", 18, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.StandardColors.White, 2, 0, 0); TextStyle textStyle4e = TextStyles.CreateSimpleTextStyle("CNTRY_NAME", "Arial", 22, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, GeoColor.StandardColors.White, 3, 0, 0); classBreakStyle4.ClassBreaks.Add(new ClassBreak(0, textStyle4a)); classBreakStyle4.ClassBreaks.Add(new ClassBreak(20000, textStyle4b)); classBreakStyle4.ClassBreaks.Add(new ClassBreak(100000, textStyle4c)); classBreakStyle4.ClassBreaks.Add(new ClassBreak(500000, textStyle4d)); classBreakStyle4.ClassBreaks.Add(new ClassBreak(3000000, textStyle4e)); worldLabelLayer.ZoomLevelSet.ZoomLevel08.CustomStyles.Add(classBreakStyle4); worldLabelLayer.ZoomLevelSet.ZoomLevel08.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay staticOverlay = new LayerOverlay(); staticOverlay.Layers.Add("WorldShapeLayer", worldShapeLayer); staticOverlay.Layers.Add("WorldLabelLayer", worldLabelLayer); winformsMap1.Overlays.Add(staticOverlay); winformsMap1.Refresh(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.DisplayASimpleMap); ShapeFileFeatureLayer txwatFeatureLayer = new ShapeFileFeatureLayer(SampleHelper.GetDataPath(@"Frisco/TXwat.shp")); txwatFeatureLayer.ZoomLevelSet.ZoomLevel12.DefaultAreaStyle.FillSolidBrush.Color = GeoColor.FromArgb(255, 153, 179, 204); txwatFeatureLayer.ZoomLevelSet.ZoomLevel12.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("LandName", "Arial", 9, DrawingFontStyles.Italic, GeoColor.StandardColors.Navy); txwatFeatureLayer.ZoomLevelSet.ZoomLevel12.DefaultTextStyle.SuppressPartialLabels = true; txwatFeatureLayer.ZoomLevelSet.ZoomLevel12.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; ShapeFileFeatureLayer txlkaA40FeatureLayer = new ShapeFileFeatureLayer(SampleHelper.GetDataPath(@"Frisco/TXlkaA40.shp")); txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel14.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.DarkGray, 1F, false); txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel15.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.White, 3F, GeoColor.StandardColors.DarkGray, 5F, true); txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.White, 8F, GeoColor.StandardColors.DarkGray, 10F, true); txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("[fedirp] [fename] [fetype] [fedirs]", "Arial", 10f, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, 0, -1); txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle.SuppressPartialLabels = true; txlkaA40FeatureLayer.ZoomLevelSet.ZoomLevel16.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; txlkaA40FeatureLayer.DrawingMarginPercentage = 80; ShapeFileFeatureLayer txlkaA20FeatureLayer = new ShapeFileFeatureLayer(SampleHelper.GetDataPath(@"Frisco/TXlkaA20.shp")); txlkaA20FeatureLayer.ZoomLevelSet.ZoomLevel15.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(255, 255, 255, 128), 6, GeoColor.StandardColors.LightGray, 9, true); txlkaA20FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(255, 255, 255, 128), 9, GeoColor.StandardColors.LightGray, 12, true); txlkaA20FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle = TextStyles.CreateSimpleTextStyle("[fedirp] [fename] [fetype] [fedirs]", "Arial", 12, DrawingFontStyles.Regular, GeoColor.StandardColors.Black, 0, -1); txlkaA20FeatureLayer.ZoomLevelSet.ZoomLevel16.DefaultTextStyle.SuppressPartialLabels = true; txlkaA20FeatureLayer.ZoomLevelSet.ZoomLevel16.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; Marker thinkGeoMarker = new Marker(BaseContext); thinkGeoMarker.Position = new PointShape(-96.809523, 33.128675); thinkGeoMarker.SetImageBitmap(Android.Graphics.BitmapFactory.DecodeResource(ThinkGeo.MapSuite.Android.Resources, Resource.Drawable.Pin)); thinkGeoMarker.YOffset = -(int)(22 * ThinkGeo.MapSuite.Android.Resources.DisplayMetrics.Density); MarkerOverlay markerOverlay = new MarkerOverlay(); markerOverlay.Markers.Add(thinkGeoMarker); ImageView imageView = new ImageView(this); imageView.SetImageResource(Resource.Drawable.ThinkGeoLogo); TextView textView = new TextView(this); textView.Text = string.Format("Longitude : {0:N4}" + "\r\n" + "Latitude : {1:N4}", thinkGeoMarker.Position.X, thinkGeoMarker.Position.Y); textView.SetTextColor(Color.Black); textView.SetTextSize(ComplexUnitType.Px, 22); LinearLayout linearLayout = new LinearLayout(this); linearLayout.SetPadding(10, 10, 10, 10); linearLayout.Orientation = Orientation.Vertical; linearLayout.AddView(imageView); linearLayout.AddView(textView); Popup popup = new Popup(this); popup.Position = thinkGeoMarker.Position; popup.YOffset = (int)(-44 * ThinkGeo.MapSuite.Android.Resources.DisplayMetrics.Density); popup.XOffset = (int)(4 * ThinkGeo.MapSuite.Android.Resources.DisplayMetrics.Density); popup.AddView(linearLayout); PopupOverlay popupOverlay = new PopupOverlay(); popupOverlay.Popups.Add(popup); LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add(txwatFeatureLayer); layerOverlay.Layers.Add(txlkaA20FeatureLayer); layerOverlay.Layers.Add(txlkaA40FeatureLayer); androidMap = FindViewById <MapView>(Resource.Id.androidmap); androidMap.MapUnit = GeographyUnit.DecimalDegree; androidMap.CurrentExtent = new RectangleShape(-96.8172, 33.1299, -96.8050, 33.1226); androidMap.Overlays.Add(layerOverlay); androidMap.Overlays.Add(markerOverlay); androidMap.Overlays.Add(popupOverlay); SampleViewHelper.InitializeInstruction(this, FindViewById <RelativeLayout>(Resource.Id.MainLayout), GetType()); }