/*! \param map PCRaster map handle. It is ours to close. */ PCRasterDataset::PCRasterDataset( MAP* map) : GDALPamDataset(), d_map(map), d_west(0.0), d_north(0.0), d_cellSize(0.0) { // Read header info. nRasterXSize = RgetNrCols(d_map); nRasterYSize = RgetNrRows(d_map); d_west = static_cast<double>(RgetXUL(d_map)); d_north = static_cast<double>(RgetYUL(d_map)); d_cellSize = static_cast<double>(RgetCellSize(d_map)); d_cellRepresentation = RgetUseCellRepr(d_map); CPLAssert(d_cellRepresentation != CR_UNDEFINED); d_valueScale = RgetValueScale(d_map); CPLAssert(d_valueScale != VS_UNDEFINED); d_defaultNoDataValue = ::missingValue(d_cellRepresentation); d_location_changed = false; // Create band information objects. nBands = 1; SetBand(1, new PCRasterRasterBand(this)); SetMetadataItem("PCRASTER_VALUESCALE", valueScale2String( d_valueScale).c_str()); }
static int ReadAttr( ATTRIBUTES *a, MAP *m, BOOL readOnly) /* are the attribute only used for teh PRINT op */ { DefaultAttr(a); if (RuseAs(m, CR_REAL8)) goto failure; RgetMinVal(m, &(a->minVal)); RgetMaxVal(m, &(a->maxVal)); a->projection = MgetProjection(m); a->xUL = RgetXUL(m); a->yUL = RgetYUL(m); a->nrRows = RgetNrRows(m); a->nrCols = RgetNrCols(m); a->cellSize = RgetCellSize(m); a->version = MgetVersion(m); a->gisFileId = MgetGisFileId(m); a->byteOrder = m->main.byteOrder; a->attrTable = m->main.attrTable; if (Merrno) goto failure; if (a->version == 2 || readOnly) { /* otherwise use defaults */ a->valueScale = RgetValueScale(m); a->cellRepr = RgetCellRepr(m); a->angle = RgetAngle(m); if (a->angle < 0) a->angle = -Rad2Deg(-a->angle); else a->angle = Rad2Deg(a->angle); } return 0; failure: return 1; }