@@ -392,67 +392,6 @@ group_colours_colourmat <- function (cols, groups, rotate) {
392
392
return (list (" cols" = cols , " cmat" = cmat ))
393
393
}
394
394
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
-
456
395
# ' Trim coordinates of obj to be plotted down to coordinates of map
457
396
# '
458
397
# ' @note This has to be modified for points!
0 commit comments