12 package com.generalrobotix.ui.item;
14 import java.util.List;
15 import java.util.Vector;
17 import org.eclipse.jface.dialogs.MessageDialog;
19 import javax.media.j3d.BadTransformException;
20 import javax.media.j3d.BranchGroup;
21 import javax.media.j3d.Geometry;
22 import javax.media.j3d.QuadArray;
23 import javax.media.j3d.Shape3D;
24 import javax.media.j3d.Switch;
25 import javax.media.j3d.Transform3D;
26 import javax.media.j3d.TransformGroup;
29 import javax.vecmath.Color3f;
30 import javax.vecmath.Matrix3d;
31 import javax.vecmath.Matrix4d;
32 import javax.vecmath.Point3f;
33 import javax.vecmath.Vector3d;
52 @SuppressWarnings(
"serial")
54 public TransformGroup
tg_;
55 public BranchGroup
bg_;
73 tg_ =
new TransformGroup();
74 tg_.setCapability(TransformGroup.ALLOW_CHILDREN_READ);
75 tg_.setCapability(TransformGroup.ALLOW_CHILDREN_EXTEND);
76 tg_.setCapability(TransformGroup.ALLOW_CHILDREN_WRITE);
77 tg_.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
78 tg_.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
81 tg_.addChild(switchAxes_);
83 bg_ =
new BranchGroup();
84 bg_.setCapability(BranchGroup.ALLOW_DETACH);
85 bg_.setCapability(BranchGroup.ALLOW_CHILDREN_READ);
86 bg_.setCapability(BranchGroup.ALLOW_CHILDREN_EXTEND);
92 children_ =
new Vector<GrxTransformItem>();
101 children_.add(child);
112 children_.remove(child);
120 public void delete() {
123 while (children_.size() > 0){
124 children_.get(0).delete();
127 if (parent_ !=
null){
133 }
catch(Exception ex){
134 ex.printStackTrace();
149 switchAxes_.setWhichChild(b? Switch.CHILD_ALL:Switch.CHILD_NONE);
150 switchBb_.setWhichChild(b? Switch.CHILD_ALL:Switch.CHILD_NONE);
155 modifier.
init_ =
true;
157 Color3f color =
new Color3f(1.0
f, 0.0
f, 0.0
f);
159 tg_.addChild(switchBb_);
163 Transform3D trorg =
new Transform3D();
164 tg_.getTransform(trorg);
166 Transform3D tr =
new Transform3D();
167 tg_.setTransform(tr);
171 modifier.
init_ =
true;
175 Shape3D shapeNode = (Shape3D)switchBb_.getChild(0);
176 Geometry gm = (Geometry)shapeNode.getGeometry(0);
179 if (gm instanceof QuadArray) {
180 QuadArray qa = (QuadArray) gm;
181 qa.setCoordinates(0, p3fW);
184 }
catch(Exception ex){
185 ex.printStackTrace();
188 tg_.setTransform(trorg);
193 GrxSensorItem sensor = (GrxSensorItem)
this;
194 if (sensor.
type_.equals(type)){
198 for (
int i=0;
i<children_.size();
i++){
199 children_.get(
i).gatherSensors(type, sensors);
205 Transform3D t3d =
new Transform3D();
206 Vector3d p =
new Vector3d();
207 Vector3d _v =
new Vector3d(v);
208 tg_.getTransform(t3d);
209 t3d.transform(v, _v);
png_infop png_charp png_int_32 png_int_32 int * type
Shape3D _makeBoundingBox(Color3f color)
#define null
our own NULL pointer
png_infop png_charpp name
item corresponds to a robot model
static final int REMOVE_ITEM
static SceneGraphModifier getInstance()
void calcForwardKinematics()
compute forward kinematics
プラグイン管理クラス GrxUIの核になるクラス。プラグインのロード等の、初期化を実行する。 プラグインとそ...
static final int RESIZE_BOUNDS
functions to make various basic shapes
static Switch _makeSwitchNode(Shape3D shape)
static Switch createAxes()
create X(red),Y(green) and Z(blue) axes
void _calcUpperLower(Node node, Transform3D t3dParent)
static final int CREATE_BOUNDS