[QGIS-Developer] Rendering simple 3D lines

rnathreddy at sanasw.com rnathreddy at sanasw.com
Tue Sep 7 21:08:44 PDT 2021


Dear Nyall,

Thank you very much for your help. I was struggling from the past couple 
of days to resolve this issue.

As you said I missed out calling Qgs3D::Initialize () and 
Qgs3DAppUtils::initialize()  at the startup.

Now it is working.

Regards
Raghunath

On 2021-09-07 20:41, Nyall Dawson wrote:
> On Wed, 8 Sept 2021 at 13:27, <rnathreddy at sanasw.com> wrote:
>> 
>> Hi,
>> 
>> We are developing a simple 3D viewer to display the DEM and overlay a
>> trajectory (vector layer) as a simple 3d lines. It is working fine and
>> vector file is draped on to the terrain. We want to display the vector
>> file as simple 3d lines.
>> 
>> We could see the same in QGIS application by setting the Vector Layer
>> properties 3D View => Render as simple 3D lines.
>> 
>> Trying to set same programmatically, but getting the following error.
>> 
>>     " ..\..\..\src\3d\qgsvectorlayerchunkloader_p.cpp(57) :
>>       (QgsVectorLayerChunkLoader::QgsVectorLayerChunkLoader) [15960ms]
>> Unknown
>>           3D symbol type for vector layer: line  "
> 
> Possibly you are missing a call to Qgs3D::initialize() somewhere in
> your application startup.
> 
> Nyall
> 
>> 
>> The following code snippet used:
>> 
>> if (pcLyr != nullptr) {
>> 
>>    std::unique_ptr< QgsLine3DSymbol > sym = qgis::make_unique<
>> QgsLine3DSymbol >();
>>    std::unique_ptr< QgsPhongMaterialSettings > mCurrentSettings;
>> 
>>    mCurrentSettings = qgis::make_unique< QgsPhongMaterialSettings >();
>> 
>>    sym->setWidth (1);
>>    sym->setHeight (0);
>>    sym->setExtrusionHeight(0);
>>    sym->setAltitudeClamping(Qgs3DTypes::AltClampAbsolute);
>>    sym->setAltitudeBinding(Qgs3DTypes::AltBindVertex);
>>    sym->setRenderAsSimpleLines(true);
>>    sym->setMaterial(mCurrentSettings->clone());
>> 
>>    QgsVectorLayer3DRenderer *pcR = new QgsVectorLayer3DRenderer
>> (sym->clone());
>>    pcLyr->setRenderer3D(pcR);
>> }
>> 
>> 
>> Can any one help us in this regard?
>> 
>> Regards
>> Raghunath
>> _______________________________________________
>> QGIS-Developer mailing list
>> QGIS-Developer at lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


More information about the QGIS-Developer mailing list