import java.awt.*;
import com.sun.j3d.utils.geometry.*;
import com.sun.j3d.utils.universe.*;
import javax.media.j3d.*;
import javax.vecmath.Color3f;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.media.j3d.*;
import javax.vecmath.* ;
import com.sun.j3d.loaders.Scene;
import com.sun.j3d.utils.behaviors.mouse.MouseBehavior;
import com.sun.j3d.utils.behaviors.mouse.MouseRotate;
import com.sun.j3d.utils.behaviors.mouse.MouseTranslate;
import com.sun.j3d.utils.behaviors.mouse.MouseZoom;
class Menu1 extends BranchGroup{
boolean groupe=true;
Coronal[] cor=new Coronal[28];
Transaxial[] tra=new Transaxial[19];
Sagital[] sag=new Sagital[21];
Menu1()
{
TransformGroup mouseTransform =new TransformGroup();
mouseTransform.setCapability (TransformGroup.ALLOW_TRANSFORM_WRITE);
mouseTransform.setCapability (TransformGroup.ALLOW_TRANSFORM_READ);
BoundingSphere schedulingBounds = new BoundingSphere (new Point3d (), 100.0);
MouseRotate rotate = new MouseRotate();
rotate.setTransformGroup(mouseTransform);
rotate.setSchedulingBounds (schedulingBounds);
MouseTranslate trans = new MouseTranslate ();
trans.setTransformGroup(mouseTransform);
trans.setSchedulingBounds (schedulingBounds);
MouseZoom zoom = new MouseZoom();
zoom.setTransformGroup(mouseTransform);
zoom.setSchedulingBounds (schedulingBounds);
//pour changer la couleur du fond
Background background = new Background (0.9f, 0.6f, 0.6f);
background.setApplicationBounds (new BoundingBox ());
addChild (background);
addChild(rotate);
addChild(trans);
addChild(zoom);
addChild(mouseTransform);
BranchGroup forme=new BranchGroup();
///////////////////////
for(int i=0;i<28;i++)
{
cor[i]=new Coronal(i);
forme.addChild(cor[i]);
}
for(int i=0;i<19;i++)
{
tra[i]=new Transaxial(i);
forme.addChild(tra[i]);
}
for(int i=0;i<21;i++)
{
sag[i]=new Sagital(i);
forme.addChild(sag[i]);
}
//////////////////////////
mouseTransform.addChild(forme);
}
public void setCoronal(int val)
{
val=27-val;
for(int i=0;i<28;i++)
{
if(i==val)
{
cor[i].updateApparence(0.0f);
}
else
{
if(groupe)
{
if(i<val)
{
cor[i].updateApparence(1.0f);
}
else
{
cor[i].updateApparence(0.0f);
}
}
else
{
cor[i].updateApparence(1.0f);
}
}
}
}
public void setTransaxial(int val)
{
val=18-val;
for(int i=0;i<19;i++)
{
if(i==val)
{
tra[i].updateApparence(0.0f);
}
else
{
if(groupe)
{
if(i<val)
{
tra[i].updateApparence(1.0f);
}
else
{
tra[i].updateApparence(0.0f);
}
}
else
{
tra[i].updateApparence(1.0f);
}
}
}
}
public void setSagitall(int val)
{
val=20-val;
for(int i=0;i<21;i++)
{
if(i==val)
{
sag[i].updateApparence(0.0f);
}
else
{
if(groupe)
{
if(i<val)
{
sag[i].updateApparence(1.0f);
}
else
{
sag[i].updateApparence(0.0f);
}
}
else
{
sag[i].updateApparence(1.0f);
}
}
}
}
public void annulerCoronel()
{
for(int i=0;i<28;i++)
{
cor[i].updateApparence(1.0f);
}
}
public void annulerTransaxial()
{
for(int i=0;i<19;i++)
{
tra[i].updateApparence(1.0f);
}
}
public void annulerSagital()
{
for(int i=0;i<21;i++)
{
sag[i].updateApparence(1.0f);
}
}
public void setImages(boolean val)
{
groupe=val;
}
}