Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28455 Discussions

Array Viewer AvPage Usage and Requests

beaupaisley
Beginner
296 Views
0 Kudos
3 Replies
Intel_C_Intel
Employee
296 Views
Thanks for the suggestions!

For those who aren't familiar with how AvPage objects work, they are simply containers for HTML + Script code that can be used to display custom views in the Array Viewer. An example of a file containing an AvPage is /Data/HDF5/SineCompute.h5. The AvPage object in this file displays a graph along with some UI elements that allow the graph data to be dynamically recomputed.

I think most AV users aren't creating AvPage objects because of the problems that Beau has noted. Another issue is that you have to be a fairly knowledgeable about the AV object model, VBScript or JavaScript, and HTML to develop new AvPage codes. And once you have developed the AvPage, there's no real mechanism for re-use of the code (beyond copy and paste).

For IVF 8.1, there are some AV enhancements that should make it easier to create pages. Under the AV install folder, there will be a Templates folder that contains html files that can serve as the basis for various AvPage constructs. For example, slicer.htm can be used to create a "slice&dice" page where a 3d dataset can be viewed from orthogonal sections.

Complementing the Page templates, is a Macro facility in the viewer. Macros contain script code that can be used to load and customize a page template.

The number of macros & templates will be limited in the IVF 8.1 release, but I'm hoping to increase the number over time. Since they exist as external files, I'm hoping that AV users can share interesting macros/templates as well.

It would be useful to develop a facility where macros can be contained within the data file as well, but this will have to be a post-8.1 feature. One thing you could do today is just store the macro in an AvPage object. Then other pages within the file would be able to access the macro code. The only problem would be if the user clicked on the AvPage containing the macro it wouldn't be a valid HTML file.

John
0 Kudos
beaupaisley
Beginner
296 Views
John,
Thank you for the followup.
In your last paragraph you say that one AvPage can reference a script function that exists in a separate page. This would be organizationally, (code modularization), helpful but it is unclear to me how this works. Could you please post a brief example that illustrates this capability.
Beau
0 Kudos
Intel_C_Intel
Employee
296 Views
I've attached an AV XML file that illustartes what I'm talking about. If you open this in the Viewer you'll see two pages. "Add Script" contains the text: "function Add(x, y) { return x+y; }". The page "Calculator" contains two edit boxes and a "Calculate" button.
When the Calculator page is loaded, script code on the page gets the Add function from the Add Script page and calls eval(). This enables code in the page to call Add() just as if the function was defined in the page itself.
Code:
// Get the text of the "Add Script" page.
var oRoot = window.external.Root;
var oPage = oRoot.Pages.Item("Add Script");
var szAddFunction = oPage.Text;

// evaluate the add function.
eval(szAddFunction);
When the calculate button is pressed the following code calls the Add function to compute the result:
Code:
function OnClick()
{
   var x = new Number(Addend1.value);
   var y = new Number(Addend2.value);
   
   sum = Add(x, y);
   
   result.innerText = sum;
}

John
0 Kudos
Reply