Skip to content

Commit

Permalink
Merge pull request #14 from ajstamm/Dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
ajstamm authored Nov 2, 2023
2 parents 82f9d0e + 6e393a9 commit 7e11d6a
Show file tree
Hide file tree
Showing 121 changed files with 1,749 additions and 967 deletions.
15 changes: 7 additions & 8 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
Package: gatpkg
Type: Package
Title: Geographic Aggregation Tool (GAT)
Version: 2.0.0
Date: 2023-03-15
Version: 2.1.0
Date: 2023-10-31
Authors@R: c(
person("Abigail", "Stamm", email = "[email protected]",
role = c("cre", "aut"), comment = "author of R package"),
person("Gwen", "Babcock", email = "[email protected]",
role = c("aut", "trl"), comment = "author of SAS and R scripts,
contributed to technical notes"),
role = c("cre", "aut", "trl"), comment = "maintainer,
author of SAS and R scripts,
contributed to technical notes"),
person("Abigail", "Stamm", email = "[email protected]",
role = c("aut"), comment = "author of R package"),
person("Thomas", "Talbot",
role = c("ctb"), comment = "GAT concept creator,
contributed to technical notes"),
Expand Down Expand Up @@ -36,13 +37,11 @@ Imports:
raster,
RColorBrewer (>= 1.1.2),
sf,
spdep (>= 1.0-2),
stats,
tcltk,
tibble,
Suggests:
knitr,
lwgeom,
prettymapr (>= 0.2.2),
rmarkdown,
tools,
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Generated by roxygen2: do not edit by hand

export(aggregateGATnb)
export(calculateGATcompactness)
export(calculateGATexclusions)
export(calculateGATflag)
Expand Down
15 changes: 12 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
# gatpkg v2.1.0

* Removed dependency on spdep and fixed associated bugs.
* Added check for empty geographies.

# gatpkg v2.0.1

* Added check for operating system in `locateGATshapefile()`.
* Removed function `aggregateGATnb()`.

# gatpkg v2.0.0

* Revised `writeGATkml` so that it also writes to KMZ.
* Revised `writeGATkml()` so that it also writes to KMZ.
* Removed dependencies on rgeos, lwgeom, rgdal, foreign, tcltk2, plotkml, and sp.
* Removed `checkGATshapefilesize` and fixed bugs.
* Removed `checkGATshapefilesize()` and fixed bugs.
* Added advanced options to the settings file and log.
* Fixed several bugs that broke GAT.
* Revised and standardized all pop-up fonts and colors except the pre-defined progress bar and file-selection window.
* Revised population weighting to read in the population file only once.
* Added a 'GATid' variable to clone the selected merge variable instead of overwriting it.
Expand Down
52 changes: 0 additions & 52 deletions R/aggregateGATnb.R

This file was deleted.

1 change: 1 addition & 0 deletions R/calculateGATexclusions.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ calculateGATexclusions <- function(d, var, math, val) {
if (!"GATflag" %in% names(d)) {
d$GATflag <- 0 # for non-default uses of this function
}
d$GATflag <- ifelse(d$GATflag == 1, 0, d$GATflag)

if (math == "equals") {
d$GATflag <- ifelse(d$GATflag == 0 & data.frame(d)[, var] == val, 1, d$GATflag)
Expand Down
2 changes: 2 additions & 0 deletions R/calculateGATflag.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ calculateGATflag <- function(exclist, d) {
if (!"GATflag" %in% names(d)) {
d$GATflag <- 0 # for non-default uses of this function
}
d$GATflag <- ifelse(d$GATflag == 1, 0, d$GATflag)


if (exclist$var1 != "NONE") {
d <- calculateGATexclusions(d, exclist$var1, exclist$math1, exclist$val1)
Expand Down
18 changes: 12 additions & 6 deletions R/confirmGATbystep.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
#' shapefile to save to, all without extensions.
#' @param savekml A boolean, whether or not to save a KML file.
#' @param step Integer step in the GAT program, for help reference.
#' @param quitopt Text string for the cancel button.
#' @param bgcol Text string containing UI background color.
#' @param buttoncol Text string containing UI button color.
#'
#### examples ####
#' @examples
Expand Down Expand Up @@ -117,7 +120,8 @@
#### end roxygen ####

confirmGATbystep <- function(gatvars, ratevars, mergevars, filevars, exclist,
savekml, step = 0) {
savekml = FALSE, step = 0, bgcol = "lightskyblue3",
buttoncol = "cornflowerblue", quitopt = "Quit") {
## initial settings ####
instruct <- paste("To modify a step, choose it from the list and click",
"'Confirm'. \n After you modify most steps, you will",
Expand All @@ -136,8 +140,6 @@ confirmGATbystep <- function(gatvars, ratevars, mergevars, filevars, exclist,
"10. Save location",
"None")
fonthead <- tcltk::tkfont.create(family = "Segoe UI", size = 10, weight = "bold")
bgcol <- "lightskyblue3"
buttoncol <- "cornflowerblue"

## backwards compatibility check ####
if (is.null(gatvars$ismax1)) gatvars$ismax1 <- FALSE
Expand All @@ -162,6 +164,10 @@ confirmGATbystep <- function(gatvars, ratevars, mergevars, filevars, exclist,
} else {
mysets <- paste(mysets, "None selected \n")
}
if(gatvars$invalid > 0) {
mysets <- paste(mysets, "Empty areas removed (invalid):",
gatvars$invalid, "\n")
}

### aggregation variables ####
min1 <- format(as.numeric(gsub(",", "", gatvars$minvalue1)),
Expand Down Expand Up @@ -294,8 +300,8 @@ confirmGATbystep <- function(gatvars, ratevars, mergevars, filevars, exclist,
myenv <- new.env()
# button functions and layout
onHelp <- function() {
showGAThelp(help = hlp, helptitle = helppage, helppage = helppage,
step = step)
gatpkg::showGAThelp(help = hlp, helptitle = helppage, helppage = helppage,
step = step, bgcol=bgcol, buttoncol=buttoncol)
}
onOk <- function() {
Rbval <- tcltk::tclvalue(stepvar)
Expand All @@ -313,7 +319,7 @@ confirmGATbystep <- function(gatvars, ratevars, mergevars, filevars, exclist,
command = onHelp, background = buttoncol)
tt$tf$OkBut <- tcltk::tkbutton(tt$tf, text = "Confirm", width = 12,
command = onOk, default = "active", background = buttoncol)
tt$tf$CancelBut <- tcltk::tkbutton(tt$tf, text = "Cancel GAT",
tt$tf$CancelBut <- tcltk::tkbutton(tt$tf, text = quitopt,
width = 12, command = onCancel, background = buttoncol)

tcltk::tkgrid(tt$tf$OkBut, column = 2, row = 1, padx = 5)
Expand Down
13 changes: 4 additions & 9 deletions R/confirmGATquit.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,10 @@
#' @export

confirmGATquit <- function() {
msg <- "Are you sure you want to quit GAT?"
x <- tcltk::tkmessageBox(title = "GAT cancelled",
message = msg,
type = "yesno", icon = "warning")
msg <- "Are you sure you want to quit?"
x <- tcltk::tkmessageBox(title = "Program cancelled", message = msg,
type = "yesno", icon = "warning")
x <- tcltk::tclvalue(x)
if (x == "yes") {
x <- "quit"
} else if (x == "no") {
x <- "continue"
}
x <- if (x == "yes") "quit" else if (x == "no") "continue"
return(x)
}
Loading

0 comments on commit 7e11d6a

Please sign in to comment.