Commit 75be44fa authored by mjg226's avatar mjg226
Browse files

added a function ESRI_ASCIIGrid to retrieve the cell by coordinates

parent 02099f50
......@@ -932,9 +932,36 @@ namespace CA {
}
}// end of copyData
//--------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------
inline T getCellByCords(double XCord, double YCord)
{
int XCol = int(XCord - AsciiGridGeneral<T>::xllcorner) / AsciiGridGeneral<T>::cellsize;
// note , cords go from bottom left and rows,cols go grom top left, therefore need to flip this...
//int YRow = int(YCord - AsciiGridGeneral<T>::yllcorner) / AsciiGridGeneral<T>::cellsize;
int YRow = AsciiGridGeneral<T>::nrows - (int(YCord - AsciiGridGeneral<T>::yllcorner) / AsciiGridGeneral<T>::cellsize);
T returnResult = AsciiGridGeneral<T>::data[XCol + (AsciiGridGeneral<T>::ncols * YRow)];
std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
std::cout << "Local Cords ["<< XCol<<","<<YRow<<"]: " << returnResult<< std::endl;
std::cout << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << std::endl;
return returnResult;
}// end of getCellByCords
//--------------------------------------------------------------------------------------------------------------
};// end of class
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment