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, 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(AttributeList)

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


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)

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

#export(as.SpatialPolygons.Shapelist, as.SpatialPolygons.matrixList, 
#	as.Ring4.matrix)

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

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

export(as.SpatialPolygons.PolygonsList, Polygons, Polygon, SpatialPolygons,
	SpatialPolygonsDataFrame)
#, as.SpatialPolygons.Shapes, as.SpatialPolygons.map, as.SpatialPolygons.pal)

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)

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

export(spDistsN1)

exportClasses(CRS, 
	Spatial, 
	SpatialPoints, 
	GridTopology,
	SpatialPixels, 
	SpatialGrid, 
	Line, 
	Lines,
	SpatialLines, 
	#AttributeList,
 	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("[[", SpatialPointsDataFrame)
S3method("[[<-", SpatialPointsDataFrame)

S3method("[[", SpatialPixelsDataFrame)
S3method("[[<-", SpatialPixelsDataFrame)

S3method("[[", SpatialGridDataFrame)
S3method("[[<-", SpatialGridDataFrame)

S3method("[[", SpatialPolygonsDataFrame)
S3method("[[<-", SpatialPolygonsDataFrame)

S3method("[[", SpatialLinesDataFrame)
S3method("[[<-", SpatialLinesDataFrame)

#S3method("[[", AttributeList)
#S3method("[[<-", AttributeList)

S3method("$", SpatialPointsDataFrame)
S3method("$", SpatialPixelsDataFrame)
S3method("$", SpatialGridDataFrame)
S3method("$", SpatialLinesDataFrame)
S3method("$", SpatialPolygonsDataFrame)
#S3method("$", AttributeList)

S3method("$<-", SpatialPoints)
S3method("$<-", SpatialPixels)
S3method("$<-", SpatialGrid)
S3method("$<-", SpatialPointsDataFrame)
S3method("$<-", SpatialPixelsDataFrame)
S3method("$<-", SpatialGridDataFrame)
S3method("$<-", SpatialLinesDataFrame)
S3method("$<-", SpatialPolygonsDataFrame)
#S3method("$<-", AttributeList)

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, AttributeList)
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(dim, AttributeList)

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

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

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

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

# S3method(plot, Spatial)
# S3method(plot, SpatialPoints)
# S3method(plot, SpatialPointsDataFrame)
# S3method(plot, SpatialPixels)
# S3method(plot, SpatialPixelsDataFrame)
# S3method(plot, SpatialGrid)
# S3method(plot, SpatialGridDataFrame)
# S3method(plot, SpatialPolygons)
# S3method(plot, SpatialPolygonsDataFrame)
# S3method(plot, SpatialLines)
# S3method(plot, SpatialLinesDataFrame)

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(print, summary.SpatialPoints)
S3method(print, summary.SpatialPixels)
S3method(print, summary.SpatialGrid)
S3method(print, summary.SpatialPointsDataFrame)
S3method(print, summary.SpatialPixelsDataFrame)
S3method(print, summary.SpatialGridDataFrame)

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

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

# S3method(summary, Spatial)
# S3method(summary, GridTopology)
# S3method(summary, SpatialPoints)
# S3method(summary, SpatialPointsDataFrame)
# S3method(summary, SpatialPixels)
# S3method(summary, SpatialPixelsDataFrame)
# S3method(summary, SpatialGrid)
# S3method(summary, SpatialGridDataFrame)
# S3method(summary, SpatialLines)
# S3method(summary, SpatialLinesDataFrame)
# S3method(summary, SpatialPolygonsDataFrame)
# S3method(summary, AttributeList)

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")
