59 Hillshade::~Hillshade() {
162 QObject::tr(
"Hillshade requires a 3x3x1 portal of data, but a %1x%2x%3 "
163 "portal of data was provided instead")
171 QObject::tr(
"Hillshade requires a valid azimuth angle (sun direction) to "
178 QObject::tr(
"Hillshade azimuth angle [%1] must be between 0 and 360 degrees")
185 QObject::tr(
"Hillshade requires a valid zenith angle (solar elevation) to "
192 QObject::tr(
"Hillshade zenith angle [%1] must be between 0 and 90 degrees")
199 QObject::tr(
"Hillshade requires a pixel resolution (meters/pixel) to "
206 QObject::tr(
"Hillshade requires a non-zero pixel resolution (meters/pixel) "
221 double result =
Null;
224 bool anySpecialPixels =
false;
225 for(
int i = 0; i < input.
size(); ++i) {
227 anySpecialPixels =
true;
232 if (!anySpecialPixels) {
247 double p = ( (-1) * input[0] + (0) * input[1] + (1) * input[2]
248 + (-1) * input[3] + (0) * input[4] + (1) * input[5]
249 + (-1) * input[6] + (0) * input[7] + (1) * input[8]) / (3.0 *
m_pixelResolution);
251 double q = ( (-1) * input[0] + (-1) * input[1] + (-1) * input[2]
252 + (0) * input[3] + (0) * input[4] + (0) * input[5]
274 double numerator = 1.0 + p0 * p + q0 * q;
276 double denominator = sqrt(1 + p * p + q * q) * sqrt(1 + p0 * p0 + q0 * q0);
278 result = numerator / denominator;
309 QString resolution =
"Null";
314 debug <<
"Hillshade[ azimuth =" << hillshade.
azimuth().
toString().toLatin1().data()
316 <<
"resolution =" << resolution.toLatin1().data() <<
"]";
Buffer for reading and writing cube data.
Angle * m_azimuth
This is direction of the light, with 0 at north.
const double Null
Value for an Isis Null pixel.
int LineDimension() const
Returns the number of lines in the shape buffer.
int BandDimension() const
Returns the number of bands in the shape buffer.
void setAzimuth(Angle azimuth)
The azimuth is the direction of the light.
Hillshade & operator=(const Hillshade &rhs)
Assignment operator.
double radians() const
Convert an angle to a double.
Angle * m_zenith
This is the altitide of the light, with 0 directly overhead and 90 at the horizon.
QString toString(bool boolToConvert)
Global function to convert a boolean to a string.
double shadedValue(Buffer &input) const
Calculate the shaded value from a 3x3x1 window.
This error is for when a programmer made an API call that was illegal.
void setZenith(Angle zenith)
The zenith is the altitude/solar elevation of the light.
Hillshade()
Create a default-constructed Hillshade.
Angle zenith() const
Get the current zenith angle.
Degrees are generally considered more human readable, 0-360 is one circle, however most math does not...
virtual QString toString(bool includeUnits=true) const
Get the angle in human-readable form.
#define _FILEINFO_
Macro for the filename and line number.
Calculate light intensity reflected off a local slope of DEM.
A type of error that cannot be classified as any of the other error types.
bool IsSpecial(const double d)
Returns if the input pixel is special.
bool isValid() const
This indicates whether we have a legitimate angle stored or are in an unset, or invalid, state.
static Angle fullRotation()
Makes an angle to represent a full rotation (0-360 or 0-2pi).
void setResolution(double resolution)
The resolution is the meters per pixel of the input to shadedValue().
Defines an angle and provides unit conversions.
void swap(Hillshade &other)
Swap class data with other; this cannot throw an exception.
double resolution() const
Get the current resolution (meters per pixel).
int size() const
Returns the total number of pixels in the shape buffer.
QDebug operator<<(QDebug debug, const Hillshade &hillshade)
Print this class out to a QDebug object.
double m_pixelResolution
meters per pixel
Angle azimuth() const
Get the current azimuth angle.
int SampleDimension() const
Returns the number of samples in the shape buffer.