gui
Class Canvas

java.lang.Object
  extended by GLCanvas
      extended by gui.Canvas

public class Canvas
extends GLCanvas

A canvas is used to draw the objects in a map and handlers the translation between virtual and screen coordinates.


Nested Class Summary
(package private)  class Canvas.CallBack
          Callback class for polygon tesselation.
 
Field Summary
private  boolean distanceRelationsVisible
          specifies if distance relations should be drawn
(package private)  GLU glu
           
(package private)  GLUT glut
           
private  Grid grid
          the gird
private  InteractionHandler interactionHandler
          the interaction handler
private  java.awt.geom.AffineTransform inverseTransform
          the transform for screen to virtual coordinates
private  Map map
          the map to display
private  MessageBar messageBar
          the message bar
private  boolean orientationRelationsVisible
          specifies if orientation relations should be drawn
(package private)  GLUquadric quadratic
           
private  double rotation
          the rotation of the map
private  double scale
          the scale of the map
private  boolean showAbstractions
          specifies if abstract objects should be displayed
private  boolean showObjects
          specifies if constructed objects should be displayed
private  java.awt.Dimension size
          the current size of the panel
(package private)  Canvas.CallBack tessCallback
           
(package private)  GLUtessellator tobj
           
private  boolean topologyRelationsVisible
          specifies if topology relations should be drawn
private  java.awt.geom.AffineTransform transform
          the transform for virtual to screen coordinates
private  double translationX
          the x translation of the map
private  double translationY
          the y translation of the map
 
Constructor Summary
Canvas(int width, int height)
          Constructs a canvas object.
 
Method Summary
private  void buildTransforms()
          Rebuilds the view transform and the inverse view transforms.
 void display(GLAutoDrawable drawable)
          Displays the map.
 void displayChanged(GLAutoDrawable arg0, boolean arg1, boolean arg2)
          Not implemented.
 void drawObject(GL gl, OntologyObject object)
          Draws an ontology object.
 void drawText(GL gl, java.lang.String text, double x, double y, float size, float width)
          Utility function for drawing text
 boolean getAbstractionsVisible()
          Gets if abstract objects are visible.
 boolean getDistanceRelationsVisible()
          Sets if distance relations are visible.
 Grid getGrid()
          Gets the grid.
 Map getMap()
          Gets the map.
 MessageBar getMessageBar()
          Gets the message bar.
 boolean getObjectsVisible()
          Gets if constructed objects are visible.
 boolean getOrientationRelationsVisible()
          Sets if orientation relations are visible.
 OntologyObject getPickedObject(double x, double y, boolean toggleSelected)
          Returns the object at the specified virtual coordiantes or null if no object is located at the specified coordinates.
 GLUquadric getQuadratic()
          Gets the quadratic object used for drawing circles.
 double getRotation()
          Gets the rotation.
 double getScale()
          Gets the scale scale.
 java.awt.geom.Point2D getScreenCoordinates(double x, double y)
          Converts virtual coordinates to screen coordinates.
 boolean getTopologyRelationsVisible()
          Sets if topology relations are visible.
 java.awt.geom.AffineTransform getTransform()
          Gets the view transform.
 double getTranslationX()
          Gets the tranlation in the x direction.
 double getTranslationY()
          Gets the tranlation in the y direction.
 java.awt.geom.Point2D getVirtualCoordinates(double x, double y)
          Converts screen coordinates to virtual coordinates.
 void init(GLAutoDrawable drawable)
          Initializes JOGL parameters.
 void reshape(GLAutoDrawable drawable, int x, int y, int width, int height)
          Updates the viewport when the window is resized.
 void setAbstractionsVisible(boolean visible)
          Sets if abstract objects are visible.
 void setDistanceRelationsVisible(boolean visible)
          Sets if distance relations are visible.
 void setInteractionHandler(InteractionHandler handler)
          Sets the interaction handler.
 void setMap(Map map)
          Sets the map to display and resets the view transform.
 void setObjectsVisible(boolean visible)
          Sets if constructed objects are visible.
 void setOrientationRelationsVisible(boolean visible)
          Sets if orientation relations are visible.
 void setRotation(double rotation)
          Sets the rotation and rebuilds the affine transforms.
 void setScale(double scale)
          Sets the scale and rebuilds the affine transforms.
 void setTopologyRelationsVisible(boolean visible)
          Sets if topology relations are visible.
 void setTranslationX(double translationX)
          Sets the translation in the x direction and rebuilds the transforms.
 void setTranslationY(double translationY)
          Sets the translation in the y direction and rebuilds the transforms.
 void zoomAll()
          Zooms to the boundries of the current map.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

distanceRelationsVisible

private boolean distanceRelationsVisible
specifies if distance relations should be drawn


orientationRelationsVisible

private boolean orientationRelationsVisible
specifies if orientation relations should be drawn


topologyRelationsVisible

private boolean topologyRelationsVisible
specifies if topology relations should be drawn


showObjects

private boolean showObjects
specifies if constructed objects should be displayed


showAbstractions

private boolean showAbstractions
specifies if abstract objects should be displayed


map

private Map map
the map to display


translationX

private double translationX
the x translation of the map


translationY

private double translationY
the y translation of the map


scale

private double scale
the scale of the map


rotation

private double rotation
the rotation of the map


interactionHandler

private InteractionHandler interactionHandler
the interaction handler


transform

private java.awt.geom.AffineTransform transform
the transform for virtual to screen coordinates


inverseTransform

private java.awt.geom.AffineTransform inverseTransform
the transform for screen to virtual coordinates


size

private java.awt.Dimension size
the current size of the panel


grid

private Grid grid
the gird


messageBar

private MessageBar messageBar
the message bar


glu

GLU glu

glut

GLUT glut

tessCallback

Canvas.CallBack tessCallback

tobj

GLUtessellator tobj

quadratic

GLUquadric quadratic
Constructor Detail

Canvas

public Canvas(int width,
              int height)
Constructs a canvas object.

Parameters:
width - - the prefered canvas width
height - - the prefered canvas height
Method Detail

getMessageBar

public MessageBar getMessageBar()
Gets the message bar.


buildTransforms

private void buildTransforms()
Rebuilds the view transform and the inverse view transforms.


getPickedObject

public OntologyObject getPickedObject(double x,
                                      double y,
                                      boolean toggleSelected)
Returns the object at the specified virtual coordiantes or null if no object is located at the specified coordinates. If two objects are located at the specified point, then the first object is always returned. The method first checks for objects using the shape interface. However, the interface does not allow for the selection of lines. If no object is found, then the closest object within a small radius is returned.

Parameters:
x - - the x value in virutal coordinates
y - - the y value in virtual coordinates
Returns:
- the object or null if no object is picked

setMap

public void setMap(Map map)
Sets the map to display and resets the view transform.

Parameters:
map - - the new map

zoomAll

public void zoomAll()
Zooms to the boundries of the current map.


getVirtualCoordinates

public java.awt.geom.Point2D getVirtualCoordinates(double x,
                                                   double y)
Converts screen coordinates to virtual coordinates.

Parameters:
x - - the x component of the screen coordinate
y - - the y component of the screen coordinate
Returns:
- the point in virtual coordinates.

getScreenCoordinates

public java.awt.geom.Point2D getScreenCoordinates(double x,
                                                  double y)
Converts virtual coordinates to screen coordinates.

Parameters:
x - - the x component of the virtual coordinate
y - - the y component of the virtual coordinate
Returns:
- the point in screen coordinates.

getGrid

public Grid getGrid()
Gets the grid.


setObjectsVisible

public void setObjectsVisible(boolean visible)
Sets if constructed objects are visible.


getObjectsVisible

public boolean getObjectsVisible()
Gets if constructed objects are visible.


setAbstractionsVisible

public void setAbstractionsVisible(boolean visible)
Sets if abstract objects are visible.


getAbstractionsVisible

public boolean getAbstractionsVisible()
Gets if abstract objects are visible.


setDistanceRelationsVisible

public void setDistanceRelationsVisible(boolean visible)
Sets if distance relations are visible.


getDistanceRelationsVisible

public boolean getDistanceRelationsVisible()
Sets if distance relations are visible.


setOrientationRelationsVisible

public void setOrientationRelationsVisible(boolean visible)
Sets if orientation relations are visible.


getOrientationRelationsVisible

public boolean getOrientationRelationsVisible()
Sets if orientation relations are visible.


setTopologyRelationsVisible

public void setTopologyRelationsVisible(boolean visible)
Sets if topology relations are visible.


getTopologyRelationsVisible

public boolean getTopologyRelationsVisible()
Sets if topology relations are visible.


setInteractionHandler

public void setInteractionHandler(InteractionHandler handler)
Sets the interaction handler.


getTranslationX

public double getTranslationX()
Gets the tranlation in the x direction.


setTranslationX

public void setTranslationX(double translationX)
Sets the translation in the x direction and rebuilds the transforms.


getTranslationY

public double getTranslationY()
Gets the tranlation in the y direction.


setTranslationY

public void setTranslationY(double translationY)
Sets the translation in the y direction and rebuilds the transforms.


getRotation

public double getRotation()
Gets the rotation.


setRotation

public void setRotation(double rotation)
Sets the rotation and rebuilds the affine transforms.


getScale

public double getScale()
Gets the scale scale.


setScale

public void setScale(double scale)
Sets the scale and rebuilds the affine transforms.


getMap

public Map getMap()
Gets the map.


getTransform

public java.awt.geom.AffineTransform getTransform()
Gets the view transform.


init

public void init(GLAutoDrawable drawable)
Initializes JOGL parameters.


display

public void display(GLAutoDrawable drawable)
Displays the map. The objects are drawn in the following order: 1. Grid 2. Abstract and constructed objects 3. Relations 4. Interactor graphics


getQuadratic

public GLUquadric getQuadratic()
Gets the quadratic object used for drawing circles.


drawText

public void drawText(GL gl,
                     java.lang.String text,
                     double x,
                     double y,
                     float size,
                     float width)
Utility function for drawing text

Parameters:
gl - - the JOGL context
text - 0 the text to draw
x - - the x position
y - - the y position
size - - the size of the text
width - - the width of the letters

reshape

public void reshape(GLAutoDrawable drawable,
                    int x,
                    int y,
                    int width,
                    int height)
Updates the viewport when the window is resized.


displayChanged

public void displayChanged(GLAutoDrawable arg0,
                           boolean arg1,
                           boolean arg2)
Not implemented.


drawObject

public void drawObject(GL gl,
                       OntologyObject object)
Draws an ontology object.

Parameters:
gl - - the JOGL context
object - - the object to draw