/******************************************************************************* * Copyright (c) 2007 VTT Technical Research Centre of Finland and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * VTT Technical Research Centre of Finland - initial API and implementation *******************************************************************************/ package org.simantics.proconf.g3d.scenegraph; import java.util.ArrayList; import java.util.Collection; import org.simantics.proconf.g3d.stubs.G3DNode; import com.jme.scene.Node; import org.simantics.db.Graph; import org.simantics.db.Resource; public abstract class NonTransformableNode implements IGraphicsNode { private IGraphicsNode parent; private ArrayList children = new ArrayList(); protected Node parentGroup = null; protected Resource nodeResource; public NonTransformableNode(IGraphicsNode parent, Resource nodeResource) { this.parent = parent; this.nodeResource = nodeResource; parentGroup = parent.getGroup(); parent.addChild(this); } public void addChild(IGraphicsNode node) { children.add(node); } public Collection getChildren() { return children; } public void removeChild(IGraphicsNode node) { children.remove(node); } public void dispose() { assert(children.size() == 0); if (parent != null) parent.removeChild(this); } public G3DNode getG3DNode(Graph graph) { return new G3DNode(graph, nodeResource); } public Node getGroup() { return parentGroup; } public IGraphicsNode getParent() { return parent; } public Resource getResource() { return nodeResource; } public void updateTransform(Graph graph) { } }