mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Allow transform methods in QgsAbstractGeometry/QgsGeometry to also
transform z/m values via scale/translate arguments
This commit is contained in:
parent
2b5aca5518
commit
dd223d9b08
@ -234,10 +234,13 @@ class QgsAbstractGeometry
|
||||
transform.
|
||||
%End
|
||||
|
||||
virtual void transform( const QTransform &t ) = 0;
|
||||
virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0,
|
||||
double mTranslate = 0.0, double mScale = 1.0 ) = 0;
|
||||
%Docstring
|
||||
Transforms the geometry using a QTransform object
|
||||
\param t QTransform transformation
|
||||
Transforms the x and y components of the geometry using a QTransform object ``t``.
|
||||
|
||||
Optionally, the geometry's z values can be scaled via ``zScale`` and translated via ``zTranslate``.
|
||||
Similarly, m-values can be scaled via ``mScale`` and translated via ``mTranslate``.
|
||||
%End
|
||||
|
||||
virtual void draw( QPainter &p ) const = 0;
|
||||
|
@ -87,7 +87,7 @@ class QgsCircularString: QgsCurve
|
||||
|
||||
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
|
||||
bool transformZ = false );
|
||||
virtual void transform( const QTransform &t );
|
||||
virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );
|
||||
|
||||
virtual void addToPainterPath( QPainterPath &path ) const;
|
||||
|
||||
|
@ -112,7 +112,7 @@ class QgsCompoundCurve: QgsCurve
|
||||
|
||||
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
|
||||
bool transformZ = false );
|
||||
virtual void transform( const QTransform &t );
|
||||
virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );
|
||||
|
||||
virtual void addToPainterPath( QPainterPath &path ) const;
|
||||
|
||||
|
@ -131,7 +131,7 @@ Adds an interior ring to the geometry (takes ownership)
|
||||
|
||||
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
|
||||
bool transformZ = false );
|
||||
virtual void transform( const QTransform &t );
|
||||
virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );
|
||||
|
||||
|
||||
virtual bool insertVertex( QgsVertexId position, const QgsPoint &vertex );
|
||||
|
@ -566,9 +566,9 @@ Returns true if WKB of the geometry is of WKBMulti* type
|
||||
:rtype: QgsGeometry
|
||||
%End
|
||||
|
||||
OperationResult translate( double dx, double dy );
|
||||
OperationResult translate( double dx, double dy, double dz = 0.0, double dm = 0.0 );
|
||||
%Docstring
|
||||
Translates this geometry by dx, dy
|
||||
Translates this geometry by dx, dy, dz and dm.
|
||||
:return: OperationResult a result code: success or reason of failure
|
||||
:rtype: OperationResult
|
||||
%End
|
||||
@ -580,9 +580,13 @@ Returns true if WKB of the geometry is of WKBMulti* type
|
||||
:rtype: OperationResult
|
||||
%End
|
||||
|
||||
OperationResult transform( const QTransform &ct );
|
||||
OperationResult transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );
|
||||
%Docstring
|
||||
Transforms this geometry as described by QTransform ct
|
||||
Transforms the x and y components of the geometry using a QTransform object ``t``.
|
||||
|
||||
Optionally, the geometry's z values can be scaled via ``zScale`` and translated via ``zTranslate``.
|
||||
Similarly, m-values can be scaled via ``mScale`` and translated via ``mTranslate``.
|
||||
|
||||
:return: OperationResult a result code: success or reason of failure
|
||||
:rtype: OperationResult
|
||||
%End
|
||||
|
@ -83,7 +83,7 @@ Adds a geometry and takes ownership. Returns true in case of success.
|
||||
|
||||
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
|
||||
bool transformZ = false );
|
||||
virtual void transform( const QTransform &t );
|
||||
virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );
|
||||
|
||||
|
||||
virtual void draw( QPainter &p ) const;
|
||||
|
@ -225,7 +225,7 @@ Closes the line string by appending the first point to the end of the line, if i
|
||||
|
||||
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
|
||||
bool transformZ = false );
|
||||
virtual void transform( const QTransform &t );
|
||||
virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );
|
||||
|
||||
|
||||
virtual void addToPainterPath( QPainterPath &path ) const;
|
||||
|
@ -359,7 +359,7 @@ class QgsPoint: QgsAbstractGeometry
|
||||
|
||||
virtual void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
|
||||
bool transformZ = false );
|
||||
virtual void transform( const QTransform &t );
|
||||
virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );
|
||||
|
||||
virtual QgsCoordinateSequence coordinateSequence() const;
|
||||
|
||||
|
@ -262,10 +262,13 @@ class CORE_EXPORT QgsAbstractGeometry
|
||||
bool transformZ = false ) = 0;
|
||||
|
||||
/**
|
||||
* Transforms the geometry using a QTransform object
|
||||
* \param t QTransform transformation
|
||||
* Transforms the x and y components of the geometry using a QTransform object \a t.
|
||||
*
|
||||
* Optionally, the geometry's z values can be scaled via \a zScale and translated via \a zTranslate.
|
||||
* Similarly, m-values can be scaled via \a mScale and translated via \a mTranslate.
|
||||
*/
|
||||
virtual void transform( const QTransform &t ) = 0;
|
||||
virtual void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0,
|
||||
double mTranslate = 0.0, double mScale = 1.0 ) = 0;
|
||||
|
||||
/**
|
||||
* Draws the geometry using the specified QPainter.
|
||||
|
@ -559,17 +559,27 @@ void QgsCircularString::transform( const QgsCoordinateTransform &ct, QgsCoordina
|
||||
}
|
||||
}
|
||||
|
||||
void QgsCircularString::transform( const QTransform &t )
|
||||
void QgsCircularString::transform( const QTransform &t, double zTranslate, double zScale, double mTranslate, double mScale )
|
||||
{
|
||||
clearCache();
|
||||
|
||||
int nPoints = numPoints();
|
||||
bool hasZ = is3D();
|
||||
bool hasM = isMeasure();
|
||||
for ( int i = 0; i < nPoints; ++i )
|
||||
{
|
||||
qreal x, y;
|
||||
t.map( mX.at( i ), mY.at( i ), &x, &y );
|
||||
mX[i] = x;
|
||||
mY[i] = y;
|
||||
if ( hasZ )
|
||||
{
|
||||
mZ[i] = mZ.at( i ) * zScale + zTranslate;
|
||||
}
|
||||
if ( hasM )
|
||||
{
|
||||
mM[i] = mM.at( i ) * mScale + mTranslate;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,7 +76,7 @@ class CORE_EXPORT QgsCircularString: public QgsCurve
|
||||
void draw( QPainter &p ) const override;
|
||||
void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
|
||||
bool transformZ = false ) override;
|
||||
void transform( const QTransform &t ) override;
|
||||
void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 ) override;
|
||||
void addToPainterPath( QPainterPath &path ) const override;
|
||||
void drawAsPolygon( QPainter &p ) const override;
|
||||
bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) override;
|
||||
|
@ -509,11 +509,11 @@ void QgsCompoundCurve::transform( const QgsCoordinateTransform &ct, QgsCoordinat
|
||||
clearCache();
|
||||
}
|
||||
|
||||
void QgsCompoundCurve::transform( const QTransform &t )
|
||||
void QgsCompoundCurve::transform( const QTransform &t, double zTranslate, double zScale, double mTranslate, double mScale )
|
||||
{
|
||||
for ( QgsCurve *curve : qgis::as_const( mCurves ) )
|
||||
{
|
||||
curve->transform( t );
|
||||
curve->transform( t, zTranslate, zScale, mTranslate, mScale );
|
||||
}
|
||||
clearCache();
|
||||
}
|
||||
|
@ -99,7 +99,7 @@ class CORE_EXPORT QgsCompoundCurve: public QgsCurve
|
||||
void draw( QPainter &p ) const override;
|
||||
void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
|
||||
bool transformZ = false ) override;
|
||||
void transform( const QTransform &t ) override;
|
||||
void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 ) override;
|
||||
void addToPainterPath( QPainterPath &path ) const override;
|
||||
void drawAsPolygon( QPainter &p ) const override;
|
||||
bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) override;
|
||||
|
@ -704,16 +704,16 @@ void QgsCurvePolygon::transform( const QgsCoordinateTransform &ct, QgsCoordinate
|
||||
clearCache();
|
||||
}
|
||||
|
||||
void QgsCurvePolygon::transform( const QTransform &t )
|
||||
void QgsCurvePolygon::transform( const QTransform &t, double zTranslate, double zScale, double mTranslate, double mScale )
|
||||
{
|
||||
if ( mExteriorRing )
|
||||
{
|
||||
mExteriorRing->transform( t );
|
||||
mExteriorRing->transform( t, zTranslate, zScale, mTranslate, mScale );
|
||||
}
|
||||
|
||||
for ( QgsCurve *curve : qgis::as_const( mInteriorRings ) )
|
||||
{
|
||||
curve->transform( t );
|
||||
curve->transform( t, zTranslate, zScale, mTranslate, mScale );
|
||||
}
|
||||
clearCache();
|
||||
}
|
||||
|
@ -111,7 +111,7 @@ class CORE_EXPORT QgsCurvePolygon: public QgsSurface
|
||||
void draw( QPainter &p ) const override;
|
||||
void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
|
||||
bool transformZ = false ) override;
|
||||
void transform( const QTransform &t ) override;
|
||||
void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 ) override;
|
||||
|
||||
bool insertVertex( QgsVertexId position, const QgsPoint &vertex ) override;
|
||||
bool moveVertex( QgsVertexId position, const QgsPoint &newPos ) override;
|
||||
|
@ -752,7 +752,7 @@ QgsGeometry::OperationResult QgsGeometry::addPart( GEOSGeometry *newPart )
|
||||
return QgsGeometryEditUtils::addPart( d->geometry.get(), std::move( geom ) );
|
||||
}
|
||||
|
||||
QgsGeometry::OperationResult QgsGeometry::translate( double dx, double dy )
|
||||
QgsGeometry::OperationResult QgsGeometry::translate( double dx, double dy, double dz, double dm )
|
||||
{
|
||||
if ( !d->geometry )
|
||||
{
|
||||
@ -761,7 +761,7 @@ QgsGeometry::OperationResult QgsGeometry::translate( double dx, double dy )
|
||||
|
||||
detach();
|
||||
|
||||
d->geometry->transform( QTransform::fromTranslate( dx, dy ) );
|
||||
d->geometry->transform( QTransform::fromTranslate( dx, dy ), dz, 1.0, dm );
|
||||
return QgsGeometry::Success;
|
||||
}
|
||||
|
||||
@ -2308,7 +2308,7 @@ QgsGeometry::OperationResult QgsGeometry::transform( const QgsCoordinateTransfor
|
||||
return QgsGeometry::Success;
|
||||
}
|
||||
|
||||
QgsGeometry::OperationResult QgsGeometry::transform( const QTransform &ct )
|
||||
QgsGeometry::OperationResult QgsGeometry::transform( const QTransform &ct, double zTranslate, double zScale, double mTranslate, double mScale )
|
||||
{
|
||||
if ( !d->geometry )
|
||||
{
|
||||
@ -2316,7 +2316,7 @@ QgsGeometry::OperationResult QgsGeometry::transform( const QTransform &ct )
|
||||
}
|
||||
|
||||
detach();
|
||||
d->geometry->transform( ct );
|
||||
d->geometry->transform( ct, zTranslate, zScale, mTranslate, mScale );
|
||||
return QgsGeometry::Success;
|
||||
}
|
||||
|
||||
|
@ -624,10 +624,10 @@ class CORE_EXPORT QgsGeometry
|
||||
QgsGeometry removeInteriorRings( double minimumAllowedArea = -1 ) const;
|
||||
|
||||
/**
|
||||
* Translates this geometry by dx, dy
|
||||
* Translates this geometry by dx, dy, dz and dm.
|
||||
* \returns OperationResult a result code: success or reason of failure
|
||||
*/
|
||||
OperationResult translate( double dx, double dy );
|
||||
OperationResult translate( double dx, double dy, double dz = 0.0, double dm = 0.0 );
|
||||
|
||||
/**
|
||||
* Transforms this geometry as described by CoordinateTransform ct
|
||||
@ -636,10 +636,14 @@ class CORE_EXPORT QgsGeometry
|
||||
OperationResult transform( const QgsCoordinateTransform &ct );
|
||||
|
||||
/**
|
||||
* Transforms this geometry as described by QTransform ct
|
||||
* Transforms the x and y components of the geometry using a QTransform object \a t.
|
||||
*
|
||||
* Optionally, the geometry's z values can be scaled via \a zScale and translated via \a zTranslate.
|
||||
* Similarly, m-values can be scaled via \a mScale and translated via \a mTranslate.
|
||||
*
|
||||
* \returns OperationResult a result code: success or reason of failure
|
||||
*/
|
||||
OperationResult transform( const QTransform &ct );
|
||||
OperationResult transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 );
|
||||
|
||||
/**
|
||||
* Rotate this geometry around the Z axis
|
||||
|
@ -241,11 +241,11 @@ void QgsGeometryCollection::transform( const QgsCoordinateTransform &ct, QgsCoor
|
||||
clearCache(); //set bounding box invalid
|
||||
}
|
||||
|
||||
void QgsGeometryCollection::transform( const QTransform &t )
|
||||
void QgsGeometryCollection::transform( const QTransform &t, double zTranslate, double zScale, double mTranslate, double mScale )
|
||||
{
|
||||
for ( QgsAbstractGeometry *g : qgis::as_const( mGeometries ) )
|
||||
{
|
||||
g->transform( t );
|
||||
g->transform( t, zTranslate, zScale, mTranslate, mScale );
|
||||
}
|
||||
clearCache(); //set bounding box invalid
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ class CORE_EXPORT QgsGeometryCollection: public QgsAbstractGeometry
|
||||
|
||||
void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
|
||||
bool transformZ = false ) override;
|
||||
void transform( const QTransform &t ) override;
|
||||
void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 ) override;
|
||||
|
||||
void draw( QPainter &p ) const override;
|
||||
|
||||
|
@ -772,15 +772,25 @@ void QgsLineString::transform( const QgsCoordinateTransform &ct, QgsCoordinateTr
|
||||
clearCache();
|
||||
}
|
||||
|
||||
void QgsLineString::transform( const QTransform &t )
|
||||
void QgsLineString::transform( const QTransform &t, double zTranslate, double zScale, double mTranslate, double mScale )
|
||||
{
|
||||
int nPoints = numPoints();
|
||||
bool hasZ = is3D();
|
||||
bool hasM = isMeasure();
|
||||
for ( int i = 0; i < nPoints; ++i )
|
||||
{
|
||||
qreal x, y;
|
||||
t.map( mX.at( i ), mY.at( i ), &x, &y );
|
||||
mX[i] = x;
|
||||
mY[i] = y;
|
||||
if ( hasZ )
|
||||
{
|
||||
mZ[i] = mZ.at( i ) * zScale + zTranslate;
|
||||
}
|
||||
if ( hasM )
|
||||
{
|
||||
mM[i] = mM.at( i ) * mScale + mTranslate;
|
||||
}
|
||||
}
|
||||
clearCache();
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ class CORE_EXPORT QgsLineString: public QgsCurve
|
||||
|
||||
void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
|
||||
bool transformZ = false ) override;
|
||||
void transform( const QTransform &t ) override;
|
||||
void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 ) override;
|
||||
|
||||
void addToPainterPath( QPainterPath &path ) const override;
|
||||
void drawAsPolygon( QPainter &p ) const override;
|
||||
|
@ -494,13 +494,22 @@ bool QgsPoint::addMValue( double mValue )
|
||||
return true;
|
||||
}
|
||||
|
||||
void QgsPoint::transform( const QTransform &t )
|
||||
void QgsPoint::transform( const QTransform &t, double zTranslate, double zScale, double mTranslate, double mScale )
|
||||
{
|
||||
clearCache();
|
||||
qreal x, y;
|
||||
t.map( mX, mY, &x, &y );
|
||||
mX = x;
|
||||
mY = y;
|
||||
|
||||
if ( is3D() )
|
||||
{
|
||||
mZ = mZ * zScale + zTranslate;
|
||||
}
|
||||
if ( isMeasure() )
|
||||
{
|
||||
mM = mM * mScale + mTranslate;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -403,7 +403,7 @@ class CORE_EXPORT QgsPoint: public QgsAbstractGeometry
|
||||
void draw( QPainter &p ) const override;
|
||||
void transform( const QgsCoordinateTransform &ct, QgsCoordinateTransform::TransformDirection d = QgsCoordinateTransform::ForwardTransform,
|
||||
bool transformZ = false ) override;
|
||||
void transform( const QTransform &t ) override;
|
||||
void transform( const QTransform &t, double zTranslate = 0.0, double zScale = 1.0, double mTranslate = 0.0, double mScale = 1.0 ) override;
|
||||
QgsCoordinateSequence coordinateSequence() const override;
|
||||
int nCoordinates() const override;
|
||||
int vertexNumberFromVertexId( QgsVertexId id ) const override;
|
||||
|
@ -738,6 +738,8 @@ void TestQgsGeometry::point()
|
||||
QgsPoint p17( QgsWkbTypes::PointZM, 10, 20, 30, 40 );
|
||||
p17.transform( qtr );
|
||||
QVERIFY( p17 == QgsPoint( QgsWkbTypes::PointZM, 20, 60, 30, 40 ) );
|
||||
p17.transform( QTransform::fromScale( 1, 1 ), 11, 2, 3, 4 );
|
||||
QVERIFY( p17 == QgsPoint( QgsWkbTypes::PointZM, 20, 60, 71, 163 ) );
|
||||
|
||||
//coordinateSequence
|
||||
QgsPoint p18( QgsWkbTypes::PointZM, 1.0, 2.0, 3.0, 4.0 );
|
||||
@ -1644,6 +1646,12 @@ void TestQgsGeometry::circularString()
|
||||
QCOMPARE( l23.pointN( 1 ), QgsPoint( QgsWkbTypes::PointZM, 22, 36, 13, 14 ) );
|
||||
QCOMPARE( l23.boundingBox(), QgsRectangle( 2, 6, 22, 36 ) );
|
||||
|
||||
l23.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 )
|
||||
<< QgsPoint( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) );
|
||||
l23.transform( QTransform::fromScale( 1, 1 ), 3, 2, 4, 3 );
|
||||
QCOMPARE( l23.pointN( 0 ), QgsPoint( QgsWkbTypes::PointZM, 1, 2, 9, 16 ) );
|
||||
QCOMPARE( l23.pointN( 1 ), QgsPoint( QgsWkbTypes::PointZM, 11, 12, 29, 46 ) );
|
||||
|
||||
//insert vertex
|
||||
//cannot insert vertex in empty line
|
||||
QgsCircularString l24;
|
||||
@ -3318,6 +3326,12 @@ void TestQgsGeometry::lineString()
|
||||
QCOMPARE( l23.pointN( 1 ), QgsPoint( QgsWkbTypes::PointZM, 22, 36, 13, 14 ) );
|
||||
QCOMPARE( l23.boundingBox(), QgsRectangle( 2, 6, 22, 36 ) );
|
||||
|
||||
l23.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 1, 2, 3, 4 )
|
||||
<< QgsPoint( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) );
|
||||
l23.transform( QTransform::fromScale( 1, 1 ), 3, 2, 4, 3 );
|
||||
QCOMPARE( l23.pointN( 0 ), QgsPoint( QgsWkbTypes::PointZM, 1, 2, 9, 16 ) );
|
||||
QCOMPARE( l23.pointN( 1 ), QgsPoint( QgsWkbTypes::PointZM, 11, 12, 29, 46 ) );
|
||||
|
||||
//insert vertex
|
||||
|
||||
//insert vertex in empty line
|
||||
@ -5175,25 +5189,25 @@ void TestQgsGeometry::polygon()
|
||||
QgsPolygon pTransform2;
|
||||
pTransform2.setExteriorRing( l23.clone() );
|
||||
pTransform2.addInteriorRing( l23.clone() );
|
||||
pTransform2.transform( qtr );
|
||||
pTransform2.transform( qtr, 2, 3, 4, 5 );
|
||||
|
||||
extR = static_cast< const QgsLineString * >( pTransform2.exteriorRing() );
|
||||
QGSCOMPARENEAR( extR->pointN( 0 ).x(), 2, 100 );
|
||||
QGSCOMPARENEAR( extR->pointN( 0 ).y(), 6, 100 );
|
||||
QGSCOMPARENEAR( extR->pointN( 0 ).z(), 3.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 0 ).m(), 4.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 0 ).z(), 11.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 0 ).m(), 24.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 1 ).x(), 22, 100 );
|
||||
QGSCOMPARENEAR( extR->pointN( 1 ).y(), 36, 100 );
|
||||
QGSCOMPARENEAR( extR->pointN( 1 ).z(), 13.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 1 ).m(), 14.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 1 ).z(), 41.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 1 ).m(), 74.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 2 ).x(), 2, 100 );
|
||||
QGSCOMPARENEAR( extR->pointN( 2 ).y(), 36, 100 );
|
||||
QGSCOMPARENEAR( extR->pointN( 2 ).z(), 23.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 2 ).m(), 24.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 2 ).z(), 71.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 2 ).m(), 124.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 3 ).x(), 2, 100 );
|
||||
QGSCOMPARENEAR( extR->pointN( 3 ).y(), 6, 100 );
|
||||
QGSCOMPARENEAR( extR->pointN( 3 ).z(), 3.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 3 ).m(), 4.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 3 ).z(), 11.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 3 ).m(), 24.0, 0.001 );
|
||||
QGSCOMPARENEAR( pTransform2.exteriorRing()->boundingBox().xMinimum(), 2, 0.001 );
|
||||
QGSCOMPARENEAR( pTransform2.exteriorRing()->boundingBox().yMinimum(), 6, 0.001 );
|
||||
QGSCOMPARENEAR( pTransform2.exteriorRing()->boundingBox().xMaximum(), 22, 0.001 );
|
||||
@ -5201,20 +5215,20 @@ void TestQgsGeometry::polygon()
|
||||
intR = static_cast< const QgsLineString * >( pTransform2.interiorRing( 0 ) );
|
||||
QGSCOMPARENEAR( intR->pointN( 0 ).x(), 2, 100 );
|
||||
QGSCOMPARENEAR( intR->pointN( 0 ).y(), 6, 100 );
|
||||
QGSCOMPARENEAR( intR->pointN( 0 ).z(), 3.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 0 ).m(), 4.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 0 ).z(), 11.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 0 ).m(), 24.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 1 ).x(), 22, 100 );
|
||||
QGSCOMPARENEAR( intR->pointN( 1 ).y(), 36, 100 );
|
||||
QGSCOMPARENEAR( intR->pointN( 1 ).z(), 13.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 1 ).m(), 14.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 1 ).z(), 41.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 1 ).m(), 74.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 2 ).x(), 2, 100 );
|
||||
QGSCOMPARENEAR( intR->pointN( 2 ).y(), 36, 100 );
|
||||
QGSCOMPARENEAR( intR->pointN( 2 ).z(), 23.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 2 ).m(), 24.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 2 ).z(), 71.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 2 ).m(), 124.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 3 ).x(), 2, 100 );
|
||||
QGSCOMPARENEAR( intR->pointN( 3 ).y(), 6, 100 );
|
||||
QGSCOMPARENEAR( intR->pointN( 3 ).z(), 3.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 3 ).m(), 4.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 3 ).z(), 11.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 3 ).m(), 24.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->boundingBox().xMinimum(), 2, 0.001 );
|
||||
QGSCOMPARENEAR( intR->boundingBox().yMinimum(), 6, 0.001 );
|
||||
QGSCOMPARENEAR( intR->boundingBox().xMaximum(), 22, 0.001 );
|
||||
@ -9309,13 +9323,13 @@ void TestQgsGeometry::compoundCurve()
|
||||
QgsLineString ls23;
|
||||
ls23.setPoints( QgsPointSequence() << QgsPoint( QgsWkbTypes::PointZM, 11, 12, 13, 14 ) << QgsPoint( QgsWkbTypes::PointZM, 21, 13, 13, 14 ) );
|
||||
c23.addCurve( ls23.clone() );
|
||||
c23.transform( qtr );
|
||||
c23.transform( qtr, 5, 2, 4, 3 );
|
||||
c23.pointAt( 0, pt, v );
|
||||
QCOMPARE( pt, QgsPoint( QgsWkbTypes::PointZM, 2, 6, 3, 4 ) );
|
||||
QCOMPARE( pt, QgsPoint( QgsWkbTypes::PointZM, 2, 6, 11, 16 ) );
|
||||
c23.pointAt( 1, pt, v );
|
||||
QCOMPARE( pt, QgsPoint( QgsWkbTypes::PointZM, 22, 36, 13, 14 ) );
|
||||
QCOMPARE( pt, QgsPoint( QgsWkbTypes::PointZM, 22, 36, 31, 46 ) );
|
||||
c23.pointAt( 2, pt, v );
|
||||
QCOMPARE( pt, QgsPoint( QgsWkbTypes::PointZM, 42, 39, 13, 14 ) );
|
||||
QCOMPARE( pt, QgsPoint( QgsWkbTypes::PointZM, 42, 39, 31, 46 ) );
|
||||
QCOMPARE( c23.boundingBox(), QgsRectangle( 2, 6, 42, 39 ) );
|
||||
|
||||
//insert vertex
|
||||
@ -14144,25 +14158,25 @@ void TestQgsGeometry::geometryCollection()
|
||||
QgsGeometryCollection pTransform2;
|
||||
pTransform2.addGeometry( l23.clone() );
|
||||
pTransform2.addGeometry( l23.clone() );
|
||||
pTransform2.transform( qtr );
|
||||
pTransform2.transform( qtr, 3, 2, 6, 3 );
|
||||
|
||||
extR = static_cast< const QgsLineString * >( pTransform2.geometryN( 0 ) );
|
||||
QGSCOMPARENEAR( extR->pointN( 0 ).x(), 2, 100 );
|
||||
QGSCOMPARENEAR( extR->pointN( 0 ).y(), 6, 100 );
|
||||
QGSCOMPARENEAR( extR->pointN( 0 ).z(), 3.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 0 ).m(), 4.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 0 ).z(), 9.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 0 ).m(), 18.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 1 ).x(), 22, 100 );
|
||||
QGSCOMPARENEAR( extR->pointN( 1 ).y(), 36, 100 );
|
||||
QGSCOMPARENEAR( extR->pointN( 1 ).z(), 13.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 1 ).m(), 14.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 1 ).z(), 29.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 1 ).m(), 48.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 2 ).x(), 2, 100 );
|
||||
QGSCOMPARENEAR( extR->pointN( 2 ).y(), 36, 100 );
|
||||
QGSCOMPARENEAR( extR->pointN( 2 ).z(), 23.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 2 ).m(), 24.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 2 ).z(), 49.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 2 ).m(), 78.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 3 ).x(), 2, 100 );
|
||||
QGSCOMPARENEAR( extR->pointN( 3 ).y(), 6, 100 );
|
||||
QGSCOMPARENEAR( extR->pointN( 3 ).z(), 3.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 3 ).m(), 4.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 3 ).z(), 9.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->pointN( 3 ).m(), 18.0, 0.001 );
|
||||
QGSCOMPARENEAR( extR->boundingBox().xMinimum(), 2, 0.001 );
|
||||
QGSCOMPARENEAR( extR->boundingBox().yMinimum(), 6, 0.001 );
|
||||
QGSCOMPARENEAR( extR->boundingBox().xMaximum(), 22, 0.001 );
|
||||
@ -14170,20 +14184,20 @@ void TestQgsGeometry::geometryCollection()
|
||||
intR = static_cast< const QgsLineString * >( pTransform2.geometryN( 1 ) );
|
||||
QGSCOMPARENEAR( intR->pointN( 0 ).x(), 2, 100 );
|
||||
QGSCOMPARENEAR( intR->pointN( 0 ).y(), 6, 100 );
|
||||
QGSCOMPARENEAR( intR->pointN( 0 ).z(), 3.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 0 ).m(), 4.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 0 ).z(), 9.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 0 ).m(), 18.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 1 ).x(), 22, 100 );
|
||||
QGSCOMPARENEAR( intR->pointN( 1 ).y(), 36, 100 );
|
||||
QGSCOMPARENEAR( intR->pointN( 1 ).z(), 13.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 1 ).m(), 14.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 1 ).z(), 29.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 1 ).m(), 48.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 2 ).x(), 2, 100 );
|
||||
QGSCOMPARENEAR( intR->pointN( 2 ).y(), 36, 100 );
|
||||
QGSCOMPARENEAR( intR->pointN( 2 ).z(), 23.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 2 ).m(), 24.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 2 ).z(), 49.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 2 ).m(), 78.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 3 ).x(), 2, 100 );
|
||||
QGSCOMPARENEAR( intR->pointN( 3 ).y(), 6, 100 );
|
||||
QGSCOMPARENEAR( intR->pointN( 3 ).z(), 3.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 3 ).m(), 4.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 3 ).z(), 9.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->pointN( 3 ).m(), 18.0, 0.001 );
|
||||
QGSCOMPARENEAR( intR->boundingBox().xMinimum(), 2, 0.001 );
|
||||
QGSCOMPARENEAR( intR->boundingBox().yMinimum(), 6, 0.001 );
|
||||
QGSCOMPARENEAR( intR->boundingBox().xMaximum(), 22, 0.001 );
|
||||
|
Loading…
x
Reference in New Issue
Block a user