I have two images and plot them as surfaces. I am zooming on one image by drawing a zoom rectangle, using the built-in functionality of ILPlotCube. How can I apply the resulting zoom settings to the second image programmaticall, i.e.: without drawing a zoom rectangle with the mouse?
The goal is to synchronize the zoom settings between both images. Is this possible?
The zoom rectangle which is dragged by the user with the mouse on a plot cube in 2D mode controls the ILPlotCube.Limits
settings. The same result can be achieved programmatically:
Vector3 min = new Vector3(minX, minY, minZ);
Vector3 max = new Vector3(maxX, maxY, maxZ);
// fetch the plot cube and set its limits (see below)
var plotCube = panel1.SceneSynchRoot.First<ILPlotCube>();
plotCube.Limits.Set(minX, maxX);
You may also want to consider the info provided on scene management: If you set the limits on the global scene, it will affect all scenes, regardless of the driver used to render the scene. Consider using panel.SceneSynchRoot
of the panel in order to find the plot cube which is used for rendering and set the limits here. Again, this will have the same effect as setting the zoom rectangle with the mouse - which does also alter the plot cube limits of the individual synchronized scene (individually for each driver) but does not alter the global scene.
If you want to track the modifications due to mouse interaction you can use mouse events on the plot cube and read the current limits before applying them to the new image:
Vector3 min, max;
plotcube.MouseUp += (_s,_a) => {
if (_a.DirectionUp) {
var plotCube = ilPanel1.SceneSynchRoot.First<ILPlotCube>();
// keep current limits for later use (here we store them in the class context only)
min = plotCube.Limits.Min;
max = plotCube.Limits.Max;
// ...
}
}
See also:
APIDOC class reference on the Limits.Set
method,