Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Reapply cosmetical changes
  • Loading branch information
mhugent committed Jan 12, 2012
1 parent 278bd05 commit 878b048
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 35 deletions.
7 changes: 4 additions & 3 deletions src/analysis/raster/qgsaspectfilter.h
Expand Up @@ -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 );

};

Expand Down
4 changes: 2 additions & 2 deletions src/analysis/raster/qgsderivativefilter.cpp
Expand Up @@ -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 )
{

}
Expand Down
5 changes: 3 additions & 2 deletions src/analysis/raster/qgsderivativefilter.h
Expand Up @@ -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)*/
Expand Down
12 changes: 6 additions & 6 deletions src/analysis/raster/qgsninecellfilter.cpp
Expand Up @@ -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 )
{

}
Expand Down Expand Up @@ -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] );
}
}
Expand Down
15 changes: 8 additions & 7 deletions src/analysis/raster/qgsninecellfilter.h
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/raster/qgsruggednessfilter.cpp
Expand Up @@ -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...
Expand Down
6 changes: 3 additions & 3 deletions src/analysis/raster/qgsslopefilter.cpp
Expand Up @@ -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 )
{

}
Expand All @@ -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 );
Expand Down
7 changes: 4 additions & 3 deletions src/analysis/raster/qgsslopefilter.h
Expand Up @@ -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
10 changes: 5 additions & 5 deletions src/analysis/raster/qgstotalcurvaturefilter.cpp
Expand Up @@ -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 )
{

}
Expand All @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions src/analysis/raster/qgstotalcurvaturefilter.h
Expand Up @@ -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.