Skip to content
Permalink
Browse files

Reapply cosmetical changes

  • Loading branch information
mhugent committed Jan 12, 2012
1 parent 278bd05 commit 878b04843df4babfd4d2856c679255683acbbe12
@@ -27,10 +27,11 @@ class ANALYSIS_EXPORT QgsAspectFilter: public QgsDerivativeFilter
QgsAspectFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat );
~QgsAspectFilter();

/**Calculates output value from nine input values. The input values and the output value can be equal to the \
/**Calculates output value from nine input values. The input values and the output value can be equal to the
nodata value if not present or outside of the border. Must be implemented by subclasses*/
float processNineCellWindow( float* x11, float* x21, float* x31, \
float* x12, float* x22, float* x32, float* x13, float* x23, float* x33 );
float processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
float* x13, float* x23, float* x33 );

};

@@ -17,8 +17,8 @@

#include "qgsderivativefilter.h"

QgsDerivativeFilter::QgsDerivativeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat ): \
QgsNineCellFilter( inputFile, outputFile, outputFormat )
QgsDerivativeFilter::QgsDerivativeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat )
: QgsNineCellFilter( inputFile, outputFile, outputFormat )
{

}
@@ -27,8 +27,9 @@ class QgsDerivativeFilter: public QgsNineCellFilter
QgsDerivativeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat );
virtual ~QgsDerivativeFilter();
//to be implemented by subclasses
virtual float processNineCellWindow( float* x11, float* x21, float* x31, float* x12, float* x22, \
float* x32, float* x13, float* x23, float* x33 ) = 0;
virtual float processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
float* x13, float* x23, float* x33 ) = 0;

protected:
/**Calculates the first order derivative in x-direction according to Horn (1981)*/
@@ -25,9 +25,9 @@
#define TO8(x) (x).toLocal8Bit().constData()
#endif

QgsNineCellFilter::QgsNineCellFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat ): \
mInputFile( inputFile ), mOutputFile( outputFile ), mOutputFormat( outputFormat ), mCellSizeX( -1 ), mCellSizeY( -1 ), \
mInputNodataValue( -1 ), mOutputNodataValue( -1 ), mZFactor( 1.0/*111120*/ )
QgsNineCellFilter::QgsNineCellFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat )
: mInputFile( inputFile ), mOutputFile( outputFile ), mOutputFormat( outputFormat ), mCellSizeX( -1 ), mCellSizeY( -1 ),
mInputNodataValue( -1 ), mOutputNodataValue( -1 ), mZFactor( 1.0 )
{

}
@@ -154,17 +154,17 @@ int QgsNineCellFilter::processRaster( QProgressDialog* p )
{
if ( j == 0 )
{
resultLine[j] = processNineCellWindow( &mInputNodataValue, &scanLine1[j], &scanLine1[j+1], &mInputNodataValue, &scanLine2[j], \
resultLine[j] = processNineCellWindow( &mInputNodataValue, &scanLine1[j], &scanLine1[j+1], &mInputNodataValue, &scanLine2[j],
&scanLine2[j+1], &mInputNodataValue, &scanLine3[j], &scanLine3[j+1] );
}
else if ( j == xSize - 1 )
{
resultLine[j] = processNineCellWindow( &scanLine1[j-1], &scanLine1[j], &mInputNodataValue, &scanLine2[j-1], &scanLine2[j], \
resultLine[j] = processNineCellWindow( &scanLine1[j-1], &scanLine1[j], &mInputNodataValue, &scanLine2[j-1], &scanLine2[j],
&mInputNodataValue, &scanLine3[j-1], &scanLine3[j], &mInputNodataValue );
}
else
{
resultLine[j] = processNineCellWindow( &scanLine1[j-1], &scanLine1[j], &scanLine1[j+1], &scanLine2[j-1], &scanLine2[j], \
resultLine[j] = processNineCellWindow( &scanLine1[j-1], &scanLine1[j], &scanLine1[j+1], &scanLine2[j-1], &scanLine2[j],
&scanLine2[j+1], &scanLine3[j-1], &scanLine3[j], &scanLine3[j+1] );
}
}
@@ -23,8 +23,8 @@

class QProgressDialog;

/**Base class for raster analysis methods that work with a 3x3 cell filter and calculate the value of each cell based on \
the cell value and the eight neighbour cells. Common examples are slope and aspect calculation in DEMs. Subclasses only implement \
/**Base class for raster analysis methods that work with a 3x3 cell filter and calculate the value of each cell based on
the cell value and the eight neighbour cells. Common examples are slope and aspect calculation in DEMs. Subclasses only implement
the method that calculates the new value from the nine values. Everything else (reading file, writing file) is done by this subclass*/

class ANALYSIS_EXPORT QgsNineCellFilter
@@ -47,14 +47,15 @@ class ANALYSIS_EXPORT QgsNineCellFilter
void setZFactor( double factor ) { mZFactor = factor; }

double inputNodataValue() const { return mInputNodataValue; }
void setInputNodataValue( double value ){ mInputNodataValue = value; }
void setInputNodataValue( double value ) { mInputNodataValue = value; }
double outputNodataValue() const { return mOutputNodataValue; }
void setOutputNodataValue( double value ){ mOutputNodataValue = value; }
void setOutputNodataValue( double value ) { mOutputNodataValue = value; }

/**Calculates output value from nine input values. The input values and the output value can be equal to the \
/**Calculates output value from nine input values. The input values and the output value can be equal to the
nodata value if not present or outside of the border. Must be implemented by subclasses*/
virtual float processNineCellWindow( float* x11, float* x21, float* x31, \
float* x12, float* x22, float* x32, float* x13, float* x23, float* x33 ) = 0;
virtual float processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
float* x13, float* x23, float* x33 ) = 0;

private:
//default constructor forbidden. We need input file, output file and format obligatory
@@ -33,7 +33,7 @@ QgsRuggednessFilter::~QgsRuggednessFilter()

}

float QgsRuggednessFilter::processNineCellWindow( float* x11, float* x21, float* x31, \
float QgsRuggednessFilter::processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32, float* x13, float* x23, float* x33 )
{
//the formula would be that easy without nodata values...
@@ -17,8 +17,8 @@

#include "qgsslopefilter.h"

QgsSlopeFilter::QgsSlopeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat ): \
QgsDerivativeFilter( inputFile, outputFile, outputFormat )
QgsSlopeFilter::QgsSlopeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat )
: QgsDerivativeFilter( inputFile, outputFile, outputFormat )
{

}
@@ -28,7 +28,7 @@ QgsSlopeFilter::~QgsSlopeFilter()

}

float QgsSlopeFilter::processNineCellWindow( float* x11, float* x21, float* x31, \
float QgsSlopeFilter::processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32, float* x13, float* x23, float* x33 )
{
float derX = calcFirstDerX( x11, x21, x31, x12, x22, x32, x13, x23, x33 );
@@ -27,10 +27,11 @@ class ANALYSIS_EXPORT QgsSlopeFilter: public QgsDerivativeFilter
QgsSlopeFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat );
~QgsSlopeFilter();

/**Calculates output value from nine input values. The input values and the output value can be equal to the \
/**Calculates output value from nine input values. The input values and the output value can be equal to the
nodata value if not present or outside of the border. Must be implemented by subclasses*/
float processNineCellWindow( float* x11, float* x21, float* x31, \
float* x12, float* x22, float* x32, float* x13, float* x23, float* x33 );
float processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
float* x13, float* x23, float* x33 );
};

#endif // QGSSLOPEFILTER_H
@@ -17,8 +17,8 @@

#include "qgstotalcurvaturefilter.h"

QgsTotalCurvatureFilter::QgsTotalCurvatureFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat ): \
QgsNineCellFilter( inputFile, outputFile, outputFormat )
QgsTotalCurvatureFilter::QgsTotalCurvatureFilter( const QString& inputFile, const QString& outputFile, const QString& outputFormat )
: QgsNineCellFilter( inputFile, outputFile, outputFormat )
{

}
@@ -28,12 +28,12 @@ QgsTotalCurvatureFilter::~QgsTotalCurvatureFilter()

}

float QgsTotalCurvatureFilter::processNineCellWindow( float* x11, float* x21, float* x31, float* x12, \
float QgsTotalCurvatureFilter::processNineCellWindow( float* x11, float* x21, float* x31, float* x12,
float* x22, float* x32, float* x13, float* x23, float* x33 )
{
//return nodata if one value is the nodata value
if ( *x11 == mInputNodataValue || *x21 == mInputNodataValue || *x31 == mInputNodataValue || *x12 == mInputNodataValue \
|| *x22 == mInputNodataValue || *x32 == mInputNodataValue || *x13 == mInputNodataValue || *x23 == mInputNodataValue \
if ( *x11 == mInputNodataValue || *x21 == mInputNodataValue || *x31 == mInputNodataValue || *x12 == mInputNodataValue
|| *x22 == mInputNodataValue || *x32 == mInputNodataValue || *x13 == mInputNodataValue || *x23 == mInputNodataValue
|| *x33 == mInputNodataValue )
{
return mOutputNodataValue;
@@ -28,10 +28,11 @@ class ANALYSIS_EXPORT QgsTotalCurvatureFilter: public QgsNineCellFilter
~QgsTotalCurvatureFilter();

protected:
/**Calculates total curvature from nine input values. The input values and the output value can be equal to the \
/**Calculates total curvature from nine input values. The input values and the output value can be equal to the
nodata value if not present or outside of the border. Must be implemented by subclasses*/
float processNineCellWindow( float* x11, float* x21, float* x31, \
float* x12, float* x22, float* x32, float* x13, float* x23, float* x33 );
float processNineCellWindow( float* x11, float* x21, float* x31,
float* x12, float* x22, float* x32,
float* x13, float* x23, float* x33 );
};

#endif // QGSTOTALCURVATUREFILTER_H

0 comments on commit 878b048

Please sign in to comment.
You can’t perform that action at this time.