mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
More Q_GLOBAL_STATIC
Because it's pure fun
This commit is contained in:
parent
3e10767f63
commit
208ea9b033
18
python/core/additions/qgis.py
Normal file
18
python/core/additions/qgis.py
Normal file
@ -0,0 +1,18 @@
|
||||
from qgis.core import Qgis
|
||||
from qgis.core import geoWkt
|
||||
from qgis.core import projectScales
|
||||
from qgis.core import geoProj4
|
||||
from qgis.core import geoEpsgCrsAuthId
|
||||
from qgis.core import geoNone
|
||||
|
||||
from qgis import core
|
||||
|
||||
Qgis.QGIS_VERSION = Qgis.version()
|
||||
Qgis.QGIS_VERSIONi_INT = Qgis.versionInt()
|
||||
Qgis.QGIS_VERSION_RELEASE_NAME = Qgis.releaseName()
|
||||
|
||||
core.GEOWKT = geoWkt()
|
||||
core.PROJECT_SCALES = projectScales()
|
||||
core.GEOPROJ4 = geoProj4()
|
||||
core.GEO_EPSG_CRS_AUTHID = geoEpsgCrsAuthId()
|
||||
core.GEO_NONE = geoNone()
|
@ -32,10 +32,20 @@ The Qgis class provides global constants for use throughout the application.
|
||||
static const QMetaObject staticMetaObject;
|
||||
|
||||
public:
|
||||
static const QString QGIS_VERSION;
|
||||
static const int QGIS_VERSION_INT;
|
||||
static const QString QGIS_RELEASE_NAME;
|
||||
static QString version();
|
||||
%Docstring
|
||||
Version string
|
||||
%End
|
||||
static int versionInt();
|
||||
%Docstring
|
||||
Version number used for comparing versions using the "Check QGIS Version" function
|
||||
%End
|
||||
static QString releaseName();
|
||||
%Docstring
|
||||
Release name
|
||||
%End
|
||||
static const char *QGIS_DEV_VERSION;
|
||||
static QString devVersion();
|
||||
|
||||
|
||||
enum MessageLevel
|
||||
@ -230,18 +240,31 @@ QString qgsVsiPrefix( const QString &path );
|
||||
|
||||
|
||||
|
||||
const QString GEOWKT;
|
||||
const QString PROJECT_SCALES;
|
||||
QString geoWkt();
|
||||
%Docstring
|
||||
Wkt string that represents a geographic coord sys
|
||||
\since QGIS GEOWkt
|
||||
%End
|
||||
QString projectScales();
|
||||
|
||||
const QString GEOPROJ4;
|
||||
QString geoProj4();
|
||||
%Docstring
|
||||
PROJ4 string that represents a geographic coord sys
|
||||
%End
|
||||
const long GEOSRID;
|
||||
const long GEOCRS_ID;
|
||||
const long GEO_EPSG_CRS_ID;
|
||||
const QString GEO_EPSG_CRS_AUTHID;
|
||||
QString geoEpsgCrsAuthId();
|
||||
%Docstring
|
||||
Geographic coord sys from EPSG authority
|
||||
%End
|
||||
|
||||
const int USER_CRS_START_ID;
|
||||
|
||||
const QString GEO_NONE;
|
||||
QString geoNone();
|
||||
%Docstring
|
||||
Constant that holds the string representation for "No ellips/No CRS"
|
||||
%End
|
||||
|
||||
|
||||
const double DEFAULT_POINT_SIZE;
|
||||
|
@ -40,6 +40,10 @@ Prints the contents via :py:class:`QgsDebugMsg`()
|
||||
|
||||
static void convertRasterProperties( QDomDocument &doc, QDomNode &parentNode, QDomElement &rasterPropertiesElem, QgsRasterLayer *rlayer );
|
||||
|
||||
QDomDocument &dom();
|
||||
|
||||
QgsProjectVersion currentVersion() const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
@ -1020,9 +1020,9 @@ int main( int argc, char *argv[] )
|
||||
|
||||
QgsSettings migSettings;
|
||||
int firstRunVersion = migSettings.value( QStringLiteral( "migration/firstRunVersionFlag" ), 0 ).toInt();
|
||||
bool showWelcome = ( firstRunVersion == 0 || Qgis::QGIS_VERSION_INT > firstRunVersion );
|
||||
bool showWelcome = ( firstRunVersion == 0 || Qgis::versionInt() > firstRunVersion );
|
||||
|
||||
std::unique_ptr< QgsVersionMigration > migration( QgsVersionMigration::canMigrate( 20000, Qgis::QGIS_VERSION_INT ) );
|
||||
std::unique_ptr< QgsVersionMigration > migration( QgsVersionMigration::canMigrate( 20000, Qgis::versionInt() ) );
|
||||
if ( migration && ( settingsMigrationForce || migration->requiresMigration() ) )
|
||||
{
|
||||
bool runMigration = true;
|
||||
@ -1035,7 +1035,7 @@ int main( int argc, char *argv[] )
|
||||
}
|
||||
dlg.exec();
|
||||
runMigration = dlg.migrateSettings();
|
||||
migSettings.setValue( QStringLiteral( "migration/firstRunVersionFlag" ), Qgis::QGIS_VERSION_INT );
|
||||
migSettings.setValue( QStringLiteral( "migration/firstRunVersionFlag" ), Qgis::versionInt() );
|
||||
}
|
||||
|
||||
if ( runMigration )
|
||||
|
@ -521,7 +521,7 @@ static void setTitleBarText_( QWidget &qgisApp )
|
||||
|
||||
caption += QgisApp::tr( "QGIS" );
|
||||
|
||||
if ( Qgis::QGIS_VERSION.endsWith( QLatin1String( "Master" ) ) )
|
||||
if ( Qgis::version().endsWith( QLatin1String( "Master" ) ) )
|
||||
{
|
||||
caption += QStringLiteral( " %1" ).arg( Qgis::QGIS_DEV_VERSION );
|
||||
}
|
||||
@ -557,7 +557,7 @@ static void customSrsValidation_( QgsCoordinateReferenceSystem &srs )
|
||||
return;
|
||||
|
||||
case QgsOptions::UnknownLayerCrsBehavior::UseDefaultCrs:
|
||||
srs.createFromOgcWmsCrs( QgsSettings().value( QStringLiteral( "Projections/layerDefaultCrs" ), GEO_EPSG_CRS_AUTHID ).toString() );
|
||||
srs.createFromOgcWmsCrs( QgsSettings().value( QStringLiteral( "Projections/layerDefaultCrs" ), geoEpsgCrsAuthId() ).toString() );
|
||||
break;
|
||||
|
||||
case QgsOptions::UnknownLayerCrsBehavior::PromptUserForCrs:
|
||||
@ -681,7 +681,7 @@ void QgisApp::validateCrs( QgsCoordinateReferenceSystem &srs )
|
||||
|
||||
case QgsOptions::UnknownLayerCrsBehavior::UseDefaultCrs:
|
||||
{
|
||||
srs.createFromOgcWmsCrs( QgsSettings().value( QStringLiteral( "Projections/layerDefaultCrs" ), GEO_EPSG_CRS_AUTHID ).toString() );
|
||||
srs.createFromOgcWmsCrs( QgsSettings().value( QStringLiteral( "Projections/layerDefaultCrs" ), geoEpsgCrsAuthId() ).toString() );
|
||||
sAuthId = srs.authid();
|
||||
visibleMessageBar()->pushMessage( tr( "CRS was undefined" ), tr( "defaulting to CRS %1 - %2" ).arg( sAuthId, srs.description() ), Qgis::Warning, messageTimeout() );
|
||||
break;
|
||||
@ -1175,7 +1175,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
|
||||
connect( QgsGui::mapLayerActionRegistry(), &QgsMapLayerActionRegistry::changed, this, &QgisApp::refreshActionFeatureAction );
|
||||
|
||||
// set application's caption
|
||||
QString caption = tr( "QGIS - %1 ('%2')" ).arg( Qgis::QGIS_VERSION, Qgis::QGIS_RELEASE_NAME );
|
||||
QString caption = tr( "QGIS - %1 ('%2')" ).arg( Qgis::version(), Qgis::releaseName() );
|
||||
setWindowTitle( caption );
|
||||
|
||||
// QgsMessageLog::logMessage( tr( "QGIS starting…" ), QString(), Qgis::Info );
|
||||
@ -1428,7 +1428,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
|
||||
QgsGui::instance()->nativePlatformInterface()->initializeMainWindow( windowHandle(),
|
||||
QgsApplication::applicationName(),
|
||||
QgsApplication::organizationName(),
|
||||
Qgis::QGIS_VERSION );
|
||||
Qgis::version() );
|
||||
connect( QgsGui::instance()->nativePlatformInterface(), &QgsNative::usbStorageNotification, mBrowserModel, &QgsBrowserModel::refreshDrives );
|
||||
|
||||
// setup application progress reports from task manager
|
||||
@ -4698,12 +4698,12 @@ void QgisApp::about()
|
||||
sAbt = new QgsAbout( this );
|
||||
QString versionString = QStringLiteral( "<html><body><div align='center'><table width='100%'>" );
|
||||
|
||||
versionString += QStringLiteral( "<tr><td>%1</td><td>%2</td><td>" ).arg( tr( "QGIS version" ), Qgis::QGIS_VERSION );
|
||||
versionString += QStringLiteral( "<tr><td>%1</td><td>%2</td><td>" ).arg( tr( "QGIS version" ), Qgis::version() );
|
||||
|
||||
if ( QString( Qgis::QGIS_DEV_VERSION ) == QLatin1String( "exported" ) )
|
||||
{
|
||||
versionString += QStringLiteral( "%1</td><td><a href=\"https://github.com/qgis/QGIS/tree/release-%1_%2\">Release %1.%2</a></td>" )
|
||||
.arg( tr( "QGIS code branch" ) ).arg( Qgis::QGIS_VERSION_INT / 10000 ).arg( Qgis::QGIS_VERSION_INT / 100 % 100 );
|
||||
.arg( tr( "QGIS code branch" ) ).arg( Qgis::versionInt() / 10000 ).arg( Qgis::versionInt() / 100 % 100 );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -5743,12 +5743,12 @@ bool QgisApp::fileNew( bool promptToSaveFlag, bool forceBlank )
|
||||
mScaleWidget->updateScales();
|
||||
|
||||
// set project CRS
|
||||
const QgsCoordinateReferenceSystem srs = QgsCoordinateReferenceSystem( settings.value( QStringLiteral( "/projections/defaultProjectCrs" ), GEO_EPSG_CRS_AUTHID, QgsSettings::App ).toString() );
|
||||
const QgsCoordinateReferenceSystem srs = QgsCoordinateReferenceSystem( settings.value( QStringLiteral( "/projections/defaultProjectCrs" ), geoEpsgCrsAuthId(), QgsSettings::App ).toString() );
|
||||
// write the projections _proj string_ to project settings
|
||||
const bool planimetric = settings.value( QStringLiteral( "measure/planimetric" ), true, QgsSettings::Core ).toBool();
|
||||
prj->setCrs( srs, !planimetric ); // If the default ellipsoid is not planimetric, set it from the default crs
|
||||
if ( planimetric )
|
||||
prj->setEllipsoid( GEO_NONE );
|
||||
prj->setEllipsoid( geoNone() );
|
||||
|
||||
/* New Empty Project Created
|
||||
(before attempting to load custom project templates/filepaths) */
|
||||
@ -10047,7 +10047,7 @@ void QgisApp::duplicateVectorStyle( QgsVectorLayer *srcLayer, QgsVectorLayer *de
|
||||
QStringLiteral( "qgis" ), QStringLiteral( "http://mrcc.com/qgis.dtd" ), QStringLiteral( "SYSTEM" ) );
|
||||
QDomDocument doc( documentType );
|
||||
QDomElement rootNode = doc.createElement( QStringLiteral( "qgis" ) );
|
||||
rootNode.setAttribute( QStringLiteral( "version" ), Qgis::QGIS_VERSION );
|
||||
rootNode.setAttribute( QStringLiteral( "version" ), Qgis::version() );
|
||||
doc.appendChild( rootNode );
|
||||
QString errorMsg;
|
||||
QgsReadWriteContext writeContext = QgsReadWriteContext();
|
||||
@ -10766,7 +10766,7 @@ void QgisApp::loadPythonSupport()
|
||||
#ifdef __MINGW32__
|
||||
pythonlibName.prepend( "lib" );
|
||||
#endif
|
||||
QString version = QStringLiteral( "%1.%2.%3" ).arg( Qgis::QGIS_VERSION_INT / 10000 ).arg( Qgis::QGIS_VERSION_INT / 100 % 100 ).arg( Qgis::QGIS_VERSION_INT % 100 );
|
||||
QString version = QStringLiteral( "%1.%2.%3" ).arg( Qgis::versionInt() / 10000 ).arg( Qgis::versionInt() / 100 % 100 ).arg( Qgis::versionInt() % 100 );
|
||||
QgsDebugMsg( QStringLiteral( "load library %1 (%2)" ).arg( pythonlibName, version ) );
|
||||
QLibrary pythonlib( pythonlibName, version );
|
||||
// It's necessary to set these two load hints, otherwise Python library won't work correctly
|
||||
@ -13899,7 +13899,7 @@ void QgisApp::oldProjectVersionWarning( const QString &oldVersion )
|
||||
{
|
||||
QString smalltext = tr( "This project file was saved by QGIS version %1."
|
||||
" When saving this project file, QGIS will update it to version %2, "
|
||||
"possibly rendering it useless for older versions of QGIS." ).arg( oldVersion, Qgis::QGIS_VERSION );
|
||||
"possibly rendering it useless for older versions of QGIS." ).arg( oldVersion, Qgis::version() );
|
||||
|
||||
QString title = tr( "Project file is older" );
|
||||
|
||||
|
@ -62,12 +62,12 @@ LONG WINAPI QgsCrashHandler::handle( LPEXCEPTION_POINTERS exception )
|
||||
arguments << QgsProject::instance()->fileName();
|
||||
|
||||
QStringList reportData;
|
||||
reportData.append( QStringLiteral( "QGIS Version: %1" ).arg( Qgis::QGIS_VERSION ) );
|
||||
reportData.append( QStringLiteral( "QGIS Version: %1" ).arg( Qgis::version() ) );
|
||||
|
||||
if ( QString( Qgis::QGIS_DEV_VERSION ) == QLatin1String( "exported" ) )
|
||||
{
|
||||
reportData.append( QStringLiteral( "QGIS code branch: Release %1.%2" )
|
||||
.arg( Qgis::QGIS_VERSION_INT / 10000 ).arg( Qgis::QGIS_VERSION_INT / 100 % 100 ) );
|
||||
.arg( Qgis::versionInt() / 10000 ).arg( Qgis::versionInt() / 100 % 100 ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -20,8 +20,8 @@ QgsFirstRunDialog::QgsFirstRunDialog( QWidget *parent ) : QDialog( parent )
|
||||
{
|
||||
setupUi( this );
|
||||
mWelcomeDevLabel->hide();
|
||||
mWelcomeLabel->setText( tr( "Welcome to QGIS %1" ).arg( Qgis::QGIS_VERSION ) );
|
||||
if ( Qgis::QGIS_VERSION.endsWith( QLatin1String( "Master" ) ) )
|
||||
mWelcomeLabel->setText( tr( "Welcome to QGIS %1" ).arg( Qgis::version() ) );
|
||||
if ( Qgis::version().endsWith( QLatin1String( "Master" ) ) )
|
||||
{
|
||||
mWelcomeDevLabel->show();
|
||||
}
|
||||
|
@ -512,8 +512,8 @@ void QgsMapSaveDialog::onAccepted()
|
||||
{
|
||||
// These details will be used on non-GeoPDF exports is the export metadata checkbox is checked
|
||||
geoPdfExportDetails.author = QgsProject::instance()->metadata().author();
|
||||
geoPdfExportDetails.producer = QStringLiteral( "QGIS %1" ).arg( Qgis::QGIS_VERSION );
|
||||
geoPdfExportDetails.creator = QStringLiteral( "QGIS %1" ).arg( Qgis::QGIS_VERSION );
|
||||
geoPdfExportDetails.producer = QStringLiteral( "QGIS %1" ).arg( Qgis::version() );
|
||||
geoPdfExportDetails.creator = QStringLiteral( "QGIS %1" ).arg( Qgis::version() );
|
||||
geoPdfExportDetails.creationDateTime = QDateTime::currentDateTime();
|
||||
geoPdfExportDetails.subject = QgsProject::instance()->metadata().abstract();
|
||||
geoPdfExportDetails.title = QgsProject::instance()->metadata().title();
|
||||
|
@ -94,7 +94,7 @@ void QgsMeasureDialog::projChanged()
|
||||
{
|
||||
if ( mCartesian->isChecked() )
|
||||
{
|
||||
mDa.setEllipsoid( GEO_NONE );
|
||||
mDa.setEllipsoid( geoNone() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -149,7 +149,7 @@ void QgsMeasureDialog::updateSettings()
|
||||
( mCanvas->mapSettings().destinationCrs().mapUnits() == QgsUnitTypes::DistanceDegrees
|
||||
&& mDistanceUnits == QgsUnitTypes::DistanceDegrees ) )
|
||||
{
|
||||
mDa.setEllipsoid( GEO_NONE );
|
||||
mDa.setEllipsoid( geoNone() );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -384,7 +384,7 @@ void QgsMeasureDialog::updateUi()
|
||||
toolTip += "<br> * " + tr( "Units are unknown." );
|
||||
mConvertToDisplayUnits = false;
|
||||
}
|
||||
mDa.setEllipsoid( GEO_NONE );
|
||||
mDa.setEllipsoid( geoNone() );
|
||||
}
|
||||
else if ( mCanvas->mapSettings().destinationCrs().mapUnits() == QgsUnitTypes::DistanceDegrees
|
||||
&& ( mAreaUnits == QgsUnitTypes::AreaSquareDegrees || mAreaUnits == QgsUnitTypes::AreaUnknownUnit ) )
|
||||
@ -392,7 +392,7 @@ void QgsMeasureDialog::updateUi()
|
||||
//both source and destination units are degrees
|
||||
toolTip += "<br> * " + tr( "Both project CRS (%1) and measured area are in degrees, so area is calculated using Cartesian calculations in square degrees." ).arg(
|
||||
mCanvas->mapSettings().destinationCrs().description() );
|
||||
mDa.setEllipsoid( GEO_NONE );
|
||||
mDa.setEllipsoid( geoNone() );
|
||||
mConvertToDisplayUnits = false; //not required since we will be measuring in degrees
|
||||
}
|
||||
else
|
||||
@ -462,7 +462,7 @@ void QgsMeasureDialog::updateUi()
|
||||
toolTip += "<br> * " + tr( "Units are unknown." );
|
||||
mConvertToDisplayUnits = false;
|
||||
}
|
||||
mDa.setEllipsoid( GEO_NONE );
|
||||
mDa.setEllipsoid( geoNone() );
|
||||
}
|
||||
else if ( mCanvas->mapSettings().destinationCrs().mapUnits() == QgsUnitTypes::DistanceDegrees
|
||||
&& mDistanceUnits == QgsUnitTypes::DistanceDegrees )
|
||||
@ -470,7 +470,7 @@ void QgsMeasureDialog::updateUi()
|
||||
//both source and destination units are degrees
|
||||
toolTip += "<br> * " + tr( "Both project CRS (%1) and measured length are in degrees, so distance is calculated using Cartesian calculations in degrees." ).arg(
|
||||
mCanvas->mapSettings().destinationCrs().description() );
|
||||
mDa.setEllipsoid( GEO_NONE );
|
||||
mDa.setEllipsoid( geoNone() );
|
||||
mConvertToDisplayUnits = false; //not required since we will be measuring in degrees
|
||||
}
|
||||
else
|
||||
|
@ -470,11 +470,11 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl, const QList<QgsOpti
|
||||
break;
|
||||
}
|
||||
|
||||
QString myLayerDefaultCrs = mSettings->value( QStringLiteral( "/Projections/layerDefaultCrs" ), GEO_EPSG_CRS_AUTHID ).toString();
|
||||
QString myLayerDefaultCrs = mSettings->value( QStringLiteral( "/Projections/layerDefaultCrs" ), geoEpsgCrsAuthId() ).toString();
|
||||
mLayerDefaultCrs = QgsCoordinateReferenceSystem::fromOgcWmsCrs( myLayerDefaultCrs );
|
||||
leLayerGlobalCrs->setCrs( mLayerDefaultCrs );
|
||||
|
||||
const QString defaultProjectCrs = mSettings->value( QStringLiteral( "/projections/defaultProjectCrs" ), GEO_EPSG_CRS_AUTHID, QgsSettings::App ).toString();
|
||||
const QString defaultProjectCrs = mSettings->value( QStringLiteral( "/projections/defaultProjectCrs" ), geoEpsgCrsAuthId(), QgsSettings::App ).toString();
|
||||
leProjectGlobalCrs->setOptionVisible( QgsProjectionSelectionWidget::DefaultCrs, false );
|
||||
leProjectGlobalCrs->setOptionVisible( QgsProjectionSelectionWidget::CrsNotSet, true );
|
||||
leProjectGlobalCrs->setNotSetText( tr( "No projection (or unknown/non-Earth projection)" ) );
|
||||
|
@ -248,7 +248,7 @@ bool QgsPluginRegistry::checkQgisVersion( const QString &minVersion, const QStri
|
||||
}
|
||||
|
||||
// our qgis version - cut release name after version number
|
||||
QString qgisVersion = Qgis::QGIS_VERSION.section( '-', 0, 0 );
|
||||
QString qgisVersion = Qgis::version().section( '-', 0, 0 );
|
||||
|
||||
QStringList qgisVersionParts = qgisVersion.split( '.' );
|
||||
|
||||
|
@ -75,7 +75,7 @@
|
||||
#include <QDesktopServices>
|
||||
#include <QAbstractListModel>
|
||||
|
||||
const char *QgsProjectProperties::GEO_NONE_DESC = QT_TRANSLATE_NOOP( "QgsOptions", "None / Planimetric" );
|
||||
const char *QgsProjectProperties::geoNone()_DESC = QT_TRANSLATE_NOOP( "QgsOptions", "None / Planimetric" );
|
||||
|
||||
//stdc++ includes
|
||||
|
||||
@ -2253,7 +2253,7 @@ void QgsProjectProperties::addWmtsGrid( const QString &crsStr )
|
||||
{
|
||||
// calculate top, left and scale based on CRS bounds
|
||||
QgsCoordinateReferenceSystem crs = QgsCoordinateReferenceSystem::fromOgcWmsCrs( crsStr );
|
||||
QgsCoordinateTransform crsTransform( QgsCoordinateReferenceSystem::fromOgcWmsCrs( GEO_EPSG_CRS_AUTHID ), crs, QgsProject::instance() );
|
||||
QgsCoordinateTransform crsTransform( QgsCoordinateReferenceSystem::fromOgcWmsCrs( geoEpsgCrsAuthId() ), crs, QgsProject::instance() );
|
||||
try
|
||||
{
|
||||
// firstly transform CRS bounds expressed in WGS84 to CRS
|
||||
@ -2359,8 +2359,8 @@ void QgsProjectProperties::populateEllipsoidList()
|
||||
//
|
||||
EllipsoidDefs myItem;
|
||||
|
||||
myItem.acronym = GEO_NONE;
|
||||
myItem.description = tr( GEO_NONE_DESC );
|
||||
myItem.acronym = geoNone();
|
||||
myItem.description = tr( geoNone()_DESC );
|
||||
myItem.semiMajor = 0.0;
|
||||
myItem.semiMinor = 0.0;
|
||||
mEllipsoidList.append( myItem );
|
||||
@ -2432,7 +2432,7 @@ void QgsProjectProperties::updateEllipsoidUI( int newIndex )
|
||||
leSemiMajor->setToolTip( tr( "Select %1 from pull-down menu to adjust radii" ).arg( tr( "Custom" ) ) );
|
||||
leSemiMinor->setToolTip( tr( "Select %1 from pull-down menu to adjust radii" ).arg( tr( "Custom" ) ) );
|
||||
}
|
||||
if ( mEllipsoidList[ mEllipsoidIndex ].acronym != GEO_NONE )
|
||||
if ( mEllipsoidList[ mEllipsoidIndex ].acronym != geoNone() )
|
||||
{
|
||||
leSemiMajor->setText( QLocale().toString( myMajor, 'f', 3 ) );
|
||||
leSemiMinor->setText( QLocale().toString( myMinor, 'f', 3 ) );
|
||||
|
@ -254,7 +254,7 @@ class APP_EXPORT QgsProjectProperties : public QgsOptionsDialogBase, private Ui:
|
||||
//! Add a scale item to the list of scales
|
||||
void addScaleToScaleList( QListWidgetItem *newItem );
|
||||
|
||||
static const char *GEO_NONE_DESC;
|
||||
static const char *geoNone()_DESC;
|
||||
|
||||
void updateGuiForMapUnits();
|
||||
|
||||
|
@ -32,12 +32,12 @@ void QgsVersionInfo::checkVersion()
|
||||
|
||||
bool QgsVersionInfo::newVersionAvailable() const
|
||||
{
|
||||
return mLatestVersion > Qgis::QGIS_VERSION_INT;
|
||||
return mLatestVersion > Qgis::versionInt();
|
||||
}
|
||||
|
||||
bool QgsVersionInfo::isDevelopmentVersion() const
|
||||
{
|
||||
return Qgis::QGIS_VERSION_INT > mLatestVersion;
|
||||
return Qgis::versionInt() > mLatestVersion;
|
||||
}
|
||||
|
||||
void QgsVersionInfo::versionReplyFinished()
|
||||
|
@ -275,7 +275,7 @@ void QgsExpression::initGeomCalculator( const QgsExpressionContext *context )
|
||||
if ( crs.isValid() )
|
||||
{
|
||||
d->mCalc = std::shared_ptr<QgsDistanceArea>( new QgsDistanceArea() );
|
||||
d->mCalc->setEllipsoid( ellipsoid.isEmpty() ? GEO_NONE : ellipsoid );
|
||||
d->mCalc->setEllipsoid( ellipsoid.isEmpty() ? geoNone() : ellipsoid );
|
||||
d->mCalc->setSourceCrs( crs, tContext );
|
||||
}
|
||||
}
|
||||
|
@ -42,10 +42,10 @@ QgsExpressionContextScope *QgsExpressionContextUtils::globalScope()
|
||||
}
|
||||
|
||||
//add some extra global variables
|
||||
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "qgis_version" ), Qgis::QGIS_VERSION, true, true ) );
|
||||
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "qgis_version_no" ), Qgis::QGIS_VERSION_INT, true, true ) );
|
||||
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "qgis_short_version" ), QStringLiteral( "%1.%2" ).arg( Qgis::QGIS_VERSION_INT / 10000 ).arg( Qgis::QGIS_VERSION_INT / 100 % 100 ), true, true ) );
|
||||
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "qgis_release_name" ), Qgis::QGIS_RELEASE_NAME, true, true ) );
|
||||
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "qgis_version" ), Qgis::version(), true, true ) );
|
||||
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "qgis_version_no" ), Qgis::versionInt(), true, true ) );
|
||||
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "qgis_short_version" ), QStringLiteral( "%1.%2" ).arg( Qgis::versionInt() / 10000 ).arg( Qgis::versionInt() / 100 % 100 ), true, true ) );
|
||||
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "qgis_release_name" ), Qgis::releaseName(), true, true ) );
|
||||
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "qgis_platform" ), QgsApplication::platform(), true, true ) );
|
||||
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "qgis_os_name" ), QgsApplication::osName(), true, true ) );
|
||||
scope->addVariable( QgsExpressionContextScope::StaticVariable( QStringLiteral( "qgis_locale" ), QgsApplication::locale(), true, true ) );
|
||||
@ -794,7 +794,7 @@ QgsExpressionContextUtils::GetLayerVisibility::GetLayerVisibility( const QList<Q
|
||||
, mLayers( _qgis_listRawToQPointer( layers ) )
|
||||
, mScale( scale )
|
||||
{
|
||||
for ( const auto layer : mLayers )
|
||||
for ( const auto &layer : mLayers )
|
||||
{
|
||||
if ( layer->hasScaleBasedVisibility() )
|
||||
{
|
||||
|
@ -23,90 +23,116 @@
|
||||
* See details in QEP #17
|
||||
****************************************************************************/
|
||||
|
||||
const QMap<QgsWkbTypes::Type, QgsWkbTypes::wkbEntry> QgsWkbTypes::ENTRIES
|
||||
|
||||
struct WkbEntry
|
||||
{
|
||||
WkbEntry( const QString &name, bool isMultiType, QgsWkbTypes::Type multiType, QgsWkbTypes::Type singleType, QgsWkbTypes::Type flatType, QgsWkbTypes::GeometryType geometryType,
|
||||
bool hasZ, bool hasM )
|
||||
: mName( name )
|
||||
, mIsMultiType( isMultiType )
|
||||
, mMultiType( multiType )
|
||||
, mSingleType( singleType )
|
||||
, mFlatType( flatType )
|
||||
, mGeometryType( geometryType )
|
||||
, mHasZ( hasZ )
|
||||
, mHasM( hasM )
|
||||
{}
|
||||
QString mName;
|
||||
bool mIsMultiType;
|
||||
QgsWkbTypes::Type mMultiType;
|
||||
QgsWkbTypes::Type mSingleType;
|
||||
QgsWkbTypes::Type mFlatType;
|
||||
QgsWkbTypes::GeometryType mGeometryType;
|
||||
bool mHasZ;
|
||||
bool mHasM;
|
||||
};
|
||||
|
||||
typedef QMap<QgsWkbTypes::Type, WkbEntry> WkbEntries;
|
||||
|
||||
Q_GLOBAL_STATIC_WITH_ARGS( WkbEntries, sWkbEntries, (
|
||||
{
|
||||
//register the known wkb types
|
||||
{ Unknown, wkbEntry( QStringLiteral( "Unknown" ), false, Unknown, Unknown, Unknown, UnknownGeometry, false, false ) },
|
||||
{ NoGeometry, wkbEntry( QStringLiteral( "NoGeometry" ), false, NoGeometry, NoGeometry, NoGeometry, NullGeometry, false, false ) },
|
||||
{ QgsWkbTypes::Unknown, WkbEntry( QLatin1String( "Unknown" ), false, QgsWkbTypes::Unknown, QgsWkbTypes::Unknown, QgsWkbTypes::Unknown, QgsWkbTypes::UnknownGeometry, false, false ) },
|
||||
{ QgsWkbTypes::NoGeometry, WkbEntry( QLatin1String( "NoGeometry" ), false, QgsWkbTypes::NoGeometry, QgsWkbTypes::NoGeometry, QgsWkbTypes::NoGeometry, QgsWkbTypes::NullGeometry, false, false ) },
|
||||
//point
|
||||
{ Point, wkbEntry( QStringLiteral( "Point" ), false, MultiPoint, Point, Point, PointGeometry, false, false ) },
|
||||
{ PointZ, wkbEntry( QStringLiteral( "PointZ" ), false, MultiPointZ, PointZ, Point, PointGeometry, true, false ) },
|
||||
{ PointM, wkbEntry( QStringLiteral( "PointM" ), false, MultiPointM, PointM, Point, PointGeometry, false, true ) },
|
||||
{ PointZM, wkbEntry( QStringLiteral( "PointZM" ), false, MultiPointZM, PointZM, Point, PointGeometry, true, true ) },
|
||||
{ Point25D, wkbEntry( QStringLiteral( "Point25D" ), false, MultiPoint25D, Point25D, Point, PointGeometry, true, false ) },
|
||||
{QgsWkbTypes::Point, WkbEntry( QLatin1String( "Point" ), false, QgsWkbTypes::MultiPoint, QgsWkbTypes::Point, QgsWkbTypes::Point, QgsWkbTypes::PointGeometry, false, false ) },
|
||||
{QgsWkbTypes::PointZ, WkbEntry( QLatin1String( "PointZ" ), false, QgsWkbTypes::MultiPointZ, QgsWkbTypes::PointZ, QgsWkbTypes::Point, QgsWkbTypes::PointGeometry, true, false ) },
|
||||
{QgsWkbTypes::PointM, WkbEntry( QLatin1String( "PointM" ), false, QgsWkbTypes::MultiPointM, QgsWkbTypes::PointM, QgsWkbTypes::Point, QgsWkbTypes::PointGeometry, false, true ) },
|
||||
{QgsWkbTypes::PointZM, WkbEntry( QLatin1String( "PointZM" ), false, QgsWkbTypes::MultiPointZM, QgsWkbTypes::PointZM, QgsWkbTypes::Point, QgsWkbTypes::PointGeometry, true, true ) },
|
||||
{QgsWkbTypes::Point25D, WkbEntry( QLatin1String( "Point25D" ), false, QgsWkbTypes::MultiPoint25D, QgsWkbTypes::Point25D, QgsWkbTypes::Point, QgsWkbTypes::PointGeometry, true, false ) },
|
||||
//linestring
|
||||
{ LineString, wkbEntry( QStringLiteral( "LineString" ), false, MultiLineString, LineString, LineString, LineGeometry, false, false ) },
|
||||
{ LineStringZ, wkbEntry( QStringLiteral( "LineStringZ" ), false, MultiLineStringZ, LineStringZ, LineString, LineGeometry, true, false ) },
|
||||
{ LineStringM, wkbEntry( QStringLiteral( "LineStringM" ), false, MultiLineStringM, LineStringM, LineString, LineGeometry, false, true ) },
|
||||
{ LineStringZM, wkbEntry( QStringLiteral( "LineStringZM" ), false, MultiLineStringZM, LineStringZM, LineString, LineGeometry, true, true ) },
|
||||
{ LineString25D, wkbEntry( QStringLiteral( "LineString25D" ), false, MultiLineString25D, LineString25D, LineString, LineGeometry, true, false ) },
|
||||
{ QgsWkbTypes::LineString, WkbEntry( QLatin1String( "LineString" ), false, QgsWkbTypes::MultiLineString, QgsWkbTypes::LineString, QgsWkbTypes::LineString, QgsWkbTypes::LineGeometry, false, false ) },
|
||||
{ QgsWkbTypes::LineStringZ, WkbEntry( QLatin1String( "LineStringZ" ), false, QgsWkbTypes::MultiLineStringZ, QgsWkbTypes::LineStringZ, QgsWkbTypes::LineString, QgsWkbTypes::LineGeometry, true, false ) },
|
||||
{ QgsWkbTypes::LineStringM, WkbEntry( QLatin1String( "LineStringM" ), false, QgsWkbTypes::MultiLineStringM, QgsWkbTypes::LineStringM, QgsWkbTypes::LineString, QgsWkbTypes::LineGeometry, false, true ) },
|
||||
{ QgsWkbTypes::LineStringZM, WkbEntry( QLatin1String( "LineStringZM" ), false, QgsWkbTypes::MultiLineStringZM, QgsWkbTypes::LineStringZM, QgsWkbTypes::LineString, QgsWkbTypes::LineGeometry, true, true ) },
|
||||
{ QgsWkbTypes::LineString25D, WkbEntry( QLatin1String( "LineString25D" ), false, QgsWkbTypes::MultiLineString25D, QgsWkbTypes::LineString25D, QgsWkbTypes::LineString, QgsWkbTypes::LineGeometry, true, false ) },
|
||||
//circularstring
|
||||
{ CircularString, wkbEntry( QStringLiteral( "CircularString" ), false, MultiCurve, CircularString, CircularString, LineGeometry, false, false ) },
|
||||
{ CircularStringZ, wkbEntry( QStringLiteral( "CircularStringZ" ), false, MultiCurveZ, CircularStringZ, CircularString, LineGeometry, true, false ) },
|
||||
{ CircularStringM, wkbEntry( QStringLiteral( "CircularStringM" ), false, MultiCurveM, CircularStringM, CircularString, LineGeometry, false, true ) },
|
||||
{ CircularStringZM, wkbEntry( QStringLiteral( "CircularStringZM" ), false, MultiCurveZM, CircularStringZM, CircularString, LineGeometry, true, true ) },
|
||||
{ QgsWkbTypes::CircularString, WkbEntry( QLatin1String( "CircularString" ), false, QgsWkbTypes::MultiCurve, QgsWkbTypes::CircularString, QgsWkbTypes::CircularString, QgsWkbTypes::LineGeometry, false, false ) },
|
||||
{ QgsWkbTypes::CircularStringZ, WkbEntry( QLatin1String( "CircularStringZ" ), false, QgsWkbTypes::MultiCurveZ, QgsWkbTypes::CircularStringZ, QgsWkbTypes::CircularString, QgsWkbTypes::LineGeometry, true, false ) },
|
||||
{ QgsWkbTypes::CircularStringM, WkbEntry( QLatin1String( "CircularStringM" ), false, QgsWkbTypes::MultiCurveM, QgsWkbTypes::CircularStringM, QgsWkbTypes::CircularString, QgsWkbTypes::LineGeometry, false, true ) },
|
||||
{ QgsWkbTypes::CircularStringZM, WkbEntry( QLatin1String( "CircularStringZM" ), false, QgsWkbTypes::MultiCurveZM, QgsWkbTypes::CircularStringZM, QgsWkbTypes::CircularString, QgsWkbTypes::LineGeometry, true, true ) },
|
||||
//compoundcurve
|
||||
{ CompoundCurve, wkbEntry( QStringLiteral( "CompoundCurve" ), false, MultiCurve, CompoundCurve, CompoundCurve, LineGeometry, false, false ) },
|
||||
{ CompoundCurveZ, wkbEntry( QStringLiteral( "CompoundCurveZ" ), false, MultiCurveZ, CompoundCurveZ, CompoundCurve, LineGeometry, true, false ) },
|
||||
{ CompoundCurveM, wkbEntry( QStringLiteral( "CompoundCurveM" ), false, MultiCurveM, CompoundCurveM, CompoundCurve, LineGeometry, false, true ) },
|
||||
{ CompoundCurveZM, wkbEntry( QStringLiteral( "CompoundCurveZM" ), false, MultiCurveZM, CompoundCurveZM, CompoundCurve, LineGeometry, true, true ) },
|
||||
{ QgsWkbTypes::CompoundCurve, WkbEntry( QLatin1String( "CompoundCurve" ), false, QgsWkbTypes::MultiCurve, QgsWkbTypes::CompoundCurve, QgsWkbTypes::CompoundCurve, QgsWkbTypes::LineGeometry, false, false ) },
|
||||
{ QgsWkbTypes::CompoundCurveZ, WkbEntry( QLatin1String( "CompoundCurveZ" ), false, QgsWkbTypes::MultiCurveZ, QgsWkbTypes::CompoundCurveZ, QgsWkbTypes::CompoundCurve, QgsWkbTypes::LineGeometry, true, false ) },
|
||||
{ QgsWkbTypes::CompoundCurveM, WkbEntry( QLatin1String( "CompoundCurveM" ), false, QgsWkbTypes::MultiCurveM, QgsWkbTypes::CompoundCurveM, QgsWkbTypes::CompoundCurve, QgsWkbTypes::LineGeometry, false, true ) },
|
||||
{ QgsWkbTypes::CompoundCurveZM, WkbEntry( QLatin1String( "CompoundCurveZM" ), false, QgsWkbTypes::MultiCurveZM, QgsWkbTypes::CompoundCurveZM, QgsWkbTypes::CompoundCurve, QgsWkbTypes::LineGeometry, true, true ) },
|
||||
//polygon
|
||||
{ Polygon, wkbEntry( QStringLiteral( "Polygon" ), false, MultiPolygon, Polygon, Polygon, PolygonGeometry, false, false ) },
|
||||
{ PolygonZ, wkbEntry( QStringLiteral( "PolygonZ" ), false, MultiPolygonZ, PolygonZ, Polygon, PolygonGeometry, true, false ) },
|
||||
{ PolygonM, wkbEntry( QStringLiteral( "PolygonM" ), false, MultiPolygonM, PolygonM, Polygon, PolygonGeometry, false, true ) },
|
||||
{ PolygonZM, wkbEntry( QStringLiteral( "PolygonZM" ), false, MultiPolygonZM, PolygonZM, Polygon, PolygonGeometry, true, true ) },
|
||||
{ Polygon25D, wkbEntry( QStringLiteral( "Polygon25D" ), false, MultiPolygon25D, Polygon25D, Polygon, PolygonGeometry, true, false ) },
|
||||
{ QgsWkbTypes::Polygon, WkbEntry( QLatin1String( "Polygon" ), false, QgsWkbTypes::MultiPolygon, QgsWkbTypes::Polygon, QgsWkbTypes::Polygon, QgsWkbTypes::PolygonGeometry, false, false ) },
|
||||
{ QgsWkbTypes::PolygonZ, WkbEntry( QLatin1String( "PolygonZ" ), false, QgsWkbTypes::MultiPolygonZ, QgsWkbTypes::PolygonZ, QgsWkbTypes::Polygon, QgsWkbTypes::PolygonGeometry, true, false ) },
|
||||
{ QgsWkbTypes::PolygonM, WkbEntry( QLatin1String( "PolygonM" ), false, QgsWkbTypes::MultiPolygonM, QgsWkbTypes::PolygonM, QgsWkbTypes::Polygon, QgsWkbTypes::PolygonGeometry, false, true ) },
|
||||
{ QgsWkbTypes::PolygonZM, WkbEntry( QLatin1String( "PolygonZM" ), false, QgsWkbTypes::MultiPolygonZM, QgsWkbTypes::PolygonZM, QgsWkbTypes::Polygon, QgsWkbTypes::PolygonGeometry, true, true ) },
|
||||
{ QgsWkbTypes::Polygon25D, WkbEntry( QLatin1String( "Polygon25D" ), false, QgsWkbTypes::MultiPolygon25D, QgsWkbTypes::Polygon25D, QgsWkbTypes::Polygon, QgsWkbTypes::PolygonGeometry, true, false ) },
|
||||
//triangle
|
||||
{ Triangle, wkbEntry( QStringLiteral( "Triangle" ), false, Unknown, Triangle, Triangle, PolygonGeometry, false, false ) },
|
||||
{ TriangleZ, wkbEntry( QStringLiteral( "TriangleZ" ), false, Unknown, TriangleZ, Triangle, PolygonGeometry, true, false ) },
|
||||
{ TriangleM, wkbEntry( QStringLiteral( "TriangleM" ), false, Unknown, TriangleM, Triangle, PolygonGeometry, false, true ) },
|
||||
{ TriangleZM, wkbEntry( QStringLiteral( "TriangleZM" ), false, Unknown, TriangleZM, Triangle, PolygonGeometry, true, true ) },
|
||||
{ QgsWkbTypes::Triangle, WkbEntry( QLatin1String( "Triangle" ), false, QgsWkbTypes::Unknown, QgsWkbTypes::Triangle, QgsWkbTypes::Triangle, QgsWkbTypes::PolygonGeometry, false, false ) },
|
||||
{ QgsWkbTypes::TriangleZ, WkbEntry( QLatin1String( "TriangleZ" ), false, QgsWkbTypes::Unknown, QgsWkbTypes::TriangleZ, QgsWkbTypes::Triangle, QgsWkbTypes::PolygonGeometry, true, false ) },
|
||||
{ QgsWkbTypes::TriangleM, WkbEntry( QLatin1String( "TriangleM" ), false, QgsWkbTypes::Unknown, QgsWkbTypes::TriangleM, QgsWkbTypes::Triangle, QgsWkbTypes::PolygonGeometry, false, true ) },
|
||||
{ QgsWkbTypes::TriangleZM, WkbEntry( QLatin1String( "TriangleZM" ), false, QgsWkbTypes::Unknown, QgsWkbTypes::TriangleZM, QgsWkbTypes::Triangle, QgsWkbTypes::PolygonGeometry, true, true ) },
|
||||
//curvepolygon
|
||||
{ CurvePolygon, wkbEntry( QStringLiteral( "CurvePolygon" ), false, MultiSurface, CurvePolygon, CurvePolygon, PolygonGeometry, false, false ) },
|
||||
{ CurvePolygonZ, wkbEntry( QStringLiteral( "CurvePolygonZ" ), false, MultiSurfaceZ, CurvePolygonZ, CurvePolygon, PolygonGeometry, true, false ) },
|
||||
{ CurvePolygonM, wkbEntry( QStringLiteral( "CurvePolygonM" ), false, MultiSurfaceM, CurvePolygonM, CurvePolygon, PolygonGeometry, false, true ) },
|
||||
{ CurvePolygonZM, wkbEntry( QStringLiteral( "CurvePolygonZM" ), false, MultiSurfaceZM, CurvePolygonZM, CurvePolygon, PolygonGeometry, true, true ) },
|
||||
{ QgsWkbTypes::CurvePolygon, WkbEntry( QLatin1String( "CurvePolygon" ), false, QgsWkbTypes::MultiSurface, QgsWkbTypes::CurvePolygon, QgsWkbTypes::CurvePolygon, QgsWkbTypes::PolygonGeometry, false, false ) },
|
||||
{ QgsWkbTypes::CurvePolygonZ, WkbEntry( QLatin1String( "CurvePolygonZ" ), false, QgsWkbTypes::MultiSurfaceZ, QgsWkbTypes::CurvePolygonZ, QgsWkbTypes::CurvePolygon, QgsWkbTypes::PolygonGeometry, true, false ) },
|
||||
{ QgsWkbTypes::CurvePolygonM, WkbEntry( QLatin1String( "CurvePolygonM" ), false, QgsWkbTypes::MultiSurfaceM, QgsWkbTypes::CurvePolygonM, QgsWkbTypes::CurvePolygon, QgsWkbTypes::PolygonGeometry, false, true ) },
|
||||
{ QgsWkbTypes::CurvePolygonZM, WkbEntry( QLatin1String( "CurvePolygonZM" ), false, QgsWkbTypes::MultiSurfaceZM, QgsWkbTypes::CurvePolygonZM, QgsWkbTypes::CurvePolygon, QgsWkbTypes::PolygonGeometry, true, true ) },
|
||||
//multipoint
|
||||
{ MultiPoint, wkbEntry( QStringLiteral( "MultiPoint" ), true, MultiPoint, Point, MultiPoint, PointGeometry, false, false ) },
|
||||
{ MultiPointZ, wkbEntry( QStringLiteral( "MultiPointZ" ), true, MultiPointZ, PointZ, MultiPoint, PointGeometry, true, false ) },
|
||||
{ MultiPointM, wkbEntry( QStringLiteral( "MultiPointM" ), true, MultiPointM, PointM, MultiPoint, PointGeometry, false, true ) },
|
||||
{ MultiPointZM, wkbEntry( QStringLiteral( "MultiPointZM" ), true, MultiPointZM, PointZM, MultiPoint, PointGeometry, true, true ) },
|
||||
{ MultiPoint25D, wkbEntry( QStringLiteral( "MultiPoint25D" ), true, MultiPoint25D, Point25D, MultiPoint, PointGeometry, true, false ) },
|
||||
{ QgsWkbTypes::MultiPoint, WkbEntry( QLatin1String( "MultiPoint" ), true, QgsWkbTypes::MultiPoint, QgsWkbTypes::Point, QgsWkbTypes::MultiPoint, QgsWkbTypes::PointGeometry, false, false ) },
|
||||
{ QgsWkbTypes::MultiPointZ, WkbEntry( QLatin1String( "MultiPointZ" ), true, QgsWkbTypes::MultiPointZ, QgsWkbTypes::PointZ, QgsWkbTypes::MultiPoint, QgsWkbTypes::PointGeometry, true, false ) },
|
||||
{ QgsWkbTypes::MultiPointM, WkbEntry( QLatin1String( "MultiPointM" ), true, QgsWkbTypes::MultiPointM, QgsWkbTypes::PointM, QgsWkbTypes::MultiPoint, QgsWkbTypes::PointGeometry, false, true ) },
|
||||
{ QgsWkbTypes::MultiPointZM, WkbEntry( QLatin1String( "MultiPointZM" ), true, QgsWkbTypes::MultiPointZM, QgsWkbTypes::PointZM, QgsWkbTypes::MultiPoint, QgsWkbTypes::PointGeometry, true, true ) },
|
||||
{ QgsWkbTypes::MultiPoint25D, WkbEntry( QLatin1String( "MultiPoint25D" ), true, QgsWkbTypes::MultiPoint25D, QgsWkbTypes::Point25D, QgsWkbTypes::MultiPoint, QgsWkbTypes::PointGeometry, true, false ) },
|
||||
//multiline
|
||||
{ MultiLineString, wkbEntry( QStringLiteral( "MultiLineString" ), true, MultiLineString, LineString, MultiLineString, LineGeometry, false, false ) },
|
||||
{ MultiLineStringZ, wkbEntry( QStringLiteral( "MultiLineStringZ" ), true, MultiLineStringZ, LineStringZ, MultiLineString, LineGeometry, true, false ) },
|
||||
{ MultiLineStringM, wkbEntry( QStringLiteral( "MultiLineStringM" ), true, MultiLineStringM, LineStringM, MultiLineString, LineGeometry, false, true ) },
|
||||
{ MultiLineStringZM, wkbEntry( QStringLiteral( "MultiLineStringZM" ), true, MultiLineStringZM, LineStringZM, MultiLineString, LineGeometry, true, true ) },
|
||||
{ MultiLineString25D, wkbEntry( QStringLiteral( "MultiLineString25D" ), true, MultiLineString25D, LineString25D, MultiLineString, LineGeometry, true, false ) },
|
||||
{ QgsWkbTypes::MultiLineString, WkbEntry( QLatin1String( "MultiLineString" ), true, QgsWkbTypes::MultiLineString, QgsWkbTypes::LineString, QgsWkbTypes::MultiLineString, QgsWkbTypes::LineGeometry, false, false ) },
|
||||
{ QgsWkbTypes::MultiLineStringZ, WkbEntry( QLatin1String( "MultiLineStringZ" ), true, QgsWkbTypes::MultiLineStringZ, QgsWkbTypes::LineStringZ, QgsWkbTypes::MultiLineString, QgsWkbTypes::LineGeometry, true, false ) },
|
||||
{ QgsWkbTypes::MultiLineStringM, WkbEntry( QLatin1String( "MultiLineStringM" ), true, QgsWkbTypes::MultiLineStringM, QgsWkbTypes::LineStringM, QgsWkbTypes::MultiLineString, QgsWkbTypes::LineGeometry, false, true ) },
|
||||
{ QgsWkbTypes::MultiLineStringZM, WkbEntry( QLatin1String( "MultiLineStringZM" ), true, QgsWkbTypes::MultiLineStringZM, QgsWkbTypes::LineStringZM, QgsWkbTypes::MultiLineString, QgsWkbTypes::LineGeometry, true, true ) },
|
||||
{ QgsWkbTypes::MultiLineString25D, WkbEntry( QLatin1String( "MultiLineString25D" ), true, QgsWkbTypes::MultiLineString25D, QgsWkbTypes::LineString25D, QgsWkbTypes::MultiLineString, QgsWkbTypes::LineGeometry, true, false ) },
|
||||
//multicurve
|
||||
{ MultiCurve, wkbEntry( QStringLiteral( "MultiCurve" ), true, MultiCurve, CompoundCurve, MultiCurve, LineGeometry, false, false ) },
|
||||
{ MultiCurveZ, wkbEntry( QStringLiteral( "MultiCurveZ" ), true, MultiCurveZ, CompoundCurveZ, MultiCurve, LineGeometry, true, false ) },
|
||||
{ MultiCurveM, wkbEntry( QStringLiteral( "MultiCurveM" ), true, MultiCurveM, CompoundCurveM, MultiCurve, LineGeometry, false, true ) },
|
||||
{ MultiCurveZM, wkbEntry( QStringLiteral( "MultiCurveZM" ), true, MultiCurveZM, CompoundCurveZM, MultiCurve, LineGeometry, true, true ) },
|
||||
{ QgsWkbTypes::MultiCurve, WkbEntry( QLatin1String( "MultiCurve" ), true, QgsWkbTypes::MultiCurve, QgsWkbTypes::CompoundCurve, QgsWkbTypes::MultiCurve, QgsWkbTypes::LineGeometry, false, false ) },
|
||||
{ QgsWkbTypes::MultiCurveZ, WkbEntry( QLatin1String( "MultiCurveZ" ), true, QgsWkbTypes::MultiCurveZ, QgsWkbTypes::CompoundCurveZ, QgsWkbTypes::MultiCurve, QgsWkbTypes::LineGeometry, true, false ) },
|
||||
{ QgsWkbTypes::MultiCurveM, WkbEntry( QLatin1String( "MultiCurveM" ), true, QgsWkbTypes::MultiCurveM, QgsWkbTypes::CompoundCurveM, QgsWkbTypes::MultiCurve, QgsWkbTypes::LineGeometry, false, true ) },
|
||||
{ QgsWkbTypes::MultiCurveZM, WkbEntry( QLatin1String( "MultiCurveZM" ), true, QgsWkbTypes::MultiCurveZM, QgsWkbTypes::CompoundCurveZM, QgsWkbTypes::MultiCurve, QgsWkbTypes::LineGeometry, true, true ) },
|
||||
//multipolygon
|
||||
{ MultiPolygon, wkbEntry( QStringLiteral( "MultiPolygon" ), true, MultiPolygon, Polygon, MultiPolygon, PolygonGeometry, false, false ) },
|
||||
{ MultiPolygonZ, wkbEntry( QStringLiteral( "MultiPolygonZ" ), true, MultiPolygonZ, PolygonZ, MultiPolygon, PolygonGeometry, true, false ) },
|
||||
{ MultiPolygonM, wkbEntry( QStringLiteral( "MultiPolygonM" ), true, MultiPolygonM, PolygonM, MultiPolygon, PolygonGeometry, false, true ) },
|
||||
{ MultiPolygonZM, wkbEntry( QStringLiteral( "MultiPolygonZM" ), true, MultiPolygonZM, PolygonZM, MultiPolygon, PolygonGeometry, true, true ) },
|
||||
{ MultiPolygon25D, wkbEntry( QStringLiteral( "MultiPolygon25D" ), true, MultiPolygon25D, Polygon25D, MultiPolygon, PolygonGeometry, true, false ) },
|
||||
{ QgsWkbTypes::MultiPolygon, WkbEntry( QLatin1String( "MultiPolygon" ), true, QgsWkbTypes::MultiPolygon, QgsWkbTypes::Polygon, QgsWkbTypes::MultiPolygon, QgsWkbTypes::PolygonGeometry, false, false ) },
|
||||
{ QgsWkbTypes::MultiPolygonZ, WkbEntry( QLatin1String( "MultiPolygonZ" ), true, QgsWkbTypes::MultiPolygonZ, QgsWkbTypes::PolygonZ, QgsWkbTypes::MultiPolygon, QgsWkbTypes::PolygonGeometry, true, false ) },
|
||||
{ QgsWkbTypes::MultiPolygonM, WkbEntry( QLatin1String( "MultiPolygonM" ), true, QgsWkbTypes::MultiPolygonM, QgsWkbTypes::PolygonM, QgsWkbTypes::MultiPolygon, QgsWkbTypes::PolygonGeometry, false, true ) },
|
||||
{ QgsWkbTypes::MultiPolygonZM, WkbEntry( QLatin1String( "MultiPolygonZM" ), true, QgsWkbTypes::MultiPolygonZM, QgsWkbTypes::PolygonZM, QgsWkbTypes::MultiPolygon, QgsWkbTypes::PolygonGeometry, true, true ) },
|
||||
{ QgsWkbTypes::MultiPolygon25D, WkbEntry( QLatin1String( "MultiPolygon25D" ), true, QgsWkbTypes::MultiPolygon25D, QgsWkbTypes::Polygon25D, QgsWkbTypes::MultiPolygon, QgsWkbTypes::PolygonGeometry, true, false ) },
|
||||
//multisurface
|
||||
{ MultiSurface, wkbEntry( QStringLiteral( "MultiSurface" ), true, MultiSurface, CurvePolygon, MultiSurface, PolygonGeometry, false, false ) },
|
||||
{ MultiSurfaceZ, wkbEntry( QStringLiteral( "MultiSurfaceZ" ), true, MultiSurfaceZ, CurvePolygonZ, MultiSurface, PolygonGeometry, true, false ) },
|
||||
{ MultiSurfaceM, wkbEntry( QStringLiteral( "MultiSurfaceM" ), true, MultiSurfaceM, CurvePolygonM, MultiSurface, PolygonGeometry, false, true ) },
|
||||
{ MultiSurfaceZM, wkbEntry( QStringLiteral( "MultiSurfaceZM" ), true, MultiSurfaceZM, CurvePolygonZM, MultiSurface, PolygonGeometry, true, true ) },
|
||||
{ QgsWkbTypes::MultiSurface, WkbEntry( QLatin1String( "MultiSurface" ), true, QgsWkbTypes::MultiSurface, QgsWkbTypes::CurvePolygon, QgsWkbTypes::MultiSurface, QgsWkbTypes::PolygonGeometry, false, false ) },
|
||||
{ QgsWkbTypes::MultiSurfaceZ, WkbEntry( QLatin1String( "MultiSurfaceZ" ), true, QgsWkbTypes::MultiSurfaceZ, QgsWkbTypes::CurvePolygonZ, QgsWkbTypes::MultiSurface, QgsWkbTypes::PolygonGeometry, true, false ) },
|
||||
{ QgsWkbTypes::MultiSurfaceM, WkbEntry( QLatin1String( "MultiSurfaceM" ), true, QgsWkbTypes::MultiSurfaceM, QgsWkbTypes::CurvePolygonM, QgsWkbTypes::MultiSurface, QgsWkbTypes::PolygonGeometry, false, true ) },
|
||||
{ QgsWkbTypes::MultiSurfaceZM, WkbEntry( QLatin1String( "MultiSurfaceZM" ), true, QgsWkbTypes::MultiSurfaceZM, QgsWkbTypes::CurvePolygonZM, QgsWkbTypes::MultiSurface, QgsWkbTypes::PolygonGeometry, true, true ) },
|
||||
//geometrycollection
|
||||
{ GeometryCollection, wkbEntry( QStringLiteral( "GeometryCollection" ), true, GeometryCollection, Unknown, GeometryCollection, UnknownGeometry, false, false ) },
|
||||
{ GeometryCollectionZ, wkbEntry( QStringLiteral( "GeometryCollectionZ" ), true, GeometryCollectionZ, Unknown, GeometryCollection, UnknownGeometry, true, false ) },
|
||||
{ GeometryCollectionM, wkbEntry( QStringLiteral( "GeometryCollectionM" ), true, GeometryCollectionM, Unknown, GeometryCollection, UnknownGeometry, false, true ) },
|
||||
{ GeometryCollectionZM, wkbEntry( QStringLiteral( "GeometryCollectionZM" ), true, GeometryCollectionZM, Unknown, GeometryCollection, UnknownGeometry, true, true ) },
|
||||
};
|
||||
{ QgsWkbTypes::GeometryCollection, WkbEntry( QLatin1String( "GeometryCollection" ), true, QgsWkbTypes::GeometryCollection, QgsWkbTypes::Unknown, QgsWkbTypes::GeometryCollection, QgsWkbTypes::UnknownGeometry, false, false ) },
|
||||
{ QgsWkbTypes::GeometryCollectionZ, WkbEntry( QLatin1String( "GeometryCollectionZ" ), true, QgsWkbTypes::GeometryCollectionZ, QgsWkbTypes::Unknown, QgsWkbTypes::GeometryCollection, QgsWkbTypes::UnknownGeometry, true, false ) },
|
||||
{ QgsWkbTypes::GeometryCollectionM, WkbEntry( QLatin1String( "GeometryCollectionM" ), true, QgsWkbTypes::GeometryCollectionM, QgsWkbTypes::Unknown, QgsWkbTypes::GeometryCollection, QgsWkbTypes::UnknownGeometry, false, true ) },
|
||||
{ QgsWkbTypes::GeometryCollectionZM, WkbEntry( QLatin1String( "GeometryCollectionZM" ), true, QgsWkbTypes::GeometryCollectionZM, QgsWkbTypes::Unknown, QgsWkbTypes::GeometryCollection, QgsWkbTypes::UnknownGeometry, true, true ) },
|
||||
} ) )
|
||||
|
||||
QgsWkbTypes::Type QgsWkbTypes::parseType( const QString &wktStr )
|
||||
{
|
||||
QString typestr = wktStr.left( wktStr.indexOf( '(' ) ).simplified().remove( ' ' );
|
||||
|
||||
QMap<QgsWkbTypes::Type, QgsWkbTypes::wkbEntry>::const_iterator it = ENTRIES.constBegin();
|
||||
for ( ; it != ENTRIES.constEnd(); ++it )
|
||||
QMap<QgsWkbTypes::Type, WkbEntry>::const_iterator it = sWkbEntries()->constBegin();
|
||||
for ( ; it != sWkbEntries()->constEnd(); ++it )
|
||||
{
|
||||
if ( it.value().mName.compare( typestr, Qt::CaseInsensitive ) == 0 )
|
||||
{
|
||||
@ -118,8 +144,8 @@ QgsWkbTypes::Type QgsWkbTypes::parseType( const QString &wktStr )
|
||||
|
||||
QString QgsWkbTypes::displayString( Type type )
|
||||
{
|
||||
QMap< Type, wkbEntry >::const_iterator it = ENTRIES.constFind( type );
|
||||
if ( it == ENTRIES.constEnd() )
|
||||
QMap< Type, WkbEntry >::const_iterator it = sWkbEntries()->constFind( type );
|
||||
if ( it == sWkbEntries()->constEnd() )
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
@ -1112,32 +1112,6 @@ class CORE_EXPORT QgsWkbTypes
|
||||
return Unknown;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
struct wkbEntry
|
||||
{
|
||||
wkbEntry( const QString &name, bool isMultiType, Type multiType, Type singleType, Type flatType, GeometryType geometryType,
|
||||
bool hasZ, bool hasM )
|
||||
: mName( name )
|
||||
, mIsMultiType( isMultiType )
|
||||
, mMultiType( multiType )
|
||||
, mSingleType( singleType )
|
||||
, mFlatType( flatType )
|
||||
, mGeometryType( geometryType )
|
||||
, mHasZ( hasZ )
|
||||
, mHasM( hasM )
|
||||
{}
|
||||
QString mName;
|
||||
bool mIsMultiType;
|
||||
Type mMultiType;
|
||||
Type mSingleType;
|
||||
Type mFlatType;
|
||||
GeometryType mGeometryType;
|
||||
bool mHasZ;
|
||||
bool mHasM;
|
||||
};
|
||||
|
||||
static const QMap<Type, wkbEntry> ENTRIES;
|
||||
};
|
||||
|
||||
#endif // QGSWKBTYPES_H
|
||||
|
@ -592,8 +592,8 @@ QgsLayoutExporter::ExportResult QgsLayoutExporter::exportToPdf( const QString &f
|
||||
{
|
||||
// copy layout metadata to GeoPDF export settings
|
||||
details.author = mLayout->project()->metadata().author();
|
||||
details.producer = QStringLiteral( "QGIS %1" ).arg( Qgis::QGIS_VERSION );
|
||||
details.creator = QStringLiteral( "QGIS %1" ).arg( Qgis::QGIS_VERSION );
|
||||
details.producer = QStringLiteral( "QGIS %1" ).arg( Qgis::version() );
|
||||
details.creator = QStringLiteral( "QGIS %1" ).arg( Qgis::version() );
|
||||
details.creationDateTime = mLayout->project()->metadata().creationDateTime();
|
||||
details.subject = mLayout->project()->metadata().abstract();
|
||||
details.title = mLayout->project()->metadata().title();
|
||||
@ -1390,7 +1390,7 @@ void QgsLayoutExporter::appendMetadataToSvg( QDomDocument &svg ) const
|
||||
};
|
||||
|
||||
addAgentNode( QStringLiteral( "dc:creator" ), metadata.author() );
|
||||
addAgentNode( QStringLiteral( "dc:publisher" ), QStringLiteral( "QGIS %1" ).arg( Qgis::QGIS_VERSION ) );
|
||||
addAgentNode( QStringLiteral( "dc:publisher" ), QStringLiteral( "QGIS %1" ).arg( Qgis::version() ) );
|
||||
|
||||
// keywords
|
||||
{
|
||||
@ -1575,7 +1575,7 @@ bool QgsLayoutExporter::georeferenceOutputPrivate( const QString &file, QgsLayou
|
||||
GDALSetMetadataItem( outputDS.get(), "CREATION_DATE", creationDateString.toLocal8Bit().constData(), nullptr );
|
||||
|
||||
GDALSetMetadataItem( outputDS.get(), "AUTHOR", mLayout->project()->metadata().author().toLocal8Bit().constData(), nullptr );
|
||||
const QString creator = QStringLiteral( "QGIS %1" ).arg( Qgis::QGIS_VERSION );
|
||||
const QString creator = QStringLiteral( "QGIS %1" ).arg( Qgis::version() );
|
||||
GDALSetMetadataItem( outputDS.get(), "CREATOR", creator.toLocal8Bit().constData(), nullptr );
|
||||
GDALSetMetadataItem( outputDS.get(), "PRODUCER", creator.toLocal8Bit().constData(), nullptr );
|
||||
GDALSetMetadataItem( outputDS.get(), "SUBJECT", mLayout->project()->metadata().abstract().toLocal8Bit().constData(), nullptr );
|
||||
@ -1960,7 +1960,7 @@ bool QgsLayoutExporter::saveImage( const QImage &image, const QString &imageFile
|
||||
if ( projectForMetadata )
|
||||
{
|
||||
w.setText( QStringLiteral( "Author" ), projectForMetadata->metadata().author() );
|
||||
const QString creator = QStringLiteral( "QGIS %1" ).arg( Qgis::QGIS_VERSION );
|
||||
const QString creator = QStringLiteral( "QGIS %1" ).arg( Qgis::version() );
|
||||
w.setText( QStringLiteral( "Creator" ), creator );
|
||||
w.setText( QStringLiteral( "Producer" ), creator );
|
||||
w.setText( QStringLiteral( "Subject" ), projectForMetadata->metadata().abstract() );
|
||||
|
@ -57,7 +57,7 @@ void QgsProcessingFeedback::pushConsoleInfo( const QString &info )
|
||||
|
||||
void QgsProcessingFeedback::pushVersionInfo( const QgsProcessingProvider *provider )
|
||||
{
|
||||
pushDebugInfo( tr( "QGIS version: %1" ).arg( Qgis::QGIS_VERSION ) );
|
||||
pushDebugInfo( tr( "QGIS version: %1" ).arg( Qgis::version() ) );
|
||||
if ( QString( Qgis::QGIS_DEV_VERSION ) != QLatin1String( "exported" ) )
|
||||
{
|
||||
pushDebugInfo( tr( "QGIS code revision: %1" ).arg( Qgis::QGIS_DEV_VERSION ) );
|
||||
|
@ -35,42 +35,9 @@
|
||||
// Version constants
|
||||
//
|
||||
|
||||
// Version string
|
||||
const QString Qgis::QGIS_VERSION( QString::fromUtf8( VERSION ) );
|
||||
|
||||
// development version
|
||||
const char *Qgis::QGIS_DEV_VERSION = QGSVERSION;
|
||||
|
||||
// Version number used for comparing versions using the
|
||||
// "Check QGIS Version" function
|
||||
const int Qgis::QGIS_VERSION_INT = VERSION_INT;
|
||||
|
||||
// Release name
|
||||
const QString Qgis::QGIS_RELEASE_NAME( QString::fromUtf8( RELEASE_NAME ) );
|
||||
|
||||
const QString GEOPROJ4 = QStringLiteral( "+proj=longlat +datum=WGS84 +no_defs" );
|
||||
|
||||
const QString GEOWKT =
|
||||
"GEOGCS[\"WGS 84\", "
|
||||
" DATUM[\"WGS_1984\", "
|
||||
" SPHEROID[\"WGS 84\",6378137,298.257223563, "
|
||||
" AUTHORITY[\"EPSG\",\"7030\"]], "
|
||||
" TOWGS84[0,0,0,0,0,0,0], "
|
||||
" AUTHORITY[\"EPSG\",\"6326\"]], "
|
||||
" PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]], "
|
||||
" UNIT[\"DMSH\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]], "
|
||||
" AXIS[\"Lat\",NORTH], "
|
||||
" AXIS[\"Long\",EAST], "
|
||||
" AUTHORITY[\"EPSG\",\"4326\"]]";
|
||||
|
||||
const QString PROJECT_SCALES =
|
||||
"1:1000000,1:500000,1:250000,1:100000,1:50000,1:25000,"
|
||||
"1:10000,1:5000,1:2500,1:1000,1:500";
|
||||
|
||||
const QString GEO_EPSG_CRS_AUTHID = QStringLiteral( "EPSG:4326" );
|
||||
|
||||
const QString GEO_NONE = QStringLiteral( "NONE" );
|
||||
|
||||
const double Qgis::DEFAULT_SEARCH_RADIUS_MM = 2.;
|
||||
|
||||
const float Qgis::DEFAULT_MAPTOPIXEL_THRESHOLD = 1.0f;
|
||||
@ -299,3 +266,63 @@ bool qgsVariantEqual( const QVariant &lhs, const QVariant &rhs )
|
||||
{
|
||||
return ( lhs.isNull() == rhs.isNull() && lhs == rhs ) || ( lhs.isNull() && rhs.isNull() && lhs.isValid() && rhs.isValid() );
|
||||
}
|
||||
|
||||
QString geoNone()
|
||||
{
|
||||
return QStringLiteral( "NONE" );
|
||||
}
|
||||
|
||||
QString geoEpsgCrsAuthId()
|
||||
{
|
||||
return QStringLiteral( "EPSG:4326" );
|
||||
}
|
||||
|
||||
QString geoProj4()
|
||||
{
|
||||
return QStringLiteral( "+proj=longlat +datum=WGS84 +no_defs" );
|
||||
}
|
||||
|
||||
QString geoWkt()
|
||||
{
|
||||
return QStringLiteral(
|
||||
"GEOGCS[\"WGS 84\", "
|
||||
" DATUM[\"WGS_1984\", "
|
||||
" SPHEROID[\"WGS 84\",6378137,298.257223563, "
|
||||
" AUTHORITY[\"EPSG\",\"7030\"]], "
|
||||
" TOWGS84[0,0,0,0,0,0,0], "
|
||||
" AUTHORITY[\"EPSG\",\"6326\"]], "
|
||||
" PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]], "
|
||||
" UNIT[\"DMSH\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9108\"]], "
|
||||
" AXIS[\"Lat\",NORTH], "
|
||||
" AXIS[\"Long\",EAST], "
|
||||
" AUTHORITY[\"EPSG\",\"4326\"]]"
|
||||
);
|
||||
}
|
||||
|
||||
QString projectScales()
|
||||
{
|
||||
return QStringLiteral( "1:1000000,1:500000,1:250000,1:100000,1:50000,1:25000,"
|
||||
"1:10000,1:5000,1:2500,1:1000,1:500" );
|
||||
}
|
||||
|
||||
QString Qgis::version()
|
||||
{
|
||||
return QString::fromUtf8( VERSION );
|
||||
}
|
||||
|
||||
int Qgis::versionInt()
|
||||
{
|
||||
// Version number used for comparing versions using the
|
||||
// "Check QGIS Version" function
|
||||
return VERSION_INT;
|
||||
}
|
||||
|
||||
QString Qgis::releaseName()
|
||||
{
|
||||
return QString::fromUtf8( RELEASE_NAME );
|
||||
}
|
||||
|
||||
QString Qgis::devVersion()
|
||||
{
|
||||
return QString::fromUtf8( QGIS_DEV_VERSION );
|
||||
}
|
||||
|
@ -49,13 +49,14 @@ class CORE_EXPORT Qgis
|
||||
// Version constants
|
||||
//
|
||||
//! Version string
|
||||
static const QString QGIS_VERSION;
|
||||
static QString version();
|
||||
//! Version number used for comparing versions using the "Check QGIS Version" function
|
||||
static const int QGIS_VERSION_INT;
|
||||
static int versionInt();
|
||||
//! Release name
|
||||
static const QString QGIS_RELEASE_NAME;
|
||||
static QString releaseName();
|
||||
//! The development version
|
||||
static const char *QGIS_DEV_VERSION;
|
||||
static QString devVersion();
|
||||
|
||||
// Enumerations
|
||||
//
|
||||
@ -564,11 +565,11 @@ void CORE_EXPORT qgsFree( void *ptr ) SIP_SKIP;
|
||||
* Wkt string that represents a geographic coord sys
|
||||
* \since QGIS GEOWkt
|
||||
*/
|
||||
extern CORE_EXPORT const QString GEOWKT;
|
||||
extern CORE_EXPORT const QString PROJECT_SCALES;
|
||||
QString CORE_EXPORT geoWkt();
|
||||
QString CORE_EXPORT projectScales();
|
||||
|
||||
//! PROJ4 string that represents a geographic coord sys
|
||||
extern CORE_EXPORT const QString GEOPROJ4;
|
||||
QString CORE_EXPORT geoProj4();
|
||||
//! Magic number for a geographic coord sys in POSTGIS SRID
|
||||
const long GEOSRID = 4326;
|
||||
//! Magic number for a geographic coord sys in QGIS srs.db tbl_srs.srs_id
|
||||
@ -576,7 +577,7 @@ const long GEOCRS_ID = 3452;
|
||||
//! Magic number for a geographic coord sys in EpsgCrsId ID format
|
||||
const long GEO_EPSG_CRS_ID = 4326;
|
||||
//! Geographic coord sys from EPSG authority
|
||||
extern CORE_EXPORT const QString GEO_EPSG_CRS_AUTHID;
|
||||
QString CORE_EXPORT geoEpsgCrsAuthId();
|
||||
|
||||
/**
|
||||
* Magick number that determines whether a projection crsid is a system (srs.db)
|
||||
@ -584,7 +585,7 @@ extern CORE_EXPORT const QString GEO_EPSG_CRS_AUTHID;
|
||||
const int USER_CRS_START_ID = 100000;
|
||||
|
||||
//! Constant that holds the string representation for "No ellips/No CRS"
|
||||
extern CORE_EXPORT const QString GEO_NONE;
|
||||
QString CORE_EXPORT geoNone();
|
||||
|
||||
//
|
||||
// Constants for point symbols
|
||||
|
@ -49,12 +49,12 @@ QgsDistanceArea::QgsDistanceArea()
|
||||
mInvFlattening = -1.0;
|
||||
QgsCoordinateTransformContext context; // this is ok - by default we have a source/dest of WGS84, so no reprojection takes place
|
||||
setSourceCrs( QgsCoordinateReferenceSystem::fromSrsId( GEOCRS_ID ), context ); // WGS 84
|
||||
setEllipsoid( GEO_NONE );
|
||||
setEllipsoid( geoNone() );
|
||||
}
|
||||
|
||||
bool QgsDistanceArea::willUseEllipsoid() const
|
||||
{
|
||||
return mEllipsoid != GEO_NONE;
|
||||
return mEllipsoid != geoNone();
|
||||
}
|
||||
|
||||
void QgsDistanceArea::setSourceCrs( const QgsCoordinateReferenceSystem &srcCRS, const QgsCoordinateTransformContext &context )
|
||||
@ -66,9 +66,9 @@ void QgsDistanceArea::setSourceCrs( const QgsCoordinateReferenceSystem &srcCRS,
|
||||
bool QgsDistanceArea::setEllipsoid( const QString &ellipsoid )
|
||||
{
|
||||
// Shortcut if ellipsoid is none.
|
||||
if ( ellipsoid == GEO_NONE )
|
||||
if ( ellipsoid == geoNone() )
|
||||
{
|
||||
mEllipsoid = GEO_NONE;
|
||||
mEllipsoid = geoNone();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -476,7 +476,7 @@ double QgsDistanceArea::latitudeGeodesicCrossesAntimeridian( const QgsPointXY &p
|
||||
double lat = p2y;
|
||||
double lon = p2x;
|
||||
|
||||
if ( mEllipsoid == GEO_NONE )
|
||||
if ( mEllipsoid == geoNone() )
|
||||
{
|
||||
fractionAlongLine = ( 180 - p1x ) / ( p2x - p1x );
|
||||
if ( p1.x() >= 180 )
|
||||
@ -971,7 +971,7 @@ double QgsDistanceArea::getQbar( double x ) const
|
||||
void QgsDistanceArea::computeAreaInit()
|
||||
{
|
||||
//don't try to perform calculations if no ellipsoid
|
||||
if ( mEllipsoid == GEO_NONE )
|
||||
if ( mEllipsoid == geoNone() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1037,7 +1037,7 @@ bool QgsMapLayer::importNamedStyle( QDomDocument &myDocument, QString &myErrorMe
|
||||
|
||||
// get style file version string, if any
|
||||
QgsProjectVersion fileVersion( myRoot.attribute( QStringLiteral( "version" ) ) );
|
||||
QgsProjectVersion thisVersion( Qgis::QGIS_VERSION );
|
||||
QgsProjectVersion thisVersion( Qgis::version() );
|
||||
|
||||
if ( thisVersion > fileVersion )
|
||||
{
|
||||
@ -1075,7 +1075,7 @@ void QgsMapLayer::exportNamedMetadata( QDomDocument &doc, QString &errorMsg ) co
|
||||
QDomDocument myDocument( documentType );
|
||||
|
||||
QDomElement myRootNode = myDocument.createElement( QStringLiteral( "qgis" ) );
|
||||
myRootNode.setAttribute( QStringLiteral( "version" ), Qgis::QGIS_VERSION );
|
||||
myRootNode.setAttribute( QStringLiteral( "version" ), Qgis::version() );
|
||||
myDocument.appendChild( myRootNode );
|
||||
|
||||
if ( !mMetadata.writeMetadataXml( myRootNode, myDocument ) )
|
||||
@ -1094,7 +1094,7 @@ void QgsMapLayer::exportNamedStyle( QDomDocument &doc, QString &errorMsg, const
|
||||
QDomDocument myDocument( documentType );
|
||||
|
||||
QDomElement myRootNode = myDocument.createElement( QStringLiteral( "qgis" ) );
|
||||
myRootNode.setAttribute( QStringLiteral( "version" ), Qgis::QGIS_VERSION );
|
||||
myRootNode.setAttribute( QStringLiteral( "version" ), Qgis::version() );
|
||||
myDocument.appendChild( myRootNode );
|
||||
|
||||
if ( !writeSymbology( myRootNode, myDocument, errorMsg, context, categories ) ) // TODO: support relative paths in QML?
|
||||
|
@ -343,7 +343,7 @@ bool QgsMapRendererTask::run()
|
||||
GDALSetMetadataItem( outputDS.get(), "CREATION_DATE", creationDateString.toLocal8Bit().constData(), nullptr );
|
||||
|
||||
GDALSetMetadataItem( outputDS.get(), "AUTHOR", mGeoPdfExportDetails.author.toLocal8Bit().constData(), nullptr );
|
||||
const QString creator = QStringLiteral( "QGIS %1" ).arg( Qgis::QGIS_VERSION );
|
||||
const QString creator = QStringLiteral( "QGIS %1" ).arg( Qgis::version() );
|
||||
GDALSetMetadataItem( outputDS.get(), "CREATOR", creator.toLocal8Bit().constData(), nullptr );
|
||||
GDALSetMetadataItem( outputDS.get(), "PRODUCER", creator.toLocal8Bit().constData(), nullptr );
|
||||
GDALSetMetadataItem( outputDS.get(), "SUBJECT", mGeoPdfExportDetails.subject.toLocal8Bit().constData(), nullptr );
|
||||
|
@ -221,7 +221,7 @@ QNetworkReply *QgsNetworkAccessManager::createRequest( QNetworkAccessManager::Op
|
||||
QString userAgent = s.value( QStringLiteral( "/qgis/networkAndProxy/userAgent" ), "Mozilla/5.0" ).toString();
|
||||
if ( !userAgent.isEmpty() )
|
||||
userAgent += ' ';
|
||||
userAgent += QStringLiteral( "QGIS/%1" ).arg( Qgis::QGIS_VERSION );
|
||||
userAgent += QStringLiteral( "QGIS/%1" ).arg( Qgis::version() );
|
||||
pReq->setRawHeader( "User-Agent", userAgent.toUtf8() );
|
||||
|
||||
#ifndef QT_NO_SSL
|
||||
|
@ -681,9 +681,9 @@ void QgsProject::setCrs( const QgsCoordinateReferenceSystem &crs, bool adjustEll
|
||||
QString QgsProject::ellipsoid() const
|
||||
{
|
||||
if ( !crs().isValid() )
|
||||
return GEO_NONE;
|
||||
return geoNone();
|
||||
|
||||
return readEntry( QStringLiteral( "Measure" ), QStringLiteral( "/Ellipsoid" ), GEO_NONE );
|
||||
return readEntry( QStringLiteral( "Measure" ), QStringLiteral( "/Ellipsoid" ), geoNone() );
|
||||
}
|
||||
|
||||
void QgsProject::setEllipsoid( const QString &ellipsoid )
|
||||
@ -1193,13 +1193,13 @@ bool QgsProject::readProjectFile( const QString &filename, QgsProject::ReadFlags
|
||||
|
||||
// get project version string, if any
|
||||
QgsProjectVersion fileVersion = getVersion( *doc );
|
||||
QgsProjectVersion thisVersion( Qgis::QGIS_VERSION );
|
||||
QgsProjectVersion thisVersion( Qgis::version() );
|
||||
|
||||
if ( thisVersion > fileVersion )
|
||||
{
|
||||
QgsLogger::warning( "Loading a file that was saved with an older "
|
||||
"version of qgis (saved in " + fileVersion.text() +
|
||||
", loaded in " + Qgis::QGIS_VERSION +
|
||||
", loaded in " + Qgis::version() +
|
||||
"). Problems may occur." );
|
||||
|
||||
QgsProjectFileTransform projectFile( *doc, fileVersion );
|
||||
@ -1937,7 +1937,7 @@ bool QgsProject::writeProjectFile( const QString &filename )
|
||||
|
||||
QDomElement qgisNode = doc->createElement( QStringLiteral( "qgis" ) );
|
||||
qgisNode.setAttribute( QStringLiteral( "projectname" ), title() );
|
||||
qgisNode.setAttribute( QStringLiteral( "version" ), QStringLiteral( "%1" ).arg( Qgis::QGIS_VERSION ) );
|
||||
qgisNode.setAttribute( QStringLiteral( "version" ), QStringLiteral( "%1" ).arg( Qgis::version() ) );
|
||||
|
||||
doc->appendChild( qgisNode );
|
||||
|
||||
@ -3136,7 +3136,7 @@ QgsCoordinateReferenceSystem QgsProject::defaultCrsForNewLayers() const
|
||||
else
|
||||
{
|
||||
// global crs
|
||||
QString layerDefaultCrs = settings.value( QStringLiteral( "/Projections/layerDefaultCrs" ), GEO_EPSG_CRS_AUTHID ).toString();
|
||||
QString layerDefaultCrs = settings.value( QStringLiteral( "/Projections/layerDefaultCrs" ), geoEpsgCrsAuthId() ).toString();
|
||||
defaultCrs = QgsCoordinateReferenceSystem::fromOgcWmsCrs( layerDefaultCrs );
|
||||
}
|
||||
|
||||
|
@ -38,52 +38,78 @@
|
||||
|
||||
typedef QgsProjectVersion PFV;
|
||||
|
||||
// Transformer functions below. Declare functions here,
|
||||
// define them in qgsprojectfiletransform.cpp and add them
|
||||
// to the transformArray with proper version number
|
||||
void transformNull( QgsProjectFileTransform *pft ) { Q_UNUSED( pft ) } // Do absolutely nothing
|
||||
void transform081to090( QgsProjectFileTransform *pft );
|
||||
void transform091to0100( QgsProjectFileTransform *pft );
|
||||
void transform0100to0110( QgsProjectFileTransform *pft );
|
||||
void transform0110to1000( QgsProjectFileTransform *pft );
|
||||
void transform1100to1200( QgsProjectFileTransform *pft );
|
||||
void transform1400to1500( QgsProjectFileTransform *pft );
|
||||
void transform1800to1900( QgsProjectFileTransform *pft );
|
||||
void transform2200to2300( QgsProjectFileTransform *pft );
|
||||
void transform3000( QgsProjectFileTransform *pft );
|
||||
|
||||
QgsProjectFileTransform::TransformItem QgsProjectFileTransform::sTransformers[] =
|
||||
//helper functions
|
||||
int rasterBandNumber( const QDomElement &rasterPropertiesElem, const QString &bandName, QgsRasterLayer *rlayer );
|
||||
void transformContrastEnhancement( QDomDocument &doc, const QDomElement &rasterproperties, QDomElement &rendererElem );
|
||||
void transformRasterTransparency( QDomDocument &doc, const QDomElement &orig, QDomElement &rendererElem );
|
||||
|
||||
typedef struct
|
||||
{
|
||||
{PFV( 0, 8, 0 ), PFV( 0, 8, 1 ), &QgsProjectFileTransform::transformNull},
|
||||
{PFV( 0, 8, 1 ), PFV( 0, 9, 0 ), &QgsProjectFileTransform::transform081to090},
|
||||
{PFV( 0, 9, 0 ), PFV( 0, 9, 1 ), &QgsProjectFileTransform::transformNull},
|
||||
{PFV( 0, 9, 1 ), PFV( 0, 10, 0 ), &QgsProjectFileTransform::transform091to0100},
|
||||
// Following line is a hack that takes us straight from 0.9.2 to 0.11.0
|
||||
// due to an unknown bug in migrating 0.9.2 files which we didn't pursue (TS & GS)
|
||||
{PFV( 0, 9, 2 ), PFV( 0, 11, 0 ), &QgsProjectFileTransform::transformNull},
|
||||
{PFV( 0, 10, 0 ), PFV( 0, 11, 0 ), &QgsProjectFileTransform::transform0100to0110},
|
||||
{PFV( 0, 11, 0 ), PFV( 1, 0, 0 ), &QgsProjectFileTransform::transform0110to1000},
|
||||
{PFV( 1, 0, 0 ), PFV( 1, 1, 0 ), &QgsProjectFileTransform::transformNull},
|
||||
{PFV( 1, 0, 2 ), PFV( 1, 1, 0 ), &QgsProjectFileTransform::transformNull},
|
||||
{PFV( 1, 1, 0 ), PFV( 1, 2, 0 ), &QgsProjectFileTransform::transform1100to1200},
|
||||
{PFV( 1, 2, 0 ), PFV( 1, 3, 0 ), &QgsProjectFileTransform::transformNull},
|
||||
{PFV( 1, 3, 0 ), PFV( 1, 4, 0 ), &QgsProjectFileTransform::transformNull},
|
||||
{PFV( 1, 4, 0 ), PFV( 1, 5, 0 ), &QgsProjectFileTransform::transform1400to1500},
|
||||
{PFV( 1, 5, 0 ), PFV( 1, 6, 0 ), &QgsProjectFileTransform::transformNull},
|
||||
{PFV( 1, 6, 0 ), PFV( 1, 7, 0 ), &QgsProjectFileTransform::transformNull},
|
||||
{PFV( 1, 7, 0 ), PFV( 1, 8, 0 ), &QgsProjectFileTransform::transformNull},
|
||||
{PFV( 1, 8, 0 ), PFV( 1, 9, 0 ), &QgsProjectFileTransform::transform1800to1900},
|
||||
{PFV( 1, 9, 0 ), PFV( 2, 0, 0 ), &QgsProjectFileTransform::transformNull},
|
||||
{PFV( 2, 0, 0 ), PFV( 2, 1, 0 ), &QgsProjectFileTransform::transformNull},
|
||||
{PFV( 2, 1, 0 ), PFV( 2, 2, 0 ), &QgsProjectFileTransform::transformNull},
|
||||
{PFV( 2, 2, 0 ), PFV( 2, 3, 0 ), &QgsProjectFileTransform::transform2200to2300},
|
||||
// A transformer with a NULL from version means that it should be run when upgrading
|
||||
// from any version and will take care that it's not going to cause trouble if it's
|
||||
// run several times on the same file.
|
||||
{PFV(), PFV( 3, 0, 0 ), &QgsProjectFileTransform::transform3000},
|
||||
};
|
||||
QgsProjectVersion from;
|
||||
QgsProjectVersion to;
|
||||
void ( * transformFunc )( QgsProjectFileTransform * );
|
||||
} TransformItem;
|
||||
|
||||
typedef std::vector<TransformItem> Transformers;
|
||||
|
||||
bool QgsProjectFileTransform::updateRevision( const QgsProjectVersion &newVersion )
|
||||
{
|
||||
Q_UNUSED( newVersion )
|
||||
bool returnValue = false;
|
||||
|
||||
static const Transformers transformers(
|
||||
{
|
||||
{PFV( 0, 8, 0 ), PFV( 0, 8, 1 ), &transformNull},
|
||||
{PFV( 0, 8, 1 ), PFV( 0, 9, 0 ), &transform081to090},
|
||||
{PFV( 0, 9, 0 ), PFV( 0, 9, 1 ), &transformNull},
|
||||
{PFV( 0, 9, 1 ), PFV( 0, 10, 0 ), &transform091to0100},
|
||||
// Following line is a hack that takes us straight from 0.9.2 to 0.11.0
|
||||
// due to an unknown bug in migrating 0.9.2 files which we didn't pursue (TS & GS)
|
||||
{PFV( 0, 9, 2 ), PFV( 0, 11, 0 ), &transformNull},
|
||||
{PFV( 0, 10, 0 ), PFV( 0, 11, 0 ), &transform0100to0110},
|
||||
{PFV( 0, 11, 0 ), PFV( 1, 0, 0 ), &transform0110to1000},
|
||||
{PFV( 1, 0, 0 ), PFV( 1, 1, 0 ), &transformNull},
|
||||
{PFV( 1, 0, 2 ), PFV( 1, 1, 0 ), &transformNull},
|
||||
{PFV( 1, 1, 0 ), PFV( 1, 2, 0 ), &transform1100to1200},
|
||||
{PFV( 1, 2, 0 ), PFV( 1, 3, 0 ), &transformNull},
|
||||
{PFV( 1, 3, 0 ), PFV( 1, 4, 0 ), &transformNull},
|
||||
{PFV( 1, 4, 0 ), PFV( 1, 5, 0 ), &transform1400to1500},
|
||||
{PFV( 1, 5, 0 ), PFV( 1, 6, 0 ), &transformNull},
|
||||
{PFV( 1, 6, 0 ), PFV( 1, 7, 0 ), &transformNull},
|
||||
{PFV( 1, 7, 0 ), PFV( 1, 8, 0 ), &transformNull},
|
||||
{PFV( 1, 8, 0 ), PFV( 1, 9, 0 ), &transform1800to1900},
|
||||
{PFV( 1, 9, 0 ), PFV( 2, 0, 0 ), &transformNull},
|
||||
{PFV( 2, 0, 0 ), PFV( 2, 1, 0 ), &transformNull},
|
||||
{PFV( 2, 1, 0 ), PFV( 2, 2, 0 ), &transformNull},
|
||||
{PFV( 2, 2, 0 ), PFV( 2, 3, 0 ), &transform2200to2300},
|
||||
// A transformer with a NULL from version means that it should be run when upgrading
|
||||
// from any version and will take care that it's not going to cause trouble if it's
|
||||
// run several times on the same file.
|
||||
{PFV(), PFV( 3, 0, 0 ), &transform3000},
|
||||
} );
|
||||
|
||||
if ( !mDom.isNull() )
|
||||
{
|
||||
for ( std::size_t i = 0; i < sizeof( sTransformers ) / sizeof( TransformItem ); i++ )
|
||||
for ( const TransformItem &transformer : transformers )
|
||||
{
|
||||
const TransformItem &transformer = sTransformers[i];
|
||||
if ( transformer.to >= mCurrentVersion && ( transformer.from == mCurrentVersion || transformer.from.isNull() ) )
|
||||
{
|
||||
// Run the transformer, and update the revision in every case
|
||||
( this->*( transformer.transformFunc ) )();
|
||||
( *( transformer.transformFunc ) )( this );
|
||||
mCurrentVersion = transformer.to;
|
||||
returnValue = true;
|
||||
}
|
||||
@ -99,7 +125,7 @@ void QgsProjectFileTransform::dump()
|
||||
.arg( mCurrentVersion.minorVersion() )
|
||||
.arg( mCurrentVersion.subVersion() ) );
|
||||
#ifdef QGISDEBUG
|
||||
// Using QgsDebugMsg() didn't print the entire mDom...
|
||||
// Using QgsDebugMsg() didn't print the entire pft->dom()...
|
||||
std::cout << mDom.toString( 2 ).toLatin1().constData(); // OK
|
||||
#endif
|
||||
}
|
||||
@ -108,23 +134,23 @@ void QgsProjectFileTransform::dump()
|
||||
* Transformers below!
|
||||
*/
|
||||
|
||||
void QgsProjectFileTransform::transform081to090()
|
||||
void transform081to090( QgsProjectFileTransform *pft )
|
||||
{
|
||||
QgsDebugMsg( QStringLiteral( "Entering..." ) );
|
||||
if ( ! mDom.isNull() )
|
||||
if ( ! pft->dom().isNull() )
|
||||
{
|
||||
// Start with inserting a mapcanvas element and populate it
|
||||
|
||||
QDomElement mapCanvas; // A null element.
|
||||
|
||||
// there should only be one <qgis>
|
||||
QDomNode qgis = mDom.firstChildElement( QStringLiteral( "qgis" ) );
|
||||
QDomNode qgis = pft->dom().firstChildElement( QStringLiteral( "qgis" ) );
|
||||
if ( ! qgis.isNull() )
|
||||
{
|
||||
QgsDebugMsg( QStringLiteral( "Populating new mapcanvas" ) );
|
||||
|
||||
// Create a mapcanvas
|
||||
mapCanvas = mDom.createElement( QStringLiteral( "mapcanvas" ) );
|
||||
mapCanvas = pft->dom().createElement( QStringLiteral( "mapcanvas" ) );
|
||||
// Append mapcanvas to parent 'qgis'.
|
||||
qgis.appendChild( mapCanvas );
|
||||
// Re-parent units
|
||||
@ -139,10 +165,10 @@ void QgsProjectFileTransform::transform081to090()
|
||||
QDomElement hasCrsTransformEnabled = spatial.firstChildElement( QStringLiteral( "ProjectionsEnabled" ) );
|
||||
// Type is 'int', and '1' if on.
|
||||
// Create an element
|
||||
QDomElement projection = mDom.createElement( QStringLiteral( "projections" ) );
|
||||
QDomElement projection = pft->dom().createElement( QStringLiteral( "projections" ) );
|
||||
QgsDebugMsg( QStringLiteral( "Projection flag: " ) + hasCrsTransformEnabled.text() );
|
||||
// Set flag from ProjectionsEnabled
|
||||
projection.appendChild( mDom.createTextNode( hasCrsTransformEnabled.text() ) );
|
||||
projection.appendChild( pft->dom().createTextNode( hasCrsTransformEnabled.text() ) );
|
||||
// Set new element as child of <mapcanvas>
|
||||
mapCanvas.appendChild( projection );
|
||||
|
||||
@ -151,7 +177,7 @@ void QgsProjectFileTransform::transform081to090()
|
||||
|
||||
// Transforming coordinate-transforms
|
||||
// Create a list of all map layers
|
||||
QDomNodeList mapLayers = mDom.elementsByTagName( QStringLiteral( "maplayer" ) );
|
||||
QDomNodeList mapLayers = pft->dom().elementsByTagName( QStringLiteral( "maplayer" ) );
|
||||
bool doneDestination = false;
|
||||
for ( int i = 0; i < mapLayers.count(); i++ )
|
||||
{
|
||||
@ -183,7 +209,7 @@ void QgsProjectFileTransform::transform081to090()
|
||||
}
|
||||
|
||||
// Set the flag 'visible' to match the status of 'checked'
|
||||
QDomNodeList legendLayerFiles = mDom.elementsByTagName( QStringLiteral( "legendlayerfile" ) );
|
||||
QDomNodeList legendLayerFiles = pft->dom().elementsByTagName( QStringLiteral( "legendlayerfile" ) );
|
||||
QgsDebugMsg( QStringLiteral( "Legend layer file entries: " ) + QString::number( legendLayerFiles.count() ) );
|
||||
for ( int i = 0; i < mapLayers.count(); i++ )
|
||||
{
|
||||
@ -212,12 +238,12 @@ void QgsProjectFileTransform::transform081to090()
|
||||
}
|
||||
}
|
||||
|
||||
void QgsProjectFileTransform::transform091to0100()
|
||||
void transform091to0100( QgsProjectFileTransform *pft )
|
||||
{
|
||||
if ( ! mDom.isNull() )
|
||||
if ( ! pft->dom().isNull() )
|
||||
{
|
||||
// Insert transforms here!
|
||||
QDomNodeList rasterPropertyList = mDom.elementsByTagName( QStringLiteral( "rasterproperties" ) );
|
||||
QDomNodeList rasterPropertyList = pft->dom().elementsByTagName( QStringLiteral( "rasterproperties" ) );
|
||||
QgsDebugMsg( QStringLiteral( "Raster properties file entries: " ) + QString::number( rasterPropertyList.count() ) );
|
||||
for ( int i = 0; i < rasterPropertyList.count(); i++ )
|
||||
{
|
||||
@ -237,7 +263,7 @@ void QgsProjectFileTransform::transform091to0100()
|
||||
}
|
||||
|
||||
// Changing symbol size for hard: symbols
|
||||
QDomNodeList symbolPropertyList = mDom.elementsByTagName( QStringLiteral( "symbol" ) );
|
||||
QDomNodeList symbolPropertyList = pft->dom().elementsByTagName( QStringLiteral( "symbol" ) );
|
||||
for ( int i = 0; i < symbolPropertyList.count(); i++ )
|
||||
{
|
||||
// Get the <poinmtsymbol> to check for 'hard:' for each <symbol>
|
||||
@ -257,8 +283,8 @@ void QgsProjectFileTransform::transform091to0100()
|
||||
// where '2r' is the old size.
|
||||
pointSize = pointSize + 2 + 2 * lineWidth;
|
||||
QgsDebugMsg( QStringLiteral( "Setting point size to %1" ).arg( pointSize ) );
|
||||
QDomElement newPointSizeProperty = mDom.createElement( QStringLiteral( "pointsize" ) );
|
||||
QDomText newPointSizeTxt = mDom.createTextNode( QString::number( pointSize ) );
|
||||
QDomElement newPointSizeProperty = pft->dom().createElement( QStringLiteral( "pointsize" ) );
|
||||
QDomText newPointSizeTxt = pft->dom().createTextNode( QString::number( pointSize ) );
|
||||
newPointSizeProperty.appendChild( newPointSizeTxt );
|
||||
symbolProperty.replaceChild( newPointSizeProperty, pointSymbol );
|
||||
}
|
||||
@ -268,9 +294,9 @@ void QgsProjectFileTransform::transform091to0100()
|
||||
}
|
||||
}
|
||||
|
||||
void QgsProjectFileTransform::transform0100to0110()
|
||||
void transform0100to0110( QgsProjectFileTransform *pft )
|
||||
{
|
||||
if ( ! mDom.isNull() )
|
||||
if ( ! pft->dom().isNull() )
|
||||
{
|
||||
#ifndef QT_NO_PRINTER
|
||||
//Change 'outlinewidth' in QgsSymbol
|
||||
@ -278,7 +304,7 @@ void QgsProjectFileTransform::transform0100to0110()
|
||||
int screenDpi = myPrinter.resolution();
|
||||
double widthScaleFactor = 25.4 / screenDpi;
|
||||
|
||||
QDomNodeList outlineWidthList = mDom.elementsByTagName( QStringLiteral( "outlinewidth" ) );
|
||||
QDomNodeList outlineWidthList = pft->dom().elementsByTagName( QStringLiteral( "outlinewidth" ) );
|
||||
for ( int i = 0; i < outlineWidthList.size(); ++i )
|
||||
{
|
||||
//calculate new width
|
||||
@ -288,13 +314,13 @@ void QgsProjectFileTransform::transform0100to0110()
|
||||
|
||||
//replace old text node
|
||||
QDomNode outlineTextNode = currentOutlineElem.firstChild();
|
||||
QDomText newOutlineText = mDom.createTextNode( QString::number( outlineWidth ) );
|
||||
QDomText newOutlineText = pft->dom().createTextNode( QString::number( outlineWidth ) );
|
||||
currentOutlineElem.replaceChild( newOutlineText, outlineTextNode );
|
||||
|
||||
}
|
||||
|
||||
//Change 'pointsize' in QgsSymbol
|
||||
QDomNodeList pointSizeList = mDom.elementsByTagName( QStringLiteral( "pointsize" ) );
|
||||
QDomNodeList pointSizeList = pft->dom().elementsByTagName( QStringLiteral( "pointsize" ) );
|
||||
for ( int i = 0; i < pointSizeList.size(); ++i )
|
||||
{
|
||||
//calculate new size
|
||||
@ -304,18 +330,18 @@ void QgsProjectFileTransform::transform0100to0110()
|
||||
|
||||
//replace old text node
|
||||
QDomNode pointSizeTextNode = currentPointSizeElem.firstChild();
|
||||
QDomText newPointSizeText = mDom.createTextNode( QString::number( static_cast< int >( pointSize ) ) );
|
||||
QDomText newPointSizeText = pft->dom().createTextNode( QString::number( static_cast< int >( pointSize ) ) );
|
||||
currentPointSizeElem.replaceChild( newPointSizeText, pointSizeTextNode );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void QgsProjectFileTransform::transform0110to1000()
|
||||
void transform0110to1000( QgsProjectFileTransform *pft )
|
||||
{
|
||||
if ( ! mDom.isNull() )
|
||||
if ( ! pft->dom().isNull() )
|
||||
{
|
||||
QDomNodeList layerList = mDom.elementsByTagName( QStringLiteral( "maplayer" ) );
|
||||
QDomNodeList layerList = pft->dom().elementsByTagName( QStringLiteral( "maplayer" ) );
|
||||
for ( int i = 0; i < layerList.size(); ++i )
|
||||
{
|
||||
QDomElement layerElem = layerList.at( i ).toElement();
|
||||
@ -366,7 +392,7 @@ void QgsProjectFileTransform::transform0110to1000()
|
||||
int fieldNumber = classificationFieldElem.text().toInt();
|
||||
if ( fieldNumber >= 0 && fieldNumber < fields.count() )
|
||||
{
|
||||
QDomText fieldName = mDom.createTextNode( fields.at( fieldNumber ).name() );
|
||||
QDomText fieldName = pft->dom().createTextNode( fields.at( fieldNumber ).name() );
|
||||
QDomNode nameNode = classificationFieldElem.firstChild();
|
||||
classificationFieldElem.replaceChild( fieldName, nameNode );
|
||||
}
|
||||
@ -376,13 +402,13 @@ void QgsProjectFileTransform::transform0110to1000()
|
||||
}
|
||||
}
|
||||
|
||||
void QgsProjectFileTransform::transform1100to1200()
|
||||
void transform1100to1200( QgsProjectFileTransform *pft )
|
||||
{
|
||||
QgsDebugMsg( QStringLiteral( "Entering..." ) );
|
||||
if ( mDom.isNull() )
|
||||
if ( pft->dom().isNull() )
|
||||
return;
|
||||
|
||||
QDomNode qgis = mDom.firstChildElement( QStringLiteral( "qgis" ) );
|
||||
QDomNode qgis = pft->dom().firstChildElement( QStringLiteral( "qgis" ) );
|
||||
if ( qgis.isNull() )
|
||||
return;
|
||||
|
||||
@ -407,18 +433,18 @@ void QgsProjectFileTransform::transform1100to1200()
|
||||
units << QStringLiteral( "0" );
|
||||
|
||||
QgsProjectPropertyValue value( units );
|
||||
value.writeXml( QStringLiteral( "LayerSnappingToleranceUnitList" ), digitizing, mDom );
|
||||
value.writeXml( QStringLiteral( "LayerSnappingToleranceUnitList" ), digitizing, pft->dom() );
|
||||
}
|
||||
|
||||
void QgsProjectFileTransform::transform1400to1500()
|
||||
void transform1400to1500( QgsProjectFileTransform *pft )
|
||||
{
|
||||
//Adapt the XML description of the composer legend model to version 1.5
|
||||
if ( mDom.isNull() )
|
||||
if ( pft->dom().isNull() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
//Add layer id to <VectorClassificationItem>
|
||||
QDomNodeList layerItemList = mDom.elementsByTagName( QStringLiteral( "LayerItem" ) );
|
||||
QDomNodeList layerItemList = pft->dom().elementsByTagName( QStringLiteral( "LayerItem" ) );
|
||||
QDomElement currentLayerItemElem;
|
||||
QString currentLayerId;
|
||||
|
||||
@ -457,11 +483,11 @@ void QgsProjectFileTransform::transform1400to1500()
|
||||
QDomElement classificationElement;
|
||||
if ( !vectorClassificationList.isEmpty() ) //we guess it is a vector layer
|
||||
{
|
||||
classificationElement = mDom.createElement( QStringLiteral( "VectorClassificationItem" ) );
|
||||
classificationElement = pft->dom().createElement( QStringLiteral( "VectorClassificationItem" ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
classificationElement = mDom.createElement( QStringLiteral( "RasterClassificationItem" ) );
|
||||
classificationElement = pft->dom().createElement( QStringLiteral( "RasterClassificationItem" ) );
|
||||
}
|
||||
|
||||
classificationElement.setAttribute( QStringLiteral( "layerId" ), currentLayerId );
|
||||
@ -471,9 +497,9 @@ void QgsProjectFileTransform::transform1400to1500()
|
||||
}
|
||||
}
|
||||
|
||||
void QgsProjectFileTransform::transform1800to1900()
|
||||
void transform1800to1900( QgsProjectFileTransform *pft )
|
||||
{
|
||||
if ( mDom.isNull() )
|
||||
if ( pft->dom().isNull() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -481,7 +507,7 @@ void QgsProjectFileTransform::transform1800to1900()
|
||||
QgsReadWriteContext context;
|
||||
context.setPathResolver( QgsProject::instance()->pathResolver() );
|
||||
|
||||
QDomNodeList layerItemList = mDom.elementsByTagName( QStringLiteral( "rasterproperties" ) );
|
||||
QDomNodeList layerItemList = pft->dom().elementsByTagName( QStringLiteral( "rasterproperties" ) );
|
||||
for ( int i = 0; i < layerItemList.size(); ++i )
|
||||
{
|
||||
QDomElement rasterPropertiesElem = layerItemList.at( i ).toElement();
|
||||
@ -492,12 +518,12 @@ void QgsProjectFileTransform::transform1800to1900()
|
||||
// TODO: We have to use more data from project file to read the layer it correctly,
|
||||
// OTOH, we should not read it until it was converted
|
||||
rasterLayer.readLayerXml( layerNode.toElement(), context );
|
||||
convertRasterProperties( mDom, layerNode, rasterPropertiesElem, &rasterLayer );
|
||||
pft->convertRasterProperties( pft->dom(), layerNode, rasterPropertiesElem, &rasterLayer );
|
||||
}
|
||||
|
||||
//composer: replace mGridAnnotationPosition with mLeftGridAnnotationPosition & co.
|
||||
// and mGridAnnotationDirection with mLeftGridAnnotationDirection & co.
|
||||
QDomNodeList composerMapList = mDom.elementsByTagName( QStringLiteral( "ComposerMap" ) );
|
||||
QDomNodeList composerMapList = pft->dom().elementsByTagName( QStringLiteral( "ComposerMap" ) );
|
||||
for ( int i = 0; i < composerMapList.size(); ++i )
|
||||
{
|
||||
QDomNodeList gridList = composerMapList.at( i ).toElement().elementsByTagName( QStringLiteral( "Grid" ) );
|
||||
@ -551,7 +577,7 @@ void QgsProjectFileTransform::transform1800to1900()
|
||||
}
|
||||
|
||||
//Composer: move all items under Composition element
|
||||
QDomNodeList composerList = mDom.elementsByTagName( QStringLiteral( "Composer" ) );
|
||||
QDomNodeList composerList = pft->dom().elementsByTagName( QStringLiteral( "Composer" ) );
|
||||
for ( int i = 0; i < composerList.size(); ++i )
|
||||
{
|
||||
QDomElement composerElem = composerList.at( i ).toElement();
|
||||
@ -587,7 +613,7 @@ void QgsProjectFileTransform::transform1800to1900()
|
||||
// SimpleFill symbol layer v2: avoid double transparency
|
||||
// replacing alpha value of symbol layer's color with 255 (the
|
||||
// transparency value is already stored as symbol transparency).
|
||||
QDomNodeList rendererList = mDom.elementsByTagName( QStringLiteral( "renderer-v2" ) );
|
||||
QDomNodeList rendererList = pft->dom().elementsByTagName( QStringLiteral( "renderer-v2" ) );
|
||||
for ( int i = 0; i < rendererList.size(); ++i )
|
||||
{
|
||||
QDomNodeList layerList = rendererList.at( i ).toElement().elementsByTagName( QStringLiteral( "layer" ) );
|
||||
@ -609,13 +635,13 @@ void QgsProjectFileTransform::transform1800to1900()
|
||||
}
|
||||
}
|
||||
|
||||
QgsDebugMsg( mDom.toString() );
|
||||
QgsDebugMsg( pft->dom().toString() );
|
||||
}
|
||||
|
||||
void QgsProjectFileTransform::transform2200to2300()
|
||||
void transform2200to2300( QgsProjectFileTransform *pft )
|
||||
{
|
||||
//composer: set placement for all picture items to middle, to mimic <=2.2 behavior
|
||||
QDomNodeList composerPictureList = mDom.elementsByTagName( QStringLiteral( "ComposerPicture" ) );
|
||||
QDomNodeList composerPictureList = pft->dom().elementsByTagName( QStringLiteral( "ComposerPicture" ) );
|
||||
for ( int i = 0; i < composerPictureList.size(); ++i )
|
||||
{
|
||||
QDomElement picture = composerPictureList.at( i ).toElement();
|
||||
@ -623,10 +649,10 @@ void QgsProjectFileTransform::transform2200to2300()
|
||||
}
|
||||
}
|
||||
|
||||
void QgsProjectFileTransform::transform3000()
|
||||
void transform3000( QgsProjectFileTransform *pft )
|
||||
{
|
||||
// transform OTF off to "no projection" for project
|
||||
QDomElement propsElem = mDom.firstChildElement( QStringLiteral( "qgis" ) ).toElement().firstChildElement( QStringLiteral( "properties" ) );
|
||||
QDomElement propsElem = pft->dom().firstChildElement( QStringLiteral( "qgis" ) ).toElement().firstChildElement( QStringLiteral( "properties" ) );
|
||||
if ( !propsElem.isNull() )
|
||||
{
|
||||
QDomNodeList srsNodes = propsElem.elementsByTagName( QStringLiteral( "SpatialRefSys" ) );
|
||||
@ -638,19 +664,19 @@ void QgsProjectFileTransform::transform3000()
|
||||
QDomNodeList projNodes = srsElem.elementsByTagName( QStringLiteral( "ProjectionsEnabled" ) );
|
||||
if ( projNodes.count() == 0 )
|
||||
{
|
||||
projElem = mDom.createElement( QStringLiteral( "ProjectionsEnabled" ) );
|
||||
projElem = pft->dom().createElement( QStringLiteral( "ProjectionsEnabled" ) );
|
||||
projElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "int" ) );
|
||||
QDomText projText = mDom.createTextNode( QStringLiteral( "0" ) );
|
||||
QDomText projText = pft->dom().createTextNode( QStringLiteral( "0" ) );
|
||||
projElem.appendChild( projText );
|
||||
srsElem.appendChild( projElem );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
srsElem = mDom.createElement( QStringLiteral( "SpatialRefSys" ) );
|
||||
projElem = mDom.createElement( QStringLiteral( "ProjectionsEnabled" ) );
|
||||
srsElem = pft->dom().createElement( QStringLiteral( "SpatialRefSys" ) );
|
||||
projElem = pft->dom().createElement( QStringLiteral( "ProjectionsEnabled" ) );
|
||||
projElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "int" ) );
|
||||
QDomText projText = mDom.createTextNode( QStringLiteral( "0" ) );
|
||||
QDomText projText = pft->dom().createTextNode( QStringLiteral( "0" ) );
|
||||
projElem.appendChild( projText );
|
||||
srsElem.appendChild( projElem );
|
||||
propsElem.appendChild( srsElem );
|
||||
@ -659,7 +685,7 @@ void QgsProjectFileTransform::transform3000()
|
||||
// transform map canvas CRS to project CRS - this is because project CRS was inconsistently used
|
||||
// prior to 3.0. In >= 3.0 main canvas CRS is forced to match project CRS, so we need to make
|
||||
// sure we can read the project CRS correctly
|
||||
QDomNodeList canvasNodes = mDom.elementsByTagName( QStringLiteral( "mapcanvas" ) );
|
||||
QDomNodeList canvasNodes = pft->dom().elementsByTagName( QStringLiteral( "mapcanvas" ) );
|
||||
if ( canvasNodes.count() > 0 )
|
||||
{
|
||||
QDomElement canvasElem = canvasNodes.at( 0 ).toElement();
|
||||
@ -712,21 +738,21 @@ void QgsProjectFileTransform::transform3000()
|
||||
srsElem.removeChild( projectionsEnabledNodes.at( i ) );
|
||||
}
|
||||
|
||||
QDomElement proj4Elem = mDom.createElement( QStringLiteral( "ProjectCRSProj4String" ) );
|
||||
QDomElement proj4Elem = pft->dom().createElement( QStringLiteral( "ProjectCRSProj4String" ) );
|
||||
proj4Elem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "QString" ) );
|
||||
QDomText proj4Text = mDom.createTextNode( proj );
|
||||
QDomText proj4Text = pft->dom().createTextNode( proj );
|
||||
proj4Elem.appendChild( proj4Text );
|
||||
QDomElement projectCrsElem = mDom.createElement( QStringLiteral( "ProjectCrs" ) );
|
||||
QDomElement projectCrsElem = pft->dom().createElement( QStringLiteral( "ProjectCrs" ) );
|
||||
projectCrsElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "QString" ) );
|
||||
QDomText projectCrsText = mDom.createTextNode( authid );
|
||||
QDomText projectCrsText = pft->dom().createTextNode( authid );
|
||||
projectCrsElem.appendChild( projectCrsText );
|
||||
QDomElement projectCrsIdElem = mDom.createElement( QStringLiteral( "ProjectCRSID" ) );
|
||||
QDomElement projectCrsIdElem = pft->dom().createElement( QStringLiteral( "ProjectCRSID" ) );
|
||||
projectCrsIdElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "int" ) );
|
||||
QDomText srsidText = mDom.createTextNode( srsid );
|
||||
QDomText srsidText = pft->dom().createTextNode( srsid );
|
||||
projectCrsIdElem.appendChild( srsidText );
|
||||
QDomElement projectionsEnabledElem = mDom.createElement( QStringLiteral( "ProjectionsEnabled" ) );
|
||||
QDomElement projectionsEnabledElem = pft->dom().createElement( QStringLiteral( "ProjectionsEnabled" ) );
|
||||
projectionsEnabledElem.setAttribute( QStringLiteral( "type" ), QStringLiteral( "int" ) );
|
||||
QDomText projectionsEnabledText = mDom.createTextNode( QStringLiteral( "1" ) );
|
||||
QDomText projectionsEnabledText = pft->dom().createTextNode( QStringLiteral( "1" ) );
|
||||
projectionsEnabledElem.appendChild( projectionsEnabledText );
|
||||
srsElem.appendChild( proj4Elem );
|
||||
srsElem.appendChild( projectCrsElem );
|
||||
@ -744,18 +770,18 @@ void QgsProjectFileTransform::transform3000()
|
||||
}
|
||||
|
||||
|
||||
QDomNodeList mapLayers = mDom.elementsByTagName( QStringLiteral( "maplayer" ) );
|
||||
QDomNodeList mapLayers = pft->dom().elementsByTagName( QStringLiteral( "maplayer" ) );
|
||||
|
||||
for ( int mapLayerIndex = 0; mapLayerIndex < mapLayers.count(); ++mapLayerIndex )
|
||||
{
|
||||
QDomElement layerElem = mapLayers.at( mapLayerIndex ).toElement();
|
||||
|
||||
// The newly added fieldConfiguration element
|
||||
QDomElement fieldConfigurationElement = mDom.createElement( QStringLiteral( "fieldConfiguration" ) );
|
||||
QDomElement fieldConfigurationElement = pft->dom().createElement( QStringLiteral( "fieldConfiguration" ) );
|
||||
layerElem.appendChild( fieldConfigurationElement );
|
||||
|
||||
QDomNodeList editTypeNodes = layerElem.namedItem( QStringLiteral( "edittypes" ) ).childNodes();
|
||||
QDomElement constraintExpressionsElem = mDom.createElement( QStringLiteral( "constraintExpressions" ) );
|
||||
QDomElement constraintExpressionsElem = pft->dom().createElement( QStringLiteral( "constraintExpressions" ) );
|
||||
layerElem.appendChild( constraintExpressionsElem );
|
||||
|
||||
for ( int i = 0; i < editTypeNodes.size(); ++i )
|
||||
@ -763,16 +789,16 @@ void QgsProjectFileTransform::transform3000()
|
||||
QDomNode editTypeNode = editTypeNodes.at( i );
|
||||
QDomElement editTypeElement = editTypeNode.toElement();
|
||||
|
||||
QDomElement fieldElement = mDom.createElement( QStringLiteral( "field" ) );
|
||||
QDomElement fieldElement = pft->dom().createElement( QStringLiteral( "field" ) );
|
||||
fieldConfigurationElement.appendChild( fieldElement );
|
||||
|
||||
QString name = editTypeElement.attribute( QStringLiteral( "name" ) );
|
||||
fieldElement.setAttribute( QStringLiteral( "name" ), name );
|
||||
QDomElement constraintExpressionElem = mDom.createElement( QStringLiteral( "constraint" ) );
|
||||
QDomElement constraintExpressionElem = pft->dom().createElement( QStringLiteral( "constraint" ) );
|
||||
constraintExpressionElem.setAttribute( QStringLiteral( "field" ), name );
|
||||
constraintExpressionsElem.appendChild( constraintExpressionElem );
|
||||
|
||||
QDomElement editWidgetElement = mDom.createElement( QStringLiteral( "editWidget" ) );
|
||||
QDomElement editWidgetElement = pft->dom().createElement( QStringLiteral( "editWidget" ) );
|
||||
fieldElement.appendChild( editWidgetElement );
|
||||
|
||||
QString ewv2Type = editTypeElement.attribute( QStringLiteral( "widgetv2type" ) );
|
||||
@ -782,7 +808,7 @@ void QgsProjectFileTransform::transform3000()
|
||||
|
||||
if ( !ewv2CfgElem.isNull() )
|
||||
{
|
||||
QDomElement editWidgetConfigElement = mDom.createElement( QStringLiteral( "config" ) );
|
||||
QDomElement editWidgetConfigElement = pft->dom().createElement( QStringLiteral( "config" ) );
|
||||
editWidgetElement.appendChild( editWidgetConfigElement );
|
||||
|
||||
QVariantMap editWidgetConfiguration;
|
||||
@ -852,7 +878,7 @@ void QgsProjectFileTransform::transform3000()
|
||||
editWidgetConfiguration.insert( QStringLiteral( "RelativeStorage" ), 1 );
|
||||
}
|
||||
|
||||
editWidgetConfigElement.appendChild( QgsXmlUtils::writeVariant( editWidgetConfiguration, mDom ) );
|
||||
editWidgetConfigElement.appendChild( QgsXmlUtils::writeVariant( editWidgetConfiguration, pft->dom() ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1073,8 +1099,17 @@ void QgsProjectFileTransform::convertRasterProperties( QDomDocument &doc, QDomNo
|
||||
}
|
||||
}
|
||||
|
||||
int QgsProjectFileTransform::rasterBandNumber( const QDomElement &rasterPropertiesElem, const QString &bandName,
|
||||
QgsRasterLayer *rlayer )
|
||||
QDomDocument &QgsProjectFileTransform::dom()
|
||||
{
|
||||
return mDom;
|
||||
}
|
||||
|
||||
QgsProjectVersion QgsProjectFileTransform::currentVersion() const
|
||||
{
|
||||
return mCurrentVersion;
|
||||
}
|
||||
|
||||
int rasterBandNumber( const QDomElement &rasterPropertiesElem, const QString &bandName, QgsRasterLayer *rlayer )
|
||||
{
|
||||
if ( !rlayer )
|
||||
{
|
||||
@ -1095,7 +1130,7 @@ int QgsProjectFileTransform::rasterBandNumber( const QDomElement &rasterProperti
|
||||
return band;
|
||||
}
|
||||
|
||||
void QgsProjectFileTransform::transformContrastEnhancement( QDomDocument &doc, const QDomElement &rasterproperties, QDomElement &rendererElem )
|
||||
void transformContrastEnhancement( QDomDocument &doc, const QDomElement &rasterproperties, QDomElement &rendererElem )
|
||||
{
|
||||
if ( rasterproperties.isNull() || rendererElem.isNull() )
|
||||
{
|
||||
@ -1187,12 +1222,3 @@ void QgsProjectFileTransform::transformContrastEnhancement( QDomDocument &doc, c
|
||||
rendererElem.appendChild( newContrastEnhancementElem );
|
||||
}
|
||||
}
|
||||
|
||||
void QgsProjectFileTransform::transformRasterTransparency( QDomDocument &doc, const QDomElement &orig, QDomElement &rendererElem )
|
||||
{
|
||||
//soon...
|
||||
Q_UNUSED( doc )
|
||||
Q_UNUSED( orig )
|
||||
Q_UNUSED( rendererElem )
|
||||
}
|
||||
|
||||
|
@ -66,38 +66,14 @@ class CORE_EXPORT QgsProjectFileTransform
|
||||
|
||||
static void convertRasterProperties( QDomDocument &doc, QDomNode &parentNode, QDomElement &rasterPropertiesElem, QgsRasterLayer *rlayer );
|
||||
|
||||
QDomDocument &dom();
|
||||
|
||||
QgsProjectVersion currentVersion() const;
|
||||
|
||||
private:
|
||||
|
||||
typedef struct
|
||||
{
|
||||
QgsProjectVersion from;
|
||||
QgsProjectVersion to;
|
||||
void ( QgsProjectFileTransform::* transformFunc )();
|
||||
} TransformItem;
|
||||
|
||||
static TransformItem sTransformers[];
|
||||
|
||||
QDomDocument mDom;
|
||||
QgsProjectVersion mCurrentVersion;
|
||||
|
||||
// Transformer functions below. Declare functions here,
|
||||
// define them in qgsprojectfiletransform.cpp and add them
|
||||
// to the transformArray with proper version number
|
||||
void transformNull() {} // Do absolutely nothing
|
||||
void transform081to090();
|
||||
void transform091to0100();
|
||||
void transform0100to0110();
|
||||
void transform0110to1000();
|
||||
void transform1100to1200();
|
||||
void transform1400to1500();
|
||||
void transform1800to1900();
|
||||
void transform2200to2300();
|
||||
void transform3000();
|
||||
|
||||
//helper functions
|
||||
static int rasterBandNumber( const QDomElement &rasterPropertiesElem, const QString &bandName, QgsRasterLayer *rlayer );
|
||||
static void transformContrastEnhancement( QDomDocument &doc, const QDomElement &rasterproperties, QDomElement &rendererElem );
|
||||
static void transformRasterTransparency( QDomDocument &doc, const QDomElement &orig, QDomElement &rendererElem );
|
||||
};
|
||||
|
||||
|
||||
|
@ -823,7 +823,7 @@ void QgsRasterLayer::setDataSource( const QString &dataSource, const QString &ba
|
||||
|
||||
QDomDocument doc = QDomDocument( documentType );
|
||||
QDomElement styleElem = doc.createElement( QStringLiteral( "qgis" ) );
|
||||
styleElem.setAttribute( QStringLiteral( "version" ), Qgis::QGIS_VERSION );
|
||||
styleElem.setAttribute( QStringLiteral( "version" ), Qgis::version() );
|
||||
QgsReadWriteContext writeContext;
|
||||
if ( ! writeSymbology( styleElem, doc, errorMsg, writeContext ) )
|
||||
{
|
||||
|
@ -167,11 +167,6 @@ class GUI_EXPORT QgsSpinBox : public QSpinBox
|
||||
|
||||
bool mExpressionsEnabled = true;
|
||||
|
||||
// This is required because private implementation of
|
||||
// QAbstractSpinBoxPrivate checks for specialText emptiness
|
||||
// and skips specialText handling if it's empty
|
||||
static QString SPECIAL_TEXT_WHEN_EMPTY;
|
||||
|
||||
QString stripped( const QString &originalText ) const;
|
||||
|
||||
friend class TestQgsRangeWidgetWrapper;
|
||||
|
@ -560,7 +560,7 @@ QMap< QString, QString > QgsMapToolIdentify::featureDerivedAttributes( const Qgs
|
||||
double dist = calc.measureLength( feature.geometry() );
|
||||
dist = calc.convertLengthMeasurement( dist, displayDistanceUnits() );
|
||||
QString str;
|
||||
if ( ellipsoid != GEO_NONE )
|
||||
if ( ellipsoid != geoNone() )
|
||||
{
|
||||
str = formatDistance( dist );
|
||||
derivedAttributes.insert( tr( "Length (Ellipsoidal — %1)" ).arg( ellipsoid ), str );
|
||||
@ -608,7 +608,7 @@ QMap< QString, QString > QgsMapToolIdentify::featureDerivedAttributes( const Qgs
|
||||
double area = calc.measureArea( feature.geometry() );
|
||||
area = calc.convertAreaMeasurement( area, displayAreaUnits() );
|
||||
QString str;
|
||||
if ( ellipsoid != GEO_NONE )
|
||||
if ( ellipsoid != geoNone() )
|
||||
{
|
||||
str = formatArea( area );
|
||||
derivedAttributes.insert( tr( "Area (Ellipsoidal — %1)" ).arg( ellipsoid ), str );
|
||||
@ -617,7 +617,7 @@ QMap< QString, QString > QgsMapToolIdentify::featureDerivedAttributes( const Qgs
|
||||
* QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::distanceToAreaUnit( layer->crs().mapUnits() ), cartesianAreaUnits ), cartesianAreaUnits );
|
||||
derivedAttributes.insert( tr( "Area (Cartesian)" ), str );
|
||||
|
||||
if ( ellipsoid != GEO_NONE )
|
||||
if ( ellipsoid != geoNone() )
|
||||
{
|
||||
double perimeter = calc.measurePerimeter( feature.geometry() );
|
||||
perimeter = calc.convertLengthMeasurement( perimeter, displayDistanceUnits() );
|
||||
|
@ -444,7 +444,7 @@ void QgsOWSSourceSelect::populateCrs()
|
||||
defaultCRS = *it;
|
||||
|
||||
// prefer value of DEFAULT_GEO_EPSG_CRS_ID if available
|
||||
if ( *it == GEO_EPSG_CRS_AUTHID )
|
||||
if ( *it == geoEpsgCrsAuthId() )
|
||||
defaultCRS = *it;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ QgsProjectionSelectionWidget::QgsProjectionSelectionWidget( QWidget *parent )
|
||||
addProjectCrsOption();
|
||||
|
||||
QgsSettings settings;
|
||||
mDefaultCrs = QgsCoordinateReferenceSystem( settings.value( QStringLiteral( "/projections/defaultProjectCrs" ), GEO_EPSG_CRS_AUTHID, QgsSettings::App ).toString() );
|
||||
mDefaultCrs = QgsCoordinateReferenceSystem( settings.value( QStringLiteral( "/projections/defaultProjectCrs" ), geoEpsgCrsAuthId(), QgsSettings::App ).toString() );
|
||||
if ( mDefaultCrs.authid() != mProjectCrs.authid() )
|
||||
{
|
||||
//only show default CRS option if it's different to the project CRS, avoids
|
||||
|
@ -636,7 +636,7 @@ QgsRectangle GlobePlugin::getQGISLayerExtent() const
|
||||
void GlobePlugin::showCurrentCoordinates( const osgEarth::GeoPoint &geoPoint )
|
||||
{
|
||||
osg::Vec3d pos = geoPoint.vec3d();
|
||||
emit xyCoordinates( QgsCoordinateTransform( QgsCoordinateReferenceSystem( GEO_EPSG_CRS_AUTHID ), mQGisIface->mapCanvas()->mapSettings().destinationCrs(), QgsProject::instance()->transformContext() ).transform( QgsPointXY( pos.x(), pos.y() ) ) );
|
||||
emit xyCoordinates( QgsCoordinateTransform( QgsCoordinateReferenceSystem( geoEpsgCrsAuthId() ), mQGisIface->mapCanvas()->mapSettings().destinationCrs(), QgsProject::instance()->transformContext() ).transform( QgsPointXY( pos.x(), pos.y() ) ) );
|
||||
}
|
||||
|
||||
void GlobePlugin::setSelectedCoordinates( const osg::Vec3d &coords )
|
||||
@ -957,7 +957,7 @@ void GlobePlugin::updateLayers()
|
||||
else
|
||||
{
|
||||
drapedLayers.append( mapLayer );
|
||||
QgsRectangle extent = QgsCoordinateTransform( mapLayer->crs(), QgsCoordinateReferenceSystem( GEO_EPSG_CRS_AUTHID ), QgsProject::instance()->transformContext() ).transform( mapLayer->extent() );
|
||||
QgsRectangle extent = QgsCoordinateTransform( mapLayer->crs(), QgsCoordinateReferenceSystem( geoEpsgCrsAuthId() ), QgsProject::instance()->transformContext() ).transform( mapLayer->extent() );
|
||||
mLayerExtents.insert( mapLayer->id(), extent );
|
||||
}
|
||||
}
|
||||
@ -1031,7 +1031,7 @@ void GlobePlugin::layerChanged( QgsMapLayer *mapLayer )
|
||||
}
|
||||
}
|
||||
mTileSource->setLayers( layers );
|
||||
QgsRectangle extent = QgsCoordinateTransform( mapLayer->crs(), QgsCoordinateReferenceSystem( GEO_EPSG_CRS_AUTHID ), QgsProject::instance()->transformContext() ).transform( mapLayer->extent() );
|
||||
QgsRectangle extent = QgsCoordinateTransform( mapLayer->crs(), QgsCoordinateReferenceSystem( geoEpsgCrsAuthId() ), QgsProject::instance()->transformContext() ).transform( mapLayer->extent() );
|
||||
mLayerExtents.insert( mapLayer->id(), extent );
|
||||
}
|
||||
// Remove any model layer of that layer, in case one existed
|
||||
@ -1040,7 +1040,7 @@ void GlobePlugin::layerChanged( QgsMapLayer *mapLayer )
|
||||
#else
|
||||
mMapNode->getMap()->removeModelLayer( mMapNode->getMap()->getModelLayerByName( mapLayer->id().toStdString() ) );
|
||||
#endif
|
||||
QgsRectangle layerExtent = QgsCoordinateTransform( mapLayer->crs(), QgsCoordinateReferenceSystem( GEO_EPSG_CRS_AUTHID ), QgsProject::instance()->transformContext() ).transform( mapLayer->extent() );
|
||||
QgsRectangle layerExtent = QgsCoordinateTransform( mapLayer->crs(), QgsCoordinateReferenceSystem( geoEpsgCrsAuthId() ), QgsProject::instance()->transformContext() ).transform( mapLayer->extent() );
|
||||
QgsRectangle dirtyExtent = layerExtent;
|
||||
if ( mLayerExtents.contains( mapLayer->id() ) )
|
||||
{
|
||||
|
@ -98,7 +98,7 @@ QgsMapSettings QgsGlobeTileImage::createSettings( int dpi, const QList<QgsMapLay
|
||||
{
|
||||
QgsMapSettings settings;
|
||||
settings.setBackgroundColor( QColor( Qt::transparent ) );
|
||||
settings.setDestinationCrs( QgsCoordinateReferenceSystem::fromOgcWmsCrs( GEO_EPSG_CRS_AUTHID ) );
|
||||
settings.setDestinationCrs( QgsCoordinateReferenceSystem::fromOgcWmsCrs( geoEpsgCrsAuthId() ) );
|
||||
settings.setExtent( mTileExtent );
|
||||
settings.setLayers( layers );
|
||||
settings.setFlag( QgsMapSettings::DrawEditingInfo, false );
|
||||
|
@ -193,9 +193,9 @@ QString QgsArcGisServiceSourceSelect::getPreferredCrs( const QSet<QString> &crsS
|
||||
}
|
||||
|
||||
//second: WGS84
|
||||
if ( crsSet.contains( GEO_EPSG_CRS_AUTHID ) )
|
||||
if ( crsSet.contains( geoEpsgCrsAuthId() ) )
|
||||
{
|
||||
return GEO_EPSG_CRS_AUTHID;
|
||||
return geoEpsgCrsAuthId();
|
||||
}
|
||||
|
||||
//third: first entry in set
|
||||
|
@ -195,9 +195,9 @@ QString QgsWFSSourceSelect::getPreferredCrs( const QSet<QString> &crsSet ) const
|
||||
}
|
||||
|
||||
//second: WGS84
|
||||
if ( crsSet.contains( GEO_EPSG_CRS_AUTHID ) )
|
||||
if ( crsSet.contains( geoEpsgCrsAuthId() ) )
|
||||
{
|
||||
return GEO_EPSG_CRS_AUTHID;
|
||||
return geoEpsgCrsAuthId();
|
||||
}
|
||||
|
||||
//third: first entry in set
|
||||
|
@ -56,7 +56,7 @@
|
||||
|
||||
QgsWMSSourceSelect::QgsWMSSourceSelect( QWidget *parent, Qt::WindowFlags fl, QgsProviderRegistry::WidgetMode theWidgetMode )
|
||||
: QgsAbstractDataSourceWidget( parent, fl, theWidgetMode )
|
||||
, mDefaultCRS( GEO_EPSG_CRS_AUTHID )
|
||||
, mDefaultCRS( geoEpsgCrsAuthId() )
|
||||
{
|
||||
setupUi( this );
|
||||
QgsGui::enableAutoGeometryRestore( this );
|
||||
|
@ -334,7 +334,7 @@ bool QgsPythonUtilsImpl::runString( const QString &command, QString msgOnError,
|
||||
|
||||
QString str = "<font color=\"red\">" + msgOnError + "</font><br><pre>\n" + traceback + "\n</pre>"
|
||||
+ QObject::tr( "Python version:" ) + "<br>" + version + "<br><br>"
|
||||
+ QObject::tr( "QGIS version:" ) + "<br>" + QStringLiteral( "%1 '%2', %3" ).arg( Qgis::QGIS_VERSION, Qgis::QGIS_RELEASE_NAME, Qgis::QGIS_DEV_VERSION ) + "<br><br>"
|
||||
+ QObject::tr( "QGIS version:" ) + "<br>" + QStringLiteral( "%1 '%2', %3" ).arg( Qgis::version(), Qgis::releaseName(), Qgis::QGIS_DEV_VERSION ) + "<br><br>"
|
||||
+ QObject::tr( "Python path:" ) + "<br>" + path;
|
||||
str.replace( '\n', QLatin1String( "<br>" ) ).replace( QLatin1String( " " ), QLatin1String( " " ) );
|
||||
|
||||
|
@ -166,5 +166,5 @@ void QgsFcgiServerResponse::truncate()
|
||||
|
||||
void QgsFcgiServerResponse::setDefaultHeaders()
|
||||
{
|
||||
setHeader( QStringLiteral( "Server" ), QStringLiteral( " Qgis FCGI server - QGis version %1" ).arg( Qgis::QGIS_VERSION ) );
|
||||
setHeader( QStringLiteral( "Server" ), QStringLiteral( " Qgis FCGI server - QGis version %1" ).arg( Qgis::version() ) );
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ bool QgsServerPlugins::initPlugins( QgsServerInterface *interface )
|
||||
#ifdef __MINGW32__
|
||||
pythonlibName.prepend( "lib" );
|
||||
#endif
|
||||
QString version = QStringLiteral( "%1.%2.%3" ).arg( Qgis::QGIS_VERSION_INT / 10000 ).arg( Qgis::QGIS_VERSION_INT / 100 % 100 ).arg( Qgis::QGIS_VERSION_INT % 100 );
|
||||
QString version = QStringLiteral( "%1.%2.%3" ).arg( Qgis::versionInt() / 10000 ).arg( Qgis::versionInt() / 100 % 100 ).arg( Qgis::versionInt() % 100 );
|
||||
QgsMessageLog::logMessage( QStringLiteral( "load library %1 (%2)" ).arg( pythonlibName, version ), __FILE__, Qgis::Info );
|
||||
QLibrary pythonlib( pythonlibName, version );
|
||||
// It's necessary to set these two load hints, otherwise Python library won't work correctly
|
||||
|
@ -591,7 +591,7 @@ namespace QgsWfs
|
||||
//create WGS84BoundingBox
|
||||
QgsRectangle layerExtent = layer->extent();
|
||||
//transform the layers native CRS into WGS84
|
||||
QgsCoordinateReferenceSystem wgs84 = QgsCoordinateReferenceSystem::fromOgcWmsCrs( GEO_EPSG_CRS_AUTHID );
|
||||
QgsCoordinateReferenceSystem wgs84 = QgsCoordinateReferenceSystem::fromOgcWmsCrs( geoEpsgCrsAuthId() );
|
||||
QgsRectangle wgs84BoundingRect;
|
||||
if ( !layerExtent.isNull() )
|
||||
{
|
||||
|
@ -1431,7 +1431,7 @@ namespace QgsWms
|
||||
layerExtent.grow( 0.000001 );
|
||||
}
|
||||
|
||||
QgsCoordinateReferenceSystem wgs84 = QgsCoordinateReferenceSystem::fromOgcWmsCrs( GEO_EPSG_CRS_AUTHID );
|
||||
QgsCoordinateReferenceSystem wgs84 = QgsCoordinateReferenceSystem::fromOgcWmsCrs( geoEpsgCrsAuthId() );
|
||||
|
||||
QString version = doc.documentElement().attribute( QStringLiteral( "version" ) );
|
||||
|
||||
|
@ -336,7 +336,7 @@ namespace QgsWmts
|
||||
QList< layerDef > wmtsLayers, QList< tileMatrixSetDef > tmsList,
|
||||
const QgsProject *project )
|
||||
{
|
||||
QgsCoordinateReferenceSystem wgs84 = QgsCoordinateReferenceSystem::fromOgcWmsCrs( GEO_EPSG_CRS_AUTHID );
|
||||
QgsCoordinateReferenceSystem wgs84 = QgsCoordinateReferenceSystem::fromOgcWmsCrs( geoEpsgCrsAuthId() );
|
||||
// Define InfoFormat helper
|
||||
std::function < void ( QDomElement &, const QString & ) > appendInfoFormat = [&doc]( QDomElement & elem, const QString & format )
|
||||
{
|
||||
|
@ -32,7 +32,7 @@ namespace QgsWmts
|
||||
{
|
||||
QMap< QString, tileMatrixInfo> populateFixedTileMatrixInfoMap();
|
||||
|
||||
QgsCoordinateReferenceSystem wgs84 = QgsCoordinateReferenceSystem::fromOgcWmsCrs( GEO_EPSG_CRS_AUTHID );
|
||||
QgsCoordinateReferenceSystem wgs84 = QgsCoordinateReferenceSystem::fromOgcWmsCrs( geoEpsgCrsAuthId() );
|
||||
|
||||
// Constant
|
||||
int tileSize = 256;
|
||||
@ -290,7 +290,7 @@ namespace QgsWmts
|
||||
tmi.unit = crs.mapUnits();
|
||||
tmi.hasAxisInverted = crs.hasAxisInverted();
|
||||
|
||||
QgsCoordinateTransform crsTransform( QgsCoordinateReferenceSystem::fromOgcWmsCrs( GEO_EPSG_CRS_AUTHID ), crs, project );
|
||||
QgsCoordinateTransform crsTransform( QgsCoordinateReferenceSystem::fromOgcWmsCrs( geoEpsgCrsAuthId() ), crs, project );
|
||||
try
|
||||
{
|
||||
// firstly transform CRS bounds expressed in WGS84 to CRS
|
||||
|
Loading…
x
Reference in New Issue
Block a user