Вопрос

i am a Student and just startet programming and try out ILNumerics. Here is my question: How can i refresh or replot a IlPanal after changing colormap or userdata? I want to refresh the Surfacegraph by clicking on a button. I guess the answer is very easy, but i tried a lot the last two days... i'm a noob ;)

For example:

 private void ilPanel_3D_Load(object sender, EventArgs e)
        {
            var scene = new ILScene();
            var pc = scene.Add(new ILPlotCube(twoDMode: false));
            var sf = pc.Add(new ILSurface(Z));
            ilPanel_3D.Scene = scene;
        }

 private void button1_Click(object sender, EventArgs e)
        {
           // dont know what to put in here...
        }

thanks

Это было полезно?

Решение

For such interactive actions you will have to access the 'synchronized copy' which every driver internally maintains of the global scene. Since a scene may get displayed by many drivers at the same time, this internal copy only reflects all changes due to user interaction / modifications.

private void button1_Click(object sender, EventArgs e) {
    ilPanel_3D.GetCurrentScene().First<ILSurface>().Colormap = Colormaps.Summer;
    ilPanel_3D.Refresh(); 
}

PS: no need to wait for two days the next time ... ! ;)

@Edit2: Actually, the update works just fine on the global scene also. But in order to broadcast the change to the ilPanel1 driver, you will have to add a call to Configure() at the end of your modifications. Configure can be called once for all changed nodes on one of their common parent nodes. So, you might simply call Configure() on the scene:

private void button1_Click(object sender, EventArgs e) {
    ilPanel_3D.Scene.First<ILSurface>().Colormap = Colormaps.Summer;
    ilPanel_3D.Scene.Configure();
    ilPanel_3D.Refresh(); 
}
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top