How to extend the user interface

From Endrov

This section describes the specifics of extending the user interface. If you want to know how to put it in a plugin, see How to make plugins.



Endrov uses Swing for windows, buttons, etc. You should read up on it a bit before attempting to extend Endrov.

Swing guidelines

  • Always use layout managers. EvSwingUtils provides some convenient functions
  • Never assume the size of any components (see above)
  • Minimum screen resolution is 640x480, optimize for about 1024x768
  • Separate GUI code from algorithms, but not to the extent that we get more code to maintain
  • Never change the standard color of a component unless it serves a function
  • Always add a tooltip

We might switch to another GUI library in the future, Qt in particular. This depends on if the move to LGPL will increase its acceptance.

Creating new windows

All new windows should extend BasicWindow. See the source code for up to date documentation.

Extending the 2D viewer

  • Implement ImageWindowExtension which registers
  • an ImageWindowRenderer if you want to draw overlay,
  • an ImageWindowTool if you want to capture input

See the source code for up to date documentation. Read the source for the simplest tools.

Extending the 3D viewer

Endrov uses OpenGL to render 3D graphics. The messy parts (moving the camera around, setting up the display) are all done, you just need to provide the commands to add the polygons. A very out of date but freely available guide is available, The red book.

To extend the model window, create a new class implementing ModelWindowExtension. This class should register a ModelWindowHook. The source code is the most up to date documentation. Read the source for the simplest extensions.

If you write new rendering code, try to stay close to the OpenGL 3.1 standard as at some point we should upgrade. In particular, do not use display lists; if you need speed, use vertex buffers. Don't use transforms more than you need.