R/map_deps.R

# Copyright © 2016 RTE Réseau de transport d’électricité

requireDep <- function(map, deps) {
   mapDeps <- list(
     shadows = htmlDependency(
       "shadows",
       "1.0",
       src = system.file("leafletPlugins", package = "bpNumerique2018"),
       script = "svgShadows.js"
     ),
     
     antaresLegend = htmlDependency(
       "antaresLegend",
       "1.0",
       src = system.file("leafletPlugins", package = "bpNumerique2018"),
       script = "antaresLegend.js",
       stylesheet = "antaresLegend.css"
     )
   )
   
   depsInMap <- sapply(map$dependencies, function(x) x$name)
   
   for (dep in deps) {
     if (!any(depsInMap == dep)) {
       map$dependencies <- c(map$dependencies, list(mapDeps[[dep]]))
     }
   }
   
   map
 }
rte-antares-rpackage/bpN documentation built on May 31, 2019, 2:52 p.m.