Difference between revisions of "Writing Custom Applications"

From KitwarePublic
Jump to: navigation, search
(How to write radically different applications based on ParaView?)
Line 39: Line 39:
 
</source>
 
</source>
  
 
+
This is similar to what one would do to create a Qt based application except that in addition to creating the QApplication, we are creating pqApplicationCore (or it's subclass). pqApplicationCore ensures that ParaView server-manager is initialized correctly. The CMakeLists.txt file for such an application would be pretty much standard with an ADD_EXECUTABLE for creating an executable with proper target dependencies.
  
 
=Acknowledgements=
 
=Acknowledgements=
 
This effort has been funded by EDF and Sandia National Labs.
 
This effort has been funded by EDF and Sandia National Labs.

Revision as of 10:48, 30 November 2009

Motivation

This document describes how to create Qt-based custom visualization applications using ParaView's Parallel Visualization framework.

Applications based on ParaView have grown since the release of ParaView 3.0. In spite of best of our intentions we soon realized that it was not very easy to create applications that use ParaView core without subscribing to an user interface identical to ParaView's. The infamous pqMainWindowCore ended up being copy-pasted for every application and then tweaked and modified breaking every possible rule for good programming practices. Also it was hard to create domain specific ParaView-clones with limited user interface components, since various components have cross dependencies among each other and it becomes hard to ensure that all signals/slots are connected correctly for them to work.

To address these issues, we re-structured the application layer in Paraview. The main goals we set out to address are:

  • Facilitate creation of applications radically different from ParaView, with totally different workflows.
  • Facilitate creation of ParaView-variants that use most of ParaView functionality with minor behavioral or user-interface changes.

All such custom applications created using this framework will be referred to as ParaView-brands in this document.

Do I need a Custom App, or merely a Plugin?

When adding functionality to ParaView eg. filters, panels, menus, views etc. without changing the application level behavior of ParaView, plugins are the easiest. Note that plugins are only "additive" i.e. you can add functionality to ParaView using plugins, never remove or qualify existing behavior i.e you cannot change what happens when user clicks "File-Open" in ParaView using plugins, however, you can add support for a new reader that becomes available for the user in the File-Open dialog.

If what you need is change the way ParaView as an application works, i.e. totally customize the menus, get rid of the pipeline browser, change the pipeline centric user interface etc., then you should look into creating a custom application. Of course, custom applications can use plugins to add new features required by them.

Where are the examples?

ParaView application itself serves as an example of this framework. Look under ParaViewSourceDir/Applications/ParaView. Additional examples are available under ParaViewSourceDir/CustomApplications

How to write radically different applications based on ParaView?

Let's consider the simplest case first, we want to write an appliaction that's totally different in work flow than ParaView i.e. we want maximum customization. Here's how such an applications main.cxx might look:

  #include <QApplication>
  #include "pqApplicationCore.h"
  #include "myCustomMainWindow.h"
 
  int main(int argc, char** argc)
  {
   QApplication app(argc, argv);
   pqApplicationCore appCore(argc, argv);
   myCustomMainWindow window;
   window.show();
   return app.exec();
  }

This is similar to what one would do to create a Qt based application except that in addition to creating the QApplication, we are creating pqApplicationCore (or it's subclass). pqApplicationCore ensures that ParaView server-manager is initialized correctly. The CMakeLists.txt file for such an application would be pretty much standard with an ADD_EXECUTABLE for creating an executable with proper target dependencies.

Acknowledgements

This effort has been funded by EDF and Sandia National Labs.