mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-13 00:03:09 -04:00
Merge pull request #3314 from nyalldawson/units
Consolidate unit handling in QgsUnitTypes
This commit is contained in:
commit
68b621ace6
@ -53,6 +53,14 @@ should now call QgsCoordinateReferenceSystem::invalidateCache() and QgsCoordinat
|
||||
<li>permissiveToDouble() and permissiveToInt() where moved out of the QGis class and renamed to qgsPermissiveToDouble() and
|
||||
qgsPermissiveToInt()</li>
|
||||
<li>The constants DEFAULT_IDENTIFY_RADIUS and MINIMUM_POINT_SIZE were removed</li>
|
||||
<li>QGis::DecimalDegrees, DegreesMinutesSeconds and DegreesDecimalMinutes have been removed, and have all been replaced
|
||||
with the general Degrees unit</li>
|
||||
<li>The distance unit types QGis::UnitType (including QGis::Meters, QGis::Feet, QGis::Degrees, QGis::NauticalMiles,
|
||||
QGis::Kilometers, QGis::Yards, QGis::Miles and QGis::UnknownUnit have been moved to QgsUnitTypes::DistanceUnit.
|
||||
Some of these unit types have also been renamed - see the notes on QgsUnitTypes below. All methods which accepted
|
||||
QGis::UnitType parameters have been updated to take QgsUnitTypes::DistanceUnit instead.</li>
|
||||
<li>The unit handling methods toLiteral, fromLiteral, tr, fromTr, fromUnitToUnitFactor have been removed. Their
|
||||
corresponding counterparts in QgsUnitTypes should be used instead.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsAuthConfigUriEdit QgsAuthConfigUriEdit
|
||||
@ -447,6 +455,20 @@ has improved sort capabilities including the ability to set custom sort values f
|
||||
and for forcing certain items to always sort on top.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsSymbolV2 QgsSymbolV2
|
||||
|
||||
<ul>
|
||||
<li>The OutputUnit enum, including QgsSymbolV2::MM, QgsSymbolV2::MapUnit, QgsSymbolV2::Mixed, QgsSymbolV2::Pixel and QgsSymbolV2::Percentage has been moved to QgsUnitTypes
|
||||
and renamed to RenderUnit. QgsSymbolV2::OutputUnitList was renamed to QgsUnitTypes::RenderUnitList. All methods which previously accepted QgsSymbolV2::OutputUnit
|
||||
parameters or QgsSymbolV2::OutputUnitList parameters now take QgsUnitTypes::RenderUnit or QgsUnitTypes::RenderUnitList parameters respectively.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsSymbolLayerV2Utils QgsSymbolLayerV2Utils
|
||||
|
||||
<ul>
|
||||
<li>encodeOutputUnit() and decodeOutputUnit() were removed. QgsUnitTypes::encodeUnit() and QgsUnitTypes::decodeRenderUnit() should be used instead.</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsTreeWidgetItem QgsTreeWidgetItem
|
||||
|
||||
<ul>
|
||||
@ -454,6 +476,23 @@ and for forcing certain items to always sort on top.</li>
|
||||
use QgsTreeWidgetItemObject which is an upgraded version of the original QgsTreeWidgetItem</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsUnitTypes QgsUnitTypes
|
||||
|
||||
<ul>
|
||||
<li>All distance enumeration values were renamed to have a "Distance" prefix, including
|
||||
Meters (to DistanceMeters), Kilometers (to DistanceKilometers), Feet (to DistanceFeet),
|
||||
NauticalMiles (to DistanceNauticalMiles), Yards (to DistanceYards), Miles (to DistanceMiles),
|
||||
Degrees (to DistanceDegrees) and UnknownDistanceUnit to DistanceUnknownUnit</li>
|
||||
<li>All area enumeration values were renamed to have a "Area" prefix, including
|
||||
SquareMeters (to AreaSquareMeters), SquareKilometers (to AreaSquareKilometers), SquareFeet (to AreaSquareFeet),
|
||||
SquareYards (to AreaSquareYards), SquareMiles (to AreaSquareMiles), Hectares (to AreaHectares),
|
||||
Acres (to AreaAcres), SquareNauticalMiles (to AreaSquareNauticalMiles), SquareDegrees (to AreaSquareDegrees)
|
||||
and UnknownAreaUnit to AreaUnknownUnit</li>
|
||||
<li>All angle enumeration values were renamed to have a "Angle" prefix, including
|
||||
Radians (to AngleRadians), Gon (to AngleGon), MinutesOfArc (to AngleMinutesOfArc),
|
||||
SecondsOfArc (to AngleSecondsOfArc), Turn (to AngleTurn) and UnknownAngleUnit to AngleUnknownUnit</li>
|
||||
</ul>
|
||||
|
||||
\subsection qgis_api_break_3_0_QgsVectorLayer QgsVectorLayer
|
||||
|
||||
<ul>
|
||||
|
@ -63,14 +63,14 @@ class QgsDxfExport
|
||||
* Set map units
|
||||
* @param u unit
|
||||
*/
|
||||
void setMapUnits( Qgis::UnitType u );
|
||||
void setMapUnits( QgsUnitTypes::DistanceUnit u );
|
||||
|
||||
/**
|
||||
* Retrieve map units
|
||||
* @returns unit
|
||||
* @see setMapUnits
|
||||
*/
|
||||
Qgis::UnitType mapUnits() const;
|
||||
QgsUnitTypes::DistanceUnit mapUnits() const;
|
||||
|
||||
/**
|
||||
* Set symbology export mode
|
||||
@ -327,7 +327,8 @@ class QgsDxfExport
|
||||
//! @note added in 2.15
|
||||
void writeMText( const QString &layer, const QString &text, const QgsPointV2 &pt, double width, double angle, const QColor& color );
|
||||
|
||||
static double mapUnitScaleFactor( double scaleDenominator, QgsSymbolV2::OutputUnit symbolUnits, Qgis::UnitType mapUnits );
|
||||
//! Calculates a scaling factor to convert from map units to a specified symbol unit.
|
||||
static double mapUnitScaleFactor( double scaleDenominator, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits );
|
||||
|
||||
//! Return cleaned layer name for use in DXF
|
||||
static QString dxfLayerName( const QString &name );
|
||||
|
@ -50,7 +50,7 @@ class QgsGlowEffect : QgsPaintEffect
|
||||
* @see setSpread
|
||||
* @see setSpreadMapUnitScale
|
||||
*/
|
||||
void setSpreadUnit( const QgsSymbolV2::OutputUnit unit );
|
||||
void setSpreadUnit( const QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units used for the glow spread distance.
|
||||
* @returns units for spread distance
|
||||
@ -58,7 +58,7 @@ class QgsGlowEffect : QgsPaintEffect
|
||||
* @see spread
|
||||
* @see spreadMapUnitScale
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit spreadUnit() const;
|
||||
QgsUnitTypes::RenderUnit spreadUnit() const;
|
||||
|
||||
/** Sets the map unit scale used for the spread distance.
|
||||
* @param scale map unit scale for spread distance
|
||||
|
@ -69,7 +69,7 @@ class QgsShadowEffect : QgsPaintEffect
|
||||
* @see setOffsetDistance
|
||||
* @see setOffsetMapUnitScale
|
||||
*/
|
||||
void setOffsetUnit( const QgsSymbolV2::OutputUnit unit );
|
||||
void setOffsetUnit( const QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units used for the shadow offset distance.
|
||||
* @returns units for offset distance
|
||||
@ -77,7 +77,7 @@ class QgsShadowEffect : QgsPaintEffect
|
||||
* @see offsetDistance
|
||||
* @see offsetMapUnitScale
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit offsetUnit() const;
|
||||
QgsUnitTypes::RenderUnit offsetUnit() const;
|
||||
|
||||
/** Sets the map unit scale used for the shadow offset distance.
|
||||
* @param scale map unit scale for offset distance
|
||||
|
@ -71,7 +71,7 @@ class QgsTransformEffect : QgsPaintEffect
|
||||
* @see setTranslateY
|
||||
* @see setTranslateMapUnitScale
|
||||
*/
|
||||
void setTranslateUnit( const QgsSymbolV2::OutputUnit unit );
|
||||
void setTranslateUnit( const QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units used for the transform translation.
|
||||
* @returns units for translation
|
||||
@ -80,7 +80,7 @@ class QgsTransformEffect : QgsPaintEffect
|
||||
* @see translateY
|
||||
* @see translateMapUnitScale
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit translateUnit() const;
|
||||
QgsUnitTypes::RenderUnit translateUnit() const;
|
||||
|
||||
/** Sets the map unit scale used for the transform translation.
|
||||
* @param scale map unit scale for translation
|
||||
|
@ -136,50 +136,6 @@ class Qgis
|
||||
QImage::Format_ARGB32_Premultiplied */ ARGB32_Premultiplied,
|
||||
};
|
||||
|
||||
|
||||
/** Map units that qgis supports
|
||||
* @note that QGIS < 1.4 api had only Meters, Feet, Degrees and UnknownUnit
|
||||
* @note and QGIS >1.8 returns to that
|
||||
*/
|
||||
//TODO QGIS 3.0 - clean up and move to QgsUnitTypes and rename to DistanceUnit
|
||||
enum UnitType
|
||||
{
|
||||
Meters, /*!< meters */
|
||||
Feet, /*!< imperial feet */
|
||||
Degrees, /*!< degrees, for planar geographic CRS distance measurements */ //for 1.0 api backwards compatibility
|
||||
NauticalMiles, /*!< nautical miles */
|
||||
Kilometers, /*!< kilometers */
|
||||
Yards, /*!< imperial yards */
|
||||
Miles, /*!< terrestial miles */
|
||||
|
||||
UnknownUnit, /*!< unknown distance unit */
|
||||
|
||||
// for [1.4;1.8] api compatibility
|
||||
DecimalDegrees, // was 2
|
||||
DegreesMinutesSeconds, // was 4
|
||||
DegreesDecimalMinutes, // was 5
|
||||
};
|
||||
|
||||
//! Provides the canonical name of the type value
|
||||
//! @deprecated use QgsUnitTypes::encodeUnit() instead
|
||||
static QString toLiteral( Qgis::UnitType unit ) /Deprecated/;
|
||||
|
||||
//! Converts from the canonical name to the type value
|
||||
//! @deprecated use QgsUnitTypes::decodeDistanceUnit() instead
|
||||
static UnitType fromLiteral( const QString& literal, Qgis::UnitType defaultType = UnknownUnit ) /Deprecated/;
|
||||
|
||||
//! Provides translated version of the type value
|
||||
//! @deprecated use QgsUnitTypes::toString() instead
|
||||
static QString tr( Qgis::UnitType unit ) /Deprecated/;
|
||||
|
||||
//! Provides type value from translated version
|
||||
//! @deprecated use QgsUnitTypes::stringToDistanceUnit() instead
|
||||
static UnitType fromTr( const QString& literal, Qgis::UnitType defaultType = UnknownUnit ) /Deprecated/;
|
||||
|
||||
//! Returns the conversion factor between the specified units
|
||||
//! @deprecated use QgsUnitTyoes::fromUnitToUnitFactor() instead
|
||||
static double fromUnitToUnitFactor( Qgis::UnitType fromUnit, Qgis::UnitType toUnit ) /Deprecated/;
|
||||
|
||||
//! User defined event types
|
||||
enum UserEvent
|
||||
{
|
||||
|
@ -479,7 +479,7 @@ class QgsCoordinateReferenceSystem
|
||||
|
||||
/** Returns the units for the projection used by the CRS.
|
||||
*/
|
||||
Qgis::UnitType mapUnits() const;
|
||||
QgsUnitTypes::DistanceUnit mapUnits() const;
|
||||
|
||||
|
||||
// Mutators -----------------------------------
|
||||
|
@ -285,7 +285,7 @@ class QgsDiagramSettings
|
||||
|
||||
/** Diagram size unit
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit sizeType;
|
||||
QgsUnitTypes::RenderUnit sizeType;
|
||||
|
||||
/** Diagram size unit scale
|
||||
* @note added in 2.16
|
||||
@ -295,7 +295,7 @@ class QgsDiagramSettings
|
||||
/** Line unit index
|
||||
* @note added in 2.16
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit lineSizeUnit;
|
||||
QgsUnitTypes::RenderUnit lineSizeUnit;
|
||||
|
||||
/** Line unit scale
|
||||
* @note added in 2.16
|
||||
|
@ -155,7 +155,7 @@ class QgsDistanceArea
|
||||
* @note added in QGIS 2.14
|
||||
* @see areaUnits()
|
||||
*/
|
||||
Qgis::UnitType lengthUnits() const;
|
||||
QgsUnitTypes::DistanceUnit lengthUnits() const;
|
||||
|
||||
/** Returns the units of area for areal calculations made by this object.
|
||||
* @note added in QGIS 2.14
|
||||
@ -179,7 +179,7 @@ class QgsDistanceArea
|
||||
* @return formatted measurement string
|
||||
* @deprecated use formatDistance() or formatArea() instead
|
||||
*/
|
||||
static QString textUnit( double value, int decimals, Qgis::UnitType u, bool isArea, bool keepBaseUnit = false ) /Deprecated/;
|
||||
static QString textUnit( double value, int decimals, QgsUnitTypes::DistanceUnit u, bool isArea, bool keepBaseUnit = false ) /Deprecated/;
|
||||
|
||||
/** Returns an distance formatted as a friendly string.
|
||||
* @param distance distance to format
|
||||
@ -191,7 +191,7 @@ class QgsDistanceArea
|
||||
* @note added in QGIS 2.16
|
||||
* @see formatArea()
|
||||
*/
|
||||
static QString formatDistance( double distance, int decimals, Qgis::UnitType unit, bool keepBaseUnit = false );
|
||||
static QString formatDistance( double distance, int decimals, QgsUnitTypes::DistanceUnit unit, bool keepBaseUnit = false );
|
||||
|
||||
/** Returns an area formatted as a friendly string.
|
||||
* @param area area to format
|
||||
@ -208,7 +208,7 @@ class QgsDistanceArea
|
||||
|
||||
//! Helper for conversion between physical units
|
||||
// TODO QGIS 3.0 - remove this method, as its behaviour is non-intuitive.
|
||||
void convertMeasurement( double &measure /In,Out/, Qgis::UnitType &measureUnits /In,Out/, Qgis::UnitType displayUnits, bool isArea ) const;
|
||||
void convertMeasurement( double &measure /In,Out/, QgsUnitTypes::DistanceUnit &measureUnits /In,Out/, QgsUnitTypes::DistanceUnit displayUnits, bool isArea ) const;
|
||||
|
||||
/** Takes a length measurement calculated by this QgsDistanceArea object and converts it to a
|
||||
* different distance unit.
|
||||
@ -219,7 +219,7 @@ class QgsDistanceArea
|
||||
* @see convertAreaMeasurement()
|
||||
* @note added in QGIS 2.14
|
||||
*/
|
||||
double convertLengthMeasurement( double length, Qgis::UnitType toUnits ) const;
|
||||
double convertLengthMeasurement( double length, QgsUnitTypes::DistanceUnit toUnits ) const;
|
||||
|
||||
/** Takes an area measurement calculated by this QgsDistanceArea object and converts it to a
|
||||
* different areal unit.
|
||||
|
@ -167,14 +167,14 @@ class QgsExpression
|
||||
* @note added in QGIS 2.14
|
||||
* @see setDistanceUnits()
|
||||
*/
|
||||
Qgis::UnitType distanceUnits() const;
|
||||
QgsUnitTypes::DistanceUnit distanceUnits() const;
|
||||
|
||||
/** Sets the desired distance units for calculations involving geomCalculator(), eg "$length" and "$perimeter".
|
||||
* @note distances are only converted when a geomCalculator() has been set
|
||||
* @note added in QGIS 2.14
|
||||
* @see distanceUnits()
|
||||
*/
|
||||
void setDistanceUnits( Qgis::UnitType unit );
|
||||
void setDistanceUnits( QgsUnitTypes::DistanceUnit unit );
|
||||
|
||||
/** Returns the desired areal units for calculations involving geomCalculator(), eg "$area".
|
||||
* @note areas are only converted when a geomCalculator() has been set
|
||||
|
@ -91,9 +91,9 @@ class QgsMapSettings
|
||||
QgsCoordinateReferenceSystem destinationCrs() const;
|
||||
|
||||
//! Get units of map's geographical coordinates - used for scale calculation
|
||||
Qgis::UnitType mapUnits() const;
|
||||
QgsUnitTypes::DistanceUnit mapUnits() const;
|
||||
//! Set units of map's geographical coordinates - used for scale calculation
|
||||
void setMapUnits( Qgis::UnitType u );
|
||||
void setMapUnits( QgsUnitTypes::DistanceUnit u );
|
||||
|
||||
//! Set the background color of the map
|
||||
void setBackgroundColor( const QColor& color );
|
||||
|
@ -246,7 +246,7 @@ class QgsProject : QObject
|
||||
* @note added in QGIS 2.14
|
||||
* @see areaUnits()
|
||||
*/
|
||||
Qgis::UnitType distanceUnits() const;
|
||||
QgsUnitTypes::DistanceUnit distanceUnits() const;
|
||||
|
||||
/** Convenience function to query default area measurement units for project.
|
||||
* @note added in QGIS 2.14
|
||||
|
@ -13,11 +13,10 @@ class QgsScaleCalculator
|
||||
/**
|
||||
* Constructor
|
||||
* @param dpi Monitor resolution in dots per inch
|
||||
* @param mapUnits Units of the data on the map. Must match a value from the
|
||||
* Qgis::UnitType enum (Meters, Feet, Degrees)
|
||||
* @param mapUnits Units of the data on the map
|
||||
*/
|
||||
QgsScaleCalculator( double dpi = 0,
|
||||
Qgis::UnitType mapUnits = Qgis::Meters );
|
||||
QgsUnitTypes::DistanceUnit mapUnits = QgsUnitTypes::DistanceMeters );
|
||||
|
||||
/**
|
||||
* Set the dpi to be used in scale calculations
|
||||
@ -35,10 +34,10 @@ class QgsScaleCalculator
|
||||
* Set the map units
|
||||
* @param mapUnits Units of the data on the map. Must match a value from the
|
||||
*/
|
||||
void setMapUnits( Qgis::UnitType mapUnits );
|
||||
void setMapUnits( QgsUnitTypes::DistanceUnit mapUnits );
|
||||
|
||||
/** Returns current map units */
|
||||
Qgis::UnitType mapUnits() const;
|
||||
QgsUnitTypes::DistanceUnit mapUnits() const;
|
||||
|
||||
/**
|
||||
* Calculate the scale denominator
|
||||
|
@ -12,52 +12,78 @@ class QgsUnitTypes
|
||||
|
||||
public:
|
||||
|
||||
//! Units of distance
|
||||
enum DistanceUnit
|
||||
{
|
||||
DistanceMeters, /*!< meters */
|
||||
DistanceKilometers, /*!< kilometers */
|
||||
DistanceFeet, /*!< imperial feet */
|
||||
DistanceNauticalMiles, /*!< nautical miles */
|
||||
DistanceYards, /*!< imperial yards */
|
||||
DistanceMiles, /*!< terrestial miles */
|
||||
DistanceDegrees, /*!< degrees, for planar geographic CRS distance measurements */
|
||||
DistanceUnknownUnit, /*!< unknown distance unit */
|
||||
};
|
||||
|
||||
/** Types of distance units
|
||||
*/
|
||||
enum DistanceUnitType
|
||||
{
|
||||
Standard, /*!< unit is a standard measurement unit */
|
||||
Geographic, /*!< unit is a geographic (eg degree based) unit */
|
||||
UnknownType, /*!< unknown unit type */
|
||||
Standard, /*!< unit is a standard measurement unit */
|
||||
Geographic, /*!< unit is a geographic (eg degree based) unit */
|
||||
UnknownType, /*!< unknown unit type */
|
||||
};
|
||||
|
||||
//! Units of area
|
||||
enum AreaUnit
|
||||
{
|
||||
SquareMeters, /*!< square meters */
|
||||
SquareKilometers, /*!< square kilometers */
|
||||
SquareFeet, /*!< square feet */
|
||||
SquareYards, /*!< square yards */
|
||||
SquareMiles, /*!< square miles */
|
||||
Hectares, /*!< hectares */
|
||||
Acres, /*!< acres */
|
||||
SquareNauticalMiles, /*!< square nautical miles */
|
||||
SquareDegrees, /*!< square degrees, for planar geographic CRS area measurements */
|
||||
UnknownAreaUnit, /*!< unknown areal unit */
|
||||
AreaSquareMeters, /*!< square meters */
|
||||
AreaSquareKilometers, /*!< square kilometers */
|
||||
AreaSquareFeet, /*!< square feet */
|
||||
AreaSquareYards, /*!< square yards */
|
||||
AreaSquareMiles, /*!< square miles */
|
||||
AreaHectares, /*!< hectares */
|
||||
AreaAcres, /*!< acres */
|
||||
AreaSquareNauticalMiles, /*!< square nautical miles */
|
||||
AreaSquareDegrees, /*!< square degrees, for planar geographic CRS area measurements */
|
||||
AreaUnknownUnit, /*!< unknown areal unit */
|
||||
};
|
||||
|
||||
//! Units of angles
|
||||
enum AngleUnit
|
||||
{
|
||||
AngleDegrees = 0, /*!< degrees */
|
||||
Radians, /*!< square kilometers */
|
||||
Gon, /*!< gon/gradian */
|
||||
MinutesOfArc, /*!< minutes of arc */
|
||||
SecondsOfArc, /*!< seconds of arc */
|
||||
Turn, /*!< turn/revolutions */
|
||||
UnknownAngleUnit, /*!< unknown angle unit */
|
||||
AngleDegrees, /*!< degrees */
|
||||
AngleRadians, /*!< square kilometers */
|
||||
AngleGon, /*!< gon/gradian */
|
||||
AngleMinutesOfArc, /*!< minutes of arc */
|
||||
AngleSecondsOfArc, /*!< seconds of arc */
|
||||
AngleTurn, /*!< turn/revolutions */
|
||||
AngleUnknownUnit, /*!< unknown angle unit */
|
||||
};
|
||||
|
||||
//! Rendering size units
|
||||
enum RenderUnit
|
||||
{
|
||||
RenderMillimeters, //!< millimeters
|
||||
RenderMapUnits, //!< map units
|
||||
RenderPixels, //!< pixels
|
||||
RenderPercentage, //!< percentage of another measurement (eg canvas size, feature size)
|
||||
RenderUnknownUnit, //!< mixed or unknown units
|
||||
};
|
||||
|
||||
//! List of render units
|
||||
typedef QList<QgsUnitTypes::RenderUnit> RenderUnitList;
|
||||
|
||||
/** Returns the type for a distance unit.
|
||||
*/
|
||||
static DistanceUnitType unitType( Qgis::UnitType unit );
|
||||
static DistanceUnitType unitType( QgsUnitTypes::DistanceUnit unit );
|
||||
|
||||
/** Encodes a distance unit to a string.
|
||||
* @param unit unit to encode
|
||||
* @returns encoded string
|
||||
* @see decodeDistanceUnit()
|
||||
*/
|
||||
static QString encodeUnit( Qgis::UnitType unit );
|
||||
static QString encodeUnit( QgsUnitTypes::DistanceUnit unit );
|
||||
|
||||
/** Decodes a distance unit from a string.
|
||||
* @param string string to decode
|
||||
@ -65,27 +91,27 @@ class QgsUnitTypes
|
||||
* @returns decoded units
|
||||
* @see encodeUnit()
|
||||
*/
|
||||
static Qgis::UnitType decodeDistanceUnit( const QString& string, bool *ok = 0 );
|
||||
static QgsUnitTypes::DistanceUnit decodeDistanceUnit( const QString& string, bool *ok /Out/ = 0 );
|
||||
|
||||
/** Returns a translated string representing a distance unit.
|
||||
* @param unit unit to convert to string
|
||||
* @see stringToDistanceUnit()
|
||||
*/
|
||||
static QString toString( Qgis::UnitType unit );
|
||||
static QString toString( QgsUnitTypes::DistanceUnit unit );
|
||||
|
||||
/** Converts a translated string to a distance unit.
|
||||
* @param string string representing a distance unit
|
||||
* @param ok optional boolean, will be set to true if string was converted successfully
|
||||
* @see toString()
|
||||
*/
|
||||
static Qgis::UnitType stringToDistanceUnit( const QString& string, bool *ok = 0 );
|
||||
static QgsUnitTypes::DistanceUnit stringToDistanceUnit( const QString& string, bool *ok /Out/ = 0 );
|
||||
|
||||
/** Returns the conversion factor between the specified distance units.
|
||||
* @param fromUnit distance unit to convert from
|
||||
* @param toUnit distance unit to convert to
|
||||
* @returns multiplication factor to convert between units
|
||||
*/
|
||||
static double fromUnitToUnitFactor( Qgis::UnitType fromUnit, Qgis::UnitType toUnit );
|
||||
static double fromUnitToUnitFactor( QgsUnitTypes::DistanceUnit fromUnit, QgsUnitTypes::DistanceUnit toUnit );
|
||||
|
||||
/** Returns the type for an areal unit.
|
||||
*/
|
||||
@ -104,7 +130,7 @@ class QgsUnitTypes
|
||||
* @returns decoded units
|
||||
* @see encodeUnit()
|
||||
*/
|
||||
static AreaUnit decodeAreaUnit( const QString& string, bool *ok = 0 );
|
||||
static AreaUnit decodeAreaUnit( const QString& string, bool *ok /Out/ = 0 );
|
||||
|
||||
/** Returns a translated string representing an areal unit.
|
||||
* @param unit unit to convert to string
|
||||
@ -117,7 +143,7 @@ class QgsUnitTypes
|
||||
* @param ok optional boolean, will be set to true if string was converted successfully
|
||||
* @see toString()
|
||||
*/
|
||||
static AreaUnit stringToAreaUnit( const QString& string, bool *ok = 0 );
|
||||
static AreaUnit stringToAreaUnit( const QString& string, bool *ok /Out/ = 0 );
|
||||
|
||||
/** Returns the conversion factor between the specified areal units.
|
||||
* @param fromUnit area unit to convert from
|
||||
@ -130,7 +156,7 @@ class QgsUnitTypes
|
||||
* @param distanceUnit distance unit to convert
|
||||
* @return matching areal unit
|
||||
*/
|
||||
static AreaUnit distanceToAreaUnit( Qgis::UnitType distanceUnit );
|
||||
static AreaUnit distanceToAreaUnit( QgsUnitTypes::DistanceUnit distanceUnit );
|
||||
|
||||
// ANGULAR UNITS
|
||||
|
||||
@ -147,7 +173,7 @@ class QgsUnitTypes
|
||||
* @returns decoded units
|
||||
* @see encodeUnit()
|
||||
*/
|
||||
static AngleUnit decodeAngleUnit( const QString& string, bool *ok = 0 );
|
||||
static AngleUnit decodeAngleUnit( const QString& string, bool *ok /Out/ = 0 );
|
||||
|
||||
/** Returns a translated string representing an angular unit.
|
||||
* @param unit unit to convert to string
|
||||
@ -168,5 +194,23 @@ class QgsUnitTypes
|
||||
* @returns formatted angle string
|
||||
*/
|
||||
static QString formatAngle( double angle, int decimals, AngleUnit unit );
|
||||
|
||||
// RENDER UNITS
|
||||
|
||||
/** Encodes a render unit to a string.
|
||||
* @param unit unit to encode
|
||||
* @returns encoded string
|
||||
* @see decodeRenderUnit()
|
||||
*/
|
||||
static QString encodeUnit( RenderUnit unit );
|
||||
|
||||
/** Decodes a render unit from a string.
|
||||
* @param string string to decode
|
||||
* @param ok optional boolean, will be set to true if string was converted successfully
|
||||
* @returns decoded units
|
||||
* @see encodeUnit()
|
||||
*/
|
||||
static RenderUnit decodeRenderUnit( const QString& string, bool *ok /Out/ = 0 );
|
||||
|
||||
};
|
||||
|
||||
|
@ -271,7 +271,7 @@ class QgsVectorFileWriter
|
||||
QString errorMessage();
|
||||
|
||||
/** Add feature to the currently opened data source */
|
||||
bool addFeature( QgsFeature& feature, QgsFeatureRendererV2* renderer = 0, Qgis::UnitType outputUnit = Qgis::Meters );
|
||||
bool addFeature( QgsFeature& feature, QgsFeatureRendererV2* renderer = 0, QgsUnitTypes::DistanceUnit outputUnit = QgsUnitTypes::DistanceMeters );
|
||||
|
||||
//! @note not available in python bindings
|
||||
// QMap<int, int> attrIdxToOgrIdx();
|
||||
|
@ -8,13 +8,24 @@ class QgsXmlUtils
|
||||
%End
|
||||
public:
|
||||
|
||||
/* reading */
|
||||
/** Decodes a distance unit from a DOM element.
|
||||
* @param element DOM element to decode
|
||||
* @returns distance units
|
||||
* @see writeMapUnits()
|
||||
*/
|
||||
static QgsUnitTypes::DistanceUnit readMapUnits( const QDomElement& element );
|
||||
|
||||
static Qgis::UnitType readMapUnits( const QDomElement& element );
|
||||
static QgsRectangle readRectangle( const QDomElement& element );
|
||||
|
||||
/* writing */
|
||||
|
||||
static QDomElement writeMapUnits( Qgis::UnitType units, QDomDocument& doc );
|
||||
/** Encodes a distance unit to a DOM element.
|
||||
* @param units units to encode
|
||||
* @param doc DOM document
|
||||
* @returns element containing encoded units
|
||||
* @see readMapUnits()
|
||||
*/
|
||||
static QDomElement writeMapUnits( QgsUnitTypes::DistanceUnit units, QDomDocument& doc );
|
||||
|
||||
static QDomElement writeRectangle( const QgsRectangle& rect, QDomDocument& doc );
|
||||
};
|
||||
|
@ -39,9 +39,9 @@ class QgsArrowSymbolLayer : public QgsLineSymbolLayerV2
|
||||
/** Set the arrow width */
|
||||
void setArrowWidth( double width );
|
||||
/** Get the unit for the arrow width */
|
||||
QgsSymbolV2::OutputUnit arrowWidthUnit() const;
|
||||
QgsUnitTypes::RenderUnit arrowWidthUnit() const;
|
||||
/** Set the unit for the arrow width */
|
||||
void setArrowWidthUnit( QgsSymbolV2::OutputUnit unit );
|
||||
void setArrowWidthUnit( QgsUnitTypes::RenderUnit unit );
|
||||
/** Get the scale for the arrow width */
|
||||
QgsMapUnitScale arrowWidthUnitScale() const;
|
||||
/** Set the scale for the arrow width */
|
||||
@ -52,9 +52,9 @@ class QgsArrowSymbolLayer : public QgsLineSymbolLayerV2
|
||||
/** Set the arrow start width */
|
||||
void setArrowStartWidth( double width );
|
||||
/** Get the unit for the arrow start width */
|
||||
QgsSymbolV2::OutputUnit arrowStartWidthUnit() const;
|
||||
QgsUnitTypes::RenderUnit arrowStartWidthUnit() const;
|
||||
/** Set the unit for the arrow start width */
|
||||
void setArrowStartWidthUnit( QgsSymbolV2::OutputUnit unit );
|
||||
void setArrowStartWidthUnit( QgsUnitTypes::RenderUnit unit );
|
||||
/** Get the scale for the arrow start width */
|
||||
QgsMapUnitScale arrowStartWidthUnitScale() const;
|
||||
/** Set the scale for the arrow start width */
|
||||
@ -65,9 +65,9 @@ class QgsArrowSymbolLayer : public QgsLineSymbolLayerV2
|
||||
/** Set the arrow head length */
|
||||
void setHeadLength( double length );
|
||||
/** Get the unit for the head length */
|
||||
QgsSymbolV2::OutputUnit headLengthUnit() const;
|
||||
QgsUnitTypes::RenderUnit headLengthUnit() const;
|
||||
/** Set the unit for the head length */
|
||||
void setHeadLengthUnit( QgsSymbolV2::OutputUnit unit );
|
||||
void setHeadLengthUnit( QgsUnitTypes::RenderUnit unit );
|
||||
/** Get the scale for the head length */
|
||||
QgsMapUnitScale headLengthUnitScale() const;
|
||||
/** Set the scale for the head length */
|
||||
@ -78,9 +78,9 @@ class QgsArrowSymbolLayer : public QgsLineSymbolLayerV2
|
||||
/** Set the arrow head height */
|
||||
void setHeadThickness( double thickness );
|
||||
/** Get the unit for the head height */
|
||||
QgsSymbolV2::OutputUnit headThicknessUnit() const;
|
||||
QgsUnitTypes::RenderUnit headThicknessUnit() const;
|
||||
/** Set the unit for the head height */
|
||||
void setHeadThicknessUnit( QgsSymbolV2::OutputUnit unit );
|
||||
void setHeadThicknessUnit( QgsUnitTypes::RenderUnit unit );
|
||||
/** Get the scale for the head height */
|
||||
QgsMapUnitScale headThicknessUnitScale() const;
|
||||
/** Set the scale for the head height */
|
||||
|
@ -51,26 +51,54 @@ class QgsEllipseSymbolLayerV2 : QgsMarkerSymbolLayerV2
|
||||
void setOutlineColor( const QColor& c );
|
||||
QColor outlineColor() const;
|
||||
|
||||
void setSymbolWidthUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit symbolWidthUnit() const;
|
||||
/** Sets the units for the symbol's width.
|
||||
* @param unit symbol units
|
||||
* @see symbolWidthUnit()
|
||||
* @see setSymbolHeightUnit()
|
||||
*/
|
||||
void setSymbolWidthUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the symbol's width.
|
||||
* @see setSymbolWidthUnit()
|
||||
* @see symbolHeightUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit symbolWidthUnit() const;
|
||||
|
||||
void setSymbolWidthMapUnitScale( const QgsMapUnitScale& scale);
|
||||
const QgsMapUnitScale& symbolWidthMapUnitScale() const;
|
||||
|
||||
void setSymbolHeightUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit symbolHeightUnit() const;
|
||||
/** Sets the units for the symbol's height.
|
||||
* @param unit symbol units
|
||||
* @see symbolHeightUnit()
|
||||
* @see setSymbolWidthUnit()
|
||||
*/
|
||||
void setSymbolHeightUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the symbol's height.
|
||||
* @see setSymbolHeightUnit()
|
||||
* @see symbolWidthUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit symbolHeightUnit() const;
|
||||
|
||||
void setSymbolHeightMapUnitScale( const QgsMapUnitScale& scale);
|
||||
const QgsMapUnitScale& symbolHeightMapUnitScale() const;
|
||||
|
||||
void setOutlineWidthUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit outlineWidthUnit() const;
|
||||
/** Sets the units for the symbol's outline width.
|
||||
* @param unit symbol units
|
||||
* @see outlineWidthUnit()
|
||||
*/
|
||||
void setOutlineWidthUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the symbol's outline width.
|
||||
* @see setOutlineWidthUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit outlineWidthUnit() const;
|
||||
|
||||
void setOutlineWidthMapUnitScale( const QgsMapUnitScale& scale);
|
||||
const QgsMapUnitScale& outlineWidthMapUnitScale() const;
|
||||
|
||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit outputUnit() const;
|
||||
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
||||
QgsUnitTypes::RenderUnit outputUnit() const;
|
||||
|
||||
void setMapUnitScale( const QgsMapUnitScale& scale );
|
||||
QgsMapUnitScale mapUnitScale() const;
|
||||
|
@ -68,20 +68,36 @@ class QgsSimpleFillSymbolLayerV2 : QgsFillSymbolLayerV2
|
||||
void setOffset( QPointF offset );
|
||||
QPointF offset();
|
||||
|
||||
void setBorderWidthUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit borderWidthUnit() const;
|
||||
/** Sets the units for the width of the fill's border.
|
||||
* @param unit width units
|
||||
* @see borderWidthUnit()
|
||||
*/
|
||||
void setBorderWidthUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the width of the fill's border.
|
||||
* @see setBorderWidthUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit borderWidthUnit() const;
|
||||
|
||||
void setBorderWidthMapUnitScale( const QgsMapUnitScale& scale);
|
||||
const QgsMapUnitScale& borderWidthMapUnitScale() const;
|
||||
|
||||
void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit offsetUnit() const;
|
||||
/** Sets the units for the fill's offset.
|
||||
* @param unit offset units
|
||||
* @see offsetUnit()
|
||||
*/
|
||||
void setOffsetUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the fill's offset.
|
||||
* @see setOffsetUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit offsetUnit() const;
|
||||
|
||||
void setOffsetMapUnitScale( const QgsMapUnitScale& scale);
|
||||
const QgsMapUnitScale& offsetMapUnitScale() const;
|
||||
|
||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit outputUnit() const;
|
||||
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
||||
QgsUnitTypes::RenderUnit outputUnit() const;
|
||||
|
||||
void setMapUnitScale( const QgsMapUnitScale &scale );
|
||||
QgsMapUnitScale mapUnitScale() const;
|
||||
@ -203,14 +219,14 @@ class QgsGradientFillSymbolLayerV2 : QgsFillSymbolLayerV2
|
||||
QPointF offset() const;
|
||||
|
||||
/** Units for gradient fill offset*/
|
||||
void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit offsetUnit() const;
|
||||
void setOffsetUnit( QgsUnitTypes::RenderUnit unit );
|
||||
QgsUnitTypes::RenderUnit offsetUnit() const;
|
||||
|
||||
void setOffsetMapUnitScale( const QgsMapUnitScale& scale);
|
||||
const QgsMapUnitScale& offsetMapUnitScale() const;
|
||||
|
||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit outputUnit() const;
|
||||
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
||||
QgsUnitTypes::RenderUnit outputUnit() const;
|
||||
|
||||
void setMapUnitScale( const QgsMapUnitScale &scale );
|
||||
QgsMapUnitScale mapUnitScale() const;
|
||||
@ -308,14 +324,14 @@ class QgsShapeburstFillSymbolLayerV2 : QgsFillSymbolLayerV2
|
||||
* @see setMaxDistance
|
||||
* @see distanceUnit
|
||||
*/
|
||||
void setDistanceUnit( QgsSymbolV2::OutputUnit unit );
|
||||
void setDistanceUnit( QgsUnitTypes::RenderUnit unit );
|
||||
/** Returns the unit for the maximum distance to shade inside of the shape from the polygon's boundary.
|
||||
* @returns distance unit for the maximum distance
|
||||
* @note added in 2.3
|
||||
* @see maxDistance
|
||||
* @see setDistanceUnit
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit distanceUnit() const;
|
||||
QgsUnitTypes::RenderUnit distanceUnit() const;
|
||||
|
||||
void setDistanceMapUnitScale( const QgsMapUnitScale& scale );
|
||||
const QgsMapUnitScale& distanceMapUnitScale() const;
|
||||
@ -406,20 +422,20 @@ class QgsShapeburstFillSymbolLayerV2 : QgsFillSymbolLayerV2
|
||||
* @see setOffset
|
||||
* @see offsetUnit
|
||||
*/
|
||||
void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
|
||||
void setOffsetUnit( QgsUnitTypes::RenderUnit unit );
|
||||
/** Returns the units used for the offset of the shapeburst fill.
|
||||
* @returns units used for the fill offset
|
||||
* @note added in 2.3
|
||||
* @see offset
|
||||
* @see setOffsetUnit
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit offsetUnit() const;
|
||||
QgsUnitTypes::RenderUnit offsetUnit() const;
|
||||
|
||||
void setOffsetMapUnitScale( const QgsMapUnitScale& scale);
|
||||
const QgsMapUnitScale& offsetMapUnitScale() const;
|
||||
|
||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit outputUnit() const;
|
||||
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
||||
QgsUnitTypes::RenderUnit outputUnit() const;
|
||||
|
||||
void setMapUnitScale( const QgsMapUnitScale &scale );
|
||||
QgsMapUnitScale mapUnitScale() const;
|
||||
@ -440,14 +456,22 @@ class QgsImageFillSymbolLayer: QgsFillSymbolLayerV2
|
||||
virtual QgsSymbolV2* subSymbol();
|
||||
virtual bool setSubSymbol( QgsSymbolV2* symbol /Transfer/ );
|
||||
|
||||
void setOutlineWidthUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit outlineWidthUnit() const;
|
||||
/** Sets the units for the symbol's outline width.
|
||||
* @param unit symbol units
|
||||
* @see outlineWidthUnit()
|
||||
*/
|
||||
void setOutlineWidthUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the symbol's outline width.
|
||||
* @see setOutlineWidthUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit outlineWidthUnit() const;
|
||||
|
||||
void setOutlineWidthMapUnitScale( const QgsMapUnitScale& scale);
|
||||
const QgsMapUnitScale& outlineWidthMapUnitScale() const;
|
||||
|
||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit outputUnit() const;
|
||||
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
||||
QgsUnitTypes::RenderUnit outputUnit() const;
|
||||
|
||||
void setMapUnitScale( const QgsMapUnitScale& scale );
|
||||
QgsMapUnitScale mapUnitScale() const;
|
||||
@ -557,14 +581,14 @@ class QgsRasterFillSymbolLayer: QgsImageFillSymbolLayer
|
||||
* @see setOffset
|
||||
* @see setOffsetMapUnitScale
|
||||
*/
|
||||
void setOffsetUnit( const QgsSymbolV2::OutputUnit unit );
|
||||
void setOffsetUnit( const QgsUnitTypes::RenderUnit unit );
|
||||
/** Returns the units for the fill's offset.
|
||||
* @returns units for offset
|
||||
* @see setOffsetUnit
|
||||
* @see offset
|
||||
* @see offsetMapUnitScale
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit offsetUnit() const;
|
||||
QgsUnitTypes::RenderUnit offsetUnit() const;
|
||||
|
||||
/** Sets the map unit scale for the fill's offset.
|
||||
* @param scale map unit scale for offset
|
||||
@ -604,14 +628,14 @@ class QgsRasterFillSymbolLayer: QgsImageFillSymbolLayer
|
||||
* @see setWidth
|
||||
* @see setWidthMapUnitScale
|
||||
*/
|
||||
void setWidthUnit( const QgsSymbolV2::OutputUnit unit );
|
||||
void setWidthUnit( const QgsUnitTypes::RenderUnit unit );
|
||||
/** Returns the units for the image's width.
|
||||
* @returns units for width
|
||||
* @see setWidthUnit
|
||||
* @see width
|
||||
* @see widthMapUnitScale
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit widthUnit() const;
|
||||
QgsUnitTypes::RenderUnit widthUnit() const;
|
||||
|
||||
/** Sets the map unit scale for the image's width.
|
||||
* @param scale map unit scale for width
|
||||
@ -676,20 +700,36 @@ class QgsSVGFillSymbolLayer: QgsImageFillSymbolLayer
|
||||
void setSvgOutlineWidth( double w );
|
||||
double svgOutlineWidth() const;
|
||||
|
||||
void setPatternWidthUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit patternWidthUnit() const;
|
||||
/** Sets the units for the width of the SVG images in the pattern.
|
||||
* @param unit width units
|
||||
* @see patternWidthUnit()
|
||||
*/
|
||||
void setPatternWidthUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the width of the SVG images in the pattern.
|
||||
* @see setPatternWidthUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit patternWidthUnit() const;
|
||||
|
||||
void setPatternWidthMapUnitScale( const QgsMapUnitScale& scale);
|
||||
const QgsMapUnitScale& patternWidthMapUnitScale() const;
|
||||
|
||||
void setSvgOutlineWidthUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit svgOutlineWidthUnit() const;
|
||||
/** Sets the units for the outline width.
|
||||
* @param unit width units
|
||||
* @see svgOutlineWidthUnit()
|
||||
*/
|
||||
void setSvgOutlineWidthUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the outline width.
|
||||
* @see setSvgOutlineWidthUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit svgOutlineWidthUnit() const;
|
||||
|
||||
void setSvgOutlineWidthMapUnitScale( const QgsMapUnitScale& scale);
|
||||
const QgsMapUnitScale& svgOutlineWidthMapUnitScale() const;
|
||||
|
||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit outputUnit() const;
|
||||
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
||||
QgsUnitTypes::RenderUnit outputUnit() const;
|
||||
|
||||
void setMapUnitScale( const QgsMapUnitScale &scale );
|
||||
QgsMapUnitScale mapUnitScale() const;
|
||||
@ -729,7 +769,18 @@ class QgsLinePatternFillSymbolLayer: QgsImageFillSymbolLayer
|
||||
//getters and setters
|
||||
void setLineAngle( double a );
|
||||
double lineAngle() const;
|
||||
|
||||
/** Sets the distance between lines in the fill pattern.
|
||||
* @param d distance. Units are specified by setDistanceUnit()
|
||||
* @see distance()
|
||||
* @see setDistanceUnit()
|
||||
*/
|
||||
void setDistance( double d );
|
||||
|
||||
/** Returns the distance between lines in the fill pattern. Units are retrieved by distanceUnit().
|
||||
* @see setDistance()
|
||||
* @see distanceUnit()
|
||||
*/
|
||||
double distance() const;
|
||||
void setLineWidth( double w );
|
||||
double lineWidth() const;
|
||||
@ -738,26 +789,52 @@ class QgsLinePatternFillSymbolLayer: QgsImageFillSymbolLayer
|
||||
void setOffset( double offset );
|
||||
double offset() const;
|
||||
|
||||
void setDistanceUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit distanceUnit() const;
|
||||
/** Sets the units for the distance between lines in the fill pattern.
|
||||
* @param unit distance units
|
||||
* @see distanceUnit()
|
||||
* @see setDistance()
|
||||
*/
|
||||
void setDistanceUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the distance between lines in the fill pattern.
|
||||
* @see setDistanceUnit()
|
||||
* @see distance()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit distanceUnit() const;
|
||||
|
||||
void setDistanceMapUnitScale( const QgsMapUnitScale& scale);
|
||||
const QgsMapUnitScale& distanceMapUnitScale() const;
|
||||
|
||||
void setLineWidthUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit lineWidthUnit() const;
|
||||
/** Sets the units for the line's width.
|
||||
* @param unit width units
|
||||
* @see lineWidthUnit()
|
||||
*/
|
||||
void setLineWidthUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the line's width.
|
||||
* @see setLineWidthUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit lineWidthUnit() const;
|
||||
|
||||
void setLineWidthMapUnitScale( const QgsMapUnitScale& scale);
|
||||
const QgsMapUnitScale& lineWidthMapUnitScale() const;
|
||||
|
||||
void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit offsetUnit() const;
|
||||
/** Sets the units for the line pattern's offset.
|
||||
* @param unit offset units
|
||||
* @see offsetUnit()
|
||||
*/
|
||||
void setOffsetUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the line pattern's offset.
|
||||
* @see setOffsetUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit offsetUnit() const;
|
||||
|
||||
void setOffsetMapUnitScale( const QgsMapUnitScale& scale);
|
||||
const QgsMapUnitScale& offsetMapUnitScale() const;
|
||||
|
||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit outputUnit() const;
|
||||
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
||||
QgsUnitTypes::RenderUnit outputUnit() const;
|
||||
|
||||
void setMapUnitScale( const QgsMapUnitScale& scale );
|
||||
QgsMapUnitScale mapUnitScale() const;
|
||||
@ -811,32 +888,52 @@ class QgsPointPatternFillSymbolLayer : QgsImageFillSymbolLayer
|
||||
bool setSubSymbol( QgsSymbolV2* symbol /Transfer/ );
|
||||
virtual QgsSymbolV2* subSymbol();
|
||||
|
||||
void setDistanceXUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit distanceXUnit() const;
|
||||
/** Sets the units for the horizontal distance between points in the pattern.
|
||||
* @param unit distance units
|
||||
* @see distanceXUnit()
|
||||
* @see setDistanceYUnit()
|
||||
*/
|
||||
void setDistanceXUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the horizontal distance between points in the pattern.
|
||||
* @see setDistanceXUnit()
|
||||
* @see distanceYUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit distanceXUnit() const;
|
||||
|
||||
void setDistanceXMapUnitScale( const QgsMapUnitScale& scale);
|
||||
const QgsMapUnitScale& distanceXMapUnitScale() const;
|
||||
|
||||
void setDistanceYUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit distanceYUnit() const;
|
||||
/** Sets the units for the vertical distance between points in the pattern.
|
||||
* @param unit distance units
|
||||
* @see distanceYUnit()
|
||||
* @see setDistanceXUnit()
|
||||
*/
|
||||
void setDistanceYUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the vertical distance between points in the pattern.
|
||||
* @see setDistanceYUnit()
|
||||
* @see distanceXUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit distanceYUnit() const;
|
||||
|
||||
void setDistanceYMapUnitScale( const QgsMapUnitScale& scale);
|
||||
const QgsMapUnitScale& distanceYMapUnitScale() const;
|
||||
|
||||
void setDisplacementXUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit displacementXUnit() const;
|
||||
void setDisplacementXUnit( QgsUnitTypes::RenderUnit unit );
|
||||
QgsUnitTypes::RenderUnit displacementXUnit() const;
|
||||
|
||||
void setDisplacementXMapUnitScale( const QgsMapUnitScale& scale);
|
||||
const QgsMapUnitScale& displacementXMapUnitScale() const;
|
||||
|
||||
void setDisplacementYUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit displacementYUnit() const;
|
||||
void setDisplacementYUnit( QgsUnitTypes::RenderUnit unit );
|
||||
QgsUnitTypes::RenderUnit displacementYUnit() const;
|
||||
|
||||
void setDisplacementYMapUnitScale( const QgsMapUnitScale& scale);
|
||||
const QgsMapUnitScale& displacementYMapUnitScale() const;
|
||||
|
||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit outputUnit() const;
|
||||
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
||||
QgsUnitTypes::RenderUnit outputUnit() const;
|
||||
|
||||
void setMapUnitScale( const QgsMapUnitScale &scale );
|
||||
QgsMapUnitScale mapUnitScale() const;
|
||||
@ -887,8 +984,8 @@ class QgsCentroidFillSymbolLayerV2 : QgsFillSymbolLayerV2
|
||||
QgsSymbolV2* subSymbol();
|
||||
bool setSubSymbol( QgsSymbolV2* symbol /Transfer/ );
|
||||
|
||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit outputUnit() const;
|
||||
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
||||
QgsUnitTypes::RenderUnit outputUnit() const;
|
||||
|
||||
void setMapUnitScale(const QgsMapUnitScale &scale);
|
||||
QgsMapUnitScale mapUnitScale() const;
|
||||
|
@ -75,14 +75,14 @@ class QgsHeatmapRenderer : QgsFeatureRendererV2
|
||||
* @see setRadiusUnit
|
||||
* @see radiusMapUnitScale
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit radiusUnit() const;
|
||||
QgsUnitTypes::RenderUnit radiusUnit() const;
|
||||
/** Sets the units used for the heatmap's radius
|
||||
* @param unit units for heatmap radius
|
||||
* @see radiusUnit
|
||||
* @see setRadius
|
||||
* @see radiusMapUnitScale
|
||||
*/
|
||||
void setRadiusUnit( const QgsSymbolV2::OutputUnit unit );
|
||||
void setRadiusUnit( const QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the map unit scale used for the heatmap's radius
|
||||
* @returns map unit scale for heatmap's radius
|
||||
|
@ -35,8 +35,8 @@ class QgsSimpleLineSymbolLayerV2 : QgsLineSymbolLayerV2
|
||||
|
||||
QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const;
|
||||
|
||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit outputUnit() const;
|
||||
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
||||
QgsUnitTypes::RenderUnit outputUnit() const;
|
||||
|
||||
void setMapUnitScale( const QgsMapUnitScale &scale );
|
||||
QgsMapUnitScale mapUnitScale() const;
|
||||
@ -57,8 +57,16 @@ class QgsSimpleLineSymbolLayerV2 : QgsLineSymbolLayerV2
|
||||
bool useCustomDashPattern() const;
|
||||
void setUseCustomDashPattern( bool b );
|
||||
|
||||
void setCustomDashPatternUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit customDashPatternUnit() const;
|
||||
/** Sets the units for lengths used in the custom dash pattern.
|
||||
* @param unit length units
|
||||
* @see customDashPatternUnit()
|
||||
*/
|
||||
void setCustomDashPatternUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for lengths used in the custom dash pattern.
|
||||
* @see setCustomDashPatternUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit customDashPatternUnit() const;
|
||||
|
||||
const QgsMapUnitScale& customDashPatternMapUnitScale() const;
|
||||
void setCustomDashPatternMapUnitScale( const QgsMapUnitScale& scale);
|
||||
@ -71,7 +79,7 @@ class QgsSimpleLineSymbolLayerV2 : QgsLineSymbolLayerV2
|
||||
//Set to true if the line should only be drawn inside the polygon
|
||||
void setDrawInsidePolygon( bool drawInsidePolygon );
|
||||
|
||||
QVector<qreal> dxfCustomDashPattern( QgsSymbolV2::OutputUnit& unit ) const;
|
||||
QVector<qreal> dxfCustomDashPattern( QgsUnitTypes::RenderUnit& unit ) const;
|
||||
Qt::PenStyle dxfPenStyle() const;
|
||||
|
||||
double dxfWidth( const QgsDxfExport& e, QgsSymbolV2RenderContext &context ) const;
|
||||
@ -170,12 +178,17 @@ class QgsMarkerLineSymbolLayerV2 : QgsLineSymbolLayerV2
|
||||
void setRotateMarker( bool rotate );
|
||||
|
||||
/**
|
||||
* The interval between individual markers.
|
||||
* Returns the interval between individual markers. Units are specified through intervalUnits().
|
||||
* @see setInterval()
|
||||
* @see intervalUnit()
|
||||
*/
|
||||
double interval() const;
|
||||
|
||||
/**
|
||||
* The interval between individual markers.
|
||||
* Sets the interval between individual markers.
|
||||
* @param interval interval size. Units are specified through setIntervalUnits()
|
||||
* @see interval()
|
||||
* @see setIntervalUnits()
|
||||
*/
|
||||
void setInterval( double interval );
|
||||
|
||||
@ -219,14 +232,14 @@ class QgsMarkerLineSymbolLayerV2 : QgsLineSymbolLayerV2
|
||||
* @see setOffsetAlongLineUnit
|
||||
* @see offsetAlongLine
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit offsetAlongLineUnit() const;
|
||||
QgsUnitTypes::RenderUnit offsetAlongLineUnit() const;
|
||||
|
||||
/** Sets the unit used for calculating the offset along line for markers.
|
||||
* @param unit Offset along line unit type.
|
||||
* @see offsetAlongLineUnit
|
||||
* @see setOffsetAlongLine
|
||||
*/
|
||||
void setOffsetAlongLineUnit( QgsSymbolV2::OutputUnit unit );
|
||||
void setOffsetAlongLineUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the map unit scale used for calculating the offset in map units along line for markers.
|
||||
* @returns Offset along line map unit scale.
|
||||
@ -238,14 +251,24 @@ class QgsMarkerLineSymbolLayerV2 : QgsLineSymbolLayerV2
|
||||
*/
|
||||
void setOffsetAlongLineMapUnitScale( const QgsMapUnitScale& scale );
|
||||
|
||||
void setIntervalUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit intervalUnit() const;
|
||||
/** Sets the units for the interval between markers.
|
||||
* @param unit interval units
|
||||
* @see intervalUnit()
|
||||
* @see setInterval()
|
||||
*/
|
||||
void setIntervalUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the interval between markers.
|
||||
* @see setIntervalUnit()
|
||||
* @see interval()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit intervalUnit() const;
|
||||
|
||||
void setIntervalMapUnitScale( const QgsMapUnitScale& scale );
|
||||
const QgsMapUnitScale& intervalMapUnitScale() const;
|
||||
|
||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit outputUnit() const;
|
||||
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
||||
QgsUnitTypes::RenderUnit outputUnit() const;
|
||||
|
||||
void setMapUnitScale( const QgsMapUnitScale& scale );
|
||||
QgsMapUnitScale mapUnitScale() const;
|
||||
|
@ -211,8 +211,8 @@ class QgsSimpleMarkerSymbolLayerV2 : QgsSimpleMarkerSymbolLayerBase
|
||||
void writeSldMarker( QDomDocument &doc, QDomElement &element, const QgsStringMap& props ) const;
|
||||
QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const;
|
||||
bool writeDxf( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolV2RenderContext &context, QPointF shift = QPointF( 0.0, 0.0 ) ) const;
|
||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit outputUnit() const;
|
||||
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
||||
QgsUnitTypes::RenderUnit outputUnit() const;
|
||||
void setMapUnitScale( const QgsMapUnitScale& scale );
|
||||
QgsMapUnitScale mapUnitScale() const;
|
||||
QRectF bounds( QPointF point, QgsSymbolV2RenderContext& context );
|
||||
@ -301,14 +301,14 @@ class QgsSimpleMarkerSymbolLayerV2 : QgsSimpleMarkerSymbolLayerBase
|
||||
* @see setOutlineWidth()
|
||||
* @see setOutlineWidthMapUnitScale()
|
||||
*/
|
||||
void setOutlineWidthUnit( QgsSymbolV2::OutputUnit u );
|
||||
void setOutlineWidthUnit( QgsUnitTypes::RenderUnit u );
|
||||
|
||||
/** Returns the unit for the width of the marker's outline.
|
||||
* @see setOutlineWidthUnit()
|
||||
* @see outlineWidth()
|
||||
* @see outlineWidthMapUnitScale()
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit outlineWidthUnit() const;
|
||||
QgsUnitTypes::RenderUnit outlineWidthUnit() const;
|
||||
|
||||
/** Sets the map scale for the width of the marker's outline.
|
||||
* @param scale outline width map unit scale
|
||||
@ -448,14 +448,22 @@ class QgsSvgMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2
|
||||
double outlineWidth() const;
|
||||
void setOutlineWidth( double w );
|
||||
|
||||
void setOutlineWidthUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit outlineWidthUnit() const;
|
||||
/** Sets the units for the outline width.
|
||||
* @param unit width units
|
||||
* @see outlineWidthUnit()
|
||||
*/
|
||||
void setOutlineWidthUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the outline width.
|
||||
* @see outlineWidthUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit outlineWidthUnit() const;
|
||||
|
||||
void setOutlineWidthMapUnitScale( const QgsMapUnitScale& scale);
|
||||
const QgsMapUnitScale& outlineWidthMapUnitScale() const;
|
||||
|
||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit outputUnit() const;
|
||||
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
||||
QgsUnitTypes::RenderUnit outputUnit() const;
|
||||
|
||||
void setMapUnitScale( const QgsMapUnitScale& scale );
|
||||
QgsMapUnitScale mapUnitScale() const;
|
||||
@ -525,10 +533,10 @@ class QgsFontMarkerSymbolLayerV2 : QgsMarkerSymbolLayerV2
|
||||
|
||||
/** Get outline width unit.
|
||||
* @note added in 2.16 */
|
||||
QgsSymbolV2::OutputUnit outlineWidthUnit() const;
|
||||
QgsUnitTypes::RenderUnit outlineWidthUnit() const;
|
||||
/** Set outline width unit.
|
||||
* @note added in 2.16 */
|
||||
void setOutlineWidthUnit( QgsSymbolV2::OutputUnit unit );
|
||||
void setOutlineWidthUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Get outline width map unit scale.
|
||||
* @note added in 2.16 */
|
||||
|
@ -138,14 +138,14 @@ class QgsPointDisplacementRenderer : QgsFeatureRendererV2
|
||||
* @see toleranceUnit()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
void setToleranceUnit( QgsSymbolV2::OutputUnit unit );
|
||||
void setToleranceUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the tolerance distance.
|
||||
* @see tolerance()
|
||||
* @see setToleranceUnit()
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit toleranceUnit() const;
|
||||
QgsUnitTypes::RenderUnit toleranceUnit() const;
|
||||
|
||||
/** Sets the map unit scale object for the distance tolerance. This is only used if the
|
||||
* toleranceUnit() is set to QgsSymbolV2::MapUnit.
|
||||
|
@ -142,8 +142,23 @@ class QgsSymbolLayerV2
|
||||
be affected by data defined symbology rules.*/
|
||||
virtual double estimateMaxBleed() const;
|
||||
|
||||
virtual void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
||||
virtual QgsSymbolV2::OutputUnit outputUnit() const;
|
||||
/** Sets the units to use for sizes and widths within the symbol layer. Individual
|
||||
* symbol layer subclasses will interpret this in different ways, eg a marker symbol
|
||||
* layer may use it to specify the units for the marker size, while a line symbol
|
||||
* layer may use it to specify the units for the line width.
|
||||
* @param unit output units
|
||||
* @see outputUnit()
|
||||
*/
|
||||
virtual void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units to use for sizes and widths within the symbol layer. Individual
|
||||
* symbol layer subclasses will interpret this in different ways, eg a marker symbol
|
||||
* layer may use it to specify the units for the marker size, while a line symbol
|
||||
* layer may use it to specify the units for the line width.
|
||||
* @returns output unit, or QgsUnitTypes::RenderUnknownUnit if the symbol layer contains mixed units
|
||||
* @see setOutputUnit()
|
||||
*/
|
||||
virtual QgsUnitTypes::RenderUnit outputUnit() const;
|
||||
|
||||
virtual void setMapUnitScale( const QgsMapUnitScale& scale );
|
||||
virtual QgsMapUnitScale mapUnitScale() const;
|
||||
@ -264,7 +279,7 @@ class QgsSymbolLayerV2
|
||||
virtual QColor dxfColor( QgsSymbolV2RenderContext& context ) const;
|
||||
virtual double dxfAngle( QgsSymbolV2RenderContext& context ) const;
|
||||
|
||||
virtual QVector<qreal> dxfCustomDashPattern( QgsSymbolV2::OutputUnit& unit ) const;
|
||||
virtual QVector<qreal> dxfCustomDashPattern( QgsUnitTypes::RenderUnit& unit ) const;
|
||||
virtual Qt::PenStyle dxfPenStyle() const;
|
||||
virtual QColor dxfBrushColor( QgsSymbolV2RenderContext& context ) const;
|
||||
virtual Qt::BrushStyle dxfBrushStyle() const;
|
||||
@ -415,14 +430,14 @@ class QgsMarkerSymbolLayerV2 : QgsSymbolLayerV2
|
||||
* @see setSize()
|
||||
* @see setSizeMapUnitScale()
|
||||
*/
|
||||
void setSizeUnit( QgsSymbolV2::OutputUnit unit );
|
||||
void setSizeUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the symbol's size.
|
||||
* @see setSizeUnit()
|
||||
* @see size()
|
||||
* @see sizeMapUnitScale()
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit sizeUnit() const;
|
||||
QgsUnitTypes::RenderUnit sizeUnit() const;
|
||||
|
||||
/** Sets the map unit scale for the symbol's size.
|
||||
* @param scale size map unit scale
|
||||
@ -473,14 +488,14 @@ class QgsMarkerSymbolLayerV2 : QgsSymbolLayerV2
|
||||
* @see setOffset()
|
||||
* @see setOffsetMapUnitScale()
|
||||
*/
|
||||
void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
|
||||
void setOffsetUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the symbol's offset.
|
||||
* @see setOffsetUnit()
|
||||
* @see offset()
|
||||
* @see offsetMapUnitScale()
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit offsetUnit() const;
|
||||
QgsUnitTypes::RenderUnit offsetUnit() const;
|
||||
|
||||
/** Sets the map unit scale for the symbol's offset.
|
||||
* @param scale offset map unit scale
|
||||
@ -536,8 +551,8 @@ class QgsMarkerSymbolLayerV2 : QgsSymbolLayerV2
|
||||
*/
|
||||
virtual void writeSldMarker( QDomDocument &doc, QDomElement &element, const QgsStringMap& props ) const;
|
||||
|
||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit outputUnit() const;
|
||||
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
||||
QgsUnitTypes::RenderUnit outputUnit() const;
|
||||
|
||||
void setMapUnitScale( const QgsMapUnitScale& scale );
|
||||
QgsMapUnitScale mapUnitScale() const;
|
||||
@ -579,7 +594,7 @@ class QgsMarkerSymbolLayerV2 : QgsSymbolLayerV2
|
||||
|
||||
//! @note available in python bindings as markerOffset2
|
||||
void markerOffset( QgsSymbolV2RenderContext& context, double width, double height,
|
||||
QgsSymbolV2::OutputUnit widthUnit, QgsSymbolV2::OutputUnit heightUnit,
|
||||
QgsUnitTypes::RenderUnit widthUnit, QgsUnitTypes::RenderUnit heightUnit,
|
||||
double& offsetX, double& offsetY,
|
||||
const QgsMapUnitScale &widthMapUnitScale, const QgsMapUnitScale &heightMapUnitScale ) const /PyName=markerOffset2/;
|
||||
|
||||
@ -608,20 +623,36 @@ class QgsLineSymbolLayerV2 : QgsSymbolLayerV2
|
||||
double offset() const;
|
||||
void setOffset( double offset );
|
||||
|
||||
void setWidthUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit widthUnit() const;
|
||||
/** Sets the units for the line's width.
|
||||
* @param unit width units
|
||||
* @see widthUnit()
|
||||
*/
|
||||
void setWidthUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the line's width.
|
||||
* @see setWidthUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit widthUnit() const;
|
||||
|
||||
void setWidthMapUnitScale( const QgsMapUnitScale& scale);
|
||||
const QgsMapUnitScale& widthMapUnitScale() const;
|
||||
|
||||
void setOffsetUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit offsetUnit() const;
|
||||
/** Sets the units for the line's offset.
|
||||
* @param unit offset units
|
||||
* @see offsetUnit()
|
||||
*/
|
||||
void setOffsetUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the line's offset.
|
||||
* @see setOffsetUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit offsetUnit() const;
|
||||
|
||||
void setOffsetMapUnitScale( const QgsMapUnitScale& scale );
|
||||
const QgsMapUnitScale& offsetMapUnitScale() const;
|
||||
|
||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit outputUnit() const;
|
||||
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
||||
QgsUnitTypes::RenderUnit outputUnit() const;
|
||||
|
||||
void setMapUnitScale( const QgsMapUnitScale& scale );
|
||||
QgsMapUnitScale mapUnitScale() const;
|
||||
|
@ -51,11 +51,21 @@ class QgsSymbolLayerV2Utils
|
||||
static QString encodeSldRealVector( const QVector<qreal>& v );
|
||||
static QVector<qreal> decodeSldRealVector( const QString& s );
|
||||
|
||||
static QString encodeOutputUnit( QgsSymbolV2::OutputUnit unit );
|
||||
static QgsSymbolV2::OutputUnit decodeOutputUnit( const QString& str );
|
||||
/** Encodes a render unit into an SLD unit of measure string.
|
||||
* @param unit unit to encode
|
||||
* @param scaleFactor if specified, will be set to scale factor for unit of measure
|
||||
* @returns encoded string
|
||||
* @see decodeSldUom()
|
||||
*/
|
||||
static QString encodeSldUom( QgsUnitTypes::RenderUnit unit, double *scaleFactor );
|
||||
|
||||
static QString encodeSldUom( QgsSymbolV2::OutputUnit unit, double *scaleFactor );
|
||||
static QgsSymbolV2::OutputUnit decodeSldUom( const QString& str, double *scaleFactor );
|
||||
/** Decodes a SLD unit of measure string to a render unit.
|
||||
* @param str string to decode
|
||||
* @param scaleFactor if specified, will be set to scale factor for unit of measure
|
||||
* @returns matching render unit
|
||||
* @see encodeSldUom()
|
||||
*/
|
||||
static QgsUnitTypes::RenderUnit decodeSldUom( const QString& str, double *scaleFactor );
|
||||
|
||||
static QString encodeScaleMethod( QgsSymbolV2::ScaleMethod scaleMethod );
|
||||
static QgsSymbolV2::ScaleMethod decodeScaleMethod( const QString& str );
|
||||
@ -71,10 +81,20 @@ class QgsSymbolLayerV2Utils
|
||||
* @param scale map unit scale for preview
|
||||
* @returns QPicture containing symbol layer preview
|
||||
* @note added in QGIS 2.9
|
||||
* @see symbolLayerPreviewIcon()
|
||||
*/
|
||||
static QPicture symbolLayerPreviewPicture( QgsSymbolLayerV2* layer, QgsSymbolV2::OutputUnit units, QSize size, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
static QPicture symbolLayerPreviewPicture( QgsSymbolLayerV2* layer, QgsUnitTypes::RenderUnit units, QSize size, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
|
||||
/** Draws a symbol layer preview to an icon.
|
||||
* @param layer symbol layer to draw
|
||||
* @param u size units
|
||||
* @param size target size of preview icon
|
||||
* @param scale map unit scale for preview
|
||||
* @returns icon containing symbol layer preview
|
||||
* @see symbolLayerPreviewPicture()
|
||||
*/
|
||||
static QIcon symbolLayerPreviewIcon( QgsSymbolLayerV2* layer, QgsUnitTypes::RenderUnit u, QSize size, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
|
||||
static QIcon symbolLayerPreviewIcon( QgsSymbolLayerV2* layer, QgsSymbolV2::OutputUnit u, QSize size, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
static QIcon colorRampPreviewIcon( QgsVectorColorRampV2* ramp, QSize size );
|
||||
|
||||
static void drawStippledBackground( QPainter* painter, QRect rect );
|
||||
@ -327,7 +347,7 @@ class QgsSymbolLayerV2Utils
|
||||
* @param scale map unit scale, specifying limits for the map units to convert from
|
||||
* @see convertToPainterUnits()
|
||||
*/
|
||||
static double lineWidthScaleFactor( const QgsRenderContext& c, QgsSymbolV2::OutputUnit u, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
static double lineWidthScaleFactor( const QgsRenderContext& c, QgsUnitTypes::RenderUnit u, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
|
||||
/** Converts a size from the specied units to painter units. The conversion respects the limits
|
||||
* specified by the optional scale parameter.
|
||||
@ -339,7 +359,7 @@ class QgsSymbolLayerV2Utils
|
||||
* @see lineWidthScaleFactor()
|
||||
* @see convertToMapUnits()
|
||||
*/
|
||||
static double convertToPainterUnits( const QgsRenderContext&c, double size, QgsSymbolV2::OutputUnit unit, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
static double convertToPainterUnits( const QgsRenderContext&c, double size, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
|
||||
/** Converts a size from the specied units to map units. The conversion respects the limits
|
||||
* specified by the optional scale parameter.
|
||||
@ -350,13 +370,13 @@ class QgsSymbolLayerV2Utils
|
||||
* @note added in QGIS 2.16
|
||||
* @see convertToPainterUnits()
|
||||
*/
|
||||
static double convertToMapUnits( const QgsRenderContext&c, double size, QgsSymbolV2::OutputUnit unit, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
static double convertToMapUnits( const QgsRenderContext&c, double size, QgsUnitTypes::RenderUnit unit, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
|
||||
/** Returns scale factor painter units -> pixel dimensions*/
|
||||
static double pixelSizeScaleFactor( const QgsRenderContext& c, QgsSymbolV2::OutputUnit u, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
static double pixelSizeScaleFactor( const QgsRenderContext& c, QgsUnitTypes::RenderUnit u, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
|
||||
/** Returns scale factor painter units -> map units*/
|
||||
static double mapUnitScaleFactor( const QgsRenderContext& c, QgsSymbolV2::OutputUnit u, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
static double mapUnitScaleFactor( const QgsRenderContext& c, QgsUnitTypes::RenderUnit u, const QgsMapUnitScale& scale = QgsMapUnitScale() );
|
||||
|
||||
/** Creates a render context for a pixel based device*/
|
||||
static QgsRenderContext createRenderContext( QPainter* p );
|
||||
|
@ -19,21 +19,6 @@ class QgsSymbolV2
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* The unit of the output
|
||||
*/
|
||||
//TODO QGIS 3.0 - move to QgsUnitTypes and rename to SymbolUnit
|
||||
enum OutputUnit
|
||||
{
|
||||
MM = 0, //!< The output shall be in millimeters
|
||||
MapUnit, //!< The output shall be in map unitx
|
||||
Mixed, //!< Mixed units in symbol layers
|
||||
Pixel, //!< The output shall be in pixels
|
||||
Percentage, //!< The ouput shall be a percentage of another measurement (eg canvas size, feature size)
|
||||
};
|
||||
|
||||
typedef QList<QgsSymbolV2::OutputUnit> OutputUnitList;
|
||||
|
||||
/**
|
||||
* Type of the symbol
|
||||
*/
|
||||
@ -154,8 +139,23 @@ class QgsSymbolV2
|
||||
|
||||
void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;
|
||||
|
||||
OutputUnit outputUnit() const;
|
||||
void setOutputUnit( OutputUnit u );
|
||||
/** Returns the units to use for sizes and widths within the symbol. Individual
|
||||
* symbol layer definitions will interpret this in different ways, eg a marker symbol
|
||||
* may use it to specify the units for the marker size, while a line symbol
|
||||
* may use it to specify the units for the line width.
|
||||
* @returns output unit, or QgsUnitTypes::RenderUnknownUnit if the symbol contains mixed units
|
||||
* @see setOutputUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit outputUnit() const;
|
||||
|
||||
/** Sets the units to use for sizes and widths within the symbol. Individual
|
||||
* symbol definitions will interpret this in different ways, eg a marker symbol
|
||||
* may use it to specify the units for the marker size, while a line symbol
|
||||
* may use it to specify the units for the line width.
|
||||
* @param unit output units
|
||||
* @see outputUnit()
|
||||
*/
|
||||
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
QgsMapUnitScale mapUnitScale() const;
|
||||
void setMapUnitScale( const QgsMapUnitScale& scale );
|
||||
@ -281,7 +281,18 @@ class QgsSymbolV2RenderContext
|
||||
%End
|
||||
|
||||
public:
|
||||
QgsSymbolV2RenderContext( QgsRenderContext& c, QgsSymbolV2::OutputUnit u, qreal alpha = 1.0, bool selected = false, int renderHints = 0, const QgsFeature* f = 0, const QgsFields* fields = 0, const QgsMapUnitScale& mapUnitScale = QgsMapUnitScale() );
|
||||
|
||||
/** Constructor for QgsSymbolV2RenderContext
|
||||
* @param c
|
||||
* @param u
|
||||
* @param alpha
|
||||
* @param selected set to true if symbol should be drawn in a "selected" state
|
||||
* @param renderHints
|
||||
* @param f
|
||||
* @param fields
|
||||
* @param mapUnitScale
|
||||
*/
|
||||
QgsSymbolV2RenderContext( QgsRenderContext& c, QgsUnitTypes::RenderUnit u, qreal alpha = 1.0, bool selected = false, int renderHints = 0, const QgsFeature* f = 0, const QgsFields* fields = 0, const QgsMapUnitScale& mapUnitScale = QgsMapUnitScale() );
|
||||
~QgsSymbolV2RenderContext();
|
||||
|
||||
QgsRenderContext& renderContext();
|
||||
@ -294,8 +305,11 @@ class QgsSymbolV2RenderContext
|
||||
*/
|
||||
void setOriginalValueVariable( const QVariant& value );
|
||||
|
||||
QgsSymbolV2::OutputUnit outputUnit() const;
|
||||
void setOutputUnit( QgsSymbolV2::OutputUnit u );
|
||||
//! Returns the output unit for the context
|
||||
QgsUnitTypes::RenderUnit outputUnit() const;
|
||||
|
||||
//! Sets the output unit for the context
|
||||
void setOutputUnit( QgsUnitTypes::RenderUnit u );
|
||||
|
||||
QgsMapUnitScale mapUnitScale() const;
|
||||
void setMapUnitScale( const QgsMapUnitScale& scale );
|
||||
@ -447,7 +461,7 @@ class QgsMarkerSymbolV2 : QgsSymbolV2
|
||||
* @see setSizeMapUnitScale()
|
||||
* @see setSize()
|
||||
*/
|
||||
void setSizeUnit( OutputUnit unit );
|
||||
void setSizeUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the size units for the whole symbol (including all symbol layers).
|
||||
* @returns size units, or mixed units if symbol layers have different units
|
||||
@ -456,7 +470,7 @@ class QgsMarkerSymbolV2 : QgsSymbolV2
|
||||
* @see sizeMapUnitScale()
|
||||
* @see size()
|
||||
*/
|
||||
OutputUnit sizeUnit() const;
|
||||
QgsUnitTypes::RenderUnit sizeUnit() const;
|
||||
|
||||
/** Sets the size map unit scale for the whole symbol (including all symbol layers).
|
||||
* @param scale map unit scale
|
||||
|
@ -64,14 +64,22 @@ class QgsVectorFieldSymbolLayer : QgsMarkerSymbolLayerV2
|
||||
void setAngleUnits( AngleUnits units );
|
||||
AngleUnits angleUnits() const;
|
||||
|
||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit outputUnit() const;
|
||||
void setOutputUnit( QgsUnitTypes::RenderUnit unit );
|
||||
QgsUnitTypes::RenderUnit outputUnit() const;
|
||||
|
||||
void setMapUnitScale( const QgsMapUnitScale& scale );
|
||||
QgsMapUnitScale mapUnitScale() const;
|
||||
|
||||
void setDistanceUnit( QgsSymbolV2::OutputUnit unit );
|
||||
QgsSymbolV2::OutputUnit distanceUnit() const;
|
||||
/** Sets the units for the distance.
|
||||
* @param unit distance units
|
||||
* @see distanceUnit()
|
||||
*/
|
||||
void setDistanceUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the units for the distance.
|
||||
* @see setDistanceUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit distanceUnit() const;
|
||||
|
||||
void setDistanceMapUnitScale( const QgsMapUnitScale& scale );
|
||||
const QgsMapUnitScale& distanceMapUnitScale() const;
|
||||
|
@ -223,10 +223,10 @@ class QgsMapCanvas : QGraphicsView
|
||||
bool isFrozen();
|
||||
|
||||
//! Set map units (needed by project properties dialog)
|
||||
void setMapUnits( Qgis::UnitType mapUnits );
|
||||
void setMapUnits( QgsUnitTypes::DistanceUnit mapUnits );
|
||||
|
||||
//! Get the current canvas map units
|
||||
Qgis::UnitType mapUnits() const;
|
||||
QgsUnitTypes::DistanceUnit mapUnits() const;
|
||||
|
||||
//! Getter for stored overrides of styles for layers.
|
||||
//! @note added in 2.12
|
||||
|
@ -114,18 +114,18 @@ class QgsMapToolIdentify : QgsMapTool
|
||||
|
||||
//! Private helper
|
||||
//! @deprecated use displayDistanceUnits() and displayAreaUnits() instead
|
||||
virtual void convertMeasurement( QgsDistanceArea &calc, double &measure, Qgis::UnitType &u, bool isArea ) /Deprecated/;
|
||||
virtual void convertMeasurement( QgsDistanceArea &calc, double &measure, QgsUnitTypes::DistanceUnit &u, bool isArea ) /Deprecated/;
|
||||
|
||||
/** Transforms the measurements of derived attributes in the desired units
|
||||
* @deprecated use displayDistanceUnits() and displayAreaUnits() instead
|
||||
*/
|
||||
virtual Qgis::UnitType displayUnits() /Deprecated/;
|
||||
virtual QgsUnitTypes::DistanceUnit displayUnits() /Deprecated/;
|
||||
|
||||
/** Desired units for distance display.
|
||||
* @note added in QGIS 2.14
|
||||
* @see displayAreaUnits()
|
||||
*/
|
||||
virtual Qgis::UnitType displayDistanceUnits() const;
|
||||
virtual QgsUnitTypes::DistanceUnit displayDistanceUnits() const;
|
||||
|
||||
/** Desired units for area display.
|
||||
* @note added in QGIS 2.14
|
||||
|
@ -43,7 +43,7 @@ class QgsUnitSelectionWidget : QWidget
|
||||
* @param units list of valid units
|
||||
* @note added in QGIS 2.9
|
||||
*/
|
||||
void setUnits( const QgsSymbolV2::OutputUnitList& units );
|
||||
void setUnits( const QgsUnitTypes::RenderUnitList& units );
|
||||
|
||||
/** Get the selected unit index */
|
||||
int getUnit() const;
|
||||
@ -52,7 +52,7 @@ class QgsUnitSelectionWidget : QWidget
|
||||
* @returns selected output unit, or QgsSymbolV2::Mixed if the widget was populated with custom unit types
|
||||
* @note added in QGIS 2.9
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit unit() const;
|
||||
QgsUnitTypes::RenderUnit unit() const;
|
||||
|
||||
/** Sets the selected unit index
|
||||
* @param unitIndex index of unit to set as current
|
||||
@ -63,7 +63,7 @@ class QgsUnitSelectionWidget : QWidget
|
||||
/** Sets the selected unit
|
||||
* @param unit predefined unit to set as current
|
||||
*/
|
||||
void setUnit( QgsSymbolV2::OutputUnit unit );
|
||||
void setUnit( QgsUnitTypes::RenderUnit unit );
|
||||
|
||||
/** Returns the map unit scale */
|
||||
QgsMapUnitScale getMapUnitScale() const;
|
||||
|
@ -74,8 +74,15 @@ class QgsMapRenderer : QObject
|
||||
//! Recalculate the map scale
|
||||
void updateScale();
|
||||
|
||||
Qgis::UnitType mapUnits() const;
|
||||
void setMapUnits( Qgis::UnitType u );
|
||||
/** Returns the distance units which are used for map units.
|
||||
* @see setMapUnits()
|
||||
*/
|
||||
QgsUnitTypes::DistanceUnit mapUnits() const;
|
||||
|
||||
/** Sets the distance units which will be used for map units.
|
||||
* @see mapUnits()
|
||||
*/
|
||||
void setMapUnits( QgsUnitTypes::DistanceUnit u );
|
||||
|
||||
//! sets whether map image will be for overview
|
||||
void enableOverviewMode( bool isOverview = true );
|
||||
|
@ -181,7 +181,7 @@ int QgsTransectSample::createSample( QProgressDialog* pd )
|
||||
double minDistanceLayerUnits = minDistance;
|
||||
//if minDistance is in meters and the data in degrees, we need to apply a rough conversion for the buffer distance
|
||||
double bufferDist = bufferDistance( minDistance );
|
||||
if ( mMinDistanceUnits == Meters && mStrataLayer->crs().mapUnits() == Qgis::DecimalDegrees )
|
||||
if ( mMinDistanceUnits == Meters && mStrataLayer->crs().mapUnits() == QgsUnitTypes::DistanceDegrees )
|
||||
{
|
||||
minDistanceLayerUnits = minDistance / 111319.9;
|
||||
}
|
||||
@ -710,7 +710,7 @@ double QgsTransectSample::bufferDistance( double minDistanceFromAttribute ) cons
|
||||
bufferDist = mBaselineBufferDistance;
|
||||
}
|
||||
|
||||
if ( mMinDistanceUnits == Meters && mStrataLayer->crs().mapUnits() == Qgis::DecimalDegrees )
|
||||
if ( mMinDistanceUnits == Meters && mStrataLayer->crs().mapUnits() == QgsUnitTypes::DistanceDegrees )
|
||||
{
|
||||
bufferDist /= 111319.9;
|
||||
}
|
||||
|
@ -4419,7 +4419,7 @@ void QgisApp::fileNew( bool thePromptToSaveFlag, bool forceBlank )
|
||||
prj->writeEntry( "SpatialRefSys", "/ProjectCrs", srs.authid() );
|
||||
prj->writeEntry( "SpatialRefSys", "/ProjectCRSID", static_cast< int >( srs.srsid() ) );
|
||||
prj->setDirty( false );
|
||||
if ( srs.mapUnits() != Qgis::UnknownUnit )
|
||||
if ( srs.mapUnits() != QgsUnitTypes::DistanceUnknownUnit )
|
||||
{
|
||||
mMapCanvas->setMapUnits( srs.mapUnits() );
|
||||
}
|
||||
@ -8507,7 +8507,7 @@ void QgisApp::setProjectCrsFromLayer()
|
||||
QgsCoordinateReferenceSystem crs = mLayerTreeView->currentLayer()->crs();
|
||||
mMapCanvas->freeze();
|
||||
mMapCanvas->setDestinationCrs( crs );
|
||||
if ( crs.mapUnits() != Qgis::UnknownUnit )
|
||||
if ( crs.mapUnits() != QgsUnitTypes::DistanceUnknownUnit )
|
||||
{
|
||||
mMapCanvas->setMapUnits( crs.mapUnits() );
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ QgsDecorationCopyright::QgsDecorationCopyright( QObject* parent )
|
||||
, mMarginVertical( 0 )
|
||||
{
|
||||
mPlacement = BottomRight;
|
||||
mMarginUnit = QgsSymbolV2::MM;
|
||||
mMarginUnit = QgsUnitTypes::RenderMillimeters;
|
||||
|
||||
setName( "Copyright Label" );
|
||||
// initialise default values in the gui
|
||||
@ -116,7 +116,7 @@ void QgsDecorationCopyright::render( QPainter * theQPainter )
|
||||
// Set margin according to selected units
|
||||
switch ( mMarginUnit )
|
||||
{
|
||||
case QgsSymbolV2::MM:
|
||||
case QgsUnitTypes::RenderMillimeters:
|
||||
{
|
||||
int myPixelsInchX = theQPainter->device()->logicalDpiX();
|
||||
int myPixelsInchY = theQPainter->device()->logicalDpiY();
|
||||
@ -125,12 +125,12 @@ void QgsDecorationCopyright::render( QPainter * theQPainter )
|
||||
break;
|
||||
}
|
||||
|
||||
case QgsSymbolV2::Pixel:
|
||||
case QgsUnitTypes::RenderPixels:
|
||||
myXOffset = mMarginHorizontal;
|
||||
myYOffset = mMarginVertical;
|
||||
break;
|
||||
|
||||
case QgsSymbolV2::Percentage:
|
||||
case QgsUnitTypes::RenderPercentage:
|
||||
myXOffset = (( myWidth - size.width() ) / 100. ) * mMarginHorizontal;
|
||||
myYOffset = (( myHeight - size.height() ) / 100. ) * mMarginVertical;
|
||||
break;
|
||||
|
@ -46,7 +46,7 @@ QgsDecorationCopyrightDialog::QgsDecorationCopyrightDialog( QgsDecorationCopyrig
|
||||
cboPlacement->setCurrentIndex( cboPlacement->findData( mDeco.placement() ) );
|
||||
spnHorizontal->setValue( mDeco.mMarginHorizontal );
|
||||
spnVertical->setValue( mDeco.mMarginVertical );
|
||||
wgtUnitSelection->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::Percentage << QgsSymbolV2::Pixel );
|
||||
wgtUnitSelection->setUnits( QgsUnitTypes::RenderUnitList() << QgsUnitTypes::RenderMillimeters << QgsUnitTypes::RenderPercentage << QgsUnitTypes::RenderPixels );
|
||||
wgtUnitSelection->setUnit( mDeco.mMarginUnit );
|
||||
|
||||
// color
|
||||
|
@ -93,8 +93,8 @@ void QgsDecorationGrid::projectRead()
|
||||
QgsDecorationItem::projectRead();
|
||||
|
||||
mEnabled = QgsProject::instance()->readBoolEntry( mNameConfig, "/Enabled", false );
|
||||
mMapUnits = static_cast< Qgis::UnitType >( QgsProject::instance()->readNumEntry( mNameConfig, "/MapUnits",
|
||||
Qgis::UnknownUnit ) );
|
||||
mMapUnits = static_cast< QgsUnitTypes::DistanceUnit >( QgsProject::instance()->readNumEntry( mNameConfig, "/MapUnits",
|
||||
QgsUnitTypes::DistanceUnknownUnit ) );
|
||||
mGridStyle = static_cast< GridStyle >( QgsProject::instance()->readNumEntry( mNameConfig, "/Style",
|
||||
QgsDecorationGrid::Line ) );
|
||||
mGridIntervalX = QgsProject::instance()->readDoubleEntry( mNameConfig, "/IntervalX", 10 );
|
||||
@ -747,11 +747,11 @@ void QgsDecorationGrid::checkMapUnitsChanged()
|
||||
// this is to avoid problems when CRS changes to/from geographic and projected
|
||||
// a better solution would be to change the grid interval, but this is a little tricky
|
||||
// note: we could be less picky (e.g. from degrees to DMS)
|
||||
Qgis::UnitType mapUnits = QgisApp::instance()->mapCanvas()->mapSettings().mapUnits();
|
||||
QgsUnitTypes::DistanceUnit mapUnits = QgisApp::instance()->mapCanvas()->mapSettings().mapUnits();
|
||||
if ( mEnabled && ( mMapUnits != mapUnits ) )
|
||||
{
|
||||
mEnabled = false;
|
||||
mMapUnits = Qgis::UnknownUnit; // make sure isDirty() returns true
|
||||
mMapUnits = QgsUnitTypes::DistanceUnknownUnit; // make sure isDirty() returns true
|
||||
if ( ! QgisApp::instance()->mapCanvas()->isFrozen() )
|
||||
{
|
||||
update();
|
||||
@ -763,7 +763,7 @@ bool QgsDecorationGrid::isDirty()
|
||||
{
|
||||
// checks if stored map units is undefined or different from canvas map units
|
||||
// or if interval is 0
|
||||
if ( mMapUnits == Qgis::UnknownUnit ||
|
||||
if ( mMapUnits == QgsUnitTypes::DistanceUnknownUnit ||
|
||||
mMapUnits != QgisApp::instance()->mapCanvas()->mapSettings().mapUnits() ||
|
||||
qgsDoubleNear( mGridIntervalX, 0.0 ) || qgsDoubleNear( mGridIntervalY, 0.0 ) )
|
||||
return true;
|
||||
@ -774,7 +774,7 @@ void QgsDecorationGrid::setDirty( bool dirty )
|
||||
{
|
||||
if ( dirty )
|
||||
{
|
||||
mMapUnits = Qgis::UnknownUnit;
|
||||
mMapUnits = QgsUnitTypes::DistanceUnknownUnit;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -124,8 +124,8 @@ class APP_EXPORT QgsDecorationGrid: public QgsDecorationItem
|
||||
const QgsMarkerSymbolV2* markerSymbol() const { return mMarkerSymbol; }
|
||||
|
||||
/** Sets map unit type */
|
||||
void setMapUnits( Qgis::UnitType t ) { mMapUnits = t; }
|
||||
Qgis::UnitType mapUnits() { return mMapUnits; }
|
||||
void setMapUnits( QgsUnitTypes::DistanceUnit t ) { mMapUnits = t; }
|
||||
QgsUnitTypes::DistanceUnit mapUnits() { return mMapUnits; }
|
||||
|
||||
/** Set mapUnits value */
|
||||
void setDirty( bool dirty = true );
|
||||
@ -193,7 +193,7 @@ class APP_EXPORT QgsDecorationGrid: public QgsDecorationItem
|
||||
QgsLineSymbolV2* mLineSymbol;
|
||||
QgsMarkerSymbolV2* mMarkerSymbol;
|
||||
|
||||
Qgis::UnitType mMapUnits;
|
||||
QgsUnitTypes::DistanceUnit mMapUnits;
|
||||
|
||||
/** Draw coordinates for mGridAnnotationType Coordinate
|
||||
@param p drawing painter
|
||||
|
@ -47,7 +47,7 @@ QgsDecorationItem::QgsDecorationItem( QObject* parent )
|
||||
: QObject( parent )
|
||||
, mEnabled( false )
|
||||
, mPlacement( TopLeft )
|
||||
, mMarginUnit( QgsSymbolV2::MM )
|
||||
, mMarginUnit( QgsUnitTypes::RenderMillimeters )
|
||||
{
|
||||
}
|
||||
|
||||
@ -66,14 +66,14 @@ void QgsDecorationItem::projectRead()
|
||||
{
|
||||
mEnabled = QgsProject::instance()->readBoolEntry( mNameConfig, "/Enabled", false );
|
||||
mPlacement = static_cast< Placement >( QgsProject::instance()->readNumEntry( mNameConfig, "/Placement", static_cast< int >( mPlacement ) ) );
|
||||
mMarginUnit = QgsSymbolLayerV2Utils::decodeOutputUnit( QgsProject::instance()->readEntry( mNameConfig, "/MarginUnit", QgsSymbolLayerV2Utils::encodeOutputUnit( mMarginUnit ) ) );
|
||||
mMarginUnit = QgsUnitTypes::decodeRenderUnit( QgsProject::instance()->readEntry( mNameConfig, "/MarginUnit", QgsUnitTypes::encodeUnit( mMarginUnit ) ) );
|
||||
}
|
||||
|
||||
void QgsDecorationItem::saveToProject()
|
||||
{
|
||||
QgsProject::instance()->writeEntry( mNameConfig, "/Enabled", mEnabled );
|
||||
QgsProject::instance()->writeEntry( mNameConfig, "/Placement", static_cast< int >( mPlacement ) );
|
||||
QgsProject::instance()->writeEntry( mNameConfig, "/MarginUnit", QgsSymbolLayerV2Utils::encodeOutputUnit( mMarginUnit ) );
|
||||
QgsProject::instance()->writeEntry( mNameConfig, "/MarginUnit", QgsUnitTypes::encodeUnit( mMarginUnit ) );
|
||||
}
|
||||
|
||||
void QgsDecorationItem::setName( const char *name )
|
||||
|
@ -19,7 +19,7 @@
|
||||
#define QGSDECORATIONITEM_H
|
||||
|
||||
#include <QObject>
|
||||
#include "qgssymbolv2.h"
|
||||
#include "qgsunittypes.h"
|
||||
|
||||
class QPainter;
|
||||
|
||||
@ -85,7 +85,7 @@ class APP_EXPORT QgsDecorationItem: public QObject
|
||||
//! Placement of the decoration
|
||||
Placement mPlacement;
|
||||
//! Units used for the decoration placement margin
|
||||
QgsSymbolV2::OutputUnit mMarginUnit;
|
||||
QgsUnitTypes::RenderUnit mMarginUnit;
|
||||
|
||||
QString mName;
|
||||
QString mNameConfig;
|
||||
|
@ -62,7 +62,7 @@ QgsDecorationNorthArrow::QgsDecorationNorthArrow( QObject* parent )
|
||||
, mMarginVertical( 0 )
|
||||
{
|
||||
mPlacement = BottomLeft;
|
||||
mMarginUnit = QgsSymbolV2::MM;
|
||||
mMarginUnit = QgsUnitTypes::RenderMillimeters;
|
||||
|
||||
setName( "North Arrow" );
|
||||
projectRead();
|
||||
@ -145,7 +145,7 @@ void QgsDecorationNorthArrow::render( QPainter * theQPainter )
|
||||
int myYOffset = 0;
|
||||
switch ( mMarginUnit )
|
||||
{
|
||||
case QgsSymbolV2::MM:
|
||||
case QgsUnitTypes::RenderMillimeters:
|
||||
{
|
||||
int myPixelsInchX = theQPainter->device()->logicalDpiX();
|
||||
int myPixelsInchY = theQPainter->device()->logicalDpiY();
|
||||
@ -154,12 +154,12 @@ void QgsDecorationNorthArrow::render( QPainter * theQPainter )
|
||||
break;
|
||||
}
|
||||
|
||||
case QgsSymbolV2::Pixel:
|
||||
case QgsUnitTypes::RenderPixels:
|
||||
myXOffset = mMarginHorizontal - 5; // Minus 5 to shift tight into corner
|
||||
myYOffset = mMarginVertical - 5;
|
||||
break;
|
||||
|
||||
case QgsSymbolV2::Percentage:
|
||||
case QgsUnitTypes::RenderPercentage:
|
||||
myXOffset = (( myWidth - myQPixmap.width() ) / 100. ) * mMarginHorizontal;
|
||||
myYOffset = (( myHeight - myQPixmap.height() ) / 100. ) * mMarginVertical;
|
||||
break;
|
||||
|
@ -47,7 +47,7 @@ QgsDecorationNorthArrowDialog::QgsDecorationNorthArrowDialog( QgsDecorationNorth
|
||||
cboPlacement->setCurrentIndex( cboPlacement->findData( mDeco.placement() ) );
|
||||
spinHorizontal->setValue( mDeco.mMarginHorizontal );
|
||||
spinVertical->setValue( mDeco.mMarginVertical );
|
||||
wgtUnitSelection->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::Percentage << QgsSymbolV2::Pixel );
|
||||
wgtUnitSelection->setUnits( QgsUnitTypes::RenderUnitList() << QgsUnitTypes::RenderMillimeters << QgsUnitTypes::RenderPercentage << QgsUnitTypes::RenderPixels );
|
||||
wgtUnitSelection->setUnit( mDeco.mMarginUnit );
|
||||
|
||||
// enabled
|
||||
|
@ -55,7 +55,7 @@ QgsDecorationScaleBar::QgsDecorationScaleBar( QObject* parent )
|
||||
, mMarginVertical( 0 )
|
||||
{
|
||||
mPlacement = TopLeft;
|
||||
mMarginUnit = QgsSymbolV2::MM;
|
||||
mMarginUnit = QgsUnitTypes::RenderMillimeters;
|
||||
mStyleLabels << tr( "Tick Down" ) << tr( "Tick Up" )
|
||||
<< tr( "Bar" ) << tr( "Box" );
|
||||
|
||||
@ -133,10 +133,10 @@ void QgsDecorationScaleBar::render( QPainter * theQPainter )
|
||||
|
||||
QSettings settings;
|
||||
bool ok = false;
|
||||
Qgis::UnitType myPreferredUnits = QgsUnitTypes::decodeDistanceUnit( settings.value( "/qgis/measure/displayunits" ).toString(), &ok );
|
||||
QgsUnitTypes::DistanceUnit myPreferredUnits = QgsUnitTypes::decodeDistanceUnit( settings.value( "/qgis/measure/displayunits" ).toString(), &ok );
|
||||
if ( !ok )
|
||||
myPreferredUnits = Qgis::Meters;
|
||||
Qgis::UnitType myMapUnits = canvas->mapUnits();
|
||||
myPreferredUnits = QgsUnitTypes::DistanceMeters;
|
||||
QgsUnitTypes::DistanceUnit myMapUnits = canvas->mapUnits();
|
||||
|
||||
// Adjust units meter/feet/... or vice versa
|
||||
myMapUnitsPerPixelDouble *= QgsUnitTypes::fromUnitToUnitFactor( myMapUnits, myPreferredUnits );
|
||||
@ -175,7 +175,7 @@ void QgsDecorationScaleBar::render( QPainter * theQPainter )
|
||||
QString myScaleBarUnitLabel;
|
||||
switch ( myMapUnits )
|
||||
{
|
||||
case Qgis::Meters:
|
||||
case QgsUnitTypes::DistanceMeters:
|
||||
if ( myActualSize > 1000.0 )
|
||||
{
|
||||
myScaleBarUnitLabel = tr( " km" );
|
||||
@ -194,7 +194,7 @@ void QgsDecorationScaleBar::render( QPainter * theQPainter )
|
||||
else
|
||||
myScaleBarUnitLabel = tr( " m" );
|
||||
break;
|
||||
case Qgis::Feet:
|
||||
case QgsUnitTypes::DistanceFeet:
|
||||
if ( myActualSize > 5280.0 ) //5280 feet to the mile
|
||||
{
|
||||
myScaleBarUnitLabel = tr( " miles" );
|
||||
@ -224,13 +224,13 @@ void QgsDecorationScaleBar::render( QPainter * theQPainter )
|
||||
myScaleBarUnitLabel = tr( " feet" );
|
||||
}
|
||||
break;
|
||||
case Qgis::Degrees:
|
||||
case QgsUnitTypes::DistanceDegrees:
|
||||
if ( myActualSize == 1.0 )
|
||||
myScaleBarUnitLabel = tr( " degree" );
|
||||
else
|
||||
myScaleBarUnitLabel = tr( " degrees" );
|
||||
break;
|
||||
case Qgis::UnknownUnit:
|
||||
case QgsUnitTypes::DistanceUnknownUnit:
|
||||
myScaleBarUnitLabel = tr( " unknown" );
|
||||
//intentional fall-through
|
||||
FALLTHROUGH;
|
||||
@ -260,7 +260,7 @@ void QgsDecorationScaleBar::render( QPainter * theQPainter )
|
||||
// Set margin according to selected units
|
||||
switch ( mMarginUnit )
|
||||
{
|
||||
case QgsSymbolV2::MM:
|
||||
case QgsUnitTypes::RenderMillimeters:
|
||||
{
|
||||
int myPixelsInchX = theQPainter->device()->logicalDpiX();
|
||||
int myPixelsInchY = theQPainter->device()->logicalDpiY();
|
||||
@ -269,12 +269,12 @@ void QgsDecorationScaleBar::render( QPainter * theQPainter )
|
||||
break;
|
||||
}
|
||||
|
||||
case QgsSymbolV2::Pixel:
|
||||
case QgsUnitTypes::RenderPixels:
|
||||
myOriginX = mMarginHorizontal - 5.; // Minus 5 to shift tight into corner
|
||||
myOriginY = mMarginVertical - 5.;
|
||||
break;
|
||||
|
||||
case QgsSymbolV2::Percentage:
|
||||
case QgsUnitTypes::RenderPercentage:
|
||||
{
|
||||
float myMarginDoubledW = myMarginW * 2.0;
|
||||
float myMarginDoubledH = myMarginH * 2.0;
|
||||
|
@ -60,7 +60,7 @@ QgsDecorationScaleBarDialog::QgsDecorationScaleBarDialog( QgsDecorationScaleBar&
|
||||
cboPlacement->setCurrentIndex( cboPlacement->findData( mDeco.placement() ) );
|
||||
spnHorizontal->setValue( mDeco.mMarginHorizontal );
|
||||
spnVertical->setValue( mDeco.mMarginVertical );
|
||||
wgtUnitSelection->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::Percentage << QgsSymbolV2::Pixel );
|
||||
wgtUnitSelection->setUnits( QgsUnitTypes::RenderUnitList() << QgsUnitTypes::RenderMillimeters << QgsUnitTypes::RenderPercentage << QgsUnitTypes::RenderPixels );
|
||||
wgtUnitSelection->setUnit( mDeco.mMarginUnit );
|
||||
|
||||
grpEnable->setChecked( mDeco.enabled() );
|
||||
|
@ -101,8 +101,8 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer,
|
||||
connect( mFixedSizeRadio, SIGNAL( toggled( bool ) ), this, SLOT( scalingTypeChanged() ) );
|
||||
connect( mAttributeBasedScalingRadio, SIGNAL( toggled( bool ) ), this, SLOT( scalingTypeChanged() ) );
|
||||
|
||||
mDiagramUnitComboBox->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit << QgsSymbolV2::Pixel );
|
||||
mDiagramLineUnitComboBox->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit << QgsSymbolV2::Pixel );
|
||||
mDiagramUnitComboBox->setUnits( QgsUnitTypes::RenderUnitList() << QgsUnitTypes::RenderMillimeters << QgsUnitTypes::RenderMapUnits << QgsUnitTypes::RenderPixels );
|
||||
mDiagramLineUnitComboBox->setUnits( QgsUnitTypes::RenderUnitList() << QgsUnitTypes::RenderMillimeters << QgsUnitTypes::RenderMapUnits << QgsUnitTypes::RenderPixels );
|
||||
|
||||
Qgis::GeometryType layerType = layer->geometryType();
|
||||
if ( layerType == Qgis::UnknownGeometry || layerType == Qgis::NoGeometry )
|
||||
@ -201,8 +201,8 @@ QgsDiagramProperties::QgsDiagramProperties( QgsVectorLayer* layer,
|
||||
mDiagramTypeComboBox->setCurrentIndex( 0 );
|
||||
mDiagramTypeComboBox->blockSignals( false );
|
||||
mFixedSizeRadio->setChecked( true );
|
||||
mDiagramUnitComboBox->setUnit( QgsSymbolV2::MM );
|
||||
mDiagramLineUnitComboBox->setUnit( QgsSymbolV2::MM );
|
||||
mDiagramUnitComboBox->setUnit( QgsUnitTypes::RenderMillimeters );
|
||||
mDiagramLineUnitComboBox->setUnit( QgsUnitTypes::RenderMillimeters );
|
||||
mLabelPlacementComboBox->setCurrentIndex( mLabelPlacementComboBox->findText( tr( "x-height" ) ) );
|
||||
mDiagramSizeSpinBox->setEnabled( true );
|
||||
mDiagramSizeSpinBox->setValue( 15 );
|
||||
|
@ -18,7 +18,6 @@
|
||||
#ifndef QGSDIAGRAMPROPERTIES_H
|
||||
#define QGSDIAGRAMPROPERTIES_H
|
||||
|
||||
#include "qgssymbolv2.h"
|
||||
#include <QDialog>
|
||||
#include <ui_qgsdiagrampropertiesbase.h>
|
||||
|
||||
|
@ -44,5 +44,5 @@ void QgsDisplayAngle::updateUi()
|
||||
QSettings settings;
|
||||
QgsUnitTypes::AngleUnit unit = QgsUnitTypes::decodeAngleUnit( settings.value( "/qgis/measure/angleunits", QgsUnitTypes::encodeUnit( QgsUnitTypes::AngleDegrees ) ).toString() );
|
||||
int decimals = settings.value( "/qgis/measure/decimalplaces", "3" ).toInt();
|
||||
mAngleLineEdit->setText( QgsUnitTypes::formatAngle( mValue * QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::Radians, unit ), decimals, unit ) );
|
||||
mAngleLineEdit->setText( QgsUnitTypes::formatAngle( mValue * QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::AngleRadians, unit ), decimals, unit ) );
|
||||
}
|
||||
|
@ -85,16 +85,16 @@ QgsLabelingGui::QgsLabelingGui( QgsVectorLayer* layer, QgsMapCanvas* mapCanvas,
|
||||
unitWidget->setMapCanvas( mMapCanvas );
|
||||
}
|
||||
mFontSizeUnitWidget->setUnits( QStringList() << tr( "Points" ) << tr( "Map unit" ), 1 );
|
||||
mBufferUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit );
|
||||
mShapeSizeUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit );
|
||||
mShapeOffsetUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit );
|
||||
mBufferUnitWidget->setUnits( QgsUnitTypes::RenderUnitList() << QgsUnitTypes::RenderMillimeters << QgsUnitTypes::RenderMapUnits );
|
||||
mShapeSizeUnitWidget->setUnits( QgsUnitTypes::RenderUnitList() << QgsUnitTypes::RenderMillimeters << QgsUnitTypes::RenderMapUnits );
|
||||
mShapeOffsetUnitWidget->setUnits( QgsUnitTypes::RenderUnitList() << QgsUnitTypes::RenderMillimeters << QgsUnitTypes::RenderMapUnits );
|
||||
mShapeRadiusUnitWidget->setUnits( QStringList() << tr( "Millimeter" ) << tr( "Map unit" ) << tr( "% of length" ), 1 );
|
||||
mShapeBorderWidthUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit );
|
||||
mShadowOffsetUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit );
|
||||
mShadowRadiusUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit );
|
||||
mPointOffsetUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit );
|
||||
mLineDistanceUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit );
|
||||
mRepeatDistanceUnitWidget->setUnits( QgsSymbolV2::OutputUnitList() << QgsSymbolV2::MM << QgsSymbolV2::MapUnit );
|
||||
mShapeBorderWidthUnitWidget->setUnits( QgsUnitTypes::RenderUnitList() << QgsUnitTypes::RenderMillimeters << QgsUnitTypes::RenderMapUnits );
|
||||
mShadowOffsetUnitWidget->setUnits( QgsUnitTypes::RenderUnitList() << QgsUnitTypes::RenderMillimeters << QgsUnitTypes::RenderMapUnits );
|
||||
mShadowRadiusUnitWidget->setUnits( QgsUnitTypes::RenderUnitList() << QgsUnitTypes::RenderMillimeters << QgsUnitTypes::RenderMapUnits );
|
||||
mPointOffsetUnitWidget->setUnits( QgsUnitTypes::RenderUnitList() << QgsUnitTypes::RenderMillimeters << QgsUnitTypes::RenderMapUnits );
|
||||
mLineDistanceUnitWidget->setUnits( QgsUnitTypes::RenderUnitList() << QgsUnitTypes::RenderMillimeters << QgsUnitTypes::RenderMapUnits );
|
||||
mRepeatDistanceUnitWidget->setUnits( QgsUnitTypes::RenderUnitList() << QgsUnitTypes::RenderMillimeters << QgsUnitTypes::RenderMapUnits );
|
||||
|
||||
mFontLineHeightSpinBox->setClearValue( 1.0 );
|
||||
mShapeRotationDblSpnBx->setClearValue( 0.0 );
|
||||
@ -628,13 +628,13 @@ void QgsLabelingGui::init()
|
||||
mCentroidInsideCheckBox->setChecked( lyr.centroidInside );
|
||||
mFitInsidePolygonCheckBox->setChecked( lyr.fitInPolygonOnly );
|
||||
mLineDistanceSpnBx->setValue( lyr.dist );
|
||||
mLineDistanceUnitWidget->setUnit( lyr.distInMapUnits ? QgsSymbolV2::MapUnit : QgsSymbolV2::MM );
|
||||
mLineDistanceUnitWidget->setUnit( lyr.distInMapUnits ? QgsUnitTypes::RenderMapUnits : QgsUnitTypes::RenderMillimeters );
|
||||
mLineDistanceUnitWidget->setMapUnitScale( lyr.distMapUnitScale );
|
||||
mOffsetTypeComboBox->setCurrentIndex( mOffsetTypeComboBox->findData( lyr.offsetType ) );
|
||||
mQuadrantBtnGrp->button(( int )lyr.quadOffset )->setChecked( true );
|
||||
mPointOffsetXSpinBox->setValue( lyr.xOffset );
|
||||
mPointOffsetYSpinBox->setValue( lyr.yOffset );
|
||||
mPointOffsetUnitWidget->setUnit( lyr.labelOffsetInMapUnits ? QgsSymbolV2::MapUnit : QgsSymbolV2::MM );
|
||||
mPointOffsetUnitWidget->setUnit( lyr.labelOffsetInMapUnits ? QgsUnitTypes::RenderMapUnits : QgsUnitTypes::RenderMillimeters );
|
||||
mPointOffsetUnitWidget->setMapUnitScale( lyr.labelOffsetMapUnitScale );
|
||||
mPointAngleSpinBox->setValue( lyr.angleOffset );
|
||||
chkLineAbove->setChecked( lyr.placementFlags & QgsPalLayerSettings::AboveLine );
|
||||
@ -675,7 +675,7 @@ void QgsLabelingGui::init()
|
||||
|
||||
// Label repeat distance
|
||||
mRepeatDistanceSpinBox->setValue( lyr.repeatDistance );
|
||||
mRepeatDistanceUnitWidget->setUnit( lyr.repeatDistanceUnit == QgsPalLayerSettings::MapUnits ? QgsSymbolV2::MapUnit : QgsSymbolV2::MM );
|
||||
mRepeatDistanceUnitWidget->setUnit( lyr.repeatDistanceUnit == QgsPalLayerSettings::MapUnits ? QgsUnitTypes::RenderMapUnits : QgsUnitTypes::RenderMillimeters );
|
||||
mRepeatDistanceUnitWidget->setMapUnitScale( lyr.repeatDistanceMapUnitScale );
|
||||
|
||||
mPrioritySlider->setValue( lyr.priority );
|
||||
@ -721,7 +721,7 @@ void QgsLabelingGui::init()
|
||||
// buffer
|
||||
mBufferDrawChkBx->setChecked( lyr.bufferDraw );
|
||||
spinBufferSize->setValue( lyr.bufferSize );
|
||||
mBufferUnitWidget->setUnit( lyr.bufferSizeInMapUnits ? QgsSymbolV2::MapUnit : QgsSymbolV2::MM );
|
||||
mBufferUnitWidget->setUnit( lyr.bufferSizeInMapUnits ? QgsUnitTypes::RenderMapUnits : QgsUnitTypes::RenderMillimeters );
|
||||
mBufferUnitWidget->setMapUnitScale( lyr.bufferSizeMapUnitScale );
|
||||
btnBufferColor->setColor( lyr.bufferColor );
|
||||
mBufferTranspSpinBox->setValue( lyr.bufferTransp );
|
||||
@ -782,7 +782,7 @@ void QgsLabelingGui::init()
|
||||
mShapeSizeCmbBx->setCurrentIndex( lyr.shapeSizeType );
|
||||
mShapeSizeXSpnBx->setValue( lyr.shapeSize.x() );
|
||||
mShapeSizeYSpnBx->setValue( lyr.shapeSize.y() );
|
||||
mShapeSizeUnitWidget->setUnit( lyr.shapeSizeUnits == QgsPalLayerSettings::MapUnits ? QgsSymbolV2::MapUnit : QgsSymbolV2::MM );
|
||||
mShapeSizeUnitWidget->setUnit( lyr.shapeSizeUnits == QgsPalLayerSettings::MapUnits ? QgsUnitTypes::RenderMapUnits : QgsUnitTypes::RenderMillimeters );
|
||||
mShapeSizeUnitWidget->setMapUnitScale( lyr.shapeSizeMapUnitScale );
|
||||
mShapeRotationCmbBx->setCurrentIndex( lyr.shapeRotationType );
|
||||
mShapeRotationDblSpnBx->setEnabled( lyr.shapeRotationType != QgsPalLayerSettings::RotationSync );
|
||||
@ -790,7 +790,7 @@ void QgsLabelingGui::init()
|
||||
mShapeRotationDblSpnBx->setValue( lyr.shapeRotation );
|
||||
mShapeOffsetXSpnBx->setValue( lyr.shapeOffset.x() );
|
||||
mShapeOffsetYSpnBx->setValue( lyr.shapeOffset.y() );
|
||||
mShapeOffsetUnitWidget->setUnit( lyr.shapeOffsetUnits == QgsPalLayerSettings::MapUnits ? QgsSymbolV2::MapUnit : QgsSymbolV2::MM );
|
||||
mShapeOffsetUnitWidget->setUnit( lyr.shapeOffsetUnits == QgsPalLayerSettings::MapUnits ? QgsUnitTypes::RenderMapUnits : QgsUnitTypes::RenderMillimeters );
|
||||
mShapeOffsetUnitWidget->setMapUnitScale( lyr.shapeOffsetMapUnitScale );
|
||||
mShapeRadiusXDbSpnBx->setValue( lyr.shapeRadii.x() );
|
||||
mShapeRadiusYDbSpnBx->setValue( lyr.shapeRadii.y() );
|
||||
@ -800,7 +800,7 @@ void QgsLabelingGui::init()
|
||||
mShapeFillColorBtn->setColor( lyr.shapeFillColor );
|
||||
mShapeBorderColorBtn->setColor( lyr.shapeBorderColor );
|
||||
mShapeBorderWidthSpnBx->setValue( lyr.shapeBorderWidth );
|
||||
mShapeBorderWidthUnitWidget->setUnit( lyr.shapeBorderWidthUnits == QgsPalLayerSettings::MapUnits ? QgsSymbolV2::MapUnit : QgsSymbolV2::MM );
|
||||
mShapeBorderWidthUnitWidget->setUnit( lyr.shapeBorderWidthUnits == QgsPalLayerSettings::MapUnits ? QgsUnitTypes::RenderMapUnits : QgsUnitTypes::RenderMillimeters );
|
||||
mShapeBorderWidthUnitWidget->setMapUnitScale( lyr.shapeBorderWidthMapUnitScale );
|
||||
mShapePenStyleCmbBx->setPenJoinStyle( lyr.shapeJoinStyle );
|
||||
|
||||
@ -815,12 +815,12 @@ void QgsLabelingGui::init()
|
||||
mShadowUnderCmbBx->setCurrentIndex( lyr.shadowUnder );
|
||||
mShadowOffsetAngleSpnBx->setValue( lyr.shadowOffsetAngle );
|
||||
mShadowOffsetSpnBx->setValue( lyr.shadowOffsetDist );
|
||||
mShadowOffsetUnitWidget->setUnit( lyr.shadowOffsetUnits == QgsPalLayerSettings::MapUnits ? QgsSymbolV2::MapUnit : QgsSymbolV2::MM );
|
||||
mShadowOffsetUnitWidget->setUnit( lyr.shadowOffsetUnits == QgsPalLayerSettings::MapUnits ? QgsUnitTypes::RenderMapUnits : QgsUnitTypes::RenderMillimeters );
|
||||
mShadowOffsetUnitWidget->setMapUnitScale( lyr.shadowOffsetMapUnitScale );
|
||||
mShadowOffsetGlobalChkBx->setChecked( lyr.shadowOffsetGlobal );
|
||||
|
||||
mShadowRadiusDblSpnBx->setValue( lyr.shadowRadius );
|
||||
mShadowRadiusUnitWidget->setUnit( lyr.shadowRadiusUnits == QgsPalLayerSettings::MapUnits ? QgsSymbolV2::MapUnit : QgsSymbolV2::MM );
|
||||
mShadowRadiusUnitWidget->setUnit( lyr.shadowRadiusUnits == QgsPalLayerSettings::MapUnits ? QgsUnitTypes::RenderMapUnits : QgsUnitTypes::RenderMillimeters );
|
||||
mShadowRadiusUnitWidget->setMapUnitScale( lyr.shadowRadiusMapUnitScale );
|
||||
mShadowRadiusAlphaChkBx->setChecked( lyr.shadowRadiusAlphaOnly );
|
||||
mShadowTranspSpnBx->setValue( lyr.shadowTransparency );
|
||||
@ -929,13 +929,13 @@ QgsPalLayerSettings QgsLabelingGui::layerSettings()
|
||||
lyr.centroidInside = mCentroidInsideCheckBox->isChecked();
|
||||
lyr.fitInPolygonOnly = mFitInsidePolygonCheckBox->isChecked();
|
||||
lyr.dist = mLineDistanceSpnBx->value();
|
||||
lyr.distInMapUnits = ( mLineDistanceUnitWidget->unit() == QgsSymbolV2::MapUnit );
|
||||
lyr.distInMapUnits = ( mLineDistanceUnitWidget->unit() == QgsUnitTypes::RenderMapUnits );
|
||||
lyr.distMapUnitScale = mLineDistanceUnitWidget->getMapUnitScale();
|
||||
lyr.offsetType = static_cast< QgsPalLayerSettings::OffsetType >( mOffsetTypeComboBox->itemData( mOffsetTypeComboBox->currentIndex() ).toInt() );
|
||||
lyr.quadOffset = ( QgsPalLayerSettings::QuadrantPosition )mQuadrantBtnGrp->checkedId();
|
||||
lyr.xOffset = mPointOffsetXSpinBox->value();
|
||||
lyr.yOffset = mPointOffsetYSpinBox->value();
|
||||
lyr.labelOffsetInMapUnits = ( mPointOffsetUnitWidget->unit() == QgsSymbolV2::MapUnit );
|
||||
lyr.labelOffsetInMapUnits = ( mPointOffsetUnitWidget->unit() == QgsUnitTypes::RenderMapUnits );
|
||||
lyr.labelOffsetMapUnitScale = mPointOffsetUnitWidget->getMapUnitScale();
|
||||
lyr.angleOffset = mPointAngleSpinBox->value();
|
||||
if ( chkLineAbove->isChecked() )
|
||||
@ -982,7 +982,7 @@ QgsPalLayerSettings QgsLabelingGui::layerSettings()
|
||||
}
|
||||
|
||||
lyr.repeatDistance = mRepeatDistanceSpinBox->value();
|
||||
lyr.repeatDistanceUnit = mRepeatDistanceUnitWidget->unit() == QgsSymbolV2::MapUnit ? QgsPalLayerSettings::MapUnits : QgsPalLayerSettings::MM;
|
||||
lyr.repeatDistanceUnit = mRepeatDistanceUnitWidget->unit() == QgsUnitTypes::RenderMapUnits ? QgsPalLayerSettings::MapUnits : QgsPalLayerSettings::MM;
|
||||
lyr.repeatDistanceMapUnitScale = mRepeatDistanceUnitWidget->getMapUnitScale();
|
||||
|
||||
lyr.textColor = btnTextColor->color();
|
||||
@ -1009,7 +1009,7 @@ QgsPalLayerSettings QgsLabelingGui::layerSettings()
|
||||
lyr.bufferSize = spinBufferSize->value();
|
||||
lyr.bufferColor = btnBufferColor->color();
|
||||
lyr.bufferTransp = mBufferTranspSpinBox->value();
|
||||
lyr.bufferSizeInMapUnits = ( mBufferUnitWidget->unit() == QgsSymbolV2::MapUnit );
|
||||
lyr.bufferSizeInMapUnits = ( mBufferUnitWidget->unit() == QgsUnitTypes::RenderMapUnits );
|
||||
lyr.bufferSizeMapUnitScale = mBufferUnitWidget->getMapUnitScale();
|
||||
lyr.bufferJoinStyle = mBufferJoinStyleComboBox->penJoinStyle();
|
||||
lyr.bufferNoFill = !mBufferTranspFillChbx->isChecked();
|
||||
@ -1022,12 +1022,12 @@ QgsPalLayerSettings QgsLabelingGui::layerSettings()
|
||||
|
||||
lyr.shapeSizeType = ( QgsPalLayerSettings::SizeType )mShapeSizeCmbBx->currentIndex();
|
||||
lyr.shapeSize = QPointF( mShapeSizeXSpnBx->value(), mShapeSizeYSpnBx->value() );
|
||||
lyr.shapeSizeUnits = mShapeSizeUnitWidget->unit() == QgsSymbolV2::MapUnit ? QgsPalLayerSettings::MapUnits : QgsPalLayerSettings::MM;
|
||||
lyr.shapeSizeUnits = mShapeSizeUnitWidget->unit() == QgsUnitTypes::RenderMapUnits ? QgsPalLayerSettings::MapUnits : QgsPalLayerSettings::MM;
|
||||
lyr.shapeSizeMapUnitScale = mShapeSizeUnitWidget->getMapUnitScale();
|
||||
lyr.shapeRotationType = ( QgsPalLayerSettings::RotationType )( mShapeRotationCmbBx->currentIndex() );
|
||||
lyr.shapeRotation = mShapeRotationDblSpnBx->value();
|
||||
lyr.shapeOffset = QPointF( mShapeOffsetXSpnBx->value(), mShapeOffsetYSpnBx->value() );
|
||||
lyr.shapeOffsetUnits = mShapeOffsetUnitWidget->unit() == QgsSymbolV2::MapUnit ? QgsPalLayerSettings::MapUnits : QgsPalLayerSettings::MM;
|
||||
lyr.shapeOffsetUnits = mShapeOffsetUnitWidget->unit() == QgsUnitTypes::RenderMapUnits ? QgsPalLayerSettings::MapUnits : QgsPalLayerSettings::MM;
|
||||
lyr.shapeOffsetMapUnitScale = mShapeOffsetUnitWidget->getMapUnitScale();
|
||||
lyr.shapeRadii = QPointF( mShapeRadiusXDbSpnBx->value(), mShapeRadiusYDbSpnBx->value() );
|
||||
lyr.shapeRadiiUnits = ( QgsPalLayerSettings::SizeUnit )( mShapeRadiusUnitWidget->getUnit() + 1 );
|
||||
@ -1036,7 +1036,7 @@ QgsPalLayerSettings QgsLabelingGui::layerSettings()
|
||||
lyr.shapeFillColor = mShapeFillColorBtn->color();
|
||||
lyr.shapeBorderColor = mShapeBorderColorBtn->color();
|
||||
lyr.shapeBorderWidth = mShapeBorderWidthSpnBx->value();
|
||||
lyr.shapeBorderWidthUnits = mShapeBorderWidthUnitWidget->unit() == QgsSymbolV2::MapUnit ? QgsPalLayerSettings::MapUnits : QgsPalLayerSettings::MM;
|
||||
lyr.shapeBorderWidthUnits = mShapeBorderWidthUnitWidget->unit() == QgsUnitTypes::RenderMapUnits ? QgsPalLayerSettings::MapUnits : QgsPalLayerSettings::MM;
|
||||
lyr.shapeBorderWidthMapUnitScale = mShapeBorderWidthUnitWidget->getMapUnitScale();
|
||||
lyr.shapeJoinStyle = mShapePenStyleCmbBx->penJoinStyle();
|
||||
lyr.shapeTransparency = mShapeTranspSpinBox->value();
|
||||
@ -1047,11 +1047,11 @@ QgsPalLayerSettings QgsLabelingGui::layerSettings()
|
||||
lyr.shadowUnder = ( QgsPalLayerSettings::ShadowType )mShadowUnderCmbBx->currentIndex();
|
||||
lyr.shadowOffsetAngle = mShadowOffsetAngleSpnBx->value();
|
||||
lyr.shadowOffsetDist = mShadowOffsetSpnBx->value();
|
||||
lyr.shadowOffsetUnits = mShadowOffsetUnitWidget->unit() == QgsSymbolV2::MapUnit ? QgsPalLayerSettings::MapUnits : QgsPalLayerSettings::MM;
|
||||
lyr.shadowOffsetUnits = mShadowOffsetUnitWidget->unit() == QgsUnitTypes::RenderMapUnits ? QgsPalLayerSettings::MapUnits : QgsPalLayerSettings::MM;
|
||||
lyr.shadowOffsetMapUnitScale = mShadowOffsetUnitWidget->getMapUnitScale();
|
||||
lyr.shadowOffsetGlobal = mShadowOffsetGlobalChkBx->isChecked();
|
||||
lyr.shadowRadius = mShadowRadiusDblSpnBx->value();
|
||||
lyr.shadowRadiusUnits = mShadowRadiusUnitWidget->unit() == QgsSymbolV2::MapUnit ? QgsPalLayerSettings::MapUnits : QgsPalLayerSettings::MM;
|
||||
lyr.shadowRadiusUnits = mShadowRadiusUnitWidget->unit() == QgsUnitTypes::RenderMapUnits ? QgsPalLayerSettings::MapUnits : QgsPalLayerSettings::MM;
|
||||
lyr.shadowRadiusMapUnitScale = mShadowRadiusUnitWidget->getMapUnitScale();
|
||||
lyr.shadowRadiusAlphaOnly = mShadowRadiusAlphaChkBx->isChecked();
|
||||
lyr.shadowTransparency = mShadowTranspSpnBx->value();
|
||||
@ -1567,7 +1567,7 @@ void QgsLabelingGui::updatePreview()
|
||||
|
||||
if ( mBufferDrawChkBx->isChecked() )
|
||||
{
|
||||
if ( mBufferUnitWidget->unit() == QgsSymbolV2::MapUnit )
|
||||
if ( mBufferUnitWidget->unit() == QgsUnitTypes::RenderMapUnits )
|
||||
{
|
||||
bufferSize = previewRatio * spinBufferSize->value() / 3.527;
|
||||
}
|
||||
@ -1587,7 +1587,7 @@ void QgsLabelingGui::updatePreview()
|
||||
|
||||
if ( mBufferDrawChkBx->isChecked() )
|
||||
{
|
||||
if ( mBufferUnitWidget->unit() == QgsSymbolV2::MM )
|
||||
if ( mBufferUnitWidget->unit() == QgsUnitTypes::RenderMillimeters )
|
||||
{
|
||||
bufferSize = spinBufferSize->value();
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ void QgsMapToolIdentifyAction::deactivate()
|
||||
QgsMapTool::deactivate();
|
||||
}
|
||||
|
||||
Qgis::UnitType QgsMapToolIdentifyAction::displayDistanceUnits() const
|
||||
QgsUnitTypes::DistanceUnit QgsMapToolIdentifyAction::displayDistanceUnits() const
|
||||
{
|
||||
return QgsProject::instance()->distanceUnits();
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ class APP_EXPORT QgsMapToolIdentifyAction : public QgsMapToolIdentify
|
||||
|
||||
QgsIdentifyResultsDialog *resultsDialog();
|
||||
|
||||
virtual Qgis::UnitType displayDistanceUnits() const override;
|
||||
virtual QgsUnitTypes::DistanceUnit displayDistanceUnits() const override;
|
||||
virtual QgsUnitTypes::AreaUnit displayAreaUnits() const override;
|
||||
|
||||
};
|
||||
|
@ -223,7 +223,7 @@ void QgsMapToolOffsetPointSymbol::updateOffsetPreviewItem( const QgsPoint& start
|
||||
mOffsetItem->updateSize();
|
||||
}
|
||||
|
||||
QPointF QgsMapToolOffsetPointSymbol::calculateOffset( const QgsPoint& startPoint, const QgsPoint& endPoint, QgsSymbolV2::OutputUnit unit ) const
|
||||
QPointF QgsMapToolOffsetPointSymbol::calculateOffset( const QgsPoint& startPoint, const QgsPoint& endPoint, QgsUnitTypes::RenderUnit unit ) const
|
||||
{
|
||||
double dx = endPoint.x() - startPoint.x();
|
||||
double dy = -( endPoint.y() - startPoint.y() );
|
||||
@ -232,20 +232,20 @@ QPointF QgsMapToolOffsetPointSymbol::calculateOffset( const QgsPoint& startPoint
|
||||
|
||||
switch ( unit )
|
||||
{
|
||||
case QgsSymbolV2::MM:
|
||||
case QgsUnitTypes::RenderMillimeters:
|
||||
factor = 25.4 / mCanvas->mapSettings().outputDpi() / mCanvas->mapSettings().mapUnitsPerPixel() ;
|
||||
break;
|
||||
|
||||
case QgsSymbolV2::Pixel:
|
||||
case QgsUnitTypes::RenderPixels:
|
||||
factor = 1.0 / mCanvas->mapSettings().mapUnitsPerPixel();
|
||||
break;
|
||||
|
||||
case QgsSymbolV2::MapUnit:
|
||||
case QgsUnitTypes::RenderMapUnits:
|
||||
factor = 1.0;
|
||||
break;
|
||||
|
||||
case QgsSymbolV2::Mixed:
|
||||
case QgsSymbolV2::Percentage:
|
||||
case QgsUnitTypes::RenderUnknownUnit:
|
||||
case QgsUnitTypes::RenderPercentage:
|
||||
//no sensible value
|
||||
factor = 1.0;
|
||||
break;
|
||||
|
@ -84,7 +84,7 @@ class APP_EXPORT QgsMapToolOffsetPointSymbol: public QgsMapToolPointSymbol
|
||||
|
||||
//! Calculates the required offset from the start to end points, in the specified unit
|
||||
//! @note start and end points are in map units
|
||||
QPointF calculateOffset( const QgsPoint& startPoint, const QgsPoint& endPoint, QgsSymbolV2::OutputUnit unit ) const;
|
||||
QPointF calculateOffset( const QgsPoint& startPoint, const QgsPoint& endPoint, QgsUnitTypes::RenderUnit unit ) const;
|
||||
|
||||
//! Adjusts the calculated offset to account for the symbol's rotation
|
||||
QPointF rotatedOffset( QPointF offset, double angle ) const;
|
||||
|
@ -108,7 +108,7 @@ void QgsMeasureDialog::unitsChanged( int index )
|
||||
if ( mMeasureArea )
|
||||
mAreaUnits = static_cast< QgsUnitTypes::AreaUnit >( mUnitsCombo->itemData( index ).toInt() );
|
||||
else
|
||||
mDistanceUnits = static_cast< Qgis::UnitType >( mUnitsCombo->itemData( index ).toInt() );
|
||||
mDistanceUnits = static_cast< QgsUnitTypes::DistanceUnit >( mUnitsCombo->itemData( index ).toInt() );
|
||||
mTable->clear();
|
||||
mTotal = 0.;
|
||||
updateUi();
|
||||
@ -274,8 +274,8 @@ void QgsMeasureDialog::updateUi()
|
||||
|
||||
if ( mMeasureArea )
|
||||
{
|
||||
if ( mTool->canvas()->mapSettings().destinationCrs().mapUnits() == Qgis::Degrees
|
||||
&& ( mAreaUnits == QgsUnitTypes::SquareDegrees || mAreaUnits == QgsUnitTypes::UnknownAreaUnit ) )
|
||||
if ( mTool->canvas()->mapSettings().destinationCrs().mapUnits() == QgsUnitTypes::DistanceDegrees
|
||||
&& ( mAreaUnits == QgsUnitTypes::AreaSquareDegrees || mAreaUnits == QgsUnitTypes::AreaUnknownUnit ) )
|
||||
{
|
||||
//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(
|
||||
@ -285,7 +285,7 @@ void QgsMeasureDialog::updateUi()
|
||||
}
|
||||
else
|
||||
{
|
||||
QgsUnitTypes::AreaUnit resultUnit = QgsUnitTypes::UnknownAreaUnit;
|
||||
QgsUnitTypes::AreaUnit resultUnit = QgsUnitTypes::AreaUnknownUnit;
|
||||
if ( ! mTool->canvas()->hasCrsTransformEnabled() )
|
||||
{
|
||||
resultUnit = QgsUnitTypes::distanceToAreaUnit( mTool->canvas()->mapSettings().destinationCrs().mapUnits() );
|
||||
@ -299,7 +299,7 @@ void QgsMeasureDialog::updateUi()
|
||||
{
|
||||
if ( mDa.willUseEllipsoid() )
|
||||
{
|
||||
resultUnit = QgsUnitTypes::SquareMeters;
|
||||
resultUnit = QgsUnitTypes::AreaSquareMeters;
|
||||
toolTip += "<br> * " + tr( "Project CRS transformation is turned on and ellipsoidal calculation is selected." ) + ' ';
|
||||
toolTip += "<br> * " + tr( "The coordinates are transformed to the chosen ellipsoid (%1), and the area is calculated in %2." ).arg( mDa.ellipsoid(),
|
||||
QgsUnitTypes::toString( resultUnit ) );
|
||||
@ -318,13 +318,13 @@ void QgsMeasureDialog::updateUi()
|
||||
QgsUnitTypes::unitType( mAreaUnits ) == QgsUnitTypes::Standard )
|
||||
{
|
||||
toolTip += "<br> * Area is roughly converted to square meters by using scale at equator (1 degree = 111319.49 meters).";
|
||||
resultUnit = QgsUnitTypes::SquareMeters;
|
||||
resultUnit = QgsUnitTypes::AreaSquareMeters;
|
||||
}
|
||||
else if ( QgsUnitTypes::unitType( resultUnit ) == QgsUnitTypes::Standard &&
|
||||
QgsUnitTypes::unitType( mAreaUnits ) == QgsUnitTypes::Geographic )
|
||||
{
|
||||
toolTip += "<br> * Area is roughly converted to square degrees by using scale at equator (1 degree = 111319.49 meters).";
|
||||
resultUnit = QgsUnitTypes::SquareDegrees;
|
||||
resultUnit = QgsUnitTypes::AreaSquareDegrees;
|
||||
}
|
||||
|
||||
if ( resultUnit != mAreaUnits )
|
||||
@ -348,8 +348,8 @@ void QgsMeasureDialog::updateUi()
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( mTool->canvas()->mapSettings().destinationCrs().mapUnits() == Qgis::Degrees
|
||||
&& mDistanceUnits == Qgis::Degrees )
|
||||
if ( mTool->canvas()->mapSettings().destinationCrs().mapUnits() == QgsUnitTypes::DistanceDegrees
|
||||
&& mDistanceUnits == QgsUnitTypes::DistanceDegrees )
|
||||
{
|
||||
//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(
|
||||
@ -359,7 +359,7 @@ void QgsMeasureDialog::updateUi()
|
||||
}
|
||||
else
|
||||
{
|
||||
Qgis::UnitType resultUnit = Qgis::UnknownUnit;
|
||||
QgsUnitTypes::DistanceUnit resultUnit = QgsUnitTypes::DistanceUnknownUnit;
|
||||
if ( ! mTool->canvas()->hasCrsTransformEnabled() )
|
||||
{
|
||||
resultUnit = mTool->canvas()->mapSettings().destinationCrs().mapUnits();
|
||||
@ -373,7 +373,7 @@ void QgsMeasureDialog::updateUi()
|
||||
{
|
||||
if ( mDa.willUseEllipsoid() )
|
||||
{
|
||||
resultUnit = Qgis::Meters;
|
||||
resultUnit = QgsUnitTypes::DistanceMeters;
|
||||
toolTip += "<br> * " + tr( "Project CRS transformation is turned on and ellipsoidal calculation is selected." ) + ' ';
|
||||
toolTip += "<br> * " + tr( "The coordinates are transformed to the chosen ellipsoid (%1), and the distance is calculated in %2." ).arg( mDa.ellipsoid(),
|
||||
QgsUnitTypes::toString( resultUnit ) );
|
||||
@ -392,13 +392,13 @@ void QgsMeasureDialog::updateUi()
|
||||
QgsUnitTypes::unitType( mDistanceUnits ) == QgsUnitTypes::Standard )
|
||||
{
|
||||
toolTip += "<br> * Distance is roughly converted to meters by using scale at equator (1 degree = 111319.49 meters).";
|
||||
resultUnit = Qgis::Meters;
|
||||
resultUnit = QgsUnitTypes::DistanceMeters;
|
||||
}
|
||||
else if ( QgsUnitTypes::unitType( resultUnit ) == QgsUnitTypes::Standard &&
|
||||
QgsUnitTypes::unitType( mDistanceUnits ) == QgsUnitTypes::Geographic )
|
||||
{
|
||||
toolTip += "<br> * Distance is roughly converted to degrees by using scale at equator (1 degree = 111319.49 meters).";
|
||||
resultUnit = Qgis::Degrees;
|
||||
resultUnit = QgsUnitTypes::DistanceDegrees;
|
||||
}
|
||||
|
||||
if ( resultUnit != mDistanceUnits )
|
||||
@ -491,30 +491,30 @@ void QgsMeasureDialog::repopulateComboBoxUnits( bool isArea )
|
||||
mUnitsCombo->clear();
|
||||
if ( isArea )
|
||||
{
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::SquareMeters ), QgsUnitTypes::SquareMeters );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::SquareKilometers ), QgsUnitTypes::SquareKilometers );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::SquareFeet ), QgsUnitTypes::SquareFeet );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::SquareYards ), QgsUnitTypes::SquareYards );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::SquareMiles ), QgsUnitTypes::SquareMiles );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::Hectares ), QgsUnitTypes::Hectares );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::Acres ), QgsUnitTypes::Acres );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::SquareNauticalMiles ), QgsUnitTypes::SquareNauticalMiles );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::SquareDegrees ), QgsUnitTypes::SquareDegrees );
|
||||
mUnitsCombo->addItem( tr( "map units" ), QgsUnitTypes::UnknownAreaUnit );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::AreaSquareMeters ), QgsUnitTypes::AreaSquareMeters );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::AreaSquareKilometers ), QgsUnitTypes::AreaSquareKilometers );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::AreaSquareFeet ), QgsUnitTypes::AreaSquareFeet );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::AreaSquareYards ), QgsUnitTypes::AreaSquareYards );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::AreaSquareMiles ), QgsUnitTypes::AreaSquareMiles );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::AreaHectares ), QgsUnitTypes::AreaHectares );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::AreaAcres ), QgsUnitTypes::AreaAcres );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::AreaSquareNauticalMiles ), QgsUnitTypes::AreaSquareNauticalMiles );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::AreaSquareDegrees ), QgsUnitTypes::AreaSquareDegrees );
|
||||
mUnitsCombo->addItem( tr( "map units" ), QgsUnitTypes::AreaUnknownUnit );
|
||||
}
|
||||
else
|
||||
{
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( Qgis::Meters ), Qgis::Meters );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( Qgis::Kilometers ), Qgis::Kilometers );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( Qgis::Feet ), Qgis::Feet );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( Qgis::Yards ), Qgis::Yards );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( Qgis::Miles ), Qgis::Miles );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( Qgis::Degrees ), Qgis::Degrees );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( Qgis::NauticalMiles ), Qgis::NauticalMiles );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::DistanceMeters ), QgsUnitTypes::DistanceMeters );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::DistanceKilometers ), QgsUnitTypes::DistanceKilometers );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::DistanceFeet ), QgsUnitTypes::DistanceFeet );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::DistanceYards ), QgsUnitTypes::DistanceYards );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::DistanceMiles ), QgsUnitTypes::DistanceMiles );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::DistanceDegrees ), QgsUnitTypes::DistanceDegrees );
|
||||
mUnitsCombo->addItem( QgsUnitTypes::toString( QgsUnitTypes::DistanceNauticalMiles ), QgsUnitTypes::DistanceNauticalMiles );
|
||||
}
|
||||
}
|
||||
|
||||
double QgsMeasureDialog::convertLength( double length, Qgis::UnitType toUnit ) const
|
||||
double QgsMeasureDialog::convertLength( double length, QgsUnitTypes::DistanceUnit toUnit ) const
|
||||
{
|
||||
return mDa.convertLengthMeasurement( length, toUnit );
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ class APP_EXPORT QgsMeasureDialog : public QDialog, private Ui::QgsMeasureBase
|
||||
*/
|
||||
void repopulateComboBoxUnits( bool isArea );
|
||||
|
||||
double convertLength( double length, Qgis::UnitType toUnit ) const;
|
||||
double convertLength( double length, QgsUnitTypes::DistanceUnit toUnit ) const;
|
||||
|
||||
double convertArea( double area, QgsUnitTypes::AreaUnit toUnit ) const;
|
||||
|
||||
@ -100,10 +100,10 @@ class APP_EXPORT QgsMeasureDialog : public QDialog, private Ui::QgsMeasureBase
|
||||
int mDecimalPlaces;
|
||||
|
||||
//! Current unit for input values
|
||||
Qgis::UnitType mCanvasUnits;
|
||||
QgsUnitTypes::DistanceUnit mCanvasUnits;
|
||||
|
||||
//! Current unit for distance values
|
||||
Qgis::UnitType mDistanceUnits;
|
||||
QgsUnitTypes::DistanceUnit mDistanceUnits;
|
||||
|
||||
//! Current unit for area values
|
||||
QgsUnitTypes::AreaUnit mAreaUnits;
|
||||
|
@ -459,43 +459,43 @@ QgsOptions::QgsOptions( QWidget *parent, Qt::WindowFlags fl )
|
||||
}
|
||||
|
||||
// Set the units for measuring
|
||||
mDistanceUnitsComboBox->addItem( tr( "Meters" ), Qgis::Meters );
|
||||
mDistanceUnitsComboBox->addItem( tr( "Kilometers" ), Qgis::Kilometers );
|
||||
mDistanceUnitsComboBox->addItem( tr( "Feet" ), Qgis::Feet );
|
||||
mDistanceUnitsComboBox->addItem( tr( "Yards" ), Qgis::Yards );
|
||||
mDistanceUnitsComboBox->addItem( tr( "Miles" ), Qgis::Miles );
|
||||
mDistanceUnitsComboBox->addItem( tr( "Nautical miles" ), Qgis::NauticalMiles );
|
||||
mDistanceUnitsComboBox->addItem( tr( "Degrees" ), Qgis::Degrees );
|
||||
mDistanceUnitsComboBox->addItem( tr( "Map units" ), Qgis::UnknownUnit );
|
||||
mDistanceUnitsComboBox->addItem( tr( "Meters" ), QgsUnitTypes::DistanceMeters );
|
||||
mDistanceUnitsComboBox->addItem( tr( "Kilometers" ), QgsUnitTypes::DistanceKilometers );
|
||||
mDistanceUnitsComboBox->addItem( tr( "Feet" ), QgsUnitTypes::DistanceFeet );
|
||||
mDistanceUnitsComboBox->addItem( tr( "Yards" ), QgsUnitTypes::DistanceYards );
|
||||
mDistanceUnitsComboBox->addItem( tr( "Miles" ), QgsUnitTypes::DistanceMiles );
|
||||
mDistanceUnitsComboBox->addItem( tr( "Nautical miles" ), QgsUnitTypes::DistanceNauticalMiles );
|
||||
mDistanceUnitsComboBox->addItem( tr( "Degrees" ), QgsUnitTypes::DistanceDegrees );
|
||||
mDistanceUnitsComboBox->addItem( tr( "Map units" ), QgsUnitTypes::DistanceUnknownUnit );
|
||||
|
||||
bool ok = false;
|
||||
Qgis::UnitType distanceUnits = QgsUnitTypes::decodeDistanceUnit( mSettings->value( "/qgis/measure/displayunits" ).toString(), &ok );
|
||||
QgsUnitTypes::DistanceUnit distanceUnits = QgsUnitTypes::decodeDistanceUnit( mSettings->value( "/qgis/measure/displayunits" ).toString(), &ok );
|
||||
if ( !ok )
|
||||
distanceUnits = Qgis::Meters;
|
||||
distanceUnits = QgsUnitTypes::DistanceMeters;
|
||||
mDistanceUnitsComboBox->setCurrentIndex( mDistanceUnitsComboBox->findData( distanceUnits ) );
|
||||
|
||||
mAreaUnitsComboBox->addItem( tr( "Square meters" ), QgsUnitTypes::SquareMeters );
|
||||
mAreaUnitsComboBox->addItem( tr( "Square kilometers" ), QgsUnitTypes::SquareKilometers );
|
||||
mAreaUnitsComboBox->addItem( tr( "Square feet" ), QgsUnitTypes::SquareFeet );
|
||||
mAreaUnitsComboBox->addItem( tr( "Square yards" ), QgsUnitTypes::SquareYards );
|
||||
mAreaUnitsComboBox->addItem( tr( "Square miles" ), QgsUnitTypes::SquareMiles );
|
||||
mAreaUnitsComboBox->addItem( tr( "Hectares" ), QgsUnitTypes::Hectares );
|
||||
mAreaUnitsComboBox->addItem( tr( "Acres" ), QgsUnitTypes::Acres );
|
||||
mAreaUnitsComboBox->addItem( tr( "Square nautical miles" ), QgsUnitTypes::SquareNauticalMiles );
|
||||
mAreaUnitsComboBox->addItem( tr( "Square degrees" ), QgsUnitTypes::SquareDegrees );
|
||||
mAreaUnitsComboBox->addItem( tr( "Map units" ), QgsUnitTypes::UnknownAreaUnit );
|
||||
mAreaUnitsComboBox->addItem( tr( "Square meters" ), QgsUnitTypes::AreaSquareMeters );
|
||||
mAreaUnitsComboBox->addItem( tr( "Square kilometers" ), QgsUnitTypes::AreaSquareKilometers );
|
||||
mAreaUnitsComboBox->addItem( tr( "Square feet" ), QgsUnitTypes::AreaSquareFeet );
|
||||
mAreaUnitsComboBox->addItem( tr( "Square yards" ), QgsUnitTypes::AreaSquareYards );
|
||||
mAreaUnitsComboBox->addItem( tr( "Square miles" ), QgsUnitTypes::AreaSquareMiles );
|
||||
mAreaUnitsComboBox->addItem( tr( "Hectares" ), QgsUnitTypes::AreaHectares );
|
||||
mAreaUnitsComboBox->addItem( tr( "Acres" ), QgsUnitTypes::AreaAcres );
|
||||
mAreaUnitsComboBox->addItem( tr( "Square nautical miles" ), QgsUnitTypes::AreaSquareNauticalMiles );
|
||||
mAreaUnitsComboBox->addItem( tr( "Square degrees" ), QgsUnitTypes::AreaSquareDegrees );
|
||||
mAreaUnitsComboBox->addItem( tr( "Map units" ), QgsUnitTypes::AreaUnknownUnit );
|
||||
|
||||
QgsUnitTypes::AreaUnit areaUnits = QgsUnitTypes::decodeAreaUnit( mSettings->value( "/qgis/measure/areaunits" ).toString(), &ok );
|
||||
if ( !ok )
|
||||
areaUnits = QgsUnitTypes::SquareMeters;
|
||||
areaUnits = QgsUnitTypes::AreaSquareMeters;
|
||||
mAreaUnitsComboBox->setCurrentIndex( mAreaUnitsComboBox->findData( areaUnits ) );
|
||||
|
||||
mAngleUnitsComboBox->addItem( tr( "Degrees" ), QgsUnitTypes::AngleDegrees );
|
||||
mAngleUnitsComboBox->addItem( tr( "Radians" ), QgsUnitTypes::Radians );
|
||||
mAngleUnitsComboBox->addItem( tr( "Gon/gradians" ), QgsUnitTypes::Gon );
|
||||
mAngleUnitsComboBox->addItem( tr( "Minutes of arc" ), QgsUnitTypes::MinutesOfArc );
|
||||
mAngleUnitsComboBox->addItem( tr( "Seconds of arc" ), QgsUnitTypes::SecondsOfArc );
|
||||
mAngleUnitsComboBox->addItem( tr( "Turns/revolutions" ), QgsUnitTypes::Turn );
|
||||
mAngleUnitsComboBox->addItem( tr( "Radians" ), QgsUnitTypes::AngleRadians );
|
||||
mAngleUnitsComboBox->addItem( tr( "Gon/gradians" ), QgsUnitTypes::AngleGon );
|
||||
mAngleUnitsComboBox->addItem( tr( "Minutes of arc" ), QgsUnitTypes::AngleMinutesOfArc );
|
||||
mAngleUnitsComboBox->addItem( tr( "Seconds of arc" ), QgsUnitTypes::AngleSecondsOfArc );
|
||||
mAngleUnitsComboBox->addItem( tr( "Turns/revolutions" ), QgsUnitTypes::AngleTurn );
|
||||
|
||||
QgsUnitTypes::AngleUnit unit = QgsUnitTypes::decodeAngleUnit( mSettings->value( "/qgis/measure/angleunits", QgsUnitTypes::encodeUnit( QgsUnitTypes::AngleDegrees ) ).toString() );
|
||||
mAngleUnitsComboBox->setCurrentIndex( mAngleUnitsComboBox->findData( unit ) );
|
||||
@ -1301,7 +1301,7 @@ void QgsOptions::saveOptions()
|
||||
|
||||
//measurement settings
|
||||
|
||||
Qgis::UnitType distanceUnit = static_cast< Qgis::UnitType >( mDistanceUnitsComboBox->itemData( mDistanceUnitsComboBox->currentIndex() ).toInt() );
|
||||
QgsUnitTypes::DistanceUnit distanceUnit = static_cast< QgsUnitTypes::DistanceUnit >( mDistanceUnitsComboBox->itemData( mDistanceUnitsComboBox->currentIndex() ).toInt() );
|
||||
mSettings->setValue( "/qgis/measure/displayunits", QgsUnitTypes::encodeUnit( distanceUnit ) );
|
||||
|
||||
QgsUnitTypes::AreaUnit areaUnit = static_cast< QgsUnitTypes::AreaUnit >( mAreaUnitsComboBox->itemData( mAreaUnitsComboBox->currentIndex() ).toInt() );
|
||||
|
@ -86,25 +86,25 @@ QgsProjectProperties::QgsProjectProperties( QgsMapCanvas* mapCanvas, QWidget *pa
|
||||
mCoordinateDisplayComboBox->addItem( tr( "Degrees, minutes" ), DegreesMinutes );
|
||||
mCoordinateDisplayComboBox->addItem( tr( "Degrees, minutes, seconds" ), DegreesMinutesSeconds );
|
||||
|
||||
mDistanceUnitsCombo->addItem( tr( "Meters" ), Qgis::Meters );
|
||||
mDistanceUnitsCombo->addItem( tr( "Kilometers" ), Qgis::Kilometers );
|
||||
mDistanceUnitsCombo->addItem( tr( "Feet" ), Qgis::Feet );
|
||||
mDistanceUnitsCombo->addItem( tr( "Yards" ), Qgis::Yards );
|
||||
mDistanceUnitsCombo->addItem( tr( "Miles" ), Qgis::Miles );
|
||||
mDistanceUnitsCombo->addItem( tr( "Nautical miles" ), Qgis::NauticalMiles );
|
||||
mDistanceUnitsCombo->addItem( tr( "Degrees" ), Qgis::Degrees );
|
||||
mDistanceUnitsCombo->addItem( tr( "Map units" ), Qgis::UnknownUnit );
|
||||
mDistanceUnitsCombo->addItem( tr( "Meters" ), QgsUnitTypes::DistanceMeters );
|
||||
mDistanceUnitsCombo->addItem( tr( "Kilometers" ), QgsUnitTypes::DistanceKilometers );
|
||||
mDistanceUnitsCombo->addItem( tr( "Feet" ), QgsUnitTypes::DistanceFeet );
|
||||
mDistanceUnitsCombo->addItem( tr( "Yards" ), QgsUnitTypes::DistanceYards );
|
||||
mDistanceUnitsCombo->addItem( tr( "Miles" ), QgsUnitTypes::DistanceMiles );
|
||||
mDistanceUnitsCombo->addItem( tr( "Nautical miles" ), QgsUnitTypes::DistanceNauticalMiles );
|
||||
mDistanceUnitsCombo->addItem( tr( "Degrees" ), QgsUnitTypes::DistanceDegrees );
|
||||
mDistanceUnitsCombo->addItem( tr( "Map units" ), QgsUnitTypes::DistanceUnknownUnit );
|
||||
|
||||
mAreaUnitsCombo->addItem( tr( "Square meters" ), QgsUnitTypes::SquareMeters );
|
||||
mAreaUnitsCombo->addItem( tr( "Square kilometers" ), QgsUnitTypes::SquareKilometers );
|
||||
mAreaUnitsCombo->addItem( tr( "Square feet" ), QgsUnitTypes::SquareFeet );
|
||||
mAreaUnitsCombo->addItem( tr( "Square yards" ), QgsUnitTypes::SquareYards );
|
||||
mAreaUnitsCombo->addItem( tr( "Square miles" ), QgsUnitTypes::SquareMiles );
|
||||
mAreaUnitsCombo->addItem( tr( "Hectares" ), QgsUnitTypes::Hectares );
|
||||
mAreaUnitsCombo->addItem( tr( "Acres" ), QgsUnitTypes::Acres );
|
||||
mAreaUnitsCombo->addItem( tr( "Square nautical miles" ), QgsUnitTypes::SquareNauticalMiles );
|
||||
mAreaUnitsCombo->addItem( tr( "Square degrees" ), QgsUnitTypes::SquareDegrees );
|
||||
mAreaUnitsCombo->addItem( tr( "Map units" ), QgsUnitTypes::UnknownAreaUnit );
|
||||
mAreaUnitsCombo->addItem( tr( "Square meters" ), QgsUnitTypes::AreaSquareMeters );
|
||||
mAreaUnitsCombo->addItem( tr( "Square kilometers" ), QgsUnitTypes::AreaSquareKilometers );
|
||||
mAreaUnitsCombo->addItem( tr( "Square feet" ), QgsUnitTypes::AreaSquareFeet );
|
||||
mAreaUnitsCombo->addItem( tr( "Square yards" ), QgsUnitTypes::AreaSquareYards );
|
||||
mAreaUnitsCombo->addItem( tr( "Square miles" ), QgsUnitTypes::AreaSquareMiles );
|
||||
mAreaUnitsCombo->addItem( tr( "Hectares" ), QgsUnitTypes::AreaHectares );
|
||||
mAreaUnitsCombo->addItem( tr( "Acres" ), QgsUnitTypes::AreaAcres );
|
||||
mAreaUnitsCombo->addItem( tr( "Square nautical miles" ), QgsUnitTypes::AreaSquareNauticalMiles );
|
||||
mAreaUnitsCombo->addItem( tr( "Square degrees" ), QgsUnitTypes::AreaSquareDegrees );
|
||||
mAreaUnitsCombo->addItem( tr( "Map units" ), QgsUnitTypes::AreaUnknownUnit );
|
||||
|
||||
connect( buttonBox->button( QDialogButtonBox::Apply ), SIGNAL( clicked() ), this, SLOT( apply() ) );
|
||||
connect( this, SIGNAL( accepted() ), this, SLOT( apply() ) );
|
||||
@ -732,17 +732,17 @@ QgsProjectProperties::~QgsProjectProperties()
|
||||
}
|
||||
|
||||
// return the map units
|
||||
Qgis::UnitType QgsProjectProperties::mapUnits() const
|
||||
QgsUnitTypes::DistanceUnit QgsProjectProperties::mapUnits() const
|
||||
{
|
||||
return mMapCanvas->mapSettings().mapUnits();
|
||||
}
|
||||
|
||||
void QgsProjectProperties::setMapUnits( Qgis::UnitType unit )
|
||||
void QgsProjectProperties::setMapUnits( QgsUnitTypes::DistanceUnit unit )
|
||||
{
|
||||
// select the button
|
||||
if ( unit == Qgis::UnknownUnit )
|
||||
if ( unit == QgsUnitTypes::DistanceUnknownUnit )
|
||||
{
|
||||
unit = Qgis::Meters;
|
||||
unit = QgsUnitTypes::DistanceMeters;
|
||||
}
|
||||
|
||||
mMapCanvas->setMapUnits( unit );
|
||||
@ -787,7 +787,7 @@ void QgsProjectProperties::apply()
|
||||
{
|
||||
// If we couldn't get the map units, default to the value in the
|
||||
// projectproperties dialog box (set above)
|
||||
if ( srs.mapUnits() != Qgis::UnknownUnit )
|
||||
if ( srs.mapUnits() != QgsUnitTypes::DistanceUnknownUnit )
|
||||
mMapCanvas->setMapUnits( srs.mapUnits() );
|
||||
}
|
||||
|
||||
@ -831,7 +831,7 @@ void QgsProjectProperties::apply()
|
||||
// Announce that we may have a new display precision setting
|
||||
emit displayPrecisionChanged();
|
||||
|
||||
Qgis::UnitType distanceUnits = static_cast< Qgis::UnitType >( mDistanceUnitsCombo->itemData( mDistanceUnitsCombo->currentIndex() ).toInt() );
|
||||
QgsUnitTypes::DistanceUnit distanceUnits = static_cast< QgsUnitTypes::DistanceUnit >( mDistanceUnitsCombo->itemData( mDistanceUnitsCombo->currentIndex() ).toInt() );
|
||||
QgsProject::instance()->writeEntry( "Measurement", "/DistanceUnits", QgsUnitTypes::encodeUnit( distanceUnits ) );
|
||||
|
||||
QgsUnitTypes::AreaUnit areaUnits = static_cast< QgsUnitTypes::AreaUnit >( mAreaUnitsCombo->itemData( mAreaUnitsCombo->currentIndex() ).toInt() );
|
||||
@ -1274,7 +1274,7 @@ void QgsProjectProperties::cbxWCSPubliedStateChanged( int aIdx )
|
||||
}
|
||||
}
|
||||
|
||||
void QgsProjectProperties::updateGuiForMapUnits( Qgis::UnitType units )
|
||||
void QgsProjectProperties::updateGuiForMapUnits( QgsUnitTypes::DistanceUnit units )
|
||||
{
|
||||
//make sure map units option is shown in coordinate display combo
|
||||
int idx = mCoordinateDisplayComboBox->findData( MapUnits );
|
||||
@ -1282,13 +1282,13 @@ void QgsProjectProperties::updateGuiForMapUnits( Qgis::UnitType units )
|
||||
mCoordinateDisplayComboBox->setItemText( idx, mapUnitString );
|
||||
|
||||
//also update unit combo boxes
|
||||
idx = mDistanceUnitsCombo->findData( Qgis::UnknownUnit );
|
||||
idx = mDistanceUnitsCombo->findData( QgsUnitTypes::DistanceUnknownUnit );
|
||||
if ( idx >= 0 )
|
||||
{
|
||||
QString mapUnitString = tr( "Map units (%1)" ).arg( QgsUnitTypes::toString( units ) );
|
||||
mDistanceUnitsCombo->setItemText( idx, mapUnitString );
|
||||
}
|
||||
idx = mAreaUnitsCombo->findData( QgsUnitTypes::UnknownAreaUnit );
|
||||
idx = mAreaUnitsCombo->findData( QgsUnitTypes::AreaUnknownUnit );
|
||||
if ( idx >= 0 )
|
||||
{
|
||||
QString mapUnitString = tr( "Map units (%1)" ).arg( QgsUnitTypes::toString( QgsUnitTypes::distanceToAreaUnit( units ) ) );
|
||||
@ -1304,7 +1304,7 @@ void QgsProjectProperties::srIdUpdated()
|
||||
|
||||
QgsCoordinateReferenceSystem srs = QgsCoordinateReferenceSystem::fromSrsId( myCRSID );
|
||||
//set radio button to crs map unit type
|
||||
Qgis::UnitType units = srs.mapUnits();
|
||||
QgsUnitTypes::DistanceUnit units = srs.mapUnits();
|
||||
|
||||
updateGuiForMapUnits( units );
|
||||
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "qgsoptionsdialogbase.h"
|
||||
#include "ui_qgsprojectpropertiesbase.h"
|
||||
#include "qgis.h"
|
||||
#include "qgsunittypes.h"
|
||||
#include "qgisgui.h"
|
||||
#include "qgscontexthelp.h"
|
||||
|
||||
@ -47,12 +48,12 @@ class APP_EXPORT QgsProjectProperties : public QgsOptionsDialogBase, private Ui:
|
||||
|
||||
/** Gets the currently select map units
|
||||
*/
|
||||
Qgis::UnitType mapUnits() const;
|
||||
QgsUnitTypes::DistanceUnit mapUnits() const;
|
||||
|
||||
/*!
|
||||
* Set the map units
|
||||
*/
|
||||
void setMapUnits( Qgis::UnitType );
|
||||
void setMapUnits( QgsUnitTypes::DistanceUnit );
|
||||
|
||||
/*!
|
||||
Every project has a title
|
||||
@ -240,5 +241,5 @@ class APP_EXPORT QgsProjectProperties : public QgsOptionsDialogBase, private Ui:
|
||||
|
||||
static const char * GEO_NONE_DESC;
|
||||
|
||||
void updateGuiForMapUnits( Qgis::UnitType units );
|
||||
void updateGuiForMapUnits( QgsUnitTypes::DistanceUnit units );
|
||||
};
|
||||
|
@ -306,20 +306,20 @@ double QgsComposerScaleBar::mapWidth() const
|
||||
da.setSourceCrs( mComposition->mapSettings().destinationCrs().srsid() );
|
||||
da.setEllipsoid( QgsProject::instance()->readEntry( "Measure", "/Ellipsoid", "WGS84" ) );
|
||||
|
||||
Qgis::UnitType units = Qgis::Meters;
|
||||
QgsUnitTypes::DistanceUnit units = QgsUnitTypes::DistanceMeters;
|
||||
double measure = da.measureLine( QgsPoint( composerMapRect.xMinimum(), composerMapRect.yMinimum() ),
|
||||
QgsPoint( composerMapRect.xMaximum(), composerMapRect.yMinimum() ),
|
||||
units );
|
||||
switch ( mUnits )
|
||||
{
|
||||
case QgsComposerScaleBar::Feet:
|
||||
measure /= QgsUnitTypes::fromUnitToUnitFactor( Qgis::Feet, units );
|
||||
measure /= QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::DistanceFeet, units );
|
||||
break;
|
||||
case QgsComposerScaleBar::NauticalMiles:
|
||||
measure /= QgsUnitTypes::fromUnitToUnitFactor( Qgis::NauticalMiles, units );
|
||||
measure /= QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::DistanceNauticalMiles, units );
|
||||
break;
|
||||
case QgsComposerScaleBar::Meters:
|
||||
measure /= QgsUnitTypes::fromUnitToUnitFactor( Qgis::Meters, units );
|
||||
measure /= QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::DistanceMeters, units );
|
||||
break;
|
||||
case QgsComposerScaleBar::MapUnits:
|
||||
//avoid warning
|
||||
|
@ -88,7 +88,7 @@ float QgsDiagram::sizePainterUnits( float l, const QgsDiagramSettings& s, const
|
||||
QFont QgsDiagram::scaledFont( const QgsDiagramSettings& s, const QgsRenderContext& c )
|
||||
{
|
||||
QFont f = s.font;
|
||||
if ( s.sizeType == QgsSymbolV2::MapUnit )
|
||||
if ( s.sizeType == QgsUnitTypes::RenderMapUnits )
|
||||
{
|
||||
int pixelsize = s.font.pointSizeF() / c.mapToPixel().mapUnitsPerPixel();
|
||||
f.setPixelSize( pixelsize > 0 ? pixelsize : 1 );
|
||||
|
@ -366,7 +366,7 @@ const char *QgsDxfExport::mDxfEncodings[][2] =
|
||||
QgsDxfExport::QgsDxfExport()
|
||||
: mSymbologyScaleDenominator( 1.0 )
|
||||
, mSymbologyExport( NoSymbology )
|
||||
, mMapUnits( Qgis::Meters )
|
||||
, mMapUnits( QgsUnitTypes::DistanceMeters )
|
||||
, mLayerTitleAsName( false )
|
||||
, mSymbolLayerCounter( 0 )
|
||||
, mNextHandleId( DXF_HANDSEED )
|
||||
@ -852,7 +852,7 @@ void QgsDxfExport::writeBlocks()
|
||||
continue;
|
||||
|
||||
// if point symbol layer and no data defined properties: write block
|
||||
QgsSymbolV2RenderContext ctx( ct, QgsSymbolV2::MapUnit, slIt->second->alpha(), false, slIt->second->renderHints(), nullptr );
|
||||
QgsSymbolV2RenderContext ctx( ct, QgsUnitTypes::RenderMapUnits, slIt->second->alpha(), false, slIt->second->renderHints(), nullptr );
|
||||
ml->startRender( ctx );
|
||||
|
||||
// markers with data defined properties are inserted inline
|
||||
@ -912,7 +912,7 @@ void QgsDxfExport::writeEntities()
|
||||
mapSettings.setExtent( bbox );
|
||||
|
||||
int dpi = 96;
|
||||
double factor = 1000 * dpi / mSymbologyScaleDenominator / 25.4 * QgsUnitTypes::fromUnitToUnitFactor( mMapUnits, Qgis::Meters );
|
||||
double factor = 1000 * dpi / mSymbologyScaleDenominator / 25.4 * QgsUnitTypes::fromUnitToUnitFactor( mMapUnits, QgsUnitTypes::DistanceMeters );
|
||||
mapSettings.setOutputSize( QSize( bbox.width() * factor, bbox.height() * factor ) );
|
||||
mapSettings.setOutputDpi( dpi );
|
||||
mapSettings.setCrsTransformEnabled( false );
|
||||
@ -945,7 +945,7 @@ void QgsDxfExport::writeEntities()
|
||||
continue;
|
||||
}
|
||||
|
||||
QgsSymbolV2RenderContext sctx( ctx, QgsSymbolV2::MM, 1.0, false, 0, nullptr );
|
||||
QgsSymbolV2RenderContext sctx( ctx, QgsUnitTypes::RenderMillimeters, 1.0, false, 0, nullptr );
|
||||
QgsFeatureRendererV2* renderer = vl->rendererV2();
|
||||
if ( !renderer )
|
||||
{
|
||||
@ -1084,7 +1084,7 @@ void QgsDxfExport::writeEntitiesSymbolLevels( QgsVectorLayer* layer )
|
||||
ctx.expressionContext() << QgsExpressionContextUtils::globalScope()
|
||||
<< QgsExpressionContextUtils::projectScope()
|
||||
<< QgsExpressionContextUtils::layerScope( layer );
|
||||
QgsSymbolV2RenderContext sctx( ctx, QgsSymbolV2::MM, 1.0, false, 0, nullptr );
|
||||
QgsSymbolV2RenderContext sctx( ctx, QgsUnitTypes::RenderMillimeters, 1.0, false, 0, nullptr );
|
||||
renderer->startRender( ctx, layer->fields() );
|
||||
|
||||
// get iterator
|
||||
@ -3960,14 +3960,14 @@ QgsRenderContext QgsDxfExport::renderContext() const
|
||||
return context;
|
||||
}
|
||||
|
||||
double QgsDxfExport::mapUnitScaleFactor( double scaleDenominator, QgsSymbolV2::OutputUnit symbolUnits, Qgis::UnitType mapUnits )
|
||||
double QgsDxfExport::mapUnitScaleFactor( double scaleDenominator, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits )
|
||||
{
|
||||
if ( symbolUnits == QgsSymbolV2::MapUnit )
|
||||
if ( symbolUnits == QgsUnitTypes::RenderMapUnits )
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
// MM symbol unit
|
||||
return scaleDenominator * QgsUnitTypes::fromUnitToUnitFactor( Qgis::Meters, mapUnits ) / 1000.0;
|
||||
return scaleDenominator * QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::DistanceMeters, mapUnits ) / 1000.0;
|
||||
}
|
||||
|
||||
QList< QPair< QgsSymbolLayerV2*, QgsSymbolV2* > > QgsDxfExport::symbolLayers( QgsRenderContext &context )
|
||||
@ -4035,19 +4035,19 @@ void QgsDxfExport::writeDefaultLinetypes()
|
||||
QVector<qreal> dashVector( 2 );
|
||||
dashVector[0] = das;
|
||||
dashVector[1] = dss;
|
||||
writeLinetype( "DASH", dashVector, QgsSymbolV2::MapUnit );
|
||||
writeLinetype( "DASH", dashVector, QgsUnitTypes::RenderMapUnits );
|
||||
|
||||
QVector<qreal> dotVector( 2 );
|
||||
dotVector[0] = dos;
|
||||
dotVector[1] = dss;
|
||||
writeLinetype( "DOT", dotVector, QgsSymbolV2::MapUnit );
|
||||
writeLinetype( "DOT", dotVector, QgsUnitTypes::RenderMapUnits );
|
||||
|
||||
QVector<qreal> dashDotVector( 4 );
|
||||
dashDotVector[0] = das;
|
||||
dashDotVector[1] = dss;
|
||||
dashDotVector[2] = dos;
|
||||
dashDotVector[3] = dss;
|
||||
writeLinetype( "DASHDOT", dashDotVector, QgsSymbolV2::MapUnit );
|
||||
writeLinetype( "DASHDOT", dashDotVector, QgsUnitTypes::RenderMapUnits );
|
||||
|
||||
QVector<qreal> dashDotDotVector( 6 );
|
||||
dashDotDotVector[0] = das;
|
||||
@ -4056,7 +4056,7 @@ void QgsDxfExport::writeDefaultLinetypes()
|
||||
dashDotDotVector[3] = dss;
|
||||
dashDotDotVector[4] = dos;
|
||||
dashDotDotVector[5] = dss;
|
||||
writeLinetype( "DASHDOTDOT", dashDotDotVector, QgsSymbolV2::MapUnit );
|
||||
writeLinetype( "DASHDOTDOT", dashDotDotVector, QgsUnitTypes::RenderMapUnits );
|
||||
}
|
||||
|
||||
void QgsDxfExport::writeSymbolLayerLinetype( const QgsSymbolLayerV2* symbolLayer )
|
||||
@ -4066,7 +4066,7 @@ void QgsDxfExport::writeSymbolLayerLinetype( const QgsSymbolLayerV2* symbolLayer
|
||||
return;
|
||||
}
|
||||
|
||||
QgsSymbolV2::OutputUnit unit;
|
||||
QgsUnitTypes::RenderUnit unit;
|
||||
QVector<qreal> customLinestyle = symbolLayer->dxfCustomDashPattern( unit );
|
||||
if ( !customLinestyle.isEmpty() )
|
||||
{
|
||||
@ -4094,7 +4094,7 @@ int QgsDxfExport::nLineTypes( const QList< QPair< QgsSymbolLayerV2*, QgsSymbolV2
|
||||
return nLineTypes;
|
||||
}
|
||||
|
||||
void QgsDxfExport::writeLinetype( const QString& styleName, const QVector<qreal>& pattern, QgsSymbolV2::OutputUnit u )
|
||||
void QgsDxfExport::writeLinetype( const QString& styleName, const QVector<qreal>& pattern, QgsUnitTypes::RenderUnit u )
|
||||
{
|
||||
double length = 0;
|
||||
QVector<qreal>::const_iterator dashIt = pattern.constBegin();
|
||||
@ -4164,7 +4164,7 @@ double QgsDxfExport::dashSeparatorSize() const
|
||||
|
||||
double QgsDxfExport::sizeToMapUnits( double s ) const
|
||||
{
|
||||
double size = s * QgsUnitTypes::fromUnitToUnitFactor( Qgis::Meters, mMapUnits );
|
||||
double size = s * QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::DistanceMeters, mMapUnits );
|
||||
return size;
|
||||
}
|
||||
|
||||
|
@ -86,14 +86,14 @@ class CORE_EXPORT QgsDxfExport
|
||||
* Set map units
|
||||
* @param u unit
|
||||
*/
|
||||
void setMapUnits( Qgis::UnitType u ) { mMapUnits = u; }
|
||||
void setMapUnits( QgsUnitTypes::DistanceUnit u ) { mMapUnits = u; }
|
||||
|
||||
/**
|
||||
* Retrieve map units
|
||||
* @returns unit
|
||||
* @see setMapUnits
|
||||
*/
|
||||
Qgis::UnitType mapUnits() const { return mMapUnits; }
|
||||
QgsUnitTypes::DistanceUnit mapUnits() const { return mMapUnits; }
|
||||
|
||||
/**
|
||||
* Set symbology export mode
|
||||
@ -352,7 +352,8 @@ class CORE_EXPORT QgsDxfExport
|
||||
//! @note added in 2.15
|
||||
void writeMText( const QString &layer, const QString &text, const QgsPointV2 &pt, double width, double angle, const QColor& color );
|
||||
|
||||
static double mapUnitScaleFactor( double scaleDenominator, QgsSymbolV2::OutputUnit symbolUnits, Qgis::UnitType mapUnits );
|
||||
//! Calculates a scaling factor to convert from map units to a specified symbol unit.
|
||||
static double mapUnitScaleFactor( double scaleDenominator, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits );
|
||||
|
||||
//! Return cleaned layer name for use in DXF
|
||||
static QString dxfLayerName( const QString &name );
|
||||
@ -387,7 +388,7 @@ class CORE_EXPORT QgsDxfExport
|
||||
/** Scale for symbology export (used if symbols units are mm)*/
|
||||
double mSymbologyScaleDenominator;
|
||||
SymbologyExport mSymbologyExport;
|
||||
Qgis::UnitType mMapUnits;
|
||||
QgsUnitTypes::DistanceUnit mMapUnits;
|
||||
bool mLayerTitleAsName;
|
||||
|
||||
QTextStream mTextStream;
|
||||
@ -416,7 +417,7 @@ class CORE_EXPORT QgsDxfExport
|
||||
void writePoint( const QgsPointV2 &pt, const QString &layer, const QColor& color, QgsSymbolV2RenderContext &ctx, const QgsSymbolLayerV2 *symbolLayer, const QgsSymbolV2 *symbol, double angle );
|
||||
void writeDefaultLinetypes();
|
||||
void writeSymbolLayerLinetype( const QgsSymbolLayerV2 *symbolLayer );
|
||||
void writeLinetype( const QString &styleName, const QVector<qreal> &pattern, QgsSymbolV2::OutputUnit u );
|
||||
void writeLinetype( const QString &styleName, const QVector<qreal> &pattern, QgsUnitTypes::RenderUnit u );
|
||||
|
||||
QgsRectangle dxfExtent() const;
|
||||
|
||||
|
@ -24,7 +24,7 @@
|
||||
QgsGlowEffect::QgsGlowEffect()
|
||||
: QgsPaintEffect()
|
||||
, mSpread( 2.0 )
|
||||
, mSpreadUnit( QgsSymbolV2::MM )
|
||||
, mSpreadUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mRamp( nullptr )
|
||||
, mBlurLevel( 3 )
|
||||
, mTransparency( 0.5 )
|
||||
@ -124,7 +124,7 @@ QgsStringMap QgsGlowEffect::properties() const
|
||||
props.insert( "transparency", QString::number( mTransparency ) );
|
||||
props.insert( "blur_level", QString::number( mBlurLevel ) );
|
||||
props.insert( "spread", QString::number( mSpread ) );
|
||||
props.insert( "spread_unit", QgsSymbolLayerV2Utils::encodeOutputUnit( mSpreadUnit ) );
|
||||
props.insert( "spread_unit", QgsUnitTypes::encodeUnit( mSpreadUnit ) );
|
||||
props.insert( "spread_unit_scale", QgsSymbolLayerV2Utils::encodeMapUnitScale( mSpreadMapUnitScale ) );
|
||||
props.insert( "color_type", QString::number( static_cast< int >( mColorType ) ) );
|
||||
props.insert( "single_color", QgsSymbolLayerV2Utils::encodeColor( mColor ) );
|
||||
@ -162,7 +162,7 @@ void QgsGlowEffect::readProperties( const QgsStringMap &props )
|
||||
{
|
||||
mSpread = spread;
|
||||
}
|
||||
mSpreadUnit = QgsSymbolLayerV2Utils::decodeOutputUnit( props.value( "spread_unit" ) );
|
||||
mSpreadUnit = QgsUnitTypes::decodeRenderUnit( props.value( "spread_unit" ) );
|
||||
mSpreadMapUnitScale = QgsSymbolLayerV2Utils::decodeMapUnitScale( props.value( "spread_unit_scale" ) );
|
||||
QgsGlowEffect::GlowColorType type = static_cast< QgsGlowEffect::GlowColorType >( props.value( "color_type" ).toInt( &ok ) );
|
||||
if ( ok )
|
||||
|
@ -72,7 +72,7 @@ class CORE_EXPORT QgsGlowEffect : public QgsPaintEffect
|
||||
* @see setSpread
|
||||
* @see setSpreadMapUnitScale
|
||||
*/
|
||||
void setSpreadUnit( const QgsSymbolV2::OutputUnit unit ) { mSpreadUnit = unit; }
|
||||
void setSpreadUnit( const QgsUnitTypes::RenderUnit unit ) { mSpreadUnit = unit; }
|
||||
|
||||
/** Returns the units used for the glow spread distance.
|
||||
* @returns units for spread distance
|
||||
@ -80,7 +80,7 @@ class CORE_EXPORT QgsGlowEffect : public QgsPaintEffect
|
||||
* @see spread
|
||||
* @see spreadMapUnitScale
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit spreadUnit() const { return mSpreadUnit; }
|
||||
QgsUnitTypes::RenderUnit spreadUnit() const { return mSpreadUnit; }
|
||||
|
||||
/** Sets the map unit scale used for the spread distance.
|
||||
* @param scale map unit scale for spread distance
|
||||
@ -209,7 +209,7 @@ class CORE_EXPORT QgsGlowEffect : public QgsPaintEffect
|
||||
virtual bool shadeExterior() const = 0;
|
||||
|
||||
double mSpread;
|
||||
QgsSymbolV2::OutputUnit mSpreadUnit;
|
||||
QgsUnitTypes::RenderUnit mSpreadUnit;
|
||||
QgsMapUnitScale mSpreadMapUnitScale;
|
||||
QgsVectorColorRampV2* mRamp;
|
||||
int mBlurLevel;
|
||||
|
@ -25,7 +25,7 @@ QgsShadowEffect::QgsShadowEffect()
|
||||
, mBlurLevel( 10 )
|
||||
, mOffsetAngle( 135 )
|
||||
, mOffsetDist( 2.0 )
|
||||
, mOffsetUnit( QgsSymbolV2::MM )
|
||||
, mOffsetUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mTransparency( 0.0 )
|
||||
, mColor( Qt::black )
|
||||
, mBlendMode( QPainter::CompositionMode_Multiply )
|
||||
@ -103,7 +103,7 @@ QgsStringMap QgsShadowEffect::properties() const
|
||||
props.insert( "blur_level", QString::number( mBlurLevel ) );
|
||||
props.insert( "offset_angle", QString::number( mOffsetAngle ) );
|
||||
props.insert( "offset_distance", QString::number( mOffsetDist ) );
|
||||
props.insert( "offset_unit", QgsSymbolLayerV2Utils::encodeOutputUnit( mOffsetUnit ) );
|
||||
props.insert( "offset_unit", QgsUnitTypes::encodeUnit( mOffsetUnit ) );
|
||||
props.insert( "offset_unit_scale", QgsSymbolLayerV2Utils::encodeMapUnitScale( mOffsetMapUnitScale ) );
|
||||
props.insert( "color", QgsSymbolLayerV2Utils::encodeColor( mColor ) );
|
||||
return props;
|
||||
@ -139,7 +139,7 @@ void QgsShadowEffect::readProperties( const QgsStringMap &props )
|
||||
{
|
||||
mOffsetDist = distance;
|
||||
}
|
||||
mOffsetUnit = QgsSymbolLayerV2Utils::decodeOutputUnit( props.value( "offset_unit" ) );
|
||||
mOffsetUnit = QgsUnitTypes::decodeRenderUnit( props.value( "offset_unit" ) );
|
||||
mOffsetMapUnitScale = QgsSymbolLayerV2Utils::decodeMapUnitScale( props.value( "offset_unit_scale" ) );
|
||||
if ( props.contains( "color" ) )
|
||||
{
|
||||
|
@ -90,7 +90,7 @@ class CORE_EXPORT QgsShadowEffect : public QgsPaintEffect
|
||||
* @see setOffsetDistance
|
||||
* @see setOffsetMapUnitScale
|
||||
*/
|
||||
void setOffsetUnit( const QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit; }
|
||||
void setOffsetUnit( const QgsUnitTypes::RenderUnit unit ) { mOffsetUnit = unit; }
|
||||
|
||||
/** Returns the units used for the shadow offset distance.
|
||||
* @returns units for offset distance
|
||||
@ -98,7 +98,7 @@ class CORE_EXPORT QgsShadowEffect : public QgsPaintEffect
|
||||
* @see offsetDistance
|
||||
* @see offsetMapUnitScale
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; }
|
||||
QgsUnitTypes::RenderUnit offsetUnit() const { return mOffsetUnit; }
|
||||
|
||||
/** Sets the map unit scale used for the shadow offset distance.
|
||||
* @param scale map unit scale for offset distance
|
||||
@ -171,7 +171,7 @@ class CORE_EXPORT QgsShadowEffect : public QgsPaintEffect
|
||||
int mBlurLevel;
|
||||
int mOffsetAngle;
|
||||
double mOffsetDist;
|
||||
QgsSymbolV2::OutputUnit mOffsetUnit;
|
||||
QgsUnitTypes::RenderUnit mOffsetUnit;
|
||||
QgsMapUnitScale mOffsetMapUnitScale;
|
||||
double mTransparency;
|
||||
QColor mColor;
|
||||
|
@ -32,7 +32,7 @@ QgsTransformEffect::QgsTransformEffect()
|
||||
: QgsPaintEffect()
|
||||
, mTranslateX( 0.0 )
|
||||
, mTranslateY( 0.0 )
|
||||
, mTranslateUnit( QgsSymbolV2::MM )
|
||||
, mTranslateUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mScaleX( 1.0 )
|
||||
, mScaleY( 1.0 )
|
||||
, mRotation( 0.0 )
|
||||
@ -78,7 +78,7 @@ QgsStringMap QgsTransformEffect::properties() const
|
||||
props.insert( "shear_y", QString::number( mShearY ) );
|
||||
props.insert( "translate_x", QString::number( mTranslateX ) );
|
||||
props.insert( "translate_y", QString::number( mTranslateY ) );
|
||||
props.insert( "translate_unit", QgsSymbolLayerV2Utils::encodeOutputUnit( mTranslateUnit ) );
|
||||
props.insert( "translate_unit", QgsUnitTypes::encodeUnit( mTranslateUnit ) );
|
||||
props.insert( "translate_unit_scale", QgsSymbolLayerV2Utils::encodeMapUnitScale( mTranslateMapUnitScale ) );
|
||||
props.insert( "enabled", mEnabled ? "1" : "0" );
|
||||
props.insert( "draw_mode", QString::number( int( mDrawMode ) ) );
|
||||
@ -96,7 +96,7 @@ void QgsTransformEffect::readProperties( const QgsStringMap &props )
|
||||
mRotation = props.value( "rotation", "0.0" ).toDouble();
|
||||
mTranslateX = props.value( "translate_x", "0.0" ).toDouble();
|
||||
mTranslateY = props.value( "translate_y", "0.0" ).toDouble();
|
||||
mTranslateUnit = QgsSymbolLayerV2Utils::decodeOutputUnit( props.value( "translate_unit" ) );
|
||||
mTranslateUnit = QgsUnitTypes::decodeRenderUnit( props.value( "translate_unit" ) );
|
||||
mTranslateMapUnitScale = QgsSymbolLayerV2Utils::decodeMapUnitScale( props.value( "translate_unit_scale" ) );
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "qgspainteffect.h"
|
||||
#include "qgis.h"
|
||||
#include "qgsmapunitscale.h"
|
||||
#include "qgssymbolv2.h"
|
||||
#include <QPainter>
|
||||
|
||||
/** \ingroup core
|
||||
@ -93,7 +92,7 @@ class CORE_EXPORT QgsTransformEffect : public QgsPaintEffect
|
||||
* @see setTranslateY
|
||||
* @see setTranslateMapUnitScale
|
||||
*/
|
||||
void setTranslateUnit( const QgsSymbolV2::OutputUnit unit ) { mTranslateUnit = unit; }
|
||||
void setTranslateUnit( const QgsUnitTypes::RenderUnit unit ) { mTranslateUnit = unit; }
|
||||
|
||||
/** Returns the units used for the transform translation.
|
||||
* @returns units for translation
|
||||
@ -102,7 +101,7 @@ class CORE_EXPORT QgsTransformEffect : public QgsPaintEffect
|
||||
* @see translateY
|
||||
* @see translateMapUnitScale
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit translateUnit() const { return mTranslateUnit; }
|
||||
QgsUnitTypes::RenderUnit translateUnit() const { return mTranslateUnit; }
|
||||
|
||||
/** Sets the map unit scale used for the transform translation.
|
||||
* @param scale map unit scale for translation
|
||||
@ -226,7 +225,7 @@ class CORE_EXPORT QgsTransformEffect : public QgsPaintEffect
|
||||
|
||||
double mTranslateX;
|
||||
double mTranslateY;
|
||||
QgsSymbolV2::OutputUnit mTranslateUnit;
|
||||
QgsUnitTypes::RenderUnit mTranslateUnit;
|
||||
QgsMapUnitScale mTranslateMapUnitScale;
|
||||
double mScaleX;
|
||||
double mScaleY;
|
||||
|
@ -140,7 +140,7 @@ QgsSymbolV2LegendNode::QgsSymbolV2LegendNode( QgsLayerTreeLayer* nodeLayer, cons
|
||||
updateLabel();
|
||||
|
||||
if ( mItem.symbol() )
|
||||
mSymbolUsesMapUnits = ( mItem.symbol()->outputUnit() != QgsSymbolV2::MM );
|
||||
mSymbolUsesMapUnits = ( mItem.symbol()->outputUnit() != QgsUnitTypes::RenderMillimeters );
|
||||
}
|
||||
|
||||
QgsSymbolV2LegendNode::~QgsSymbolV2LegendNode()
|
||||
|
@ -28,7 +28,6 @@
|
||||
#include "qgsconfig.h"
|
||||
#include "qgslogger.h"
|
||||
#include "geometry/qgswkbtypes.h"
|
||||
#include "qgsunittypes.h"
|
||||
|
||||
#include <ogr_api.h>
|
||||
|
||||
@ -88,20 +87,6 @@ double Qgis::DEFAULT_HIGHLIGHT_MIN_WIDTH_MM = 1.0;
|
||||
|
||||
double Qgis::SCALE_PRECISION = 0.9999999999;
|
||||
|
||||
// description strings for units
|
||||
// Order must match enum indices
|
||||
const char* Qgis::qgisUnitTypes[] =
|
||||
{
|
||||
QT_TRANSLATE_NOOP( "Qgis::UnitType", "meters" ),
|
||||
QT_TRANSLATE_NOOP( "Qgis::UnitType", "feet" ),
|
||||
QT_TRANSLATE_NOOP( "Qgis::UnitType", "degrees" ),
|
||||
QT_TRANSLATE_NOOP( "Qgis::UnitType", "<unknown>" ),
|
||||
QT_TRANSLATE_NOOP( "Qgis::UnitType", "degrees" ),
|
||||
QT_TRANSLATE_NOOP( "Qgis::UnitType", "degrees" ),
|
||||
QT_TRANSLATE_NOOP( "Qgis::UnitType", "degrees" ),
|
||||
QT_TRANSLATE_NOOP( "Qgis::UnitType", "nautical miles" )
|
||||
};
|
||||
|
||||
QgsWKBTypes::Type Qgis::fromOldWkbType( Qgis::WkbType type )
|
||||
{
|
||||
switch ( type )
|
||||
@ -186,36 +171,6 @@ Qgis::WkbType Qgis::fromNewWkbType( QgsWKBTypes::Type type )
|
||||
return static_cast< Qgis::WkbType >( type );
|
||||
}
|
||||
|
||||
|
||||
Qgis::UnitType Qgis::fromLiteral( const QString& literal, Qgis::UnitType defaultType )
|
||||
{
|
||||
bool ok = false;
|
||||
Qgis::UnitType unit = QgsUnitTypes::decodeDistanceUnit( literal, &ok );
|
||||
return ok ? unit : defaultType;
|
||||
}
|
||||
|
||||
QString Qgis::toLiteral( Qgis::UnitType unit )
|
||||
{
|
||||
return QgsUnitTypes::encodeUnit( unit );
|
||||
}
|
||||
|
||||
QString Qgis::tr( Qgis::UnitType unit )
|
||||
{
|
||||
return QgsUnitTypes::toString( unit );
|
||||
}
|
||||
|
||||
Qgis::UnitType Qgis::fromTr( const QString& literal, Qgis::UnitType defaultType )
|
||||
{
|
||||
bool ok = false;
|
||||
Qgis::UnitType unit = QgsUnitTypes::stringToDistanceUnit( literal, &ok );
|
||||
return ok ? unit : defaultType;
|
||||
}
|
||||
|
||||
double Qgis::fromUnitToUnitFactor( Qgis::UnitType fromUnit, Qgis::UnitType toUnit )
|
||||
{
|
||||
return QgsUnitTypes::fromUnitToUnitFactor( fromUnit, toUnit );
|
||||
}
|
||||
|
||||
double qgsPermissiveToDouble( QString string, bool &ok )
|
||||
{
|
||||
//remove any thousands separators
|
||||
|
@ -150,50 +150,6 @@ class CORE_EXPORT Qgis
|
||||
QImage::Format_ARGB32_Premultiplied */ ARGB32_Premultiplied = 13
|
||||
};
|
||||
|
||||
|
||||
/** Map units that qgis supports
|
||||
* @note that QGIS < 1.4 api had only Meters, Feet, Degrees and UnknownUnit
|
||||
* @note and QGIS >1.8 returns to that
|
||||
*/
|
||||
//TODO QGIS 3.0 - clean up and move to QgsUnitTypes and rename to DistanceUnit
|
||||
enum UnitType
|
||||
{
|
||||
Meters = 0, /*!< meters */
|
||||
Feet = 1, /*!< imperial feet */
|
||||
Degrees = 2, /*!< degrees, for planar geographic CRS distance measurements */ //for 1.0 api backwards compatibility
|
||||
NauticalMiles = 7, /*!< nautical miles */
|
||||
Kilometers = 8, /*!< kilometers */
|
||||
Yards = 9, /*!< imperial yards */
|
||||
Miles = 10, /*!< terrestial miles */
|
||||
|
||||
UnknownUnit = 3, /*!< unknown distance unit */
|
||||
|
||||
// for [1.4;1.8] api compatibility
|
||||
DecimalDegrees = 2, // was 2
|
||||
DegreesMinutesSeconds = 2, // was 4
|
||||
DegreesDecimalMinutes = 2, // was 5
|
||||
};
|
||||
|
||||
//! Provides the canonical name of the type value
|
||||
//! @deprecated use QgsUnitTypes::encodeUnit() instead
|
||||
Q_DECL_DEPRECATED static QString toLiteral( Qgis::UnitType unit );
|
||||
|
||||
//! Converts from the canonical name to the type value
|
||||
//! @deprecated use QgsUnitTypes::decodeDistanceUnit() instead
|
||||
Q_DECL_DEPRECATED static UnitType fromLiteral( const QString& literal, Qgis::UnitType defaultType = UnknownUnit );
|
||||
|
||||
//! Provides translated version of the type value
|
||||
//! @deprecated use QgsUnitTypes::toString() instead
|
||||
Q_DECL_DEPRECATED static QString tr( Qgis::UnitType unit );
|
||||
|
||||
//! Provides type value from translated version
|
||||
//! @deprecated use QgsUnitTypes::stringToDistanceUnit() instead
|
||||
Q_DECL_DEPRECATED static UnitType fromTr( const QString& literal, Qgis::UnitType defaultType = UnknownUnit );
|
||||
|
||||
//! Returns the conversion factor between the specified units
|
||||
//! @deprecated use QgsUnitTyoes::fromUnitToUnitFactor() instead
|
||||
Q_DECL_DEPRECATED static double fromUnitToUnitFactor( Qgis::UnitType fromUnit, Qgis::UnitType toUnit );
|
||||
|
||||
//! User defined event types
|
||||
enum UserEvent
|
||||
{
|
||||
|
@ -1019,7 +1019,7 @@ bool QgsCoordinateReferenceSystem::isGeographic() const
|
||||
return d->mIsGeographic;
|
||||
}
|
||||
|
||||
Qgis::UnitType QgsCoordinateReferenceSystem::mapUnits() const
|
||||
QgsUnitTypes::DistanceUnit QgsCoordinateReferenceSystem::mapUnits() const
|
||||
{
|
||||
return d->mMapUnits;
|
||||
}
|
||||
@ -1105,7 +1105,7 @@ void QgsCoordinateReferenceSystem::setMapUnits()
|
||||
d.detach();
|
||||
if ( !d->mIsValid )
|
||||
{
|
||||
d->mMapUnits = Qgis::UnknownUnit;
|
||||
d->mMapUnits = QgsUnitTypes::DistanceUnknownUnit;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1134,13 +1134,13 @@ void QgsCoordinateReferenceSystem::setMapUnits()
|
||||
QgsDebugMsg( "Projection has linear units of " + unit );
|
||||
|
||||
if ( qgsDoubleNear( toMeter, 1.0 ) ) //Unit name for meters would be "metre"
|
||||
d->mMapUnits = Qgis::Meters;
|
||||
d->mMapUnits = QgsUnitTypes::DistanceMeters;
|
||||
else if ( unit == "Foot" )
|
||||
d->mMapUnits = Qgis::Feet;
|
||||
d->mMapUnits = QgsUnitTypes::DistanceFeet;
|
||||
else
|
||||
{
|
||||
QgsDebugMsg( "Unsupported map units of " + unit );
|
||||
d->mMapUnits = Qgis::UnknownUnit;
|
||||
d->mMapUnits = QgsUnitTypes::DistanceUnknownUnit;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1148,11 +1148,11 @@ void QgsCoordinateReferenceSystem::setMapUnits()
|
||||
OSRGetAngularUnits( d->mCRS, &unitName );
|
||||
QString unit( unitName );
|
||||
if ( unit == "degree" )
|
||||
d->mMapUnits = Qgis::Degrees;
|
||||
d->mMapUnits = QgsUnitTypes::DistanceDegrees;
|
||||
else
|
||||
{
|
||||
QgsDebugMsg( "Unsupported map units of " + unit );
|
||||
d->mMapUnits = Qgis::UnknownUnit;
|
||||
d->mMapUnits = QgsUnitTypes::DistanceUnknownUnit;
|
||||
}
|
||||
QgsDebugMsgLevel( "Projection has angular units of " + unit, 3 );
|
||||
}
|
||||
@ -1567,15 +1567,15 @@ void QgsCoordinateReferenceSystem::debugPrint()
|
||||
QgsDebugMsg( "* Proj4 : " + toProj4() );
|
||||
QgsDebugMsg( "* WKT : " + toWkt() );
|
||||
QgsDebugMsg( "* Desc. : " + d->mDescription );
|
||||
if ( mapUnits() == Qgis::Meters )
|
||||
if ( mapUnits() == QgsUnitTypes::DistanceMeters )
|
||||
{
|
||||
QgsDebugMsg( "* Units : meters" );
|
||||
}
|
||||
else if ( mapUnits() == Qgis::Feet )
|
||||
else if ( mapUnits() == QgsUnitTypes::DistanceFeet )
|
||||
{
|
||||
QgsDebugMsg( "* Units : feet" );
|
||||
}
|
||||
else if ( mapUnits() == Qgis::Degrees )
|
||||
else if ( mapUnits() == QgsUnitTypes::DistanceDegrees )
|
||||
{
|
||||
QgsDebugMsg( "* Units : degrees" );
|
||||
}
|
||||
|
@ -36,6 +36,7 @@ typedef struct sqlite3 sqlite3;
|
||||
|
||||
//qgis includes
|
||||
#include "qgis.h"
|
||||
#include "qgsunittypes.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
typedef struct OGRSpatialReferenceHS *OGRSpatialReferenceH;
|
||||
@ -530,8 +531,7 @@ class CORE_EXPORT QgsCoordinateReferenceSystem
|
||||
|
||||
/** Returns the units for the projection used by the CRS.
|
||||
*/
|
||||
Qgis::UnitType mapUnits() const;
|
||||
|
||||
QgsUnitTypes::DistanceUnit mapUnits() const;
|
||||
|
||||
// Mutators -----------------------------------
|
||||
/** Set user hint for validation
|
||||
|
@ -45,7 +45,7 @@ class QgsCoordinateReferenceSystemPrivate : public QSharedData
|
||||
explicit QgsCoordinateReferenceSystemPrivate()
|
||||
: mSrsId( 0 )
|
||||
, mIsGeographic( false )
|
||||
, mMapUnits( Qgis::UnknownUnit )
|
||||
, mMapUnits( QgsUnitTypes::DistanceUnknownUnit )
|
||||
, mSRID( 0 )
|
||||
, mIsValid( 0 )
|
||||
, mCRS( OSRNewSpatialReference( nullptr ) )
|
||||
@ -99,7 +99,7 @@ class QgsCoordinateReferenceSystemPrivate : public QSharedData
|
||||
bool mIsGeographic;
|
||||
|
||||
//! The map units for the CRS
|
||||
Qgis::UnitType mMapUnits;
|
||||
QgsUnitTypes::DistanceUnit mMapUnits;
|
||||
|
||||
//! If available, the Postgis spatial_ref_sys identifier for this CRS (defaults to 0)
|
||||
long mSRID;
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "qgslayertreemodellegendnode.h"
|
||||
#include "qgsfontutils.h"
|
||||
#include "qgssymbollayerv2utils.h"
|
||||
#include "qgssymbolv2.h"
|
||||
|
||||
#include <QDomElement>
|
||||
#include <QPainter>
|
||||
@ -193,16 +192,16 @@ void QgsDiagramSettings::readXml( const QDomElement& elem, const QgsVectorLayer*
|
||||
if ( elem.attribute( "sizeType" ) == "MapUnits" )
|
||||
{
|
||||
//compatibility with pre-2.16 project files
|
||||
sizeType = QgsSymbolV2::MapUnit;
|
||||
sizeType = QgsUnitTypes::RenderMapUnits;
|
||||
}
|
||||
else
|
||||
{
|
||||
sizeType = QgsSymbolLayerV2Utils::decodeOutputUnit( elem.attribute( "sizeType" ) );
|
||||
sizeType = QgsUnitTypes::decodeRenderUnit( elem.attribute( "sizeType" ) );
|
||||
}
|
||||
sizeScale = QgsSymbolLayerV2Utils::decodeMapUnitScale( elem.attribute( "sizeScale" ) );
|
||||
|
||||
//line width unit type and scale
|
||||
lineSizeUnit = QgsSymbolLayerV2Utils::decodeOutputUnit( elem.attribute( "lineSizeType" ) );
|
||||
lineSizeUnit = QgsUnitTypes::decodeRenderUnit( elem.attribute( "lineSizeType" ) );
|
||||
lineSizeScale = QgsSymbolLayerV2Utils::decodeMapUnitScale( elem.attribute( "lineSizeScale" ) );
|
||||
|
||||
//label placement method
|
||||
@ -314,11 +313,11 @@ void QgsDiagramSettings::writeXml( QDomElement& rendererElem, QDomDocument& doc,
|
||||
categoryElem.setAttribute( "transparency", QString::number( transparency ) );
|
||||
|
||||
//diagram size unit type and scale
|
||||
categoryElem.setAttribute( "sizeType", QgsSymbolLayerV2Utils::encodeOutputUnit( sizeType ) );
|
||||
categoryElem.setAttribute( "sizeType", QgsUnitTypes::encodeUnit( sizeType ) );
|
||||
categoryElem.setAttribute( "sizeScale", QgsSymbolLayerV2Utils::encodeMapUnitScale( sizeScale ) );
|
||||
|
||||
//line width unit type and scale
|
||||
categoryElem.setAttribute( "lineSizeType", QgsSymbolLayerV2Utils::encodeOutputUnit( lineSizeUnit ) );
|
||||
categoryElem.setAttribute( "lineSizeType", QgsUnitTypes::encodeUnit( lineSizeUnit ) );
|
||||
categoryElem.setAttribute( "lineSizeScale", QgsSymbolLayerV2Utils::encodeMapUnitScale( lineSizeScale ) );
|
||||
|
||||
// label placement method (text diagram)
|
||||
|
@ -297,7 +297,7 @@ class CORE_EXPORT QgsDiagramSettings
|
||||
{
|
||||
public:
|
||||
|
||||
//! @deprecated use QgsSymbolV2::OutputUnit instead
|
||||
//! @deprecated use QgsUnitTypes::RenderUnit instead
|
||||
enum SizeType
|
||||
{
|
||||
MM,
|
||||
@ -321,8 +321,8 @@ class CORE_EXPORT QgsDiagramSettings
|
||||
|
||||
QgsDiagramSettings()
|
||||
: enabled( true )
|
||||
, sizeType( QgsSymbolV2::MM )
|
||||
, lineSizeUnit( QgsSymbolV2::MM )
|
||||
, sizeType( QgsUnitTypes::RenderMillimeters )
|
||||
, lineSizeUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, penWidth( 0.0 )
|
||||
, labelPlacementMethod( QgsDiagramSettings::Height )
|
||||
, diagramOrientation( QgsDiagramSettings::Up )
|
||||
@ -345,7 +345,7 @@ class CORE_EXPORT QgsDiagramSettings
|
||||
|
||||
/** Diagram size unit
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit sizeType;
|
||||
QgsUnitTypes::RenderUnit sizeType;
|
||||
|
||||
/** Diagram size unit scale
|
||||
* @note added in 2.16
|
||||
@ -355,7 +355,7 @@ class CORE_EXPORT QgsDiagramSettings
|
||||
/** Line unit index
|
||||
* @note added in 2.16
|
||||
*/
|
||||
QgsSymbolV2::OutputUnit lineSizeUnit;
|
||||
QgsUnitTypes::RenderUnit lineSizeUnit;
|
||||
|
||||
/** Line unit scale
|
||||
* @note added in 2.16
|
||||
|
@ -486,11 +486,11 @@ double QgsDistanceArea::measureLine( const QList<QgsPoint> &points ) const
|
||||
|
||||
double QgsDistanceArea::measureLine( const QgsPoint &p1, const QgsPoint &p2 ) const
|
||||
{
|
||||
Qgis::UnitType units;
|
||||
QgsUnitTypes::DistanceUnit units;
|
||||
return measureLine( p1, p2, units );
|
||||
}
|
||||
|
||||
double QgsDistanceArea::measureLine( const QgsPoint& p1, const QgsPoint& p2, Qgis::UnitType& units ) const
|
||||
double QgsDistanceArea::measureLine( const QgsPoint& p1, const QgsPoint& p2, QgsUnitTypes::DistanceUnit& units ) const
|
||||
{
|
||||
double result;
|
||||
units = mCoordTransform.sourceCrs().mapUnits();
|
||||
@ -502,7 +502,7 @@ double QgsDistanceArea::measureLine( const QgsPoint& p1, const QgsPoint& p2, Qgi
|
||||
QgsDebugMsgLevel( QString( "Measuring from %1 to %2" ).arg( p1.toString( 4 ), p2.toString( 4 ) ), 3 );
|
||||
if ( mEllipsoidalMode && ( mEllipsoid != GEO_NONE ) )
|
||||
{
|
||||
units = Qgis::Meters;
|
||||
units = QgsUnitTypes::DistanceMeters;
|
||||
QgsDebugMsgLevel( QString( "Ellipsoidal calculations is enabled, using ellipsoid %1" ).arg( mEllipsoid ), 4 );
|
||||
QgsDebugMsgLevel( QString( "From proj4 : %1" ).arg( mCoordTransform.sourceCrs().toProj4() ), 4 );
|
||||
QgsDebugMsgLevel( QString( "To proj4 : %1" ).arg( mCoordTransform.destinationCrs().toProj4() ), 4 );
|
||||
@ -527,14 +527,14 @@ double QgsDistanceArea::measureLine( const QgsPoint& p1, const QgsPoint& p2, Qgi
|
||||
return result;
|
||||
}
|
||||
|
||||
Qgis::UnitType QgsDistanceArea::lengthUnits() const
|
||||
QgsUnitTypes::DistanceUnit QgsDistanceArea::lengthUnits() const
|
||||
{
|
||||
return willUseEllipsoid() ? Qgis::Meters : mCoordTransform.sourceCrs().mapUnits();
|
||||
return willUseEllipsoid() ? QgsUnitTypes::DistanceMeters : mCoordTransform.sourceCrs().mapUnits();
|
||||
}
|
||||
|
||||
QgsUnitTypes::AreaUnit QgsDistanceArea::areaUnits() const
|
||||
{
|
||||
return willUseEllipsoid() ? QgsUnitTypes::SquareMeters :
|
||||
return willUseEllipsoid() ? QgsUnitTypes::AreaSquareMeters :
|
||||
QgsUnitTypes::distanceToAreaUnit( mCoordTransform.sourceCrs().mapUnits() );
|
||||
}
|
||||
|
||||
@ -966,13 +966,13 @@ double QgsDistanceArea::computePolygonFlatArea( const QList<QgsPoint>& points )
|
||||
return qAbs( area ); // All areas are positive!
|
||||
}
|
||||
|
||||
QString QgsDistanceArea::textUnit( double value, int decimals, Qgis::UnitType u, bool isArea, bool keepBaseUnit )
|
||||
QString QgsDistanceArea::textUnit( double value, int decimals, QgsUnitTypes::DistanceUnit u, bool isArea, bool keepBaseUnit )
|
||||
{
|
||||
QString unitLabel;
|
||||
|
||||
switch ( u )
|
||||
{
|
||||
case Qgis::Meters:
|
||||
case QgsUnitTypes::DistanceMeters:
|
||||
if ( isArea )
|
||||
{
|
||||
if ( keepBaseUnit )
|
||||
@ -1021,7 +1021,7 @@ QString QgsDistanceArea::textUnit( double value, int decimals, Qgis::UnitType u,
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Qgis::Feet:
|
||||
case QgsUnitTypes::DistanceFeet:
|
||||
if ( isArea )
|
||||
{
|
||||
if ( keepBaseUnit || qAbs( value ) <= 0.5*43560.0 )
|
||||
@ -1062,7 +1062,7 @@ QString QgsDistanceArea::textUnit( double value, int decimals, Qgis::UnitType u,
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Qgis::NauticalMiles:
|
||||
case QgsUnitTypes::DistanceNauticalMiles:
|
||||
if ( isArea )
|
||||
{
|
||||
unitLabel = QObject::tr( " sq. NM" );
|
||||
@ -1072,7 +1072,7 @@ QString QgsDistanceArea::textUnit( double value, int decimals, Qgis::UnitType u,
|
||||
unitLabel = QObject::tr( " NM" );
|
||||
}
|
||||
break;
|
||||
case Qgis::Degrees:
|
||||
case QgsUnitTypes::DistanceDegrees:
|
||||
if ( isArea )
|
||||
{
|
||||
unitLabel = QObject::tr( " sq.deg." );
|
||||
@ -1085,7 +1085,7 @@ QString QgsDistanceArea::textUnit( double value, int decimals, Qgis::UnitType u,
|
||||
unitLabel = QObject::tr( " degrees" );
|
||||
}
|
||||
break;
|
||||
case Qgis::UnknownUnit:
|
||||
case QgsUnitTypes::DistanceUnknownUnit:
|
||||
unitLabel.clear();
|
||||
break;
|
||||
default:
|
||||
@ -1096,13 +1096,13 @@ QString QgsDistanceArea::textUnit( double value, int decimals, Qgis::UnitType u,
|
||||
return QString( "%L1%2" ).arg( value, 0, 'f', decimals ).arg( unitLabel );
|
||||
}
|
||||
|
||||
QString QgsDistanceArea::formatDistance( double distance, int decimals, Qgis::UnitType unit, bool keepBaseUnit )
|
||||
QString QgsDistanceArea::formatDistance( double distance, int decimals, QgsUnitTypes::DistanceUnit unit, bool keepBaseUnit )
|
||||
{
|
||||
QString unitLabel;
|
||||
|
||||
switch ( unit )
|
||||
{
|
||||
case Qgis::Meters:
|
||||
case QgsUnitTypes::DistanceMeters:
|
||||
if ( keepBaseUnit || qAbs( distance ) == 0.0 )
|
||||
{
|
||||
unitLabel = QObject::tr( " m" );
|
||||
@ -1128,7 +1128,7 @@ QString QgsDistanceArea::formatDistance( double distance, int decimals, Qgis::Un
|
||||
}
|
||||
break;
|
||||
|
||||
case Qgis::Kilometers:
|
||||
case QgsUnitTypes::DistanceKilometers:
|
||||
if ( keepBaseUnit || qAbs( distance ) >= 1.0 )
|
||||
{
|
||||
unitLabel = QObject::tr( " km" );
|
||||
@ -1140,7 +1140,7 @@ QString QgsDistanceArea::formatDistance( double distance, int decimals, Qgis::Un
|
||||
}
|
||||
break;
|
||||
|
||||
case Qgis::Feet:
|
||||
case QgsUnitTypes::DistanceFeet:
|
||||
if ( qAbs( distance ) <= 5280.0 || keepBaseUnit )
|
||||
{
|
||||
unitLabel = QObject::tr( " ft" );
|
||||
@ -1152,7 +1152,7 @@ QString QgsDistanceArea::formatDistance( double distance, int decimals, Qgis::Un
|
||||
}
|
||||
break;
|
||||
|
||||
case Qgis::Yards:
|
||||
case QgsUnitTypes::DistanceYards:
|
||||
if ( qAbs( distance ) <= 1760.0 || keepBaseUnit )
|
||||
{
|
||||
unitLabel = QObject::tr( " yd" );
|
||||
@ -1164,7 +1164,7 @@ QString QgsDistanceArea::formatDistance( double distance, int decimals, Qgis::Un
|
||||
}
|
||||
break;
|
||||
|
||||
case Qgis::Miles:
|
||||
case QgsUnitTypes::DistanceMiles:
|
||||
if ( qAbs( distance ) >= 1.0 || keepBaseUnit )
|
||||
{
|
||||
unitLabel = QObject::tr( " mi" );
|
||||
@ -1176,11 +1176,11 @@ QString QgsDistanceArea::formatDistance( double distance, int decimals, Qgis::Un
|
||||
}
|
||||
break;
|
||||
|
||||
case Qgis::NauticalMiles:
|
||||
case QgsUnitTypes::DistanceNauticalMiles:
|
||||
unitLabel = QObject::tr( " NM" );
|
||||
break;
|
||||
|
||||
case Qgis::Degrees:
|
||||
case QgsUnitTypes::DistanceDegrees:
|
||||
|
||||
if ( qAbs( distance ) == 1.0 )
|
||||
unitLabel = QObject::tr( " degree" );
|
||||
@ -1188,7 +1188,7 @@ QString QgsDistanceArea::formatDistance( double distance, int decimals, Qgis::Un
|
||||
unitLabel = QObject::tr( " degrees" );
|
||||
break;
|
||||
|
||||
case Qgis::UnknownUnit:
|
||||
case QgsUnitTypes::DistanceUnknownUnit:
|
||||
unitLabel.clear();
|
||||
break;
|
||||
default:
|
||||
@ -1205,21 +1205,21 @@ QString QgsDistanceArea::formatArea( double area, int decimals, QgsUnitTypes::Ar
|
||||
|
||||
switch ( unit )
|
||||
{
|
||||
case QgsUnitTypes::SquareMeters:
|
||||
case QgsUnitTypes::AreaSquareMeters:
|
||||
{
|
||||
if ( keepBaseUnit )
|
||||
{
|
||||
unitLabel = QObject::trUtf8( " m²" );
|
||||
}
|
||||
else if ( qAbs( area ) > QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::SquareKilometers, QgsUnitTypes::SquareMeters ) )
|
||||
else if ( qAbs( area ) > QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::AreaSquareKilometers, QgsUnitTypes::AreaSquareMeters ) )
|
||||
{
|
||||
unitLabel = QObject::trUtf8( " km²" );
|
||||
area = area * QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::SquareMeters, QgsUnitTypes::SquareKilometers );
|
||||
area = area * QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::AreaSquareMeters, QgsUnitTypes::AreaSquareKilometers );
|
||||
}
|
||||
else if ( qAbs( area ) > QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::Hectares, QgsUnitTypes::SquareMeters ) )
|
||||
else if ( qAbs( area ) > QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::AreaHectares, QgsUnitTypes::AreaSquareMeters ) )
|
||||
{
|
||||
unitLabel = QObject::tr( " ha" );
|
||||
area = area * QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::SquareMeters, QgsUnitTypes::Hectares );
|
||||
area = area * QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::AreaSquareMeters, QgsUnitTypes::AreaHectares );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1228,22 +1228,22 @@ QString QgsDistanceArea::formatArea( double area, int decimals, QgsUnitTypes::Ar
|
||||
break;
|
||||
}
|
||||
|
||||
case QgsUnitTypes::SquareKilometers:
|
||||
case QgsUnitTypes::AreaSquareKilometers:
|
||||
{
|
||||
unitLabel = QObject::trUtf8( " km²" );
|
||||
break;
|
||||
}
|
||||
|
||||
case QgsUnitTypes::SquareFeet:
|
||||
case QgsUnitTypes::AreaSquareFeet:
|
||||
{
|
||||
if ( keepBaseUnit )
|
||||
{
|
||||
unitLabel = QObject::trUtf8( " ft²" );
|
||||
}
|
||||
else if ( qAbs( area ) > QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::SquareMiles, QgsUnitTypes::SquareFeet ) )
|
||||
else if ( qAbs( area ) > QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::AreaSquareMiles, QgsUnitTypes::AreaSquareFeet ) )
|
||||
{
|
||||
unitLabel = QObject::trUtf8( " mi²" );
|
||||
area = area * QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::SquareFeet, QgsUnitTypes::SquareMiles );
|
||||
area = area * QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::AreaSquareFeet, QgsUnitTypes::AreaSquareMiles );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1252,16 +1252,16 @@ QString QgsDistanceArea::formatArea( double area, int decimals, QgsUnitTypes::Ar
|
||||
break;
|
||||
}
|
||||
|
||||
case QgsUnitTypes::SquareYards:
|
||||
case QgsUnitTypes::AreaSquareYards:
|
||||
{
|
||||
if ( keepBaseUnit )
|
||||
{
|
||||
unitLabel = QObject::trUtf8( " yd²" );
|
||||
}
|
||||
else if ( qAbs( area ) > QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::SquareMiles, QgsUnitTypes::SquareYards ) )
|
||||
else if ( qAbs( area ) > QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::AreaSquareMiles, QgsUnitTypes::AreaSquareYards ) )
|
||||
{
|
||||
unitLabel = QObject::trUtf8( " mi²" );
|
||||
area = area * QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::SquareYards, QgsUnitTypes::SquareMiles );
|
||||
area = area * QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::AreaSquareYards, QgsUnitTypes::AreaSquareMiles );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1270,22 +1270,22 @@ QString QgsDistanceArea::formatArea( double area, int decimals, QgsUnitTypes::Ar
|
||||
break;
|
||||
}
|
||||
|
||||
case QgsUnitTypes::SquareMiles:
|
||||
case QgsUnitTypes::AreaSquareMiles:
|
||||
{
|
||||
unitLabel = QObject::trUtf8( " mi²" );
|
||||
break;
|
||||
}
|
||||
|
||||
case QgsUnitTypes::Hectares:
|
||||
case QgsUnitTypes::AreaHectares:
|
||||
{
|
||||
if ( keepBaseUnit )
|
||||
{
|
||||
unitLabel = QObject::trUtf8( " ha" );
|
||||
}
|
||||
else if ( qAbs( area ) > QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::SquareKilometers, QgsUnitTypes::Hectares ) )
|
||||
else if ( qAbs( area ) > QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::AreaSquareKilometers, QgsUnitTypes::AreaHectares ) )
|
||||
{
|
||||
unitLabel = QObject::trUtf8( " km²" );
|
||||
area = area * QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::Hectares, QgsUnitTypes::SquareKilometers );
|
||||
area = area * QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::AreaHectares, QgsUnitTypes::AreaSquareKilometers );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1294,16 +1294,16 @@ QString QgsDistanceArea::formatArea( double area, int decimals, QgsUnitTypes::Ar
|
||||
break;
|
||||
}
|
||||
|
||||
case QgsUnitTypes::Acres:
|
||||
case QgsUnitTypes::AreaAcres:
|
||||
{
|
||||
if ( keepBaseUnit )
|
||||
{
|
||||
unitLabel = QObject::trUtf8( " ac" );
|
||||
}
|
||||
else if ( qAbs( area ) > QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::SquareMiles, QgsUnitTypes::Acres ) )
|
||||
else if ( qAbs( area ) > QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::AreaSquareMiles, QgsUnitTypes::AreaAcres ) )
|
||||
{
|
||||
unitLabel = QObject::trUtf8( " mi²" );
|
||||
area = area * QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::Acres, QgsUnitTypes::SquareMiles );
|
||||
area = area * QgsUnitTypes::fromUnitToUnitFactor( QgsUnitTypes::AreaAcres, QgsUnitTypes::AreaSquareMiles );
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1312,19 +1312,19 @@ QString QgsDistanceArea::formatArea( double area, int decimals, QgsUnitTypes::Ar
|
||||
break;
|
||||
}
|
||||
|
||||
case QgsUnitTypes::SquareNauticalMiles:
|
||||
case QgsUnitTypes::AreaSquareNauticalMiles:
|
||||
{
|
||||
unitLabel = QObject::trUtf8( " nm²" );
|
||||
break;
|
||||
}
|
||||
|
||||
case QgsUnitTypes::SquareDegrees:
|
||||
case QgsUnitTypes::AreaSquareDegrees:
|
||||
{
|
||||
unitLabel = QObject::tr( " sq.deg." );
|
||||
break;
|
||||
}
|
||||
|
||||
case QgsUnitTypes::UnknownAreaUnit:
|
||||
case QgsUnitTypes::AreaUnknownUnit:
|
||||
{
|
||||
unitLabel.clear();
|
||||
break;
|
||||
@ -1334,17 +1334,17 @@ QString QgsDistanceArea::formatArea( double area, int decimals, QgsUnitTypes::Ar
|
||||
return QString( "%L1%2" ).arg( area, 0, 'f', decimals ).arg( unitLabel );
|
||||
}
|
||||
|
||||
void QgsDistanceArea::convertMeasurement( double &measure, Qgis::UnitType &measureUnits, Qgis::UnitType displayUnits, bool isArea ) const
|
||||
void QgsDistanceArea::convertMeasurement( double &measure, QgsUnitTypes::DistanceUnit &measureUnits, QgsUnitTypes::DistanceUnit displayUnits, bool isArea ) const
|
||||
{
|
||||
// Helper for converting between meters and feet and degrees and NauticalMiles...
|
||||
// The parameters measure and measureUnits are in/out
|
||||
|
||||
if (( measureUnits == Qgis::Degrees || measureUnits == Qgis::Feet || measureUnits == Qgis::NauticalMiles ) &&
|
||||
if (( measureUnits == QgsUnitTypes::DistanceDegrees || measureUnits == QgsUnitTypes::DistanceFeet || measureUnits == QgsUnitTypes::DistanceNauticalMiles ) &&
|
||||
mEllipsoid != GEO_NONE &&
|
||||
mEllipsoidalMode )
|
||||
{
|
||||
// Measuring on an ellipsoid returned meters. Force!
|
||||
measureUnits = Qgis::Meters;
|
||||
measureUnits = QgsUnitTypes::DistanceMeters;
|
||||
QgsDebugMsg( "We're measuring on an ellipsoid or using projections, the system is returning meters" );
|
||||
}
|
||||
else if ( mEllipsoidalMode && mEllipsoid == GEO_NONE )
|
||||
@ -1365,10 +1365,10 @@ void QgsDistanceArea::convertMeasurement( double &measure, Qgis::UnitType &measu
|
||||
measureUnits = displayUnits;
|
||||
}
|
||||
|
||||
double QgsDistanceArea::convertLengthMeasurement( double length, Qgis::UnitType toUnits ) const
|
||||
double QgsDistanceArea::convertLengthMeasurement( double length, QgsUnitTypes::DistanceUnit toUnits ) const
|
||||
{
|
||||
// get the conversion factor between the specified units
|
||||
Qgis::UnitType measureUnits = lengthUnits();
|
||||
QgsUnitTypes::DistanceUnit measureUnits = lengthUnits();
|
||||
double factorUnits = QgsUnitTypes::fromUnitToUnitFactor( measureUnits, toUnits );
|
||||
|
||||
double result = length * factorUnits;
|
||||
|
@ -193,13 +193,13 @@ class CORE_EXPORT QgsDistanceArea
|
||||
* @returns calculated distance between points. Distance units are stored in units parameter.
|
||||
* @note added in QGIS 2.12
|
||||
*/
|
||||
double measureLine( const QgsPoint& p1, const QgsPoint& p2, Qgis::UnitType& units ) const;
|
||||
double measureLine( const QgsPoint& p1, const QgsPoint& p2, QgsUnitTypes::DistanceUnit& units ) const;
|
||||
|
||||
/** Returns the units of distance for length calculations made by this object.
|
||||
* @note added in QGIS 2.14
|
||||
* @see areaUnits()
|
||||
*/
|
||||
Qgis::UnitType lengthUnits() const;
|
||||
QgsUnitTypes::DistanceUnit lengthUnits() const;
|
||||
|
||||
/** Returns the units of area for areal calculations made by this object.
|
||||
* @note added in QGIS 2.14
|
||||
@ -223,7 +223,7 @@ class CORE_EXPORT QgsDistanceArea
|
||||
* @return formatted measurement string
|
||||
* @deprecated use formatDistance() or formatArea() instead
|
||||
*/
|
||||
Q_DECL_DEPRECATED static QString textUnit( double value, int decimals, Qgis::UnitType u, bool isArea, bool keepBaseUnit = false );
|
||||
Q_DECL_DEPRECATED static QString textUnit( double value, int decimals, QgsUnitTypes::DistanceUnit u, bool isArea, bool keepBaseUnit = false );
|
||||
|
||||
/** Returns an distance formatted as a friendly string.
|
||||
* @param distance distance to format
|
||||
@ -235,7 +235,7 @@ class CORE_EXPORT QgsDistanceArea
|
||||
* @note added in QGIS 2.16
|
||||
* @see formatArea()
|
||||
*/
|
||||
static QString formatDistance( double distance, int decimals, Qgis::UnitType unit, bool keepBaseUnit = false );
|
||||
static QString formatDistance( double distance, int decimals, QgsUnitTypes::DistanceUnit unit, bool keepBaseUnit = false );
|
||||
|
||||
/** Returns an area formatted as a friendly string.
|
||||
* @param area area to format
|
||||
@ -251,7 +251,7 @@ class CORE_EXPORT QgsDistanceArea
|
||||
|
||||
//! Helper for conversion between physical units
|
||||
// TODO QGIS 3.0 - remove this method, as its behaviour is non-intuitive.
|
||||
void convertMeasurement( double &measure, Qgis::UnitType &measureUnits, Qgis::UnitType displayUnits, bool isArea ) const;
|
||||
void convertMeasurement( double &measure, QgsUnitTypes::DistanceUnit &measureUnits, QgsUnitTypes::DistanceUnit displayUnits, bool isArea ) const;
|
||||
|
||||
/** Takes a length measurement calculated by this QgsDistanceArea object and converts it to a
|
||||
* different distance unit.
|
||||
@ -262,7 +262,7 @@ class CORE_EXPORT QgsDistanceArea
|
||||
* @see convertAreaMeasurement()
|
||||
* @note added in QGIS 2.14
|
||||
*/
|
||||
double convertLengthMeasurement( double length, Qgis::UnitType toUnits ) const;
|
||||
double convertLengthMeasurement( double length, QgsUnitTypes::DistanceUnit toUnits ) const;
|
||||
|
||||
/** Takes an area measurement calculated by this QgsDistanceArea object and converts it to a
|
||||
* different areal unit.
|
||||
|
@ -3796,12 +3796,12 @@ QgsDistanceArea* QgsExpression::geomCalculator()
|
||||
return d->mCalc.data();
|
||||
}
|
||||
|
||||
Qgis::UnitType QgsExpression::distanceUnits() const
|
||||
QgsUnitTypes::DistanceUnit QgsExpression::distanceUnits() const
|
||||
{
|
||||
return d->mDistanceUnit;
|
||||
}
|
||||
|
||||
void QgsExpression::setDistanceUnits( Qgis::UnitType unit )
|
||||
void QgsExpression::setDistanceUnits( QgsUnitTypes::DistanceUnit unit )
|
||||
{
|
||||
d->mDistanceUnit = unit;
|
||||
}
|
||||
|
@ -289,7 +289,7 @@ class CORE_EXPORT QgsExpression
|
||||
* @see setDistanceUnits()
|
||||
* @see areaUnits()
|
||||
*/
|
||||
Qgis::UnitType distanceUnits() const;
|
||||
QgsUnitTypes::DistanceUnit distanceUnits() const;
|
||||
|
||||
/** Sets the desired distance units for calculations involving geomCalculator(), eg "$length" and "$perimeter".
|
||||
* @note distances are only converted when a geomCalculator() has been set
|
||||
@ -297,7 +297,7 @@ class CORE_EXPORT QgsExpression
|
||||
* @see distanceUnits()
|
||||
* @see setAreaUnits()
|
||||
*/
|
||||
void setDistanceUnits( Qgis::UnitType unit );
|
||||
void setDistanceUnits( QgsUnitTypes::DistanceUnit unit );
|
||||
|
||||
/** Returns the desired areal units for calculations involving geomCalculator(), eg "$area".
|
||||
* @note areas are only converted when a geomCalculator() has been set
|
||||
|
@ -39,8 +39,8 @@ class QgsExpressionPrivate
|
||||
, mRowNumber( 0 )
|
||||
, mScale( 0 )
|
||||
, mCalc( nullptr )
|
||||
, mDistanceUnit( Qgis::UnknownUnit )
|
||||
, mAreaUnit( QgsUnitTypes::UnknownAreaUnit )
|
||||
, mDistanceUnit( QgsUnitTypes::DistanceUnknownUnit )
|
||||
, mAreaUnit( QgsUnitTypes::AreaUnknownUnit )
|
||||
{}
|
||||
|
||||
QgsExpressionPrivate( const QgsExpressionPrivate& other )
|
||||
@ -73,7 +73,7 @@ class QgsExpressionPrivate
|
||||
QString mExp;
|
||||
|
||||
QSharedPointer<QgsDistanceArea> mCalc;
|
||||
Qgis::UnitType mDistanceUnit;
|
||||
QgsUnitTypes::DistanceUnit mDistanceUnit;
|
||||
QgsUnitTypes::AreaUnit mAreaUnit;
|
||||
};
|
||||
///@endcond
|
||||
|
@ -53,7 +53,7 @@ QgsMapSettings::QgsMapSettings()
|
||||
updateDerived();
|
||||
|
||||
// set default map units - we use WGS 84 thus use degrees
|
||||
setMapUnits( Qgis::Degrees );
|
||||
setMapUnits( QgsUnitTypes::DistanceDegrees );
|
||||
}
|
||||
|
||||
void QgsMapSettings::setMagnificationFactor( double factor )
|
||||
@ -297,7 +297,7 @@ QgsCoordinateReferenceSystem QgsMapSettings::destinationCrs() const
|
||||
}
|
||||
|
||||
|
||||
void QgsMapSettings::setMapUnits( Qgis::UnitType u )
|
||||
void QgsMapSettings::setMapUnits( QgsUnitTypes::DistanceUnit u )
|
||||
{
|
||||
mScaleCalculator.setMapUnits( u );
|
||||
|
||||
@ -328,7 +328,7 @@ bool QgsMapSettings::testFlag( QgsMapSettings::Flag flag ) const
|
||||
return mFlags.testFlag( flag );
|
||||
}
|
||||
|
||||
Qgis::UnitType QgsMapSettings::mapUnits() const
|
||||
QgsUnitTypes::DistanceUnit QgsMapSettings::mapUnits() const
|
||||
{
|
||||
return mScaleCalculator.mapUnits();
|
||||
}
|
||||
@ -608,7 +608,7 @@ void QgsMapSettings::readXml( QDomNode& theNode )
|
||||
{
|
||||
// set units
|
||||
QDomNode mapUnitsNode = theNode.namedItem( "units" );
|
||||
Qgis::UnitType units = QgsXmlUtils::readMapUnits( mapUnitsNode.toElement() );
|
||||
QgsUnitTypes::DistanceUnit units = QgsXmlUtils::readMapUnits( mapUnitsNode.toElement() );
|
||||
setMapUnits( units );
|
||||
|
||||
// set projections flag
|
||||
|
@ -139,9 +139,9 @@ class CORE_EXPORT QgsMapSettings
|
||||
QgsCoordinateReferenceSystem destinationCrs() const;
|
||||
|
||||
//! Get units of map's geographical coordinates - used for scale calculation
|
||||
Qgis::UnitType mapUnits() const;
|
||||
QgsUnitTypes::DistanceUnit mapUnits() const;
|
||||
//! Set units of map's geographical coordinates - used for scale calculation
|
||||
void setMapUnits( Qgis::UnitType u );
|
||||
void setMapUnits( QgsUnitTypes::DistanceUnit u );
|
||||
|
||||
//! Set the background color of the map
|
||||
void setBackgroundColor( const QColor& color ) { mBackgroundColor = color; }
|
||||
|
@ -57,7 +57,6 @@
|
||||
#include <qgsmarkersymbollayerv2.h>
|
||||
#include <qgspainting.h>
|
||||
#include <qgsproject.h>
|
||||
#include "qgssymbolv2.h"
|
||||
#include "qgssymbollayerv2utils.h"
|
||||
#include "qgsmaptopixelgeometrysimplifier.h"
|
||||
#include <QMessageBox>
|
||||
@ -4811,15 +4810,15 @@ void QgsPalLabeling::drawLabelBackground( QgsRenderContext& context,
|
||||
QgsStringMap map; // for SVG symbology marker
|
||||
map["name"] = QgsSymbolLayerV2Utils::symbolNameToPath( tmpLyr.shapeSVGFile.trimmed() );
|
||||
map["size"] = QString::number( sizeOut );
|
||||
map["size_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit(
|
||||
tmpLyr.shapeSizeUnits == QgsPalLayerSettings::MapUnits ? QgsSymbolV2::MapUnit : QgsSymbolV2::MM );
|
||||
map["size_unit"] = QgsUnitTypes::encodeUnit(
|
||||
tmpLyr.shapeSizeUnits == QgsPalLayerSettings::MapUnits ? QgsUnitTypes::RenderMapUnits : QgsUnitTypes::RenderMillimeters );
|
||||
map["angle"] = QString::number( 0.0 ); // angle is handled by this local painter
|
||||
|
||||
// offset is handled by this local painter
|
||||
// TODO: see why the marker renderer doesn't seem to translate offset *after* applying rotation
|
||||
//map["offset"] = QgsSymbolLayerV2Utils::encodePoint( tmpLyr.shapeOffset );
|
||||
//map["offset_unit"] = QgsUnitTypes::encodeUnit(
|
||||
// tmpLyr.shapeOffsetUnits == QgsPalLayerSettings::MapUnits ? QgsSymbolV2::MapUnit : QgsSymbolV2::MM );
|
||||
// tmpLyr.shapeOffsetUnits == QgsPalLayerSettings::MapUnits ? QgsUnitTypes::MapUnit : QgsUnitTypes::MM );
|
||||
|
||||
map["fill"] = tmpLyr.shapeFillColor.name();
|
||||
map["outline"] = tmpLyr.shapeBorderColor.name();
|
||||
@ -4828,7 +4827,7 @@ void QgsPalLabeling::drawLabelBackground( QgsRenderContext& context,
|
||||
// TODO: fix overriding SVG symbol's border width/units in QgsSvgCache
|
||||
// currently broken, fall back to symbol's
|
||||
//map["outline_width_unit"] = QgsUnitTypes::encodeUnit(
|
||||
// tmpLyr.shapeBorderWidthUnits == QgsPalLayerSettings::MapUnits ? QgsSymbolV2::MapUnit : QgsSymbolV2::MM );
|
||||
// tmpLyr.shapeBorderWidthUnits == QgsPalLayerSettings::MapUnits ? QgsUnitTypes::MapUnit : QgsUnitTypes::MM );
|
||||
|
||||
if ( tmpLyr.shadowDraw && tmpLyr.shadowUnder == QgsPalLayerSettings::ShadowShape )
|
||||
{
|
||||
@ -4856,7 +4855,7 @@ void QgsPalLabeling::drawLabelBackground( QgsRenderContext& context,
|
||||
|
||||
QgsSymbolLayerV2* symShdwL = QgsSvgMarkerSymbolLayerV2::create( shdwmap );
|
||||
QgsSvgMarkerSymbolLayerV2* svgShdwM = static_cast<QgsSvgMarkerSymbolLayerV2*>( symShdwL );
|
||||
QgsSymbolV2RenderContext svgShdwContext( shdwContext, QgsSymbolV2::Mixed,
|
||||
QgsSymbolV2RenderContext svgShdwContext( shdwContext, QgsUnitTypes::RenderUnknownUnit,
|
||||
( 100.0 - static_cast< double >( tmpLyr.shapeTransparency ) ) / 100.0 );
|
||||
|
||||
double svgSize = tmpLyr.scaleToPixelContext( sizeOut, context, tmpLyr.shapeSizeUnits, true, tmpLyr.shapeSizeMapUnitScale );
|
||||
@ -4891,7 +4890,7 @@ void QgsPalLabeling::drawLabelBackground( QgsRenderContext& context,
|
||||
// draw the actual symbol
|
||||
QgsSymbolLayerV2* symL = QgsSvgMarkerSymbolLayerV2::create( map );
|
||||
QgsSvgMarkerSymbolLayerV2* svgM = static_cast<QgsSvgMarkerSymbolLayerV2*>( symL );
|
||||
QgsSymbolV2RenderContext svgContext( context, QgsSymbolV2::Mixed,
|
||||
QgsSymbolV2RenderContext svgContext( context, QgsUnitTypes::RenderUnknownUnit,
|
||||
( 100.0 - static_cast< double >( tmpLyr.shapeTransparency ) ) / 100.0 );
|
||||
|
||||
p->save();
|
||||
|
@ -2076,7 +2076,7 @@ bool QgsProject::topologicalEditing() const
|
||||
return ( QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 ) > 0 );
|
||||
}
|
||||
|
||||
Qgis::UnitType QgsProject::distanceUnits() const
|
||||
QgsUnitTypes::DistanceUnit QgsProject::distanceUnits() const
|
||||
{
|
||||
QString distanceUnitString = QgsProject::instance()->readEntry( "Measurement", "/DistanceUnits", QString() );
|
||||
if ( !distanceUnitString.isEmpty() )
|
||||
@ -2085,8 +2085,8 @@ Qgis::UnitType QgsProject::distanceUnits() const
|
||||
//fallback to QGIS default measurement unit
|
||||
QSettings s;
|
||||
bool ok = false;
|
||||
Qgis::UnitType type = QgsUnitTypes::decodeDistanceUnit( s.value( "/qgis/measure/displayunits" ).toString(), &ok );
|
||||
return ok ? type : Qgis::Meters;
|
||||
QgsUnitTypes::DistanceUnit type = QgsUnitTypes::decodeDistanceUnit( s.value( "/qgis/measure/displayunits" ).toString(), &ok );
|
||||
return ok ? type : QgsUnitTypes::DistanceMeters;
|
||||
}
|
||||
|
||||
QgsUnitTypes::AreaUnit QgsProject::areaUnits() const
|
||||
@ -2099,7 +2099,7 @@ QgsUnitTypes::AreaUnit QgsProject::areaUnits() const
|
||||
QSettings s;
|
||||
bool ok = false;
|
||||
QgsUnitTypes::AreaUnit type = QgsUnitTypes::decodeAreaUnit( s.value( "/qgis/measure/areaunits" ).toString(), &ok );
|
||||
return ok ? type : QgsUnitTypes::SquareMeters;
|
||||
return ok ? type : QgsUnitTypes::AreaSquareMeters;
|
||||
}
|
||||
|
||||
void QgsProjectBadLayerDefaultHandler::handleBadLayers( const QList<QDomNode>& /*layers*/, const QDomDocument& /*projectDom*/ )
|
||||
|
@ -301,7 +301,7 @@ class CORE_EXPORT QgsProject : public QObject
|
||||
* @note added in QGIS 2.14
|
||||
* @see areaUnits()
|
||||
*/
|
||||
Qgis::UnitType distanceUnits() const;
|
||||
QgsUnitTypes::DistanceUnit distanceUnits() const;
|
||||
|
||||
/** Convenience function to query default area measurement units for project.
|
||||
* @note added in QGIS 2.14
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include "qgsrectangle.h"
|
||||
#include "qgsscalecalculator.h"
|
||||
|
||||
QgsScaleCalculator::QgsScaleCalculator( double dpi, Qgis::UnitType mapUnits )
|
||||
QgsScaleCalculator::QgsScaleCalculator( double dpi, QgsUnitTypes::DistanceUnit mapUnits )
|
||||
: mDpi( dpi )
|
||||
, mMapUnits( mapUnits )
|
||||
{}
|
||||
@ -35,13 +35,13 @@ double QgsScaleCalculator::dpi()
|
||||
return mDpi;
|
||||
}
|
||||
|
||||
void QgsScaleCalculator::setMapUnits( Qgis::UnitType mapUnits )
|
||||
void QgsScaleCalculator::setMapUnits( QgsUnitTypes::DistanceUnit mapUnits )
|
||||
{
|
||||
QgsDebugMsgLevel( QString( "Map units set to %1" ).arg( QString::number( mapUnits ) ), 3 );
|
||||
mMapUnits = mapUnits;
|
||||
}
|
||||
|
||||
Qgis::UnitType QgsScaleCalculator::mapUnits() const
|
||||
QgsUnitTypes::DistanceUnit QgsScaleCalculator::mapUnits() const
|
||||
{
|
||||
QgsDebugMsgLevel( QString( "Map units returned as %1" ).arg( QString::number( mMapUnits ) ), 4 );
|
||||
return mMapUnits;
|
||||
@ -55,23 +55,23 @@ double QgsScaleCalculator::calculate( const QgsRectangle &mapExtent, int canvasW
|
||||
// users display, and the canvas width
|
||||
switch ( mMapUnits )
|
||||
{
|
||||
case Qgis::Meters:
|
||||
case QgsUnitTypes::DistanceMeters:
|
||||
// convert meters to inches
|
||||
conversionFactor = 39.3700787;
|
||||
delta = mapExtent.xMaximum() - mapExtent.xMinimum();
|
||||
break;
|
||||
case Qgis::Feet:
|
||||
case QgsUnitTypes::DistanceFeet:
|
||||
conversionFactor = 12.0;
|
||||
delta = mapExtent.xMaximum() - mapExtent.xMinimum();
|
||||
break;
|
||||
case Qgis::NauticalMiles:
|
||||
case QgsUnitTypes::DistanceNauticalMiles:
|
||||
// convert nautical miles to inches
|
||||
conversionFactor = 72913.4;
|
||||
delta = mapExtent.xMaximum() - mapExtent.xMinimum();
|
||||
break;
|
||||
|
||||
default:
|
||||
case Qgis::Degrees:
|
||||
case QgsUnitTypes::DistanceDegrees:
|
||||
// degrees require conversion to meters first
|
||||
conversionFactor = 39.3700787;
|
||||
delta = calculateGeographicDistance( mapExtent );
|
||||
|
@ -20,6 +20,7 @@
|
||||
#define QGSSCALECALCULATOR_H
|
||||
|
||||
#include <qgis.h>
|
||||
#include "qgsunittypes.h"
|
||||
|
||||
class QString;
|
||||
class QgsRectangle;
|
||||
@ -35,11 +36,10 @@ class CORE_EXPORT QgsScaleCalculator
|
||||
/**
|
||||
* Constructor
|
||||
* @param dpi Monitor resolution in dots per inch
|
||||
* @param mapUnits Units of the data on the map. Must match a value from the
|
||||
* Qgis::UnitType enum (Meters, Feet, Degrees)
|
||||
* @param mapUnits Units of the data on the map
|
||||
*/
|
||||
QgsScaleCalculator( double dpi = 0,
|
||||
Qgis::UnitType mapUnits = Qgis::Meters );
|
||||
QgsUnitTypes::DistanceUnit mapUnits = QgsUnitTypes::DistanceMeters );
|
||||
|
||||
/**
|
||||
* Set the dpi to be used in scale calculations
|
||||
@ -57,10 +57,10 @@ class CORE_EXPORT QgsScaleCalculator
|
||||
* Set the map units
|
||||
* @param mapUnits Units of the data on the map. Must match a value from the
|
||||
*/
|
||||
void setMapUnits( Qgis::UnitType mapUnits );
|
||||
void setMapUnits( QgsUnitTypes::DistanceUnit mapUnits );
|
||||
|
||||
/** Returns current map units */
|
||||
Qgis::UnitType mapUnits() const;
|
||||
QgsUnitTypes::DistanceUnit mapUnits() const;
|
||||
|
||||
/**
|
||||
* Calculate the scale denominator
|
||||
@ -84,7 +84,7 @@ class CORE_EXPORT QgsScaleCalculator
|
||||
double mDpi;
|
||||
|
||||
//! map unit member
|
||||
Qgis::UnitType mMapUnits;
|
||||
QgsUnitTypes::DistanceUnit mMapUnits;
|
||||
};
|
||||
|
||||
#endif // #ifndef QGSSCALECALCULATOR_H
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -36,6 +36,19 @@ class CORE_EXPORT QgsUnitTypes
|
||||
{
|
||||
public:
|
||||
|
||||
//! Units of distance
|
||||
enum DistanceUnit
|
||||
{
|
||||
DistanceMeters = 0, /*!< meters */
|
||||
DistanceKilometers, /*!< kilometers */
|
||||
DistanceFeet, /*!< imperial feet */
|
||||
DistanceNauticalMiles, /*!< nautical miles */
|
||||
DistanceYards, /*!< imperial yards */
|
||||
DistanceMiles, /*!< terrestial miles */
|
||||
DistanceDegrees, /*!< degrees, for planar geographic CRS distance measurements */
|
||||
DistanceUnknownUnit, /*!< unknown distance unit */
|
||||
};
|
||||
|
||||
/** Types of distance units
|
||||
*/
|
||||
enum DistanceUnitType
|
||||
@ -48,42 +61,55 @@ class CORE_EXPORT QgsUnitTypes
|
||||
//! Units of area
|
||||
enum AreaUnit
|
||||
{
|
||||
SquareMeters = 0, /*!< square meters */
|
||||
SquareKilometers, /*!< square kilometers */
|
||||
SquareFeet, /*!< square feet */
|
||||
SquareYards, /*!< square yards */
|
||||
SquareMiles, /*!< square miles */
|
||||
Hectares, /*!< hectares */
|
||||
Acres, /*!< acres */
|
||||
SquareNauticalMiles, /*!< square nautical miles */
|
||||
SquareDegrees, /*!< square degrees, for planar geographic CRS area measurements */
|
||||
UnknownAreaUnit, /*!< unknown areal unit */
|
||||
AreaSquareMeters = 0, /*!< square meters */
|
||||
AreaSquareKilometers, /*!< square kilometers */
|
||||
AreaSquareFeet, /*!< square feet */
|
||||
AreaSquareYards, /*!< square yards */
|
||||
AreaSquareMiles, /*!< square miles */
|
||||
AreaHectares, /*!< hectares */
|
||||
AreaAcres, /*!< acres */
|
||||
AreaSquareNauticalMiles, /*!< square nautical miles */
|
||||
AreaSquareDegrees, /*!< square degrees, for planar geographic CRS area measurements */
|
||||
AreaUnknownUnit, /*!< unknown areal unit */
|
||||
};
|
||||
|
||||
//! Units of angles
|
||||
enum AngleUnit
|
||||
{
|
||||
AngleDegrees = 0, /*!< degrees */
|
||||
Radians, /*!< square kilometers */
|
||||
Gon, /*!< gon/gradian */
|
||||
MinutesOfArc, /*!< minutes of arc */
|
||||
SecondsOfArc, /*!< seconds of arc */
|
||||
Turn, /*!< turn/revolutions */
|
||||
UnknownAngleUnit, /*!< unknown angle unit */
|
||||
AngleRadians, /*!< square kilometers */
|
||||
AngleGon, /*!< gon/gradian */
|
||||
AngleMinutesOfArc, /*!< minutes of arc */
|
||||
AngleSecondsOfArc, /*!< seconds of arc */
|
||||
AngleTurn, /*!< turn/revolutions */
|
||||
AngleUnknownUnit, /*!< unknown angle unit */
|
||||
};
|
||||
|
||||
//! Rendering size units
|
||||
enum RenderUnit
|
||||
{
|
||||
RenderMillimeters = 0, //!< millimeters
|
||||
RenderMapUnits, //!< map units
|
||||
RenderPixels, //!< pixels
|
||||
RenderPercentage, //!< percentage of another measurement (eg canvas size, feature size)
|
||||
RenderUnknownUnit, //!< mixed or unknown units
|
||||
};
|
||||
|
||||
//! List of render units
|
||||
typedef QList<RenderUnit> RenderUnitList;
|
||||
|
||||
// DISTANCE UNITS
|
||||
|
||||
/** Returns the type for a distance unit.
|
||||
*/
|
||||
static DistanceUnitType unitType( Qgis::UnitType unit );
|
||||
static DistanceUnitType unitType( DistanceUnit unit );
|
||||
|
||||
/** Encodes a distance unit to a string.
|
||||
* @param unit unit to encode
|
||||
* @returns encoded string
|
||||
* @see decodeDistanceUnit()
|
||||
*/
|
||||
static QString encodeUnit( Qgis::UnitType unit );
|
||||
static QString encodeUnit( QgsUnitTypes::DistanceUnit unit );
|
||||
|
||||
/** Decodes a distance unit from a string.
|
||||
* @param string string to decode
|
||||
@ -91,27 +117,27 @@ class CORE_EXPORT QgsUnitTypes
|
||||
* @returns decoded units
|
||||
* @see encodeUnit()
|
||||
*/
|
||||
static Qgis::UnitType decodeDistanceUnit( const QString& string, bool *ok = 0 );
|
||||
static QgsUnitTypes::DistanceUnit decodeDistanceUnit( const QString& string, bool *ok = 0 );
|
||||
|
||||
/** Returns a translated string representing a distance unit.
|
||||
* @param unit unit to convert to string
|
||||
* @see stringToDistanceUnit()
|
||||
*/
|
||||
static QString toString( Qgis::UnitType unit );
|
||||
static QString toString( QgsUnitTypes::DistanceUnit unit );
|
||||
|
||||
/** Converts a translated string to a distance unit.
|
||||
* @param string string representing a distance unit
|
||||
* @param ok optional boolean, will be set to true if string was converted successfully
|
||||
* @see toString()
|
||||
*/
|
||||
static Qgis::UnitType stringToDistanceUnit( const QString& string, bool *ok = 0 );
|
||||
static QgsUnitTypes::DistanceUnit stringToDistanceUnit( const QString& string, bool *ok = 0 );
|
||||
|
||||
/** Returns the conversion factor between the specified distance units.
|
||||
* @param fromUnit distance unit to convert from
|
||||
* @param toUnit distance unit to convert to
|
||||
* @returns multiplication factor to convert between units
|
||||
*/
|
||||
static double fromUnitToUnitFactor( Qgis::UnitType fromUnit, Qgis::UnitType toUnit );
|
||||
static double fromUnitToUnitFactor( QgsUnitTypes::DistanceUnit fromUnit, QgsUnitTypes::DistanceUnit toUnit );
|
||||
|
||||
// AREAL UNITS
|
||||
|
||||
@ -158,7 +184,7 @@ class CORE_EXPORT QgsUnitTypes
|
||||
* @param distanceUnit distance unit to convert
|
||||
* @return matching areal unit
|
||||
*/
|
||||
static AreaUnit distanceToAreaUnit( Qgis::UnitType distanceUnit );
|
||||
static AreaUnit distanceToAreaUnit( QgsUnitTypes::DistanceUnit distanceUnit );
|
||||
|
||||
// ANGULAR UNITS
|
||||
|
||||
@ -197,25 +223,22 @@ class CORE_EXPORT QgsUnitTypes
|
||||
*/
|
||||
static QString formatAngle( double angle, int decimals, AngleUnit unit );
|
||||
|
||||
//TODO QGIS 3.0 - enable and move symbol units here! Otherwise creates circular dependencies...
|
||||
#if 0
|
||||
// SYMBOL UNITS
|
||||
// RENDER UNITS
|
||||
|
||||
/** Encodes a symbol unit to a string.
|
||||
/** Encodes a render unit to a string.
|
||||
* @param unit unit to encode
|
||||
* @returns encoded string
|
||||
* @see decodeSymbolUnit()
|
||||
* @see decodeRenderUnit()
|
||||
*/
|
||||
static QString encodeUnit( QgsSymbolV2::OutputUnit unit );
|
||||
static QString encodeUnit( RenderUnit unit );
|
||||
|
||||
/** Decodes a symbol unit from a string.
|
||||
/** Decodes a render unit from a string.
|
||||
* @param string string to decode
|
||||
* @param ok optional boolean, will be set to true if string was converted successfully
|
||||
* @returns decoded units
|
||||
* @see encodeUnit()
|
||||
*/
|
||||
static QgsSymbolV2::OutputUnit decodeSymbolUnit( const QString& string, bool *ok = 0 );
|
||||
#endif
|
||||
static RenderUnit decodeRenderUnit( const QString& string, bool *ok = 0 );
|
||||
|
||||
};
|
||||
|
||||
|
@ -1776,7 +1776,7 @@ QString QgsVectorFileWriter::errorMessage()
|
||||
return mErrorMessage;
|
||||
}
|
||||
|
||||
bool QgsVectorFileWriter::addFeature( QgsFeature& feature, QgsFeatureRendererV2* renderer, Qgis::UnitType outputUnit )
|
||||
bool QgsVectorFileWriter::addFeature( QgsFeature& feature, QgsFeatureRendererV2* renderer, QgsUnitTypes::DistanceUnit outputUnit )
|
||||
{
|
||||
// create the feature
|
||||
OGRFeatureH poFeature = createFeature( feature );
|
||||
@ -2318,7 +2318,7 @@ QgsVectorFileWriter::WriterError QgsVectorFileWriter::writeAsVectorFormat( QgsVe
|
||||
int n = 0, errors = 0;
|
||||
|
||||
//unit type
|
||||
Qgis::UnitType mapUnits = layer->crs().mapUnits();
|
||||
QgsUnitTypes::DistanceUnit mapUnits = layer->crs().mapUnits();
|
||||
if ( ct.isValid() )
|
||||
{
|
||||
mapUnits = ct.destinationCrs().mapUnits();
|
||||
@ -2600,7 +2600,7 @@ void QgsVectorFileWriter::createSymbolLayerTable( QgsVectorLayer* vl, const Qgs
|
||||
}
|
||||
|
||||
//unit type
|
||||
Qgis::UnitType mapUnits = vl->crs().mapUnits();
|
||||
QgsUnitTypes::DistanceUnit mapUnits = vl->crs().mapUnits();
|
||||
if ( ct.isValid() )
|
||||
{
|
||||
mapUnits = ct.destinationCrs().mapUnits();
|
||||
@ -2651,7 +2651,7 @@ QgsVectorFileWriter::WriterError QgsVectorFileWriter::exportFeaturesSymbolLevels
|
||||
QHash< QgsSymbolV2*, QList<QgsFeature> > features;
|
||||
|
||||
//unit type
|
||||
Qgis::UnitType mapUnits = layer->crs().mapUnits();
|
||||
QgsUnitTypes::DistanceUnit mapUnits = layer->crs().mapUnits();
|
||||
if ( ct.isValid() )
|
||||
{
|
||||
mapUnits = ct.destinationCrs().mapUnits();
|
||||
@ -2775,16 +2775,16 @@ QgsVectorFileWriter::WriterError QgsVectorFileWriter::exportFeaturesSymbolLevels
|
||||
return ( nErrors > 0 ) ? QgsVectorFileWriter::ErrFeatureWriteFailed : QgsVectorFileWriter::NoError;
|
||||
}
|
||||
|
||||
double QgsVectorFileWriter::mmScaleFactor( double scaleDenominator, QgsSymbolV2::OutputUnit symbolUnits, Qgis::UnitType mapUnits )
|
||||
double QgsVectorFileWriter::mmScaleFactor( double scaleDenominator, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits )
|
||||
{
|
||||
if ( symbolUnits == QgsSymbolV2::MM )
|
||||
if ( symbolUnits == QgsUnitTypes::RenderMillimeters )
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
//conversion factor map units -> mm
|
||||
if ( mapUnits == Qgis::Meters )
|
||||
if ( mapUnits == QgsUnitTypes::DistanceMeters )
|
||||
{
|
||||
return 1000 / scaleDenominator;
|
||||
}
|
||||
@ -2793,15 +2793,15 @@ double QgsVectorFileWriter::mmScaleFactor( double scaleDenominator, QgsSymbolV2:
|
||||
return 1.0; //todo: map units
|
||||
}
|
||||
|
||||
double QgsVectorFileWriter::mapUnitScaleFactor( double scaleDenominator, QgsSymbolV2::OutputUnit symbolUnits, Qgis::UnitType mapUnits )
|
||||
double QgsVectorFileWriter::mapUnitScaleFactor( double scaleDenominator, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits )
|
||||
{
|
||||
if ( symbolUnits == QgsSymbolV2::MapUnit )
|
||||
if ( symbolUnits == QgsUnitTypes::RenderMapUnits )
|
||||
{
|
||||
return 1.0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( symbolUnits == QgsSymbolV2::MM && mapUnits == Qgis::Meters )
|
||||
if ( symbolUnits == QgsUnitTypes::RenderMillimeters && mapUnits == QgsUnitTypes::DistanceMeters )
|
||||
{
|
||||
return scaleDenominator / 1000;
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ class CORE_EXPORT QgsVectorFileWriter
|
||||
QString errorMessage();
|
||||
|
||||
/** Add feature to the currently opened data source */
|
||||
bool addFeature( QgsFeature& feature, QgsFeatureRendererV2* renderer = nullptr, Qgis::UnitType outputUnit = Qgis::Meters );
|
||||
bool addFeature( QgsFeature& feature, QgsFeatureRendererV2* renderer = nullptr, QgsUnitTypes::DistanceUnit outputUnit = QgsUnitTypes::DistanceMeters );
|
||||
|
||||
//! @note not available in python bindings
|
||||
QMap<int, int> attrIdxToOgrIdx() { return mAttrIdxToOgrIdx; }
|
||||
@ -443,14 +443,14 @@ class CORE_EXPORT QgsVectorFileWriter
|
||||
QgsRenderContext mRenderContext;
|
||||
|
||||
static QMap<QString, MetaData> initMetaData();
|
||||
void createSymbolLayerTable( QgsVectorLayer* vl, const QgsCoordinateTransform& ct, OGRDataSourceH ds );
|
||||
void createSymbolLayerTable( QgsVectorLayer* vl, const QgsCoordinateTransform& ct, OGRDataSourceH ds );
|
||||
OGRFeatureH createFeature( QgsFeature& feature );
|
||||
bool writeFeature( OGRLayerH layer, OGRFeatureH feature );
|
||||
|
||||
/** Writes features considering symbol level order*/
|
||||
WriterError exportFeaturesSymbolLevels( QgsVectorLayer* layer, QgsFeatureIterator& fit, const QgsCoordinateTransform& ct, QString* errorMessage = nullptr );
|
||||
double mmScaleFactor( double scaleDenominator, QgsSymbolV2::OutputUnit symbolUnits, Qgis::UnitType mapUnits );
|
||||
double mapUnitScaleFactor( double scaleDenominator, QgsSymbolV2::OutputUnit symbolUnits, Qgis::UnitType mapUnits );
|
||||
double mmScaleFactor( double scaleDenominator, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits );
|
||||
double mapUnitScaleFactor( double scaleDenominator, QgsUnitTypes::RenderUnit symbolUnits, QgsUnitTypes::DistanceUnit mapUnits );
|
||||
|
||||
void startRender( QgsVectorLayer* vl );
|
||||
void stopRender( QgsVectorLayer* vl );
|
||||
|
@ -75,7 +75,6 @@
|
||||
#include "qgsvectorlayerundocommand.h"
|
||||
#include "qgspointv2.h"
|
||||
#include "qgsrendererv2.h"
|
||||
#include "qgssymbolv2.h"
|
||||
#include "qgssymbollayerv2.h"
|
||||
#include "qgssinglesymbolrendererv2.h"
|
||||
#include "qgsdiagramrendererv2.h"
|
||||
|
@ -688,11 +688,11 @@ int QgsVectorLayerEditUtils::addTopologicalPoints( const QgsPoint& p )
|
||||
|
||||
//work with a tolerance because coordinate projection may introduce some rounding
|
||||
double threshold = 0.0000001;
|
||||
if ( L->crs().mapUnits() == Qgis::Meters )
|
||||
if ( L->crs().mapUnits() == QgsUnitTypes::DistanceMeters )
|
||||
{
|
||||
threshold = 0.001;
|
||||
}
|
||||
else if ( L->crs().mapUnits() == Qgis::Feet )
|
||||
else if ( L->crs().mapUnits() == QgsUnitTypes::DistanceFeet )
|
||||
{
|
||||
threshold = 0.0001;
|
||||
}
|
||||
|
@ -20,32 +20,16 @@
|
||||
#include "qgsrectangle.h"
|
||||
|
||||
|
||||
Qgis::UnitType QgsXmlUtils::readMapUnits( const QDomElement& element )
|
||||
QgsUnitTypes::DistanceUnit QgsXmlUtils::readMapUnits( const QDomElement& element )
|
||||
{
|
||||
if ( "meters" == element.text() )
|
||||
if ( "unknown" == element.text() )
|
||||
{
|
||||
return Qgis::Meters;
|
||||
}
|
||||
else if ( "feet" == element.text() )
|
||||
{
|
||||
return Qgis::Feet;
|
||||
}
|
||||
else if ( "nautical miles" == element.text() )
|
||||
{
|
||||
return Qgis::NauticalMiles;
|
||||
}
|
||||
else if ( "degrees" == element.text() )
|
||||
{
|
||||
return Qgis::Degrees;
|
||||
}
|
||||
else if ( "unknown" == element.text() )
|
||||
{
|
||||
return Qgis::UnknownUnit;
|
||||
return QgsUnitTypes::DistanceUnknownUnit;
|
||||
}
|
||||
else
|
||||
{
|
||||
QgsDebugMsg( "Unknown map unit type " + element.text() );
|
||||
return Qgis::Degrees;
|
||||
QgsUnitTypes::DistanceUnit unit = QgsUnitTypes::decodeDistanceUnit( element.text() );
|
||||
return unit == QgsUnitTypes::DistanceUnknownUnit ? QgsUnitTypes::DistanceDegrees : unit;
|
||||
}
|
||||
}
|
||||
|
||||
@ -79,28 +63,12 @@ QgsRectangle QgsXmlUtils::readRectangle( const QDomElement& element )
|
||||
|
||||
|
||||
|
||||
QDomElement QgsXmlUtils::writeMapUnits( Qgis::UnitType units, QDomDocument& doc )
|
||||
QDomElement QgsXmlUtils::writeMapUnits( QgsUnitTypes::DistanceUnit units, QDomDocument& doc )
|
||||
{
|
||||
QString unitsString;
|
||||
switch ( units )
|
||||
{
|
||||
case Qgis::Meters:
|
||||
unitsString = "meters";
|
||||
break;
|
||||
case Qgis::Feet:
|
||||
unitsString = "feet";
|
||||
break;
|
||||
case Qgis::NauticalMiles:
|
||||
unitsString = "nautical miles";
|
||||
break;
|
||||
case Qgis::Degrees:
|
||||
unitsString = "degrees";
|
||||
break;
|
||||
case Qgis::UnknownUnit:
|
||||
default:
|
||||
unitsString = "unknown";
|
||||
break;
|
||||
}
|
||||
QString unitsString = QgsUnitTypes::encodeUnit( units );
|
||||
// maintain compatibility with old projects
|
||||
if ( units == QgsUnitTypes::DistanceUnknownUnit )
|
||||
unitsString = "unknown";
|
||||
|
||||
QDomElement unitsNode = doc.createElement( "units" );
|
||||
unitsNode.appendChild( doc.createTextNode( unitsString ) );
|
||||
|
@ -21,6 +21,7 @@ class QDomElement;
|
||||
class QgsRectangle;
|
||||
|
||||
#include "qgis.h"
|
||||
#include "qgsunittypes.h"
|
||||
|
||||
/** \ingroup core
|
||||
* Assorted helper methods for reading and writing chunks of XML
|
||||
@ -31,12 +32,25 @@ class CORE_EXPORT QgsXmlUtils
|
||||
|
||||
/* reading */
|
||||
|
||||
static Qgis::UnitType readMapUnits( const QDomElement& element );
|
||||
/** Decodes a distance unit from a DOM element.
|
||||
* @param element DOM element to decode
|
||||
* @returns distance units
|
||||
* @see writeMapUnits()
|
||||
*/
|
||||
static QgsUnitTypes::DistanceUnit readMapUnits( const QDomElement& element );
|
||||
|
||||
static QgsRectangle readRectangle( const QDomElement& element );
|
||||
|
||||
/* writing */
|
||||
|
||||
static QDomElement writeMapUnits( Qgis::UnitType units, QDomDocument& doc );
|
||||
/** Encodes a distance unit to a DOM element.
|
||||
* @param units units to encode
|
||||
* @param doc DOM document
|
||||
* @returns element containing encoded units
|
||||
* @see readMapUnits()
|
||||
*/
|
||||
static QDomElement writeMapUnits( QgsUnitTypes::DistanceUnit units, QDomDocument& doc );
|
||||
|
||||
static QDomElement writeRectangle( const QgsRectangle& rect, QDomDocument& doc );
|
||||
};
|
||||
|
||||
|
@ -87,7 +87,7 @@ Qgs25DRenderer::Qgs25DRenderer()
|
||||
QgsEffectStack* effectStack = new QgsEffectStack();
|
||||
QgsOuterGlowEffect* glowEffect = new QgsOuterGlowEffect();
|
||||
glowEffect->setBlurLevel( 5 );
|
||||
glowEffect->setSpreadUnit( QgsSymbolV2::MapUnit );
|
||||
glowEffect->setSpreadUnit( QgsUnitTypes::RenderMapUnits );
|
||||
effectStack->appendEffect( glowEffect );
|
||||
floor->setPaintEffect( effectStack );
|
||||
|
||||
|
@ -18,13 +18,13 @@
|
||||
QgsArrowSymbolLayer::QgsArrowSymbolLayer()
|
||||
: QgsLineSymbolLayerV2()
|
||||
, mArrowWidth( 1.0 )
|
||||
, mArrowWidthUnit( QgsSymbolV2::MM )
|
||||
, mArrowWidthUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mArrowStartWidth( 1.0 )
|
||||
, mArrowStartWidthUnit( QgsSymbolV2::MM )
|
||||
, mArrowStartWidthUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mHeadLength( 1.5 )
|
||||
, mHeadLengthUnit( QgsSymbolV2::MM )
|
||||
, mHeadLengthUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mHeadThickness( 1.5 )
|
||||
, mHeadThicknessUnit( QgsSymbolV2::MM )
|
||||
, mHeadThicknessUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mHeadType( HeadSingle )
|
||||
, mArrowType( ArrowPlain )
|
||||
, mIsCurved( true )
|
||||
@ -39,7 +39,7 @@ QgsArrowSymbolLayer::QgsArrowSymbolLayer()
|
||||
{
|
||||
/* default values */
|
||||
setOffset( 0.0 );
|
||||
setOffsetUnit( QgsSymbolV2::MM );
|
||||
setOffsetUnit( QgsUnitTypes::RenderMillimeters );
|
||||
|
||||
mSymbol.reset( static_cast<QgsFillSymbolV2*>( QgsFillSymbolV2::createSimple( QgsStringMap() ) ) );
|
||||
}
|
||||
@ -63,7 +63,7 @@ QgsSymbolLayerV2* QgsArrowSymbolLayer::create( const QgsStringMap& props )
|
||||
l->setArrowWidth( props["arrow_width"].toDouble() );
|
||||
|
||||
if ( props.contains( "arrow_width_unit" ) )
|
||||
l->setArrowWidthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( props["arrow_width_unit"] ) );
|
||||
l->setArrowWidthUnit( QgsUnitTypes::decodeRenderUnit( props["arrow_width_unit"] ) );
|
||||
|
||||
if ( props.contains( "arrow_width_unit_scale" ) )
|
||||
l->setArrowWidthUnitScale( QgsSymbolLayerV2Utils::decodeMapUnitScale( props["arrow_width_unit_scale"] ) );
|
||||
@ -72,7 +72,7 @@ QgsSymbolLayerV2* QgsArrowSymbolLayer::create( const QgsStringMap& props )
|
||||
l->setArrowStartWidth( props["arrow_start_width"].toDouble() );
|
||||
|
||||
if ( props.contains( "arrow_start_width_unit" ) )
|
||||
l->setArrowStartWidthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( props["arrow_start_width_unit"] ) );
|
||||
l->setArrowStartWidthUnit( QgsUnitTypes::decodeRenderUnit( props["arrow_start_width_unit"] ) );
|
||||
|
||||
if ( props.contains( "arrow_start_width_unit_scale" ) )
|
||||
l->setArrowStartWidthUnitScale( QgsSymbolLayerV2Utils::decodeMapUnitScale( props["arrow_start_width_unit_scale"] ) );
|
||||
@ -87,7 +87,7 @@ QgsSymbolLayerV2* QgsArrowSymbolLayer::create( const QgsStringMap& props )
|
||||
l->setHeadLength( props["head_length"].toDouble() );
|
||||
|
||||
if ( props.contains( "head_length_unit" ) )
|
||||
l->setHeadLengthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( props["head_length_unit"] ) );
|
||||
l->setHeadLengthUnit( QgsUnitTypes::decodeRenderUnit( props["head_length_unit"] ) );
|
||||
|
||||
if ( props.contains( "head_length_unit_scale" ) )
|
||||
l->setHeadLengthUnitScale( QgsSymbolLayerV2Utils::decodeMapUnitScale( props["head_length_unit_scale"] ) );
|
||||
@ -96,7 +96,7 @@ QgsSymbolLayerV2* QgsArrowSymbolLayer::create( const QgsStringMap& props )
|
||||
l->setHeadThickness( props["head_thickness"].toDouble() );
|
||||
|
||||
if ( props.contains( "head_thickness_unit" ) )
|
||||
l->setHeadThicknessUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( props["head_thickness_unit"] ) );
|
||||
l->setHeadThicknessUnit( QgsUnitTypes::decodeRenderUnit( props["head_thickness_unit"] ) );
|
||||
|
||||
if ( props.contains( "head_thickness_unit_scale" ) )
|
||||
l->setHeadThicknessUnitScale( QgsSymbolLayerV2Utils::decodeMapUnitScale( props["head_thickness_unit_scale"] ) );
|
||||
@ -111,7 +111,7 @@ QgsSymbolLayerV2* QgsArrowSymbolLayer::create( const QgsStringMap& props )
|
||||
l->setOffset( props["offset"].toDouble() );
|
||||
|
||||
if ( props.contains( "offset_unit" ) )
|
||||
l->setOffsetUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( props["offset_unit"] ) );
|
||||
l->setOffsetUnit( QgsUnitTypes::decodeRenderUnit( props["offset_unit"] ) );
|
||||
|
||||
if ( props.contains( "offset_unit_scale" ) )
|
||||
l->setOffsetMapUnitScale( QgsSymbolLayerV2Utils::decodeMapUnitScale( props["offset_unit_scale"] ) );
|
||||
@ -142,29 +142,29 @@ QgsStringMap QgsArrowSymbolLayer::properties() const
|
||||
QgsStringMap map;
|
||||
|
||||
map["arrow_width"] = QString::number( arrowWidth() );
|
||||
map["arrow_width_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( arrowWidthUnit() );
|
||||
map["arrow_width_unit"] = QgsUnitTypes::encodeUnit( arrowWidthUnit() );
|
||||
map["arrow_width_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( arrowWidthUnitScale() );
|
||||
|
||||
map["arrow_start_width"] = QString::number( arrowStartWidth() );
|
||||
map["arrow_start_width_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( arrowStartWidthUnit() );
|
||||
map["arrow_start_width_unit"] = QgsUnitTypes::encodeUnit( arrowStartWidthUnit() );
|
||||
map["arrow_start_width_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( arrowStartWidthUnitScale() );
|
||||
|
||||
map["is_curved"] = QString::number( isCurved() ? 1 : 0 );
|
||||
map["is_repeated"] = QString::number( isRepeated() ? 1 : 0 );
|
||||
|
||||
map["head_length"] = QString::number( headLength() );
|
||||
map["head_length_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( headLengthUnit() );
|
||||
map["head_length_unit"] = QgsUnitTypes::encodeUnit( headLengthUnit() );
|
||||
map["head_length_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( headLengthUnitScale() );
|
||||
|
||||
map["head_thickness"] = QString::number( headThickness() );
|
||||
map["head_thickness_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( headThicknessUnit() );
|
||||
map["head_thickness_unit"] = QgsUnitTypes::encodeUnit( headThicknessUnit() );
|
||||
map["head_thickness_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( headThicknessUnitScale() );
|
||||
|
||||
map["head_type"] = QString::number( headType() );
|
||||
map["arrow_type"] = QString::number( arrowType() );
|
||||
|
||||
map["offset"] = QString::number( offset() );
|
||||
map["offset_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( offsetUnit() );
|
||||
map["offset_unit"] = QgsUnitTypes::encodeUnit( offsetUnit() );
|
||||
map["offset_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( offsetMapUnitScale() );
|
||||
|
||||
saveDataDefinedProperties( map );
|
||||
|
@ -57,9 +57,9 @@ class CORE_EXPORT QgsArrowSymbolLayer : public QgsLineSymbolLayerV2
|
||||
/** Set the arrow width */
|
||||
void setArrowWidth( double width ) { mArrowWidth = width; }
|
||||
/** Get the unit for the arrow width */
|
||||
QgsSymbolV2::OutputUnit arrowWidthUnit() const { return mArrowWidthUnit; }
|
||||
QgsUnitTypes::RenderUnit arrowWidthUnit() const { return mArrowWidthUnit; }
|
||||
/** Set the unit for the arrow width */
|
||||
void setArrowWidthUnit( QgsSymbolV2::OutputUnit unit ) { mArrowWidthUnit = unit; }
|
||||
void setArrowWidthUnit( QgsUnitTypes::RenderUnit unit ) { mArrowWidthUnit = unit; }
|
||||
/** Get the scale for the arrow width */
|
||||
QgsMapUnitScale arrowWidthUnitScale() const { return mArrowWidthUnitScale; }
|
||||
/** Set the scale for the arrow width */
|
||||
@ -70,9 +70,9 @@ class CORE_EXPORT QgsArrowSymbolLayer : public QgsLineSymbolLayerV2
|
||||
/** Set the arrow start width */
|
||||
void setArrowStartWidth( double width ) { mArrowStartWidth = width; }
|
||||
/** Get the unit for the arrow start width */
|
||||
QgsSymbolV2::OutputUnit arrowStartWidthUnit() const { return mArrowStartWidthUnit; }
|
||||
QgsUnitTypes::RenderUnit arrowStartWidthUnit() const { return mArrowStartWidthUnit; }
|
||||
/** Set the unit for the arrow start width */
|
||||
void setArrowStartWidthUnit( QgsSymbolV2::OutputUnit unit ) { mArrowStartWidthUnit = unit; }
|
||||
void setArrowStartWidthUnit( QgsUnitTypes::RenderUnit unit ) { mArrowStartWidthUnit = unit; }
|
||||
/** Get the scale for the arrow start width */
|
||||
QgsMapUnitScale arrowStartWidthUnitScale() const { return mArrowStartWidthUnitScale; }
|
||||
/** Set the scale for the arrow start width */
|
||||
@ -83,9 +83,9 @@ class CORE_EXPORT QgsArrowSymbolLayer : public QgsLineSymbolLayerV2
|
||||
/** Set the arrow head length */
|
||||
void setHeadLength( double length ) { mHeadLength = length; }
|
||||
/** Get the unit for the head length */
|
||||
QgsSymbolV2::OutputUnit headLengthUnit() const { return mHeadLengthUnit; }
|
||||
QgsUnitTypes::RenderUnit headLengthUnit() const { return mHeadLengthUnit; }
|
||||
/** Set the unit for the head length */
|
||||
void setHeadLengthUnit( QgsSymbolV2::OutputUnit unit ) { mHeadLengthUnit = unit; }
|
||||
void setHeadLengthUnit( QgsUnitTypes::RenderUnit unit ) { mHeadLengthUnit = unit; }
|
||||
/** Get the scale for the head length */
|
||||
QgsMapUnitScale headLengthUnitScale() const { return mHeadLengthUnitScale; }
|
||||
/** Set the scale for the head length */
|
||||
@ -96,9 +96,9 @@ class CORE_EXPORT QgsArrowSymbolLayer : public QgsLineSymbolLayerV2
|
||||
/** Set the arrow head height */
|
||||
void setHeadThickness( double thickness ) { mHeadThickness = thickness; }
|
||||
/** Get the unit for the head height */
|
||||
QgsSymbolV2::OutputUnit headThicknessUnit() const { return mHeadThicknessUnit; }
|
||||
QgsUnitTypes::RenderUnit headThicknessUnit() const { return mHeadThicknessUnit; }
|
||||
/** Set the unit for the head height */
|
||||
void setHeadThicknessUnit( QgsSymbolV2::OutputUnit unit ) { mHeadThicknessUnit = unit; }
|
||||
void setHeadThicknessUnit( QgsUnitTypes::RenderUnit unit ) { mHeadThicknessUnit = unit; }
|
||||
/** Get the scale for the head height */
|
||||
QgsMapUnitScale headThicknessUnitScale() const { return mHeadThicknessUnitScale; }
|
||||
/** Set the scale for the head height */
|
||||
@ -170,18 +170,18 @@ class CORE_EXPORT QgsArrowSymbolLayer : public QgsLineSymbolLayerV2
|
||||
QScopedPointer<QgsFillSymbolV2> mSymbol;
|
||||
|
||||
double mArrowWidth;
|
||||
QgsSymbolV2::OutputUnit mArrowWidthUnit;
|
||||
QgsUnitTypes::RenderUnit mArrowWidthUnit;
|
||||
QgsMapUnitScale mArrowWidthUnitScale;
|
||||
|
||||
double mArrowStartWidth;
|
||||
QgsSymbolV2::OutputUnit mArrowStartWidthUnit;
|
||||
QgsUnitTypes::RenderUnit mArrowStartWidthUnit;
|
||||
QgsMapUnitScale mArrowStartWidthUnitScale;
|
||||
|
||||
double mHeadLength;
|
||||
QgsSymbolV2::OutputUnit mHeadLengthUnit;
|
||||
QgsUnitTypes::RenderUnit mHeadLengthUnit;
|
||||
QgsMapUnitScale mHeadLengthUnitScale;
|
||||
double mHeadThickness;
|
||||
QgsSymbolV2::OutputUnit mHeadThicknessUnit;
|
||||
QgsUnitTypes::RenderUnit mHeadThicknessUnit;
|
||||
QgsMapUnitScale mHeadThicknessUnitScale;
|
||||
|
||||
HeadType mHeadType;
|
||||
|
@ -31,14 +31,14 @@ QgsEllipseSymbolLayerV2::QgsEllipseSymbolLayerV2()
|
||||
: QgsMarkerSymbolLayerV2()
|
||||
, mSymbolName( "circle" )
|
||||
, mSymbolWidth( 4 )
|
||||
, mSymbolWidthUnit( QgsSymbolV2::MM )
|
||||
, mSymbolWidthUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mSymbolHeight( 3 )
|
||||
, mSymbolHeightUnit( QgsSymbolV2::MM )
|
||||
, mSymbolHeightUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mOutlineColor( Qt::black )
|
||||
, mOutlineStyle( Qt::SolidLine )
|
||||
, mPenJoinStyle( DEFAULT_ELLIPSE_JOINSTYLE )
|
||||
, mOutlineWidth( 0 )
|
||||
, mOutlineWidthUnit( QgsSymbolV2::MM )
|
||||
, mOutlineWidthUnit( QgsUnitTypes::RenderMillimeters )
|
||||
{
|
||||
mColor = Qt::white;
|
||||
mPen.setColor( mOutlineColor );
|
||||
@ -68,7 +68,7 @@ QgsSymbolLayerV2* QgsEllipseSymbolLayerV2::create( const QgsStringMap& propertie
|
||||
}
|
||||
if ( properties.contains( "symbol_width_unit" ) )
|
||||
{
|
||||
layer->setSymbolWidthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["symbol_width_unit"] ) );
|
||||
layer->setSymbolWidthUnit( QgsUnitTypes::decodeRenderUnit( properties["symbol_width_unit"] ) );
|
||||
}
|
||||
if ( properties.contains( "symbol_width_map_unit_scale" ) )
|
||||
{
|
||||
@ -80,7 +80,7 @@ QgsSymbolLayerV2* QgsEllipseSymbolLayerV2::create( const QgsStringMap& propertie
|
||||
}
|
||||
if ( properties.contains( "symbol_height_unit" ) )
|
||||
{
|
||||
layer->setSymbolHeightUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["symbol_height_unit"] ) );
|
||||
layer->setSymbolHeightUnit( QgsUnitTypes::decodeRenderUnit( properties["symbol_height_unit"] ) );
|
||||
}
|
||||
if ( properties.contains( "symbol_height_map_unit_scale" ) )
|
||||
{
|
||||
@ -112,11 +112,11 @@ QgsSymbolLayerV2* QgsEllipseSymbolLayerV2::create( const QgsStringMap& propertie
|
||||
}
|
||||
if ( properties.contains( "outline_width_unit" ) )
|
||||
{
|
||||
layer->setOutlineWidthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["outline_width_unit"] ) );
|
||||
layer->setOutlineWidthUnit( QgsUnitTypes::decodeRenderUnit( properties["outline_width_unit"] ) );
|
||||
}
|
||||
else if ( properties.contains( "line_width_unit" ) )
|
||||
{
|
||||
layer->setOutlineWidthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["line_width_unit"] ) );
|
||||
layer->setOutlineWidthUnit( QgsUnitTypes::decodeRenderUnit( properties["line_width_unit"] ) );
|
||||
}
|
||||
if ( properties.contains( "outline_width_map_unit_scale" ) )
|
||||
{
|
||||
@ -145,7 +145,7 @@ QgsSymbolLayerV2* QgsEllipseSymbolLayerV2::create( const QgsStringMap& propertie
|
||||
}
|
||||
if ( properties.contains( "size_unit" ) )
|
||||
{
|
||||
layer->setSizeUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["size_unit"] ) );
|
||||
layer->setSizeUnit( QgsUnitTypes::decodeRenderUnit( properties["size_unit"] ) );
|
||||
}
|
||||
if ( properties.contains( "size_map_unit_scale" ) )
|
||||
{
|
||||
@ -157,7 +157,7 @@ QgsSymbolLayerV2* QgsEllipseSymbolLayerV2::create( const QgsStringMap& propertie
|
||||
}
|
||||
if ( properties.contains( "offset_unit" ) )
|
||||
{
|
||||
layer->setOffsetUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["offset_unit"] ) );
|
||||
layer->setOffsetUnit( QgsUnitTypes::decodeRenderUnit( properties["offset_unit"] ) );
|
||||
}
|
||||
if ( properties.contains( "offset_map_unit_scale" ) )
|
||||
{
|
||||
@ -510,24 +510,24 @@ QgsStringMap QgsEllipseSymbolLayerV2::properties() const
|
||||
QgsStringMap map;
|
||||
map["symbol_name"] = mSymbolName;
|
||||
map["symbol_width"] = QString::number( mSymbolWidth );
|
||||
map["symbol_width_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mSymbolWidthUnit );
|
||||
map["symbol_width_unit"] = QgsUnitTypes::encodeUnit( mSymbolWidthUnit );
|
||||
map["symbol_width_map_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( mSymbolWidthMapUnitScale );
|
||||
map["symbol_height"] = QString::number( mSymbolHeight );
|
||||
map["symbol_height_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mSymbolHeightUnit );
|
||||
map["symbol_height_unit"] = QgsUnitTypes::encodeUnit( mSymbolHeightUnit );
|
||||
map["symbol_height_map_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( mSymbolHeightMapUnitScale );
|
||||
map["angle"] = QString::number( mAngle );
|
||||
map["outline_style"] = QgsSymbolLayerV2Utils::encodePenStyle( mOutlineStyle );
|
||||
map["outline_width"] = QString::number( mOutlineWidth );
|
||||
map["outline_width_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mOutlineWidthUnit );
|
||||
map["outline_width_unit"] = QgsUnitTypes::encodeUnit( mOutlineWidthUnit );
|
||||
map["outline_width_map_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( mOutlineWidthMapUnitScale );
|
||||
map["joinstyle"] = QgsSymbolLayerV2Utils::encodePenJoinStyle( mPenJoinStyle );
|
||||
map["color"] = QgsSymbolLayerV2Utils::encodeColor( mColor );
|
||||
map["outline_color"] = QgsSymbolLayerV2Utils::encodeColor( mOutlineColor );
|
||||
map["offset"] = QgsSymbolLayerV2Utils::encodePoint( mOffset );
|
||||
map["offset_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mOffsetUnit );
|
||||
map["offset_unit"] = QgsUnitTypes::encodeUnit( mOffsetUnit );
|
||||
map["offset_map_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( mOffsetMapUnitScale );
|
||||
map["size"] = QString::number( mSize );
|
||||
map["size_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mSizeUnit );
|
||||
map["size_unit"] = QgsUnitTypes::encodeUnit( mSizeUnit );
|
||||
map["size_map_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( mSizeMapUnitScale );
|
||||
map["horizontal_anchor_point"] = QString::number( mHorizontalAnchorPoint );
|
||||
map["vertical_anchor_point"] = QString::number( mVerticalAnchorPoint );
|
||||
@ -637,7 +637,7 @@ void QgsEllipseSymbolLayerV2::preparePath( const QString& symbolName, QgsSymbolV
|
||||
}
|
||||
}
|
||||
|
||||
void QgsEllipseSymbolLayerV2::setOutputUnit( QgsSymbolV2::OutputUnit unit )
|
||||
void QgsEllipseSymbolLayerV2::setOutputUnit( QgsUnitTypes::RenderUnit unit )
|
||||
{
|
||||
QgsMarkerSymbolLayerV2::setOutputUnit( unit );
|
||||
mSymbolWidthUnit = unit;
|
||||
@ -645,12 +645,12 @@ void QgsEllipseSymbolLayerV2::setOutputUnit( QgsSymbolV2::OutputUnit unit )
|
||||
mOutlineWidthUnit = unit;
|
||||
}
|
||||
|
||||
QgsSymbolV2::OutputUnit QgsEllipseSymbolLayerV2::outputUnit() const
|
||||
QgsUnitTypes::RenderUnit QgsEllipseSymbolLayerV2::outputUnit() const
|
||||
{
|
||||
QgsSymbolV2::OutputUnit unit = QgsMarkerSymbolLayerV2::outputUnit();
|
||||
QgsUnitTypes::RenderUnit unit = QgsMarkerSymbolLayerV2::outputUnit();
|
||||
if ( mSymbolWidthUnit != unit || mSymbolHeightUnit != unit || mOutlineWidthUnit != unit )
|
||||
{
|
||||
return QgsSymbolV2::Mixed;
|
||||
return QgsUnitTypes::RenderUnknownUnit;
|
||||
}
|
||||
return unit;
|
||||
}
|
||||
@ -743,7 +743,7 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
|
||||
{
|
||||
symbolWidth = mSize;
|
||||
}
|
||||
if ( mSymbolWidthUnit == QgsSymbolV2::MM )
|
||||
if ( mSymbolWidthUnit == QgsUnitTypes::RenderMillimeters )
|
||||
{
|
||||
symbolWidth *= mmMapUnitScaleFactor;
|
||||
}
|
||||
@ -759,7 +759,7 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
|
||||
{
|
||||
symbolHeight = mSize;
|
||||
}
|
||||
if ( mSymbolHeightUnit == QgsSymbolV2::MM )
|
||||
if ( mSymbolHeightUnit == QgsUnitTypes::RenderMillimeters )
|
||||
{
|
||||
symbolHeight *= mmMapUnitScaleFactor;
|
||||
}
|
||||
@ -772,7 +772,7 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa
|
||||
context.setOriginalValueVariable( mOutlineWidth );
|
||||
outlineWidth = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH, context, mOutlineWidth ).toDouble();
|
||||
}
|
||||
if ( mOutlineWidthUnit == QgsSymbolV2::MM )
|
||||
if ( mOutlineWidthUnit == QgsUnitTypes::RenderMillimeters )
|
||||
{
|
||||
outlineWidth *= outlineWidth;
|
||||
}
|
||||
|
@ -73,26 +73,54 @@ class CORE_EXPORT QgsEllipseSymbolLayerV2: public QgsMarkerSymbolLayerV2
|
||||
void setOutlineColor( const QColor& c ) override { mOutlineColor = c; }
|
||||
QColor outlineColor() const override { return mOutlineColor; }
|
||||
|
||||
void setSymbolWidthUnit( QgsSymbolV2::OutputUnit unit ) { mSymbolWidthUnit = unit; }
|
||||
QgsSymbolV2::OutputUnit symbolWidthUnit() const { return mSymbolWidthUnit; }
|
||||
/** Sets the units for the symbol's width.
|
||||
* @param unit symbol units
|
||||
* @see symbolWidthUnit()
|
||||
* @see setSymbolHeightUnit()
|
||||
*/
|
||||
void setSymbolWidthUnit( QgsUnitTypes::RenderUnit unit ) { mSymbolWidthUnit = unit; }
|
||||
|
||||
/** Returns the units for the symbol's width.
|
||||
* @see setSymbolWidthUnit()
|
||||
* @see symbolHeightUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit symbolWidthUnit() const { return mSymbolWidthUnit; }
|
||||
|
||||
void setSymbolWidthMapUnitScale( const QgsMapUnitScale& scale ) { mSymbolWidthMapUnitScale = scale; }
|
||||
const QgsMapUnitScale& symbolWidthMapUnitScale() const { return mSymbolWidthMapUnitScale; }
|
||||
|
||||
void setSymbolHeightUnit( QgsSymbolV2::OutputUnit unit ) { mSymbolHeightUnit = unit; }
|
||||
QgsSymbolV2::OutputUnit symbolHeightUnit() const { return mSymbolHeightUnit; }
|
||||
/** Sets the units for the symbol's height.
|
||||
* @param unit symbol units
|
||||
* @see symbolHeightUnit()
|
||||
* @see setSymbolWidthUnit()
|
||||
*/
|
||||
void setSymbolHeightUnit( QgsUnitTypes::RenderUnit unit ) { mSymbolHeightUnit = unit; }
|
||||
|
||||
/** Returns the units for the symbol's height.
|
||||
* @see setSymbolHeightUnit()
|
||||
* @see symbolWidthUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit symbolHeightUnit() const { return mSymbolHeightUnit; }
|
||||
|
||||
void setSymbolHeightMapUnitScale( const QgsMapUnitScale& scale ) { mSymbolHeightMapUnitScale = scale; }
|
||||
const QgsMapUnitScale& symbolHeightMapUnitScale() const { return mSymbolHeightMapUnitScale; }
|
||||
|
||||
void setOutlineWidthUnit( QgsSymbolV2::OutputUnit unit ) { mOutlineWidthUnit = unit; }
|
||||
QgsSymbolV2::OutputUnit outlineWidthUnit() const { return mOutlineWidthUnit; }
|
||||
/** Sets the units for the symbol's outline width.
|
||||
* @param unit symbol units
|
||||
* @see outlineWidthUnit()
|
||||
*/
|
||||
void setOutlineWidthUnit( QgsUnitTypes::RenderUnit unit ) { mOutlineWidthUnit = unit; }
|
||||
|
||||
/** Returns the units for the symbol's outline width.
|
||||
* @see setOutlineWidthUnit()
|
||||
*/
|
||||
QgsUnitTypes::RenderUnit outlineWidthUnit() const { return mOutlineWidthUnit; }
|
||||
|
||||
void setOutlineWidthMapUnitScale( const QgsMapUnitScale& scale ) { mOutlineWidthMapUnitScale = scale; }
|
||||
const QgsMapUnitScale& outlineWidthMapUnitScale() const { return mOutlineWidthMapUnitScale; }
|
||||
|
||||
void setOutputUnit( QgsSymbolV2::OutputUnit unit ) override;
|
||||
QgsSymbolV2::OutputUnit outputUnit() const override;
|
||||
void setOutputUnit( QgsUnitTypes::RenderUnit unit ) override;
|
||||
QgsUnitTypes::RenderUnit outputUnit() const override;
|
||||
|
||||
void setMapUnitScale( const QgsMapUnitScale& scale ) override;
|
||||
QgsMapUnitScale mapUnitScale() const override;
|
||||
@ -102,16 +130,16 @@ class CORE_EXPORT QgsEllipseSymbolLayerV2: public QgsMarkerSymbolLayerV2
|
||||
private:
|
||||
QString mSymbolName;
|
||||
double mSymbolWidth;
|
||||
QgsSymbolV2::OutputUnit mSymbolWidthUnit;
|
||||
QgsUnitTypes::RenderUnit mSymbolWidthUnit;
|
||||
QgsMapUnitScale mSymbolWidthMapUnitScale;
|
||||
double mSymbolHeight;
|
||||
QgsSymbolV2::OutputUnit mSymbolHeightUnit;
|
||||
QgsUnitTypes::RenderUnit mSymbolHeightUnit;
|
||||
QgsMapUnitScale mSymbolHeightMapUnitScale;
|
||||
QColor mOutlineColor;
|
||||
Qt::PenStyle mOutlineStyle;
|
||||
Qt::PenJoinStyle mPenJoinStyle;
|
||||
double mOutlineWidth;
|
||||
QgsSymbolV2::OutputUnit mOutlineWidthUnit;
|
||||
QgsUnitTypes::RenderUnit mOutlineWidthUnit;
|
||||
QgsMapUnitScale mOutlineWidthMapUnitScale;
|
||||
|
||||
QPainterPath mPainterPath;
|
||||
|
@ -40,25 +40,25 @@ QgsSimpleFillSymbolLayerV2::QgsSimpleFillSymbolLayerV2( const QColor& color, Qt:
|
||||
, mBorderColor( borderColor )
|
||||
, mBorderStyle( borderStyle )
|
||||
, mBorderWidth( borderWidth )
|
||||
, mBorderWidthUnit( QgsSymbolV2::MM )
|
||||
, mBorderWidthUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mPenJoinStyle( penJoinStyle )
|
||||
, mOffsetUnit( QgsSymbolV2::MM )
|
||||
, mOffsetUnit( QgsUnitTypes::RenderMillimeters )
|
||||
{
|
||||
mColor = color;
|
||||
}
|
||||
|
||||
void QgsSimpleFillSymbolLayerV2::setOutputUnit( QgsSymbolV2::OutputUnit unit )
|
||||
void QgsSimpleFillSymbolLayerV2::setOutputUnit( QgsUnitTypes::RenderUnit unit )
|
||||
{
|
||||
mBorderWidthUnit = unit;
|
||||
mOffsetUnit = unit;
|
||||
}
|
||||
|
||||
QgsSymbolV2::OutputUnit QgsSimpleFillSymbolLayerV2::outputUnit() const
|
||||
QgsUnitTypes::RenderUnit QgsSimpleFillSymbolLayerV2::outputUnit() const
|
||||
{
|
||||
QgsSymbolV2::OutputUnit unit = mBorderWidthUnit;
|
||||
QgsUnitTypes::RenderUnit unit = mBorderWidthUnit;
|
||||
if ( mOffsetUnit != unit )
|
||||
{
|
||||
return QgsSymbolV2::Mixed;
|
||||
return QgsUnitTypes::RenderUnknownUnit;
|
||||
}
|
||||
return unit;
|
||||
}
|
||||
@ -200,18 +200,18 @@ QgsSymbolLayerV2* QgsSimpleFillSymbolLayerV2::create( const QgsStringMap& props
|
||||
sl->setOffset( offset );
|
||||
if ( props.contains( "border_width_unit" ) )
|
||||
{
|
||||
sl->setBorderWidthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( props["border_width_unit"] ) );
|
||||
sl->setBorderWidthUnit( QgsUnitTypes::decodeRenderUnit( props["border_width_unit"] ) );
|
||||
}
|
||||
else if ( props.contains( "outline_width_unit" ) )
|
||||
{
|
||||
sl->setBorderWidthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( props["outline_width_unit"] ) );
|
||||
sl->setBorderWidthUnit( QgsUnitTypes::decodeRenderUnit( props["outline_width_unit"] ) );
|
||||
}
|
||||
else if ( props.contains( "line_width_unit" ) )
|
||||
{
|
||||
sl->setBorderWidthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( props["line_width_unit"] ) );
|
||||
sl->setBorderWidthUnit( QgsUnitTypes::decodeRenderUnit( props["line_width_unit"] ) );
|
||||
}
|
||||
if ( props.contains( "offset_unit" ) )
|
||||
sl->setOffsetUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( props["offset_unit"] ) );
|
||||
sl->setOffsetUnit( QgsUnitTypes::decodeRenderUnit( props["offset_unit"] ) );
|
||||
|
||||
if ( props.contains( "border_width_map_unit_scale" ) )
|
||||
sl->setBorderWidthMapUnitScale( QgsSymbolLayerV2Utils::decodeMapUnitScale( props["border_width_map_unit_scale"] ) );
|
||||
@ -303,11 +303,11 @@ QgsStringMap QgsSimpleFillSymbolLayerV2::properties() const
|
||||
map["outline_color"] = QgsSymbolLayerV2Utils::encodeColor( mBorderColor );
|
||||
map["outline_style"] = QgsSymbolLayerV2Utils::encodePenStyle( mBorderStyle );
|
||||
map["outline_width"] = QString::number( mBorderWidth );
|
||||
map["outline_width_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mBorderWidthUnit );
|
||||
map["outline_width_unit"] = QgsUnitTypes::encodeUnit( mBorderWidthUnit );
|
||||
map["border_width_map_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( mBorderWidthMapUnitScale );
|
||||
map["joinstyle"] = QgsSymbolLayerV2Utils::encodePenJoinStyle( mPenJoinStyle );
|
||||
map["offset"] = QgsSymbolLayerV2Utils::encodePoint( mOffset );
|
||||
map["offset_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mOffsetUnit );
|
||||
map["offset_unit"] = QgsUnitTypes::encodeUnit( mOffsetUnit );
|
||||
map["offset_map_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( mOffsetMapUnitScale );
|
||||
saveDataDefinedProperties( map );
|
||||
return map;
|
||||
@ -472,7 +472,7 @@ QgsGradientFillSymbolLayerV2::QgsGradientFillSymbolLayerV2( const QColor& color,
|
||||
, mReferencePoint1IsCentroid( false )
|
||||
, mReferencePoint2( QPointF( 0.5, 1 ) )
|
||||
, mReferencePoint2IsCentroid( false )
|
||||
, mOffsetUnit( QgsSymbolV2::MM )
|
||||
, mOffsetUnit( QgsUnitTypes::RenderMillimeters )
|
||||
{
|
||||
mColor = color;
|
||||
mColor2 = color2;
|
||||
@ -543,7 +543,7 @@ QgsSymbolLayerV2* QgsGradientFillSymbolLayerV2::create( const QgsStringMap& prop
|
||||
QgsGradientFillSymbolLayerV2* sl = new QgsGradientFillSymbolLayerV2( color, color2, colorType, type, coordinateMode, gradientSpread );
|
||||
sl->setOffset( offset );
|
||||
if ( props.contains( "offset_unit" ) )
|
||||
sl->setOffsetUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( props["offset_unit"] ) );
|
||||
sl->setOffsetUnit( QgsUnitTypes::decodeRenderUnit( props["offset_unit"] ) );
|
||||
if ( props.contains( "offset_map_unit_scale" ) )
|
||||
sl->setOffsetMapUnitScale( QgsSymbolLayerV2Utils::decodeMapUnitScale( props["offset_map_unit_scale"] ) );
|
||||
sl->setReferencePoint1( referencePoint1 );
|
||||
@ -890,7 +890,7 @@ QgsStringMap QgsGradientFillSymbolLayerV2::properties() const
|
||||
map["reference_point2_iscentroid"] = QString::number( mReferencePoint2IsCentroid );
|
||||
map["angle"] = QString::number( mAngle );
|
||||
map["offset"] = QgsSymbolLayerV2Utils::encodePoint( mOffset );
|
||||
map["offset_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mOffsetUnit );
|
||||
map["offset_unit"] = QgsUnitTypes::encodeUnit( mOffsetUnit );
|
||||
map["offset_map_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( mOffsetMapUnitScale );
|
||||
saveDataDefinedProperties( map );
|
||||
if ( mGradientRamp )
|
||||
@ -924,12 +924,12 @@ double QgsGradientFillSymbolLayerV2::estimateMaxBleed() const
|
||||
return offsetBleed;
|
||||
}
|
||||
|
||||
void QgsGradientFillSymbolLayerV2::setOutputUnit( QgsSymbolV2::OutputUnit unit )
|
||||
void QgsGradientFillSymbolLayerV2::setOutputUnit( QgsUnitTypes::RenderUnit unit )
|
||||
{
|
||||
mOffsetUnit = unit;
|
||||
}
|
||||
|
||||
QgsSymbolV2::OutputUnit QgsGradientFillSymbolLayerV2::outputUnit() const
|
||||
QgsUnitTypes::RenderUnit QgsGradientFillSymbolLayerV2::outputUnit() const
|
||||
{
|
||||
return mOffsetUnit;
|
||||
}
|
||||
@ -951,13 +951,13 @@ QgsShapeburstFillSymbolLayerV2::QgsShapeburstFillSymbolLayerV2( const QColor& co
|
||||
: mBlurRadius( blurRadius )
|
||||
, mUseWholeShape( useWholeShape )
|
||||
, mMaxDistance( maxDistance )
|
||||
, mDistanceUnit( QgsSymbolV2::MM )
|
||||
, mDistanceUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mColorType( colorType )
|
||||
, mColor2( color2 )
|
||||
, mGradientRamp( nullptr )
|
||||
, mTwoColorGradientRamp( nullptr )
|
||||
, mIgnoreRings( false )
|
||||
, mOffsetUnit( QgsSymbolV2::MM )
|
||||
, mOffsetUnit( QgsUnitTypes::RenderMillimeters )
|
||||
{
|
||||
mColor = color;
|
||||
}
|
||||
@ -1026,11 +1026,11 @@ QgsSymbolLayerV2* QgsShapeburstFillSymbolLayerV2::create( const QgsStringMap& pr
|
||||
sl->setOffset( offset );
|
||||
if ( props.contains( "offset_unit" ) )
|
||||
{
|
||||
sl->setOffsetUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( props["offset_unit"] ) );
|
||||
sl->setOffsetUnit( QgsUnitTypes::decodeRenderUnit( props["offset_unit"] ) );
|
||||
}
|
||||
if ( props.contains( "distance_unit" ) )
|
||||
{
|
||||
sl->setDistanceUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( props["distance_unit"] ) );
|
||||
sl->setDistanceUnit( QgsUnitTypes::decodeRenderUnit( props["distance_unit"] ) );
|
||||
}
|
||||
if ( props.contains( "offset_map_unit_scale" ) )
|
||||
{
|
||||
@ -1485,11 +1485,11 @@ QgsStringMap QgsShapeburstFillSymbolLayerV2::properties() const
|
||||
map["blur_radius"] = QString::number( mBlurRadius );
|
||||
map["use_whole_shape"] = QString::number( mUseWholeShape );
|
||||
map["max_distance"] = QString::number( mMaxDistance );
|
||||
map["distance_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mDistanceUnit );
|
||||
map["distance_unit"] = QgsUnitTypes::encodeUnit( mDistanceUnit );
|
||||
map["distance_map_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( mDistanceMapUnitScale );
|
||||
map["ignore_rings"] = QString::number( mIgnoreRings );
|
||||
map["offset"] = QgsSymbolLayerV2Utils::encodePoint( mOffset );
|
||||
map["offset_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mOffsetUnit );
|
||||
map["offset_unit"] = QgsUnitTypes::encodeUnit( mOffsetUnit );
|
||||
map["offset_map_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( mOffsetMapUnitScale );
|
||||
|
||||
saveDataDefinedProperties( map );
|
||||
@ -1526,19 +1526,19 @@ double QgsShapeburstFillSymbolLayerV2::estimateMaxBleed() const
|
||||
return offsetBleed;
|
||||
}
|
||||
|
||||
void QgsShapeburstFillSymbolLayerV2::setOutputUnit( QgsSymbolV2::OutputUnit unit )
|
||||
void QgsShapeburstFillSymbolLayerV2::setOutputUnit( QgsUnitTypes::RenderUnit unit )
|
||||
{
|
||||
mDistanceUnit = unit;
|
||||
mOffsetUnit = unit;
|
||||
}
|
||||
|
||||
QgsSymbolV2::OutputUnit QgsShapeburstFillSymbolLayerV2::outputUnit() const
|
||||
QgsUnitTypes::RenderUnit QgsShapeburstFillSymbolLayerV2::outputUnit() const
|
||||
{
|
||||
if ( mDistanceUnit == mOffsetUnit )
|
||||
{
|
||||
return mDistanceUnit;
|
||||
}
|
||||
return QgsSymbolV2::Mixed;
|
||||
return QgsUnitTypes::RenderUnknownUnit;
|
||||
}
|
||||
|
||||
void QgsShapeburstFillSymbolLayerV2::setMapUnitScale( const QgsMapUnitScale &scale )
|
||||
@ -1562,7 +1562,7 @@ QgsMapUnitScale QgsShapeburstFillSymbolLayerV2::mapUnitScale() const
|
||||
QgsImageFillSymbolLayer::QgsImageFillSymbolLayer()
|
||||
: mNextAngle( 0.0 )
|
||||
, mOutlineWidth( 0.0 )
|
||||
, mOutlineWidthUnit( QgsSymbolV2::MM )
|
||||
, mOutlineWidthUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mOutline( nullptr )
|
||||
{
|
||||
setSubSymbol( new QgsLineSymbolV2() );
|
||||
@ -1656,12 +1656,12 @@ bool QgsImageFillSymbolLayer::setSubSymbol( QgsSymbolV2* symbol )
|
||||
return false;
|
||||
}
|
||||
|
||||
void QgsImageFillSymbolLayer::setOutputUnit( QgsSymbolV2::OutputUnit unit )
|
||||
void QgsImageFillSymbolLayer::setOutputUnit( QgsUnitTypes::RenderUnit unit )
|
||||
{
|
||||
mOutlineWidthUnit = unit;
|
||||
}
|
||||
|
||||
QgsSymbolV2::OutputUnit QgsImageFillSymbolLayer::outputUnit() const
|
||||
QgsUnitTypes::RenderUnit QgsImageFillSymbolLayer::outputUnit() const
|
||||
{
|
||||
return mOutlineWidthUnit;
|
||||
}
|
||||
@ -1736,8 +1736,8 @@ QSet<QString> QgsImageFillSymbolLayer::usedAttributes() const
|
||||
QgsSVGFillSymbolLayer::QgsSVGFillSymbolLayer( const QString& svgFilePath, double width, double angle )
|
||||
: QgsImageFillSymbolLayer()
|
||||
, mPatternWidth( width )
|
||||
, mPatternWidthUnit( QgsSymbolV2::MM )
|
||||
, mSvgOutlineWidthUnit( QgsSymbolV2::MM )
|
||||
, mPatternWidthUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mSvgOutlineWidthUnit( QgsUnitTypes::RenderMillimeters )
|
||||
{
|
||||
setSvgFilePath( svgFilePath );
|
||||
mOutlineWidth = 0.3;
|
||||
@ -1752,9 +1752,9 @@ QgsSVGFillSymbolLayer::QgsSVGFillSymbolLayer( const QString& svgFilePath, double
|
||||
QgsSVGFillSymbolLayer::QgsSVGFillSymbolLayer( const QByteArray& svgData, double width, double angle )
|
||||
: QgsImageFillSymbolLayer()
|
||||
, mPatternWidth( width )
|
||||
, mPatternWidthUnit( QgsSymbolV2::MM )
|
||||
, mPatternWidthUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mSvgData( svgData )
|
||||
, mSvgOutlineWidthUnit( QgsSymbolV2::MM )
|
||||
, mSvgOutlineWidthUnit( QgsUnitTypes::RenderMillimeters )
|
||||
{
|
||||
storeViewBox();
|
||||
mOutlineWidth = 0.3;
|
||||
@ -1772,7 +1772,7 @@ QgsSVGFillSymbolLayer::~QgsSVGFillSymbolLayer()
|
||||
delete mSvgPattern;
|
||||
}
|
||||
|
||||
void QgsSVGFillSymbolLayer::setOutputUnit( QgsSymbolV2::OutputUnit unit )
|
||||
void QgsSVGFillSymbolLayer::setOutputUnit( QgsUnitTypes::RenderUnit unit )
|
||||
{
|
||||
QgsImageFillSymbolLayer::setOutputUnit( unit );
|
||||
mPatternWidthUnit = unit;
|
||||
@ -1780,12 +1780,12 @@ void QgsSVGFillSymbolLayer::setOutputUnit( QgsSymbolV2::OutputUnit unit )
|
||||
mOutlineWidthUnit = unit;
|
||||
}
|
||||
|
||||
QgsSymbolV2::OutputUnit QgsSVGFillSymbolLayer::outputUnit() const
|
||||
QgsUnitTypes::RenderUnit QgsSVGFillSymbolLayer::outputUnit() const
|
||||
{
|
||||
QgsSymbolV2::OutputUnit unit = QgsImageFillSymbolLayer::outputUnit();
|
||||
QgsUnitTypes::RenderUnit unit = QgsImageFillSymbolLayer::outputUnit();
|
||||
if ( mPatternWidthUnit != unit || mSvgOutlineWidthUnit != unit || mOutlineWidthUnit != unit )
|
||||
{
|
||||
return QgsSymbolV2::Mixed;
|
||||
return QgsUnitTypes::RenderUnknownUnit;
|
||||
}
|
||||
return unit;
|
||||
}
|
||||
@ -1894,7 +1894,7 @@ QgsSymbolLayerV2* QgsSVGFillSymbolLayer::create( const QgsStringMap& properties
|
||||
//units
|
||||
if ( properties.contains( "pattern_width_unit" ) )
|
||||
{
|
||||
symbolLayer->setPatternWidthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["pattern_width_unit"] ) );
|
||||
symbolLayer->setPatternWidthUnit( QgsUnitTypes::decodeRenderUnit( properties["pattern_width_unit"] ) );
|
||||
}
|
||||
if ( properties.contains( "pattern_width_map_unit_scale" ) )
|
||||
{
|
||||
@ -1902,7 +1902,7 @@ QgsSymbolLayerV2* QgsSVGFillSymbolLayer::create( const QgsStringMap& properties
|
||||
}
|
||||
if ( properties.contains( "svg_outline_width_unit" ) )
|
||||
{
|
||||
symbolLayer->setSvgOutlineWidthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["svg_outline_width_unit"] ) );
|
||||
symbolLayer->setSvgOutlineWidthUnit( QgsUnitTypes::decodeRenderUnit( properties["svg_outline_width_unit"] ) );
|
||||
}
|
||||
if ( properties.contains( "svg_outline_width_map_unit_scale" ) )
|
||||
{
|
||||
@ -1910,7 +1910,7 @@ QgsSymbolLayerV2* QgsSVGFillSymbolLayer::create( const QgsStringMap& properties
|
||||
}
|
||||
if ( properties.contains( "outline_width_unit" ) )
|
||||
{
|
||||
symbolLayer->setOutlineWidthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["outline_width_unit"] ) );
|
||||
symbolLayer->setOutlineWidthUnit( QgsUnitTypes::decodeRenderUnit( properties["outline_width_unit"] ) );
|
||||
}
|
||||
if ( properties.contains( "outline_width_map_unit_scale" ) )
|
||||
{
|
||||
@ -1927,9 +1927,9 @@ QString QgsSVGFillSymbolLayer::layerType() const
|
||||
return "SVGFill";
|
||||
}
|
||||
|
||||
void QgsSVGFillSymbolLayer::applyPattern( QBrush& brush, const QString& svgFilePath, double patternWidth, QgsSymbolV2::OutputUnit patternWidthUnit,
|
||||
void QgsSVGFillSymbolLayer::applyPattern( QBrush& brush, const QString& svgFilePath, double patternWidth, QgsUnitTypes::RenderUnit patternWidthUnit,
|
||||
const QColor& svgFillColor, const QColor& svgOutlineColor, double svgOutlineWidth,
|
||||
QgsSymbolV2::OutputUnit svgOutlineWidthUnit, const QgsSymbolV2RenderContext& context,
|
||||
QgsUnitTypes::RenderUnit svgOutlineWidthUnit, const QgsSymbolV2RenderContext& context,
|
||||
const QgsMapUnitScale& patternWidthMapUnitScale, const QgsMapUnitScale& svgOutlineWidthMapUnitScale )
|
||||
{
|
||||
if ( mSvgViewBox.isNull() )
|
||||
@ -2026,11 +2026,11 @@ QgsStringMap QgsSVGFillSymbolLayer::properties() const
|
||||
map.insert( "outline_width", QString::number( mSvgOutlineWidth ) );
|
||||
|
||||
//units
|
||||
map.insert( "pattern_width_unit", QgsSymbolLayerV2Utils::encodeOutputUnit( mPatternWidthUnit ) );
|
||||
map.insert( "pattern_width_unit", QgsUnitTypes::encodeUnit( mPatternWidthUnit ) );
|
||||
map.insert( "pattern_width_map_unit_scale", QgsSymbolLayerV2Utils::encodeMapUnitScale( mPatternWidthMapUnitScale ) );
|
||||
map.insert( "svg_outline_width_unit", QgsSymbolLayerV2Utils::encodeOutputUnit( mSvgOutlineWidthUnit ) );
|
||||
map.insert( "svg_outline_width_unit", QgsUnitTypes::encodeUnit( mSvgOutlineWidthUnit ) );
|
||||
map.insert( "svg_outline_width_map_unit_scale", QgsSymbolLayerV2Utils::encodeMapUnitScale( mSvgOutlineWidthMapUnitScale ) );
|
||||
map.insert( "outline_width_unit", QgsSymbolLayerV2Utils::encodeOutputUnit( mOutlineWidthUnit ) );
|
||||
map.insert( "outline_width_unit", QgsUnitTypes::encodeUnit( mOutlineWidthUnit ) );
|
||||
map.insert( "outline_width_map_unit_scale", QgsSymbolLayerV2Utils::encodeMapUnitScale( mOutlineWidthMapUnitScale ) );
|
||||
|
||||
saveDataDefinedProperties( map );
|
||||
@ -2307,12 +2307,12 @@ void QgsSVGFillSymbolLayer::setDefaultSvgParams()
|
||||
QgsLinePatternFillSymbolLayer::QgsLinePatternFillSymbolLayer()
|
||||
: QgsImageFillSymbolLayer()
|
||||
, mDistance( 5.0 )
|
||||
, mDistanceUnit( QgsSymbolV2::MM )
|
||||
, mDistanceUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mLineWidth( 0 )
|
||||
, mLineWidthUnit( QgsSymbolV2::MM )
|
||||
, mLineWidthUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mLineAngle( 45.0 )
|
||||
, mOffset( 0.0 )
|
||||
, mOffsetUnit( QgsSymbolV2::MM )
|
||||
, mOffsetUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mFillLineSymbol( nullptr )
|
||||
{
|
||||
setSubSymbol( new QgsLineSymbolV2() );
|
||||
@ -2381,7 +2381,7 @@ double QgsLinePatternFillSymbolLayer::estimateMaxBleed() const
|
||||
return 0;
|
||||
}
|
||||
|
||||
void QgsLinePatternFillSymbolLayer::setOutputUnit( QgsSymbolV2::OutputUnit unit )
|
||||
void QgsLinePatternFillSymbolLayer::setOutputUnit( QgsUnitTypes::RenderUnit unit )
|
||||
{
|
||||
QgsImageFillSymbolLayer::setOutputUnit( unit );
|
||||
mDistanceUnit = unit;
|
||||
@ -2389,12 +2389,12 @@ void QgsLinePatternFillSymbolLayer::setOutputUnit( QgsSymbolV2::OutputUnit unit
|
||||
mOffsetUnit = unit;
|
||||
}
|
||||
|
||||
QgsSymbolV2::OutputUnit QgsLinePatternFillSymbolLayer::outputUnit() const
|
||||
QgsUnitTypes::RenderUnit QgsLinePatternFillSymbolLayer::outputUnit() const
|
||||
{
|
||||
QgsSymbolV2::OutputUnit unit = QgsImageFillSymbolLayer::outputUnit();
|
||||
QgsUnitTypes::RenderUnit unit = QgsImageFillSymbolLayer::outputUnit();
|
||||
if ( mDistanceUnit != unit || mLineWidthUnit != unit || mOffsetUnit != unit )
|
||||
{
|
||||
return QgsSymbolV2::Mixed;
|
||||
return QgsUnitTypes::RenderUnknownUnit;
|
||||
}
|
||||
return unit;
|
||||
}
|
||||
@ -2484,7 +2484,7 @@ QgsSymbolLayerV2* QgsLinePatternFillSymbolLayer::create( const QgsStringMap& pro
|
||||
|
||||
if ( properties.contains( "distance_unit" ) )
|
||||
{
|
||||
patternLayer->setDistanceUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["distance_unit"] ) );
|
||||
patternLayer->setDistanceUnit( QgsUnitTypes::decodeRenderUnit( properties["distance_unit"] ) );
|
||||
}
|
||||
if ( properties.contains( "distance_map_unit_scale" ) )
|
||||
{
|
||||
@ -2492,11 +2492,11 @@ QgsSymbolLayerV2* QgsLinePatternFillSymbolLayer::create( const QgsStringMap& pro
|
||||
}
|
||||
if ( properties.contains( "line_width_unit" ) )
|
||||
{
|
||||
patternLayer->setLineWidthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["line_width_unit"] ) );
|
||||
patternLayer->setLineWidthUnit( QgsUnitTypes::decodeRenderUnit( properties["line_width_unit"] ) );
|
||||
}
|
||||
else if ( properties.contains( "outline_width_unit" ) )
|
||||
{
|
||||
patternLayer->setLineWidthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["outline_width_unit"] ) );
|
||||
patternLayer->setLineWidthUnit( QgsUnitTypes::decodeRenderUnit( properties["outline_width_unit"] ) );
|
||||
}
|
||||
if ( properties.contains( "line_width_map_unit_scale" ) )
|
||||
{
|
||||
@ -2504,7 +2504,7 @@ QgsSymbolLayerV2* QgsLinePatternFillSymbolLayer::create( const QgsStringMap& pro
|
||||
}
|
||||
if ( properties.contains( "offset_unit" ) )
|
||||
{
|
||||
patternLayer->setOffsetUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["offset_unit"] ) );
|
||||
patternLayer->setOffsetUnit( QgsUnitTypes::decodeRenderUnit( properties["offset_unit"] ) );
|
||||
}
|
||||
if ( properties.contains( "offset_map_unit_scale" ) )
|
||||
{
|
||||
@ -2512,7 +2512,7 @@ QgsSymbolLayerV2* QgsLinePatternFillSymbolLayer::create( const QgsStringMap& pro
|
||||
}
|
||||
if ( properties.contains( "outline_width_unit" ) )
|
||||
{
|
||||
patternLayer->setOutlineWidthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["outline_width_unit"] ) );
|
||||
patternLayer->setOutlineWidthUnit( QgsUnitTypes::decodeRenderUnit( properties["outline_width_unit"] ) );
|
||||
}
|
||||
if ( properties.contains( "outline_width_map_unit_scale" ) )
|
||||
{
|
||||
@ -2567,7 +2567,7 @@ void QgsLinePatternFillSymbolLayer::applyPattern( const QgsSymbolV2RenderContext
|
||||
// offset regardless units. This has to be fixed especially
|
||||
// in estimateMaxBleed(), context probably has to be used.
|
||||
// For now, we only support millimeters
|
||||
double outputPixelLayerBleed = layerBleed * QgsSymbolLayerV2Utils::pixelSizeScaleFactor( ctx, QgsSymbolV2::MM );
|
||||
double outputPixelLayerBleed = layerBleed * QgsSymbolLayerV2Utils::pixelSizeScaleFactor( ctx, QgsUnitTypes::RenderMillimeters );
|
||||
outputPixelBleed = qMax( outputPixelBleed, outputPixelLayerBleed );
|
||||
|
||||
QgsMarkerLineSymbolLayerV2 *markerLineLayer = dynamic_cast<QgsMarkerLineSymbolLayerV2 *>( layer );
|
||||
@ -2842,13 +2842,13 @@ QgsStringMap QgsLinePatternFillSymbolLayer::properties() const
|
||||
map.insert( "line_width", QString::number( mLineWidth ) );
|
||||
map.insert( "color", QgsSymbolLayerV2Utils::encodeColor( mColor ) );
|
||||
map.insert( "offset", QString::number( mOffset ) );
|
||||
map.insert( "distance_unit", QgsSymbolLayerV2Utils::encodeOutputUnit( mDistanceUnit ) );
|
||||
map.insert( "line_width_unit", QgsSymbolLayerV2Utils::encodeOutputUnit( mLineWidthUnit ) );
|
||||
map.insert( "offset_unit", QgsSymbolLayerV2Utils::encodeOutputUnit( mOffsetUnit ) );
|
||||
map.insert( "distance_unit", QgsUnitTypes::encodeUnit( mDistanceUnit ) );
|
||||
map.insert( "line_width_unit", QgsUnitTypes::encodeUnit( mLineWidthUnit ) );
|
||||
map.insert( "offset_unit", QgsUnitTypes::encodeUnit( mOffsetUnit ) );
|
||||
map.insert( "distance_map_unit_scale", QgsSymbolLayerV2Utils::encodeMapUnitScale( mDistanceMapUnitScale ) );
|
||||
map.insert( "line_width_map_unit_scale", QgsSymbolLayerV2Utils::encodeMapUnitScale( mLineWidthMapUnitScale ) );
|
||||
map.insert( "offset_map_unit_scale", QgsSymbolLayerV2Utils::encodeMapUnitScale( mOffsetMapUnitScale ) );
|
||||
map.insert( "outline_width_unit", QgsSymbolLayerV2Utils::encodeOutputUnit( mOutlineWidthUnit ) );
|
||||
map.insert( "outline_width_unit", QgsUnitTypes::encodeUnit( mOutlineWidthUnit ) );
|
||||
map.insert( "outline_width_map_unit_scale", QgsSymbolLayerV2Utils::encodeMapUnitScale( mOutlineWidthMapUnitScale ) );
|
||||
saveDataDefinedProperties( map );
|
||||
return map;
|
||||
@ -3036,13 +3036,13 @@ QgsPointPatternFillSymbolLayer::QgsPointPatternFillSymbolLayer()
|
||||
: QgsImageFillSymbolLayer()
|
||||
, mMarkerSymbol( nullptr )
|
||||
, mDistanceX( 15 )
|
||||
, mDistanceXUnit( QgsSymbolV2::MM )
|
||||
, mDistanceXUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mDistanceY( 15 )
|
||||
, mDistanceYUnit( QgsSymbolV2::MM )
|
||||
, mDistanceYUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mDisplacementX( 0 )
|
||||
, mDisplacementXUnit( QgsSymbolV2::MM )
|
||||
, mDisplacementXUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mDisplacementY( 0 )
|
||||
, mDisplacementYUnit( QgsSymbolV2::MM )
|
||||
, mDisplacementYUnit( QgsUnitTypes::RenderMillimeters )
|
||||
{
|
||||
mDistanceX = 15;
|
||||
mDistanceY = 15;
|
||||
@ -3057,7 +3057,7 @@ QgsPointPatternFillSymbolLayer::~QgsPointPatternFillSymbolLayer()
|
||||
delete mMarkerSymbol;
|
||||
}
|
||||
|
||||
void QgsPointPatternFillSymbolLayer::setOutputUnit( QgsSymbolV2::OutputUnit unit )
|
||||
void QgsPointPatternFillSymbolLayer::setOutputUnit( QgsUnitTypes::RenderUnit unit )
|
||||
{
|
||||
QgsImageFillSymbolLayer::setOutputUnit( unit );
|
||||
mDistanceXUnit = unit;
|
||||
@ -3066,12 +3066,12 @@ void QgsPointPatternFillSymbolLayer::setOutputUnit( QgsSymbolV2::OutputUnit unit
|
||||
mDisplacementYUnit = unit;
|
||||
}
|
||||
|
||||
QgsSymbolV2::OutputUnit QgsPointPatternFillSymbolLayer::outputUnit() const
|
||||
QgsUnitTypes::RenderUnit QgsPointPatternFillSymbolLayer::outputUnit() const
|
||||
{
|
||||
QgsSymbolV2::OutputUnit unit = QgsImageFillSymbolLayer::outputUnit();
|
||||
QgsUnitTypes::RenderUnit unit = QgsImageFillSymbolLayer::outputUnit();
|
||||
if ( mDistanceXUnit != unit || mDistanceYUnit != unit || mDisplacementXUnit != unit || mDisplacementYUnit != unit )
|
||||
{
|
||||
return QgsSymbolV2::Mixed;
|
||||
return QgsUnitTypes::RenderUnknownUnit;
|
||||
}
|
||||
return unit;
|
||||
}
|
||||
@ -3119,7 +3119,7 @@ QgsSymbolLayerV2* QgsPointPatternFillSymbolLayer::create( const QgsStringMap& pr
|
||||
|
||||
if ( properties.contains( "distance_x_unit" ) )
|
||||
{
|
||||
layer->setDistanceXUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["distance_x_unit"] ) );
|
||||
layer->setDistanceXUnit( QgsUnitTypes::decodeRenderUnit( properties["distance_x_unit"] ) );
|
||||
}
|
||||
if ( properties.contains( "distance_x_map_unit_scale" ) )
|
||||
{
|
||||
@ -3127,7 +3127,7 @@ QgsSymbolLayerV2* QgsPointPatternFillSymbolLayer::create( const QgsStringMap& pr
|
||||
}
|
||||
if ( properties.contains( "distance_y_unit" ) )
|
||||
{
|
||||
layer->setDistanceYUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["distance_y_unit"] ) );
|
||||
layer->setDistanceYUnit( QgsUnitTypes::decodeRenderUnit( properties["distance_y_unit"] ) );
|
||||
}
|
||||
if ( properties.contains( "distance_y_map_unit_scale" ) )
|
||||
{
|
||||
@ -3135,7 +3135,7 @@ QgsSymbolLayerV2* QgsPointPatternFillSymbolLayer::create( const QgsStringMap& pr
|
||||
}
|
||||
if ( properties.contains( "displacement_x_unit" ) )
|
||||
{
|
||||
layer->setDisplacementXUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["displacement_x_unit"] ) );
|
||||
layer->setDisplacementXUnit( QgsUnitTypes::decodeRenderUnit( properties["displacement_x_unit"] ) );
|
||||
}
|
||||
if ( properties.contains( "displacement_x_map_unit_scale" ) )
|
||||
{
|
||||
@ -3143,7 +3143,7 @@ QgsSymbolLayerV2* QgsPointPatternFillSymbolLayer::create( const QgsStringMap& pr
|
||||
}
|
||||
if ( properties.contains( "displacement_y_unit" ) )
|
||||
{
|
||||
layer->setDisplacementYUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["displacement_y_unit"] ) );
|
||||
layer->setDisplacementYUnit( QgsUnitTypes::decodeRenderUnit( properties["displacement_y_unit"] ) );
|
||||
}
|
||||
if ( properties.contains( "displacement_y_map_unit_scale" ) )
|
||||
{
|
||||
@ -3151,7 +3151,7 @@ QgsSymbolLayerV2* QgsPointPatternFillSymbolLayer::create( const QgsStringMap& pr
|
||||
}
|
||||
if ( properties.contains( "outline_width_unit" ) )
|
||||
{
|
||||
layer->setOutlineWidthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["outline_width_unit"] ) );
|
||||
layer->setOutlineWidthUnit( QgsUnitTypes::decodeRenderUnit( properties["outline_width_unit"] ) );
|
||||
}
|
||||
if ( properties.contains( "outline_width_map_unit_scale" ) )
|
||||
{
|
||||
@ -3262,15 +3262,15 @@ QgsStringMap QgsPointPatternFillSymbolLayer::properties() const
|
||||
map.insert( "distance_y", QString::number( mDistanceY ) );
|
||||
map.insert( "displacement_x", QString::number( mDisplacementX ) );
|
||||
map.insert( "displacement_y", QString::number( mDisplacementY ) );
|
||||
map.insert( "distance_x_unit", QgsSymbolLayerV2Utils::encodeOutputUnit( mDistanceXUnit ) );
|
||||
map.insert( "distance_y_unit", QgsSymbolLayerV2Utils::encodeOutputUnit( mDistanceYUnit ) );
|
||||
map.insert( "displacement_x_unit", QgsSymbolLayerV2Utils::encodeOutputUnit( mDisplacementXUnit ) );
|
||||
map.insert( "displacement_y_unit", QgsSymbolLayerV2Utils::encodeOutputUnit( mDisplacementYUnit ) );
|
||||
map.insert( "distance_x_unit", QgsUnitTypes::encodeUnit( mDistanceXUnit ) );
|
||||
map.insert( "distance_y_unit", QgsUnitTypes::encodeUnit( mDistanceYUnit ) );
|
||||
map.insert( "displacement_x_unit", QgsUnitTypes::encodeUnit( mDisplacementXUnit ) );
|
||||
map.insert( "displacement_y_unit", QgsUnitTypes::encodeUnit( mDisplacementYUnit ) );
|
||||
map.insert( "distance_x_map_unit_scale", QgsSymbolLayerV2Utils::encodeMapUnitScale( mDistanceXMapUnitScale ) );
|
||||
map.insert( "distance_y_map_unit_scale", QgsSymbolLayerV2Utils::encodeMapUnitScale( mDistanceYMapUnitScale ) );
|
||||
map.insert( "displacement_x_map_unit_scale", QgsSymbolLayerV2Utils::encodeMapUnitScale( mDisplacementXMapUnitScale ) );
|
||||
map.insert( "displacement_y_map_unit_scale", QgsSymbolLayerV2Utils::encodeMapUnitScale( mDisplacementYMapUnitScale ) );
|
||||
map.insert( "outline_width_unit", QgsSymbolLayerV2Utils::encodeOutputUnit( mOutlineWidthUnit ) );
|
||||
map.insert( "outline_width_unit", QgsUnitTypes::encodeUnit( mOutlineWidthUnit ) );
|
||||
map.insert( "outline_width_map_unit_scale", QgsSymbolLayerV2Utils::encodeMapUnitScale( mOutlineWidthMapUnitScale ) );
|
||||
saveDataDefinedProperties( map );
|
||||
return map;
|
||||
@ -3588,7 +3588,7 @@ QSet<QString> QgsCentroidFillSymbolLayerV2::usedAttributes() const
|
||||
return attributes;
|
||||
}
|
||||
|
||||
void QgsCentroidFillSymbolLayerV2::setOutputUnit( QgsSymbolV2::OutputUnit unit )
|
||||
void QgsCentroidFillSymbolLayerV2::setOutputUnit( QgsUnitTypes::RenderUnit unit )
|
||||
{
|
||||
if ( mMarker )
|
||||
{
|
||||
@ -3596,13 +3596,13 @@ void QgsCentroidFillSymbolLayerV2::setOutputUnit( QgsSymbolV2::OutputUnit unit )
|
||||
}
|
||||
}
|
||||
|
||||
QgsSymbolV2::OutputUnit QgsCentroidFillSymbolLayerV2::outputUnit() const
|
||||
QgsUnitTypes::RenderUnit QgsCentroidFillSymbolLayerV2::outputUnit() const
|
||||
{
|
||||
if ( mMarker )
|
||||
{
|
||||
return mMarker->outputUnit();
|
||||
}
|
||||
return QgsSymbolV2::Mixed; //mOutputUnit;
|
||||
return QgsUnitTypes::RenderUnknownUnit; //mOutputUnit;
|
||||
}
|
||||
|
||||
void QgsCentroidFillSymbolLayerV2::setMapUnitScale( const QgsMapUnitScale &scale )
|
||||
@ -3630,9 +3630,9 @@ QgsRasterFillSymbolLayer::QgsRasterFillSymbolLayer( const QString &imageFilePath
|
||||
, mImageFilePath( imageFilePath )
|
||||
, mCoordinateMode( QgsRasterFillSymbolLayer::Feature )
|
||||
, mAlpha( 1.0 )
|
||||
, mOffsetUnit( QgsSymbolV2::MM )
|
||||
, mOffsetUnit( QgsUnitTypes::RenderMillimeters )
|
||||
, mWidth( 0.0 )
|
||||
, mWidthUnit( QgsSymbolV2::Pixel )
|
||||
, mWidthUnit( QgsUnitTypes::RenderPixels )
|
||||
{
|
||||
QgsImageFillSymbolLayer::setSubSymbol( nullptr ); //disable sub symbol
|
||||
}
|
||||
@ -3683,7 +3683,7 @@ QgsSymbolLayerV2 *QgsRasterFillSymbolLayer::create( const QgsStringMap &properti
|
||||
symbolLayer->setWidth( width );
|
||||
if ( properties.contains( "offset_unit" ) )
|
||||
{
|
||||
symbolLayer->setOffsetUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["offset_unit"] ) );
|
||||
symbolLayer->setOffsetUnit( QgsUnitTypes::decodeRenderUnit( properties["offset_unit"] ) );
|
||||
}
|
||||
if ( properties.contains( "offset_map_unit_scale" ) )
|
||||
{
|
||||
@ -3691,7 +3691,7 @@ QgsSymbolLayerV2 *QgsRasterFillSymbolLayer::create( const QgsStringMap &properti
|
||||
}
|
||||
if ( properties.contains( "width_unit" ) )
|
||||
{
|
||||
symbolLayer->setWidthUnit( QgsSymbolLayerV2Utils::decodeOutputUnit( properties["width_unit"] ) );
|
||||
symbolLayer->setWidthUnit( QgsUnitTypes::decodeRenderUnit( properties["width_unit"] ) );
|
||||
}
|
||||
if ( properties.contains( "width_map_unit_scale" ) )
|
||||
{
|
||||
@ -3761,11 +3761,11 @@ QgsStringMap QgsRasterFillSymbolLayer::properties() const
|
||||
map["coordinate_mode"] = QString::number( mCoordinateMode );
|
||||
map["alpha"] = QString::number( mAlpha );
|
||||
map["offset"] = QgsSymbolLayerV2Utils::encodePoint( mOffset );
|
||||
map["offset_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mOffsetUnit );
|
||||
map["offset_unit"] = QgsUnitTypes::encodeUnit( mOffsetUnit );
|
||||
map["offset_map_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( mOffsetMapUnitScale );
|
||||
map["angle"] = QString::number( mAngle );
|
||||
map["width"] = QString::number( mWidth );
|
||||
map["width_unit"] = QgsSymbolLayerV2Utils::encodeOutputUnit( mWidthUnit );
|
||||
map["width_unit"] = QgsUnitTypes::encodeUnit( mWidthUnit );
|
||||
map["width_map_unit_scale"] = QgsSymbolLayerV2Utils::encodeMapUnitScale( mWidthMapUnitScale );
|
||||
|
||||
saveDataDefinedProperties( map );
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user