Skip to content
Permalink
Browse files

Add some useful methods to QgsAABB and QgsChunkNodeId

  • Loading branch information
wonder-sk authored and nyalldawson committed Oct 26, 2020
1 parent e248fff commit fea3c2173c0c7082cab83f1a74f75b62b871da2a
Showing with 18 additions and 0 deletions.
  1. +10 −0 src/3d/chunks/qgschunknode_p.h
  2. +5 −0 src/3d/qgsaabb.cpp
  3. +3 −0 src/3d/qgsaabb.h
@@ -67,6 +67,16 @@ struct QgsChunkNodeId
else
return QStringLiteral( "%1/%2/%3/%4" ).arg( d ).arg( x ).arg( y ).arg( z ); // octree
}

bool operator==( const QgsChunkNodeId &other ) const
{
return d == other.d && x == other.x && y == other.y && z == other.z;
}

bool operator!=( const QgsChunkNodeId &other ) const
{
return !(*this == other );
}
};

/**
@@ -92,3 +92,8 @@ QList<QVector3D> QgsAABB::verticesForLines() const
}
return vertices;
}

QString QgsAABB::toString() const
{
return QString( "X %1 - %2 Y %3 - %4 Z %5 - %6" ).arg( xMin ).arg( xMax ).arg( yMin ).arg( yMax ).arg( zMin ).arg( zMax );
}
@@ -75,6 +75,9 @@ class _3D_EXPORT QgsAABB
//! Returns a list of pairs of vertices (useful for display of bounding boxes)
QList<QVector3D> verticesForLines() const;

//! Return text representation of the bounding box
QString toString() const;

float xMin = 0.0f;
float yMin = 0.0f;
float zMin = 0.0f;

0 comments on commit fea3c21

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