File: Class-SpatialGrid.R

package info (click to toggle)
r-cran-sp 1%3A0.9-66-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,696 kB
  • ctags: 123
  • sloc: ansic: 1,475; sh: 6; makefile: 5
file content (24 lines) | stat: -rw-r--r-- 813 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
setClass("SpatialPixels", 
	representation("SpatialPoints", grid = "GridTopology", grid.index = "integer"),
	validity = function(object) {
# print("Entering validation: SpatialPixels")
		# check that dimensions, proj4string and bbox do not conflict
		if (nrow(object@coords) != length(object@grid.index) 
				&& length(object@grid.index) != 0)
			stop("grid.index should have length zero or equal to nrow(coords)")
		return(TRUE)
	}
)

setClass("SpatialGrid",
	representation("SpatialPixels"),
	validity = function(object) {
# print("Entering validation: SpatialGrid")
		# check that dimensions, proj4string and bbox do not conflict
		if (length(object@grid.index) > 0)
			stop("grid.index should have length zero")
		if (nrow(object@coords) != 2)
			stop("bogus coords should have two rows")
		return(TRUE)
	}
)