Example #1
0
 /// <summary>
 /// Given a state, returns the URL to the file containing its block group data
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 public static string GetStateAllGeometryUrl(AcsState state)
 {
     //TODO:
     return(string.Concat(
                Settings.CurrentAcsAllStateTablesUrl,
                '/', GetStateAllGeometryFileName(state)));
 }
Example #2
0
        /// <summary>
        /// Returns the path to the directory where the raw data files for a given should be extracted/read from
        /// </summary>
        /// <param name="state"></param>
        /// <returns></returns>
        public static string GetStateBlockGroupDataDir(AcsState state)
        {
            string filePath = FileLocator.GetStateBlockGroupDataFilePath(state);
            string basePath = Path.GetDirectoryName(filePath);

            //IMPORTANT!  Don't create this directory on disk, just the path string!
            return(FileUtilities.PathCombine(basePath, state.ToString()));
        }
Example #3
0
        /// <summary>
        /// Populates our 'year', 'state', 'summary level', and 'srid' controls,
        /// as well as any other "choose from a set" controls that come up.
        /// </summary>
        protected void PopulateLists()
        {
            this.cboYear.DataSource         = new BindingSource(FormController.Instance.AvailableYears, string.Empty);
            this.cboStates.DataSource       = new BindingSource(FormController.Instance.AvailableStates, string.Empty);
            this.cboSummaryLevel.DataSource = new BindingSource(FormController.Instance.AvailableLevels, string.Empty);


            this.cboStates.FormattingEnabled = true;
            this.cboStates.Format           += delegate(object sender, ListControlConvertEventArgs e)
            {
                AcsState state = (AcsState)e.Value;
                if (state == AcsState.None)
                {
                    e.Value = string.Empty;
                }
                else
                {
                    e.Value = state.ToString();
                }
            };

            this.cboSummaryLevel.FormattingEnabled = true;
            this.cboSummaryLevel.Format           += delegate(object sender, ListControlConvertEventArgs e)
            {
                BoundaryLevels level = (BoundaryLevels)e.Value;
                switch (level)
                {
                case BoundaryLevels.None:
                    e.Value = string.Empty;
                    break;

                //case BoundaryLevels.counties:
                //    e.Value = "Counties";
                //    break;
                //case BoundaryLevels.county_subdivisions:
                //    e.Value = "County Subdivisions";
                //    break;
                case BoundaryLevels.census_tracts:
                    e.Value = "Census Tracts";
                    break;

                case BoundaryLevels.census_blockgroups:
                    e.Value = "Census Blockgroups";
                    break;
                }
            };

            //NOTE! We're doing this initialization in "radioSRIDFromList_CheckedChanged",
            //instead of here, this is because it's expensive (we have to read through a whole file)
            //so we're shaving a half-second off the init, and moving it to a spot where the user shouldn't notice.
            //this.cboProjections.DataSource = new BindingSource(FormController.Instance.AvailableProjections, string.Empty);
        }
Example #4
0
 /// <summary>
 /// Gets the working directory for a given state
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 public static string GetStateWorkingDir(AcsState state)
 {
     return FileUtilities.PathEnsure(Settings.AppDataDirectory, "Working", state.ToString());
 }
Example #5
0
        //public static readonly string TempPath = FileUtilities.SafePathEnsure(Settings.AppTempPath);


        /// <summary>
        /// Given a state, returns the URL to the file containing its block group data
        /// </summary>
        /// <param name="state"></param>
        /// <returns></returns>
        public static string GetStateBlockGroupUrl(AcsState state)
        {
            return(string.Concat(
                       Settings.CurrentAcsAllStateTablesUrl,
                       '/', GetStateBlockGroupFileName(state)));
        }
Example #6
0
 /// <summary>
 /// Given a state, returns the name to the file containing its block group data
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 public static string GetStateBlockGroupFileName(AcsState state)
 {
     //TODO:
     return(States.StateToCensusName(state) + Settings.BlockGroupsDataTableSuffix
            + Settings.DataFileTypeExtension);
 }
Example #7
0
 /// <summary>
 /// Get's a pretty name for a state
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 public static string StateToRealName(AcsState state)
 {
     throw new NotImplementedException("This function will be implemented at a later date");
 }
Example #8
0
 /// <summary>
 /// Gets the working directory for a given state
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 public static string GetStateWorkingDir(AcsState state)
 {
     return(FileUtilities.PathEnsure(Settings.AppDataDirectory, "Working", state.ToString()));
 }
Example #9
0
 /// <summary>
 /// The Census uses it's own naming convention for states (currently PascalCase without spaces)
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 public static string StateToCensusName(AcsState state)
 {
     return(state.ToString());
 }
Example #10
0
 /// <summary>
 /// Get's a pretty name for a state
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 public static string StateToRealName(AcsState state)
 {
     throw new NotImplementedException("This function will be implemented at a later date");
 }
Example #11
0
 /// <summary>
 /// Given a state, returns the name to the file containing its block group data
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 public static string GetStateAllGeometryFileName(AcsState state)
 {
     return(States.StateToCensusName(state) + Settings.AllGeographiesDataTableSuffix
            + Settings.DataFileTypeExtension);
 }
 public AcsDataManager(AcsState aState)
 {
     this.State = aState;
     Init();
 }
Example #13
0
 //public static readonly string TempPath = FileUtilities.SafePathEnsure(Settings.AppTempPath);
 /// <summary>
 /// Given a state, returns the URL to the file containing its block group data
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 public static string GetStateBlockGroupUrl(AcsState state)
 {
     return string.Concat(
         Settings.CurrentAcsAllStateTablesUrl,
         '/', GetStateBlockGroupFileName(state));
 }
Example #14
0
 /// <summary>
 /// Given a state, returns the name to the file containing its block group data
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 public static string GetStateBlockGroupFileName(AcsState state)
 {
     //TODO:
     return States.StateToCensusName(state) + Settings.BlockGroupsDataTableSuffix
         + Settings.DataFileTypeExtension;
 }
Example #15
0
 /// <summary>
 /// Gets the local path of the zip file containing all the raw blockgroup/tract data
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 public static string GetStateBlockGroupDataFilePath(AcsState state)
 {
     string basePath = FileUtilities.PathEnsure(Settings.AppDataDirectory, Settings.CurrentAcsDirectory);
     return Path.Combine(basePath, state.ToString() + Settings.DataFileTypeExtension);
 }
Example #16
0
        /// <summary>
        /// Returns the path to the directory where the raw data files for a given should be extracted/read from
        /// </summary>
        /// <param name="state"></param>
        /// <returns></returns>
        public static string GetStateBlockGroupDataDir(AcsState state)
        {
            string filePath = FileLocator.GetStateBlockGroupDataFilePath(state);
            string basePath = Path.GetDirectoryName(filePath);

            //IMPORTANT!  Don't create this directory on disk, just the path string!
            return FileUtilities.PathCombine(basePath, state.ToString());
        }
Example #17
0
 /// <summary>
 /// Given a state, returns the URL to the file containing its block group data
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 public static string GetStateAllGeometryUrl(AcsState state)
 {
     //TODO:
     return string.Concat(
         Settings.CurrentAcsAllStateTablesUrl,
         '/', GetStateAllGeometryFileName(state));
 }
Example #18
0
        /// <summary>
        /// Gets the local path of the zip file containing all the raw blockgroup/tract data
        /// </summary>
        /// <param name="state"></param>
        /// <returns></returns>
        public static string GetStateBlockGroupDataFilePath(AcsState state)
        {
            string basePath = FileUtilities.PathEnsure(Settings.AppDataDirectory, Settings.CurrentAcsDirectory);

            return(Path.Combine(basePath, state.ToString() + Settings.DataFileTypeExtension));
        }
Example #19
0
 /// <summary>
 /// Given a state, returns the name to the file containing its block group data
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 public static string GetStateAllGeometryFileName(AcsState state)
 {
     return States.StateToCensusName(state) + Settings.AllGeographiesDataTableSuffix
         + Settings.DataFileTypeExtension;
 }
        public AcsDataManager(AcsState aState, string workingFolder, string year)
        {
            this.State = aState;

            if (!string.IsNullOrEmpty(year))
            {
                /**
                 * IMPORTANT NOTE!  RequestedYear MUST BE SET before setting the Application Data Directory!
                 */

                Settings.RequestedYear = year;
            }

            if (!string.IsNullOrEmpty(workingFolder))
            {
                //override where we're storing temporary files
                Settings.AppDataDirectory = FileUtilities.SafePathEnsure(workingFolder);
            }
            _log.InfoFormat("Working directory is {0} ", workingFolder);

            Init();
        }
Example #21
0
 /// <summary>
 /// The Census uses it's own naming convention for states (currently PascalCase without spaces)
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 public static string StateToCensusName(AcsState state)
 {
     return state.ToString();
 }