]> gerrit.simantics Code Review - simantics/3d.git/blob - org.simantics.g3d/src/org/simantics/proconf/g3d/base/ScenegraphAdapter.java
40154a653ba676c36dfa9f86e91761d9843ab35b
[simantics/3d.git] / org.simantics.g3d / src / org / simantics / proconf / g3d / base / ScenegraphAdapter.java
1 /*******************************************************************************\r
2  * Copyright (c) 2007- VTT Technical Research Centre of Finland.\r
3  * All rights reserved. This program and the accompanying materials\r
4  * are made available under the terms of the Eclipse Public License v1.0\r
5  * which accompanies this distribution, and is available at\r
6  * http://www.eclipse.org/legal/epl-v10.html\r
7  *\r
8  * Contributors:\r
9  *     VTT Technical Research Centre of Finland - initial API and implementation\r
10  *******************************************************************************/\r
11 package org.simantics.proconf.g3d.base;\r
12 \r
13 import java.util.Collection;\r
14 \r
15 import org.simantics.db.Graph;\r
16 import org.simantics.db.Resource;\r
17 import org.simantics.layer0.utils.IEntity;\r
18 import org.simantics.proconf.g3d.scenegraph.IGeometryNode;\r
19 import org.simantics.proconf.g3d.scenegraph.IGraphicsNode;\r
20 import org.simantics.proconf.g3d.stubs.G3DNode;\r
21 \r
22 import com.jme.scene.Node;\r
23 \r
24 public interface ScenegraphAdapter {\r
25 \r
26         /**\r
27          * Disposes the adapter\r
28          */\r
29         public void dispose();\r
30 \r
31         /**\r
32          * Returns scene-graph node of the resource\r
33          * @param resource\r
34          * @return\r
35          */\r
36         public IGraphicsNode getNode(Resource resource);\r
37 \r
38         /**\r
39          * Returns scene-graph node of the resource\r
40          * @param thing\r
41          * @return\r
42          */\r
43         public IGraphicsNode getNode(IEntity thing);\r
44 \r
45         /**\r
46          * Returns node (resource) for the uid.\r
47          * @param uid\r
48          * @return the node (resource)\r
49          */\r
50         public Resource getNodeResource(String uid);\r
51 \r
52         /**\r
53          * @return all nodes in the scene-graph\r
54          */\r
55         public Collection<IGraphicsNode> getNodes();\r
56 \r
57         /**\r
58          * Returns uid of the node.\r
59          * @param nodeResource\r
60          * @return\r
61          */\r
62         public String getNodeUID(Resource nodeResource);\r
63 \r
64         public JmeRenderingComponent getRenderingComponent();\r
65 \r
66         public Node getRoot();\r
67 \r
68         public IGraphicsNode getRootNode();\r
69 \r
70         public Resource getRootResource();\r
71 \r
72         /**\r
73          * Returns true if the scene-graph contains the node\r
74          * @param resource\r
75          * @return\r
76          */\r
77         public boolean hasNode(Resource resource);\r
78 \r
79         /**\r
80          * Checks if the view has been changed (and needs redrawing).\r
81          * @return\r
82          */\r
83         public boolean isChanged();\r
84 \r
85         /**\r
86          * Checks if any geometries needs updating\r
87          * @return \r
88          */\r
89         public boolean needsUpdateGeometry();\r
90 \r
91         /**\r
92          * \r
93          * @param changed\r
94          */\r
95         public void setChanged(boolean changed);\r
96 \r
97         /**\r
98          * Sets the root node of the scene-graph\r
99          * @param rootNode\r
100          */\r
101         public void setRootNode(G3DNode rootNode);\r
102 \r
103         /**\r
104          * Updates requested geometries.\r
105          * \r
106          * @param graph\r
107          */\r
108         public void updateGeometry(Graph graph);\r
109 \r
110         /**\r
111          * Updates node's geometry\r
112          * @param node\r
113          */\r
114         public void updateGeometry(IGeometryNode node);\r
115         \r
116         /**\r
117          * Updates node's geometry\r
118          * @param nodeResource\r
119          */\r
120         public void updateGeometry(Resource nodeResource);\r
121 \r
122 }