mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
remove QgsVectorLayer::hasGeometryType in favor of QgsMapLayer::isSpatial
This commit is contained in:
parent
1c273f815d
commit
5b8e2c2f27
@ -2411,6 +2411,7 @@ displayExpression instead. For the map tip use mapTipTemplate() instead.
|
||||
- annotationForm() and setAnnotationForm() have been removed. Form path is stored in individual QgsFormAnnotation objects.
|
||||
- setLayerTransparency, layerTransparency, and layerTransparencyChanged were removed. Use opacity, setOpacity and opacityChanged instead.
|
||||
- The c++ signature for uniqueValues() has changed (the PyQGIS method remains unchanged)
|
||||
- hasGeometryType() has been removed, replaced by QgsMapLayer::isSpatial()
|
||||
|
||||
|
||||
QgsVectorLayerEditBuffer {#qgis_api_break_3_0_QgsVectorLayerEditBuffer}
|
||||
|
@ -679,12 +679,6 @@ Returns point, line or polygon
|
||||
:rtype: QgsWkbTypes.GeometryType
|
||||
%End
|
||||
|
||||
bool hasGeometryType() const;
|
||||
%Docstring
|
||||
Returns true if this is a geometry layer and false in case of NoGeometry (table only) or UnknownGeometry
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
virtual QgsWkbTypes::Type wkbType() const;
|
||||
|
||||
%Docstring
|
||||
@ -1084,6 +1078,10 @@ Returns true if the provider is in editing mode
|
||||
%End
|
||||
|
||||
virtual bool isSpatial() const;
|
||||
%Docstring
|
||||
Returns true if this is a geometry layer and false in case of NoGeometry (table only) or UnknownGeometry
|
||||
:rtype: bool
|
||||
%End
|
||||
|
||||
virtual bool isModified() const;
|
||||
%Docstring
|
||||
|
@ -66,7 +66,7 @@ class DlgExportVector(QDialog, Ui_Dialog):
|
||||
def checkSupports(self):
|
||||
""" update options available for the current input layer """
|
||||
allowSpatial = self.db.connector.hasSpatialSupport()
|
||||
hasGeomType = self.inLayer and self.inLayer.hasGeometryType()
|
||||
hasGeomType = self.inLayer and self.inLayer.isSpatial()
|
||||
self.chkSourceSrid.setEnabled(allowSpatial and hasGeomType)
|
||||
self.chkTargetSrid.setEnabled(allowSpatial and hasGeomType)
|
||||
# self.chkSpatialIndex.setEnabled(allowSpatial and hasGeomType)
|
||||
|
@ -96,7 +96,7 @@ class DlgImportVector(QDialog, Ui_Dialog):
|
||||
def checkSupports(self):
|
||||
""" update options available for the current input layer """
|
||||
allowSpatial = self.db.connector.hasSpatialSupport()
|
||||
hasGeomType = self.inLayer and self.inLayer.hasGeometryType()
|
||||
hasGeomType = self.inLayer and self.inLayer.isSpatial()
|
||||
isShapefile = self.inLayer and self.inLayer.providerType() == "ogr" and self.inLayer.storageType() == "ESRI Shapefile"
|
||||
|
||||
self.chkGeomColumn.setEnabled(allowSpatial and hasGeomType)
|
||||
@ -310,7 +310,7 @@ class DlgImportVector(QDialog, Ui_Dialog):
|
||||
if not pk:
|
||||
pk = self.default_pk
|
||||
|
||||
if self.inLayer.hasGeometryType() and self.chkGeomColumn.isEnabled():
|
||||
if self.inLayer.isSpatial() and self.chkGeomColumn.isEnabled():
|
||||
geom = srcUri.geometryColumn() if not self.chkGeomColumn.isChecked() else self.editGeomColumn.text()
|
||||
if not geom:
|
||||
geom = self.default_geom
|
||||
|
@ -310,7 +310,7 @@ class OutputVector(Output):
|
||||
def hasGeometry(self):
|
||||
if self.base_layer is None:
|
||||
return True
|
||||
return self.base_layer.hasGeometryType()
|
||||
return self.base_layer.isSpatial()
|
||||
|
||||
def getSupportedOutputVectorLayerExtensions(self):
|
||||
exts = QgsVectorFileWriter.supportedFormatExtensions()
|
||||
|
@ -397,7 +397,7 @@ void QgsAttributeTableDialog::columnBoxInit()
|
||||
|
||||
mFilterButton->addAction( mActionShowAllFilter );
|
||||
mFilterButton->addAction( mActionSelectedFilter );
|
||||
if ( mLayer->hasGeometryType() )
|
||||
if ( mLayer->isSpatial() )
|
||||
{
|
||||
mFilterButton->addAction( mActionVisibleFilter );
|
||||
}
|
||||
@ -622,7 +622,7 @@ void QgsAttributeTableDialog::filterSelected()
|
||||
|
||||
void QgsAttributeTableDialog::filterVisible()
|
||||
{
|
||||
if ( !mLayer->hasGeometryType() )
|
||||
if ( !mLayer->isSpatial() )
|
||||
{
|
||||
filterShowAll();
|
||||
return;
|
||||
|
@ -320,7 +320,7 @@ bool QgsSnappingLayerTreeModel::nodeShown( QgsLayerTreeNode *node ) const
|
||||
else
|
||||
{
|
||||
QgsVectorLayer *layer = qobject_cast<QgsVectorLayer *>( QgsLayerTree::toLayer( node )->layer() );
|
||||
return layer && layer->hasGeometryType();
|
||||
return layer && layer->isSpatial();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -133,7 +133,7 @@ QgsVectorLayerProperties::QgsVectorLayerProperties(
|
||||
|
||||
QVBoxLayout *layout = nullptr;
|
||||
|
||||
if ( mLayer->hasGeometryType() )
|
||||
if ( mLayer->isSpatial() )
|
||||
{
|
||||
// Create the Labeling dialog tab
|
||||
layout = new QVBoxLayout( labelingFrame );
|
||||
|
@ -120,7 +120,7 @@ bool QgsMapLayerProxyModel::filterAcceptsRow( int source_row, const QModelIndex
|
||||
{
|
||||
if ( QgsVectorLayer *vl = qobject_cast< QgsVectorLayer *>( layer ) )
|
||||
{
|
||||
if ( mFilters.testFlag( HasGeometry ) && vl->hasGeometryType() )
|
||||
if ( mFilters.testFlag( HasGeometry ) && vl->isSpatial() )
|
||||
return true;
|
||||
if ( mFilters.testFlag( NoGeometry ) && vl->geometryType() == QgsWkbTypes::NullGeometry )
|
||||
return true;
|
||||
|
@ -526,7 +526,7 @@ QgsVectorLayer *QgsOfflineEditing::copyVectorLayer( QgsVectorLayer *layer, sqlit
|
||||
int rc = sqlExec( db, sql );
|
||||
|
||||
// add geometry column
|
||||
if ( layer->hasGeometryType() )
|
||||
if ( layer->isSpatial() )
|
||||
{
|
||||
QString geomType = QLatin1String( "" );
|
||||
switch ( layer->wkbType() )
|
||||
@ -576,7 +576,7 @@ QgsVectorLayer *QgsOfflineEditing::copyVectorLayer( QgsVectorLayer *layer, sqlit
|
||||
// add new layer
|
||||
QString connectionString = QStringLiteral( "dbname='%1' table='%2'%3 sql=" )
|
||||
.arg( offlineDbPath,
|
||||
tableName, layer->hasGeometryType() ? "(Geometry)" : "" );
|
||||
tableName, layer->isSpatial() ? "(Geometry)" : "" );
|
||||
QgsVectorLayer *newLayer = new QgsVectorLayer( connectionString,
|
||||
layer->name() + " (offline)", QStringLiteral( "spatialite" ) );
|
||||
if ( newLayer->isValid() )
|
||||
|
@ -265,7 +265,7 @@ QgsSnappingConfig::IndividualLayerSettings QgsSnappingConfig::individualLayerSet
|
||||
|
||||
void QgsSnappingConfig::setIndividualLayerSettings( QgsVectorLayer *vl, const IndividualLayerSettings &individualLayerSettings )
|
||||
{
|
||||
if ( !vl || !vl->hasGeometryType() || mIndividualLayerSettings.value( vl ) == individualLayerSettings )
|
||||
if ( !vl || !vl->isSpatial() || mIndividualLayerSettings.value( vl ) == individualLayerSettings )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -382,7 +382,7 @@ bool QgsSnappingConfig::addLayers( const QList<QgsMapLayer *> &layers )
|
||||
Q_FOREACH ( QgsMapLayer *ml, layers )
|
||||
{
|
||||
QgsVectorLayer *vl = qobject_cast<QgsVectorLayer *>( ml );
|
||||
if ( vl && vl->hasGeometryType() )
|
||||
if ( vl && vl->isSpatial() )
|
||||
{
|
||||
mIndividualLayerSettings.insert( vl, IndividualLayerSettings( enabled, type, tolerance, units ) );
|
||||
changed = true;
|
||||
@ -449,7 +449,7 @@ void QgsSnappingConfig::readLegacySettings()
|
||||
for ( ; layerIt != layerIdList.constEnd(); ++layerIt, ++tolIt, ++tolUnitIt, ++snapIt, ++enabledIt )
|
||||
{
|
||||
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mProject->mapLayer( *layerIt ) );
|
||||
if ( !vlayer || !vlayer->hasGeometryType() )
|
||||
if ( !vlayer || !vlayer->isSpatial() )
|
||||
continue;
|
||||
|
||||
SnappingType t( *snapIt == QLatin1String( "to_vertex" ) ? Vertex :
|
||||
|
@ -615,12 +615,6 @@ QgsWkbTypes::GeometryType QgsVectorLayer::geometryType() const
|
||||
return QgsWkbTypes::UnknownGeometry;
|
||||
}
|
||||
|
||||
bool QgsVectorLayer::hasGeometryType() const
|
||||
{
|
||||
QgsWkbTypes::GeometryType t = geometryType();
|
||||
return t != QgsWkbTypes::NullGeometry && t != QgsWkbTypes::UnknownGeometry;
|
||||
}
|
||||
|
||||
QgsWkbTypes::Type QgsVectorLayer::wkbType() const
|
||||
{
|
||||
return mWkbType;
|
||||
@ -628,7 +622,7 @@ QgsWkbTypes::Type QgsVectorLayer::wkbType() const
|
||||
|
||||
QgsRectangle QgsVectorLayer::boundingBoxOfSelected() const
|
||||
{
|
||||
if ( !mValid || !hasGeometryType() || mSelectedFeatureIds.isEmpty() ) //no selected features
|
||||
if ( !mValid || !isSpatial() || mSelectedFeatureIds.isEmpty() ) //no selected features
|
||||
{
|
||||
return QgsRectangle( 0, 0, 0, 0 );
|
||||
}
|
||||
@ -801,7 +795,7 @@ QgsRectangle QgsVectorLayer::extent() const
|
||||
QgsRectangle rect;
|
||||
rect.setMinimal();
|
||||
|
||||
if ( !hasGeometryType() )
|
||||
if ( !isSpatial() )
|
||||
return rect;
|
||||
|
||||
if ( !mValidExtent && mLazyExtent && mDataProvider )
|
||||
@ -922,7 +916,7 @@ bool QgsVectorLayer::setSubsetString( const QString &subset )
|
||||
|
||||
bool QgsVectorLayer::simplifyDrawingCanbeApplied( const QgsRenderContext &renderContext, QgsVectorSimplifyMethod::SimplifyHint simplifyHint ) const
|
||||
{
|
||||
if ( mValid && mDataProvider && !mEditBuffer && ( hasGeometryType() && geometryType() != QgsWkbTypes::PointGeometry ) && ( mSimplifyMethod.simplifyHints() & simplifyHint ) && renderContext.useRenderingOptimization() )
|
||||
if ( mValid && mDataProvider && !mEditBuffer && ( isSpatial() && geometryType() != QgsWkbTypes::PointGeometry ) && ( mSimplifyMethod.simplifyHints() & simplifyHint ) && renderContext.useRenderingOptimization() )
|
||||
{
|
||||
double maximumSimplificationScale = mSimplifyMethod.maximumScale();
|
||||
|
||||
@ -1461,7 +1455,7 @@ void QgsVectorLayer::setDataSource( const QString &dataSource, const QString &ba
|
||||
}
|
||||
|
||||
// if the default style failed to load or was disabled use some very basic defaults
|
||||
if ( !defaultLoadedFlag && hasGeometryType() )
|
||||
if ( !defaultLoadedFlag && isSpatial() )
|
||||
{
|
||||
// add single symbol renderer
|
||||
setRenderer( QgsFeatureRenderer::defaultRenderer( geometryType() ) );
|
||||
@ -1832,7 +1826,7 @@ bool QgsVectorLayer::readStyle( const QDomNode &node, QString &errorMessage, con
|
||||
bool result = true;
|
||||
emit readCustomSymbology( node.toElement(), errorMessage );
|
||||
|
||||
if ( hasGeometryType() )
|
||||
if ( isSpatial() )
|
||||
{
|
||||
// try renderer v2 first
|
||||
QDomElement rendererElement = node.firstChildElement( RENDERER_TAG_NAME );
|
||||
@ -2132,7 +2126,7 @@ bool QgsVectorLayer::writeStyle( QDomNode &node, QDomDocument &doc, QString &err
|
||||
|
||||
emit writeCustomSymbology( mapLayerNode, doc, errorMessage );
|
||||
|
||||
if ( hasGeometryType() )
|
||||
if ( isSpatial() )
|
||||
{
|
||||
if ( mRenderer )
|
||||
{
|
||||
@ -2193,7 +2187,7 @@ bool QgsVectorLayer::readSld( const QDomNode &node, QString &errorMessage )
|
||||
errorMessage = QStringLiteral( "Warning: Name element not found within NamedLayer while it's required." );
|
||||
}
|
||||
|
||||
if ( hasGeometryType() )
|
||||
if ( isSpatial() )
|
||||
{
|
||||
QgsFeatureRenderer *r = QgsFeatureRenderer::loadSld( node, geometryType(), errorMessage );
|
||||
if ( !r )
|
||||
@ -2222,7 +2216,7 @@ bool QgsVectorLayer::writeSld( QDomNode &node, QDomDocument &doc, QString &error
|
||||
QgsSymbolLayerUtils::mergeScaleDependencies( maximumScale(), minimumScale(), localProps );
|
||||
}
|
||||
|
||||
if ( hasGeometryType() )
|
||||
if ( isSpatial() )
|
||||
{
|
||||
node.appendChild( mRenderer->writeSld( doc, name(), localProps ) );
|
||||
}
|
||||
@ -2613,7 +2607,7 @@ void QgsVectorLayer::setCoordinateSystem()
|
||||
// for this layer
|
||||
//
|
||||
|
||||
if ( hasGeometryType() )
|
||||
if ( isSpatial() )
|
||||
{
|
||||
// get CRS directly from provider
|
||||
setCrs( mDataProvider->crs() );
|
||||
@ -2698,7 +2692,8 @@ bool QgsVectorLayer::isEditable() const
|
||||
|
||||
bool QgsVectorLayer::isSpatial() const
|
||||
{
|
||||
return geometryType() != QgsWkbTypes::NullGeometry;
|
||||
QgsWkbTypes::GeometryType t = geometryType();
|
||||
return t != QgsWkbTypes::NullGeometry && t != QgsWkbTypes::UnknownGeometry;
|
||||
}
|
||||
|
||||
bool QgsVectorLayer::isReadOnly() const
|
||||
@ -2725,7 +2720,7 @@ bool QgsVectorLayer::isModified() const
|
||||
|
||||
void QgsVectorLayer::setRenderer( QgsFeatureRenderer *r )
|
||||
{
|
||||
if ( !hasGeometryType() )
|
||||
if ( !isSpatial() )
|
||||
return;
|
||||
|
||||
if ( r != mRenderer )
|
||||
|
@ -688,9 +688,6 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
|
||||
//! Returns point, line or polygon
|
||||
QgsWkbTypes::GeometryType geometryType() const;
|
||||
|
||||
//! Returns true if this is a geometry layer and false in case of NoGeometry (table only) or UnknownGeometry
|
||||
bool hasGeometryType() const;
|
||||
|
||||
//! Returns the WKBType or WKBUnknown in case of error
|
||||
QgsWkbTypes::Type wkbType() const override;
|
||||
|
||||
@ -1065,6 +1062,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
|
||||
//! Returns true if the provider is in editing mode
|
||||
virtual bool isEditable() const override;
|
||||
|
||||
//! Returns true if this is a geometry layer and false in case of NoGeometry (table only) or UnknownGeometry
|
||||
virtual bool isSpatial() const override;
|
||||
|
||||
//! Returns true if the provider has been modified since the last commit
|
||||
|
@ -58,7 +58,7 @@ int QgsVectorLayerCache::cacheSize()
|
||||
|
||||
void QgsVectorLayerCache::setCacheGeometry( bool cacheGeometry )
|
||||
{
|
||||
bool shouldCacheGeometry = cacheGeometry && mLayer->hasGeometryType();
|
||||
bool shouldCacheGeometry = cacheGeometry && mLayer->isSpatial();
|
||||
bool mustInvalidate = shouldCacheGeometry && !mCacheGeometry; // going from no geometry -> geometry, so have to clear existing cache entries
|
||||
mCacheGeometry = shouldCacheGeometry;
|
||||
if ( cacheGeometry )
|
||||
@ -377,7 +377,7 @@ QgsFeatureIterator QgsVectorLayerCache::getFeatures( const QgsFeatureRequest &fe
|
||||
QgsFeatureRequest myRequest = QgsFeatureRequest( featureRequest );
|
||||
|
||||
// Make sure if we cache the geometry, it gets fetched
|
||||
if ( mCacheGeometry && mLayer->hasGeometryType() )
|
||||
if ( mCacheGeometry && mLayer->isSpatial() )
|
||||
myRequest.setFlags( featureRequest.flags() & ~QgsFeatureRequest::NoGeometry );
|
||||
|
||||
// Make sure, all the cached attributes are requested as well
|
||||
|
@ -189,7 +189,7 @@ bool QgsVectorLayerEditBuffer::deleteFeatures( const QgsFeatureIds &fids )
|
||||
|
||||
bool QgsVectorLayerEditBuffer::changeGeometry( QgsFeatureId fid, const QgsGeometry &geom )
|
||||
{
|
||||
if ( !L->hasGeometryType() )
|
||||
if ( !L->isSpatial() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -35,7 +35,7 @@ QgsVectorLayerEditUtils::QgsVectorLayerEditUtils( QgsVectorLayer *layer )
|
||||
|
||||
bool QgsVectorLayerEditUtils::insertVertex( double x, double y, QgsFeatureId atFeatureId, int beforeVertex )
|
||||
{
|
||||
if ( !L->hasGeometryType() )
|
||||
if ( !L->isSpatial() )
|
||||
return false;
|
||||
|
||||
QgsFeature f;
|
||||
@ -52,7 +52,7 @@ bool QgsVectorLayerEditUtils::insertVertex( double x, double y, QgsFeatureId atF
|
||||
|
||||
bool QgsVectorLayerEditUtils::insertVertex( const QgsPoint &point, QgsFeatureId atFeatureId, int beforeVertex )
|
||||
{
|
||||
if ( !L->hasGeometryType() )
|
||||
if ( !L->isSpatial() )
|
||||
return false;
|
||||
|
||||
QgsFeature f;
|
||||
@ -75,7 +75,7 @@ bool QgsVectorLayerEditUtils::moveVertex( double x, double y, QgsFeatureId atFea
|
||||
|
||||
bool QgsVectorLayerEditUtils::moveVertex( const QgsPoint &p, QgsFeatureId atFeatureId, int atVertex )
|
||||
{
|
||||
if ( !L->hasGeometryType() )
|
||||
if ( !L->isSpatial() )
|
||||
return false;
|
||||
|
||||
QgsFeature f;
|
||||
@ -93,7 +93,7 @@ bool QgsVectorLayerEditUtils::moveVertex( const QgsPoint &p, QgsFeatureId atFeat
|
||||
|
||||
QgsVectorLayer::EditResult QgsVectorLayerEditUtils::deleteVertex( QgsFeatureId featureId, int vertex )
|
||||
{
|
||||
if ( !L->hasGeometryType() )
|
||||
if ( !L->isSpatial() )
|
||||
return QgsVectorLayer::InvalidLayer;
|
||||
|
||||
QgsFeature f;
|
||||
@ -123,7 +123,7 @@ int QgsVectorLayerEditUtils::addRing( const QList<QgsPointXY> &ring, const QgsFe
|
||||
|
||||
int QgsVectorLayerEditUtils::addRing( QgsCurve *ring, const QgsFeatureIds &targetFeatureIds, QgsFeatureId *modifiedFeatureId )
|
||||
{
|
||||
if ( !L->hasGeometryType() )
|
||||
if ( !L->isSpatial() )
|
||||
{
|
||||
delete ring;
|
||||
return 5;
|
||||
@ -182,7 +182,7 @@ int QgsVectorLayerEditUtils::addPart( const QList<QgsPointXY> &points, QgsFeatur
|
||||
|
||||
int QgsVectorLayerEditUtils::addPart( const QgsPointSequence &points, QgsFeatureId featureId )
|
||||
{
|
||||
if ( !L->hasGeometryType() )
|
||||
if ( !L->isSpatial() )
|
||||
return 6;
|
||||
|
||||
QgsGeometry geometry;
|
||||
@ -217,7 +217,7 @@ int QgsVectorLayerEditUtils::addPart( const QgsPointSequence &points, QgsFeature
|
||||
|
||||
int QgsVectorLayerEditUtils::addPart( QgsCurve *ring, QgsFeatureId featureId )
|
||||
{
|
||||
if ( !L->hasGeometryType() )
|
||||
if ( !L->isSpatial() )
|
||||
return 6;
|
||||
|
||||
QgsGeometry geometry;
|
||||
@ -253,7 +253,7 @@ int QgsVectorLayerEditUtils::addPart( QgsCurve *ring, QgsFeatureId featureId )
|
||||
|
||||
int QgsVectorLayerEditUtils::translateFeature( QgsFeatureId featureId, double dx, double dy )
|
||||
{
|
||||
if ( !L->hasGeometryType() )
|
||||
if ( !L->isSpatial() )
|
||||
return 1;
|
||||
|
||||
QgsFeature f;
|
||||
@ -273,7 +273,7 @@ int QgsVectorLayerEditUtils::translateFeature( QgsFeatureId featureId, double dx
|
||||
|
||||
int QgsVectorLayerEditUtils::splitFeatures( const QList<QgsPointXY> &splitLine, bool topologicalEditing )
|
||||
{
|
||||
if ( !L->hasGeometryType() )
|
||||
if ( !L->isSpatial() )
|
||||
return 4;
|
||||
|
||||
QgsFeatureList newFeatures; //store all the newly created features
|
||||
@ -384,7 +384,7 @@ int QgsVectorLayerEditUtils::splitFeatures( const QList<QgsPointXY> &splitLine,
|
||||
|
||||
int QgsVectorLayerEditUtils::splitParts( const QList<QgsPointXY> &splitLine, bool topologicalEditing )
|
||||
{
|
||||
if ( !L->hasGeometryType() )
|
||||
if ( !L->isSpatial() )
|
||||
return 4;
|
||||
|
||||
double xMin, yMin, xMax, yMax;
|
||||
@ -520,7 +520,7 @@ int QgsVectorLayerEditUtils::splitParts( const QList<QgsPointXY> &splitLine, boo
|
||||
|
||||
int QgsVectorLayerEditUtils::addTopologicalPoints( const QgsGeometry &geom )
|
||||
{
|
||||
if ( !L->hasGeometryType() )
|
||||
if ( !L->isSpatial() )
|
||||
return 1;
|
||||
|
||||
if ( geom.isNull() )
|
||||
@ -628,7 +628,7 @@ int QgsVectorLayerEditUtils::addTopologicalPoints( const QgsGeometry &geom )
|
||||
|
||||
int QgsVectorLayerEditUtils::addTopologicalPoints( const QgsPointXY &p )
|
||||
{
|
||||
if ( !L->hasGeometryType() )
|
||||
if ( !L->isSpatial() )
|
||||
return 1;
|
||||
|
||||
double segmentSearchEpsilon = L->crs().isGeographic() ? 1e-12 : 1e-8;
|
||||
|
@ -56,7 +56,7 @@ QgsAttributeTableModel::QgsAttributeTableModel( QgsVectorLayerCache *layerCache,
|
||||
|
||||
mFeat.setId( std::numeric_limits<int>::min() );
|
||||
|
||||
if ( !layer()->hasGeometryType() )
|
||||
if ( !layer()->isSpatial() )
|
||||
mFeatureRequest.setFlags( QgsFeatureRequest::NoGeometry );
|
||||
|
||||
loadAttributes();
|
||||
@ -867,7 +867,7 @@ QString QgsAttributeTableModel::sortCacheExpression() const
|
||||
void QgsAttributeTableModel::setRequest( const QgsFeatureRequest &request )
|
||||
{
|
||||
mFeatureRequest = request;
|
||||
if ( layer() && !layer()->hasGeometryType() )
|
||||
if ( layer() && !layer()->isSpatial() )
|
||||
mFeatureRequest.setFlags( mFeatureRequest.flags() | QgsFeatureRequest::NoGeometry );
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ void QgsRelationReferenceConfigDlg::relationChanged( int idx )
|
||||
if ( mReferencedLayer )
|
||||
{
|
||||
mExpressionWidget->setField( mReferencedLayer->displayExpression() );
|
||||
mCbxMapIdentification->setEnabled( mReferencedLayer->hasGeometryType() );
|
||||
mCbxMapIdentification->setEnabled( mReferencedLayer->isSpatial() );
|
||||
}
|
||||
|
||||
loadFields();
|
||||
|
@ -904,7 +904,7 @@ void QgsMapCanvas::zoomToSelected( QgsVectorLayer *layer )
|
||||
layer = qobject_cast<QgsVectorLayer *>( mCurrentLayer );
|
||||
}
|
||||
|
||||
if ( !layer || !layer->hasGeometryType() || layer->selectedFeatureCount() == 0 )
|
||||
if ( !layer || !layer->isSpatial() || layer->selectedFeatureCount() == 0 )
|
||||
return;
|
||||
|
||||
QgsRectangle rect = layer->boundingBoxOfSelected();
|
||||
@ -1027,7 +1027,7 @@ void QgsMapCanvas::panToSelected( QgsVectorLayer *layer )
|
||||
layer = qobject_cast<QgsVectorLayer *>( mCurrentLayer );
|
||||
}
|
||||
|
||||
if ( !layer || !layer->hasGeometryType() || layer->selectedFeatureCount() == 0 )
|
||||
if ( !layer || !layer->isSpatial() || layer->selectedFeatureCount() == 0 )
|
||||
return;
|
||||
|
||||
QgsRectangle rect = layer->boundingBoxOfSelected();
|
||||
|
@ -199,7 +199,7 @@ bool QgsMapToolIdentify::identifyLayer( QList<IdentifyResult> *results, QgsMapLa
|
||||
|
||||
bool QgsMapToolIdentify::identifyVectorLayer( QList<IdentifyResult> *results, QgsVectorLayer *layer, const QgsPointXY &point )
|
||||
{
|
||||
if ( !layer || !layer->hasGeometryType() )
|
||||
if ( !layer || !layer->isSpatial() )
|
||||
return false;
|
||||
|
||||
if ( !layer->isInScaleRange( mCanvas->mapSettings().scale() ) )
|
||||
|
@ -1806,7 +1806,7 @@ QDomDocument QgsWmsProjectParser::getStyles( QStringList &layerList ) const
|
||||
|
||||
Q_FOREACH ( QString styleName, layer->styleManager()->styles() )
|
||||
{
|
||||
if ( layer->hasGeometryType() )
|
||||
if ( layer->isSpatial() )
|
||||
{
|
||||
layer->styleManager()->setCurrentStyle( styleName );
|
||||
if ( styleName.isEmpty() )
|
||||
|
@ -196,7 +196,7 @@ namespace QgsWfs
|
||||
extensionElem.appendChild( sequenceElem );
|
||||
|
||||
//xsd:element
|
||||
if ( layer->hasGeometryType() )
|
||||
if ( layer->isSpatial() )
|
||||
{
|
||||
QDomElement geomElem = doc.createElement( QStringLiteral( "element" )/*xsd:element*/ );
|
||||
geomElem.setAttribute( QStringLiteral( "name" ), QStringLiteral( "geometry" ) );
|
||||
|
@ -169,7 +169,7 @@ namespace QgsWms
|
||||
if ( layer->type() == QgsMapLayer::VectorLayer )
|
||||
{
|
||||
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
|
||||
if ( vlayer->hasGeometryType() )
|
||||
if ( vlayer->isSpatial() )
|
||||
{
|
||||
QString currentStyle = vlayer->styleManager()->currentStyle();
|
||||
Q_FOREACH ( QString styleName, vlayer->styleManager()->styles() )
|
||||
|
@ -135,12 +135,12 @@ class OfflineTestBase(object):
|
||||
# goes offline
|
||||
ol = QgsOfflineEditing()
|
||||
online_layer = list(self.registry.mapLayers().values())[0]
|
||||
self.assertTrue(online_layer.hasGeometryType())
|
||||
self.assertTrue(online_layer.isSpatial())
|
||||
# Check we have features
|
||||
self.assertEqual(len([f for f in online_layer.getFeatures()]), len(TEST_FEATURES))
|
||||
self.assertTrue(ol.convertToOfflineProject(self.temp_path, 'offlineDbFile.sqlite', [online_layer.id()]))
|
||||
offline_layer = list(self.registry.mapLayers().values())[0]
|
||||
self.assertTrue(offline_layer.hasGeometryType())
|
||||
self.assertTrue(offline_layer.isSpatial())
|
||||
self.assertTrue(offline_layer.isValid())
|
||||
self.assertTrue(offline_layer.name().find('(offline)') > -1)
|
||||
self.assertEqual(len([f for f in offline_layer.getFeatures()]), len(TEST_FEATURES))
|
||||
|
@ -257,7 +257,7 @@ class TestQgsSpatialiteProvider(unittest.TestCase, ProviderTestCase):
|
||||
"""Create spatialite database"""
|
||||
layer = QgsVectorLayer("dbname=%s table=test_pg (geometry)" % self.dbname, "test_pg", "spatialite")
|
||||
self.assertTrue(layer.isValid())
|
||||
self.assertTrue(layer.hasGeometryType())
|
||||
self.assertTrue(layer.isSpatial())
|
||||
layer.startEditing()
|
||||
self.assertEqual(layer.splitFeatures([QgsPointXY(0.75, -0.5), QgsPointXY(0.75, 1.5)], 0), 0)
|
||||
self.assertEqual(layer.splitFeatures([QgsPointXY(-0.5, 0.25), QgsPointXY(1.5, 0.25)], 0), 0)
|
||||
@ -268,7 +268,7 @@ class TestQgsSpatialiteProvider(unittest.TestCase, ProviderTestCase):
|
||||
"""Create spatialite database"""
|
||||
layer = QgsVectorLayer("dbname=%s table=test_pg_mk (geometry)" % self.dbname, "test_pg_mk", "spatialite")
|
||||
self.assertTrue(layer.isValid())
|
||||
self.assertTrue(layer.hasGeometryType())
|
||||
self.assertTrue(layer.isSpatial())
|
||||
layer.startEditing()
|
||||
self.assertEqual(layer.splitFeatures([QgsPointXY(0.5, -0.5), QgsPointXY(0.5, 1.5)], 0), 0)
|
||||
self.assertEqual(layer.splitFeatures([QgsPointXY(-0.5, 0.5), QgsPointXY(1.5, 0.5)], 0), 0)
|
||||
|
@ -94,7 +94,7 @@ class TestQgsSpatialiteProvider(unittest.TestCase):
|
||||
"""Split multipolygon"""
|
||||
layer = QgsVectorLayer("dbname=test.sqlite table=test_mpg (geometry)", "test_mpg", "spatialite")
|
||||
assert(layer.isValid())
|
||||
assert(layer.hasGeometryType())
|
||||
assert(layer.isSpatial())
|
||||
layer.featureCount() == 1 or die("wrong number of features")
|
||||
layer.startEditing()
|
||||
layer.splitFeatures([QgsPointXY(0.5, -0.5), QgsPointXY(0.5, 1.5)], 0) == 0 or die("error in split of one polygon of multipolygon")
|
||||
@ -106,7 +106,7 @@ class TestQgsSpatialiteProvider(unittest.TestCase):
|
||||
"""Try to creat a cut edge"""
|
||||
layer = QgsVectorLayer("dbname=test.sqlite table=test_pg (geometry)", "test_pg", "spatialite")
|
||||
assert(layer.isValid())
|
||||
assert(layer.hasGeometryType())
|
||||
assert(layer.isSpatial())
|
||||
layer.featureCount() == 1 or die("wrong number of features")
|
||||
layer.startEditing()
|
||||
layer.splitFeatures([QgsPointXY(1.5, -0.5), QgsPointXY(1.5, 1.5)], 0) == 0 or die("error when trying to create an invalid polygon in split")
|
||||
|
Loading…
x
Reference in New Issue
Block a user