public override VectorElement BuildClusterElement(MapPos pos, VectorElementVector elements)
        {
            BalloonPopupStyle style = balloonPopupStyleBuilder.BuildStyle();
            var popup = new BalloonPopup(pos, style, elements.Count.ToString(), "");

            return(popup);
        }
        public override bool OnVectorTileClicked(VectorTileClickInfo clickInfo)
        {
            if (Previous != null)
            {
                source.Remove(Previous);
            }

            var feature    = clickInfo.Feature;
            var properties = feature.Properties;

            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       = 14;
            builder.TitleColor          = new Color(20, 20, 20, 255);
            builder.DescriptionFontSize = 9;
            builder.DescriptionColor    = new Color(100, 100, 100, 255);

            builder.LeftMargins  = new BalloonPopupMargins(6, 6, 6, 6);
            builder.LeftImage    = LeftImage;
            builder.RightMargins = new BalloonPopupMargins(2, 6, 12, 6);

            var animationBuilder = new AnimationStyleBuilder();

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

            BalloonPopupStyle style = builder.BuildStyle();

            string title       = properties.GetObjectElement("title").String;
            string description = properties.GetObjectElement("description").String;

            MapPos       position = clickInfo.Feature.Geometry.CenterPos;
            BalloonPopup popup    = new BalloonPopup(position, style, title, description);;

            source.Add(popup);
            Previous = popup;

            string url = properties.GetObjectElement("attachment_url").String;

            Click?.Invoke(url, EventArgs.Empty);

            return(true);
        }
コード例 #3
0
        public override void OnMapClicked(MapClickInfo mapClickInfo)
        {
            // Remove old click label
            if (oldClickLabel != null)
            {
                vectorDataSource.Remove(oldClickLabel);
                oldClickLabel = null;
            }

            BalloonPopupStyleBuilder styleBuilder = new BalloonPopupStyleBuilder();

            // Make sure this label is shown on top all other labels
            styleBuilder.PlacementPriority = 10;

            // Check the type of the click
            string clickMsg = null;

            if (mapClickInfo.ClickType == ClickType.ClickTypeSingle)
            {
                clickMsg = "Single map click!";
            }
            else if (mapClickInfo.ClickType == ClickType.ClickTypeLong)
            {
                clickMsg = "Long map click!";
            }
            else if (mapClickInfo.ClickType == ClickType.ClickTypeDouble)
            {
                clickMsg = "Double map click!";
            }
            else if (mapClickInfo.ClickType == ClickType.ClickTypeDual)
            {
                clickMsg = "Dual map click!";
            }

            MapPos clickPos = mapClickInfo.ClickPos;

            // Show click coordinates also
            MapPos wgs84Clickpos = mapView.Options.BaseProjection.ToWgs84(clickPos);
            //string message = string.Format("%.4f, %.4f", wgs84Clickpos.Y, wgs84Clickpos.X);
            string message = Math.Round(wgs84Clickpos.Y, 4) + ", " + Math.Round(wgs84Clickpos.X, 4);

            BalloonPopupStyle style = styleBuilder.BuildStyle();
            BalloonPopup      popup = new BalloonPopup(mapClickInfo.ClickPos, style, clickMsg, message);

            vectorDataSource.Add(popup);

            oldClickLabel = popup;
        }
コード例 #4
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;
            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);
        }