Beispiel #1
0
        /// <summary>
        /// Compiles regions with locations, merging the peakbagger and base sets of formations from *.csv files.
        /// </summary>
        /// <param name="filePathRegionsKml">The file path to the KML file containing the regions.</param>
        /// <param name="filePathCsv">The file path to the *.csv file containing the base formation sets.</param>
        /// <param name="filePathPeakbaggerCsvSource">The file path to the master peakbagger *.csv file.</param>
        /// <param name="filePathPeakbaggerCsv">The file path to the filtered peakbagger *.csv file.</param>
        /// <returns>Regions.</returns>
        public static Region CollateLocationsFromCsv(string filePathRegionsKml,
                                                     string filePathCsv,
                                                     string filePathPeakbaggerCsvSource,
                                                     string filePathPeakbaggerCsv = "")
        {
            // Get regions
            Region regions = Kml.ReadRegions(filePathRegionsKml);

            // Add database locations
            List <FormationMatcher> locations = GetFormationsFromCsv(filePathCsv);

            regions.AddFormationsByRegionName(locations);

            // Get peakbagger locations
            bool             potentialLocationsAreSaved = !string.IsNullOrWhiteSpace(filePathPeakbaggerCsv);
            List <Formation> locationsPeakbagger        = potentialLocationsAreSaved
                ? GetPeakbaggerFormationsFromCsvFiltered(filePathPeakbaggerCsv)
                : GetPeakbaggerFormationsFromCsvOriginal(filePathPeakbaggerCsvSource, new Extents(regions.Extents), saveToCsv: true);

            regions.AddFormationsByCoordinates(locationsPeakbagger);

            // Add locations to the appropriate region
            foreach (Region region in regions)
            {
                region.MergeFormations();
                region.CondensePotentialMatches();
            }

            return(regions);
        }