import("methods")

importFrom("stats",
           "as.formula",
           "reorder",
           "density",
           "aggregate",
           "update") ##needed for update.trellis

importFrom("utils",
           "modifyList",
           "stack")

importFrom("parallel",
           "mclapply",
           "parLapply",
           "detectCores")

import("grDevices")##needed by RColorBrewer

importFrom("RColorBrewer",
           "brewer.pal")

importFrom("viridisLite",
           "viridis",
           "magma",
           "inferno",
           "plasma")

importFrom("grid",
           "gpar",
           "viewport",
           "polygonGrob",
           "linesGrob", "segmentsGrob", "textGrob",
           "grid.layout", "frameGrob",
           "placeGrob", "packGrob",
           "grobHeight", "grobWidth",
           "grid.locator", "arrow",
           "convertX", "convertY",
           "unit")

import("lattice")

importFrom("latticeExtra",
           "horizonplot",
           "xyplot.list",
           "layer", "glayer",
           "custom.theme",
           "custom.theme.2",
           "xscale.components.subticks",
           "yscale.components.subticks"
           )

importFrom("hexbin",
           "BTC",
           "panel.hexbinplot",
           "hexbinplot")


importClassesFrom("sp", "SpatialPoints")
importFrom("sp",
           "SpatialPoints",
           "SpatialPointsDataFrame",
           "degreeLabelsNS",
           "degreeLabelsEW",
           "coordinates",
           "CRS",
           "point.in.polygon")

importFrom("zoo",
           "zoo")##,
           ##xyplot)

importFrom("terra",
           "spatSample",
           "is.lonlat",
           "subst",
           "nlyr",
           "ext",
           "time"
           )

importFrom("raster",
           "sampleRegular",
           "sampleRandom",
           "isLonLat",
           "subs",
           "nlayers",
           "extent",
           "getZ",
           "compareRaster"
           )


export(
  'chooseRegion',
  'xyLayer',
  'rasterTheme',
  'YlOrRdTheme',
  'BTCTheme',
  'GrTheme',
  'RdBuTheme',
  'BuRdTheme',
  'PuOrTheme',
  'viridisTheme',
  'magmaTheme',
  'infernoTheme',
  'plasmaTheme',
  'streamTheme',
  'bwTheme',
  'xscale.raster',
  'yscale.raster',
  'xscale.raster.subticks',
  'yscale.raster.subticks'
    )

#S4 methods
exportMethods(
              "bwplot",
              "densityplot",
              "histogram",
              "horizonplot",
              "hovmoller",
              "identifyRaster",
              "levelplot",
              "contourplot",
              "vectorplot",
              "streamplot",
              "splom",
              "xyplot",
              "hexbinplot",
              "plot3D",
              "gplot"
              )
#S3 methods
S3method("llines", "SpatVector")
S3method("lpoints", "SpatVector")
S3method("lpolygon", "SpatVector")
