csDataServerPlugin.PoiGraphic.AddMediaToFloatingElements C# (CSharp) Метод

AddMediaToFloatingElements() приватный Метод

Add a media element (photo) to the floating elements collection. Based on the current tap position, find a suitable location for the photo's. In addition, in case multiple photo's need to be added, offset them a bit so they don't overlap and cover each other. Also make sure that you don't add a photo twice (based on the floating element's title).
private AddMediaToFloatingElements ( MapPoint tapPos ) : void
tapPos MapPoint Tap or click position on the map in map coordinates.
Результат void
        private void AddMediaToFloatingElements(MapPoint tapPos)
        {
            if (Poi.AllMedia == null) return;
            Vector offset;
            var startPosition = ComputeStartPositionAndOffset(tapPos, out offset);
            foreach (var m in Poi.AllMedia)
            {
                var imageFile = Path.GetFileName(m.Id);
                var title = string.IsNullOrEmpty(Poi.Name)
                    ? imageFile
                    : Poi.Name + " - " + imageFile;
                if (AppState.FloatingItems.Any(f => string.Equals(f.Title, title)))
                    continue; // Do not add the same photo twice.
                if (m.Type != MediaType.Photo) continue;
                if (string.IsNullOrEmpty(m.LocalPath))
                    m.LocalPath = Poi.Service.store.GetLocalUrl(Poi.Service.MediaFolder, m.Id);

                var d = new Document { Location = m.LocalPath, OriginalUrl = m.PublicUrl };
                var fed = FloatingHelpers.CreateFloatingElement(d);
                fed.Title = title;
                fed.CanFullScreen = true;
                fed.StartPosition = startPosition + offset;
                offset += new Vector(10, 25);
                AppState.FloatingItems.AddFloatingElement(fed);
            }
        }