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;
		}
        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);
        }
Ejemplo n.º 4
0
        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);
        }
Ejemplo n.º 5
0
        public DataMarkers()
        {
            maps = new SfMaps();
            ShapeFileLayer layer = new ShapeFileLayer();

            layer.Uri = "world1.shp";

            maps.Layers.Add(layer);
            Content = maps;
        }
Ejemplo n.º 6
0
		public DataMarkers ()
		{

			maps = new SfMaps ();
			ShapeFileLayer layer = new ShapeFileLayer ();
			layer.Uri ="world1.shp";

			maps.Layers.Add (layer);
			Content = maps;
		}
Ejemplo n.º 7
0
        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;
        }
Ejemplo n.º 9
0
        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);
        }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
        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);
        }
Ejemplo n.º 12
0
		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;
		}
Ejemplo n.º 13
0
        public MapPage()
        {
            InitializeComponent();

            this.map  = this.FindByName <SfMaps>("carte");
            viewModel = new ItemsViewModel();

            Device.StartTimer(TimeSpan.FromSeconds(30), () =>
            {
                var shouldTimerContinueWork = true;
                GetData();
                return(shouldTimerContinueWork);
            });

            GetData();
        }
Ejemplo n.º 14
0
        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;
        }
Ejemplo n.º 15
0
        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;
		}
Ejemplo n.º 17
0
        void AddGridView()
        {
            InitializeChildGrid();
            mainGrid = new FrameLayout(sampleContext);
            mainGrid.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                   ViewGroup.LayoutParams.MatchParent);
            mainGrid.AddView(childGrid);
            maps = new SfMaps(sampleContext);
            maps.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent);
            ImageryLayer layer = new ImageryLayer();

            maps.Layers.Add(layer);
            mainGrid.AddView(maps);
            mainGrid.SetClipChildren(false);
            LinearLayout linear = new LinearLayout(sampleContext);

            linear.Orientation      = Orientation.Horizontal;
            linear.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                 ViewGroup.LayoutParams.MatchParent);
            linear.SetHorizontalGravity(GravityFlags.End);
            linear.SetVerticalGravity(GravityFlags.Bottom);
            TextView textView1 = new TextView(sampleContext);

            textView1.Text = "©";
            textView1.SetBackgroundColor(Color.White);
            textView1.SetTextColor(Color.Black);
            textView1.SetPadding(2, 2, 2, 2);
            linear.AddView(textView1);
            TextView textView2 = new TextView(sampleContext);

            textView2.Text = "OpenStreetMap contributors.";
            textView2.SetTextColor(Color.DeepSkyBlue);
            textView2.SetPadding(0, 2, 3, 2);
            textView2.SetBackgroundColor(Color.White);
            textView2.Clickable = true;
            textView2.Click    += TextView2_Click;
            linear.AddView(textView2);
            mainGrid.AddView(linear);
        }
Ejemplo n.º 18
0
		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;
		}
Ejemplo n.º 19
0
        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();
        }
Ejemplo n.º 20
0
        public override Android.Views.View GetSampleContent(Android.Content.Context context)
        {
            handler     = new Handler();
            frameLayout = new FrameLayout(context);
            frameLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                      ViewGroup.LayoutParams.MatchParent);

            LinearLayout linearLayout = new LinearLayout(context);

            linearLayout.Orientation      = Orientation.Vertical;
            linearLayout.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent);

            sampleContext = context;

            LinearLayout layout = new LinearLayout(context);

            layout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                 ViewGroup.LayoutParams.MatchParent);
            layout.Orientation = Orientation.Horizontal;
            layout.SetHorizontalGravity(GravityFlags.Center);
            TextView textView = new TextView(context);

            textView.TextSize = 16;
            textView.SetPadding(2, 2, 2, 2);
            textView.SetHeight(90);
            textView.Gravity = Android.Views.GravityFlags.Top;
            textView.Text    = "Top 40 countries population";
            layout.AddView(textView);
            frameLayout.AddView(layout);

            maps = new SfMaps(context);
            maps.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent);

            ShapeFileLayer layer = new ShapeFileLayer();

            layer.ShowItems         = true;
            layer.Uri               = "world1.shp";
            layer.DataSource        = GetDataSource();
            layer.ShapeIdPath       = "Country";
            layer.ShowItems         = true;
            layer.ShapeIdTableField = "NAME";

            layer.ShapeSettings           = new ShapeSetting();
            layer.ShapeSettings.ShapeFill = Color.LightGray;

            BubbleMarkerSetting marker = new BubbleMarkerSetting();

            marker.ValuePath      = "Percent";
            marker.ColorValuePath = "Percent";

            RangeColorMapping rangeColorMapping = new RangeColorMapping();

            rangeColorMapping.Color       = Color.ParseColor("#2E769F");
            rangeColorMapping.From        = 4;
            rangeColorMapping.To          = 20;
            rangeColorMapping.LegendLabel = "Above 4%";
            marker.ColorMapping.Add(rangeColorMapping);

            RangeColorMapping rangeColorMapping1 = new RangeColorMapping();

            rangeColorMapping1.Color       = Color.ParseColor("#D84444");
            rangeColorMapping1.From        = 2;
            rangeColorMapping1.To          = 4;
            rangeColorMapping1.LegendLabel = "4% - 2%";
            marker.ColorMapping.Add(rangeColorMapping1);

            RangeColorMapping rangeColorMapping2 = new RangeColorMapping();

            rangeColorMapping2.Color       = Color.ParseColor("#816F28");
            rangeColorMapping2.From        = 1;
            rangeColorMapping2.To          = 2;
            rangeColorMapping2.LegendLabel = "2% - 1%";
            marker.ColorMapping.Add(rangeColorMapping2);

            RangeColorMapping rangeColorMapping3 = new RangeColorMapping();

            rangeColorMapping3.Color       = Color.ParseColor("#7F38A0");
            rangeColorMapping3.From        = 0;
            rangeColorMapping3.To          = 1;
            rangeColorMapping3.LegendLabel = "Below 1%";
            marker.ColorMapping.Add(rangeColorMapping3);

            layer.BubbleMarkerSetting = marker;

            LegendSetting legendSetting = new LegendSetting();

            legendSetting.ShowLegend     = true;
            legendSetting.LegendType     = LegendType.Bubbles;
            legendSetting.LegendPosition = new Point(50, 10);
            legendSetting.ItemMargin     = 15;
            layer.LegendSetting          = legendSetting;

            maps.Layers.Add(layer);
            frameLayout.AddView(maps);

            frameLayout.SetClipChildren(false);

            LinearLayout linear = new LinearLayout(context);

            linear.Orientation      = Orientation.Horizontal;
            linear.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                 ViewGroup.LayoutParams.MatchParent);
            linear.SetHorizontalGravity(GravityFlags.End);
            linear.SetVerticalGravity(GravityFlags.Bottom);
            TextView textView1 = new TextView(context);

            textView1.Text = "Source:";
            textView1.SetBackgroundColor(Color.White);
            textView1.SetTextColor(Color.Black);
            textView1.SetPadding(2, 2, 2, 2);
            linear.AddView(textView1);
            TextView textView2 = new TextView(context);

            textView2.Text = "en.wikipedia.org";
            textView2.SetTextColor(Color.DeepSkyBlue);
            textView2.SetPadding(0, 2, 3, 2);
            textView2.SetBackgroundColor(Color.White);
            textView2.Clickable = true;
            textView2.Click    += TextView2_Click;
            linear.AddView(textView2);
            frameLayout.AddView(linear);

            SfBusyIndicator sfBusyIndicator = new SfBusyIndicator(context);

            sfBusyIndicator.IsBusy        = true;
            sfBusyIndicator.AnimationType = AnimationTypes.SlicedCircle;
            sfBusyIndicator.ViewBoxWidth  = 50;
            sfBusyIndicator.ViewBoxHeight = 50;
            sfBusyIndicator.TextColor     = Color.ParseColor("#779772");
            linearLayout.AddView(sfBusyIndicator);
            Java.Lang.Runnable run = new Java.Lang.Runnable(() =>
            {
                linearLayout.RemoveView(sfBusyIndicator);
                linearLayout.AddView(frameLayout);
            });
            handler.PostDelayed(run, 100);

            return(linearLayout);
        }
Ejemplo n.º 21
0
        void AddGridView()
        {
            InitializeChildGrid();
            mainGrid = new FrameLayout(sampleContext);
            mainGrid.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                   ViewGroup.LayoutParams.MatchParent);
            mainGrid.AddView(childGrid);
            maps                  = new SfMaps(sampleContext);
            maps.ZoomLevel        = 4;
            maps.MinZoom          = 4;
            maps.MaxZoom          = 10;
            maps.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent);
            layer                 = new ImageryLayer();

            layer.GeoCoordinates = new PointF(27.1751f, 78.0421f);

            PopulationMarker marker1 = new PopulationMarker(sampleContext);

            marker1.Latitude  = 20.6843f;
            marker1.Longitude = -88.5678f;
            layer.Markers.Add(marker1);

            PopulationMarker marker2 = new PopulationMarker(sampleContext);

            marker2.Latitude  = -13.1631f;
            marker2.Longitude = -72.5450f;
            layer.Markers.Add(marker2);

            PopulationMarker marker3 = new PopulationMarker(sampleContext);

            marker3.Latitude  = -22.9519f;
            marker3.Longitude = -43.2106f;
            layer.Markers.Add(marker3);

            PopulationMarker marker4 = new PopulationMarker(sampleContext);

            marker4.Latitude  = 41.8902;
            marker4.Longitude = 12.4922;
            layer.Markers.Add(marker4);

            PopulationMarker marker5 = new PopulationMarker(sampleContext);

            marker5.Latitude  = 30.3285;
            marker5.Longitude = 35.4444;
            layer.Markers.Add(marker5);

            PopulationMarker marker6 = new PopulationMarker(sampleContext);

            marker6.Latitude  = 27.1751;
            marker6.Longitude = 78.0421;
            layer.Markers.Add(marker6);

            PopulationMarker marker7 = new PopulationMarker(sampleContext);

            marker7.Latitude  = 40.4319;
            marker7.Longitude = 116.5704;
            layer.Markers.Add(marker7);

            maps.Adapter = new MarkerAdapter(sampleContext);

            maps.Layers.Add(layer);
            mainGrid.AddView(maps);
            mainGrid.SetClipChildren(false);

            List <int> arrayList = new List <int>();

            arrayList.Add(Resource.Drawable.Mexico);
            arrayList.Add(Resource.Drawable.Peru);
            arrayList.Add(Resource.Drawable.Christ);
            arrayList.Add(Resource.Drawable.Colosseum);
            arrayList.Add(Resource.Drawable.Petra);
            arrayList.Add(Resource.Drawable.TajMahal);
            arrayList.Add(Resource.Drawable.China_wall);

            List <string> descriptionList = new List <string>();

            descriptionList.Add("Mayan ruins on Mexico's Yucatan Peninsula. It was one of the largest Maya cities, thriving from around A.D. 600 to 1200.");
            descriptionList.Add("An inca citadel built in the mid-1400s. It was not widely known until the early 20th century.");
            descriptionList.Add("An enormous statue of Jesus Christ with open arms. A symbol of Christianity across the world, the statue has also become a cultural icon of both Rio de Janeiro and Brazil.");
            descriptionList.Add("Built between A.D. 70 and 80. It is one of the most popular touristattractions in Europe.");
            descriptionList.Add("It is a historic and archaeological city in southern Jordan. Petra lies around Jabal Al-Madbah in a basin surrounded by mountains which form the eastern flank of the Arabah valley that runs from the Dead Sea to the Gulf of Aqaba.");
            descriptionList.Add("It is an ivory-white marble mausoleum on the southern bank of the river Yamuna in the Indian city of Agra.");
            descriptionList.Add("The Great Wall of China is a series of fortifications that were built across the historical northern borders of ancient Chinese states and Imperial China as protection against various nomadic groups from the Eurasian Steppe.");

            List <string> headerList = new List <string>();

            headerList.Add("Chichen Itza, Mexico");
            headerList.Add("Machu Picchu, Peru");
            headerList.Add("Chirst the Redeemer, Brazil");
            headerList.Add("Colosseum, Rome");
            headerList.Add("Petra, Jordan");
            headerList.Add("Taj Mahal, India");
            headerList.Add("Great wall of China, China");

            DisplayMetrics displayMetrics = sampleContext.Resources.DisplayMetrics;
            float          screenWidth    = displayMetrics.WidthPixels;
            float          screenHeight   = displayMetrics.HeightPixels;
            var            density        = displayMetrics.Density;

            LinearLayout layout = new LinearLayout(sampleContext);

            layout.Orientation = Orientation.Horizontal;
            layout.SetPadding(0, 0, 0, 10);
            layout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);
            layout.SetVerticalGravity(GravityFlags.Bottom);

            var itemWidth = screenWidth * 0.7;

            SfCarousel carousel = new SfCarousel(sampleContext);

            carousel.RotationAngle      = 0;
            carousel.ItemWidth          = (int)itemWidth;
            carousel.ItemHeight         = (int)(110 * sampleContext.Resources.DisplayMetrics.Density);
            carousel.LayoutParameters   = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, carousel.ItemHeight);
            carousel.SelectedIndex      = 5;
            carousel.SelectedItemOffset = (int)(carousel.ItemWidth / 2) - (int)(carouselGap * density);

            List <SfCarouselItem> dataSource = new List <SfCarouselItem>();

            for (int i = 0; i <= 6; i++)
            {
                LinearLayout linearLayout = new LinearLayout(sampleContext);
                linearLayout.SetBackgroundColor(Color.White);
                linearLayout.Orientation = Orientation.Horizontal;
                linearLayout.SetBackgroundResource((Resource.Drawable.carousel_corner_radius));
                linearLayout.LayoutParameters = new Android.Views.ViewGroup.LayoutParams((int)itemWidth, (int)carousel.ItemHeight);

                var width = (int)(0.6f * itemWidth);

                LinearLayout layout1 = new LinearLayout(sampleContext);
                layout1.Orientation      = Orientation.Vertical;
                layout1.LayoutParameters = new Android.Views.ViewGroup.LayoutParams((int)width, (int)carousel.ItemHeight);
                layout1.SetPadding(15, 15, 15, 15);

                TextView textView = new TextView(sampleContext);
                textView.Text = headerList[i];

                textView.SetTypeface(Typeface.Default, TypefaceStyle.Bold);
                textView.TextAlignment    = TextAlignment.TextStart;
                textView.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(width - 30, ViewGroup.LayoutParams.WrapContent);
                layout1.AddView(textView);

                textView      = new TextView(sampleContext);
                textView.Text = descriptionList[i];
                textView.SetMaxLines(3);
                textView.Ellipsize     = Android.Text.TextUtils.TruncateAt.End;
                textView.TextAlignment = TextAlignment.TextStart;
                textView.SetPadding(0, 10, 0, 0);
                textView.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(width - 30, ViewGroup.LayoutParams.WrapContent);
                layout1.AddView(textView);
                linearLayout.AddView(layout1);

                SfCarouselItem sfCarouselItem = new SfCarouselItem(sampleContext);

                width = (int)(0.4f * itemWidth);

                LinearLayout layout2 = new LinearLayout(sampleContext);
                layout2.SetPadding(10, 15, 15, 15);

                layout2.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(width, carousel.ItemHeight);
                ImageView imageView = new ImageView(sampleContext);
                imageView.SetBackgroundResource((Resource.Drawable.carousel_corner_radius));

                imageView.SetImageResource(arrayList[i]);
                imageView.SetScaleType(ImageView.ScaleType.FitXy);
                imageView.ClipToOutline = true;

                layout2.AddView(imageView);

                linearLayout.AddView(layout2);
                sfCarouselItem.ContentView = linearLayout;
                dataSource.Add(sfCarouselItem);
            }

            carousel.DataSource        = dataSource;
            carousel.SelectionChanged += Carousel_SelectionChanged;
            layout.AddView(carousel);
            mainGrid.AddView(layout);

            LinearLayout linear = new LinearLayout(sampleContext);

            linear.Orientation      = Orientation.Horizontal;
            linear.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                 ViewGroup.LayoutParams.MatchParent);
            linear.SetHorizontalGravity(GravityFlags.End);
            linear.SetVerticalGravity(GravityFlags.Bottom);
            TextView textView1 = new TextView(sampleContext);

            textView1.Text = "©";
            textView1.SetBackgroundColor(Color.White);
            textView1.SetTextColor(Color.Black);
            textView1.SetPadding(2, 2, 2, 2);
            linear.AddView(textView1);
            TextView textView2 = new TextView(sampleContext);

            textView2.Text = "OpenStreetMap contributors.";
            textView2.SetTextColor(Color.DeepSkyBlue);
            textView2.SetPadding(0, 2, 3, 2);
            textView2.SetBackgroundColor(Color.White);
            textView2.Clickable = true;
            textView2.Click    += TextView2_Click;
            linear.AddView(textView2);
            mainGrid.AddView(linear);
        }
Ejemplo n.º 22
0
        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);
        }
Ejemplo n.º 23
0
        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 = "Samsung Semiconductor office location in USA";
            layout.AddView(textView);
            textView.Gravity = Android.Views.GravityFlags.Top;
            maps             = new SfMaps(context);
            ShapeFileLayer layer = new ShapeFileLayer();

            layer.ShowItems         = true;
            layer.Uri               = "usa_state.shp";
            layer.DataSource        = GetDataSource();
            layer.ShapeIdPath       = "Name";
            layer.ShapeIdTableField = "STATE_NAME";
            layer.DataLabelSettings = new DataLabelSetting()
            {
                TextColor = Color.Black
            };
            layer.ShapeSettings = new ShapeSetting();
            layer.ShapeSettings.ShapeValuePath      = "Type";
            layer.ShapeSettings.ShapeFill           = Color.ParseColor("#E5E5E5");
            layer.ShapeSettings.ShapeStroke         = Color.ParseColor("#D0D0D0");
            layer.ShapeSettings.ShapeStrokeThickess = 2;

            layer.DataLabelSettings.IntersectionAction = IntersectAction.Trim;

            SubShapeFileLayer subLayer = new SubShapeFileLayer();

            subLayer.Uri = "Texas.shp";
            subLayer.ShapeSettings.ShapeFill           = Color.ParseColor("#B1D8F5");
            subLayer.ShapeSettings.ShapeStroke         = Color.ParseColor("#8DCCF4");
            subLayer.ShapeSettings.ShapeStrokeThickess = 1;

            MapMarker mapMarker = new MapMarker();

            mapMarker.Latitude  = 30.267153;
            mapMarker.Longitude = -97.7430608;
            subLayer.Markers.Add(mapMarker);

            MarkerSetting markerSetting = new MarkerSetting();

            markerSetting.MarkerIconColor = Color.DarkGreen;
            markerSetting.IconSize        = 7;
            subLayer.MarkerSetting        = markerSetting;

            SubShapeFileLayer subLayer1 = new SubShapeFileLayer();

            subLayer1.Uri = "California.shp";
            subLayer1.ShapeSettings.ShapeFill           = Color.ParseColor("#B1D8F5");
            subLayer1.ShapeSettings.ShapeStroke         = Color.ParseColor("#8DCCF4");
            subLayer1.ShapeSettings.ShapeStrokeThickess = 1;

            MapMarker mapMarker1 = new MapMarker();

            mapMarker1.Latitude  = 37.3382082;
            mapMarker1.Longitude = -121.8863286;
            subLayer1.Markers.Add(mapMarker1);

            MarkerSetting markerSetting1 = new MarkerSetting();

            markerSetting1.MarkerIconColor = Color.DarkGreen;
            markerSetting1.IconSize        = 7;
            subLayer1.MarkerSetting        = markerSetting1;

            layer.SubShapeFileLayers.Add(subLayer);
            layer.SubShapeFileLayers.Add(subLayer1);

            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);
        }
Ejemplo n.º 24
0
        public override Android.Views.View GetSampleContent(Android.Content.Context context)
        {
            currentToast  = new Toast(context);
            sampleContext = 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(90);
            handler       = new Handler();
            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";
            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);
            layer.MarkerSelected += Layer_MarkerSelected;

            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);

            return(layout);
        }
        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 40 countries population";
            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.ShowItems         = true;
            layer.ShapeIdTableField = "NAME";

            layer.ShapeSettings           = new ShapeSetting();
            layer.ShapeSettings.ShapeFill = Color.LightGray;

            BubbleMarkerSetting marker = new BubbleMarkerSetting();

            marker.ValuePath      = "Population";
            marker.ColorValuePath = "Population";

            BubbleCustomTooltipSetting tooltipSetting = new BubbleCustomTooltipSetting(context);

            tooltipSetting.ShowTooltip = true;
            tooltipSetting.ValuePath   = "Country";
            marker.TooltipSettings     = tooltipSetting;

            RangeColorMapping rangeColorMapping = new RangeColorMapping();

            rangeColorMapping.Color       = Color.ParseColor("#2E769F");
            rangeColorMapping.To          = 1400000000;
            rangeColorMapping.From        = 325000000;
            rangeColorMapping.LegendLabel = "Above 4%";
            marker.ColorMapping.Add(rangeColorMapping);

            RangeColorMapping rangeColorMapping1 = new RangeColorMapping();

            rangeColorMapping1.Color       = Color.ParseColor("#D84444");
            rangeColorMapping1.To          = 325000000;
            rangeColorMapping1.From        = 180000000;
            rangeColorMapping1.LegendLabel = "4% - 2%";
            marker.ColorMapping.Add(rangeColorMapping1);

            RangeColorMapping rangeColorMapping2 = new RangeColorMapping();

            rangeColorMapping2.Color       = Color.ParseColor("#816F28");
            rangeColorMapping2.To          = 180000000;
            rangeColorMapping2.From        = 100000000;
            rangeColorMapping2.LegendLabel = "2% - 1%";
            marker.ColorMapping.Add(rangeColorMapping2);

            RangeColorMapping rangeColorMapping3 = new RangeColorMapping();

            rangeColorMapping3.Color       = Color.ParseColor("#7F38A0");
            rangeColorMapping3.To          = 100000000;
            rangeColorMapping3.From        = 5000000;
            rangeColorMapping3.LegendLabel = "Below 1%";
            marker.ColorMapping.Add(rangeColorMapping3);

            layer.BubbleMarkerSetting = marker;

            LegendSetting legendSetting = new LegendSetting();

            legendSetting.ShowLegend          = true;
            legendSetting.LegendType          = LegendType.Bubbles;
            legendSetting.IconHeight          = 15;
            legendSetting.IconWidth           = 15;
            legendSetting.LegendPosition      = new Point(50, 5);
            legendSetting.HorizontalAlignment = HorizontalAlignment.Center;
            layer.LegendSetting = legendSetting;

            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);
        }
Ejemplo n.º 26
0
        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);
        }
Ejemplo n.º 27
0
        public override Android.Views.View GetSampleContent(Android.Content.Context context)
        {
            handler = new Handler();

            frameLayout = new FrameLayout(context);
            frameLayout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                      ViewGroup.LayoutParams.MatchParent);

            LinearLayout linearLayout = new LinearLayout(context);

            linearLayout.Orientation      = Orientation.Vertical;
            linearLayout.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent);

            sampleContext = context;

            LinearLayout layout = new LinearLayout(context);

            layout.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                 ViewGroup.LayoutParams.MatchParent);
            layout.Orientation = Orientation.Horizontal;
            layout.SetHorizontalGravity(GravityFlags.Center);

            TextView textView = new TextView(context);

            textView.TextSize = 16;
            textView.SetPadding(2, 2, 2, 2);
            textView.SetHeight(90);
            textView.Gravity = Android.Views.GravityFlags.Top;
            textView.Text    = "Samsung Semiconductor office location in USA";
            layout.AddView(textView);
            frameLayout.AddView(layout);

            maps = new SfMaps(context);
            maps.LayoutParameters = new Android.Views.ViewGroup.LayoutParams(Android.Views.ViewGroup.LayoutParams.MatchParent, Android.Views.ViewGroup.LayoutParams.MatchParent);

            ShapeFileLayer layer = new ShapeFileLayer();

            layer.ShowItems         = true;
            layer.Uri               = "usa_state.shp";
            layer.DataSource        = GetDataSource();
            layer.ShapeIdPath       = "Name";
            layer.ShapeIdTableField = "STATE_NAME";
            layer.DataLabelSettings = new DataLabelSetting()
            {
                TextColor = Color.Black
            };
            layer.ShapeSettings = new ShapeSetting();
            layer.ShapeSettings.ShapeValuePath      = "Type";
            layer.ShapeSettings.ShapeFill           = Color.ParseColor("#E5E5E5");
            layer.ShapeSettings.ShapeStroke         = Color.ParseColor("#D0D0D0");
            layer.ShapeSettings.ShapeStrokeThickess = 2;

            layer.DataLabelSettings.IntersectionAction = IntersectAction.Trim;

            SubShapeFileLayer subLayer = new SubShapeFileLayer();

            subLayer.Uri = "Texas.shp";
            subLayer.ShapeSettings.ShapeFill           = Color.ParseColor("#B1D8F5");
            subLayer.ShapeSettings.ShapeStroke         = Color.ParseColor("#8DCCF4");
            subLayer.ShapeSettings.ShapeStrokeThickess = 1;

            MapMarker mapMarker = new MapMarker();

            mapMarker.Latitude  = 30.267153;
            mapMarker.Longitude = -97.7430608;
            subLayer.Markers.Add(mapMarker);

            MarkerSetting markerSetting = new MarkerSetting();

            markerSetting.MarkerIconColor = Color.DarkGreen;
            markerSetting.IconSize        = 7;
            subLayer.MarkerSetting        = markerSetting;

            SubShapeFileLayer subLayer1 = new SubShapeFileLayer();

            subLayer1.Uri = "California.shp";
            subLayer1.ShapeSettings.ShapeFill           = Color.ParseColor("#B1D8F5");
            subLayer1.ShapeSettings.ShapeStroke         = Color.ParseColor("#8DCCF4");
            subLayer1.ShapeSettings.ShapeStrokeThickess = 1;

            MapMarker mapMarker1 = new MapMarker();

            mapMarker1.Latitude  = 37.3382082;
            mapMarker1.Longitude = -121.8863286;
            subLayer1.Markers.Add(mapMarker1);

            MarkerSetting markerSetting1 = new MarkerSetting();

            markerSetting1.MarkerIconColor = Color.DarkGreen;
            markerSetting1.IconSize        = 7;
            subLayer1.MarkerSetting        = markerSetting1;

            layer.SubShapeFileLayers.Add(subLayer);
            layer.SubShapeFileLayers.Add(subLayer1);

            maps.Layers.Add(layer);
            frameLayout.AddView(maps);
            frameLayout.SetClipChildren(false);

            LinearLayout linear = new LinearLayout(context);

            linear.Orientation      = Orientation.Horizontal;
            linear.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                                                                 ViewGroup.LayoutParams.MatchParent);
            linear.SetHorizontalGravity(GravityFlags.End);
            linear.SetVerticalGravity(GravityFlags.Bottom);
            TextView textView1 = new TextView(context);

            textView1.Text = "Source:";
            textView1.SetBackgroundColor(Color.White);
            textView1.SetTextColor(Color.Black);
            textView1.SetPadding(2, 2, 2, 2);
            linear.AddView(textView1);
            TextView textView2 = new TextView(context);

            textView2.Text = "www.samsung.com";
            textView2.SetTextColor(Color.DeepSkyBlue);
            textView2.SetPadding(0, 2, 3, 2);
            textView2.SetBackgroundColor(Color.White);
            textView2.Clickable = true;
            textView2.Click    += TextView2_Click;
            linear.AddView(textView2);
            frameLayout.AddView(linear);

            SfBusyIndicator sfBusyIndicator = new SfBusyIndicator(context);

            sfBusyIndicator.IsBusy        = true;
            sfBusyIndicator.AnimationType = AnimationTypes.SlicedCircle;
            sfBusyIndicator.ViewBoxWidth  = 50;
            sfBusyIndicator.ViewBoxHeight = 50;
            sfBusyIndicator.TextColor     = Color.ParseColor("#779772");
            linearLayout.AddView(sfBusyIndicator);
            Java.Lang.Runnable run = new Java.Lang.Runnable(() =>
            {
                linearLayout.RemoveView(sfBusyIndicator);
                linearLayout.AddView(frameLayout);
            });
            handler.PostDelayed(run, 100);

            return(linearLayout);
        }
Ejemplo n.º 28
0
        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);
        }
Ejemplo n.º 29
0
		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;
		}