private void AddDataSeries(string legendText, Visifire.Charts.DataSeries dataSeries, LineStyles style, SolidColorBrush brush, Visifire.Charts.RenderAs renderAs) { // 设置数据线的格式。 dataSeries.RenderAs = renderAs; dataSeries.LegendText = legendText; dataSeries.ShowInLegend = true; dataSeries.Color = brush; }
public void DrawLines(Point[] points, int start, int length, SolidColor color, double width, LineStyles style) { if (!color.IsTransparent && length > 1) { var p = this.resourceManager.GetPen(color, width, ToWPFDashStyle(style)); if (p != null) { var geo = new PathGeometry(); for (int i = 1, k = start + 1; i < length; i++, k++) { geo.AddGeometry(new LineGeometry(points[k - 1], points[k])); } g.DrawGeometry(null, p, geo); } } }
public void DrawLine(Point startPoint, Point endPoint, SolidColor color, double width, LineStyles style) { var p = this.resourceManager.GetPen(color, width, ToWPFDashStyle(style)); if (p != null) { g.DrawLine(p, startPoint, endPoint); } }
private void Form1_Load(object sender, EventArgs e) { LoadStreetData(); InMemoryFeatureLayer inMemoryFeatureLayer = new InMemoryFeatureLayer(); inMemoryFeatureLayer.Open(); inMemoryFeatureLayer.Columns.Add(new FeatureSourceColumn("Angle")); inMemoryFeatureLayer.Close(); pointShapes1 = ReadTextFile(@"..\..\Data\GPSreadings1.txt"); pointShapes2 = ReadTextFile(@"..\..\Data\GPSreadings2.txt"); Feature newFeature1 = new Feature(pointShapes1[count1]); newFeature1.ColumnValues["Angle"] = System.Convert.ToString(pointShapes1[count1].Z); inMemoryFeatureLayer.InternalFeatures.Add("Vehicle1", newFeature1); Feature newFeature2 = new Feature(pointShapes2[count2]); newFeature2.ColumnValues["Angle"] = System.Convert.ToString(pointShapes2[count2].Z); inMemoryFeatureLayer.InternalFeatures.Add("Vehicle2", newFeature2); RotatedImageStyle rotatedImageStyle = new RotatedImageStyle(new GeoImage(@"..\..\Data\vehicle2.png"), "Angle"); inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Clear(); inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(rotatedImageStyle); inMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; InMemoryFeatureLayer breadCrumbTrailInMemoryFeatureLayer = new InMemoryFeatureLayer(); breadCrumbTrailInMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.RoyalBlue, 2, true); breadCrumbTrailInMemoryFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; LayerOverlay overLayer = new LayerOverlay(); overLayer.Layers.Add(inMemoryFeatureLayer); overLayer.Layers.Add(breadCrumbTrailInMemoryFeatureLayer); winformsMap1.Overlays.Add("Overlay", overLayer); timer1.Start(); winformsMap1.CurrentExtent = new RectangleShape(-66.8581, 10.4995, -66.8456, 10.4915); winformsMap1.Refresh(); }
public void DrawRectangle(Rectangle rect, SolidColor color, float width, LineStyles lineStyle) { var p = this.resourceManager.GetPen(color, width, ToGDILineStyle(lineStyle)); this.g.DrawRectangle(p, rect.X, rect.Y, rect.Width, rect.Height); }
public void DrawLine(Point startPoint, Point endPoint, SolidColor color, float width, LineStyles style) { if (color.A > 0) { var p = this.resourceManager.GetPen(color, width, ToGDILineStyle(style)); if (p != null) { this.g.DrawLine(p, startPoint, endPoint); } } }
protected StatisticalAggregation() { LineStyle = LineStyles.Solid; }
private void TestForm_Load(object sender, EventArgs e) { winformsMap1.MapUnit = GeographyUnit.DecimalDegree; winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.StandardColors.LightGoldenrodYellow); //Scale bar to have a graphic representation of the scale ScaleBarAdornmentLayer scaleBar = new ScaleBarAdornmentLayer(); scaleBar.UnitFamily = UnitSystem.Metric; scaleBar.Location = AdornmentLocation.LowerLeft; winformsMap1.AdornmentOverlay.Layers.Add(scaleBar); //Snapping mode to none so that we can set and get the exact scale without snapping the map. winformsMap1.ZoomLevelSnapping = ZoomLevelSnappingMode.None; //Set of 10 zoom levels from 1:200,00 to 1:250 the zoom level below being half in scale compare to the previous zoom level. //Notice that the scale parameter for ZoomLevel is the middle scale for that zoom level. The range of scale for the zoom level //will be based on the scale values of the zoom level below and above. //As an academic reminder, the scale means the ratio on the map to the corresponding distance on the ground. So, a scale of 1:100,000 //means that one unit (for example one centimeter) on the map represents 100,000 units ( or 100,000 centimeters or 1 kilometers on the ground). ZoomLevelSet partitionedZoomLevelSet = new ZoomLevelSet(); partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(200000)); //Zoom Level 1 1:200,000 (beyond 1:150,000) partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(100000)); //Zoom Level 2 1:100,000 (from 1:75,000 to 1:150,000) partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(50000)); //Zoom Level 3 1: 50,000 (from 1:37,000 to 1:75,000) partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(25000)); //Zoom Level 4 1: 25,000 (from 1:17,000 to 1:37,500) partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(10000)); //Zoom Level 5 1: 10,000 (from 1:7,500 to 1:17,500) partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(5000)); //Zoom Level 6 1: 5,000 (from 1:3,750 to 1:7,500) partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(2500)); //Zoom Level 7 1: 2,500 (from 1:1,750 to 1:3,750) partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(1000)); //Zoom Level 8 1: 1,000 (from 1:750 to 1:1,750) partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(500)); //Zoom Level 9 1: 500 (from 1:375 to 1:750) partitionedZoomLevelSet.CustomZoomLevels.Add(new ZoomLevel(250)); //Zoom Level 10 1: 250 (below 1:375) winformsMap1.ZoomLevelSet = partitionedZoomLevelSet; //Uses the Name property of ZoomLevel to give the characteristics such as the scale range. Collection <ZoomLevel> zoomLevels = winformsMap1.ZoomLevelSet.GetZoomLevels(); for (int i = 0; i < zoomLevels.Count; i++) { string ScaleRange; double BottomScale, TopScale; if (i == 0) { BottomScale = zoomLevels[i + 1].Scale + ((zoomLevels[i].Scale - zoomLevels[i + 1].Scale) / 2); ScaleRange = "Beyond 1: " + String.Format("{0:0,0}", BottomScale); } else if (i < zoomLevels.Count - 1) { BottomScale = zoomLevels[i + 1].Scale + ((zoomLevels[i].Scale - zoomLevels[i + 1].Scale) / 2); TopScale = zoomLevels[i].Scale + ((zoomLevels[i - 1].Scale - zoomLevels[i].Scale) / 2); ScaleRange = "From 1: " + String.Format("{0:0,0}", BottomScale) + " to 1: " + String.Format("{0:0,0}", TopScale); } else { TopScale = zoomLevels[i].Scale + ((zoomLevels[i - 1].Scale - zoomLevels[i].Scale) / 2); ScaleRange = "Below 1: " + String.Format("{0:0,0}", TopScale); } zoomLevels[i].Name = "Zoom Level " + (i + 1).ToString() + " " + ScaleRange; } ShapeFileFeatureLayer layer1 = new ShapeFileFeatureLayer(@"..\..\Data\Austinstreets.shp"); //Sets the custom Zoom levels to ZoomLevelSet layer1.ZoomLevelSet = partitionedZoomLevelSet; //Set a different style at each zoom level to help distinguish when we change zoom level when zooming in and out on the map. layer1.ZoomLevelSet.CustomZoomLevels[0].DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Red, 2, true); layer1.ZoomLevelSet.CustomZoomLevels[1].DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Green, 2, true); layer1.ZoomLevelSet.CustomZoomLevels[2].DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Pink, 2, true); layer1.ZoomLevelSet.CustomZoomLevels[3].DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Blue, 2, true); layer1.ZoomLevelSet.CustomZoomLevels[4].DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Orange, 2, true); layer1.ZoomLevelSet.CustomZoomLevels[5].DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Turquoise, 2, true); layer1.ZoomLevelSet.CustomZoomLevels[6].DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Violet, 2, true); layer1.ZoomLevelSet.CustomZoomLevels[7].DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.YellowGreen, 2, true); layer1.ZoomLevelSet.CustomZoomLevels[8].DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.Brown, 2, true); layer1.ZoomLevelSet.CustomZoomLevels[9].DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.DarkGreen, 2, true); LayerOverlay layerOverlay = new LayerOverlay(); layerOverlay.Layers.Add(layer1); winformsMap1.Overlays.Add(layerOverlay); layer1.Open(); winformsMap1.CurrentExtent = layer1.GetBoundingBox(); layer1.Close(); winformsMap1.Refresh(); lblZoom.Text = winformsMap1.ZoomLevelSet.GetZoomLevel(winformsMap1.CurrentExtent, winformsMap1.Width, winformsMap1.MapUnit).Name; }
public void DrawLine(Point startPoint, Point endPoint, SolidColor color, RGFloat width, LineStyles style) { throw new NotImplementedException(); }
public Pen(System.Drawing.Color color, float width, LineStyles style) { Color = color; Width = width; LineStyle = style; }
void AddLayers() { var colors = new List <Color> { Color.Red, Color.Blue, Color.Yellow, Color.Green, Color.Brown, Color.Orange, Color.Purple }; string[] fnames = GetShapefiles(); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetTitle("Select Shape File?"); builder.SetItems(fnames, (sender, args) => { if (fnames[args.Which] != null) { // Toast.MakeText( this , "Choose existing Service picked" + fnames [args.Which], ToastLength.Short).Show(); string layername = fnames[args.Which]; ShapeFileFeatureLayer nLayer = new ShapeFileFeatureLayer(System.IO.Path.Combine(Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDownloads).ToString(), layername), ShapeFileReadWriteMode.ReadOnly); nLayer.RequireIndex = false; nLayer.Open(); if (nLayer.GetShapeFileType() == ShapeFileType.Point) { nLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimplePointStyle(PointSymbolType.Circle, GeoColor.StandardColors.Red, GeoColor.StandardColors.Orange, 2); nLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; } else if (nLayer.GetShapeFileType() == ShapeFileType.Polyline) { nLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.StandardColors.LightPink, 2, GeoColor.StandardColors.Black, 0, false); nLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; } else if (nLayer.GetShapeFileType() == ShapeFileType.Polygon) { nLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle( GeoColor.FromArgb(100, GeoColor.StandardColors.LightYellow), GeoColor.StandardColors.Blue); } var v = nLayer.QueryTools.GetColumns(); string[] fields = new string[v.Count]; //for (int i = 0; i<v.Count ; ++i) int i = 0; foreach (FeatureSourceColumn c in v) { fields[i] = c.ColumnName; i++; } AlertDialog.Builder bld = new AlertDialog.Builder(this); bld.SetTitle("Select labelling field?"); bld.SetItems(fields, (senders, argss) => { if (fields[argss.Which] != null) { string d = fields[argss.Which].ToString(); if (nLayer.GetShapeFileType() == ShapeFileType.Polyline) { nLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = TextStyles.LocalRoad1(fields[argss.Which]); } else { nLayer.ZoomLevelSet.ZoomLevel01.DefaultTextStyle = new TextStyle(fields[argss.Which], new GeoFont("Arail", 9, DrawingFontStyles.Bold), new GeoSolidBrush(GeoColor.SimpleColors.Black)); } nLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; nLayer.Close(); nLayer.FeatureSource.Projection = proj4; LayerOverlay lOverlay = new LayerOverlay(); lOverlay.Layers.Add(layername, nLayer); androidMap.Overlays.Add(layername, lOverlay); androidMap.Refresh(); } }); bld.Create().Show(); } else if (fnames[args.Which] == null) { Toast.MakeText(this, "Cancel picked", ToastLength.Short).Show(); //How to close dialog Here } }); builder.Create().Show(); }
/// <summary> /// Returns dash array for line /// </summary> /// <param name="lineStyle">LineStyle as LineStyles</param> /// <returns>DashArray as DoubleCollection</returns> internal static DoubleCollection GetDashArray(LineStyles lineStyle) { return Graphics.LineStyleToStrokeDashArray(lineStyle.ToString()); }
public void DrawLine(float x1, float y1, float x2, float y2, SolidColor color, float width, LineStyles style) { if (color.A > 0) { var p = this.resourceManager.GetPen(color, width, ToGDILineStyle(style)); if (p != null) { g.DrawLine(p, x1, y1, x2, y2); } } }
protected override void DrawCore(WinformsMap winformsMap) { LayerOverlay layerOverlay = new LayerOverlay(); if (!LoadingFromShapeFile) { foreach (var item in Layers) { layerOverlay.Layers.Add(item); } } else { if (!String.IsNullOrEmpty(firstShapeFilePathName)) { ShapeFileFeatureLayer.BuildIndexFile(firstShapeFilePathName, BuildIndexMode.DoNotRebuild); ShapeFileFeatureLayer firstInputShapeFileFeatureLayer = new ShapeFileFeatureLayer(firstShapeFilePathName); firstInputShapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(102, 0, 255, 0), GeoColor.FromArgb(255, 0, 255, 0), 2); firstInputShapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(102, 0, 255, 0), 2, true); firstInputShapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(102, 0, 255, 0), 12); firstInputShapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; layerOverlay.Layers.Add(firstInputShapeFileFeatureLayer); } if (!String.IsNullOrEmpty(secondShapeFilePathName)) { ShapeFileFeatureLayer.BuildIndexFile(secondShapeFilePathName, BuildIndexMode.DoNotRebuild); ShapeFileFeatureLayer secondInputShapeFileFeatureLayer = new ShapeFileFeatureLayer(secondShapeFilePathName); secondInputShapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(102, 0, 0, 255), GeoColor.FromArgb(255, 0, 0, 255), 2); secondInputShapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(102, 0, 0, 255), 2, true); secondInputShapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(102, 0, 0, 255), 12); secondInputShapeFileFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; layerOverlay.Layers.Add(secondInputShapeFileFeatureLayer); } layerOverlay.Layers.Add(OutputFeatureLayer); } winformsMap.Overlays.Clear(); winformsMap.Overlays.Add(layerOverlay); winformsMap.Refresh(); }
public void DrawAndFillRectangle(Rectangle rect, SolidColor lineColor, IColor fillColor, double width, LineStyles lineStyle) { var p = this.resourceManager.GetPen(lineColor, width, ToWPFDashStyle(lineStyle)); var b = this.resourceManager.GetBrush(fillColor.ToSolidColor()); if (p != null && b != null) { this.g.DrawRectangle(b, p, rect); } }
public void DrawLine(RGFloat x1, RGFloat y1, RGFloat x2, RGFloat y2, SolidColor color, RGFloat width, LineStyles style) { throw new NotImplementedException(); }
public void DrawPolygon(SolidColor color, double width, LineStyles style, params Graphics.Point[] points) { this.DrawLines(points, 0, points.Length, color, width, style); }
public void DrawLines(Point[] points, int start, int length, SolidColor color, RGFloat width, LineStyles style) { throw new NotImplementedException(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.DisplayMapView); 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; 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(Resources, Resource.Drawable.Pin)); thinkGeoMarker.YOffset = -(int)(22 * 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 * Resources.DisplayMetrics.Density); popup.XOffset = (int)(4 * 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()); }
public void DrawRectangle(Rectangle rect, SolidColor color, RGFloat width, LineStyles lineStyle) { throw new NotImplementedException(); }
protected override void InitializeMap() { MapView.MapUnit = GeographyUnit.Meter; MapView.ZoomLevelSet = new ThinkGeoCloudMapsZoomLevelSet(); MapView.CurrentExtent = new RectangleShape(-13886070, 5660597, -8906057, 2382985); /*=========================================== * Backgrounds for this sample are powered by ThinkGeo Cloud Maps and require * a Client ID and Secret. These were sent to you via email when you signed up * with ThinkGeo, or you can register now at https://cloud.thinkgeo.com. * ===========================================*/ ThinkGeoCloudRasterMapsOverlay thinkGeoCloudMapsOverlay = (ThinkGeoCloudRasterMapsOverlay)MapView.Overlays["WMK"]; string baseFolder = Android.OS.Environment.ExternalStorageDirectory.AbsolutePath; string cachePathFilename = Path.Combine(baseFolder, "MapSuiteTileCaches/SampleCaches.db"); thinkGeoCloudMapsOverlay.TileCache = new SqliteBitmapTileCache(cachePathFilename, "SphericalMercator"); LineStyle lineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.FromArgb(255, 50, 0, 249), 4, false); //Cold Front CustomGeoImageLineStyle coldFrontLineStyle = GetCustomLineStyle(lineStyle, 19, CustomGeoImageLineStyle.SymbolSide.Right, SampleHelper.GetDataPath(@"CustomStyles/offset_circle_red_bl.png"), SampleHelper.GetDataPath(@"CustomStyles/offset_triangle_blue_revert.png")); InMemoryFeatureLayer inMemoryFeatureLayerColdFront = new InMemoryFeatureLayer(); inMemoryFeatureLayerColdFront.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(coldFrontLineStyle); inMemoryFeatureLayerColdFront.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; inMemoryFeatureLayerColdFront.InternalFeatures.Add(new Feature(File.ReadAllText(SampleHelper.GetDataPath(@"CustomStyles/ColdFront2.txt")))); inMemoryFeatureLayerColdFront.InternalFeatures.Add(new Feature(File.ReadAllText(SampleHelper.GetDataPath(@"CustomStyles/ColdFront3.txt")))); //Warm Front InMemoryFeatureLayer inMemoryFeatureLayerWarmFront = new InMemoryFeatureLayer(); CustomGeoImageLineStyle warmFrontLineStyle = new CustomGeoImageLineStyle(lineStyle, new GeoImage(SampleHelper.GetDataPath(@"CustomStyles/offset_circle_blue.png")), 30, CustomGeoImageLineStyle.SymbolSide.Right); inMemoryFeatureLayerWarmFront.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(warmFrontLineStyle); inMemoryFeatureLayerWarmFront.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; inMemoryFeatureLayerWarmFront.InternalFeatures.Add(new Feature(File.ReadAllText(SampleHelper.GetDataPath(@"CustomStyles/WarmFront5.txt")))); inMemoryFeatureLayerWarmFront.InternalFeatures.Add(new Feature(File.ReadAllText(SampleHelper.GetDataPath(@"CustomStyles/WarmFront6.txt")))); inMemoryFeatureLayerWarmFront.InternalFeatures.Add(new Feature(File.ReadAllText(SampleHelper.GetDataPath(@"CustomStyles/WarmFront7.txt")))); inMemoryFeatureLayerWarmFront.InternalFeatures.Add(new Feature(File.ReadAllText(SampleHelper.GetDataPath(@"CustomStyles/WarmFront8.txt")))); //Occluded Front InMemoryFeatureLayer inMemoryFeatureLayerOccludedFront = new InMemoryFeatureLayer(); CustomGeoImageLineStyle occludedFrontLineStyle = GetCustomLineStyle(lineStyle, 45, CustomGeoImageLineStyle.SymbolSide.Right, SampleHelper.GetDataPath(@"CustomStyles/offset_triangle_and_circle_blue.png"), SampleHelper.GetDataPath(@"CustomStyles/offset_triangle_and_circle_red.png")); inMemoryFeatureLayerOccludedFront.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(occludedFrontLineStyle); inMemoryFeatureLayerOccludedFront.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; inMemoryFeatureLayerOccludedFront.InternalFeatures.Add(new Feature(File.ReadAllText(SampleHelper.GetDataPath(@"CustomStyles/OccludedFront9.txt")))); inMemoryFeatureLayerOccludedFront.InternalFeatures.Add(new Feature(File.ReadAllText(SampleHelper.GetDataPath(@"CustomStyles/OccludedFront10.txt")))); inMemoryFeatureLayerOccludedFront.InternalFeatures.Add(new Feature(File.ReadAllText(SampleHelper.GetDataPath(@"CustomStyles/OccludedFront11.txt")))); PressureValueStyle pressureValueStyle = new PressureValueStyle(); pressureValueStyle.ColumnName = "Pressure"; InMemoryFeatureLayer pressureFeatureLayer = new InMemoryFeatureLayer(); pressureFeatureLayer.Open(); pressureFeatureLayer.Columns.Add(new FeatureSourceColumn("Pressure")); pressureFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(pressureValueStyle); pressureFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; pressureFeatureLayer.InternalFeatures.Add(new Feature(MapView.CurrentExtent.GetCenterPoint())); Random random = new Random(); string[] pressures = { "H", "L" }; for (int i = 0; i < 20; i++) { Feature pressurePoint = new Feature(random.Next(-13886070, -8906057), random.Next(3382985, 6660597)); pressurePoint.ColumnValues["Pressure"] = pressures[random.Next(0, 2)]; pressureFeatureLayer.InternalFeatures.Add(pressurePoint); } WindPointStyle windStyle1 = new WindPointStyle("TEXT", "LEVEL", "ANGLE", GeoColor.FromHtml("#0AF8F8")); WindPointStyle windStyle2 = new WindPointStyle("TEXT", "LEVEL", "ANGLE", GeoColor.FromHtml("#0FF5B0")); WindPointStyle windStyle3 = new WindPointStyle("TEXT", "LEVEL", "ANGLE", GeoColor.FromHtml("#F7F70D")); WindPointStyle windStyle4 = new WindPointStyle("TEXT", "LEVEL", "ANGLE", GeoColor.FromHtml("#FBE306")); ClassBreakStyle windClassBreakStyle = new ClassBreakStyle(); windClassBreakStyle.ColumnName = "TEXT"; windClassBreakStyle.ClassBreaks.Add(new ClassBreak(10, new Collection <Style> { windStyle1 })); windClassBreakStyle.ClassBreaks.Add(new ClassBreak(20, new Collection <Style> { windStyle2 })); windClassBreakStyle.ClassBreaks.Add(new ClassBreak(30, new Collection <Style> { windStyle3 })); windClassBreakStyle.ClassBreaks.Add(new ClassBreak(40, new Collection <Style> { windStyle4 })); InMemoryFeatureLayer windFeatureLayer = new InMemoryFeatureLayer(); windFeatureLayer.Open(); windFeatureLayer.Columns.Add(new FeatureSourceColumn("TEXT")); windFeatureLayer.Columns.Add(new FeatureSourceColumn("ANGLE")); windFeatureLayer.Columns.Add(new FeatureSourceColumn("LEVEL")); windFeatureLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(windClassBreakStyle); windFeatureLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; for (int i = 0; i < 20; i++) { Feature windFeature = new Feature(random.Next(-13886070, -8906057), random.Next(3382985, 6660597)); windFeature.ColumnValues["TEXT"] = random.Next(10, 40).ToString(CultureInfo.InvariantCulture); windFeature.ColumnValues["ANGLE"] = random.Next(0, 360).ToString(CultureInfo.InvariantCulture); windFeature.ColumnValues["LEVEL"] = random.Next(0, 5).ToString(CultureInfo.InvariantCulture); windFeatureLayer.InternalFeatures.Add(windFeature); } LayerOverlay dynamicOverlay = new LayerOverlay(); dynamicOverlay.Layers.Add(inMemoryFeatureLayerColdFront); dynamicOverlay.Layers.Add(inMemoryFeatureLayerWarmFront); dynamicOverlay.Layers.Add(inMemoryFeatureLayerOccludedFront); dynamicOverlay.Layers.Add(pressureFeatureLayer); dynamicOverlay.Layers.Add(windFeatureLayer); MapView.Overlays.Add(dynamicOverlay); }
public void DrawAndFillRectangle(SolidColor lineColor, IColor fillColor, Rectangle rect, RGFloat weight, LineStyles lineStyle) { throw new NotImplementedException(); }
public void DrawLines(Point[] points, int start, int length, SolidColor color, float width, LineStyles style) { if (color.A < 0) { return; } var p = this.resourceManager.GetPen(color, width, ToGDILineStyle(style)); if (p == null) { return; } WFPointF[] pt = new WFPointF[length]; for (int i = 0, k = start; i < pt.Length; i++, k++) { pt[i] = points[k]; } this.g.DrawLines(p, pt); }
public void DrawLine(double x1, double y1, double x2, double y2, SolidColor color, double width, LineStyles style) { var p = this.resourceManager.GetPen(color, width, ToWPFDashStyle(style)); if (p != null) { g.DrawLine(p, new System.Windows.Point(x1, y1), new System.Windows.Point(x2, y2)); } }
public void DrawAndFillRectangle(Rectangle rect, SolidColor lineColor, IColor fillColor, float weight, LineStyles lineStyle) { FillRectangle(rect, fillColor); DrawRectangle(rect, lineColor, weight, lineStyle); }
private void InitializeMap() { string targetDictionary = @"AppData/SampleData"; Proj4Projection proj4 = Global.GetWgs84ToMercatorProjection(); string rootPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "/CacheImages"; // WMK WorldMapKitOverlay wmkOverlay = new WorldMapKitOverlay(); wmkOverlay.Projection = ThinkGeo.MapSuite.iOS.WorldMapKitProjection.SphericalMercator; // OSM OpenStreetMapOverlay osmOverlay = new OpenStreetMapOverlay(); osmOverlay.TileCache = new FileBitmapTileCache(rootPath + "/OpenStreetMaps", "SphericalMercator"); osmOverlay.TileCache.TileMatrix.BoundingBoxUnit = GeographyUnit.Meter; osmOverlay.TileCache.TileMatrix.BoundingBox = osmOverlay.GetBoundingBox(); osmOverlay.TileCache.ImageFormat = TileImageFormat.Jpeg; osmOverlay.IsVisible = false; // Bing - Aerial BingMapsOverlay bingMapsAerialOverlay = new BingMapsOverlay(); bingMapsAerialOverlay.MapStyle = ThinkGeo.MapSuite.iOS.BingMapsMapType.AerialWithLabels; bingMapsAerialOverlay.TileCache = new FileBitmapTileCache(rootPath + "/BingMaps", "AerialWithLabels"); bingMapsAerialOverlay.TileCache.TileMatrix.BoundingBoxUnit = GeographyUnit.Meter; bingMapsAerialOverlay.TileCache.TileMatrix.BoundingBox = bingMapsAerialOverlay.GetBoundingBox(); bingMapsAerialOverlay.TileCache.ImageFormat = TileImageFormat.Jpeg; bingMapsAerialOverlay.IsVisible = false; // Bing - Road BingMapsOverlay bingMapsRoadOverlay = new BingMapsOverlay(); bingMapsRoadOverlay.MapStyle = ThinkGeo.MapSuite.iOS.BingMapsMapType.Road; bingMapsRoadOverlay.TileCache = new FileBitmapTileCache(rootPath + "/BingMaps", "Road"); bingMapsRoadOverlay.TileCache.TileMatrix.BoundingBoxUnit = GeographyUnit.Meter; bingMapsRoadOverlay.TileCache.TileMatrix.BoundingBox = bingMapsRoadOverlay.GetBoundingBox(); bingMapsRoadOverlay.TileCache.ImageFormat = TileImageFormat.Jpeg; bingMapsRoadOverlay.IsVisible = false; // Earthquake points ShapeFileFeatureLayer earthquakePointLayer = new ShapeFileFeatureLayer(Path.Combine(targetDictionary, "usEarthquake.shp")); earthquakePointLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.Red, 5, GeoColor.SimpleColors.White, 1)); earthquakePointLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; earthquakePointLayer.FeatureSource.Projection = proj4; ShapeFileFeatureSource earthquakeHeatFeatureSource = new ShapeFileFeatureSource(Path.Combine(targetDictionary, "usEarthquake_Simplified.shp")); earthquakeHeatFeatureSource.Projection = proj4; HeatLayer earthquakeHeatLayer = new HeatLayer(earthquakeHeatFeatureSource); earthquakeHeatLayer.HeatStyle = new HeatStyle(10, 75, DistanceUnit.Kilometer); earthquakeHeatLayer.HeatStyle.Alpha = 180; earthquakeHeatLayer.IsVisible = false; LayerOverlay highlightOverlay = new LayerOverlay(); highlightOverlay.Layers.Add("EarthquakePointLayer", earthquakePointLayer); highlightOverlay.Layers.Add("EarthquakeHeatLayer", earthquakeHeatLayer); // Highlighted points InMemoryFeatureLayer selectedMarkerLayer = new InMemoryFeatureLayer(); selectedMarkerLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.SimpleColors.Orange, 8, GeoColor.SimpleColors.White, 2); selectedMarkerLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; PointStyle highLightMarkerStyle = new PointStyle(); highLightMarkerStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(50, GeoColor.SimpleColors.Blue), 20, GeoColor.SimpleColors.LightBlue, 1)); highLightMarkerStyle.CustomPointStyles.Add(PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(255, 0, 122, 255), 10, GeoColor.SimpleColors.White, 2)); InMemoryFeatureLayer highlightMarkerLayer = new InMemoryFeatureLayer(); highlightMarkerLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = highLightMarkerStyle; highlightMarkerLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20; highlightOverlay.Layers.Add("SelectMarkerLayer", selectedMarkerLayer); highlightOverlay.Layers.Add("HighlightMarkerLayer", highlightMarkerLayer); // Maps iOSMap = new MapView(View.Frame); iOSMap.MapUnit = GeographyUnit.Meter; iOSMap.ZoomLevelSet = new SphericalMercatorZoomLevelSet(); iOSMap.CurrentExtent = new RectangleShape(-19062735.6816748, 9273256.52450252, -5746827.16371793, 2673516.56066139); iOSMap.BackgroundColor = new UIColor(233, 229, 220, 200); iOSMap.Overlays.Add(Global.OpenStreetMapOverlayKey, osmOverlay); iOSMap.Overlays.Add(Global.WorldMapKitOverlayKey, wmkOverlay); iOSMap.Overlays.Add(Global.BingMapsAerialOverlayKey, bingMapsAerialOverlay); iOSMap.Overlays.Add(Global.BingMapsRoadOverlayKey, bingMapsRoadOverlay); iOSMap.Overlays.Add(Global.HighLightOverlayKey, highlightOverlay); iOSMap.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.CustomStyles.Clear(); iOSMap.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultPointStyle = PointStyles.CreateSimpleCircleStyle(GeoColor.FromArgb(80, GeoColor.SimpleColors.LightGreen), 8); iOSMap.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.CreateSimpleLineStyle(GeoColor.SimpleColors.White, 3, true); iOSMap.TrackOverlay.TrackShapeLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.CreateSimpleAreaStyle(GeoColor.FromArgb(80, GeoColor.SimpleColors.LightGreen), GeoColor.SimpleColors.White, 2); iOSMap.TrackOverlay.TrackEnded += TrackInteractiveOverlayOnTrackEnded; Global.MapView = iOSMap; View.Add(iOSMap); iOSMap.Refresh(); }