@GraphType(Plant3D.URIs.Plant)
public class P3DRootNode extends ParentNode<INode> implements IG3DNode, NodeMapProvider<Resource, vtkProp, INode> {
-
+ // Vertical direction that determines the interpretation of rotation angle origin
+ protected Vector3d upVector = new Vector3d(0.0, 1.0, 0.0);
+
@RelatedElementsAdd(Plant3D.URIs.children)
public void addChild(INode node) {
//public void addChild(IP3DVisualNode node) {
throw new NodeException("Cannot set root node orientation");
}
+ /**
+ * Get a unique name in the Plant3D model with a given prefix followed by
+ * an underscore and number.
+ */
public String getUniqueName(String prefix) {
Set<String> names = new HashSet<String>();
for (INode node : getChild()) {
continue;
IP3DVisualNode n = (IP3DVisualNode)node;
names.add(n.getName());
+ if (node instanceof P3DParentNode)
+ ((P3DParentNode<?>) node).getComponentNames(names);
}
int i = 1;
while (true) {
}
- @SuppressWarnings("rawtypes")
@Override
- public Object getAdapter(Class adapter) {
- if (NodeMap.class == adapter)
- return nodeMap;
+ public <T> T getAdapter(Class<T> adapter) {
+ if (adapter.isAssignableFrom(NodeMap.class))
+ return adapter.cast(nodeMap);
return null;
}
public TurnComponent createTurn() {
return new TurnComponent();
}
+
+ public Vector3d getUpVector() {
+ return upVector;
+ }
}