Skip to content

Commit

Permalink
change the point budge to qint64 and double spin box
Browse files Browse the repository at this point in the history
  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Apr 8, 2021
1 parent 1a60a45 commit aca1146
Show file tree
Hide file tree
Showing 18 changed files with 38 additions and 50 deletions.
Expand Up @@ -128,7 +128,7 @@ Gets the current index generation state
Returns whether provider has index which is valid
%End

virtual int pointCount() const = 0;
virtual qint64 pointCount() const = 0;
%Docstring
Returns the total number of points available in the dataset.
%End
Expand Down
Expand Up @@ -114,7 +114,7 @@ QgsPointCloudLayer cannot be copied.
Returns the attributes available from the layer.
%End

int pointCount() const;
qint64 pointCount() const;
%Docstring
Returns the total number of points available in the layer.
%End
Expand Down
8 changes: 4 additions & 4 deletions src/app/3d/qgspointcloud3dsymbolwidget.cpp
Expand Up @@ -88,7 +88,7 @@ QgsPointCloud3DSymbolWidget::QgsPointCloud3DSymbolWidget( QgsPointCloudLayer *la
mRenderingStyleComboBox->setCurrentIndex( 0 );
mStackedWidget->setCurrentIndex( 0 );

whileBlocking( mPointBudgetSpinBox )->setMinimum( std::min( mLayer->pointCount() / 2, 100000 ) );
whileBlocking( mPointBudgetSpinBox )->setMinimum( std::min( mLayer->pointCount() / 2, ( qint64 )100000 ) );
whileBlocking( mPointBudgetSpinBox )->setMaximum( mLayer->pointCount() + 1 );
whileBlocking( mPointBudgetSpinBox )->setValue( 1000000 );

Expand All @@ -106,7 +106,7 @@ QgsPointCloud3DSymbolWidget::QgsPointCloud3DSymbolWidget( QgsPointCloudLayer *la

connect( mMaxScreenErrorSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [&]() { emitChangedSignal(); } );
connect( mShowBoundingBoxesCheckBox, &QCheckBox::stateChanged, this, [&]() { emitChangedSignal(); } );
connect( mPointBudgetSpinBox, qOverload<int>( &QSpinBox::valueChanged ), this, [&]() { emitChangedSignal(); } );
connect( mPointBudgetSpinBox, qOverload<double>( &QDoubleSpinBox::valueChanged ), this, [&]() { emitChangedSignal(); } );

if ( !symbol ) // if we have a symbol, this was already handled in setSymbol above
rampAttributeChanged();
Expand Down Expand Up @@ -612,12 +612,12 @@ void QgsPointCloud3DSymbolWidget::setShowBoundingBoxes( bool showBoundingBoxes )
whileBlocking( mShowBoundingBoxesCheckBox )->setChecked( showBoundingBoxes );
}

void QgsPointCloud3DSymbolWidget::setPointBudget( int budget )
void QgsPointCloud3DSymbolWidget::setPointBudget( double budget )
{
whileBlocking( mPointBudgetSpinBox )->setValue( budget );
}

int QgsPointCloud3DSymbolWidget::pointBudget() const
double QgsPointCloud3DSymbolWidget::pointBudget() const
{
return mPointBudgetSpinBox->value();
}
Expand Down
6 changes: 3 additions & 3 deletions src/app/3d/qgspointcloud3dsymbolwidget.h
Expand Up @@ -42,8 +42,8 @@ class QgsPointCloud3DSymbolWidget : public QWidget, private Ui::QgsPointCloud3DS
void setShowBoundingBoxes( bool showBoundingBoxes );
double showBoundingBoxes() const;

void setPointBudget( int budget );
int pointBudget() const;
void setPointBudget( double budget );
double pointBudget() const;

void setPointCloudSize( int size );

Expand Down Expand Up @@ -91,7 +91,7 @@ class QgsPointCloud3DSymbolWidget : public QWidget, private Ui::QgsPointCloud3DS
void minMaxModified();
void setMinMaxValue( const QgsContrastEnhancement *ce, QLineEdit *minEdit, QLineEdit *maxEdit );

int mPointBudget = 1000000;
double mPointBudget = 1000000;
};

#endif // QGSPOINTCLOUD3DSYMBOLWIDGET_H
2 changes: 1 addition & 1 deletion src/app/pointcloud/qgspointcloudlayerproperties.cpp
Expand Up @@ -599,7 +599,7 @@ QVariant QgsPointCloudClassificationStatisticsModel::data( const QModelIndex &in

case Percent:
{
const int pointCount = mLayer->dataProvider() ? mLayer->dataProvider()->pointCount() : -1;
const qint64 pointCount = mLayer->dataProvider() ? mLayer->dataProvider()->pointCount() : -1;
return pointCount > 0 ? mLayer->dataProvider()->metadataClassStatistic( mAttribute, classValue, QgsStatisticalSummary::Count ).toDouble() / pointCount * 100 : QVariant();
}

Expand Down
4 changes: 2 additions & 2 deletions src/core/pointcloud/qgseptpointcloudindex.cpp
Expand Up @@ -126,7 +126,7 @@ bool QgsEptPointCloudIndex::loadSchema( const QByteArray &dataJson )
return false;

mSpan = result.value( QLatin1String( "span" ) ).toInt();
mPointCount = std::min( ( double )std::numeric_limits<int>::max(), result.value( QLatin1String( "points" ) ).toDouble() );
mPointCount = result.value( QLatin1String( "points" ) ).toDouble();

// WKT
const QJsonObject srs = result.value( QLatin1String( "srs" ) ).toObject();
Expand Down Expand Up @@ -310,7 +310,7 @@ QgsCoordinateReferenceSystem QgsEptPointCloudIndex::crs() const
return QgsCoordinateReferenceSystem::fromWkt( mWkt );
}

int QgsEptPointCloudIndex::pointCount() const
qint64 QgsEptPointCloudIndex::pointCount() const
{
return mPointCount;
}
Expand Down
5 changes: 3 additions & 2 deletions src/core/pointcloud/qgseptpointcloudindex.h
Expand Up @@ -50,7 +50,7 @@ class CORE_EXPORT QgsEptPointCloudIndex: public QgsPointCloudIndex
QgsPointCloudBlockRequest *asyncNodeData( const IndexedPointCloudNode &n, const QgsPointCloudRequest &request ) override;

QgsCoordinateReferenceSystem crs() const override;
int pointCount() const override;
qint64 pointCount() const override;
QVariant metadataStatistic( const QString &attribute, QgsStatisticalSummary::Statistic statistic ) const override;
QVariantList metadataClasses( const QString &attribute ) const override;
QVariant metadataClassStatistic( const QString &attribute, const QVariant &value, QgsStatisticalSummary::Statistic statistic ) const override;
Expand All @@ -69,7 +69,8 @@ class CORE_EXPORT QgsEptPointCloudIndex: public QgsPointCloudIndex
QString mDataType;
QString mDirectory;
QString mWkt;
int mPointCount = 0;

qint64 mPointCount = 0;

struct AttributeStatistics
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/pointcloud/qgspointclouddataprovider.h
Expand Up @@ -174,7 +174,7 @@ class CORE_EXPORT QgsPointCloudDataProvider: public QgsDataProvider
/**
* Returns the total number of points available in the dataset.
*/
virtual int pointCount() const = 0;
virtual qint64 pointCount() const = 0;

/**
* Returns the polygon bounds of the layer. The CRS of the returned geometry will match the provider's crs().
Expand Down
2 changes: 1 addition & 1 deletion src/core/pointcloud/qgspointcloudindex.h
Expand Up @@ -186,7 +186,7 @@ class CORE_EXPORT QgsPointCloudIndex: public QObject
//! Returns the coordinate reference system of the point cloud index
virtual QgsCoordinateReferenceSystem crs() const = 0;
//! Returns the number of points in the point cloud
virtual int pointCount() const = 0;
virtual qint64 pointCount() const = 0;
//! Returns the statistic \a statistic of \a attribute
virtual QVariant metadataStatistic( const QString &attribute, QgsStatisticalSummary::Statistic statistic ) const = 0;
//! Returns the classes of \a attribute
Expand Down
4 changes: 2 additions & 2 deletions src/core/pointcloud/qgspointcloudlayer.cpp
Expand Up @@ -473,7 +473,7 @@ QString QgsPointCloudLayer::htmlMetadata() const
// feature count
QLocale locale = QLocale();
locale.setNumberOptions( locale.numberOptions() &= ~QLocale::NumberOption::OmitGroupSeparator );
const int pointCount = mDataProvider ? mDataProvider->pointCount() : -1;
const qint64 pointCount = mDataProvider ? mDataProvider->pointCount() : -1;
myMetadata += QStringLiteral( "<tr><td class=\"highlight\">" )
+ tr( "Point count" ) + QStringLiteral( "</td><td>" )
+ ( pointCount < 0 ? tr( "unknown" ) : locale.toString( static_cast<qlonglong>( pointCount ) ) )
Expand Down Expand Up @@ -630,7 +630,7 @@ QgsPointCloudAttributeCollection QgsPointCloudLayer::attributes() const
return mDataProvider ? mDataProvider->attributes() : QgsPointCloudAttributeCollection();
}

int QgsPointCloudLayer::pointCount() const
qint64 QgsPointCloudLayer::pointCount() const
{
return mDataProvider ? mDataProvider->pointCount() : 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/pointcloud/qgspointcloudlayer.h
Expand Up @@ -143,7 +143,7 @@ class CORE_EXPORT QgsPointCloudLayer : public QgsMapLayer
/**
* Returns the total number of points available in the layer.
*/
int pointCount() const;
qint64 pointCount() const;

/**
* Returns the 2D renderer for the point cloud.
Expand Down
5 changes: 0 additions & 5 deletions src/core/pointcloud/qgsremoteeptpointcloudindex.cpp
Expand Up @@ -143,11 +143,6 @@ bool QgsRemoteEptPointCloudIndex::hasNode( const IndexedPointCloudNode &n ) cons
return loadNodeHierarchy( n );
}

int QgsRemoteEptPointCloudIndex::pointCount() const
{
return mPointCount;
}

bool QgsRemoteEptPointCloudIndex::loadNodeHierarchy( const IndexedPointCloudNode &nodeId ) const
{
if ( mHierarchy.contains( nodeId ) )
Expand Down
2 changes: 0 additions & 2 deletions src/core/pointcloud/qgsremoteeptpointcloudindex.h
Expand Up @@ -56,8 +56,6 @@ class CORE_EXPORT QgsRemoteEptPointCloudIndex: public QgsEptPointCloudIndex

bool hasNode( const IndexedPointCloudNode &n ) const override;

int pointCount() const override;

bool isValid() const override;

QgsPointCloudIndex::AccessType accessType() const override { return QgsPointCloudIndex::Remote; }
Expand Down
2 changes: 1 addition & 1 deletion src/core/providers/ept/qgseptprovider.cpp
Expand Up @@ -87,7 +87,7 @@ QgsPointCloudIndex *QgsEptProvider::index() const
return mIndex.get();
}

int QgsEptProvider::pointCount() const
qint64 QgsEptProvider::pointCount() const
{
return mIndex->pointCount();
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/providers/ept/qgseptprovider.h
Expand Up @@ -50,7 +50,7 @@ class QgsEptProvider: public QgsPointCloudDataProvider
QString name() const override;
QString description() const override;
QgsPointCloudIndex *index() const override;
int pointCount() const override;
qint64 pointCount() const override;
QVariant metadataStatistic( const QString &attribute, QgsStatisticalSummary::Statistic statistic ) const override;
QVariantList metadataClasses( const QString &attribute ) const override;
QVariant metadataClassStatistic( const QString &attribute, const QVariant &value, QgsStatisticalSummary::Statistic statistic ) const override;
Expand Down
2 changes: 1 addition & 1 deletion src/providers/pdal/qgspdalprovider.cpp
Expand Up @@ -190,7 +190,7 @@ QVariant QgsPdalProvider::metadataStatistic( const QString &attribute, QgsStatis
return QVariant();
}

int QgsPdalProvider::pointCount() const
qint64 QgsPdalProvider::pointCount() const
{
return mPointCount;
}
Expand Down
4 changes: 2 additions & 2 deletions src/providers/pdal/qgspdalprovider.h
Expand Up @@ -38,7 +38,7 @@ class QgsPdalProvider: public QgsPointCloudDataProvider
QgsCoordinateReferenceSystem crs() const override;
QgsRectangle extent() const override;
QgsPointCloudAttributeCollection attributes() const override;
int pointCount() const override;
qint64 pointCount() const override;
QVariantMap originalMetadata() const override;
bool isValid() const override;
QString name() const override;
Expand All @@ -61,7 +61,7 @@ class QgsPdalProvider: public QgsPointCloudDataProvider
QgsCoordinateReferenceSystem mCrs;
QgsRectangle mExtent;
bool mIsValid = false;
int mPointCount = 0;
qint64 mPointCount = 0;

QVariantMap mOriginalMetadata;
std::unique_ptr<QgsEptPointCloudIndex> mIndex;
Expand Down
32 changes: 13 additions & 19 deletions src/ui/3d/qgspointcloud3dsymbolwidget.ui
Expand Up @@ -73,25 +73,6 @@
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QSpinBox" name="mPointBudgetSpinBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimum">
<number>100000</number>
</property>
<property name="maximum">
<number>99999999</number>
</property>
<property name="singleStep">
<number>10000</number>
</property>
<property name="value">
<number>1000000</number>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QgsDoubleSpinBox" name="mPointSizeSpinBox">
<property name="sizePolicy">
Expand Down Expand Up @@ -129,6 +110,19 @@
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QDoubleSpinBox" name="mPointBudgetSpinBox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="minimum">
<double>100000.000000000000000</double>
</property>
<property name="maximum">
<double>99999999.000000000000000</double>
</property>
</widget>
</item>
</layout>
</item>
<item row="4" column="0" colspan="2">
Expand Down

0 comments on commit aca1146

Please sign in to comment.