Skip to content

Commit

Permalink
fix some bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
NEDJIMAbelgacem authored and wonder-sk committed Dec 3, 2020
1 parent 6204d6b commit dca58b4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 12 deletions.
7 changes: 3 additions & 4 deletions src/3d/qgspointcloudlayerchunkloader_p.cpp
Expand Up @@ -178,11 +178,11 @@ void QgsPointCloud3DSymbolHandler::processNode( QgsPointCloudIndex *pc, const In
QVector3D point( x, y, z );
QgsVector3D p = context.map().mapToWorldCoordinates( point );
outNormal.positions.push_back( QVector3D( p.x(), p.y(), p.z() ) );
if ( parameterAttribute->name() == "X" )
if ( parameterAttribute && parameterAttribute->name() == "X" )
outNormal.parameter.push_back( x );
if ( parameterAttribute->name() == "Y" )
if ( parameterAttribute && parameterAttribute->name() == "Y" )
outNormal.parameter.push_back( y );
if ( parameterAttribute->name() == "Z" )
if ( parameterAttribute && parameterAttribute->name() == "Z" )
outNormal.parameter.push_back( z );
else
outNormal.parameter.push_back( iParam );
Expand Down Expand Up @@ -293,7 +293,6 @@ Qt3DRender::QMaterial *QgsPointCloud3DSymbolHandler::constructMaterial( QgsSingl
Qt3DRender::QParameter *pointSizeParameter = new Qt3DRender::QParameter( "u_pointSize", QVariant::fromValue( symbol->pointSize() ) );
mat->addParameter( pointSizeParameter );
QColor singleColor = symbol->singleColor();
qDebug() << "color: " << singleColor.redF() << " " << singleColor.greenF() << " " << singleColor.blueF();
Qt3DRender::QParameter *singleColorParameter = new Qt3DRender::QParameter( "u_singleColor", QVector3D( singleColor.redF(), singleColor.greenF(), singleColor.blueF() ) );
mat->addParameter( singleColorParameter );
return mat;
Expand Down
9 changes: 3 additions & 6 deletions src/3d/symbols/qgspointcloud3dsymbol.cpp
Expand Up @@ -41,7 +41,6 @@ QgsNoRenderingPointCloud3DSymbol::QgsNoRenderingPointCloud3DSymbol( QgsPointClou
QgsAbstract3DSymbol *QgsNoRenderingPointCloud3DSymbol::clone() const
{
QgsNoRenderingPointCloud3DSymbol *result = new QgsNoRenderingPointCloud3DSymbol( mLayer );
result->mRenderingStyle = mRenderingStyle;
copyBaseSettings( result );
return result;
}
Expand Down Expand Up @@ -70,7 +69,6 @@ QgsAbstract3DSymbol *QgsSingleColorPointCloud3DSymbol::clone() const
{
QgsSingleColorPointCloud3DSymbol *result = new QgsSingleColorPointCloud3DSymbol( mLayer );
result->mPointSize = mPointSize;
result->mRenderingStyle = mRenderingStyle;
result->mSingleColor = mSingleColor;
copyBaseSettings( result );
return result;
Expand All @@ -92,7 +90,7 @@ void QgsSingleColorPointCloud3DSymbol::readXml( const QDomElement &elem, const Q
Q_UNUSED( context )

mPointSize = elem.attribute( "point-size", QStringLiteral( "2.0" ) ).toFloat();
mRenderingStyle = static_cast< QgsPointCloud3DSymbol::RenderingStyle >( elem.attribute( "rendering-style", QStringLiteral( "0" ) ).toInt() );
mRenderingStyle = static_cast< QgsPointCloud3DSymbol::RenderingStyle >( elem.attribute( "rendering-style", QStringLiteral( "1" ) ).toInt() );
mSingleColor.setRedF( elem.attribute( "single-color-red", QStringLiteral( "0.0" ) ).toFloat() );
mSingleColor.setGreenF( elem.attribute( "single-color-green", QStringLiteral( "0.0" ) ).toFloat() );
mSingleColor.setBlueF( elem.attribute( "single-color-blue", QStringLiteral( "1.0" ) ).toFloat() );
Expand Down Expand Up @@ -120,7 +118,6 @@ QgsAbstract3DSymbol *QgsColorRampPointCloud3DSymbol::clone() const
{
QgsColorRampPointCloud3DSymbol *result = new QgsColorRampPointCloud3DSymbol( mLayer );
result->mPointSize = mPointSize;
result->mRenderingStyle = mRenderingStyle;
result->mRenderingParameter = mRenderingParameter;
result->mColorRampShader = mColorRampShader;
result->mColorRampShaderMin = mColorRampShaderMin;
Expand Down Expand Up @@ -148,8 +145,8 @@ void QgsColorRampPointCloud3DSymbol::readXml( const QDomElement &elem, const Qgs
Q_UNUSED( context )

mPointSize = elem.attribute( "point-size", QStringLiteral( "2.0" ) ).toFloat();
mRenderingStyle = static_cast< QgsPointCloud3DSymbol::RenderingStyle >( elem.attribute( "rendering-style", QStringLiteral( "0" ) ).toInt() );
mRenderingParameter = elem.attribute( "rendering-parameter", QStringLiteral( "0" ) );
mRenderingStyle = static_cast< QgsPointCloud3DSymbol::RenderingStyle >( elem.attribute( "rendering-style", QStringLiteral( "2" ) ).toInt() );
mRenderingParameter = elem.attribute( "rendering-parameter", QStringLiteral( "" ) );
mColorRampShaderMin = elem.attribute( QStringLiteral( "color-ramp-shader-min" ), QStringLiteral( "0.0" ) ).toDouble();
mColorRampShaderMax = elem.attribute( QStringLiteral( "color-ramp-shader-max" ), QStringLiteral( "1.0" ) ).toDouble();
mColorRampShader.readXml( elem );
Expand Down
4 changes: 2 additions & 2 deletions src/ui/3d/qgspointcloud3dsymbolwidget.ui
Expand Up @@ -102,7 +102,7 @@
</property>
</widget>
</item>
<item row="0" column="0" rowspan="2" colspan="2">
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>Single Color</string>
Expand Down Expand Up @@ -161,7 +161,7 @@
<item row="1" column="4">
<widget class="QPushButton" name="mColorRampShaderMinMaxReloadButton">
<property name="text">
<string>reload</string>
<string>Apply</string>
</property>
</widget>
</item>
Expand Down

0 comments on commit dca58b4

Please sign in to comment.