1

I'm using an ILPlotcube with line- and point-plots inside a windows forms window. Somehow the mouse control of the PlotCube, like zooming and dragging does not work anymore. For example: i can't zoom into the plot by drawing a rectangle over the region i want to see. The mouse doesn't seem to be recognized anymore.

Basically the code looks like this:

public void init() {
    Thread backgroundThread = new Thread(
        new ThreadStart(() =>
        {
            makePlot();
        }));
    backgroundThread.Start();
}

makePlot() looks like this:

public void makePlot()
{
   ILPlotCube plotCube = _ilPanel.Scene.First<ILPlotCube>();

   if (plotCube == null) {

      plotCube = new ILPlotCube {
         new ILLinePlot(tosingle(_data1), "plot1", lineColor: Color.Blue),
         new ILLinePlot(tosingle(_data2), "plot2", lineColor: Color.Red),
         new ILLegend("data1","data2")
       };
       _ilPanel.Scene = new ILScene { plotCube };
   }
   else
   { 
      plotCube.First<ILLinePlot>(tag: "plot1").Line.Positions.Update(tosingle(_data1);
      plotCube.First<ILLinePlot>(tag: "plot2").Line.Positions.Update(tosingle(_data2);
   }

   _ilPanel.Scene.Configure();

   _ilPanel.Invoke((MethodInvoker)delegate { _ilPanel.Refresh(); });
}

I call init() in Form1_Load() not in ilPanel1_Load()

Actually there is an other thing. The Class Reference says ILLinePlot has a Method "Update" to update the positions of the plotted line. But Visual Studio tells me ILLinePlot doesn't have such a member Function. Instead i'm using

   linePlot.Line.Positions.Update  

Also if i don't call Configure() on the Scene Element it won't plot the legend but if i do, the whole Plotting takes much more time.

Robert
  • 101
  • 7
  • Sounds like it was working and suddenly stops? Are you able to reproduce with a simple example? Which versions are you using? – user492238 Nov 14 '14 at 09:27
  • yes it was working before and it is working in a separate windows forms example i created.i now found out that it works when i exactly click on the plotted graph but not when i click in the white area. my ilnumerics version is 3.3.3.0. – Robert Nov 14 '14 at 09:51
  • i have an ilpanel in some nested tablelayout containers created by visual studio designer. my guess is that somewhere mouse events are not passed along properly anymore. maybe some element property got set to a wrong value somewhere? – Robert Nov 14 '14 at 09:58
  • Hm. there has been an important detail missing in your first question (before the edit): the fact that you set up your scene in a background thread. But it is supposed to work, nevertheless. Please provide a complete runnable class example and we will look into it. – Haymo Kutschbach Nov 18 '14 at 18:30
  • You should switch to 4.3 to get the latest API. ILLinePlot.Update is not available in the old 3.3. version. – Haymo Kutschbach Nov 18 '14 at 18:31
  • I didn't know there is a newer version. I installed via NuGet which has only version 3.3.3. I thought ilnumerics is open source and the nuget-version is the same as the payed one only without the better visual studio integration and support. Since i'm student and just writing code for my master thesis i cannot afford to buy the commercial version of ilnumerics. – Robert Nov 19 '14 at 09:19
  • Okay i found ilnumerics changelog. Seems like ilnumerics didn't continue the community edition after version 3.3.3.0. Wikipedia thou says they are working on a major update since 2011 which will be published under an open source licence. I wonder if the ilnumerics source on sourceforge corresponds to version 3.3.3.0 or an earlier version. – Robert Nov 19 '14 at 13:59

2 Answers2

0

I got it to work after i switched

ilpanel.Scene = new ILScene { plotCube }

to

ilpanel.Scene.Add( plotCube )
Robert
  • 101
  • 7
0

It is hard to guess without some code. But I suppose there are multiple plot cubes in your scene. And they probably use the same screen area (probably the whole panel area?). Mouse events will fire on the topmost camera object or one of its children, if configured that way. Possibly the plot cube lays "behind" some other camera object which catches all the events. You can find out by registering an event handler on the root node and print out all mouse down events:

ilPanel1.Scene.MouseDown += (_s, _e) => { Debug.WriteLine(_e.Target); };

This will give the node below the mouse which was selected as target for the mouse event during the mouse down action. In order for the (correct) plotcube to properly receive the mouse events for zoom / rotate/ pan operations there should be either the plotcube node (plotcube derives from ILCamera) or one of its children found as target.

Another easy way to inspect the scene and detect all camera nodes contained is to create a breakpoint at the very end of your setup method (mostly this will be ilPanel1_Load(..). Once you stopped in the debugger, execute the following code in the Immediate window:

ilPanel1.Scene.Find<ILCamera>()

Count = 2
[0]: "Camera: #2 - Polar r:10 φ:0° ρ:0° - Pos X:0 Y:0 Z:10 - Lookat X:0 Y:0 Z:0 - Top X:0 Y:1 Z:0"
[1]: "ILPlotCube #30 'PlotCube' Children:[2]"

How many plot cubes do you count?

Haymo Kutschbach
  • 3,322
  • 1
  • 17
  • 25