private void Map_MouseLeave(object sender, MouseEventArgs e) { this.AssociatedObject.listbox.Items.Clear(); ShapeFileLayer shapefilelayer1 = (sender as SfMap).Layers[0] as ShapeFileLayer; if (shapefilelayer1.SelectedMapShapes.Count > 0) { var selectedshapes = shapefilelayer1.SelectedMapShapes; foreach (MapShape mapshape in selectedshapes) { if (mapshape.ShapeValue != null) { this.AssociatedObject.listbox.Items.Add(mapshape.ShapeValue.ToString()); } } } if (this.AssociatedObject.listbox.Items != null && this.AssociatedObject.listbox.Items.Count > 0) { this.AssociatedObject.textblock.Visibility = Visibility.Visible; } else { this.AssociatedObject.textblock.Visibility = Visibility.Collapsed; } }
void map_PointerReleased(object sender, PointerRoutedEventArgs e) { listbox.Items.Clear(); ShapeFileLayer shapefilelayer1 = (sender as SfMap).Layers[0] as ShapeFileLayer; if (shapefilelayer1.EnableMultiSelection == true && shapefilelayer1.SelectedMapShapes.Count > 0) { var selectedshapes = shapefilelayer1.SelectedMapShapes; foreach (MapShape mapshape in selectedshapes) { if (mapshape.ShapeValue != null) { listbox.Items.Add(mapshape.ShapeValue.ToString()); } } } if (listbox.Items != null && listbox.Items.Count > 0) { textblock.Visibility = Visibility.Visible; } else { textblock.Visibility = Visibility.Collapsed; } }
///<summary> /// Goes to the extent specified by the bounding box for the QTS layer /// </summary> protected virtual void OnGotoExtentClick(object sender, EventArgs e) { lock (this.ParentList.ChildObjects.SyncRoot) { for (int i = 0; i < this.ParentList.ChildObjects.Count; i++) { RenderableObject ro = (RenderableObject)this.ParentList.ChildObjects[i]; if (ro.Name.Equals(name)) { if (ro is QuadTileSet) { QuadTileSet qts = (QuadTileSet)ro; DrawArgs.Camera.SetPosition((qts.North + qts.South) / 2, (qts.East + qts.West) / 2); double perpendicularViewRange = (qts.North - qts.South > qts.East - qts.West ? qts.North - qts.South : qts.East - qts.West); double altitude = qts.LayerRadius * Math.Sin(MathEngine.DegreesToRadians(perpendicularViewRange * 0.5)); DrawArgs.Camera.Altitude = altitude; break; } if (ro is ShapeFileLayer) { ShapeFileLayer slayer = (ShapeFileLayer)ro; DrawArgs.Camera.SetPosition((slayer.North + slayer.South) / 2, (slayer.East + slayer.West) / 2); double perpendicularViewRange = (slayer.North - slayer.South > slayer.East - slayer.West ? slayer.North - slayer.South : slayer.East - slayer.West); double altitude = slayer.MaxAltitude; DrawArgs.Camera.Altitude = altitude; break; } } } } }
public BubbleVisualization() { maps = new SfMaps(); ShapeFileLayer layer = new ShapeFileLayer(); maps.BackgroundColor = Color.White; layer.Uri = "world1.shp"; layer.ItemsSource = GetDataSource(); layer.ShapeIDPath = "Country"; layer.ShapeIDTableField = "NAME"; layer.ShapeSettings = new ShapeSetting(); layer.ShowMapItems = true; layer.ShapeSettings.ShapeValuePath = "Code"; layer.ShapeSettings.ShapeFill = Color.FromHex("#A9D9F7"); BubbleMarkerSetting marker = new BubbleMarkerSetting() { Fill = Color.FromHex("#ffa500"), ValuePath = "Population", MinSize = 15, MaxSize = 25 }; layer.BubbleMarkerSettings = marker; maps.Layers.Add(layer); this.ContentView = maps; }
public override Android.Views.View GetSampleContent (Android.Content.Context context) { LinearLayout layout= new LinearLayout(context); layout.Orientation = Orientation.Vertical; TextView textView= new TextView(context); textView.TextSize = 16; textView.SetPadding(10,20,0,0); textView.SetHeight(70); textView.Text ="Top Population Countries With Bubbles"; layout.AddView(textView); textView.Gravity = Android.Views.GravityFlags.Top; maps = new SfMaps (context); ShapeFileLayer layer = new ShapeFileLayer (); layer.ShowItems = true; layer.Uri ="world1.shp"; layer.DataSource = GetDataSource(); layer.ShapeIdPath = "Country"; layer.ShapeIdTableField = "NAME"; layer.ShapeSettings = new ShapeSetting (); layer.ShapeSettings.ShapeValuePath= "ShortName"; layer.ShapeSettings.ShapeFill = Color.ParseColor ("#A9D9F7"); BubbleMarkerSetting marker = new BubbleMarkerSetting () { FillColor = Color.ParseColor ("#ffa500"), MinSize=15,MaxSize=25, ValuePath="Population" }; layer.BubbleMarkerSetting = marker; maps.Layers.Add (layer); layout.AddView (maps); return layout; }
void ShapeSelection_ShapesUnSelected(object sender, SelectionEventArgs args) { ShapeFileLayer shapeLayer = sender as ShapeFileLayer; int count = listbox.Items.Count; ObservableCollection <MapShape> items = args.Items as ObservableCollection <MapShape>; int j = -1; if (items.Count > 0) { for (int i = 0; i < count; i++) { if (items[0].ShapeValue != null) { if (shapeLayer.EnableSelection && !shapeLayer.EnableMultiSelection && (listbox.Items[i] as ListBoxItem) != null && items[0].ShapeValue.ToString() == (listbox.Items[i] as ListBoxItem).Content.ToString()) { j = i; break; } else { if (shapeLayer.EnableMultiSelection && items[0].ShapeValue.ToString() == listbox.Items[i].ToString()) { j = i; break; } } } } if (j != -1) { listbox.Items.RemoveAt(j); } } }
void map_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { listbox.Items.Clear(); ShapeFileLayer shapefilelayer1 = (sender as SfMap).Layers[0] as ShapeFileLayer; if (shapefilelayer1.SelectedMapShapes.Count > 0) { var selectedshapes = shapefilelayer1.SelectedMapShapes; foreach (MapShape mapshape in selectedshapes) { if (mapshape.ShapeValue != null) { listbox.Items.Add(mapshape.ShapeValue.ToString()); } } } if (listbox.Items != null && listbox.Items.Count > 0) { textblock.Visibility = Visibility.Visible; } else { textblock.Visibility = Visibility.Collapsed; } }
public override Android.Views.View GetSampleContent(Android.Content.Context context) { LinearLayout layout = new LinearLayout(context); layout.Orientation = Orientation.Vertical; TextView textView = new TextView(context); textView.TextSize = 16; textView.SetPadding(10, 20, 0, 0); textView.SetHeight(70); textView.Text = "Top Population Countries With Bubbles"; layout.AddView(textView); textView.Gravity = Android.Views.GravityFlags.Top; maps = new SfMaps(context); ShapeFileLayer layer = new ShapeFileLayer(); layer.ShowItems = true; layer.Uri = "world1.shp"; layer.DataSource = GetDataSource(); layer.ShapeIdPath = "Country"; layer.ShapeIdTableField = "NAME"; layer.ShapeSettings = new ShapeSetting(); layer.ShapeSettings.ShapeValuePath = "ShortName"; layer.ShapeSettings.ShapeFill = Color.ParseColor("#A9D9F7"); BubbleMarkerSetting marker = new BubbleMarkerSetting() { FillColor = Color.ParseColor("#ffa500"), MinSize = 15, MaxSize = 25, ValuePath = "Population" }; layer.BubbleMarkerSetting = marker; maps.Layers.Add(layer); layout.AddView(maps); return(layout); }
private void Form1_Load(object sender, EventArgs e) { this.mapsControl1.Dock = DockStyle.Fill; this.mapsControl1.Margin = new Padding(0, 0, 4, 0); this.mapsControl1.MapBackgroundBrush = new SolidBrush(Color.White); this.mapsControl1.MapItemsShape = Syncfusion.Windows.Forms.Maps.MapItemShapes.None; this.mapsControl1.MapItemStroke = new SolidBrush(Color.Black); ShapeFileLayer shapeLayer = new ShapeFileLayer(); shapeLayer.ShapeSetting.FillSetting.AutoFillColors = false; shapeLayer.ShowMapItem = true; shapeLayer.Uri = "world1.shp"; shapeLayer.ShapeIDPath = "NAME"; shapeLayer.ShapeIDTableField = "NAME"; shapeLayer.ShowMapItem = true; shapeLayer.ShapeSetting.ShapeFill = "#626171"; shapeLayer.ShapeSetting.ShapeStrokeThickness = 0.5; shapeLayer.ShapeSetting.ShapeStroke = "#C1C1C1"; shapeLayer.ShapeSetting.FillSetting.AutoFillColors = false; Annotation annotation1 = new Annotation() { AnnotationShape = AnnotationShapes.Rectangle, AnnotationLabel = "United States", Latitude = 35.8233, Longitude = -78.8258 }; Annotation annotation2 = new Annotation() { AnnotationShape = AnnotationShapes.Rectangle, AnnotationLabel = "India", Latitude = 13.0810, Longitude = 79.970 }; shapeLayer.Annotations.Add(annotation1); shapeLayer.Annotations.Add(annotation2); shapeLayer.Annotations = new ObservableCollection <Annotation>() { new SyncfusionLocations() { Name = "USA", Latitude = 38.8833, Longitude = -77.0167 }, new SyncfusionLocations() { Name = "Brazil", Latitude = -15.7833, Longitude = -47.8667 }, new SyncfusionLocations() { Name = "India", Latitude = 21.0000, Longitude = 78.0000 }, new SyncfusionLocations() { Name = "China", Latitude = 35.0000, Longitude = 103.0000 }, new SyncfusionLocations() { Name = "Indonesia", Latitude = -6.1750, Longitude = 106.8283 }, }; this.mapsControl1.AnnotationDrawing += mapsControl1_AnnotationDrawing; this.mapsControl1.Layers.Add(shapeLayer); }
public override Android.Views.View GetSampleContent(Android.Content.Context context) { handler = new Handler(); LinearLayout layout = new LinearLayout(context); TextView textView = new TextView(context); textView.TextSize = 16; textView.SetPadding(10, 20, 0, 0); textView.SetHeight(90); textView.Text = "Primary Agricultural Activity of USA"; layout.AddView(textView); textView.Gravity = Android.Views.GravityFlags.Top; layout.Orientation = Orientation.Vertical; maps = new SfMaps(context); ShapeFileLayer layer = new ShapeFileLayer(); layer.Uri = "usa_state.shp"; layer.ShapeIdTableField = "STATE_NAME"; layer.ShapeIdPath = "Name"; layer.DataSource = GetDataSource(); layer.ShapeSettings.ShapeColorValuePath = "Type"; layer.ShapeSettings.ShapeFill = Color.ParseColor("#A9D9F7"); SetColorMapping(layer.ShapeSettings); LayerCustomTooltipSetting layerCustomTooltip = new LayerCustomTooltipSetting(context); layerCustomTooltip.ShowTooltip = true; layer.TooltipSettings = layerCustomTooltip; layer.LegendSetting = new LegendSetting() { ShowLegend = true, ItemMargin = 0 }; maps.Layers.Add(layer); SfBusyIndicator sfBusyIndicator = new SfBusyIndicator(context); sfBusyIndicator.IsBusy = true; sfBusyIndicator.AnimationType = AnimationTypes.SlicedCircle; sfBusyIndicator.ViewBoxWidth = 50; sfBusyIndicator.ViewBoxHeight = 50; sfBusyIndicator.TextColor = Color.ParseColor("#779772"); layout.AddView(sfBusyIndicator); Java.Lang.Runnable run = new Java.Lang.Runnable(() => { layout.RemoveView(sfBusyIndicator); layout.AddView(maps); }); handler.PostDelayed(run, 100); return(layout); }
public DataMarkers() { maps = new SfMaps(); ShapeFileLayer layer = new ShapeFileLayer(); layer.Uri = "world1.shp"; maps.Layers.Add(layer); Content = maps; }
public DataMarkers () { maps = new SfMaps (); ShapeFileLayer layer = new ShapeFileLayer (); layer.Uri ="world1.shp"; maps.Layers.Add (layer); Content = maps; }
public override Android.Views.View GetSampleContent(Android.Content.Context context) { handler = new Handler(); LinearLayout layout = new LinearLayout(context); layout.Orientation = Orientation.Vertical; maps = new SfMaps(context); currentToast = new Toast(context); ShapeFileLayer layer = new ShapeFileLayer(); layer.Uri = "usa_state.shp"; layer.ShapeSelected += (object sender, ShapeFileLayer.ShapeSelectedEventArgs e) => { JSONObject data = (JSONObject)e.P0; if (data != null) { if (currentToast != null) { currentToast.Cancel(); } currentToast = Toast.MakeText(context, data.Get("Name") + "\n" + data.Get("Type"), ToastLength.Short); currentToast.Show(); } }; layer.EnableSelection = true; layer.ShapeIdTableField = "STATE_NAME"; layer.ShapeIdPath = "Name"; layer.DataSource = GetDataSource(); layer.LegendSetting = new LegendSetting() { ShowLegend = true }; layer.ShapeSettings.ShapeStrokeThickess = 2; SetColorMapping(layer.ShapeSettings); layer.ShapeSettings.ShapeColorValuePath = "Type"; maps.Layers.Add(layer); SfBusyIndicator sfBusyIndicator = new SfBusyIndicator(context); sfBusyIndicator.IsBusy = true; sfBusyIndicator.AnimationType = AnimationTypes.SlicedCircle; sfBusyIndicator.ViewBoxWidth = 50; sfBusyIndicator.ViewBoxHeight = 50; sfBusyIndicator.TextColor = Color.ParseColor("#779772"); //sfBusyIndicator.SetBackgroundColor(Color.ParseColor("#779772")); layout.AddView(sfBusyIndicator); Java.Lang.Runnable run = new Java.Lang.Runnable(() => { layout.RemoveView(sfBusyIndicator); layout.AddView(maps); }); handler.PostDelayed(run, 100); return(layout); }
public MapsGettingStarted() { maps = new SfMaps(); ShapeFileLayer layer = new ShapeFileLayer(); layer.Uri = "world1.shp"; layer.ShapeSettings.ShapeFill = Color.Gray; MapMarker usa = new MapMarker(); usa.Latitude = "38.8833"; usa.Longitude = "-77.0167"; usa.Label = "United States"; layer.Markers.Add(usa); MapMarker brazil = new MapMarker(); brazil.Latitude = "-15.7833"; brazil.Longitude = "-47.8667"; brazil.Label = "Brazil"; layer.Markers.Add(brazil); MapMarker india = new MapMarker(); india.Latitude = "21.0000"; india.Longitude = "78.0000"; india.Label = "India"; layer.Markers.Add(india); MapMarker china = new MapMarker(); china.Latitude = "35.0000"; china.Longitude = "103.0000"; china.Label = "China"; layer.Markers.Add(china); MapMarker indonesia = new MapMarker(); indonesia.Latitude = "-6.1750"; indonesia.Longitude = "106.8283"; indonesia.Label = "Indonesia"; layer.Markers.Add(indonesia); maps.Layers.Add(layer); this.ContentView = maps; }
public override Android.Views.View GetSampleContent(Android.Content.Context context) { handler = new Handler(); LinearLayout layout = new LinearLayout(context); layout.Orientation = Orientation.Vertical; TextView textView = new TextView(context); textView.TextSize = 16; textView.SetPadding(10, 20, 0, 0); textView.SetHeight(90); textView.Text = "Top Population Countries With Bubbles"; layout.AddView(textView); textView.Gravity = Android.Views.GravityFlags.Top; maps = new SfMaps(context); ShapeFileLayer layer = new ShapeFileLayer(); layer.ShowItems = true; layer.Uri = "world1.shp"; layer.DataSource = GetDataSource(); layer.ShapeIdPath = "Country"; layer.ShapeIdTableField = "NAME"; layer.ShapeSettings = new ShapeSetting(); layer.ShapeSettings.ShapeValuePath = "ShortName"; layer.ShapeSettings.ShapeFill = Color.ParseColor("#A9D9F7"); BubbleMarkerSetting marker = new BubbleMarkerSetting() { FillColor = Color.ParseColor("#ffa500"), MinSize = 15, MaxSize = 25, ValuePath = "Population" }; layer.BubbleMarkerSetting = marker; maps.Layers.Add(layer); SfBusyIndicator sfBusyIndicator = new SfBusyIndicator(context); sfBusyIndicator.IsBusy = true; sfBusyIndicator.AnimationType = AnimationTypes.SlicedCircle; sfBusyIndicator.ViewBoxWidth = 50; sfBusyIndicator.ViewBoxHeight = 50; sfBusyIndicator.TextColor = Color.ParseColor("#779772"); layout.AddView(sfBusyIndicator); Java.Lang.Runnable run = new Java.Lang.Runnable(() => { layout.RemoveView(sfBusyIndicator); layout.AddView(maps); }); handler.PostDelayed(run, 100); return(layout); }
private void ShapeSelectionBehavior_ShapesSelected(object sender, SelectionEventArgs args) { ShapeFileLayer shapefilelayer1 = sender as ShapeFileLayer; if (shapefilelayer1.SelectedMapShapes.Count == 1 && shapefilelayer1.SelectedMapShapes[0].ShapeValue != null) { this.AssociatedObject.textblock.Visibility = Visibility.Visible; this.AssociatedObject.listbox.Items.Clear(); this.AssociatedObject.listbox.Items.Add(new ListBoxItem() { Content = shapefilelayer1.SelectedMapShapes[0].ShapeValue.ToString() }); } }
public override Android.Views.View GetSampleContent(Android.Content.Context context) { handler = new Handler(); LinearLayout layout = new LinearLayout(context); layout.Orientation = Orientation.Vertical; TextView textView = new TextView(context); textView.TextSize = 16; textView.SetPadding(10, 20, 0, 0); textView.SetHeight(90); textView.Text = "Rivers in Australia"; layout.AddView(textView); textView.Gravity = Android.Views.GravityFlags.Top; maps = new SfMaps(context); ShapeFileLayer layer = new ShapeFileLayer(); layer.Uri = "australia.shp"; layer.ShapeSettings.ShapeFill = Color.ParseColor("#ACF9F7"); layer.ShapeSettings.ShapeStrokeThickess = 1; maps.Layers.Add(layer); SubShapeFileLayer subLayer = new SubShapeFileLayer(); subLayer.Uri = "river.shp"; subLayer.ShapeSettings.ShapeFill = Color.ParseColor("#00A8CC"); subLayer.ShapeSettings.ShapeStrokeThickess = 2; layer.SubShapeFileLayers.Add(subLayer); maps.Layers.Add(layer); SfBusyIndicator sfBusyIndicator = new SfBusyIndicator(context); sfBusyIndicator.IsBusy = true; sfBusyIndicator.AnimationType = AnimationTypes.SlicedCircle; sfBusyIndicator.ViewBoxWidth = 50; sfBusyIndicator.ViewBoxHeight = 50; sfBusyIndicator.TextColor = Color.ParseColor("#779772"); layout.AddView(sfBusyIndicator); Java.Lang.Runnable run = new Java.Lang.Runnable(() => { layout.RemoveView(sfBusyIndicator); layout.AddView(maps); }); handler.PostDelayed(run, 100); return(layout); }
void MainWindow_ShapesSelected(object sender, SelectionEventArgs args) { ShapeFileLayer shapefilelayer1 = sender as ShapeFileLayer; if (shapefilelayer1.SelectedMapShapes.Count == 1 && shapefilelayer1.SelectedMapShapes[0].ShapeValue != null) { textblock.Visibility = Visibility.Visible; listbox.Items.Clear(); listbox.Items.Add(new ListBoxItem() { Content = shapefilelayer1.SelectedMapShapes[0].ShapeValue.ToString() }); } }
public override Android.Views.View GetSampleContent(Android.Content.Context context) { handler = new Handler(); LinearLayout layout = new LinearLayout(context); layout.Orientation = Orientation.Vertical; maps = new SfMaps(context); layer = new ShapeFileLayer(); layer.Uri = "usa_state.shp"; layer.ShowItems = true; layer.EnableSelection = false; layer.ShapeIdTableField = "STATE_NAME"; layer.ShapeIdPath = "Name"; layer.ShapeSettings.ShapeFill = Color.ParseColor("#A9D9F7"); layer.ShapeSettings.ShapeValuePath = "Name"; layer.ShapeSettings.ShapeColorValuePath = "Type"; layer.DataSource = GetDataSource(); SetColorMapping(layer.ShapeSettings); layer.DataLabelSettings.IntersectionAction = IntersectAction.None; layer.DataLabelSettings.SmartLabelMode = IntersectAction.Trim; layer.TooltipSettings.ShowTooltip = true; layer.TooltipSettings.ValuePath = "Name"; maps.Layers.Add(layer); SfBusyIndicator sfBusyIndicator = new SfBusyIndicator(context); sfBusyIndicator.IsBusy = true; sfBusyIndicator.AnimationType = AnimationTypes.SlicedCircle; sfBusyIndicator.ViewBoxWidth = 50; sfBusyIndicator.ViewBoxHeight = 50; sfBusyIndicator.TextColor = Color.ParseColor("#779772"); layout.AddView(sfBusyIndicator); Java.Lang.Runnable run = new Java.Lang.Runnable(() => { layout.RemoveView(sfBusyIndicator); layout.AddView(maps); }); handler.PostDelayed(run, 100); return(layout); }
public ColorMappings () { maps = new SfMaps (); maps.BackgroundColor = Color.White; ShapeFileLayer layer = new ShapeFileLayer(); layer.Uri ="usa_state.shp"; layer.ShapeIDTableField ="STATE_NAME"; layer.ShapeIDPath ="Name"; layer.ItemsSource = GetDataSource (); layer.BubbleMarkerSettings = null; SetColorMapping(layer.ShapeSettings); layer.ShapeSettings.ShapeColorValuePath ="Type"; maps.Layers.Add (layer); Content = maps; }
private static void OnShapeFileEventsChanged(DependencyObject d, DependencyPropertyChangedEventArgs e) { shapeLayer = d as ShapeFileLayer; if (shapeLayer != null) { mainWindow = ShapeFileEventHelper.FindParent <MainWindow>(shapeLayer) as MainWindow; mainWindow.btnReset.Click += new RoutedEventHandler(btnReset_Click); mapControl = ShapeFileEventHelper.FindParent <MapControl>(shapeLayer) as MapControl; shapeLayer.ShapesLoaded += new ShapesLoadedEventHandler(shapeLayer_ShapesLoaded); shapeLayer.ZoomedIn += new ZoomEventHandler(shapeLayer_ZoomedIn); shapeLayer.ZoomedOut += new ZoomEventHandler(shapeLayer_ZoomedOut); shapeLayer.Panning += new PanEventHandler(shapeLayer_Panning); shapeLayer.Panned += new PanEventHandler(shapeLayer_Panned); } }
public ColorMappings() { maps = new SfMaps(); maps.BackgroundColor = Color.White; ShapeFileLayer layer = new ShapeFileLayer(); layer.Uri = "usa_state.shp"; layer.ShapeIDTableField = "STATE_NAME"; layer.ShapeIDPath = "Name"; layer.ItemsSource = GetDataSource(); layer.BubbleMarkerSettings = null; SetColorMapping(layer.ShapeSettings); layer.ShapeSettings.ShapeColorValuePath = "Type"; maps.Layers.Add(layer); Content = maps; }
public override Android.Views.View GetSampleContent(Android.Content.Context context) { Toast currentToast = new Toast(context); LinearLayout layout = new LinearLayout(context); layout.Orientation = Orientation.Vertical; TextView textView = new TextView(context); textView.TextSize = 20; textView.SetPadding(10, 20, 0, 0); textView.SetHeight(70); textView.Text = "Primary Agricultural Data of USA"; layout.AddView(textView); textView.Gravity = Android.Views.GravityFlags.Top; maps = new SfMaps(context); ShapeFileLayer layer = new ShapeFileLayer(); layer.ShapeSelected += (object sender, ShapeFileLayer.ShapeSelectedEventArgs e) => { JSONObject data = (JSONObject)e.P0; if (data != null) { if (currentToast != null) { currentToast.Cancel(); } currentToast = Toast.MakeText(context, data.Get("Name") + "\n" + data.Get("Type"), ToastLength.Short); currentToast.Show(); } }; layer.EnableSelection = true; layer.Uri = "usa_state.shp"; layer.ShapeIdTableField = "STATE_NAME"; layer.ShapeIdPath = "Name"; layer.DataSource = GetDataSource(); layer.ShapeSettings.ShapeStrokeThickess = 2; SetColorMapping(layer.ShapeSettings); layer.ShapeSettings.ShapeColorValuePath = "Type"; maps.Layers.Add(layer); maps.SetY(-20); layout.AddView(maps); return(layout); }
public BubbleVisualization () { maps = new SfMaps (); ShapeFileLayer layer = new ShapeFileLayer (); maps.BackgroundColor = Color.White; layer.Uri ="world1.shp"; layer.ItemsSource = GetDataSource(); layer.ShapeIDPath = "Country"; layer.ShapeIDTableField = "NAME"; layer.ShapeSettings = new ShapeSetting (); layer.ShapeSettings.ShapeValuePath= "Country"; layer.ShapeSettings.ShapeFill = Color.FromHex ("#A9D9F7"); BubbleMarkerSetting marker = new BubbleMarkerSetting () { Fill = Color.FromHex ("#ffa500"), MinSize=25,MaxSize=75 }; layer.BubbleMarkerSettings = marker; maps.Layers.Add (layer); Content = maps; }
private void MapsTicketBooking_ShapeSelectionChanged(object sender, ShapeSelectedEventArgs e) { ShapeFileLayer shapeLayer = sender as ShapeFileLayer; ShapeData data = e.Data as ShapeData; if (data != null) { if (data.SeatNumber == "1" || data.SeatNumber == "2" || data.SeatNumber == "8" || data.SeatNumber == "9") { if (shapeLayer.SelectedItems.Contains(e.Data)) { shapeLayer.SelectedItems.Remove(e.Data); } } else { UpdateSelection(shapeLayer); } } }
void ShapeSelection_ShapesSelected(object sender, SelectionEventArgs args) { ShapeFileLayer shapefilelayer1 = sender as ShapeFileLayer; int count = shapefilelayer1.SelectedMapShapes.Count; if (count > 0 && shapefilelayer1.SelectedMapShapes[0].ShapeValue != null) { textblock.Visibility = Visibility.Visible; listbox.Items.Clear(); for (int i = 0; i < count; i++) { if (shapefilelayer1.SelectedMapShapes[i].ShapeValue != null) { listbox.Items.Add(new ListBoxItem() { Content = shapefilelayer1.SelectedMapShapes[i].ShapeValue.ToString() }); } } } }
private void TestLayer() { var color = Xamarin.Forms.Color.Blue; ShapeFileLayer subLayer = new ShapeFileLayer(); subLayer.ShapeType = ShapeType.Polyline; subLayer.Points = new ObservableCollection <Xamarin.Forms.Point>() { new Point(67.26238555, -14.31983023), new Point(67.58549159, -11.84384661), new Point(66.81337252, -11.66571815), }; ShapeSetting subLayerSetting = new ShapeSetting(); subLayerSetting.ShapeFill = color.MultiplyAlpha(.3); subLayerSetting.ShapeStroke = color.MultiplyAlpha(.5); subLayerSetting.ShapeStrokeThickness = 2; subLayer.ShapeSettings = subLayerSetting; Sublayers.Add(subLayer); }
public override Android.Views.View GetSampleContent (Android.Content.Context context) { Toast currentToast=new Toast(context); LinearLayout layout= new LinearLayout(context); layout.Orientation = Orientation.Vertical; TextView textView= new TextView(context); textView.TextSize = 20; textView.SetPadding(10,20,0,0); textView.SetHeight(70); textView.Text ="Primary Agricultural Data of USA"; layout.AddView(textView); textView.Gravity = Android.Views.GravityFlags.Top; maps = new SfMaps (context); ShapeFileLayer layer = new ShapeFileLayer(); layer.ShapeSelected += (object sender, ShapeFileLayer.ShapeSelectedEventArgs e) => { JSONObject data = (JSONObject)e.P0; if (data != null) { if (currentToast != null) { currentToast.Cancel (); } currentToast = Toast.MakeText (context, data.Get ("Name") + "\n" + data.Get ("Type"), ToastLength.Short); currentToast.Show (); } }; layer.EnableSelection = true; layer.Uri ="usa_state.shp"; layer.ShapeIdTableField ="STATE_NAME"; layer.ShapeIdPath ="Name"; layer.DataSource = GetDataSource (); layer.ShapeSettings.ShapeStrokeThickess = 2; SetColorMapping(layer.ShapeSettings); layer.ShapeSettings.ShapeColorValuePath ="Type"; maps.Layers.Add (layer); maps.SetY(-20); layout.AddView (maps); return layout; }
void UpdateSelection(ShapeFileLayer shapeLayer) { string selected = ""; if (shapeLayer.SelectedItems.Count == 0) { SelectedLabel.Text = selected; SelectedLabelCount.Text = " "; this.ClearButton.IsEnabled = false; this.ClearButton.Opacity = 0.5; } else { int count = 0; for (int i = 0; i < shapeLayer.SelectedItems.Count; i++) { ShapeData data = shapeLayer.SelectedItems[i] as ShapeData; count++; if (shapeLayer.SelectedItems.Count == 1 || i == shapeLayer.SelectedItems.Count - 1) { selected += ("S" + data.SeatNumber); } else { selected += ("S" + data.SeatNumber + ", "); } this.ClearButton.Opacity = 1; this.ClearButton.IsEnabled = true; SelectedLabel.Text = selected; } SelectedLabelCount.Text = "" + count; } }
protected override void OnAppearing() { if (BindingContext is CartoViewModel) { var tmp = BindingContext as CartoViewModel; tmp.OnAppear?.Execute(null); SfMaps map = new SfMaps(); map.BackgroundColor = Color.White; //var map = this.Content as SfMaps; ShapeFileLayer layer = new ShapeFileLayer(); layer.Uri = "world1.shp"; layer.ItemsSource = tmp.HabitatDataSource; //layer.SetBinding(ShapeFileLayer.ItemsSourceProperty, "HabitatDataSource"); layer.ShapeIDTableField = "POSTAL"; layer.ShapeIDPath = "Postal"; EqualColorMapping colorMapping = new EqualColorMapping(); colorMapping.Color = Color.FromHex("#D84444"); colorMapping.Value = "AnimalLabel"; ShapeSetting shapeSetting = new ShapeSetting(); shapeSetting.ShapeValuePath = "Animal"; shapeSetting.ShapeColorValuePath = "Animal"; shapeSetting.ColorMappings.Add(colorMapping); layer.ShapeSettings = shapeSetting; map.Layers.Add(layer); this.Content = map; } base.OnAppearing(); }
/// <summary> /// Gets the name attribute index from a shape file layer. /// If the value of nameAttribute is not provided, will use the first attribute with the word 'name' in it. /// </summary> /// <param name="layer">The shape file layer.</param> /// <param name="nameAttribute">The name attribute.</param> /// <returns>The index or -1 if not found.</returns> static int GetNameAttributeIndex(ShapeFileLayer layer, ref string nameAttribute) { string[] attributes = layer.FieldNames; List <string> list = new List <string>(); foreach (string s in attributes) { list.Add(s.ToLowerInvariant()); } attributes = list.ToArray(); if (!string.IsNullOrEmpty(nameAttribute)) { int nameAttributeIndex = Array.IndexOf(attributes, nameAttribute); if (nameAttributeIndex != -1) { return(nameAttributeIndex); } return(-1); } // No valid attribute name was supplied, will use the first attribute with the word 'name' in it. int currentIndex = 0; foreach (string attribute in attributes) { if (attribute.Contains("name")) { nameAttribute = attributes[currentIndex]; return(currentIndex); } currentIndex++; } return(-1); }
private void Form1_Load(object sender, EventArgs e) { this.MetroColor = Color.White; this.mapsControl1.Dock = DockStyle.Fill; this.mapsControl1.Margin = new Padding(0, 0, 4, 0); this.mapsControl1.MapBackgroundBrush = new SolidBrush(Color.White); this.mapsControl1.MapItemsShape = Syncfusion.Windows.Forms.Maps.MapItemShapes.None; this.mapsControl1.MapItemStroke = new SolidBrush(Color.Black); #region data MapViewModel viewmodel = new MapViewModel(); #endregion ShapeFileLayer shapeLayer = new ShapeFileLayer(); shapeLayer.ShapeSetting.FillSetting.AutoFillColors = false; shapeLayer.Uri = "states.shp"; shapeLayer.ShapeSetting.ShapeFill = "#E5E5E5"; shapeLayer.ShapeSetting.ShapeStrokeThickness = 0.5; shapeLayer.ShapeSetting.ShapeStroke = "#C1C1C1"; #region Sub-Layer(Sublayer) SubShapeFileLayer layer1 = new SubShapeFileLayer(); layer1.Uri = "landslide.shp"; layer1.ShapeSetting.ShapeFill = "#8DCEFF"; layer1.ShapeSetting.ShapeStrokeThickness = 0.5; layer1.ShapeSetting.ShapeStroke = "#2F8CEA"; shapeLayer.SubShapeFileLayers.Add(layer1); #endregion this.mapsControl1.Layers.Add(shapeLayer); }
public override Android.Views.View GetSampleContent(Android.Content.Context context) { handler = new Handler(); layout = new LinearLayout(context); linearLayout1 = new LinearLayout(context); linearLayout = new LinearLayout(context); linearLayout.Visibility = Android.Views.ViewStates.Invisible; text = new TextView(context); text.TextSize = 16; text.SetPadding(10, 20, 0, 0); text.SetHeight(90); text.Text = "WorldMap"; text.SetTextColor(Color.Blue); text.Click += Text_Click; linearLayout.AddView(text); text3 = new TextView(context); text3.TextSize = 16; text3.SetPadding(10, 20, 0, 0); text3.Text = "Click on a shape to drill"; text3.TextAlignment = Android.Views.TextAlignment.Center; linearLayout1.AddView(text3); text1 = new TextView(context); text1.Text = ">>"; text1.SetPadding(10, 20, 0, 0); linearLayout.AddView(text1); text2 = new TextView(context); linearLayout.AddView(text2); layout.Orientation = Orientation.Vertical; maps = new SfMaps(context); maps.EnableZooming = false; layer = new ShapeFileLayer(); layer.Uri = "world-map.shp"; layer.EnableSelection = true; layer.ShapeIdTableField = "admin"; layer.ShapeIdPath = "country"; layer.DataSource = GetDataSource(); layer.ShapeSettings.ShapeColorValuePath = "continent"; layer.ShapeSelected += (object sender, ShapeFileLayer.ShapeSelectedEventArgs e) => { JSONObject data = (JSONObject)e.P0; if (data != null) { var dat = data.Get("continent").ToString(); text2.Text = dat; linearLayout.Visibility = Android.Views.ViewStates.Visible; linearLayout1.Visibility = Android.Views.ViewStates.Invisible; if (dat == "South America") { maps.BaseMapIndex = 1; layer.ShapeSettings.SelectedShapeColor = Color.ParseColor("#9C3367"); } else if (dat == "North America") { maps.BaseMapIndex = 2; layer.ShapeSettings.SelectedShapeColor = Color.ParseColor("#C13664"); } else if (dat == "Europe") { maps.BaseMapIndex = 3; layer.ShapeSettings.SelectedShapeColor = Color.ParseColor("#622D6C"); } else if (dat == "Africa") { maps.BaseMapIndex = 4; layer.ShapeSettings.SelectedShapeColor = Color.ParseColor("#80306A"); } else if (dat == "Australia") { maps.BaseMapIndex = 5; layer.ShapeSettings.SelectedShapeColor = Color.ParseColor("#2A2870"); } else if (dat == "Asia") { maps.BaseMapIndex = 6; layer.ShapeSettings.SelectedShapeColor = Color.ParseColor("#462A6D"); } } }; SetColorMapping(layer.ShapeSettings); CustomMarker mapMarker = new CustomMarker(context); mapMarker.Label = "Asia"; mapMarker.Latitude = 63.34303378997662; mapMarker.Longitude = 102.07617561287645; layer.Markers.Add(mapMarker); CustomMarker mapMarker1 = new CustomMarker(context); mapMarker1.Label = "Australia"; mapMarker1.Latitude = -25.74775493367931; mapMarker1.Longitude = 136.80451417932431; layer.Markers.Add(mapMarker1); CustomMarker mapMarker2 = new CustomMarker(context); mapMarker2.Label = "Africa"; mapMarker2.Latitude = 19.025302093442327; mapMarker2.Longitude = 15.157534554671087; layer.Markers.Add(mapMarker2); CustomMarker mapMarker3 = new CustomMarker(context); mapMarker3.Label = "North America"; mapMarker3.Latitude = 59.88893689676585; mapMarker3.Longitude = -109.3359375; layer.Markers.Add(mapMarker3); CustomMarker mapMarker4 = new CustomMarker(context); mapMarker4.Label = "Europe"; mapMarker4.Latitude = 47.95121990866204; mapMarker4.Longitude = 18.468749999999998; layer.Markers.Add(mapMarker4); CustomMarker mapMarker5 = new CustomMarker(context); mapMarker5.Label = "South America"; mapMarker5.Latitude = -6.64607562172573; mapMarker5.Longitude = -55.54687499999999; layer.Markers.Add(mapMarker5); maps.Layers.Add(layer); ShapeFileLayer layer1 = new ShapeFileLayer(); layer1.ShapeIdPath = "country"; layer1.ShapeIdTableField = "admin"; layer1.Uri = "south-america.shp"; layer1.ShapeSettings.ShapeFill = Color.ParseColor("#9C3367"); maps.Layers.Add(layer1); ShapeFileLayer layer2 = new ShapeFileLayer(); layer2.ShapeIdPath = "country"; layer2.ShapeIdTableField = "admin"; layer2.Uri = "north-america.shp"; layer2.ShapeSettings.ShapeFill = Color.ParseColor("#C13664"); maps.Layers.Add(layer2); ShapeFileLayer layer3 = new ShapeFileLayer(); layer3.ShapeIdPath = "country"; layer3.ShapeIdTableField = "admin"; layer3.Uri = "europe.shp"; layer3.ShapeSettings.ShapeFill = Color.ParseColor("#622D6C"); maps.Layers.Add(layer3); ShapeFileLayer layer4 = new ShapeFileLayer(); layer4.ShapeIdPath = "country"; layer4.ShapeIdTableField = "admin"; layer4.Uri = "africa.shp"; layer4.ShapeSettings.ShapeFill = Color.ParseColor("#80306A"); maps.Layers.Add(layer4); ShapeFileLayer layer5 = new ShapeFileLayer(); layer5.ShapeIdPath = "country"; layer5.ShapeIdTableField = "admin"; layer5.Uri = "australia.shp"; layer5.ShapeSettings.ShapeFill = Color.ParseColor("#2A2870"); maps.Layers.Add(layer5); ShapeFileLayer layer6 = new ShapeFileLayer(); layer6.ShapeIdPath = "country"; layer6.ShapeIdTableField = "admin"; layer6.Uri = "asia.shp"; layer6.ShapeSettings.ShapeFill = Color.ParseColor("#462A6D"); maps.Layers.Add(layer6); SfBusyIndicator sfBusyIndicator = new SfBusyIndicator(context); sfBusyIndicator.IsBusy = true; sfBusyIndicator.AnimationType = AnimationTypes.SlicedCircle; sfBusyIndicator.ViewBoxWidth = 50; sfBusyIndicator.ViewBoxHeight = 50; sfBusyIndicator.TextColor = Color.ParseColor("#779772"); layout.AddView(sfBusyIndicator); Java.Lang.Runnable run = new Java.Lang.Runnable(() => { layout.RemoveView(sfBusyIndicator); layout.AddView(linearLayout); layout.AddView(linearLayout1); layout.AddView(maps); }); handler.PostDelayed(run, 100); return(layout); }
public override Android.Views.View GetSampleContent(Android.Content.Context context) { LayoutInflater layoutInflater = LayoutInflater.From(context); view = layoutInflater.Inflate(Resource.Layout.TicketBooking, null); gridlayout = (GridLayout)view; maps = new SfMaps(context); ShapeFileLayer layer = new ShapeFileLayer(); layer.ShowItems = true; layer.EnableSelection = true; layer.Uri = "Custom.shp"; layer.DataSource = GetDataSource(); layer.SelectionMode = SelectionMode.Multiple; layer.ShapeSettings.SelectedShapeColor = Color.Rgb(98, 170, 95); layer.GeometryType = GeometryType.Points; layer.ShapeSelected += (object sender, ShapeFileLayer.ShapeSelectedEventArgs e) => { JSONObject data = (JSONObject)e.P0; if (data != null) { UpdateSelection(); } }; layer.SelectedItems.CollectionChanged += SelectedItems_CollectionChanged; layer.ShapeSettings.ShapeStrokeThickess = 2; SetColorMapping(layer.ShapeSettings); layer.ShapeSettings.ShapeColorValuePath = "SeatNumber"; layer.ShapeIdTableField = "seatno"; layer.ShapeIdPath = "SeatNumber"; maps.Layers.Add(layer); maps.SetPadding(10, 0, 0, 0); linearLayoutChild = (LinearLayout)view.FindViewById(Resource.Id.linear); ClearSelection = (Button)view.FindViewById(Resource.Id.ClearSelection); ClearSelection.Click += (object sender, EventArgs e) => { if ((maps.Layers[0] as ShapeFileLayer).SelectedItems.Count != 0) { (maps.Layers[0] as ShapeFileLayer).SelectedItems.Clear(); SelectedLabel.Text = ""; SelectedLabelCount.Text = "" + (maps.Layers[0] as ShapeFileLayer).SelectedItems.Count; //ClearSelection.Visibility = ViewStates.Invisible; ClearSelection.Alpha = 0.5f; ClearSelection.Enabled = false; } }; SelectedLabel = (TextView)view.FindViewById(Resource.Id.SelectedLabel); SelectedLabelCount = (TextView)view.FindViewById(Resource.Id.SelectedLabelCount); linearLayoutChild.AddView(maps); return(gridlayout); }
/// <summary> /// This method Loads a shapefile /// </summary> /// <param name="shapeConfigFilePath">Full Path to the Shapefiles XML configuration file</param> /// <param name="checkForUpdate">true if it should check for a newer version of the shapefile</param> public void loadShapeFileWithAlreadyExistingXML(string shapeConfigFilePath, bool checkForUpdate) { //Check for updates if(checkForUpdate) { try { XmlDocument doc=new XmlDocument(); doc.Load(shapeConfigFilePath); string downloadURL; if((downloadURL=doc.SelectSingleNode("/LayerSet/DownloadPage/URL").InnerText)!="") { if(checkIfUpdateNeeded(downloadURL,shapeConfigFilePath)) { //Update xml+files UpdateXMLAndFiles(shapeConfigFilePath, downloadURL); } } } catch{} } XPathNavigator nav; XPathDocument docNav; // Open the XML. docNav = new XPathDocument(shapeConfigFilePath); // Create a navigator to query with XPath. nav = docNav.CreateNavigator(); XPathNodeIterator layersetIter = nav.Select("/LayerSet"); if(layersetIter.Count > 0) { while(layersetIter.MoveNext()) { string layersetName = layersetIter.Current.GetAttribute("Name",""); if(layersetName == null) continue; string showOnlyOneLayerString = layersetIter.Current.GetAttribute("ShowOnlyOneLayer", ""); string showAtStartupString = layersetIter.Current.GetAttribute("ShowAtStartup", ""); bool showOnlyOneLayer = false; bool showAtStartup = false; try { showOnlyOneLayer = ParseBool(showOnlyOneLayerString); } catch(Exception) { } try { showAtStartup = ParseBool(showAtStartupString); } catch{} WorldWind.Renderable.RenderableObjectList newLayerSetList = new RenderableObjectList(layersetName); newLayerSetList.ShowOnlyOneLayer = showOnlyOneLayer; newLayerSetList.ParentList = ParentApplication.WorldWindow.CurrentWorld.RenderableObjects; if(World.Settings.UseDefaultLayerStates) { newLayerSetList.IsOn = showAtStartup; } else { newLayerSetList.IsOn = ConfigurationLoader.IsLayerOn(newLayerSetList); } XPathNodeIterator shapeIter = layersetIter.Current.Select("ShapeFileDescriptor"); if(shapeIter.Count > 0) { while(shapeIter.MoveNext()) { string name = getInnerTextFromFirstChild(shapeIter.Current.Select("Name")); string shapeFilePath = getInnerTextFromFirstChild(shapeIter.Current.Select("ShapeFilePath")); string dataKey = getInnerTextFromFirstChild(shapeIter.Current.Select("DataKey")); string showLabelsString = getInnerTextFromFirstChild(shapeIter.Current.Select("ShowLabels")); string polygonFillString = getInnerTextFromFirstChild(shapeIter.Current.Select("PolygonFill")); string outlinePolygonsString = getInnerTextFromFirstChild(shapeIter.Current.Select("OutlinePolygons")); string lineWidthString = getInnerTextFromFirstChild(shapeIter.Current.Select("LineWidth")); string iconFilePath = getInnerTextFromFirstChild(shapeIter.Current.Select("IconFilePath")); string iconWidthString = getInnerTextFromFirstChild(shapeIter.Current.Select("IconWidth")); string iconHeightString = getInnerTextFromFirstChild(shapeIter.Current.Select("IconHeight")); string iconOpacityString = getInnerTextFromFirstChild(shapeIter.Current.Select("IconOpacity")); string scaleColorsToDataString = getInnerTextFromFirstChild(shapeIter.Current.Select("ScaleColorsToData")); /*Altitude Rendering*/ string maxAltString = getInnerTextFromFirstChild(shapeIter.Current.Select("MaxAltitude")); string minAltString = getInnerTextFromFirstChild(shapeIter.Current.Select("MinAltitude")); /*Tile Size Rendering*/ string lztsdString = getInnerTextFromFirstChild(shapeIter.Current.Select("LevelZeroTileSize")); /*LatLong Bounding Box*/ string northString = getInnerTextFromFirstChild(shapeIter.Current.Select("North")); string southString = getInnerTextFromFirstChild(shapeIter.Current.Select("South")); string eastString = getInnerTextFromFirstChild(shapeIter.Current.Select("East")); string westString = getInnerTextFromFirstChild(shapeIter.Current.Select("West")); /*Opacity added by Argon helm*/ string layerOpacityString = getInnerTextFromFirstChild(shapeIter.Current.Select("LayerOpacity")); bool showLabels = false; bool polygonFill = false; float lineWidth = 1.0f; bool outlinePolygons = false; bool scaleColorsToData = false; int iconWidth = 32; int iconHeight = 32; byte iconOpacity = 255; /*Layer Opacity added by Argon Helm*/ byte layerOpacity = 255; /*Altitude Rendering*/ double maxAlt = double.MaxValue; double minAlt = 0; /*Tile Size Rendering*/ float lztsd = 180.0f/5; /*LatLong Bounding Box*/ GeographicBoundingBox bounds = new GeographicBoundingBox(90.0,-90,-180.0,180.0); System.Drawing.Color lineColor = System.Drawing.Color.Black; System.Drawing.Color polygonColor = System.Drawing.Color.Black; System.Drawing.Color labelColor = System.Drawing.Color.White; WorldWind.ShapeFillStyle shapeFillStyle = getShapeFillStyleFromString(getInnerTextFromFirstChild(shapeIter.Current.Select("PolygonFillStyle"))); XPathNodeIterator lineColorIter = shapeIter.Current.Select("LineColor"); if(lineColorIter.Count > 0) { lineColor = getColorFromXPathIter(lineColorIter); } XPathNodeIterator polygonColorIter = shapeIter.Current.Select("PolygonColor"); if(polygonColorIter.Count > 0) { polygonColor = getColorFromXPathIter(polygonColorIter); } XPathNodeIterator labelColorIter = shapeIter.Current.Select("LabelColor"); if(labelColorIter.Count > 0) { labelColor = getColorFromXPathIter(labelColorIter); } showAtStartupString = shapeIter.Current.GetAttribute("ShowAtStartup",""); try { if(showAtStartupString != null) { showAtStartup = ParseBool(showAtStartupString); } else { showAtStartup = false; } if(scaleColorsToDataString != null) { scaleColorsToData = ParseBool(scaleColorsToDataString); } if(showLabelsString != null) { showLabels = ParseBool(showLabelsString); } if(polygonFillString != null) { polygonFill = ParseBool(polygonFillString); } if(lineWidthString != null) { lineWidth = float.Parse(lineWidthString); } if(outlinePolygonsString != null) { outlinePolygons = ParseBool(outlinePolygonsString); } if(iconHeightString != null) { iconHeight = int.Parse(iconHeightString); } if(iconWidthString != null) { iconWidth = int.Parse(iconWidthString); } if(iconOpacityString != null) { iconOpacity = byte.Parse(iconOpacityString); } /*Altitude Rendering*/ if(minAltString!=null) { minAlt=ParseDouble(minAltString); } if(maxAltString!=null) { maxAlt=ParseDouble(maxAltString); } /*Lztsd rendering*/ if(lztsdString!=null) { lztsd=float.Parse(lztsdString); } /*latlon bounds*/ if(northString!=null&&southString!=null&&westString!=null&&eastString!=null) { bounds = new GeographicBoundingBox(ParseDouble(northString), ParseDouble(southString), ParseDouble(westString), ParseDouble(eastString)); } /*Layer Opacity added by argon helm*/ if(layerOpacityString != null) { layerOpacity = byte.Parse(layerOpacityString); } } catch(Exception ex) { Log.Write(ex); } string scalarMinString = getInnerTextFromFirstChild(shapeIter.Current.Select("ScalarMin")); string scalarMaxString = getInnerTextFromFirstChild(shapeIter.Current.Select("ScalarMax")); string scalarFilterMinString = getInnerTextFromFirstChild(shapeIter.Current.Select("ScalarFilterMin")); string scalarFilterMaxString = getInnerTextFromFirstChild(shapeIter.Current.Select("ScalarFilterMax")); string[] noDataValues = getStringValues(shapeIter.Current.Select("NoDataValue")); string[] activeDataValues = getStringValues(shapeIter.Current.Select("ActiveDataValue")); double scalarMin = double.NaN; double scalarMax = double.NaN; double scalarFilterMin = double.NaN; double scalarFilterMax = double.NaN; if(scalarMinString != null) { scalarMin = ParseDouble(scalarMinString); } if(scalarMaxString != null) { scalarMax = ParseDouble(scalarMaxString); } if(scalarFilterMinString != null) { scalarFilterMin = ParseDouble(scalarFilterMinString); } if(scalarFilterMaxString != null) { scalarFilterMax = ParseDouble(scalarFilterMaxString); } /*if(!Path.IsPathRooted(shapeFilePath)) { shapeFilePath = Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "\\" + shapeFilePath; }*/ //path is relative to xml file not to executing apps directory if(!Path.IsPathRooted(shapeFilePath)) { shapeFilePath = shapeConfigFilePath.Remove( shapeConfigFilePath.LastIndexOfAny(new char[]{'\\','/'}), shapeConfigFilePath.Length- shapeConfigFilePath.LastIndexOfAny(new char[]{'\\','/'})) + "\\" + shapeFilePath; } WorldWind.ShapeFileLayer shapeFileLayer = new ShapeFileLayer( name, ParentApplication.WorldWindow.CurrentWorld, shapeFilePath, minAlt, maxAlt, lztsd, bounds, dataKey, scaleColorsToData, scalarFilterMin, scalarFilterMax, scalarMin, scalarMax, noDataValues, activeDataValues, polygonFill, outlinePolygons, polygonColor, shapeFillStyle, lineColor, lineWidth, showLabels, labelColor, Path.GetDirectoryName(System.Windows.Forms.Application.ExecutablePath) + "\\" + iconFilePath, iconWidth, iconHeight, iconOpacity ); /*Layer Opacity added by Argon Helm*/ shapeFileLayer.Opacity = layerOpacity; shapeFileLayer.ParentList = newLayerSetList; // this goes after opacity because setting opacity "turns on" a renderable object if(World.Settings.UseDefaultLayerStates) { shapeFileLayer.IsOn = showAtStartup; } else { shapeFileLayer.IsOn = ConfigurationLoader.IsLayerOn(shapeFileLayer); } if(shapeFilePath.ToLower().EndsWith(".shp")) { shapeFileLayer.dbfPath=Path.ChangeExtension(shapeFilePath,".dbf"); shapeFileLayer.dbfIsInZip=false; } else if(shapeFilePath.ToLower().EndsWith(".zip")) { shapeFileLayer.dbfIsInZip=true; shapeFileLayer.dbfPath=shapeFilePath; } newLayerSetList.Add(shapeFileLayer); } } ParentApplication.WorldWindow.CurrentWorld.RenderableObjects.Add(newLayerSetList); } } }
public Form1() { InitializeComponent(); this.MetroColor = Color.White; this.BackColor = Color.White; this.mapsControl1 = new Maps(); this.mapsControl1.ShapeSelected += mapsControl1_ShapeSelected; this.mapsControl1.Dock = System.Windows.Forms.DockStyle.None; this.mapsControl1.Margin = new System.Windows.Forms.Padding(0, 0, 4, 0); this.mapsControl1.MapItemFont = null; this.mapsControl1.MapItemsShape = Syncfusion.Windows.Forms.Maps.MapItemShapes.Ellipse; this.mapsControl1.MapItemStroke = null; this.mapsControl1.Name = "mapsControl1"; this.mapsControl1.Size = new System.Drawing.Size(880, 585); this.mapsControl1.TabIndex = 0; this.mapsControl1.Text = "mapsControl1"; // // label1 // this.MetroColor = Color.White; this.mapsControl1.Dock = DockStyle.Fill; this.mapsControl1.Margin = new Padding(0, 0, 4, 0); this.mapsControl1.MapBackgroundBrush = new SolidBrush(Color.White); this.mapsControl1.MapItemsShape = Syncfusion.Windows.Forms.Maps.MapItemShapes.None; this.mapsControl1.MapItemStroke = new SolidBrush(Color.Black); this.mapsControl1.ShapeSelected += mapsControl1_ShapeSelected; MapViewModel viewmodel = new MapViewModel(); ShapeFileLayer shapeLayer = new ShapeFileLayer(); shapeLayer.ShapeSetting.FillSetting.AutoFillColors = false; shapeLayer.Uri = "world1.shp"; shapeLayer.ItemSource = viewmodel.CountriesList; shapeLayer.ShapeIDPath = "Country"; shapeLayer.EnableSelection = true; shapeLayer.SelectionMode = SelectionModes.Multiple; shapeLayer.ShapeIDTableField = "NAME"; shapeLayer.ShowMapItem = false; shapeLayer.ShapeSetting.ShapeValuePath = "Country"; shapeLayer.ShapeSetting.ShapeFill = "#E5E5E5"; shapeLayer.ShapeSetting.ShapeStrokeThickness = 0.5; shapeLayer.ShapeSetting.ShapeStroke = "#C1C1C1"; shapeLayer.ShapeSetting.SelectedShapeColor = "#34CBF4"; this.mapsControl1.Layers.Add(shapeLayer); #endregion layoutModeLabel.Text = "SelectedCountries"; // layoutModeLabel.Height = 40; layoutModeLabel.Width = 300; layoutModeLabel.Font = new System.Drawing.Font("Segoe UI", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); // layoutModeLabel.Dock = DockStyle.Top; userOptionsGroupBox.Controls.Add(layoutModeLabel); userOptionsGroupBox.Dock = DockStyle.Right; layoutModeLabel.Location = new Point(0, 50); // countryListBox.Dock= DockStyle.Bottom; countryListBox.Height = this.Height - 100; countryListBox.Location = new Point(0, 100); countryListBox.BorderStyle = BorderStyle.None; countryListBox.Font = new System.Drawing.Font("Segoe UI", 13F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); userOptionsGroupBox.Controls.Add(countryListBox); userOptionsGroupBox.Dock = DockStyle.Right; mapContainer.Name = "Population Growth FY2012"; mapPanel.Dock = DockStyle.Fill; // mapPanel.Height = 540; mapPanel.Controls.Add(mapsControl1); mapPanel.Controls.Add(userOptionsGroupBox); this.Controls.Add(mapPanel); }
public override Android.Views.View GetSampleContent (Android.Content.Context context) { Toast currentToast=new Toast(context); LinearLayout layout= new LinearLayout(context); layout.Orientation = Orientation.Vertical; TextView textView= new TextView(context); textView.TextSize = 20; textView.SetPadding(10,20,0,0); textView.SetHeight(70); textView.Text ="Top Population Countries"; layout.AddView(textView); textView.Gravity = Android.Views.GravityFlags.Top; SfMaps maps = new SfMaps (context); ShapeFileLayer layer = new ShapeFileLayer (); layer.Uri= "world1.shp"; layer.MarkerSelected += (object sender, ShapeFileLayer.MarkerSelectedEventArgs e) => { PopulationMarker marker= (PopulationMarker)e.P0; if(marker!=null) { if(currentToast!=null) { currentToast.Cancel(); } currentToast= Toast.MakeText(context,marker.Name +"\n"+ marker.Population,ToastLength.Short); currentToast.Show(); } }; PopulationMarker usa= new PopulationMarker(context); usa.Latitude =38.8833; usa.Longitude=-77.0167; usa.Name= "United States"; usa.Population ="321,174,000"; layer.Markers.Add(usa); PopulationMarker brazil= new PopulationMarker(context); brazil.Latitude=-15.7833; brazil.Longitude=-47.8667; brazil.Name = "Brazil"; brazil.Population= "204,436,000"; layer.Markers.Add(brazil); PopulationMarker india= new PopulationMarker(context); india.Latitude=21.0000; india.Longitude=78.0000; india.Name= "India"; india.Population ="1,272,470,000"; layer.Markers.Add(india); PopulationMarker china= new PopulationMarker(context); china.Latitude=35.0000; china.Longitude=103.0000; china.Name = "China"; china.Population = "1,370,320,000"; layer.Markers.Add(china); PopulationMarker indonesia= new PopulationMarker(context); indonesia.Latitude=-6.1750; indonesia.Longitude=106.8283; indonesia.Name="Indonesia"; indonesia.Population="255,461,700"; layer.Markers.Add(indonesia); maps.Layers.Add (layer); layout.AddView (maps); return layout; }