Просмотр исходного кода

Töötav 'qgis_algorithm_search_by_word'.

Ardo Kubjas 5 лет назад
Родитель
Сommit
61bf13ede2
2 измененных файлов с 3 добавлено и 27 удалено
  1. 3 26
      R/qgis_algorithm_search_by_word.R
  2. 0 1
      man/qgis_algorithm_search_by_word.Rd

+ 3 - 26
R/qgis_algorithm_search_by_word.R

@@ -19,36 +19,13 @@
 #' qgis_algorithm_search_by_word(str = "filedownloader")
 #' qgis_algorithm_search_by_word(str = "")
 #' qgis_algorithm_search_by_word()
-#'
 #' }
 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"])
+  x <- system(sprintf("qgis_process list | grep %s", str), intern = TRUE)
+  x <- do.call("rbind", strsplit(x, "\t"))[, 2:3]
   cat("\n----------------\n")
-  cat("\nValitud algoritm:\n")
-  cat(algs.id[i, "algorithm"])
-  cat("\n\n----------------\n")
-  cat("\n\n")
+  x
 }

+ 0 - 1
man/qgis_algorithm_search_by_word.Rd

@@ -29,7 +29,6 @@ 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()
-
 }
 }
 \seealso{