private void GenerateMarker(double lat, double lon, string iconModifier, Geocache cache, string cachedesc, string mode, bool isExtra) { StringBuilder addMarkerReq = new StringBuilder(); if (isExtra) { addMarkerReq.Append("addExtraMarker("); } else { addMarkerReq.Append("addMarker("); } addMarkerReq.Append(lat.ToString(CultureInfo.InvariantCulture)); addMarkerReq.Append(","); addMarkerReq.Append(lon.ToString(CultureInfo.InvariantCulture)); addMarkerReq.Append(",'../icons/24x24/"); addMarkerReq.Append(iconModifier); string statIcon = IconManager.GetStatusIcon(cache, m_App, m_IgnoreFinds); if (null != statIcon) { addMarkerReq.Append(statIcon); } else { addMarkerReq.Append(IconManager.GetMapIcon(cache)); } addMarkerReq.Append("',\""); addMarkerReq.Append(cache.Name); addMarkerReq.Append("\",\""); addMarkerReq.Append(cache.CacheName.Replace("\"", "'")); addMarkerReq.Append("\",\""); addMarkerReq.Append(cachedesc.Replace("\"", "''")); addMarkerReq.Append("\",\""); addMarkerReq.Append(mode); addMarkerReq.Append("\""); if (AppConfig.ShowDiffTerrIcon) { addMarkerReq.Append(","); addMarkerReq.Append(cache.Difficulty.ToString(CultureInfo.InvariantCulture)); addMarkerReq.Append(","); addMarkerReq.Append(cache.Terrain.ToString(CultureInfo.InvariantCulture)); } addMarkerReq.Append(")"); LoadScript(addMarkerReq.ToString()); }
private void AddChildWaypointMarker(Waypoint pt, bool isExtra) { if (!m_UnfilteredCaches.ContainsKey(pt.Parent)) { return; } Geocache cache = m_UnfilteredCaches[pt.Parent]; string desc = pt.Desc.Replace("\"", "''"); desc = desc.Replace("\n", "<br/>"); string iconModifier = String.Empty; if (m_App.AppConfig.ShowStaleCaches) { if ((DateTime.Now - cache.Updated) > (new TimeSpan(m_App.AppConfig.StaleCacheInterval, 0, 0, 0, 0))) { iconModifier = "stale-"; } } if (m_App.AppConfig.ShowNewCaches) { if ((DateTime.Now - cache.Time) <= (new TimeSpan(m_App.AppConfig.NewCacheInterval, 0, 0, 0, 0))) { iconModifier = "new-"; } } if (cache.Archived) { iconModifier = "archived-"; } else if (!cache.Available) { iconModifier = "disabled-"; } if (isExtra) { LoadScript("addExtraMarker(" + pt.Lat.ToString(CultureInfo.InvariantCulture) + "," + pt.Lon.ToString(CultureInfo.InvariantCulture) + ",'../icons/24x24/" + iconModifier + IconManager.GetMapIcon(pt.Symbol) + "',\"" + cache.Name + "\",\"" + cache.CacheName.Replace("\"", "'") + "\",\"" + pt.Name + "-" + desc + "\")"); } else { LoadScript("addMarker(" + pt.Lat.ToString(CultureInfo.InvariantCulture) + "," + pt.Lon.ToString(CultureInfo.InvariantCulture) + ",'../icons/24x24/" + iconModifier + IconManager.GetMapIcon(pt.Symbol) + "',\"" + cache.Name + "\",\"" + cache.CacheName.Replace("\"", "'") + "\",\"" + pt.Name + "-" + desc + "\")"); } }