[QGIS-Developer] Rendering simple 3D lines

rnathreddy at sanasw.com rnathreddy at sanasw.com
Tue Sep 7 20:18:23 PDT 2021


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  "

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


More information about the QGIS-Developer mailing list