| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- #' QGIS-i algoritmi leidmine fraasi järele
- #'
- #' Funktsioon leiab fraasi järele QGIS-i algoritmid.
- #' @param str string otsitav algoritmi fraas.
- #' @return Table found algorithms. Help for the selected algorithm.
- #' @return A array of all database schemas.
- #' @seealso [qgisprocess::qgis_algorithms()]
- #' @keywords qgis, help
- #' @export
- #' @examples
- #' ## Not run:
- #' ##
- #' ## qgis_algorithm_search_by_word(str = "clip")
- #' ## algorithm <- "native:clip"
- #' ## # Read help.
- #' ## qgisprocess::qgis_show_help(algorithm = algorithm)
- #' ##
- #' ## qgis_algorithm_search_by_word(str = "centroid")
- #' ## qgis_algorithm_search_by_word(str = "filedownloader")
- #' ## qgis_algorithm_search_by_word(str = "")
- #' ## qgis_algorithm_search_by_word()
- #' ##
- #' ## End(**Not run**)
- qgis_algorithm_search_by_word <- function(str = NULL) {
- if (is.null(str) || str == "") {
- return(NULL)
- }
- algs <- qgisprocess::qgis_algorithms(query = FALSE, quiet = TRUE)
- ids <- grep(str, algs$algorithm)
- algs.id <- methods::cbind2(ids, algs[ids, ])
- colnames(algs.id) <- c("id", colnames(algs))
- print(algs.id)
- i <- 1
- # Juhendi näitamine
- if (nrow(algs.id) > 1) {
- while (T) {
- num <- readline(sprintf(
- "Millist juhendit soovid vaadata (%s)? > ",
- paste(seq(1:nrow(algs.id)), collapse = ",")
- ))
- num <- as.numeric(num)
- if (num %in% seq(1:nrow(algs.id))) {
- i <- num
- break
- }
- }
- }
- qgisprocess::qgis_show_help(algs.id[i, "algorithm"])
- cat("\n----------------\n")
- cat("\nValitud algoritm:\n")
- cat(algs.id[i, "algorithm"])
- cat("\n\n----------------\n")
- cat("\n\n")
- }
|