예제 #1
0
        private void Layer_MarkerSelected(object sender, MarkerSelectedEventArgs e)
        {
            PopulationMarker marker = (PopulationMarker)e.P0;

            if (marker != null)
            {
                if (currentToast != null)
                {
                    currentToast.Cancel();
                }
                currentToast = Toast.MakeText(sampleContext, marker.Name + "\n" + marker.Population, ToastLength.Short);
                currentToast.Show();
            }
        }
예제 #2
0
        public DataMarkers()
        {
            view          = new UIView();
            busyindicator = new SfBusyIndicator();
            busyindicator.ViewBoxWidth  = 75;
            busyindicator.ViewBoxHeight = 75;
            busyindicator.Foreground    = UIColor.FromRGB(0x77, 0x97, 0x72);            /*#779772*/
            busyindicator.AnimationType = SFBusyIndicatorAnimationType.SFBusyIndicatorAnimationTypeSlicedCircle;
            view.AddSubview(busyindicator);

            NSTimer.CreateScheduledTimer(TimeSpan.FromSeconds(0.3), delegate {
                if (isDisposed)
                {
                    return;
                }
                maps.Frame = new CGRect(Frame.Location.X, 60, Frame.Size.Width - 6, Frame.Size.Height - 60);

                view.AddSubview(maps);
            });
            view.Frame          = new CGRect(0, 0, 300, 400);
            markerView          = new UIView();
            label               = new UILabel();
            label.TextAlignment = UITextAlignment.Center;
            label.Text          = "Top Population Countries";
            label.Font          = UIFont.SystemFontOfSize(18);
            label.Frame         = new  CGRect(0, 0, 300, 40);
            label.TextColor     = UIColor.Black;
            view.AddSubview(label);

            maps = new SFMap();

            SFShapeFileLayer layer = new SFShapeFileLayer();

            layer.Uri = (NSString)NSBundle.MainBundle.PathForResource("world1", "shp");
            PopulationMarker usa = new PopulationMarker();

            usa.Latitude   = 38.8833;
            usa.Name       = "United States";
            usa.Longitude  = -77.0167;
            usa.Population = "321,174,000";
            layer.Markers.Add(usa);


            PopulationMarker brazil = new PopulationMarker();

            brazil.Latitude   = -15.7833;
            brazil.Longitude  = -47.8667;
            brazil.Name       = "Brazil";
            brazil.Population = "204,436,000";
            layer.Markers.Add(brazil);


            PopulationMarker india = new PopulationMarker();

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

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

            indonesia.Latitude   = -6.1750;
            indonesia.Longitude  = 106.8283;
            indonesia.Name       = "Indonesia";
            indonesia.Population = "255,461,700";
            layer.Markers.Add(indonesia);
            maps.Delegate = new MapsDelegate(this);

            maps.Layers.Add(layer);

            AddSubview(view);
        }
예제 #3
0
        public override void OnMarkerSelected(SFMap map, MarkerSelectedEventArgs markerSelectedEventArgs)
        {
            PopulationMarker Populationmarker = (PopulationMarker)markerSelectedEventArgs.SelectedMarker;

            mar.displayToastWithMessage((NSString)(Populationmarker.Name + "\n"), (NSString)Populationmarker.Population);
        }
예제 #4
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);
        }
예제 #5
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);
        }
예제 #6
0
		public DataMarkers () 
		{

			view = new UIView ();
			busyindicator = new SFBusyIndicator ();
			busyindicator.ViewBoxWidth=75;
			busyindicator.ViewBoxHeight=75;
			busyindicator.Foreground=  UIColor.FromRGB (0x77, 0x97, 0x72);  /*#779772*/
			busyindicator.AnimationType=SFBusyIndicatorAnimationType.SFBusyIndicatorAnimationTypeSlicedCircle;
			view.AddSubview (busyindicator);

			NSTimer.CreateScheduledTimer (TimeSpan.FromSeconds (0.3), delegate {
				maps.Frame = new CGRect(Frame.Location.X,60,Frame.Size.Width-6,Frame.Size.Height-60);

				view.AddSubview (maps);
			});
			view.Frame=new CGRect(0,0,300,400);
			markerView = new UIView ();
			label = new UILabel ();
			label.TextAlignment = UITextAlignment.Center;
			label.Text = "Top Population Countries";
			label.Font = UIFont.SystemFontOfSize (18);
			label.Frame=new  CGRect(0,0,300,40);
			label.TextColor = UIColor.Black;
			view.AddSubview (label);

			maps =new SFMap ();

			SFShapeFileLayer layer = new SFShapeFileLayer ();
			layer.Uri = (NSString)NSBundle.MainBundle.PathForResource ("world1", "shp");
			PopulationMarker usa= new PopulationMarker();
			usa.Latitude =38.8833;
			usa.Name ="United States";
			usa.Longitude=-77.0167;
			usa.Population ="321,174,000";
			layer.Markers = new NSMutableArray ();
			layer.Markers.Add(usa);


			PopulationMarker brazil= new PopulationMarker();
			brazil.Latitude=-15.7833;
			brazil.Longitude=-47.8667;
			brazil.Name ="Brazil";
			brazil.Population= "204,436,000";
			layer.Markers.Add(brazil);


			PopulationMarker india= new PopulationMarker();
			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();
			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();
			indonesia.Latitude=-6.1750;
			indonesia.Longitude=106.8283;
			indonesia.Name ="Indonesia";
			indonesia.Population="255,461,700";
			layer.Markers.Add(indonesia);
			maps.Delegate = new MapsDelegate (this);

			maps.Layers.Add (layer);

			AddSubview (view);
			control = this;


		}
예제 #7
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);
        }
예제 #8
0
        public override void DidSelectMarker(SFMap map, SFMapMarker marker)
        {
            PopulationMarker Populationmarker = (PopulationMarker)marker;

            mar.displayToastWithMessage((NSString)(Populationmarker.Name + "\n"), (NSString)Populationmarker.Population);
        }
예제 #9
0
        public DataMarkers()
        {
            view = new UIView();

            view.Frame          = new CGRect(0, 0, 300, 400);
            markerView          = new UIView();
            label               = new UILabel();
            label.TextAlignment = UITextAlignment.Center;
            label.Text          = "Top Population Countries";
            label.Font          = UIFont.SystemFontOfSize(18);
            label.Frame         = new  CGRect(0, 0, 300, 40);
            label.TextColor     = UIColor.Black;
            view.AddSubview(label);

            maps = new SFMap();

            SFShapeFileLayer layer = new SFShapeFileLayer();

            layer.Uri = (NSString)NSBundle.MainBundle.PathForResource("world1", "shp");
            PopulationMarker usa = new PopulationMarker();

            usa.Latitude   = 38.8833;
            usa.Name       = "United States";
            usa.Longitude  = -77.0167;
            usa.Population = "321,174,000";
            layer.Markers.Add(usa);


            PopulationMarker brazil = new PopulationMarker();

            brazil.Latitude   = -15.7833;
            brazil.Longitude  = -47.8667;
            brazil.Name       = "Brazil";
            brazil.Population = "204,436,000";
            layer.Markers.Add(brazil);


            PopulationMarker india = new PopulationMarker();

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

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

            indonesia.Latitude   = -6.1750;
            indonesia.Longitude  = 106.8283;
            indonesia.Name       = "Indonesia";
            indonesia.Population = "255,461,700";
            layer.Markers.Add(indonesia);
            maps.Delegate = new MapsDelegate(this);

            maps.Layers.Add(layer);

            AddSubview(view);
        }
예제 #10
0
        void AddMainView()
        {
            if (childGrid == null)
            {
                childGrid = new UIView();
            }
            mainGrid = new UIView();
            mainGrid.BackgroundColor = UIColor.FromRGB(243, 239, 233);
            mainGrid.AddSubview(childGrid);
            maps                 = new SFMap();
            maps.ZoomLevel       = 4;
            maps.MinimumZoom     = 4;
            maps.MaximumZoom     = 10;
            layer                = new ImageryLayer();
            layer.GeoCoordinates = new CGPoint(27.1751, 78.0421);

            PopulationMarker marker1 = new PopulationMarker();

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

            PopulationMarker marker2 = new PopulationMarker();

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

            PopulationMarker marker3 = new PopulationMarker();

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

            PopulationMarker marker4 = new PopulationMarker();

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

            PopulationMarker marker5 = new PopulationMarker();

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

            PopulationMarker marker6 = new PopulationMarker();

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

            PopulationMarker marker7 = new PopulationMarker();

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

            maps.Layers.Add(layer);
            maps.Delegate = new OSMDelegate(this);
            mainGrid.AddSubview(maps);

            carousel = new SfCarousel();
            carousel.RotationAngle     = 0;
            carousel.SelectedIndex     = 5;
            carousel.SelectionChanged += Carousel_SelectionChanged;

            mainGrid.AddSubview(carousel);

            label1               = new UILabel();
            label1.TextColor     = UIColor.Black;
            label1.LayoutMargins = new UIEdgeInsets(2, 2, 3, 2);
            label1.Font          = UIFont.FromName("Helvetica", 12);
            var text           = new NSString("©");
            var stringAtribute = new NSDictionary(UIStringAttributeKey.Font, label1.Font,
                                                  UIStringAttributeKey.ForegroundColor, UIColor.Black);
            UIStringAttributes strAtr = new UIStringAttributes(stringAtribute);

            label1.Text            = text;
            label1Size             = text.GetSizeUsingAttributes(strAtr);
            label1.BackgroundColor = UIColor.White;
            mainGrid.AddSubview(label1);
            label2               = new UILabel();
            label2.TextColor     = UIColor.FromRGB(0, 212, 255);
            label2.LayoutMargins = new UIEdgeInsets(1, 2, 3, 2);
            label2.Font          = UIFont.FromName("Helvetica", 12);
            var text1           = new NSString("OpenStreetMap contributors.");
            var stringAtribute1 = new NSDictionary(UIStringAttributeKey.Font, label2.Font,
                                                   UIStringAttributeKey.ForegroundColor, UIColor.FromRGB(0, 212, 255));
            UIStringAttributes strAtr1 = new UIStringAttributes(stringAtribute);

            label2.Text                   = text1;
            label2Size                    = text1.GetSizeUsingAttributes(strAtr1);
            label2.BackgroundColor        = UIColor.White;
            label2.UserInteractionEnabled = true;
            UITapGestureRecognizer tapGesture = new UITapGestureRecognizer();

            tapGesture.ShouldReceiveTouch += TapGesture_ShouldReceiveTouch;
            label2.AddGestureRecognizer(tapGesture);
            mainGrid.AddSubview(label2);
        }
예제 #11
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;
		}