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

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

public class ConceptSphere
extends java.lang.Object

This class offers an utility to draw spheres 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 createColoredSphere 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="..."; ConceptSphere sfera = new ConceptSphere(); sfera.setRadius(radius); Color3f color=new Color3f(Color.WHITE); tgx.addChild(sfera.createColoredSphere(....));

Author:
alessio.bosca@polito.it

Field Summary
private  javax.vecmath.Color3f black
           
private  boolean hasInstances
           
private  boolean isPickable
           
private  boolean isWithLabel
           
private  javax.vecmath.Color3f labelColor
           
private  float labelScale
           
private  float radius
           
private  com.sun.j3d.utils.geometry.Sphere sphere
           
private  javax.vecmath.Color3f sphereColor
           
private  java.lang.String sphereLabel
           
private  float transparency
           
 
Constructor Summary
ConceptSphere(javax.vecmath.Color3f color, java.lang.String label, boolean isPickable, boolean hasInstances)
          Void constructor.
 
Method Summary
private  javax.media.j3d.TransformGroup addSphereLabel()
          This method creates a TransformGroup containing the label.
 javax.media.j3d.BranchGroup createColoredSphere()
          Creates and adds a Sphere to a TransformGroup.
 float getRadius()
           
 com.sun.j3d.utils.geometry.Sphere getSphere()
           
 javax.media.j3d.Appearance getSphereAppearance()
           
 void setLabelColor(javax.vecmath.Color3f labelColor)
           
 void setLabelScale(float labelScale)
           
 void setRadius(float radius)
           
 void setTransparency(float transparency)
           
 void setWithLabel(boolean isWithLabel)
           
 
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

hasInstances

private boolean hasInstances

isPickable

private boolean isPickable

isWithLabel

private boolean isWithLabel

labelColor

private javax.vecmath.Color3f labelColor

labelScale

private float labelScale

radius

private float radius

sphere

private com.sun.j3d.utils.geometry.Sphere sphere

sphereColor

private javax.vecmath.Color3f sphereColor

sphereLabel

private java.lang.String sphereLabel

transparency

private float transparency
Constructor Detail

ConceptSphere

public ConceptSphere(javax.vecmath.Color3f color,
                     java.lang.String label,
                     boolean isPickable,
                     boolean hasInstances)
Void constructor. It does notingh. To draw relation, one of the createXXXSphere function must be used

Method Detail

addSphereLabel

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

Returns:
the TransformGroup containing the label

createColoredSphere

public javax.media.j3d.BranchGroup createColoredSphere()
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.

Returns:
the BranchGroup containing the sphere

getRadius

public float getRadius()
Returns:
Returns the radius.

getSphere

public com.sun.j3d.utils.geometry.Sphere getSphere()
Returns:
Returns the sphere.

getSphereAppearance

public javax.media.j3d.Appearance getSphereAppearance()

setLabelColor

public void setLabelColor(javax.vecmath.Color3f labelColor)
Parameters:
labelColor - The labelColor to set.

setLabelScale

public void setLabelScale(float labelScale)
Parameters:
labelScale - The labelScale to set.

setRadius

public void setRadius(float radius)
Parameters:
radius - The radius to set.

setTransparency

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

setWithLabel

public void setWithLabel(boolean isWithLabel)