62 if ( mIndex->nodePointCount( node ) < 1 )
65 std::unique_ptr<QgsPointCloudBlock> block =
nullptr;
68 block = mIndex->nodeData( node, mRequest );
73 if ( request ==
nullptr )
75 QgsDebugError( QStringLiteral(
"Unable to calculate statistics for node %1: Got nullptr async request" ).arg( node.
toString() ) );
99 const QVector<QgsPointCloudAttribute> attributes = attributesCollection.
attributes();
100 const char *ptr = block->data();
101 int count = block->pointCount();
104 QMap<QString, QgsPointCloudAttributeStatistics> statsMap;
108 summary.
minimum = std::numeric_limits<double>::max();
109 summary.
maximum = std::numeric_limits<double>::lowest();
112 summary.
stDev = std::numeric_limits<double>::quiet_NaN();
114 statsMap[ attribute.name() ] = summary;
117 QVector<int> attributeOffsetVector;
118 QSet<int> classifiableAttributesOffsetSet;
121 int attributeOffset = 0;
122 attributesCollection.
find( attribute.name(), attributeOffset );
123 attributeOffsetVector.push_back( attributeOffset );
124 if ( attribute.name() == QLatin1String(
"ScannerChannel" ) ||
125 attribute.name() == QLatin1String(
"ReturnNumber" ) ||
126 attribute.name() == QLatin1String(
"NumberOfReturns" ) ||
127 attribute.name() == QLatin1String(
"ScanDirectionFlag" ) ||
128 attribute.name() == QLatin1String(
"Classification" ) ||
129 attribute.name() == QLatin1String(
"EdgeOfFlightLine" ) ||
130 attribute.name() == QLatin1String(
"PointSourceId" ) ||
131 attribute.name() == QLatin1String(
"Synthetic" ) ||
132 attribute.name() == QLatin1String(
"KeyPoint" ) ||
133 attribute.name() == QLatin1String(
"Withheld" ) ||
134 attribute.name() == QLatin1String(
"Overlap" ) )
136 classifiableAttributesOffsetSet.insert( attributeOffset );
140 for (
int i = 0; i < count; ++i )
142 for (
int j = 0; j < attributes.size(); ++j )
148 QString attributeName = attributes.at( j ).name();
151 double attributeValue = 0;
152 int attributeOffset = attributeOffsetVector[ j ];
158 stats.
mean += attributeValue / count;
161 if ( classifiableAttributesOffsetSet.contains( attributeOffset ) )