File tree Expand file tree Collapse file tree 3 files changed +60
-0
lines changed
python/core/auto_generated/proj Expand file tree Collapse file tree 3 files changed +60
-0
lines changed Original file line number Diff line number Diff line change @@ -1123,6 +1123,20 @@ Pushes a recently used CRS to the top of the recent CRS list.
1123
1123
.. versionadded:: 3.10.3
1124
1124
%End
1125
1125
1126
+ static void removeRecentCoordinateReferenceSystem( const QgsCoordinateReferenceSystem &crs );
1127
+ %Docstring
1128
+ Removes a CRS from the list of recently used CRS.
1129
+
1130
+ .. versionadded:: 3.32
1131
+ %End
1132
+
1133
+ static void clearRecentCoordinateReferenceSystems();
1134
+ %Docstring
1135
+ Cleans the list of recently used CRS.
1136
+
1137
+ .. versionadded:: 3.32
1138
+ %End
1139
+
1126
1140
1127
1141
static void invalidateCache();
1128
1142
%Docstring
Original file line number Diff line number Diff line change @@ -2942,6 +2942,40 @@ void QgsCoordinateReferenceSystem::pushRecentCoordinateReferenceSystem( const Qg
2942
2942
settings.setValue ( QStringLiteral ( " UI/recentProjectionsProj4" ), proj );
2943
2943
}
2944
2944
2945
+
2946
+ void QgsCoordinateReferenceSystem::removeRecentCoordinateReferenceSystem ( const QgsCoordinateReferenceSystem &crs )
2947
+ {
2948
+ if ( crs.srsid () == 0 || !crs.isValid () )
2949
+ return ;
2950
+
2951
+ QList<QgsCoordinateReferenceSystem> recent = recentCoordinateReferenceSystems ();
2952
+ recent.removeAll ( crs );
2953
+ QStringList authids;
2954
+ authids.reserve ( recent.size () );
2955
+ QStringList proj;
2956
+ proj.reserve ( recent.size () );
2957
+ QStringList wkt;
2958
+ wkt.reserve ( recent.size () );
2959
+ for ( const QgsCoordinateReferenceSystem &c : std::as_const ( recent ) )
2960
+ {
2961
+ authids << c.authid ();
2962
+ proj << c.toProj ();
2963
+ wkt << c.toWkt ( WKT_PREFERRED );
2964
+ }
2965
+ QgsSettings settings;
2966
+ settings.setValue ( QStringLiteral ( " UI/recentProjectionsAuthId" ), authids );
2967
+ settings.setValue ( QStringLiteral ( " UI/recentProjectionsWkt" ), wkt );
2968
+ settings.setValue ( QStringLiteral ( " UI/recentProjectionsProj4" ), proj );
2969
+ }
2970
+
2971
+ void QgsCoordinateReferenceSystem::clearRecentCoordinateReferenceSystems ()
2972
+ {
2973
+ QgsSettings settings;
2974
+ settings.remove ( QStringLiteral ( " UI/recentProjectionsAuthId" ) );
2975
+ settings.remove ( QStringLiteral ( " UI/recentProjectionsWkt" ) );
2976
+ settings.remove ( QStringLiteral ( " UI/recentProjectionsProj4" ) );
2977
+ }
2978
+
2945
2979
void QgsCoordinateReferenceSystem::invalidateCache ( bool disableCache )
2946
2980
{
2947
2981
sSrIdCacheLock ()->lockForWrite ();
Original file line number Diff line number Diff line change @@ -1063,6 +1063,18 @@ class CORE_EXPORT QgsCoordinateReferenceSystem
1063
1063
*/
1064
1064
static void pushRecentCoordinateReferenceSystem ( const QgsCoordinateReferenceSystem &crs );
1065
1065
1066
+ /* *
1067
+ * Removes a CRS from the list of recently used CRS.
1068
+ * \since QGIS 3.32
1069
+ */
1070
+ static void removeRecentCoordinateReferenceSystem ( const QgsCoordinateReferenceSystem &crs );
1071
+
1072
+ /* *
1073
+ * Cleans the list of recently used CRS.
1074
+ * \since QGIS 3.32
1075
+ */
1076
+ static void clearRecentCoordinateReferenceSystems ();
1077
+
1066
1078
#ifndef SIP_RUN
1067
1079
1068
1080
/* *
You can’t perform that action at this time.
0 commit comments