mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Rename OrderBys -> OrderBy and OrderBy -> OrderByClause
And some sip fixes
This commit is contained in:
parent
3f1db6d550
commit
168c6f70bc
@ -81,6 +81,18 @@ class QgsFeatureRequest
|
||||
class OrderBy
|
||||
{
|
||||
public:
|
||||
OrderBy();
|
||||
|
||||
OrderBy( const QList<QgsFeatureRequest::OrderByClause>& other );
|
||||
|
||||
/**
|
||||
* Get a copy as a list of OrderByClauses
|
||||
*
|
||||
* This is only required in python where the inheritance
|
||||
* is not properly propagated and this makes it usable.
|
||||
*/
|
||||
QList<QgsFeatureRequest::OrderByClause> list() const;
|
||||
|
||||
/**
|
||||
* Serialize to XML
|
||||
*/
|
||||
@ -199,12 +211,12 @@ class QgsFeatureRequest
|
||||
/**
|
||||
* Return a list of order by clauses specified for this feature request.
|
||||
*/
|
||||
QgsFeatureRequest::OrderBy orderBys() const;
|
||||
QgsFeatureRequest::OrderBy orderBy() const;
|
||||
|
||||
/**
|
||||
* Set a list of order by clauses.
|
||||
*/
|
||||
QgsFeatureRequest& setOrderBys(const QgsFeatureRequest::OrderBy& orderBys );
|
||||
QgsFeatureRequest& setOrderBy(const QgsFeatureRequest::OrderBy& orderBy );
|
||||
|
||||
/** Set the maximum number of features to request.
|
||||
* @param limit maximum number of features, or -1 to request all features.
|
||||
|
@ -312,6 +312,18 @@ class QgsFeatureRendererV2
|
||||
*/
|
||||
void setForceRasterRender( bool forceRaster );
|
||||
|
||||
/**
|
||||
* Get the order in which features shall be processed by this renderer.
|
||||
* @note added in QGIS 2.14
|
||||
*/
|
||||
QgsFeatureRequest::OrderBy orderBy() const;
|
||||
|
||||
/**
|
||||
* Define the order in which features shall be processed by this renderer.
|
||||
* @note added in QGIS 2.14
|
||||
*/
|
||||
void setOrderBy( const QgsFeatureRequest::OrderBy& orderBy );
|
||||
|
||||
protected:
|
||||
QgsFeatureRendererV2( const QString& type );
|
||||
|
||||
|
@ -220,7 +220,7 @@ void QgsAbstractFeatureIterator::ref()
|
||||
prepareSimplification( mRequest.simplifyMethod() );
|
||||
|
||||
// Should be called as last preparation step since it possibly will already fetch all features
|
||||
setupOrderBy( mRequest.orderBys() );
|
||||
setupOrderBy( mRequest.orderBy() );
|
||||
}
|
||||
refs++;
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ QgsFeatureRequest& QgsFeatureRequest::operator=( const QgsFeatureRequest & rh )
|
||||
mAttrs = rh.mAttrs;
|
||||
mSimplifyMethod = rh.mSimplifyMethod;
|
||||
mLimit = rh.mLimit;
|
||||
mOrderBys = rh.mOrderBys;
|
||||
mOrderBy = rh.mOrderBy;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -144,24 +144,24 @@ QgsFeatureRequest &QgsFeatureRequest::setExpressionContext( const QgsExpressionC
|
||||
|
||||
QgsFeatureRequest& QgsFeatureRequest::addOrderBy( const QString& expression, bool ascending )
|
||||
{
|
||||
mOrderBys.append( OrderByClause( expression, ascending ) );
|
||||
mOrderBy.append( OrderByClause( expression, ascending ) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
QgsFeatureRequest& QgsFeatureRequest::addOrderBy( const QString& expression, bool ascending, bool nullsfirst )
|
||||
{
|
||||
mOrderBys.append( OrderByClause( expression, ascending, nullsfirst ) );
|
||||
mOrderBy.append( OrderByClause( expression, ascending, nullsfirst ) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
QgsFeatureRequest::OrderBy QgsFeatureRequest::orderBys() const
|
||||
QgsFeatureRequest::OrderBy QgsFeatureRequest::orderBy() const
|
||||
{
|
||||
return mOrderBys;
|
||||
return mOrderBy;
|
||||
}
|
||||
|
||||
QgsFeatureRequest& QgsFeatureRequest::setOrderBys( const QgsFeatureRequest::OrderBy& orderBys )
|
||||
QgsFeatureRequest& QgsFeatureRequest::setOrderBy( const QgsFeatureRequest::OrderBy& orderBy )
|
||||
{
|
||||
mOrderBys = orderBys;
|
||||
mOrderBy = orderBy;
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -321,6 +321,19 @@ QgsExpression QgsFeatureRequest::OrderByClause::expression() const
|
||||
return mExpression;
|
||||
}
|
||||
|
||||
QgsFeatureRequest::OrderBy::OrderBy( const QList<QgsFeatureRequest::OrderByClause>& other )
|
||||
{
|
||||
Q_FOREACH ( const QgsFeatureRequest::OrderByClause& clause, other )
|
||||
{
|
||||
append( clause );
|
||||
}
|
||||
}
|
||||
|
||||
QList<QgsFeatureRequest::OrderByClause> QgsFeatureRequest::OrderBy::list() const
|
||||
{
|
||||
return *this;
|
||||
}
|
||||
|
||||
void QgsFeatureRequest::OrderBy::save( QDomElement& elem ) const
|
||||
{
|
||||
QDomDocument doc = elem.ownerDocument();
|
||||
|
@ -175,6 +175,26 @@ class CORE_EXPORT QgsFeatureRequest
|
||||
class OrderBy : public QList<OrderByClause>
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Create a new empty order by
|
||||
*/
|
||||
OrderBy()
|
||||
: QList<OrderByClause>()
|
||||
{}
|
||||
|
||||
/**
|
||||
* Create a new order by from a list of clauses
|
||||
*/
|
||||
OrderBy( const QList<OrderByClause>& other );
|
||||
|
||||
/**
|
||||
* Get a copy as a list of OrderByClauses
|
||||
*
|
||||
* This is only required in python where the inheritance
|
||||
* is not properly propagated and this makes it usable.
|
||||
*/
|
||||
QList<OrderByClause> list() const;
|
||||
|
||||
/**
|
||||
* Serialize to XML
|
||||
*/
|
||||
@ -315,14 +335,14 @@ class CORE_EXPORT QgsFeatureRequest
|
||||
*
|
||||
* @note added in 2.14
|
||||
*/
|
||||
OrderBy orderBys() const;
|
||||
OrderBy orderBy() const;
|
||||
|
||||
/**
|
||||
* Set a list of order by clauses.
|
||||
*
|
||||
* @note added in 2.14
|
||||
*/
|
||||
QgsFeatureRequest& setOrderBys( const OrderBy& orderBys );
|
||||
QgsFeatureRequest& setOrderBy( const OrderBy& orderBy );
|
||||
|
||||
/** Set the maximum number of features to request.
|
||||
* @param limit maximum number of features, or -1 to request all features.
|
||||
@ -385,7 +405,7 @@ class CORE_EXPORT QgsFeatureRequest
|
||||
QgsAttributeList mAttrs;
|
||||
QgsSimplifyMethod mSimplifyMethod;
|
||||
long mLimit;
|
||||
OrderBy mOrderBys;
|
||||
OrderBy mOrderBy;
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS( QgsFeatureRequest::Flags )
|
||||
|
@ -120,9 +120,9 @@ QgsVectorLayerFeatureIterator::QgsVectorLayerFeatureIterator( QgsVectorLayerFeat
|
||||
// TODO:
|
||||
// It would be nicer to first check if we can compile the order by
|
||||
// and only modify the subset if we cannot.
|
||||
if ( !mProviderRequest.orderBys().isEmpty() )
|
||||
if ( !mProviderRequest.orderBy().isEmpty() )
|
||||
{
|
||||
Q_FOREACH ( const QString& attr, mProviderRequest.orderBys().usedAttributes() )
|
||||
Q_FOREACH ( const QString& attr, mProviderRequest.orderBy().usedAttributes() )
|
||||
{
|
||||
providerSubset << mSource->mFields.fieldNameIndex( attr );
|
||||
}
|
||||
|
@ -156,7 +156,7 @@ bool QgsVectorLayerRenderer::render()
|
||||
.setFilterRect( requestExtent )
|
||||
.setSubsetOfAttributes( mAttrNames, mFields )
|
||||
.setExpressionContext( mContext.expressionContext() )
|
||||
.setOrderBys( orderBy );
|
||||
.setOrderBy( orderBy );
|
||||
|
||||
const QgsFeatureFilterProvider* featureFilterProvider = mContext.featureFilterProvider();
|
||||
if ( featureFilterProvider )
|
||||
|
@ -344,7 +344,7 @@ QgsInvertedPolygonRenderer* QgsInvertedPolygonRenderer::clone() const
|
||||
newRenderer = new QgsInvertedPolygonRenderer( mSubRenderer.data() );
|
||||
}
|
||||
newRenderer->setPreprocessingEnabled( preprocessingEnabled() );
|
||||
copyPaintEffect( newRenderer );
|
||||
copyRendererData( newRenderer );
|
||||
return newRenderer;
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ QgsPointDisplacementRenderer* QgsPointDisplacementRenderer::clone() const
|
||||
{
|
||||
r->setCenterSymbol( mCenterSymbol->clone() );
|
||||
}
|
||||
copyPaintEffect( r );
|
||||
copyRendererData( r );
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -616,14 +616,14 @@ void QgsFeatureRendererV2::setPaintEffect( QgsPaintEffect *effect )
|
||||
mPaintEffect = effect;
|
||||
}
|
||||
|
||||
QgsFeatureRequest::OrderBy QgsFeatureRendererV2::orderBy()
|
||||
QgsFeatureRequest::OrderBy QgsFeatureRendererV2::orderBy() const
|
||||
{
|
||||
return mOrderBy;
|
||||
}
|
||||
|
||||
void QgsFeatureRendererV2::setOrderBy( const QgsFeatureRequest::OrderBy& orderBys )
|
||||
void QgsFeatureRendererV2::setOrderBy( const QgsFeatureRequest::OrderBy& orderBy )
|
||||
{
|
||||
mOrderBy = orderBys;
|
||||
mOrderBy = orderBy;
|
||||
}
|
||||
|
||||
void QgsFeatureRendererV2::convertSymbolSizeScale( QgsSymbolV2 * symbol, QgsSymbolV2::ScaleMethod method, const QString & field )
|
||||
|
@ -348,13 +348,13 @@ class CORE_EXPORT QgsFeatureRendererV2
|
||||
* Get the order in which features shall be processed by this renderer.
|
||||
* @note added in QGIS 2.14
|
||||
*/
|
||||
QgsFeatureRequest::OrderBy orderBy();
|
||||
QgsFeatureRequest::OrderBy orderBy() const;
|
||||
|
||||
/**
|
||||
* Define the order in which features shall be processed by this renderer.
|
||||
* @note added in QGIS 2.14
|
||||
*/
|
||||
void setOrderBy( const QgsFeatureRequest::OrderBy& orderBys );
|
||||
void setOrderBy( const QgsFeatureRequest::OrderBy& orderBy );
|
||||
|
||||
protected:
|
||||
QgsFeatureRendererV2( const QString& type );
|
||||
|
@ -911,7 +911,7 @@ QgsRuleBasedRendererV2* QgsRuleBasedRendererV2::clone() const
|
||||
QgsRuleBasedRendererV2* r = new QgsRuleBasedRendererV2( clonedRoot );
|
||||
|
||||
r->setUsingSymbolLevels( usingSymbolLevels() );
|
||||
copyPaintEffect( r );
|
||||
copyRendererData( r );
|
||||
return r;
|
||||
}
|
||||
|
||||
|
@ -71,7 +71,7 @@ void QgsOrderByDialog::setOrderBy( const QgsFeatureRequest::OrderBy& orderBy )
|
||||
|
||||
QgsFeatureRequest::OrderBy QgsOrderByDialog::orderBy()
|
||||
{
|
||||
QgsFeatureRequest::OrderBy orderBys;
|
||||
QgsFeatureRequest::OrderBy orderBy;
|
||||
|
||||
for ( int i = 0; i < mOrderByTableWidget->rowCount(); ++i )
|
||||
{
|
||||
@ -81,13 +81,13 @@ QgsFeatureRequest::OrderBy QgsOrderByDialog::orderBy()
|
||||
{
|
||||
bool asc = static_cast<QCheckBox*>( mOrderByTableWidget->cellWidget( i, 1 ) )->checkState();
|
||||
bool nullsFirst = static_cast<QCheckBox*>( mOrderByTableWidget->cellWidget( i, 2 ) )->checkState();
|
||||
QgsFeatureRequest::OrderByClause orderBy( expressionText, asc, nullsFirst );
|
||||
QgsFeatureRequest::OrderByClause orderByClause( expressionText, asc, nullsFirst );
|
||||
|
||||
orderBys << orderBy;
|
||||
orderBy << orderByClause;
|
||||
}
|
||||
}
|
||||
|
||||
return orderBys;
|
||||
return orderBy;
|
||||
}
|
||||
|
||||
void QgsOrderByDialog::onCellDoubleClicked( int row, int column )
|
||||
|
@ -197,7 +197,7 @@ void QgsMssqlFeatureIterator::BuildStatement( const QgsFeatureRequest& request )
|
||||
|
||||
if ( QSettings().value( "/qgis/compileExpressions", true ).toBool() )
|
||||
{
|
||||
Q_FOREACH ( const QgsFeatureRequest::OrderByClause& clause, request.orderBys() )
|
||||
Q_FOREACH ( const QgsFeatureRequest::OrderByClause& clause, request.orderBy() )
|
||||
{
|
||||
if (( clause.ascending() && !clause.nullsFirst() ) || ( !clause.ascending() && clause.nullsFirst() ) )
|
||||
{
|
||||
|
@ -118,7 +118,7 @@ QgsPostgresFeatureIterator::QgsPostgresFeatureIterator( QgsPostgresFeatureSource
|
||||
|
||||
if ( QSettings().value( "/qgis/compileExpressions", true ).toBool() )
|
||||
{
|
||||
Q_FOREACH ( const QgsFeatureRequest::OrderByClause& clause, request.orderBys() )
|
||||
Q_FOREACH ( const QgsFeatureRequest::OrderByClause& clause, request.orderBy() )
|
||||
{
|
||||
QgsPostgresExpressionCompiler compiler = QgsPostgresExpressionCompiler( source );
|
||||
QgsExpression expression = clause.expression();
|
||||
|
@ -123,7 +123,7 @@ QgsSpatiaLiteFeatureIterator::QgsSpatiaLiteFeatureIterator( QgsSpatiaLiteFeature
|
||||
|
||||
if ( QSettings().value( "/qgis/compileExpressions", true ).toBool() )
|
||||
{
|
||||
Q_FOREACH ( const QgsFeatureRequest::OrderByClause& clause, request.orderBys() )
|
||||
Q_FOREACH ( const QgsFeatureRequest::OrderByClause& clause, request.orderBy() )
|
||||
{
|
||||
QgsSpatiaLiteExpressionCompiler compiler = QgsSpatiaLiteExpressionCompiler( source );
|
||||
QgsExpression expression = clause.expression();
|
||||
|
Loading…
x
Reference in New Issue
Block a user