Skip to content

Commit a6886d0

Browse files
committed
rm unused 'groups_are_holes' fn with lots of sp code for #61
1 parent c39616c commit a6886d0

File tree

3 files changed

+2
-63
lines changed

3 files changed

+2
-63
lines changed

Diff for: DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: osmplotr
22
Title: Bespoke Images of 'OpenStreetMap' Data
3-
Version: 0.3.5.005
3+
Version: 0.3.5.006
44
Authors@R:
55
c(person(given = "Mark",
66
family = "Padgham",

Diff for: R/add-osm-groups.R

-61
Original file line numberDiff line numberDiff line change
@@ -392,67 +392,6 @@ group_colours_colourmat <- function (cols, groups, rotate) {
392392
return (list ("cols" = cols, "cmat" = cmat))
393393
}
394394

395-
#' identify groups which are holes in other groups
396-
#'
397-
#' @note This is not currently used, but the code is ready to implement in this
398-
#' form.
399-
#'
400-
#' @noRd
401-
groups_are_holes <- function (groups) {
402-
403-
holes <- rep (FALSE, length (groups))
404-
group_pairs <- combn (length (groups), 2)
405-
for (i in seq_len (ncol (group_pairs))) {
406-
407-
n1 <- length (groups [[group_pairs [1, i]]]) # nolint
408-
n2 <- length (groups [[group_pairs [2, i]]]) # nolint
409-
if (n1 > 2 && n2 > 2) { # otherwise can't be a hole
410-
411-
x1 <- sp::coordinates (groups [[group_pairs [1, i]]]) [, 1] # nolint
412-
y1 <- sp::coordinates (groups [[group_pairs [1, i]]]) [, 2] # nolint
413-
indx <- which (!duplicated (cbind (x1, y1)))
414-
x1 <- x1 [indx]
415-
y1 <- y1 [indx]
416-
xy1 <- spatstat.geom::ppp (x1, y1,
417-
xrange = range (x1), yrange = range (y1)
418-
)
419-
ch1 <- spatstat.geom::convexhull (xy1)
420-
bdry1 <- cbind (ch1$bdry [[1]]$x, ch1$bdry [[1]]$y)
421-
x2 <- sp::coordinates (groups [[group_pairs [2, i]]]) [, 1] # nolint
422-
y2 <- sp::coordinates (groups [[group_pairs [2, i]]]) [, 2] # nolint
423-
indx <- which (!duplicated (cbind (x2, y2)))
424-
x2 <- x2 [indx]
425-
y2 <- y2 [indx]
426-
xy2 <- spatstat.geom::ppp (x2, y2,
427-
xrange = range (x2), yrange = range (y2)
428-
)
429-
ch2 <- spatstat.geom::convexhull (xy2)
430-
bdry2 <- cbind (ch2$bdry [[1]]$x, ch2$bdry [[1]]$y)
431-
432-
indx <- sapply (bdry1, function (x) {
433-
sp::point.in.polygon (
434-
bdry2 [, 1], bdry2 [, 2],
435-
bdry1 [, 1], bdry1 [, 2]
436-
)
437-
})
438-
if (all (indx == 1)) {
439-
holes [group_pairs [1, i]] <- TRUE
440-
}
441-
indx <- sapply (bdry2, function (x) {
442-
sp::point.in.polygon (
443-
bdry1 [, 1], bdry1 [, 2],
444-
bdry2 [, 1], bdry2 [, 2]
445-
)
446-
})
447-
if (all (indx == 1)) {
448-
holes [group_pairs [2, i]] <- TRUE
449-
}
450-
}
451-
}
452-
453-
return (holes)
454-
}
455-
456395
#' Trim coordinates of obj to be plotted down to coordinates of map
457396
#'
458397
#' @note This has to be modified for points!

Diff for: codemeta.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"codeRepository": "https://github.com/ropensci/osmplotr",
99
"issueTracker": "https://github.com/ropensci/osmplotr/issues",
1010
"license": "https://spdx.org/licenses/GPL-3.0",
11-
"version": "0.3.5.005",
11+
"version": "0.3.5.006",
1212
"programmingLanguage": {
1313
"@type": "ComputerLanguage",
1414
"name": "R",

0 commit comments

Comments
 (0)