Beispiel #1
0
        internal static void Update_MapContainer_MarkerSourceActivities(MapContainer mapContainer, ActivityCollection localCollection, ActivityCollection masterCollection)
        {
            mapContainer.MapMarkers.CollectionContent.RemoveAll(
                marker => marker.MarkerSource == MapMarker.MarkerSourceActivityValue);
            var locationActivities =
                masterCollection.CollectionContent.Select(
                    activity => new { Activity = activity, Locations = activity.LocationCollection.GetIDSelectedArray() });
            Dictionary <string, LocationSpot> locDict = new Dictionary <string, LocationSpot>();

            foreach (var locAct in locationActivities)
            {
                foreach (var location in locAct.Locations)
                {
                    string       key = location.Location.GetLocationText();
                    LocationSpot locSpot;
                    locDict.TryGetValue(key, out locSpot);
                    if (locSpot == null)
                    {
                        locSpot = new LocationSpot {
                            LocationText = key, Location = location.Location
                        };
                        locDict.Add(key, locSpot);
                    }
                    locSpot.AddActivity(locAct.Activity);
                }
            }
            List <MapMarker> markers = new List <MapMarker>();

            foreach (var dictItem in locDict)
            {
                var locSpot = dictItem.Value;
                foreach (var catItem in locSpot.CategorizedActivites)
                {
                    MapMarker marker = MapMarker.CreateDefault();
                    marker.Location     = locSpot.Location;
                    marker.MarkerSource = MapMarker.MarkerSourceActivityValue;
                    marker.IconUrl      = GetIconUrlForCategory(catItem.CategoryName);
                    marker.CategoryName = GetMarkerCategoryName(catItem.CategoryName);
                    //marker.IconUrl = "../oip-additions/oip-assets/oip-images/oip-markers/OIP-marker-meeting.png";
                    marker.LocationText = locSpot.LocationText;
                    marker.SetLocationTextFromLocation(locSpot.Location);
                    marker.PopupTitle = catItem.GetCategoryTitle();
                    StringBuilder strBuilder = new StringBuilder();
                    foreach (var act in catItem.Activities)
                    {
                        ReferenceToInformation referenceToInformation = act.ReferenceToInformation;
                        appendMarkerLink(strBuilder, referenceToInformation);
                    }
                    marker.PopupContent = strBuilder.ToString();
                    markers.Add(marker);
                }
            }

            mapContainer.MapMarkers.CollectionContent.AddRange(markers);
        }
Beispiel #2
0
        internal static void Update_MapContainer_MarkerSourceBlogs(MapContainer mapContainer, BlogCollection localCollection, BlogCollection masterCollection)
        {
            mapContainer.MapMarkers.CollectionContent.RemoveAll(
                marker => marker.MarkerSource == MapMarker.MarkerSourceBlogValue);
            var locationBlogs =
                masterCollection.CollectionContent.Select(
                    blog => new { Blog = blog, Locations = blog.LocationCollection.GetIDSelectedArray() });
            Dictionary <string, LocationSpot> locDict = new Dictionary <string, LocationSpot>();

            foreach (var locBlog in locationBlogs)
            {
                foreach (var location in locBlog.Locations)
                {
                    string       key = location.Location.GetLocationText();
                    LocationSpot locSpot;
                    locDict.TryGetValue(key, out locSpot);
                    if (locSpot == null)
                    {
                        locSpot = new LocationSpot {
                            LocationText = key, Location = location.Location
                        };
                        locDict.Add(key, locSpot);
                    }
                    locSpot.AddBlog(locBlog.Blog);
                }
            }
            List <MapMarker> markers = new List <MapMarker>();

            foreach (var dictItem in locDict)
            {
                var       locSpot = dictItem.Value;
                MapMarker marker  = MapMarker.CreateDefault();
                marker.Location     = locSpot.Location;
                marker.MarkerSource = MapMarker.MarkerSourceBlogValue;
                marker.IconUrl      = GetIconUrlForCategory("News");
                marker.CategoryName = GetMarkerCategoryName("News");
                marker.LocationText = locSpot.LocationText;
                marker.SetLocationTextFromLocation(locSpot.Location);
                marker.PopupTitle = "News";
                StringBuilder strBuilder = new StringBuilder();
                foreach (var blogItem in locSpot.Blogs)
                {
                    ReferenceToInformation referenceToInformation = blogItem.ReferenceToInformation;
                    appendMarkerLink(strBuilder, referenceToInformation);
                }
                marker.PopupContent = strBuilder.ToString();
                markers.Add(marker);
            }

            mapContainer.MapMarkers.CollectionContent.AddRange(markers);
        }
        internal static void Update_MapContainer_MarkerSourceBlogs(MapContainer mapContainer, BlogCollection localCollection, BlogCollection masterCollection)
        {
            mapContainer.MapMarkers.CollectionContent.RemoveAll(
                marker => marker.MarkerSource == MapMarker.MarkerSourceBlogValue);
            var locationBlogs =
                masterCollection.CollectionContent.Select(
                    blog => new { Blog = blog, Locations = blog.LocationCollection.GetIDSelectedArray() });
            Dictionary<string, LocationSpot> locDict = new Dictionary<string, LocationSpot>();
            foreach (var locBlog in locationBlogs)
            {
                foreach (var location in locBlog.Locations)
                {
                    string key = location.Location.GetLocationText();
                    LocationSpot locSpot;
                    locDict.TryGetValue(key, out locSpot);
                    if (locSpot == null)
                    {
                        locSpot = new LocationSpot { LocationText = key, Location = location.Location };
                        locDict.Add(key, locSpot);
                    }
                    locSpot.AddBlog(locBlog.Blog);
                }
            }
            List<MapMarker> markers = new List<MapMarker>();
            foreach (var dictItem in locDict)
            {
                var locSpot = dictItem.Value;
                MapMarker marker = MapMarker.CreateDefault();
                marker.Location = locSpot.Location;
                marker.MarkerSource = MapMarker.MarkerSourceBlogValue;
                marker.IconUrl = GetIconUrlForCategory("News");
                marker.CategoryName = GetMarkerCategoryName("News");
                marker.LocationText = locSpot.LocationText;
                marker.SetLocationTextFromLocation(locSpot.Location);
                marker.PopupTitle = "News";
                StringBuilder strBuilder = new StringBuilder();
                foreach (var blogItem in locSpot.Blogs)
                {
                    ReferenceToInformation referenceToInformation = blogItem.ReferenceToInformation;
                    appendMarkerLink(strBuilder, referenceToInformation);
                }
                marker.PopupContent = strBuilder.ToString();
                markers.Add(marker);
            }

            mapContainer.MapMarkers.CollectionContent.AddRange(markers);
        }
        internal static void Update_MapContainer_MarkerSourceActivities(MapContainer mapContainer, ActivityCollection localCollection, ActivityCollection masterCollection)
        {
            mapContainer.MapMarkers.CollectionContent.RemoveAll(
                marker => marker.MarkerSource == MapMarker.MarkerSourceActivityValue);
            var locationActivities =
                masterCollection.CollectionContent.Select(
                    activity => new {Activity = activity, Locations = activity.LocationCollection.GetIDSelectedArray()});
            Dictionary<string, LocationSpot> locDict = new Dictionary<string, LocationSpot>();
            foreach(var locAct in locationActivities)
            {
                foreach(var location in locAct.Locations)
                {
                    string key = location.Location.GetLocationText();
                    LocationSpot locSpot;
                    locDict.TryGetValue(key, out locSpot);
                    if(locSpot == null)
                    {
                        locSpot = new LocationSpot {LocationText = key, Location = location.Location};
                        locDict.Add(key, locSpot);
                    }
                    locSpot.AddActivity(locAct.Activity);
                }
            }
            List<MapMarker> markers = new List<MapMarker>();
            foreach(var dictItem in locDict)
            {
                var locSpot = dictItem.Value;
                foreach(var catItem in locSpot.CategorizedActivites)
                {
                    MapMarker marker = MapMarker.CreateDefault();
                    marker.Location = locSpot.Location;
                    marker.MarkerSource = MapMarker.MarkerSourceActivityValue;
                    marker.IconUrl = GetIconUrlForCategory(catItem.CategoryName);
                    marker.CategoryName = GetMarkerCategoryName(catItem.CategoryName);
                    //marker.IconUrl = "../oip-additions/oip-assets/oip-images/oip-markers/OIP-marker-meeting.png";
                    marker.LocationText = locSpot.LocationText;
                    marker.SetLocationTextFromLocation(locSpot.Location);
                    marker.PopupTitle = catItem.GetCategoryTitle();
                    StringBuilder strBuilder = new StringBuilder();
                    foreach(var act in catItem.Activities)
                    {
                        ReferenceToInformation referenceToInformation = act.ReferenceToInformation;
                        appendMarkerLink(strBuilder, referenceToInformation);
                    }
                    marker.PopupContent = strBuilder.ToString();
                    markers.Add(marker);
                }
            }

            mapContainer.MapMarkers.CollectionContent.AddRange(markers);
        }