useDynLib(sp)

import(methods)
importFrom(graphics, plot)
import(utils) # stack, to be changed later (2.5.0?) into
importFrom(lattice, levelplot, xyplot, trellis.par.set, 
	panel.lines, panel.text, panel.points, panel.identify,
	panel.levelplot, panel.superpose, panel.xyplot, trellis.par.get,
	trellis.focus, trellis.unfocus, panel.number)
importFrom(grid, grid.polygon, grid.rect, polygonGrob, gpar,
	grid.layout, unit, frameGrob, placeGrob, rectGrob, grid.locator)

export(CRS, print.CRS, proj4string, "proj4string<-", is.projected)

export(bbox, getGridIndex, points2grid, bpy.colors, bubble,
	mapasp, point.in.polygon, spmap.to.lev, zerodist, remove.duplicates,
	degAxis)

export(coordinatevalues)

export(dimensions)
 
export(SpatialPoints, SpatialPointsDataFrame)

export(Line, Lines, SpatialLines, SpatialLinesDataFrame, as.SpatialLines.SLDF,
	gridat, LineLength, LinesLength, SpatialLinesLengths)


export(layout.scale.bar, layout.north.arrow, sp.theme,
	mapLegendGrob, spplot.key, panel.gridplot, panel.polygonsplot,
	panel.pointsplot, sp.polygons, sp.text, sp.points, sp.lines,
	sp.grid, SpatialPolygonsRescale, spplot.locator)
# export(sp.pagefn)

export(as.image.SpatialGridDataFrame, image2Grid)

export(gridparameters, "gridded<-", gridded, fullgrid, "fullgrid<-",
	SpatialPixels, SpatialPixelsDataFrame, SpatialGrid,
	SpatialGridDataFrame, GridTopology, getGridTopology,
	areaSpatialGrid, gridlines, gridat)

export(getSLlinesSlot, getLinesLinesSlot, 
	getLinesIDSlot, getSLLinesIDSlots)
export(nowrapSpatialLines, getSpatialLinesMidPoints)

export(getPolygonCoordsSlot, getPolygonLabptSlot, getPolygonAreaSlot,
	getPolygonHoleSlot, getPolygonsPolygonsSlot, getPolygonsplotOrderSlot,
	getPolygonsLabptSlot, getPolygonsIDSlot, getSpPpolygonsSlot,
	getSpPplotOrderSlot, getSpPPolygonsLabptSlots, getSpPPolygonsIDSlots,
	getSpPnParts, getSpPnHoles, getSpatialPolygonsLabelPoints)

export(as.SpatialPolygons.PolygonsList, Polygons, Polygon, SpatialPolygons,
	SpatialPolygonsDataFrame)

export(ShowSpatialPointsDataFrame)

export(select.spatial)

export(read.asciigrid, write.asciigrid)

export(makegrid, sample.Spatial, sample.Line, sample.Polygon, sample.Polygons,
	sample.Sgrid)

export(as.SpatialPolygons.GridTopology, IDvaluesGridTopology, as.SpatialPolygons.SpatialPixels, IDvaluesSpatialPixels, HexPoints2SpatialPolygons)

export(dd2dms, print.DMS, char2dms, as.character.DMS,
	as.double.DMS, as.numeric.DMS)

export(spDistsN1)

export(
	rbind.SpatialPoints,
	rbind.SpatialPointsDataFrame, 
	rbind.SpatialPixels,
	rbind.SpatialPixelsDataFrame,
	rbind.SpatialPolygons,
	rbind.SpatialPolygonsDataFrame,
	rbind.SpatialLines,
	rbind.SpatialLinesDataFrame)

exportClasses(CRS, 
	Spatial, 
	SpatialPoints, 
	GridTopology,
	SpatialPixels, 
	SpatialGrid, 
	Line, 
	Lines,
	SpatialLines, 
 	SpatialPointsDataFrame, 
	SpatialPixelsDataFrame,
	SpatialGridDataFrame,
	SpatialLinesDataFrame)

exportClasses(Polygon, Polygons, SpatialPolygons, SpatialPolygonsDataFrame)

exportClasses(DMS)

exportMethods(show, bbox, coordinates, "coordinates<-",
	coordnames, "coordnames<-", gridded, polygons, "polygons<-",
	dimensions, coerce, "[", "[[", "$", "$<-", overlay, plot, recenter,
	spplot, spsample, summary)

S3method(as.data.frame, SpatialPoints)
S3method(as.data.frame, SpatialPixels)
S3method(as.data.frame, SpatialGrid)
S3method(as.data.frame, SpatialPointsDataFrame)
S3method(as.data.frame, SpatialPixelsDataFrame)
S3method(as.data.frame, SpatialGridDataFrame)
S3method(as.data.frame, SpatialLinesDataFrame)
S3method(as.data.frame, SpatialPolygonsDataFrame)
S3method(as.data.frame, GridTopology)

S3method(as.matrix, SpatialGridDataFrame)
S3method(as.matrix, SpatialPixelsDataFrame)

S3method(cbind, SpatialGridDataFrame)

S3method(contour, SpatialPixelsDataFrame)
S3method(contour, SpatialGridDataFrame)

S3method(dim, SpatialPointsDataFrame)

S3method(image, SpatialPixelsDataFrame)
S3method(image, SpatialGridDataFrame)

S3method(lines, Line)
S3method(lines, Lines)
S3method(lines, SpatialLines)
S3method(lines, SpatialLinesDataFrame)

S3method(names, SpatialPointsDataFrame)
S3method(names, SpatialPixelsDataFrame)
S3method(names, SpatialGridDataFrame)
S3method(names, SpatialLinesDataFrame)
S3method(names, SpatialPolygonsDataFrame)

S3method("names<-", SpatialPointsDataFrame)
S3method("names<-", SpatialPolygonsDataFrame)
S3method("names<-", SpatialLinesDataFrame)
S3method("names<-", SpatialPixelsDataFrame)
S3method("names<-", SpatialGridDataFrame)

S3method(points, SpatialPoints)
S3method(points, SpatialPointsDataFrame)

S3method(print, CRS)
S3method(print, GridTopology)
S3method(print, SpatialPoints)
S3method(print, SpatialPixels)
S3method(print, SpatialPointsDataFrame)
S3method(print, SpatialPixelsDataFrame)
S3method(print, summary.Spatial)
S3method(print, summary.GridTopology)

S3method(stack, SpatialPointsDataFrame)
S3method(stack, SpatialPixelsDataFrame)
S3method(stack, SpatialGridDataFrame)

S3method(subset, SpatialPoints)
S3method(subset, SpatialPointsDataFrame)

S3method(text, SpatialPointsDataFrame)

S3method(print, DMS)
S3method(as.character, DMS)
S3method(as.numeric, DMS)
S3method(as.double, DMS)

export(".__C__CRS")
export(".__C__SpatialPoints")
export(".__C__SpatialPointsDataFrame")
export(".__C__SpatialPixelsDataFrame")
export(".__C__Line")
export(".__C__Lines")
export(".__C__SpatialLines")
export(".__C__Polygon")
export(".__C__Polygons")
export(".__C__SpatialPolygons")
