35 #include <QtConcurrent/QtConcurrentMap>
43 : mIndex( index->
clone().release() ), mRequest( request ), mFeedback( feedback ), mProgressValue( progressValue )
48 : mIndex( processor.mIndex->clone().release() ), mRequest( processor.mRequest ), mFeedback( processor.mFeedback ), mProgressValue( processor.mProgressValue )
54 mIndex.reset( rhs.mIndex->clone().release() );
55 mRequest = rhs.mRequest;
56 mFeedback = rhs.mFeedback;
57 mProgressValue = rhs.mProgressValue;
63 std::unique_ptr<QgsPointCloudBlock> block =
nullptr;
66 block.reset( mIndex->nodeData( node, mRequest ) );
76 block.reset( request->
block() );
77 if ( !request->
block() )
90 const QVector<QgsPointCloudAttribute> attributes = attributesCollection.
attributes();
91 const char *ptr = block->data();
92 int count = block->pointCount();
95 QMap<QString, QgsPointCloudAttributeStatistics> statsMap;
99 summary.
minimum = std::numeric_limits<double>::max();
100 summary.
maximum = std::numeric_limits<double>::lowest();
103 summary.
stDev = std::numeric_limits<double>::quiet_NaN();
105 statsMap[ attribute.name() ] = summary;
108 QVector<int> attributeOffsetVector;
109 QSet<int> classifiableAttributesOffsetSet;
112 int attributeOffset = 0;
113 attributesCollection.
find( attribute.name(), attributeOffset );
114 attributeOffsetVector.push_back( attributeOffset );
115 if ( attribute.name() == QLatin1String(
"ScannerChannel" ) ||
116 attribute.name() == QLatin1String(
"ReturnNumber" ) ||
117 attribute.name() == QLatin1String(
"NumberOfReturns" ) ||
118 attribute.name() == QLatin1String(
"ScanDirectionFlag" ) ||
119 attribute.name() == QLatin1String(
"Classification" ) ||
120 attribute.name() == QLatin1String(
"EdgeOfFlightLine" ) ||
121 attribute.name() == QLatin1String(
"PointSourceId" ) )
123 classifiableAttributesOffsetSet.insert( attributeOffset );
127 for (
int i = 0; i < count; ++i )
129 for (
int j = 0; j < attributes.size(); ++j )
135 QString attributeName = attributes.at( j ).name();
138 double attributeValue = 0;
139 int attributeOffset = attributeOffsetVector[ j ];
145 stats.
mean += attributeValue / count;
148 if ( classifiableAttributesOffsetSet.contains( attributeOffset ) )
158 std::unique_ptr<QgsPointCloudIndex> mIndex =
nullptr;
161 double mProgressValue = 0.0;
163 void updateFeedback()
173 : mIndex( index->clone() )
180 if ( !mIndex->isValid() )
187 qint64 pointCount = 0;
188 QVector<IndexedPointCloudNode> nodes;
189 QQueue<IndexedPointCloudNode> queue;
190 queue.push_back( mIndex->root() );
191 while ( !queue.empty() )
195 if ( !mProcessedNodes.contains( node ) )
196 pointCount += mIndex->nodePointCount( node );
197 if ( pointsLimit != -1 && pointCount > pointsLimit )
199 if ( !mProcessedNodes.contains( node ) )
201 nodes.push_back( node );
202 mProcessedNodes.insert( node );
206 queue.push_back( child );
212 QVector<QgsPointCloudStatistics> list = QtConcurrent::blockingMapped( nodes,
StatsProcessor( mIndex.get(), mRequest, feedback, 100.0 / (
double )nodes.size() ) );