Skip to content
Permalink
Browse files

Make clip work for mockup

  • Loading branch information
nyalldawson committed Sep 14, 2018
1 parent 681d44f commit e75ebad2ce7d9e9355afdee4f3d7d752599c4fec
@@ -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 &parameters,
@@ -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->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;
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;

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 )
{

0 comments on commit e75ebad

Please sign in to comment.
You can’t perform that action at this time.