Skip to content
Permalink
Browse files

remove need for factory for system of measurement

  • Loading branch information
PeterPetrik committed Jun 28, 2018
1 parent 00cd4b3 commit 7bfcaf4db9486f82d1ff37b2d5ba7c1f96d642d9
@@ -1,4 +1,5 @@
# The following has been generated automatically from src/core/qgsunittypes.h
QgsUnitTypes.SystemOfMeasurement.baseClass = QgsUnitTypes
QgsUnitTypes.DistanceUnit.baseClass = QgsUnitTypes
QgsUnitTypes.AreaUnit.baseClass = QgsUnitTypes
QgsUnitTypes.AngleUnit.baseClass = QgsUnitTypes
@@ -47,6 +47,7 @@ class CORE_EXPORT QgsUnitTypes
ImperialSystem, //!< British Imperial
USCSSystem //!< United States customary system
};
Q_ENUM( SystemOfMeasurement )

//! Units of distance
enum DistanceUnit
@@ -66,6 +66,8 @@ void QgsQuickPlugin::registerTypes( const char *uri )
qRegisterMetaType< QgsCoordinateFormatter::FormatFlags >( "QgsCoordinateFormatter::FormatFlags" );
qRegisterMetaType< QgsCoordinateFormatter::Format >( "QgsCoordinateFormatter::Format" );

qmlRegisterUncreatableType< QgsUnitTypes >( uri, 0, 1, "QgsUnitTypes", "Only enums from QgsUnitTypes can be used" );

qmlRegisterType< QgsProject >( uri, 0, 1, "Project" );
qmlRegisterType< QgsQuickFeatureHighlight >( uri, 0, 1, "FeatureHighlight" );
qmlRegisterType< QgsQuickCoordinateTransformer >( uri, 0, 1, "CoordinateTransformer" );
@@ -101,20 +101,6 @@ const QUrl QgsQuickUtils::getThemeIcon( const QString &name ) const
return QUrl( path );
}

QgsUnitTypes::SystemOfMeasurement QgsQuickUtils::systemOfMeasurementFactory( const QString &type )
{
if ( type == QStringLiteral( "Metric" ) )
return QgsUnitTypes::MetricSystem;

if ( type == QStringLiteral( "Imperial" ) )
return QgsUnitTypes::ImperialSystem;

if ( type == QStringLiteral( "USCS" ) )
return QgsUnitTypes::USCSSystem;

return QgsUnitTypes::UnknownSystem;
}

QString QgsQuickUtils::formatPoint(
const QgsPoint &point,
QgsCoordinateFormatter::Format format,
@@ -136,18 +136,6 @@ class QUICK_EXPORT QgsQuickUtils: public QObject
*/
Q_INVOKABLE const QUrl getThemeIcon( const QString &name ) const;

/**
* QgsUnitTypes::SystemOfMeasurement factory
* for input type parameter:
* "Metric": QgsUnitTypes::MetricSystem
* "Imperial": QgsUnitTypes::ImperialSystem
* "USCS": QgsUnitTypes::USCSSystem
* else: QgsUnitTypes::UnknownSystem
*
* \since QGIS 3.4
*/
Q_INVOKABLE static QgsUnitTypes::SystemOfMeasurement systemOfMeasurementFactory( const QString &type );

/**
* \copydoc QgsCoordinateFormatter::format()
*
@@ -94,7 +94,7 @@ ApplicationWindow {
height: scaleBar.height
mapSettings: mapCanvas.mapSettings
preferredWidth: scaleBar.preferredWidth
systemOfMeasurement: QgsQuick.Utils.systemOfMeasurementFactory("Imperial")
systemOfMeasurement: QgsQuick.QgsUnitTypes.ImperialSystem
z: 1
}

0 comments on commit 7bfcaf4

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