Skip to content

Commit

Permalink
Merge pull request #55718 from nirvn/cmyk_encode_decode
Browse files Browse the repository at this point in the history
[core] Rely on QgsColorUtils encoding/decoding to handle CMYK
  • Loading branch information
nirvn authored Jan 4, 2024
2 parents 5b50eab + e3c5359 commit 976ffd5
Show file tree
Hide file tree
Showing 52 changed files with 284 additions and 253 deletions.
5 changes: 3 additions & 2 deletions src/3d/lights/qgsdirectionallightsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include "qgsdirectionallightsettings.h"
#include "qgssymbollayerutils.h"
#include "qgscolorutils.h"

#include <QDomDocument>
#include <Qt3DRender/QDirectionalLight>
Expand Down Expand Up @@ -53,7 +54,7 @@ QDomElement QgsDirectionalLightSettings::writeXml( QDomDocument &doc, const QgsR
elemLight.setAttribute( QStringLiteral( "x" ), mDirection.x() );
elemLight.setAttribute( QStringLiteral( "y" ), mDirection.y() );
elemLight.setAttribute( QStringLiteral( "z" ), mDirection.z() );
elemLight.setAttribute( QStringLiteral( "color" ), QgsSymbolLayerUtils::encodeColor( mColor ) );
elemLight.setAttribute( QStringLiteral( "color" ), QgsColorUtils::colorToString( mColor ) );
elemLight.setAttribute( QStringLiteral( "intensity" ), mIntensity );
return elemLight;
}
Expand All @@ -63,7 +64,7 @@ void QgsDirectionalLightSettings::readXml( const QDomElement &elem, const QgsRea
mDirection.set( elem.attribute( QStringLiteral( "x" ) ).toFloat(),
elem.attribute( QStringLiteral( "y" ) ).toFloat(),
elem.attribute( QStringLiteral( "z" ) ).toFloat() );
mColor = QgsSymbolLayerUtils::decodeColor( elem.attribute( QStringLiteral( "color" ) ) );
mColor = QgsColorUtils::colorFromString( elem.attribute( QStringLiteral( "color" ) ) );
mIntensity = elem.attribute( QStringLiteral( "intensity" ) ).toFloat();
}

Expand Down
5 changes: 3 additions & 2 deletions src/3d/lights/qgspointlightsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include "qgspointlightsettings.h"
#include "qgssymbollayerutils.h"
#include "qgscolorutils.h"
#include "qgs3dmapsettings.h"

#include <QDomDocument>
Expand Down Expand Up @@ -90,7 +91,7 @@ QDomElement QgsPointLightSettings::writeXml( QDomDocument &doc, const QgsReadWri
elemLight.setAttribute( QStringLiteral( "x" ), mPosition.x() );
elemLight.setAttribute( QStringLiteral( "y" ), mPosition.y() );
elemLight.setAttribute( QStringLiteral( "z" ), mPosition.z() );
elemLight.setAttribute( QStringLiteral( "color" ), QgsSymbolLayerUtils::encodeColor( mColor ) );
elemLight.setAttribute( QStringLiteral( "color" ), QgsColorUtils::colorToString( mColor ) );
elemLight.setAttribute( QStringLiteral( "intensity" ), mIntensity );
elemLight.setAttribute( QStringLiteral( "attenuation-0" ), mConstantAttenuation );
elemLight.setAttribute( QStringLiteral( "attenuation-1" ), mLinearAttenuation );
Expand All @@ -103,7 +104,7 @@ void QgsPointLightSettings::readXml( const QDomElement &elem, const QgsReadWrite
mPosition.set( elem.attribute( QStringLiteral( "x" ) ).toDouble(),
elem.attribute( QStringLiteral( "y" ) ).toDouble(),
elem.attribute( QStringLiteral( "z" ) ).toDouble() );
mColor = QgsSymbolLayerUtils::decodeColor( elem.attribute( QStringLiteral( "color" ) ) );
mColor = QgsColorUtils::colorFromString( elem.attribute( QStringLiteral( "color" ) ) );
mIntensity = elem.attribute( QStringLiteral( "intensity" ) ).toFloat();
mConstantAttenuation = elem.attribute( QStringLiteral( "attenuation-0" ) ).toDouble();
mLinearAttenuation = elem.attribute( QStringLiteral( "attenuation-1" ) ).toDouble();
Expand Down
18 changes: 9 additions & 9 deletions src/3d/materials/qgsgoochmaterialsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
***************************************************************************/

#include "qgsgoochmaterialsettings.h"
#include "qgscolorutils.h"

#include "qgssymbollayerutils.h"
#include <Qt3DExtras/QGoochMaterial>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <Qt3DRender/QAttribute>
Expand Down Expand Up @@ -75,10 +75,10 @@ QgsGoochMaterialSettings *QgsGoochMaterialSettings::clone() const

void QgsGoochMaterialSettings::readXml( const QDomElement &elem, const QgsReadWriteContext &context )
{
mWarm = QgsSymbolLayerUtils::decodeColor( elem.attribute( QStringLiteral( "warm" ), QStringLiteral( "107,0,107" ) ) );
mCool = QgsSymbolLayerUtils::decodeColor( elem.attribute( QStringLiteral( "cool" ), QStringLiteral( "255,130,0" ) ) );
mDiffuse = QgsSymbolLayerUtils::decodeColor( elem.attribute( QStringLiteral( "diffuse" ), QStringLiteral( "178,178,178" ) ) );
mSpecular = QgsSymbolLayerUtils::decodeColor( elem.attribute( QStringLiteral( "specular" ) ) );
mWarm = QgsColorUtils::colorFromString( elem.attribute( QStringLiteral( "warm" ), QStringLiteral( "107,0,107" ) ) );
mCool = QgsColorUtils::colorFromString( elem.attribute( QStringLiteral( "cool" ), QStringLiteral( "255,130,0" ) ) );
mDiffuse = QgsColorUtils::colorFromString( elem.attribute( QStringLiteral( "diffuse" ), QStringLiteral( "178,178,178" ) ) );
mSpecular = QgsColorUtils::colorFromString( elem.attribute( QStringLiteral( "specular" ) ) );
mShininess = elem.attribute( QStringLiteral( "shininess2" ), QStringLiteral( "100" ) ).toFloat();
mAlpha = elem.attribute( QStringLiteral( "alpha" ), QStringLiteral( "0.25" ) ).toFloat();
mBeta = elem.attribute( QStringLiteral( "beta" ), QStringLiteral( "0.5" ) ).toFloat();
Expand All @@ -88,10 +88,10 @@ void QgsGoochMaterialSettings::readXml( const QDomElement &elem, const QgsReadWr

void QgsGoochMaterialSettings::writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const
{
elem.setAttribute( QStringLiteral( "warm" ), QgsSymbolLayerUtils::encodeColor( mWarm ) );
elem.setAttribute( QStringLiteral( "cool" ), QgsSymbolLayerUtils::encodeColor( mCool ) );
elem.setAttribute( QStringLiteral( "diffuse" ), QgsSymbolLayerUtils::encodeColor( mDiffuse ) );
elem.setAttribute( QStringLiteral( "specular" ), QgsSymbolLayerUtils::encodeColor( mSpecular ) );
elem.setAttribute( QStringLiteral( "warm" ), QgsColorUtils::colorToString( mWarm ) );
elem.setAttribute( QStringLiteral( "cool" ), QgsColorUtils::colorToString( mCool ) );
elem.setAttribute( QStringLiteral( "diffuse" ), QgsColorUtils::colorToString( mDiffuse ) );
elem.setAttribute( QStringLiteral( "specular" ), QgsColorUtils::colorToString( mSpecular ) );
elem.setAttribute( QStringLiteral( "shininess2" ), mShininess );
elem.setAttribute( QStringLiteral( "alpha" ), mAlpha );
elem.setAttribute( QStringLiteral( "beta" ), mBeta );
Expand Down
14 changes: 7 additions & 7 deletions src/3d/materials/qgsphongmaterialsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
***************************************************************************/

#include "qgsphongmaterialsettings.h"
#include "qgscolorutils.h"

#include "qgssymbollayerutils.h"
#include <Qt3DExtras/QDiffuseSpecularMaterial>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <Qt3DRender/QAttribute>
Expand Down Expand Up @@ -79,9 +79,9 @@ QgsPhongMaterialSettings *QgsPhongMaterialSettings::clone() const

void QgsPhongMaterialSettings::readXml( const QDomElement &elem, const QgsReadWriteContext &context )
{
mAmbient = QgsSymbolLayerUtils::decodeColor( elem.attribute( QStringLiteral( "ambient" ), QStringLiteral( "25,25,25" ) ) );
mDiffuse = QgsSymbolLayerUtils::decodeColor( elem.attribute( QStringLiteral( "diffuse" ), QStringLiteral( "178,178,178" ) ) );
mSpecular = QgsSymbolLayerUtils::decodeColor( elem.attribute( QStringLiteral( "specular" ), QStringLiteral( "255,255,255" ) ) );
mAmbient = QgsColorUtils::colorFromString( elem.attribute( QStringLiteral( "ambient" ), QStringLiteral( "25,25,25" ) ) );
mDiffuse = QgsColorUtils::colorFromString( elem.attribute( QStringLiteral( "diffuse" ), QStringLiteral( "178,178,178" ) ) );
mSpecular = QgsColorUtils::colorFromString( elem.attribute( QStringLiteral( "specular" ), QStringLiteral( "255,255,255" ) ) );
mShininess = elem.attribute( QStringLiteral( "shininess" ) ).toFloat();
mOpacity = elem.attribute( QStringLiteral( "opacity" ), QStringLiteral( "1.0" ) ).toFloat();

Expand All @@ -90,9 +90,9 @@ void QgsPhongMaterialSettings::readXml( const QDomElement &elem, const QgsReadWr

void QgsPhongMaterialSettings::writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const
{
elem.setAttribute( QStringLiteral( "ambient" ), QgsSymbolLayerUtils::encodeColor( mAmbient ) );
elem.setAttribute( QStringLiteral( "diffuse" ), QgsSymbolLayerUtils::encodeColor( mDiffuse ) );
elem.setAttribute( QStringLiteral( "specular" ), QgsSymbolLayerUtils::encodeColor( mSpecular ) );
elem.setAttribute( QStringLiteral( "ambient" ), QgsColorUtils::colorToString( mAmbient ) );
elem.setAttribute( QStringLiteral( "diffuse" ), QgsColorUtils::colorToString( mDiffuse ) );
elem.setAttribute( QStringLiteral( "specular" ), QgsColorUtils::colorToString( mSpecular ) );
elem.setAttribute( QStringLiteral( "shininess" ), mShininess );
elem.setAttribute( QStringLiteral( "opacity" ), mOpacity );

Expand Down
10 changes: 5 additions & 5 deletions src/3d/materials/qgsphongtexturedmaterialsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

#include "qgsphongtexturedmaterialsettings.h"

#include "qgssymbollayerutils.h"
#include "qgsapplication.h"
#include "qgscolorutils.h"
#include "qgsimagecache.h"
#include "qgsimagetexture.h"
#include "qgsphongmaterialsettings.h"
Expand Down Expand Up @@ -69,8 +69,8 @@ float QgsPhongTexturedMaterialSettings::textureRotation() const

void QgsPhongTexturedMaterialSettings::readXml( const QDomElement &elem, const QgsReadWriteContext &context )
{
mAmbient = QgsSymbolLayerUtils::decodeColor( elem.attribute( QStringLiteral( "ambient" ), QStringLiteral( "25,25,25" ) ) );
mSpecular = QgsSymbolLayerUtils::decodeColor( elem.attribute( QStringLiteral( "specular" ), QStringLiteral( "255,255,255" ) ) );
mAmbient = QgsColorUtils::colorFromString( elem.attribute( QStringLiteral( "ambient" ), QStringLiteral( "25,25,25" ) ) );
mSpecular = QgsColorUtils::colorFromString( elem.attribute( QStringLiteral( "specular" ), QStringLiteral( "255,255,255" ) ) );
mShininess = elem.attribute( QStringLiteral( "shininess" ) ).toFloat();
mOpacity = elem.attribute( QStringLiteral( "opacity" ), QStringLiteral( "1.0" ) ).toFloat();
mDiffuseTexturePath = elem.attribute( QStringLiteral( "diffuse_texture_path" ), QString() );
Expand All @@ -82,8 +82,8 @@ void QgsPhongTexturedMaterialSettings::readXml( const QDomElement &elem, const Q

void QgsPhongTexturedMaterialSettings::writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const
{
elem.setAttribute( QStringLiteral( "ambient" ), QgsSymbolLayerUtils::encodeColor( mAmbient ) );
elem.setAttribute( QStringLiteral( "specular" ), QgsSymbolLayerUtils::encodeColor( mSpecular ) );
elem.setAttribute( QStringLiteral( "ambient" ), QgsColorUtils::colorToString( mAmbient ) );
elem.setAttribute( QStringLiteral( "specular" ), QgsColorUtils::colorToString( mSpecular ) );
elem.setAttribute( QStringLiteral( "shininess" ), mShininess );
elem.setAttribute( QStringLiteral( "opacity" ), mOpacity );
elem.setAttribute( QStringLiteral( "diffuse_texture_path" ), mDiffuseTexturePath );
Expand Down
7 changes: 4 additions & 3 deletions src/3d/materials/qgssimplelinematerialsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
***************************************************************************/

#include "qgssimplelinematerialsettings.h"
#include "qgssymbollayerutils.h"
#include "qgscolorutils.h"
#include "qgslinematerial_p.h"

#include <Qt3DRender/QTexture>
#include <Qt3DRender/QParameter>
#include <Qt3DRender/QEffect>
Expand Down Expand Up @@ -74,14 +75,14 @@ QgsSimpleLineMaterialSettings *QgsSimpleLineMaterialSettings::clone() const

void QgsSimpleLineMaterialSettings::readXml( const QDomElement &elem, const QgsReadWriteContext &context )
{
mAmbient = QgsSymbolLayerUtils::decodeColor( elem.attribute( QStringLiteral( "ambient" ), QStringLiteral( "25,25,25" ) ) );
mAmbient = QgsColorUtils::colorFromString( elem.attribute( QStringLiteral( "ambient" ), QStringLiteral( "25,25,25" ) ) );

QgsAbstractMaterialSettings::readXml( elem, context );
}

void QgsSimpleLineMaterialSettings::writeXml( QDomElement &elem, const QgsReadWriteContext &context ) const
{
elem.setAttribute( QStringLiteral( "ambient" ), QgsSymbolLayerUtils::encodeColor( mAmbient ) );
elem.setAttribute( QStringLiteral( "ambient" ), QgsColorUtils::colorToString( mAmbient ) );

QgsAbstractMaterialSettings::writeXml( elem, context );
}
Expand Down
10 changes: 5 additions & 5 deletions src/3d/qgs3dmapsettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "qgsprojectelevationproperties.h"
#include "qgsterrainprovider.h"
#include "qgslightsource.h"
#include "qgssymbollayerutils.h"
#include "qgscolorutils.h"
#include "qgsrasterlayer.h"
#include "qgspointlightsettings.h"
#include "qgsdirectionallightsettings.h"
Expand Down Expand Up @@ -159,8 +159,8 @@ void Qgs3DMapSettings::readXml( const QDomElement &elem, const QgsReadWriteConte
QDomElement elemColor = elem.firstChildElement( QStringLiteral( "color" ) );
if ( !elemColor.isNull() )
{
mBackgroundColor = QgsSymbolLayerUtils::decodeColor( elemColor.attribute( QStringLiteral( "background" ) ) );
mSelectionColor = QgsSymbolLayerUtils::decodeColor( elemColor.attribute( QStringLiteral( "selection" ) ) );
mBackgroundColor = QgsColorUtils::colorFromString( elemColor.attribute( QStringLiteral( "background" ) ) );
mSelectionColor = QgsColorUtils::colorFromString( elemColor.attribute( QStringLiteral( "selection" ) ) );
}

QDomElement elemCrs = elem.firstChildElement( QStringLiteral( "crs" ) );
Expand Down Expand Up @@ -349,8 +349,8 @@ QDomElement Qgs3DMapSettings::writeXml( QDomDocument &doc, const QgsReadWriteCon
elem.appendChild( elemCamera );

QDomElement elemColor = doc.createElement( QStringLiteral( "color" ) );
elemColor.setAttribute( QStringLiteral( "background" ), QgsSymbolLayerUtils::encodeColor( mBackgroundColor ) );
elemColor.setAttribute( QStringLiteral( "selection" ), QgsSymbolLayerUtils::encodeColor( mSelectionColor ) );
elemColor.setAttribute( QStringLiteral( "background" ), QgsColorUtils::colorToString( mBackgroundColor ) );
elemColor.setAttribute( QStringLiteral( "selection" ), QgsColorUtils::colorToString( mSelectionColor ) );
elem.appendChild( elemColor );

QDomElement elemCrs = doc.createElement( QStringLiteral( "crs" ) );
Expand Down
10 changes: 5 additions & 5 deletions src/3d/symbols/qgsmesh3dsymbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

#include "qgsmesh3dsymbol.h"
#include "qgs3dtypes.h"
#include "qgssymbollayerutils.h"
#include "qgs3dutils.h"
#include "qgscolorutils.h"
#include "qgsphongmaterialsettings.h"

QgsMesh3DSymbol::QgsMesh3DSymbol()
Expand Down Expand Up @@ -79,7 +79,7 @@ void QgsMesh3DSymbol::writeXml( QDomElement &elem, const QgsReadWriteContext &co
elemAdvancedSettings.setAttribute( QStringLiteral( "smoothed-triangle" ), mSmoothedTriangles ? QStringLiteral( "1" ) : QStringLiteral( "0" ) );
elemAdvancedSettings.setAttribute( QStringLiteral( "wireframe-enabled" ), mWireframeEnabled ? QStringLiteral( "1" ) : QStringLiteral( "0" ) );
elemAdvancedSettings.setAttribute( QStringLiteral( "wireframe-line-width" ), mWireframeLineWidth );
elemAdvancedSettings.setAttribute( QStringLiteral( "wireframe-line-color" ), QgsSymbolLayerUtils::encodeColor( mWireframeLineColor ) );
elemAdvancedSettings.setAttribute( QStringLiteral( "wireframe-line-color" ), QgsColorUtils::colorToString( mWireframeLineColor ) );
elemAdvancedSettings.setAttribute( QStringLiteral( "level-of-detail" ), mLevelOfDetailIndex );
elemAdvancedSettings.setAttribute( QStringLiteral( "vertical-scale" ), mVerticalScale );
elemAdvancedSettings.setAttribute( QStringLiteral( "vertical-group-index" ), mVerticalDatasetGroupIndex );
Expand All @@ -88,7 +88,7 @@ void QgsMesh3DSymbol::writeXml( QDomElement &elem, const QgsReadWriteContext &co
elemAdvancedSettings.appendChild( mColorRampShader.writeXml( doc, context ) );
elemAdvancedSettings.setAttribute( QStringLiteral( "min-color-ramp-shader" ), mColorRampShader.minimumValue() );
elemAdvancedSettings.setAttribute( QStringLiteral( "max-color-ramp-shader" ), mColorRampShader.maximumValue() );
elemAdvancedSettings.setAttribute( QStringLiteral( "texture-single-color" ), QgsSymbolLayerUtils::encodeColor( mSingleColor ) );
elemAdvancedSettings.setAttribute( QStringLiteral( "texture-single-color" ), QgsColorUtils::colorToString( mSingleColor ) );
elemAdvancedSettings.setAttribute( QStringLiteral( "arrows-enabled" ), mArrowsEnabled ? QStringLiteral( "1" ) : QStringLiteral( "0" ) );
elemAdvancedSettings.setAttribute( QStringLiteral( "arrows-spacing" ), mArrowsSpacing );
elemAdvancedSettings.setAttribute( QStringLiteral( "arrows-fixed-size" ), mArrowsFixedSize ? QStringLiteral( "1" ) : QStringLiteral( "0" ) );
Expand Down Expand Up @@ -117,7 +117,7 @@ void QgsMesh3DSymbol::readXml( const QDomElement &elem, const QgsReadWriteContex
mSmoothedTriangles = elemAdvancedSettings.attribute( QStringLiteral( "smoothed-triangle" ) ).toInt();
mWireframeEnabled = elemAdvancedSettings.attribute( QStringLiteral( "wireframe-enabled" ) ).toInt();
mWireframeLineWidth = elemAdvancedSettings.attribute( QStringLiteral( "wireframe-line-width" ) ).toDouble();
mWireframeLineColor = QgsSymbolLayerUtils::decodeColor( elemAdvancedSettings.attribute( QStringLiteral( "wireframe-line-color" ) ) );
mWireframeLineColor = QgsColorUtils::colorFromString( elemAdvancedSettings.attribute( QStringLiteral( "wireframe-line-color" ) ) );
mLevelOfDetailIndex = elemAdvancedSettings.attribute( QStringLiteral( "level-of-detail" ) ).toInt();
mVerticalScale = elemAdvancedSettings.attribute( "vertical-scale" ).toDouble();
mVerticalDatasetGroupIndex = elemAdvancedSettings.attribute( "vertical-group-index" ).toInt();
Expand All @@ -126,7 +126,7 @@ void QgsMesh3DSymbol::readXml( const QDomElement &elem, const QgsReadWriteContex
mColorRampShader.readXml( elemAdvancedSettings.firstChildElement( "colorrampshader" ), context );
mColorRampShader.setMinimumValue( elemAdvancedSettings.attribute( QStringLiteral( "min-color-ramp-shader" ) ).toDouble() );
mColorRampShader.setMaximumValue( elemAdvancedSettings.attribute( QStringLiteral( "max-color-ramp-shader" ) ).toDouble() );
mSingleColor = QgsSymbolLayerUtils::decodeColor( elemAdvancedSettings.attribute( QStringLiteral( "texture-single-color" ) ) );
mSingleColor = QgsColorUtils::colorFromString( elemAdvancedSettings.attribute( QStringLiteral( "texture-single-color" ) ) );
mArrowsEnabled = elemAdvancedSettings.attribute( QStringLiteral( "arrows-enabled" ) ).toInt();
if ( elemAdvancedSettings.hasAttribute( QStringLiteral( "arrows-spacing" ) ) )
mArrowsSpacing = elemAdvancedSettings.attribute( QStringLiteral( "arrows-spacing" ) ).toDouble();
Expand Down
10 changes: 5 additions & 5 deletions src/3d/symbols/qgspointcloud3dsymbol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@

#include "qgspointcloud3dsymbol.h"

#include "qgscolorutils.h"
#include "qgscolorramptexture.h"
#include "qgssymbollayerutils.h"

#include <Qt3DRender/QMaterial>
#include <Qt3DRender/QParameter>
Expand Down Expand Up @@ -149,7 +149,7 @@ void QgsSingleColorPointCloud3DSymbol::writeXml( QDomElement &elem, const QgsRea
Q_UNUSED( context )

writeBaseXml( elem, context );
elem.setAttribute( QStringLiteral( "single-color" ), QgsSymbolLayerUtils::encodeColor( mSingleColor ) );
elem.setAttribute( QStringLiteral( "single-color" ), QgsColorUtils::colorToString( mSingleColor ) );

}

Expand All @@ -158,7 +158,7 @@ void QgsSingleColorPointCloud3DSymbol::readXml( const QDomElement &elem, const Q
Q_UNUSED( context )

readBaseXml( elem, context );
mSingleColor = QgsSymbolLayerUtils::decodeColor( elem.attribute( QStringLiteral( "single-color" ), QStringLiteral( "0,0,255" ) ) );
mSingleColor = QgsColorUtils::colorFromString( elem.attribute( QStringLiteral( "single-color" ), QStringLiteral( "0,0,255" ) ) );
}

void QgsSingleColorPointCloud3DSymbol::setSingleColor( QColor color )
Expand Down Expand Up @@ -493,7 +493,7 @@ void QgsClassificationPointCloud3DSymbol::writeXml( QDomElement &elem, const Qgs
catElem.setAttribute( QStringLiteral( "value" ), QString::number( category.value() ) );
catElem.setAttribute( QStringLiteral( "pointSize" ), category.pointSize() );
catElem.setAttribute( QStringLiteral( "label" ), category.label() );
catElem.setAttribute( QStringLiteral( "color" ), QgsSymbolLayerUtils::encodeColor( category.color() ) );
catElem.setAttribute( QStringLiteral( "color" ), QgsColorUtils::colorToString( category.color() ) );
catElem.setAttribute( QStringLiteral( "render" ), category.renderState() ? "true" : "false" );
catsElem.appendChild( catElem );
}
Expand All @@ -520,7 +520,7 @@ void QgsClassificationPointCloud3DSymbol::readXml( const QDomElement &elem, cons
const double size = catElem.attribute( QStringLiteral( "pointSize" ), QStringLiteral( "0" ) ).toDouble();
const QString label = catElem.attribute( QStringLiteral( "label" ) );
const bool render = catElem.attribute( QStringLiteral( "render" ) ) != QLatin1String( "false" );
const QColor color = QgsSymbolLayerUtils::decodeColor( catElem.attribute( QStringLiteral( "color" ) ) );
const QColor color = QgsColorUtils::colorFromString( catElem.attribute( QStringLiteral( "color" ) ) );
mCategoriesList.append( QgsPointCloudCategory( value, color, label, render, size ) );
}
catElem = catElem.nextSiblingElement();
Expand Down
Loading

0 comments on commit 976ffd5

Please sign in to comment.