Skip to content
Permalink
Browse files

change the point budge to qint64 and double spin box

  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Apr 8, 2021
1 parent 1a60a45 commit aca1146390fefc2009f7e0497d71a31e6b6a4b30
@@ -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
@@ -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
@@ -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 );

@@ -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();
@@ -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();
}
@@ -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 );

@@ -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
@@ -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();
}

@@ -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();
@@ -310,7 +310,7 @@ QgsCoordinateReferenceSystem QgsEptPointCloudIndex::crs() const
return QgsCoordinateReferenceSystem::fromWkt( mWkt );
}

int QgsEptPointCloudIndex::pointCount() const
qint64 QgsEptPointCloudIndex::pointCount() const
{
return mPointCount;
}
@@ -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;
@@ -69,7 +69,8 @@ class CORE_EXPORT QgsEptPointCloudIndex: public QgsPointCloudIndex
QString mDataType;
QString mDirectory;
QString mWkt;
int mPointCount = 0;

qint64 mPointCount = 0;

struct AttributeStatistics
{
@@ -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().
@@ -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
@@ -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 ) ) )
@@ -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;
}
@@ -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.
@@ -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 ) )
@@ -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; }
@@ -87,7 +87,7 @@ QgsPointCloudIndex *QgsEptProvider::index() const
return mIndex.get();
}

int QgsEptProvider::pointCount() const
qint64 QgsEptProvider::pointCount() const
{
return mIndex->pointCount();
}
@@ -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;
@@ -190,7 +190,7 @@ QVariant QgsPdalProvider::metadataStatistic( const QString &attribute, QgsStatis
return QVariant();
}

int QgsPdalProvider::pointCount() const
qint64 QgsPdalProvider::pointCount() const
{
return mPointCount;
}
@@ -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;
@@ -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;
@@ -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">
@@ -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">

0 comments on commit aca1146

Please sign in to comment.