mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-08 00:05:09 -04:00
fix null temporal properties
This commit is contained in:
parent
a755ee9c0f
commit
99a832ef1e
@ -89,6 +89,22 @@ Returns the method used to match dataset from temporal capabilities
|
||||
Sets the method used to match dataset from temporal capabilities
|
||||
|
||||
:param matchingMethod: the matching method
|
||||
%End
|
||||
|
||||
bool isValid() const;
|
||||
%Docstring
|
||||
Returns whether the instance is valid
|
||||
|
||||
.. versionadded:: 3.22
|
||||
%End
|
||||
|
||||
void setIsValid( bool isValid );
|
||||
%Docstring
|
||||
Sets whether the instance is valid
|
||||
|
||||
:param isValid: whether the instance is valid
|
||||
|
||||
.. versionadded:: 3.22
|
||||
%End
|
||||
|
||||
};
|
||||
|
@ -747,6 +747,13 @@ Returns the active vector dataset group
|
||||
Sets the active vector dataset group
|
||||
|
||||
.. versionadded:: 3.14
|
||||
%End
|
||||
|
||||
bool hasSettings( int datasetGroupIndex ) const;
|
||||
%Docstring
|
||||
Returns whether the group with ``index`` has render settings (scalar or vector)
|
||||
|
||||
.. versionadded:: 3.22
|
||||
%End
|
||||
|
||||
};
|
||||
|
@ -49,8 +49,8 @@ QgsMeshLayer::QgsMeshLayer( const QString &meshLayerPath,
|
||||
const QString &providerKey,
|
||||
const QgsMeshLayer::LayerOptions &options )
|
||||
: QgsMapLayer( QgsMapLayerType::MeshLayer, baseName, meshLayerPath ),
|
||||
mDatasetGroupStore( new QgsMeshDatasetGroupStore( this ) )
|
||||
|
||||
mDatasetGroupStore( new QgsMeshDatasetGroupStore( this ) ),
|
||||
mTemporalProperties( new QgsMeshLayerTemporalProperties( this ) )
|
||||
{
|
||||
mShouldValidateCrs = !options.skipCrsValidation;
|
||||
|
||||
@ -1159,7 +1159,6 @@ void QgsMeshLayer::setDataSourcePrivate( const QString &dataSource, const QStrin
|
||||
|
||||
if ( !mDataSource.isEmpty() && !provider.isEmpty() )
|
||||
setDataProvider( provider, options, flags );
|
||||
|
||||
}
|
||||
|
||||
QgsPointXY QgsMeshLayer::snapOnElement( QgsMesh::ElementType elementType, const QgsPointXY &point, double searchRadius )
|
||||
@ -1497,8 +1496,6 @@ bool QgsMeshLayer::readXml( const QDomNode &layer_node, QgsReadWriteContext &con
|
||||
else
|
||||
mDatasetGroupStore->readXml( elemDatasetGroupsStore, context );
|
||||
|
||||
mTemporalProperties = new QgsMeshLayerTemporalProperties( this );
|
||||
|
||||
setDataProvider( mProviderKey, providerOptions, flags );
|
||||
|
||||
QString errorMsg;
|
||||
@ -1706,9 +1703,8 @@ bool QgsMeshLayer::setDataProvider( QString const &provider, const QgsDataProvid
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( !mTemporalProperties )
|
||||
if ( !mTemporalProperties->isValid() )
|
||||
{
|
||||
mTemporalProperties = new QgsMeshLayerTemporalProperties( this );
|
||||
mTemporalProperties->setDefaultsFromDataProviderTemporalCapabilities( dataProvider()->temporalCapabilities() );
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@ bool QgsMeshLayerTemporalProperties::readXml( const QDomElement &element, const
|
||||
mMatchingMethod = static_cast<QgsMeshDataProviderTemporalCapabilities::MatchingTemporalDatasetMethod>(
|
||||
temporalElement.attribute( QStringLiteral( "matching-method" ) ).toInt() );
|
||||
|
||||
mIsValid = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -74,6 +75,8 @@ void QgsMeshLayerTemporalProperties::setDefaultsFromDataProviderTemporalCapabili
|
||||
|
||||
if ( mReferenceTime.isValid() )
|
||||
mTimeExtent = temporalCapabilities->timeExtent();
|
||||
|
||||
mIsValid = true;
|
||||
}
|
||||
|
||||
QgsDateTimeRange QgsMeshLayerTemporalProperties::calculateTemporalExtent( QgsMapLayer * ) const
|
||||
@ -112,3 +115,13 @@ void QgsMeshLayerTemporalProperties::setMatchingMethod( const QgsMeshDataProvide
|
||||
{
|
||||
mMatchingMethod = matchingMethod;
|
||||
}
|
||||
|
||||
bool QgsMeshLayerTemporalProperties::isValid() const
|
||||
{
|
||||
return mIsValid;
|
||||
}
|
||||
|
||||
void QgsMeshLayerTemporalProperties::setIsValid( bool isValid )
|
||||
{
|
||||
mIsValid = isValid;
|
||||
}
|
||||
|
@ -100,11 +100,28 @@ class CORE_EXPORT QgsMeshLayerTemporalProperties : public QgsMapLayerTemporalPro
|
||||
*/
|
||||
void setMatchingMethod( const QgsMeshDataProviderTemporalCapabilities::MatchingTemporalDatasetMethod &matchingMethod );
|
||||
|
||||
/**
|
||||
* Returns whether the instance is valid
|
||||
*
|
||||
* \since QGIS 3.22
|
||||
*/
|
||||
bool isValid() const;
|
||||
|
||||
/**
|
||||
* Sets whether the instance is valid
|
||||
*
|
||||
* \param isValid whether the instance is valid
|
||||
*
|
||||
* \since QGIS 3.22
|
||||
*/
|
||||
void setIsValid( bool isValid );
|
||||
|
||||
private:
|
||||
QDateTime mReferenceTime;
|
||||
QgsDateTimeRange mTimeExtent;
|
||||
QgsMeshDataProviderTemporalCapabilities::MatchingTemporalDatasetMethod mMatchingMethod =
|
||||
QgsMeshDataProviderTemporalCapabilities::FindClosestDatasetBeforeStartRangeTime;
|
||||
bool mIsValid = false;
|
||||
};
|
||||
|
||||
#endif // QGSMESHLAYERTEMPORALPROPERTIES_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user