xmsstamper  1.0
xms::XmStampRaster Class Reference

Raster defined using a non-rotated cartesian axis for use in XmStamper. More...

#include <XmStamperIo.h>

Public Types

enum  XmRasterFormatEnum { RS_ARCINFO_ASCII }
 /breif enum the identify the format of the raster
 

Public Member Functions

 XmStampRaster (const int a_numPixelsX, const int a_numPixelsY, const double a_pixelSizeX, const double a_pixelSizeY, const Pt3d &a_min, const std::vector< double > &a_vals, const int a_noData)
 Constructor that sets all the raster values. More...
 
 XmStampRaster ()
 Default Constructor.
 
int GetCellIndexFromColRow (const int a_col, const int a_row) const
 Gets the zero-based cell index from the given column and row. More...
 
void GetColRowFromCellIndex (const int a_index, int &a_col, int &a_row) const
 Gets the zero-based column and row from the cell index. More...
 
Pt3d GetLocationFromCellIndex (const int a_index) const
 Gets the location of the cell center from the zero-based cell index. More...
 
void WriteGridFile (const std::string &a_fileName, const XmRasterFormatEnum a_format)
 Writes the raster in the given format to the given filename. More...
 
void WriteToFile (std::ofstream &a_file, const std::string &a_cardName) const
 Writes the XmStampRaster class information to a file. More...
 
bool ReadFromFile (std::ifstream &a_file)
 Reads the XmStampRaster class information to a file. More...
 

Public Attributes

int m_numPixelsX
 Number of pixels in the X-direction (Required)
 
int m_numPixelsY
 Number of pixels in the Y-direction (Required)
 
double m_pixelSizeX
 Pixel size in the X-direction (Required)
 
double m_pixelSizeY
 Pixel size in the Y-direction (Required)
 
Pt3d m_min
 Minimum (lower left) X, Y coordinate of the raster at the center of the raster cell (Required)
 
std::vector< double > m_vals
 
int m_noData
 NO DATA value for the raster (typically XM_NODATA)
 

Detailed Description

Raster defined using a non-rotated cartesian axis for use in XmStamper.

Definition at line 33 of file XmStamperIo.h.

Constructor & Destructor Documentation

◆ XmStampRaster()

xms::XmStampRaster::XmStampRaster ( const int  a_numPixelsX,
const int  a_numPixelsY,
const double  a_pixelSizeX,
const double  a_pixelSizeY,
const Pt3d a_min,
const std::vector< double > &  a_vals,
const int  a_noData 
)

Constructor that sets all the raster values.

Parameters
[in]a_numPixelsXnumber of pixels in x direction
[in]a_numPixelsYnumber of pixels in y direction
[in]a_pixelSizeXsize of the pixels in the x direction
[in]a_pixelSizeYsize of the pixels in the y direction
[in]a_minThe bottom left corner (x,y) of the raster
[in]a_valsThe raster values
[in]a_noDataThe "no data" (or inactive) value to identify raster pixels where no value exists.

Definition at line 268 of file XmStamperIo.cpp.

Member Function Documentation

◆ GetCellIndexFromColRow()

int xms::XmStampRaster::GetCellIndexFromColRow ( const int  a_col,
const int  a_row 
) const

Gets the zero-based cell index from the given column and row.

Parameters
[in]a_colThe zero-based column index for the raster.
[in]a_rowThe zero-based row index for the raster.
Returns
The zero-based cell index from the given a_col, a_row.

Definition at line 298 of file XmStamperIo.cpp.

References m_numPixelsX, and m_numPixelsY.

Referenced by XmStampIntermediateTests::test_BuildRasterAndGetCellValue().

◆ GetColRowFromCellIndex()

void xms::XmStampRaster::GetColRowFromCellIndex ( const int  a_index,
int &  a_col,
int &  a_row 
) const

Gets the zero-based column and row from the cell index.

Parameters
[in]a_indexThe zero-based raster cell index.
[out]a_colThe zero-based column index for the raster.
[out]a_rowThe zero-based row index for the raster.

Definition at line 312 of file XmStamperIo.cpp.

References m_numPixelsX, and m_numPixelsY.

Referenced by GetLocationFromCellIndex().

◆ GetLocationFromCellIndex()

Pt3d xms::XmStampRaster::GetLocationFromCellIndex ( const int  a_index) const

Gets the location of the cell center from the zero-based cell index.

Parameters
[in]a_indexThe zero-based raster cell index.
Returns
The location of the cell with the given index.

Definition at line 326 of file XmStamperIo.cpp.

References GetColRowFromCellIndex(), m_min, m_numPixelsY, m_pixelSizeX, m_pixelSizeY, xms::Pt3< T >::x, and xms::Pt3< T >::y.

◆ ReadFromFile()

bool xms::XmStampRaster::ReadFromFile ( std::ifstream &  a_file)

Reads the XmStampRaster class information to a file.

Parameters
[in]a_fileThe input file.
Returns
true if file read is successful. false if errors encountered.

Definition at line 393 of file XmStamperIo.cpp.

References m_min, m_noData, m_numPixelsX, m_numPixelsY, m_pixelSizeX, m_pixelSizeY, m_vals, stEqualNoCase(), xms::Pt3< T >::x, XM_ENSURE_TRUE, and xms::Pt3< T >::y.

Referenced by xms::XmStamperIo::ReadFromFile(), and TutStampingUnitTests::test_RealDataStamping().

◆ WriteGridFile()

void xms::XmStampRaster::WriteGridFile ( const std::string &  a_fileName,
const XmRasterFormatEnum  a_format 
)

◆ WriteToFile()

void xms::XmStampRaster::WriteToFile ( std::ofstream &  a_file,
const std::string &  a_cardName 
) const

Writes the XmStampRaster class information to a file.

Parameters
[in]a_fileThe output file.
[in]a_cardNameThe card name to be written to the output file.

Definition at line 375 of file XmStamperIo.cpp.

References m_min, m_noData, m_numPixelsX, m_numPixelsY, m_pixelSizeX, m_pixelSizeY, m_vals, xms::Pt3< T >::x, XM_ENSURE_TRUE, and xms::Pt3< T >::y.

Referenced by xms::XmStamperIo::WriteToFile().

Member Data Documentation

◆ m_vals

std::vector<double> xms::XmStampRaster::m_vals

Raster values defined from the top left corner to the bottom right corner (Required) Use the m_noData value to specify a cell value with no data.

Definition at line 46 of file XmStamperIo.h.

Referenced by xms::XmStamperImpl::DoStamp(), ReadFromFile(), XmStampIntermediateTests::test_BuildRasterAndGetCellValue(), WriteGridFile(), and WriteToFile().


The documentation for this class was generated from the following files: