Skip to content

Commit

Permalink
fix some checks and building
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik authored and nyalldawson committed Oct 26, 2020
1 parent 539f235 commit 29113a8
Show file tree
Hide file tree
Showing 17 changed files with 142 additions and 102 deletions.
3 changes: 2 additions & 1 deletion cmake/FindLazPerf.cmake
Expand Up @@ -26,5 +26,6 @@ MARK_AS_ADVANCED(LazPerf_INCLUDE_DIR)
IF (LazPerf_FOUND)
MESSAGE(STATUS "Found laz-perf: ${LazPerf_INCLUDE_DIR}")
ELSE (LazPerf_FOUND)
MESSAGE(FATAL_ERROR "Could not find laz-perf")
# optional dependency only
MESSAGE(STATUS "Could not find laz-perf")
ENDIF (LazPerf_FOUND)
2 changes: 1 addition & 1 deletion cmake/FindZSTD.cmake
Expand Up @@ -30,5 +30,5 @@ MARK_AS_ADVANCED(ZSTD_LIBRARY ZSTD_INCLUDE_DIR)
IF (ZSTD_FOUND)
MESSAGE(STATUS "Found ZSTD: ${ZSTD_LIBRARY}")
ELSE (ZSTD_FOUND)
MESSAGE(FATAL_ERROR "Could not find ZSTD")
MESSAGE(STATUS "Could not find ZSTD")
ENDIF (ZSTD_FOUND)
4 changes: 3 additions & 1 deletion python/core/auto_additions/qgsmaplayer.py
Expand Up @@ -13,7 +13,9 @@
QgsMapLayer.VectorTileLayer.__doc__ = "Added in 3.14"
QgsMapLayer.AnnotationLayer = QgsMapLayerType.AnnotationLayer
QgsMapLayer.AnnotationLayer.__doc__ = "Contains freeform, georeferenced annotations. Added in QGIS 3.16"
QgsMapLayerType.__doc__ = 'Types of layers that can be added to a map\n\n.. versionadded:: 3.8\n\n' + '* ``VectorLayer``: ' + QgsMapLayerType.VectorLayer.__doc__ + '\n' + '* ``RasterLayer``: ' + QgsMapLayerType.RasterLayer.__doc__ + '\n' + '* ``PluginLayer``: ' + QgsMapLayerType.PluginLayer.__doc__ + '\n' + '* ``MeshLayer``: ' + QgsMapLayerType.MeshLayer.__doc__ + '\n' + '* ``VectorTileLayer``: ' + QgsMapLayerType.VectorTileLayer.__doc__ + '\n' + '* ``AnnotationLayer``: ' + QgsMapLayerType.AnnotationLayer.__doc__
QgsMapLayer.PointCloudLayer = QgsMapLayerType.PointCloudLayer
QgsMapLayer.PointCloudLayer.__doc__ = "Added in 3.18"
QgsMapLayerType.__doc__ = 'Types of layers that can be added to a map\n\n.. versionadded:: 3.8\n\n' + '* ``VectorLayer``: ' + QgsMapLayerType.VectorLayer.__doc__ + '\n' + '* ``RasterLayer``: ' + QgsMapLayerType.RasterLayer.__doc__ + '\n' + '* ``PluginLayer``: ' + QgsMapLayerType.PluginLayer.__doc__ + '\n' + '* ``MeshLayer``: ' + QgsMapLayerType.MeshLayer.__doc__ + '\n' + '* ``VectorTileLayer``: ' + QgsMapLayerType.VectorTileLayer.__doc__ + '\n' + '* ``AnnotationLayer``: ' + QgsMapLayerType.AnnotationLayer.__doc__ + '\n' + '* ``PointCloudLayer``: ' + QgsMapLayerType.PointCloudLayer.__doc__
# --
QgsMapLayer.LayerFlag.baseClass = QgsMapLayer
QgsMapLayer.LayerFlags.baseClass = QgsMapLayer
Expand Down
Expand Up @@ -15,7 +15,7 @@ class QgsPointCloudDataProvider: QgsDataProvider
%Docstring
Base class for providing data for QgsPointCloudLayer

Responsible for reading native point cloud data and returning the indexed data?
Responsible for reading native point cloud data and returning the indexed data.

.. note::

Expand Down
Expand Up @@ -84,7 +84,7 @@ QgsPointCloudLayer cannot be copied.
virtual QString loadDefaultStyle( bool &resultFlag /Out/ );


private: // Private methods
private:
QgsPointCloudLayer( const QgsPointCloudLayer &rhs );
};

Expand Down
Expand Up @@ -14,7 +14,6 @@




/************************************************************************
* This file has been generated automatically from *
* *
Expand Down
16 changes: 0 additions & 16 deletions src/3d/qgspointcloudlayer3drenderer.cpp
Expand Up @@ -85,29 +85,13 @@ void QgsPointCloudLayer3DRenderer::writeXml( QDomElement &elem, const QgsReadWri
QDomDocument doc = elem.ownerDocument();

elem.setAttribute( QStringLiteral( "layer" ), mLayerRef.layerId );
/*
QDomElement elemSymbol = doc.createElement( QStringLiteral( "symbol" ) );
if ( mSymbol )
{
elemSymbol.setAttribute( QStringLiteral( "type" ), mSymbol->type() );
mSymbol->writeXml( elemSymbol, context );
}
elem.appendChild( elemSymbol );
*/
}

void QgsPointCloudLayer3DRenderer::readXml( const QDomElement &elem, const QgsReadWriteContext &context )
{
Q_UNUSED( context )

mLayerRef = QgsMapLayerRef( elem.attribute( QStringLiteral( "layer" ) ) );

/*
QDomElement elemSymbol = elem.firstChildElement( QStringLiteral( "symbol" ) );
QgsMesh3DSymbol *symbol = new QgsMesh3DSymbol;
symbol->readXml( elemSymbol, context );
mSymbol.reset( symbol );
*/
}

void QgsPointCloudLayer3DRenderer::resolveReferences( const QgsProject &project )
Expand Down
2 changes: 1 addition & 1 deletion src/3d/qgspointcloudlayer3drenderer.h
Expand Up @@ -37,7 +37,7 @@ class QgsPointCloudLayer;
*
* \since QGIS 3.18
*/
class _3D_EXPORT QgsPointCloudLayer3DRendererMetadata : public Qgs3DRendererAbstractMetadata
class _3D_EXPORT QgsPointCloudLayer3DRendererMetadata : public Qgs3DRendererAbstractMetadata SIP_SKIP
{
public:
QgsPointCloudLayer3DRendererMetadata();
Expand Down
46 changes: 5 additions & 41 deletions src/3d/qgspointcloudlayerchunkloader_p.cpp
Expand Up @@ -22,7 +22,6 @@
#include "qgspointcloudlayer.h"
#include "qgspointcloudindex.h"
#include "qgseventtracing.h"
#include "qgsabstractvectorlayer3drenderer.h" // for QgsVectorLayer3DTilingSettings

#include "qgspoint3dsymbol.h"
#include "qgsphongmaterialsettings.h"
Expand All @@ -35,6 +34,7 @@
#include <Qt3DRender/QTechnique>
#include <Qt3DRender/QShaderProgram>
#include <Qt3DRender/QGraphicsApiFilter>
#include <QPointSize>

///@cond PRIVATE

Expand Down Expand Up @@ -105,10 +105,6 @@ void QgsPointCloud3DSymbolHandler::processNode( QgsPointCloudIndex *pc, const In
const QgsVector3D scale = pc->scale();
const QgsVector3D offset = pc->offset();

//qDebug() << " node " << data.count()/3 << " points";

// QgsRectangle mapExtent = context.map().extent()???

const qint32 *ptr = data.constData();
int count = data.count() / 3;
for ( int i = 0; i < count; ++i )
Expand All @@ -119,32 +115,19 @@ void QgsPointCloud3DSymbolHandler::processNode( QgsPointCloudIndex *pc, const In

double x = offset.x() + scale.x() * ix;
double y = offset.y() + scale.y() * iy;
// if ( mapExtent.contains( QgsPointXY( x, y ) ) )
// {
double z = offset.z() + scale.z() * iz;
QVector3D point( x, y, z );
QgsVector3D p = context.map().mapToWorldCoordinates( point );
outNormal.positions.push_back( QVector3D( p.x(), p.y(), p.z() ) );

// }
}
outNormal.classes.append( classes );
}

void QgsPointCloud3DSymbolHandler::finalize( Qt3DCore::QEntity *parent, const Qgs3DRenderContext &context )
{
makeEntity( parent, context, outNormal, false );
// makeEntity( parent, context, outSelected, true );

// updateZRangeFromPositions( outNormal.positions );
// updateZRangeFromPositions( outSelected.positions );

// the elevation offset is applied separately in QTransform added to sub-entities
//float symbolHeight = mSymbol->transform().data()[13];
//mZMin += symbolHeight;
//mZMax += symbolHeight;
}
#include <QPointSize>

void QgsPointCloud3DSymbolHandler::makeEntity( Qt3DCore::QEntity *parent, const Qgs3DRenderContext &context, QgsPointCloud3DSymbolHandler::PointData &out, bool selected )
{
Q_UNUSED( selected )
Expand All @@ -162,8 +145,6 @@ void QgsPointCloud3DSymbolHandler::makeEntity( Qt3DCore::QEntity *parent, const

// Transform
Qt3DCore::QTransform *tr = new Qt3DCore::QTransform;
// tr->setMatrix( symbol->transform() );
// tr->setTranslation( position + tr->translation() );

// Material
Qt3DRender::QMaterial *mat = new Qt3DRender::QMaterial;
Expand Down Expand Up @@ -211,7 +192,6 @@ QgsPointCloudLayerChunkLoader::QgsPointCloudLayerChunkLoader( const QgsPointClou
: QgsChunkLoader( node )
, mFactory( factory )
, mContext( factory->mMap )
// , mSource( new QgsPointCloudLayerFeatureSource( factory->mLayer ) )
{
if ( node->level() < mFactory->mLeafLevel )
{
Expand All @@ -228,22 +208,6 @@ QgsPointCloudLayerChunkLoader::QgsPointCloudLayerChunkLoader( const QgsPointClou

QgsPointCloudIndex *pc = layer->dataProvider()->index();

//QgsExpressionContext exprContext( Qgs3DUtils::globalProjectLayerExpressionContext( layer ) );
//exprContext.setFields( layer->fields() );
//mContext.setExpressionContext( exprContext );

//QSet<QString> attributeNames;
//if ( !mHandler->prepare( mContext, attributeNames ) )
// {
// QgsDebugMsg( QStringLiteral( "Failed to prepare 3D feature handler!" ) );
// return;
//}

// build the feature request
// QgsFeatureRequest req;
//req.setDestinationCrs( map.crs(), map.transformContext() );
//req.setSubsetOfAttributes( attributeNames, layer->fields() );

// only a subset of data to be queried
QgsRectangle rect = Qgs3DUtils::worldToMapExtent( node->bbox(), map.origin() );
//req.setFilterRect( rect );
Expand Down Expand Up @@ -326,10 +290,10 @@ QgsPointCloudLayerChunkedEntity::QgsPointCloudLayerChunkedEntity( QgsPointCloudL
: QgsChunkedEntity( Qgs3DUtils::layerToWorldExtent( vl->extent(), zMin, zMax, vl->crs(), map.origin(), map.crs(), map.transformContext() ),
-1, // rootError (negative error means that the node does not contain anything)
-1, // max. allowed screen error (negative tau means that we need to go until leaves are reached)
0, //QgsVectorLayer3DTilingSettings().zoomLevelsCount() - 1,
new QgsPointCloudLayerChunkLoaderFactory( map, vl, 0 /*QgsVectorLayer3DTilingSettings().zoomLevelsCount() - 1*/ ), true )
0,
new QgsPointCloudLayerChunkLoaderFactory( map, vl, 0 ), true )
{
setShowBoundingBoxes( true ); //QgsVectorLayer3DTilingSettings().showBoundingBoxes() );
setShowBoundingBoxes( true );
}

QgsPointCloudLayerChunkedEntity::~QgsPointCloudLayerChunkedEntity()
Expand Down
5 changes: 3 additions & 2 deletions src/app/qgslayerstylingwidget.cpp
Expand Up @@ -678,8 +678,9 @@ void QgsLayerStylingWidget::updateCurrentWidgetLayer()
{
QgsPointCloudLayer *pcLayer = qobject_cast<QgsPointCloudLayer *>( mCurrentLayer );
( void )pcLayer;
//TODO
mStackedWidget->setCurrentIndex( mNotSupportedPage );

//TODO
mStackedWidget->setCurrentIndex( mNotSupportedPage );
break;
}

Expand Down
2 changes: 1 addition & 1 deletion src/core/pointcloud/qgspointclouddataprovider.h
Expand Up @@ -28,7 +28,7 @@ class QgsPointCloudIndex;
* \ingroup core
* Base class for providing data for QgsPointCloudLayer
*
* Responsible for reading native point cloud data and returning the indexed data?
* Responsible for reading native point cloud data and returning the indexed data.
*
* \note The API is considered EXPERIMENTAL and can be changed without a notice
*
Expand Down
67 changes: 50 additions & 17 deletions src/core/pointcloud/qgspointcloudindex.cpp
Expand Up @@ -25,11 +25,24 @@
#include <QTime>
#include <QtDebug>

IndexedPointCloudNode::IndexedPointCloudNode(): d( -1 ), x( 0 ), y( 0 ), z( 0 ) {}
IndexedPointCloudNode::IndexedPointCloudNode():
mD( -1 ),
mX( 0 ),
mY( 0 ),
mZ( 0 )
{}

IndexedPointCloudNode::IndexedPointCloudNode( int _d, int _x, int _y, int _z ): d( _d ), x( _x ), y( _y ), z( _z ) {}
IndexedPointCloudNode::IndexedPointCloudNode( int _d, int _x, int _y, int _z ):
mD( _d ),
mX( _x ),
mY( _y ),
mZ( _z )
{}

bool IndexedPointCloudNode::operator==( const IndexedPointCloudNode &other ) const { return d == other.d && x == other.x && y == other.y && z == other.z; }
bool IndexedPointCloudNode::operator==( const IndexedPointCloudNode &other ) const
{
return mD == other.d() && mX == other.x() && mY == other.y() && mZ == other.z();
}

IndexedPointCloudNode IndexedPointCloudNode::fromString( const QString &str )
{
Expand All @@ -41,12 +54,32 @@ IndexedPointCloudNode IndexedPointCloudNode::fromString( const QString &str )

QString IndexedPointCloudNode::toString() const
{
return QString( "%1-%2-%3-%4" ).arg( d ).arg( x ).arg( y ).arg( z );
return QString( "%1-%2-%3-%4" ).arg( mD ).arg( mX ).arg( mY ).arg( mZ );
}

int IndexedPointCloudNode::d() const
{
return mD;
}

int IndexedPointCloudNode::x() const
{
return mX;
}

int IndexedPointCloudNode::y() const
{
return mY;
}

int IndexedPointCloudNode::z() const
{
return mZ;
}

uint qHash( const IndexedPointCloudNode &id )
{
return id.d + id.x + id.y + id.z;
return id.d() + id.x() + id.y() + id.z();
}

///@cond PRIVATE
Expand Down Expand Up @@ -139,10 +172,10 @@ QList<IndexedPointCloudNode> QgsPointCloudIndex::children( const IndexedPointClo
{
Q_ASSERT( mHierarchy.contains( n ) );
QList<IndexedPointCloudNode> lst;
int d = n.d + 1;
int x = n.x * 2;
int y = n.y * 2;
int z = n.z * 2;
int d = n.d() + 1;
int x = n.x() * 2;
int y = n.y() * 2;
int z = n.z() * 2;

for ( int i = 0; i < 8; ++i )
{
Expand All @@ -160,14 +193,14 @@ QgsPointCloudDataBounds QgsPointCloudIndex::nodeBounds( const IndexedPointCloudN
qint32 xMax = 999999999, yMax = 999999999, zMax = 999999999;

int d = mRootBounds.xMax() - mRootBounds.xMin();
double dLevel = ( double )d / pow( 2, n.d );

xMin = round( mRootBounds.xMin() + dLevel * n.x );
xMax = round( mRootBounds.xMin() + dLevel * ( n.x + 1 ) );
yMin = round( mRootBounds.yMin() + dLevel * n.y );
yMax = round( mRootBounds.yMin() + dLevel * ( n.y + 1 ) );
zMin = round( mRootBounds.zMin() + dLevel * n.z );
zMax = round( mRootBounds.zMin() + dLevel * ( n.z + 1 ) );
double dLevel = ( double )d / pow( 2, n.d() );

xMin = round( mRootBounds.xMin() + dLevel * n.x() );
xMax = round( mRootBounds.xMin() + dLevel * ( n.x() + 1 ) );
yMin = round( mRootBounds.yMin() + dLevel * n.y() );
yMax = round( mRootBounds.yMin() + dLevel * ( n.y() + 1 ) );
zMin = round( mRootBounds.zMin() + dLevel * n.z() );
zMax = round( mRootBounds.zMin() + dLevel * ( n.z() + 1 ) );

QgsPointCloudDataBounds db( xMin, yMin, zMin, xMax, yMax, zMax );
return db;
Expand Down

0 comments on commit 29113a8

Please sign in to comment.