it.polito.elite.visualization.ontoviewer.tools
Class InstanceCube

java.lang.Object
  extended by it.polito.elite.visualization.ontoviewer.tools.InstanceCube

public class InstanceCube
extends java.lang.Object

This class offers an utility to draw cubes as a building block for scenes. It exposes a dummy constructor, a group of set methods in order to explicitly set characteristics as transparency, the radius.. It provides also a method createColoredCube which return a java 3D TransformGroup that will be included by the scene itself. An example of its use is: TransformGroup tgx = new TransformGroup(); String label="..."; InstanceCube cube = new InstanceCube(); tgx.addChild(cube.createColoredCube(......));

Author:
alessio.bosca@polito.it

Field Summary
private  javax.vecmath.Color3f black
           
private  com.sun.j3d.utils.geometry.Box cube
           
private  javax.vecmath.Color3f cubeColor
           
private  java.lang.String cubeLabel
           
private  java.lang.String fontFamily
           
private  int fontModifier
           
private  boolean isWithLabel
           
private  javax.vecmath.Color3f labelColor
           
private  float labelScale
           
private  float side
           
private  float transparency
           
 
Constructor Summary
InstanceCube()
          Void constructor.
 
Method Summary
private  javax.media.j3d.TransformGroup addCubeLabel()
          This method creates a TransformGroup containing the label.
 javax.media.j3d.BranchGroup createColoredCube(javax.vecmath.Color3f color, java.lang.String label, boolean hasPertainingFacts)
          Creates and adds a Sphere to a TransformGroup.
private  javax.media.j3d.BranchGroup drawInstanceCube(boolean hasFacts)
          This method actually draws the sphere
 float getSide()
           
 void setFontFamily(java.lang.String fontFamily)
           
 void setFontModifier(int fontModifier)
           
 void setIsWithLabel(boolean isWithLabel)
           
 void setLabelAppearance(javax.vecmath.Color3f labelColor, float scale)
          Sets color and dimension scale for the label
 void setSide(float side)
           
 void setTransparency(float transparency)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

black

private final javax.vecmath.Color3f black

cube

private com.sun.j3d.utils.geometry.Box cube

cubeColor

private javax.vecmath.Color3f cubeColor

cubeLabel

private java.lang.String cubeLabel

fontFamily

private java.lang.String fontFamily

fontModifier

private int fontModifier

isWithLabel

private boolean isWithLabel

labelColor

private javax.vecmath.Color3f labelColor

labelScale

private float labelScale

side

private float side

transparency

private float transparency
Constructor Detail

InstanceCube

public InstanceCube()
Void constructor. It does notingh. To draw relation, one of the createXXXSphere function must be used

Method Detail

addCubeLabel

private javax.media.j3d.TransformGroup addCubeLabel()
This method creates a TransformGroup containing the label.

Returns:
the TransformGroup containing the label

createColoredCube

public javax.media.j3d.BranchGroup createColoredCube(javax.vecmath.Color3f color,
                                                     java.lang.String label,
                                                     boolean hasPertainingFacts)
Creates and adds a Sphere to a TransformGroup. The user data (which is the information retrieved by the Picker Behavior) of the 3D sphere object is set as the label string.

Parameters:
color - The Color of the Cube
label - The label of the Cube (can be null)
hasPertainingFacts - Indicates if the instance is involved in facts (relations with other instances).
Returns:
the TransformGroup containing the sphere

drawInstanceCube

private javax.media.j3d.BranchGroup drawInstanceCube(boolean hasFacts)
This method actually draws the sphere

Returns:
the TransformGroup containing the sphere and the label (if present)

getSide

public float getSide()
Returns:
Returns the side.

setFontFamily

public void setFontFamily(java.lang.String fontFamily)
Parameters:
fontFamily - The fontFamily to set.

setFontModifier

public void setFontModifier(int fontModifier)
Parameters:
fontModifier - The fontModifier to set.

setIsWithLabel

public void setIsWithLabel(boolean isWithLabel)

setLabelAppearance

public void setLabelAppearance(javax.vecmath.Color3f labelColor,
                               float scale)
Sets color and dimension scale for the label

Parameters:
labelColor -
scale -

setSide

public void setSide(float side)
Parameters:
side - The side to set.

setTransparency

public void setTransparency(float transparency)
Parameters:
transparency - The transparency to set.