Example #1
0
    public override bool OnVectorElementClicked(VectorElementClickInfo clickInfo)
    {
        Action manipUI = () => {
            var zoomIn = activity.FindViewById <Button>(Resource.Id.zoomIn);
            zoomIn.Text = "+";
        }
        activity.RunOnUIThread(manipUI);

        return(true);
    }
        public override bool OnVectorElementClicked(VectorElementClickInfo clickInfo)
        {
            // A note about iOS: DISABLE 'Optimize PNG files for iOS' option in iOS build settings,
            // otherwise icons can not be loaded using AssetUtils/Bitmap constructor as Xamarin converts
            // PNGs to unsupported custom format.
            var bitmap = BitmapUtils.LoadBitmapFromAssets("Icon.png");

            var styleBuilder = new MarkerStyleBuilder();

            styleBuilder.Size   = 20;
            styleBuilder.Bitmap = bitmap;
            styleBuilder.Color  = new Carto.Graphics.Color(200, 0, 200, 200);
            var marker = new Marker(clickInfo.ClickPos, styleBuilder.BuildStyle());

            _dataSource.Add(marker);

            return(true);
        }
Example #3
0
        public override bool OnVectorElementClicked(VectorElementClickInfo clickInfo)
        {
            if (previous != null)
            {
                source.Remove(previous);
            }

            VectorElement element = clickInfo.VectorElement;

            BalloonPopupStyleBuilder builder = new BalloonPopupStyleBuilder();

            builder.LeftMargins       = new BalloonPopupMargins(0, 0, 0, 0);
            builder.RightMargins      = new BalloonPopupMargins(6, 3, 6, 3);
            builder.PlacementPriority = 10;

            BalloonPopupStyle style = builder.BuildStyle();

            string title       = element.GetMetaDataElement("ClickText").String;
            string description = "";

            for (int i = 0; i < element.MetaData.Count; i++)
            {
                string key = element.MetaData.Keys.ToList()[i];
                description += key + " = " + element.GetMetaDataElement(key) + "; ";
            }

            BalloonPopup popup;

            if (element is BalloonPopup)
            {
                Billboard billboard = (Billboard)element;
                popup = new BalloonPopup(billboard, style, title, description);
            }
            else
            {
                MapPos position = clickInfo.ClickPos;
                popup = new BalloonPopup(position, style, title, description);
            }

            source.Add(popup);
            previous = popup;

            return(true);
        }
        public override bool OnVectorElementClicked(VectorElementClickInfo clickInfo)
        {
            if (previous != null)
            {
                source.Remove(previous);
            }

            VectorElement element = clickInfo.VectorElement;

            BalloonPopupStyleBuilder builder = new BalloonPopupStyleBuilder();
            builder.LeftMargins = new BalloonPopupMargins(0, 0, 0, 0);
            builder.RightMargins = new BalloonPopupMargins(6, 3, 6, 3);
            builder.PlacementPriority = 10;

            BalloonPopupStyle style = builder.BuildStyle();

            string title = element.GetMetaDataElement("ClickText").String;
            string description = "";

            for (int i = 0; i < element.MetaData.Count; i++)
            {
                string key = element.MetaData.Keys.ToList()[i];
                description += key + " = " + element.GetMetaDataElement(key) + "; ";
            }

            BalloonPopup popup;

            if (element is BalloonPopup)
            {
                Billboard billboard = (Billboard)element;
                popup = new BalloonPopup(billboard, style, title, description);
            }
            else
            {
                MapPos position = clickInfo.ClickPos;
                popup = new BalloonPopup(position, style, title, description);
            }

            source.Add(popup);
            previous = popup;

            return true;
        }
 public override bool OnVectorElementClicked(VectorElementClickInfo clickInfo)
 {
     vectorLayer.SelectedVectorElement = clickInfo.VectorElement;
     return(true);
 }
 public override bool OnVectorElementClicked(VectorElementClickInfo clickInfo)
 {
     return(false);
 }
        public override bool OnVectorElementClicked(VectorElementClickInfo clickInfo)
        {
            if (previous != null)
            {
                source.Remove(previous);
            }

            VectorElement element = clickInfo.VectorElement;

            BalloonPopupStyleBuilder builder = new BalloonPopupStyleBuilder();

            builder.LeftMargins         = new BalloonPopupMargins(0, 0, 0, 0);
            builder.RightMargins        = new BalloonPopupMargins(6, 3, 6, 3);
            builder.PlacementPriority   = 10;
            builder.CornerRadius        = 5;
            builder.TitleFontSize       = 12;
            builder.DescriptionFontSize = 10;

            var navy = new Color(22, 41, 69, 255);

            builder.TitleColor       = navy;
            builder.DescriptionColor = navy;

            var animationBuilder = new AnimationStyleBuilder();

            animationBuilder.RelativeSpeed     = 2.0f;
            animationBuilder.SizeAnimationType = AnimationType.AnimationTypeSpring;
            builder.AnimationStyle             = animationBuilder.BuildStyle();

            BalloonPopupStyle style = builder.BuildStyle();

            string title       = element.GetMetaDataElement("ClickText").String;
            string description = "";

            if (!element.GetMetaDataElement(RouteSearchTitle).String.Equals(NullString))
            {
                // Route search has a special click text
                title       = element.GetMetaDataElement(RouteSearchTitle).String;
                description = element.GetMetaDataElement(RouteSearchDescription).String;
            }
            else
            {
                for (int i = 0; i < element.MetaData.Count; i++)
                {
                    string key = element.MetaData.Keys.ToList()[i];
                    description += key + " = " + element.GetMetaDataElement(key) + "; ";
                }
            }


            BalloonPopup popup;

            if (element is BalloonPopup)
            {
                Billboard billboard = (Billboard)element;
                popup = new BalloonPopup(billboard, style, title, description);
            }
            else
            {
                MapPos position = clickInfo.ClickPos;
                popup = new BalloonPopup(position, style, title, description);
            }

            source.Add(popup);
            previous = popup;

            return(true);
        }