Isis 3 Programmer Reference
Isis::Hillshade Class Reference

Calculate light intensity reflected off a local slope of DEM. More...

#include <Hillshade.h>

Collaboration diagram for Isis::Hillshade:
Collaboration graph

Public Member Functions

 Hillshade ()
 Create a default-constructed Hillshade. More...
 
 Hillshade (Angle azimuth, Angle zenith, double resolution)
 Construct and fully initialize a Hillshade. More...
 
 Hillshade (const Hillshade &other)
 Copy constructor. More...
 
void setAzimuth (Angle azimuth)
 The azimuth is the direction of the light. More...
 
void setZenith (Angle zenith)
 The zenith is the altitude/solar elevation of the light. More...
 
void setResolution (double resolution)
 The resolution is the meters per pixel of the input to shadedValue(). More...
 
Angle azimuth () const
 Get the current azimuth angle. More...
 
Angle zenith () const
 Get the current zenith angle. More...
 
double resolution () const
 Get the current resolution (meters per pixel). More...
 
double shadedValue (Buffer &input) const
 Calculate the shaded value from a 3x3x1 window. More...
 
void swap (Hillshade &other)
 Swap class data with other; this cannot throw an exception. More...
 
Hillshadeoperator= (const Hillshade &rhs)
 Assignment operator. More...
 
QString toString () const
 

Private Attributes

Anglem_azimuth
 This is direction of the light, with 0 at north. More...
 
Anglem_zenith
 This is the altitide of the light, with 0 directly overhead and 90 at the horizon. More...
 
double m_pixelResolution
 meters per pixel More...
 

Detailed Description

Calculate light intensity reflected off a local slope of DEM.

This class basically does what the 'shade' application does. This calculates a shaded-relief cube given 3x3 topographic portals. Inputs include the sun angle (azimuth), solar elevation (zenith), and resolution (meters per pixel). This was abstracted out from the shade application, which uses the algorithm described at: http://people.csail.mit.edu/bkph/papers/Hill-Shading.pdf

I (Steven Lambright) took the code, originally authored by Tracie Sucharski, from the shade program and re-implemented it in this class.

This class is re-entrant and const methods are thread-safe.

Author
2012-10-25 Steven Lambright
History:
2016-11-21 Makayla Shepherd - Corrected the shaded value algorithm in shadedValue. Fixes #4326.

Definition at line 31 of file Hillshade.h.

Constructor & Destructor Documentation

◆ Hillshade() [1/3]

Isis::Hillshade::Hillshade ( )

Create a default-constructed Hillshade.

You must use mutators to initialize this instance before it can be used to calculate shaded values.

Definition at line 18 of file Hillshade.cpp.

References m_azimuth, m_pixelResolution, m_zenith, and Isis::Null.

◆ Hillshade() [2/3]

Isis::Hillshade::Hillshade ( Angle  azimuth,
Angle  zenith,
double  resolution 
)

Construct and fully initialize a Hillshade.

This can immediately calculate shaded values.

See also
setAzimuth
setZenith
setResolution

Definition at line 32 of file Hillshade.cpp.

References azimuth(), m_azimuth, m_pixelResolution, m_zenith, Isis::Null, resolution(), setAzimuth(), setResolution(), setZenith(), and zenith().

◆ Hillshade() [3/3]

Isis::Hillshade::Hillshade ( const Hillshade other)

Copy constructor.

Definition at line 46 of file Hillshade.cpp.

References m_azimuth, m_pixelResolution, and m_zenith.

Member Function Documentation

◆ azimuth()

Angle Isis::Hillshade::azimuth ( ) const

Get the current azimuth angle.

See also
setAzimuth()

Definition at line 119 of file Hillshade.cpp.

References m_azimuth.

Referenced by Hillshade(), Isis::operator<<(), and setAzimuth().

◆ operator=()

Hillshade & Isis::Hillshade::operator= ( const Hillshade rhs)

Assignment operator.

This utilizes copy-and-swap.

Definition at line 298 of file Hillshade.cpp.

References swap().

◆ resolution()

double Isis::Hillshade::resolution ( ) const

Get the current resolution (meters per pixel).

See also
setResolution()

Definition at line 149 of file Hillshade.cpp.

References m_pixelResolution.

Referenced by Hillshade(), Isis::operator<<(), and setResolution().

◆ setAzimuth()

void Isis::Hillshade::setAzimuth ( Angle  azimuth)

The azimuth is the direction of the light.

0 is north; this angle rotates the sun.

An invalid angle will silently fail; if shadedValue() is called without a valid azimuth angle then an exception will be thrown.

Definition at line 76 of file Hillshade.cpp.

References azimuth(), Isis::Angle::isValid(), and m_azimuth.

Referenced by Hillshade().

◆ setResolution()

void Isis::Hillshade::setResolution ( double  resolution)

The resolution is the meters per pixel of the input to shadedValue().

A special pixel value will silently fail; if shadedValue() is called without a valid resolution angle then an exception will be thrown.

Definition at line 109 of file Hillshade.cpp.

References m_pixelResolution, and resolution().

Referenced by Hillshade().

◆ setZenith()

void Isis::Hillshade::setZenith ( Angle  zenith)

The zenith is the altitude/solar elevation of the light.

0 is directly above and 90 is the horizon; this angle raises and lowers the sun.

An invalid angle will silently fail; if shadedValue() is called without a valid zenith angle then an exception will be thrown.

Definition at line 93 of file Hillshade.cpp.

References Isis::Angle::isValid(), m_zenith, and zenith().

Referenced by Hillshade().

◆ shadedValue()

◆ swap()

void Isis::Hillshade::swap ( Hillshade other)

Swap class data with other; this cannot throw an exception.

Definition at line 288 of file Hillshade.cpp.

References m_azimuth, m_pixelResolution, and m_zenith.

Referenced by operator=().

◆ zenith()

Angle Isis::Hillshade::zenith ( ) const

Get the current zenith angle.

See also
setZenith()

Definition at line 134 of file Hillshade.cpp.

References m_zenith.

Referenced by Hillshade(), Isis::operator<<(), and setZenith().

Member Data Documentation

◆ m_azimuth

Angle* Isis::Hillshade::m_azimuth
private

This is direction of the light, with 0 at north.

Definition at line 55 of file Hillshade.h.

Referenced by azimuth(), Hillshade(), setAzimuth(), shadedValue(), and swap().

◆ m_pixelResolution

double Isis::Hillshade::m_pixelResolution
private

meters per pixel

Definition at line 59 of file Hillshade.h.

Referenced by Hillshade(), resolution(), setResolution(), shadedValue(), and swap().

◆ m_zenith

Angle* Isis::Hillshade::m_zenith
private

This is the altitide of the light, with 0 directly overhead and 90 at the horizon.

Definition at line 57 of file Hillshade.h.

Referenced by Hillshade(), setZenith(), shadedValue(), swap(), and zenith().


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