mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Make clip work for mockup
This commit is contained in:
parent
681d44f11f
commit
e75ebad2ce
@ -26,6 +26,13 @@ QString QgsClipAlgorithm::name() const
|
||||
return QStringLiteral( "clip" );
|
||||
}
|
||||
|
||||
QgsProcessingAlgorithm::Flags QgsClipAlgorithm::flags() const
|
||||
{
|
||||
Flags f = QgsProcessingAlgorithm::flags();
|
||||
f |= QgsProcessingAlgorithm::FlagSupportsInPlaceEdits;
|
||||
return f;
|
||||
}
|
||||
|
||||
QString QgsClipAlgorithm::displayName() const
|
||||
{
|
||||
return QObject::tr( "Clip" );
|
||||
|
@ -45,6 +45,7 @@ class QgsClipAlgorithm : public QgsProcessingAlgorithm
|
||||
QString shortHelpString() const override;
|
||||
QgsClipAlgorithm *createInstance() const override SIP_FACTORY;
|
||||
|
||||
QgsProcessingAlgorithm::Flags flags() const override;
|
||||
protected:
|
||||
|
||||
QVariantMap processAlgorithm( const QVariantMap ¶meters,
|
||||
|
@ -721,24 +721,26 @@ bool QgsProcessingToolboxProxyModel::filterAcceptsRow( int sourceRow, const QMod
|
||||
return false;
|
||||
|
||||
const QgsProcessingFeatureBasedAlgorithm *alg = dynamic_cast< const QgsProcessingFeatureBasedAlgorithm * >( mModel->algorithmForIndex( sourceIndex ) );
|
||||
if ( alg )
|
||||
{
|
||||
if ( !alg->inputLayerTypes().empty() &&
|
||||
!alg->inputLayerTypes().contains( QgsProcessing::TypeVector ) &&
|
||||
!alg->inputLayerTypes().contains( QgsProcessing::TypeVectorAnyGeometry ) &&
|
||||
( ( mInPlaceGeometryType == QgsWkbTypes::PolygonGeometry && !alg->inputLayerTypes().contains( QgsProcessing::TypeVectorPolygon ) ) ||
|
||||
( mInPlaceGeometryType == QgsWkbTypes::LineGeometry && !alg->inputLayerTypes().contains( QgsProcessing::TypeVectorLine ) ) ||
|
||||
( mInPlaceGeometryType == QgsWkbTypes::PointGeometry && !alg->inputLayerTypes().contains( QgsProcessing::TypeVectorPoint ) ) ) )
|
||||
return false;
|
||||
|
||||
if ( !alg->inputLayerTypes().empty() &&
|
||||
!alg->inputLayerTypes().contains( QgsProcessing::TypeVector ) &&
|
||||
!alg->inputLayerTypes().contains( QgsProcessing::TypeVectorAnyGeometry ) &&
|
||||
( ( mInPlaceGeometryType == QgsWkbTypes::PolygonGeometry && !alg->inputLayerTypes().contains( QgsProcessing::TypeVectorPolygon ) ) ||
|
||||
( mInPlaceGeometryType == QgsWkbTypes::LineGeometry && !alg->inputLayerTypes().contains( QgsProcessing::TypeVectorLine ) ) ||
|
||||
( mInPlaceGeometryType == QgsWkbTypes::PointGeometry && !alg->inputLayerTypes().contains( QgsProcessing::TypeVectorPoint ) ) ) )
|
||||
return false;
|
||||
|
||||
QgsWkbTypes::Type type = QgsWkbTypes::Unknown;
|
||||
if ( mInPlaceGeometryType == QgsWkbTypes::PointGeometry )
|
||||
type = QgsWkbTypes::Point;
|
||||
else if ( mInPlaceGeometryType == QgsWkbTypes::LineGeometry )
|
||||
type = QgsWkbTypes::LineString;
|
||||
else if ( mInPlaceGeometryType == QgsWkbTypes::PolygonGeometry )
|
||||
type = QgsWkbTypes::Polygon;
|
||||
if ( QgsWkbTypes::geometryType( alg->outputWkbType( type ) ) != mInPlaceGeometryType )
|
||||
return false;
|
||||
QgsWkbTypes::Type type = QgsWkbTypes::Unknown;
|
||||
if ( mInPlaceGeometryType == QgsWkbTypes::PointGeometry )
|
||||
type = QgsWkbTypes::Point;
|
||||
else if ( mInPlaceGeometryType == QgsWkbTypes::LineGeometry )
|
||||
type = QgsWkbTypes::LineString;
|
||||
else if ( mInPlaceGeometryType == QgsWkbTypes::PolygonGeometry )
|
||||
type = QgsWkbTypes::Polygon;
|
||||
if ( QgsWkbTypes::geometryType( alg->outputWkbType( type ) ) != mInPlaceGeometryType )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ( mFilters & FilterModeler )
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user