public IList <string> FullProcess(ISpreadsheet spreadsheet, IMapGraphic mapGraphic, IEnumerable <IMapGraphicConverter> converters, string outputFolderPath, RenderPreferences preferences, Products products) { var countyIds = spreadsheet .Where(x => x.HasTruthyValue(products)) .Select(x => x[ID_COLUMN]); try { mapGraphic.FillReferenceBoxes(preferences.DefaultColor); mapGraphic.FillCounties(preferences.DefaultColor); mapGraphic.StrokeReferenceBoxes(preferences.LineColor); mapGraphic.StrokeOuterBorder(preferences.LineColor); mapGraphic.Fill(preferences.PresenceColor, countyIds); mapGraphic.Fill(preferences.PresenceColor, ELEMENTID_REF_PRESENCE_BOX); if (!preferences.ShowCountyNames) { mapGraphic.HideCountyNames(); } if (preferences.ShowCountyLines) { mapGraphic.StrokeCounties(preferences.LineColor); } else { mapGraphic.ReduceStrokeCounties(); mapGraphic.StrokeCounties(preferences.DefaultColor); mapGraphic.Stroke(preferences.PresenceColor, countyIds); } mapGraphic.SetText(ELEMENTID_REF_PRESENCE_TEXT, products.GetWithPresenceText()); mapGraphic.SetText(ELEMENTID_REF_NO_PRESENCE_TEXT, products.GetWithoutPresenceText()); } catch { throw new ApplicationException("Error applying color to elements, verify elementIds and SVG file."); } var resultFileNames = new List <string>(); var baseFilename = Path.Combine(outputFolderPath, string.Format("COPsync-presence-map-{0:yyyyMMddHHmmss}", DateTime.Now)); foreach (var converter in converters) { try { var convertedFilename = Path.ChangeExtension(baseFilename, converter.DefaultExtension); converter.Convert(mapGraphic, convertedFilename); resultFileNames.Add(convertedFilename); } catch (Exception e) { throw new ApplicationException(string.Format("Error converting the file using {0}:\n{1}", converter.GetType(), e.Message)); } } return(resultFileNames); }
private PreferencesManager() { //TODO: PropertyGrid for editing this RenderPreferences = new RenderPreferences(); GamePreferences = new GamePreferences(); }