Skip to content
Permalink
Browse files

Update indentation

  • Loading branch information
nyalldawson committed Jan 29, 2017
1 parent 548461a commit c96a32aadf4c4f66c5641b820a0e211839fa2864
Showing with 44 additions and 44 deletions.
  1. +22 −22 src/core/geometry/qgspointv2.cpp
  2. +1 −1 src/core/geometry/qgspointv2.h
  3. +1 −1 src/core/qgsexpression.cpp
  4. +20 −20 tests/src/core/testqgsgeometry.cpp
@@ -466,31 +466,31 @@ double QgsPointV2::azimuth( const QgsPointV2& other ) const

QgsPointV2 QgsPointV2::project( double distance, double azimuth, double inclination ) const
{
QgsWkbTypes::Type pType(QgsWkbTypes::Point);
QgsWkbTypes::Type pType( QgsWkbTypes::Point );

double rads_xy = azimuth * M_PI / 180.0;
double dx = 0.0, dy = 0.0, dz = 0.0;
double radsXy = azimuth * M_PI / 180.0;
double dx = 0.0, dy = 0.0, dz = 0.0;

inclination = fmod( inclination, 360.0 );
inclination = fmod( inclination, 360.0 );

if ( !is3D() && qgsDoubleNear(inclination, 90.0) )
{
dx = distance * sin( rads_xy );
dy = distance * cos( rads_xy );
}
else
{
pType = QgsWkbTypes::addZ( pType );
double rads_z = inclination * M_PI / 180.0;
dx = distance * sin( rads_z ) * sin( rads_xy );
dy = distance * sin( rads_z ) * cos( rads_xy );
dz = distance * cos( rads_z );
}
if ( !is3D() && qgsDoubleNear( inclination, 90.0 ) )
{
dx = distance * sin( radsXy );
dy = distance * cos( radsXy );
}
else
{
pType = QgsWkbTypes::addZ( pType );
double radsZ = inclination * M_PI / 180.0;
dx = distance * sin( radsZ ) * sin( radsXy );
dy = distance * sin( radsZ ) * cos( radsXy );
dz = distance * cos( radsZ );
}

if ( isMeasure() )
{
pType = QgsWkbTypes::addM( pType );
}
if ( isMeasure() )
{
pType = QgsWkbTypes::addM( pType );
}

return QgsPointV2( pType, mX + dx, mY + dy, mZ + dz, mM );
return QgsPointV2( pType, mX + dx, mY + dy, mZ + dz, mM );
}
@@ -220,7 +220,7 @@ class CORE_EXPORT QgsPointV2: public QgsAbstractGeometry
* \endcode
* @note added in QGIS 3.0
*/
QgsPointV2 project(double distance, double azimuth, double inclination = 90.0 ) const;
QgsPointV2 project( double distance, double azimuth, double inclination = 90.0 ) const;

/**
* Calculates the vector obtained by subtracting a point from this point.
@@ -2768,7 +2768,7 @@ static QVariant fcnProject( const QVariantList& values, const QgsExpressionConte
const QgsPointV2* p = dynamic_cast<const QgsPointV2*>( geom.geometry() );
QgsPointV2 newPoint = p->project( distance, 180.0 * azimuth / M_PI, 180.0 * inclination / M_PI );

return QVariant::fromValue( QgsGeometry( new QgsPointV2( newPoint) ) );
return QVariant::fromValue( QgsGeometry( new QgsPointV2( newPoint ) ) );
}

static QVariant fcnExtrude( const QVariantList& values, const QgsExpressionContext*, QgsExpression* parent )
@@ -867,28 +867,28 @@ void TestQgsGeometry::point()

// 3D
QgsPointV2 p34 = QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 2 );
QCOMPARE( p34.project( 1, 0 ), QgsPointV2(QgsWkbTypes::PointZ, 1, 3, 2 ) );
QCOMPARE( p34.project( 1, 0, 0 ), QgsPointV2(QgsWkbTypes::PointZ, 1, 2, 3 ) );
QCOMPARE( p34.project( 1.5, 90 ), QgsPointV2(QgsWkbTypes::PointZ, 2.5, 2, 2 ) );
QCOMPARE( p34.project( 1.5, 90, 90 ), QgsPointV2(QgsWkbTypes::PointZ, 2.5, 2, 2 ) );
QCOMPARE( p34.project( 2, 180 ), QgsPointV2(QgsWkbTypes::PointZ, 1, 0, 2 ) );
QCOMPARE( p34.project( 2, 180, 180 ), QgsPointV2(QgsWkbTypes::PointZ, 1, 2, 0 ) );
QCOMPARE( p34.project( 5, 270 ), QgsPointV2(QgsWkbTypes::PointZ, -4, 2, 2 ) );
QCOMPARE( p34.project( 5, 270, 270 ), QgsPointV2(QgsWkbTypes::PointZ, 6, 2, 2 ) );
QCOMPARE( p34.project( 6, 360 ), QgsPointV2(QgsWkbTypes::PointZ, 1, 8, 2 ) );
QCOMPARE( p34.project( 6, 360, 360 ), QgsPointV2(QgsWkbTypes::PointZ, 1, 2, 8 ) );
QCOMPARE( p34.project( 5, 450 ), QgsPointV2(QgsWkbTypes::PointZ, 6, 2, 2 ) );
QCOMPARE( p34.project( 5, 450, 450 ), QgsPointV2(QgsWkbTypes::PointZ, 6, 2, 2 ) );
QCOMPARE( p34.project( -1, 0 ), QgsPointV2(QgsWkbTypes::PointZ, 1, 1, 2 ) );
QCOMPARE( p34.project( -1, 0, 0 ), QgsPointV2(QgsWkbTypes::PointZ, 1, 2, 1 ) );
QCOMPARE( p34.project( 1.5, -90 ), QgsPointV2(QgsWkbTypes::PointZ, -0.5, 2, 2 ) );
QCOMPARE( p34.project( 1.5, -90, -90 ), QgsPointV2(QgsWkbTypes::PointZ, 2.5, 2, 2 ) );
QCOMPARE( p34.project( 1, 0 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 3, 2 ) );
QCOMPARE( p34.project( 1, 0, 0 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 3 ) );
QCOMPARE( p34.project( 1.5, 90 ), QgsPointV2( QgsWkbTypes::PointZ, 2.5, 2, 2 ) );
QCOMPARE( p34.project( 1.5, 90, 90 ), QgsPointV2( QgsWkbTypes::PointZ, 2.5, 2, 2 ) );
QCOMPARE( p34.project( 2, 180 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 0, 2 ) );
QCOMPARE( p34.project( 2, 180, 180 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 0 ) );
QCOMPARE( p34.project( 5, 270 ), QgsPointV2( QgsWkbTypes::PointZ, -4, 2, 2 ) );
QCOMPARE( p34.project( 5, 270, 270 ), QgsPointV2( QgsWkbTypes::PointZ, 6, 2, 2 ) );
QCOMPARE( p34.project( 6, 360 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 8, 2 ) );
QCOMPARE( p34.project( 6, 360, 360 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 8 ) );
QCOMPARE( p34.project( 5, 450 ), QgsPointV2( QgsWkbTypes::PointZ, 6, 2, 2 ) );
QCOMPARE( p34.project( 5, 450, 450 ), QgsPointV2( QgsWkbTypes::PointZ, 6, 2, 2 ) );
QCOMPARE( p34.project( -1, 0 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 1, 2 ) );
QCOMPARE( p34.project( -1, 0, 0 ), QgsPointV2( QgsWkbTypes::PointZ, 1, 2, 1 ) );
QCOMPARE( p34.project( 1.5, -90 ), QgsPointV2( QgsWkbTypes::PointZ, -0.5, 2, 2 ) );
QCOMPARE( p34.project( 1.5, -90, -90 ), QgsPointV2( QgsWkbTypes::PointZ, 2.5, 2, 2 ) );
// PointM
p34.addMValue( 5.0 );
QCOMPARE( p34.project( 1, 0 ), QgsPointV2(QgsWkbTypes::PointZM, 1, 3, 2, 5 ) );
QCOMPARE( p34.project( 1, 0, 0 ), QgsPointV2(QgsWkbTypes::PointZM, 1, 2, 3, 5 ) );
QCOMPARE( p34.project( 5, 450 ), QgsPointV2(QgsWkbTypes::PointZM, 6, 2, 2, 5 ) );
QCOMPARE( p34.project( 5, 450, 450 ), QgsPointV2(QgsWkbTypes::PointZM, 6, 2, 2, 5 ) );
QCOMPARE( p34.project( 1, 0 ), QgsPointV2( QgsWkbTypes::PointZM, 1, 3, 2, 5 ) );
QCOMPARE( p34.project( 1, 0, 0 ), QgsPointV2( QgsWkbTypes::PointZM, 1, 2, 3, 5 ) );
QCOMPARE( p34.project( 5, 450 ), QgsPointV2( QgsWkbTypes::PointZM, 6, 2, 2, 5 ) );
QCOMPARE( p34.project( 5, 450, 450 ), QgsPointV2( QgsWkbTypes::PointZM, 6, 2, 2, 5 ) );

}

0 comments on commit c96a32a

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