How to SetRenderer on VoxelLayer.SelectedVariableProfile

177
0
07-05-2021 02:55 PM
TomLiu
by
New Contributor II

Hello,

I am trying to set renderer for voxel layer with the code below, but for some reason it's not working. It seems that before and after I call "SetRenderer" onSelectedVariableProfile, the "Renderer" property is always null. Not sure why the "Renderer" property of voxel layer can't be set. Could you please advise? Thanks.

await FrameworkAbstracter.QueuedTaskRunner.Run(async () =>
{

var map = MapFactory.Instance.CreateMap(Utilities.Constants.MAP_NAME_VOXEL, MapType.Scene, MapViewingMode.SceneLocal);
var voxelLayer = LayerFactory.Instance.CreateLayer<VoxelLayer>(createParams, map);
var mapPane = await ProApp.Panes.CreateMapPaneAsync(map);
if (voxelLayer.SelectedVariableProfile != null && voxelLayer.SelectedVariableProfile.DataType == VoxelVariableDataType.Discrete)
{
CIMVoxelUniqueValueRenderer renderer = new CIMVoxelUniqueValueRenderer();
renderer.Classes = GetRendererClasses()
voxelLayer.SelectedVariableProfile.SetRenderer(renderer);
}
})

The GetRendererClasses() returns an array of CIMVoxelColorUniqueValue.

Thanks very much.

0 Kudos
0 Replies