importFrom(stats, simulate)
importFrom(utils, head)
importFrom(utils, tail)
importFrom(utils, packageDescription)
importFrom(utils, packageVersion)
importFrom(MASS, ginv)
importFrom(MASS, eqscplot)
importFrom(abind, abind)
importFrom(nlme, fdHess)
importFrom(mgcv, gam)
importFrom(mgcv, s)
importFrom(mgcv, te)
importFrom(mgcv, formula.gam)

##importFrom(maptools, unionSpatialPolygons)
##importFrom(maptools, readShapePoly)

import(sp)
import(parallel)
importFrom("methods", Ops, Math)

## 2014-10-05 speculative
importFrom(raster, 'values<-')
importFrom(raster, values)
importFrom(raster, clump)
importFrom(raster, adjacent)
importClassesFrom(raster, RasterLayer)
importMethodsFrom(raster, raster)
##exportClasses(RasterLayer, mask, Dsurface)
exportClasses(mask, Dsurface)

export (secr.fit)
export (par.secr.fit)
export (par.derived)
export (par.region.N)
export (region.N)
export (expected.n)
export (ip.secr)
export (pfn)
export (read.traps)
export (read.telemetry)
export (make.grid)
export (make.circle)
export (make.tri)
export (trap.builder)
export (make.systematic)
export (writeGPS)
export (mash)
export (addTelemetry)
export (cluster.counts)
export (cluster.centres)
export (clip.hex)
export (make.poly)
export (make.telemetry)
export (make.transect)
export (read.capthist)
export (write.capthist)
export (sim.popn)
export (tile)
export (make.capthist)
export (sim.capthist)
export (sim.resight)
export (read.mask)
export (addCovariates)
export (make.mask)
export (RPSV)
export (dbar)
export (moves)
export (MMDM)
export (ARL)
export (circular.r)
export (circular.p)
export (autoini)
export (logit)
export (invlogit)
export (write.captures)
export (write.traps)
export (score.test)
export (score.table)
export (LR.test)
export (esa)
export (derived)
export (derived.cluster)
export (derived.session)
export (derived.mash)
export (derived.external)
export (derived.nj)
export (pdot)
export (esa.plot)
export (esa.plot.secr)
export (suggest.buffer)
export (bias.D)
export (mask.check)
export (polyarea)
export (pdot.contour)
export (buffer.contour)
export (distancetotrap)
export (nearesttrap)
export (secrlist)
export (MS.capthist)
export (rbind.capthist)
export (join)
export (unjoin)
export (RMarkInput)
export (unRMarkInput)
export (detectfnplot)
export (attenuationplot)
export (counts)
export (model.average)
export (collate)
export (ellipse.secr)
export (ellipse.bvn)
export (LLsurface.secr)
export (closure.test)
export (closedN)
export (read.SPACECAP)
export (write.SPACECAP)
export (read.DA)
export (write.DA)
export (logmultinom)
export (fxi.secr)
export (fx.total)
export (fxi.contour)
export (fxi.mode)
export (pointsInPolygon)
export (predictDsurface)
export (rectangularMask)
export (spotHeight)
export (strip.legend)
export (randomHabitat)
export (make.lookup)

# new generics
export (reduce)
export (rotate)
export (shift)
export (flip)
export (trim)
export (verify)
export (ms)
export (detectpar)
export (signal)
export (noise)
export (clone)

S3method(reduce, default)
S3method(rotate, default)
S3method(shift, default)
S3method(flip, default)
S3method(trim, default)

S3method (verify, default)
S3method (verify, traps)
S3method (verify, capthist)
S3method (verify, mask)

S3method (head, mask)
S3method (head, Dsurface)
S3method (head, traps)
S3method (head, capthist)
S3method (tail, mask)
S3method (tail, Dsurface)
S3method (tail, traps)
S3method (tail, capthist)

S3method (ms, default)
S3method (ms, mask)
S3method (ms, secr)
S3method (ms, secrtest)

S3method(detectpar, default)
S3method(detectpar, secr)

S3method(signal, default)
S3method(noise, default)
S3method(signal, capthist)
S3method(noise, capthist)

S3method(clone, default)
S3method(clone, popn)
S3method(clone, capthist)

export (covariates)
export (timevaryingcov)
export (usage)
export (usagePlot)
export (detector)
export (clusterID)
export (clustertrap)
export (spacing)
export (searcharea)
export (transectlength)
export (polyID)
export (transectID)
export (animalID)
export (alive)
export (xy)
export (telemetryxy)
export (telemetered)
export (PG)
export (alongtransect)
export (snip)
export (signalframe)
export (signalmatrix)
export (noise)
export (occasion)
export (trap)
export (Rsurface)
export (CV)
export (CVa)
export (CVa0)
export (plotMCP)
export (xy2CH)

export (traps)
export (session)

S3method(covariates,default)
S3method(timevaryingcov,default)
S3method(usage,default)
S3method(clusterID,default)
S3method(clustertrap,default)
S3method(detector,default)
S3method(spacing,default)
S3method(traps,default)
S3method(session, default)

export ('covariates<-')
export ('timevaryingcov<-')
export ('usage<-')
export ('detector<-')
export ('clusterID<-')
export ('clustertrap<-')
export ('spacing<-')
export ('polyID<-')
export ('transectID<-')
export ('traps<-')
export ('session<-')
export ('xy<-')
export ('signalframe<-')
export ('signal<-')
export ('noise<-')

## assume these internal fns not needed outside
# export (group.levels)
# export (group.factor)
# export (secr.lpredictor)
# export (make.lookup)

export (secr.make.newdata)
export (secr.design.MS)
export (D.designdata)
export (sim.secr)
export (sim.detect)
export (secr.test)
export (getMeanSD)
export (maskarea)
export (masklength)
export (edist)

## export (telemetry.LT)
## export (telemetry.LC)

S3method(print, traps)
S3method(plot, traps)
S3method(summary, traps)
S3method(print, summary.traps)
S3method(rbind, traps)
S3method(subset, traps)
S3method(reduce, traps)
S3method(rotate, traps)
S3method(shift, traps)
S3method(flip, traps)
S3method(split, traps)
S3method(spacing, traps)

S3method(rotate, popn)
S3method(flip, popn)
S3method(shift, popn)
S3method(plot, popn)
S3method(subset, popn)
export (rbind.popn)   ## stopgap until can sort out dispatching

S3method(print, capthist)
S3method(plot, capthist)
S3method(summary, capthist)
S3method(print, summary.capthist)
S3method(subset, capthist)
S3method(reduce, capthist)
S3method(split, capthist)
S3method(sort, capthist)

S3method(subset, mask)
S3method(rbind, mask)
S3method(plot, mask)
S3method(summary, mask)
S3method(print, summary.mask)
S3method(spacing, mask)
S3method(shift, mask)

S3method(print, secr)
S3method(plot, secr)
S3method(predict, secr)
S3method(vcov, secr)
S3method(AIC, secr)
S3method(logLik, secr)
S3method(coef, secr)
S3method(confint, secr)
S3method(deviance, secr)
S3method(df.residual, secr)
S3method(simulate, secr)
S3method(trim, secr)

S3method(print, secrdata)
S3method(print, secrlist)
S3method(plot, secrlist)
S3method(predict, secrlist)
S3method(AIC, secrlist)
S3method('[', secrlist)

S3method(print, Dsurface)
S3method(plot, Dsurface)
S3method(summary, Dsurface)

S3method(plot, Rsurface)
S3method(print, Rsurface)

S3method(print, secrtest)
S3method(plot, secrtest)

useDynLib (
    secr,
    fxIHP,
    pdotpoint,
    pdotpoly,
    integralprw1,
    secrloglik,
    trappingsingle,
    trappingmulti,
    trappingproximity,
    trappingcount,
    trappingpolygon,
    trappingpolygonX,
    trappingtransect,
    trappingtransectX,
    trappingtelemetry,
    trappingsignal,
    trappingtimes,
    simdetect,
    naived,
    naivecap2,
    makelookup,
    SegCircle,
    getdenomext
)

