I want to use a colorbar with custom objects. The objects are colored according to a specific colormap. I want to show this colormap in a colorbar at runtime.
I already tried adding it to scene by:
ILColorbar cb = new ILColorbar();
scene.Add(cb);
or to the cube:
plotCube.Add(cb);
or even plotCube.Children.Add(cb);
but it still doesn't work. What is the correct way to display a colorbar for custom objects?
Here is my code:
private void OKInputBodyListButton_Click(object sender, EventArgs e)
{
try
{
var sceneBody = new ILScene();
var plotCubeBody = sceneBody.Add(new ILPlotCube(twoDMode: false));
foreach (BlockBody item in ObjectList)
{
createBlockBody(item, sceneBody, plotCubeBody);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void createBlockBody(BlockBody BlockBody, ILScene scene, ILPlotCube plotCube)
{
var box = new ILTriangles("tri")
{
...
...
}
plotCube.Add(box);
var colormap = new ILColormap(Colormaps.Jet);
Vector4 key1 = colormap.Map((float)BlockBody.Rho, new Tuple<float, float>(-1, 1));
var test = key1.ToColor();
box.Color = test;
SliceilPanel.Scene = scene;
SliceilPanel.Refresh();
}
And this are my figures: