Presentation Layer

Updated on July 15, 2009 by KeiOno

Still under construction!

Introduction

Presentation layer is the set of actual classes which draws network graphics. From 3.0, Cytoscpae can have multiple presentation per view. This means multiple rendering engines can co-exist in an instance of Cytoscape.

Design

Definitions

Data Model

View Model

Presentation

API

There are 3 interfaces in Presentation API bundle:

   1 public interface PresentationFactory {
   2         /*
   3          * A presentation can contain multiple view models.
   4          * This enable developers to render multiple View Models in the same display.
   5          * For example, if View<CyNetwork> with View<Decoration> as child is passed to this, 
   6          * both of them will be rendered in a window, using same rendering engine.
   7          */
   8         public RenderingEngine addPresentation(Container container, View<?> viewModel);
   9 }
  10 

   1 public interface VisualItemRenderer<T extends View<?>> {
   2         /**
   3          * Provide a set of Visual Properties this renderer can visualize.
   4          *
   5          * @return Set of VP as a VisualLexicon
   6          */
   7         public VisualLexicon getVisualLexicon();
   8 }
   9 

   1 public interface RenderingEngine {
   2         
   3         /**
   4          * Returns backend View Models for this presentation.
   5          * 
   6          * @return view models.
   7          */
   8         public List<View<?>> getRootViewModel();
   9         
  10 
  11         /**
  12          * Rendering engine dependent properties, like LOD
  13          */
  14         public void setProperties(Properties props);
  15         public Properties getProperties();
  16 
  17         /**
  18          * For export image function.
  19          * 
  20          * @return DOCUMENT ME!
  21          */
  22         public Printable getPrintable();
  23 
  24         /**
  25          * Render image from the current view model state.
  26          * 
  27          * @return Image object created from current window.
  28          */
  29         public Image getImage(int width, int height);
  30 
  31         /**
  32          * For a given Visual Property, render an Icon based on the default value of
  33          * the Visual Property.
  34          * 
  35          * @param vp
  36          *            Visual Property.
  37          * 
  38          * @return DOCUMENT ME!
  39          * 
  40          * @exception IllegalArgumentException
  41          *                if vp is not in the lexicon.
  42          */
  43         public Icon getDefaultIcon(VisualProperty<?> vp);
  44 }
  45 

Discussion

Our overall design (model-view-presentation) does not completely equivalent to typical scene graph used in many 3D visualizers. This design is inspired by Prefuse Visualization Toolkit. The rendering engine object can take any type of Views, but usually it takes Networks or data tables. For each View, render the object using proper VisualItemRenderer. VisualItemRenderer provides a Visual Lexicon, which is a set of Visual Properties that can be recognized by this rendering engine's drawing classes.

A presentation can be created from multiple view models. This makes renderer more flexible because the engine can render network(s) and other data objects (like decoration network) in the same canvas.

We need to add hierarchy to View Model to support views on a canvas:

   1 public class View<T> {
   2   public Collection<View<?>> getChildren();
   3   public boolean isLeaf();
   4 }
   5 

Then, rendering engine can traverse this View Model Tree to draw all underlaying Views.

Relationship between Presentation Layer and Other Modules

VizMap

Outdated_Cytoscape_3.0/PresentationDiscussions (last edited 2011-02-24 15:32:17 by PietMolenaar)

Funding for Cytoscape is provided by a federal grant from the U.S. National Institute of General Medical Sciences (NIGMS) of the Na tional Institutes of Health (NIH) under award number GM070743-01. Corporate funding is provided through a contract from Unilever PLC.

MoinMoin Appliance - Powered by TurnKey Linux