import java.util.List;
import java.util.Set;
+import org.simantics.db.Resource;
import org.simantics.db.Session;
import org.simantics.g3d.csg.scenegraph2.CSGrootNode;
import org.simantics.g3d.csg.scenegraph2.ICSGnode;
import vtk.vtkProp;
import vtk.vtkProp3D;
-public class CSGNodeMap extends AbstractVTKNodeMap<ICSGnode> {
+public class CSGNodeMap extends AbstractVTKNodeMap<Resource,ICSGnode> {
import javax.vecmath.Quat4d;
import javax.vecmath.Vector3d;
+import org.simantics.db.Resource;
import org.simantics.g3d.csg.editor.CSGNodeMap;
import org.simantics.g3d.csg.ontology.CSG;
import org.simantics.g3d.math.MathTools;
@GraphType(CSG.URIs.Model)
-public class CSGrootNode extends ParentNode<ICSGnode> implements IG3DNode, NodeMapProvider<vtkProp, ICSGnode> {
+public class CSGrootNode extends ParentNode<ICSGnode> implements IG3DNode, NodeMapProvider<Resource,vtkProp, ICSGnode> {
private CSGNodeMap nodeMap;
}
@Override
- public NodeMap<vtkProp, ICSGnode> getNodeMap() {
+ public NodeMap<Resource,vtkProp, ICSGnode> getNodeMap() {
return nodeMap;
}
import vtk.vtkProp;
-public abstract class AbstractVTKNodeMap<E extends INode> implements VTKNodeMap<E>, IMappingListener, RenderListener, NodeListener, UndoRedoSupport.ChangeListener{
+public abstract class AbstractVTKNodeMap<DBObject,E extends INode> implements VTKNodeMap<DBObject,E>, IMappingListener, RenderListener, NodeListener, UndoRedoSupport.ChangeListener{
private static final boolean DEBUG = false;
protected Session session;
- protected IMapping<Object,E> mapping;
+ protected IMapping<DBObject,E> mapping;
protected VtkView view;
protected MapList<E, vtkProp> nodeToActor = new MapList<E, vtkProp>();
protected int redoOpCount = 0;
protected boolean runUndo = false;
protected boolean runRedo = false;
- public AbstractVTKNodeMap(Session session, IMapping<Object,E> mapping, VtkView view, ParentNode<E> rootNode) {
+ public AbstractVTKNodeMap(Session session, IMapping<DBObject,E> mapping, VtkView view, ParentNode<E> rootNode) {
this.session = session;
this.mapping = mapping;
this.view = view;
protected void reset(ReadGraph graph) throws MappingException {
if (DEBUG) System.out.println("Reset");
+
synchronized (syncMutex) {
graphUpdates = true;
mapping.getRangeModified().clear();
- for (Object o : mapping.getDomain())
+ for (DBObject o : mapping.getDomain())
mapping.domainModified(o);
mapping.updateRange(graph);
graphModified.clear();
} else {
synchronized (syncMutex) {
graphUpdates = true;
- for (Object domainObject : mapping.getDomainModified()) {
+ for (DBObject domainObject : mapping.getDomainModified()) {
E rangeObject = mapping.get(domainObject);
if (rangeObject != null)
graphModified.add(rangeObject);
}
- public IMapping<Object,E> getMapping() {
+ public IMapping<DBObject,E> getMapping() {
return mapping;
}
import vtk.vtkProp;
import vtk.vtkProperty;
-public class SelectionHighlighter<E extends INode> implements ISelectionChangedListener{
+public class SelectionHighlighter<DBObject, E extends INode> implements ISelectionChangedListener{
protected VtkView panel;
- protected VTKNodeMap<E> nodeMap;
+ protected VTKNodeMap<DBObject,E> nodeMap;
protected List<IG3DNode> selectedNodes = new ArrayList<IG3DNode>();
protected List<vtkActor> selectedActors = new ArrayList<vtkActor>();
protected HighlightObjectType type = HighlightObjectType.Node;
- public SelectionHighlighter(VtkView panel, VTKNodeMap<E> nodeMap) {
+ public SelectionHighlighter(VtkView panel, VTKNodeMap<DBObject,E> nodeMap) {
this.panel = panel;
this.nodeMap = nodeMap;
}
import vtk.vtkProp;
-public interface VTKNodeMap<E extends INode> extends NodeMap<vtkProp, E>{
+public interface VTKNodeMap<DBObject,E extends INode> extends NodeMap<DBObject,vtkProp, E>{
private TableViewer viewer;
private IG3DNode node;
- private NodeMap<?,?> nodeMap;
+ private NodeMap<?,?,?> nodeMap;
private List<TableViewerColumn> valueColumns = new ArrayList<TableViewerColumn>();
nodeMap = null;
break;
}
- if (n instanceof NodeMapProvider<?,?>) {
- nodeMap = ((NodeMapProvider<?,?>) n).getNodeMap();
+ if (n instanceof NodeMapProvider<?,?,?>) {
+ nodeMap = ((NodeMapProvider<?,?,?>) n).getNodeMap();
if (nodeMap != null)
break;
}
private static class PropertyEditingSupport extends EditingSupport {
AnnotatedPropertyTab tab;
int index;
- NodeMap<?,?> nodeMap;
+ NodeMap<?,?,?> nodeMap;
TableViewer viewer;
CellEditor editor;
- public PropertyEditingSupport(AnnotatedPropertyTab tab, TableViewer viewer, int index, NodeMap<?,?> nodeMap) {
+ public PropertyEditingSupport(AnnotatedPropertyTab tab, TableViewer viewer, int index, NodeMap<?,?,?> nodeMap) {
super(viewer);
this.tab = tab;
this.index = index;
import org.simantics.g3d.scenegraph.base.ParentNode;
import org.simantics.objmap.graph.IMapping;
-public interface NodeMap<T,E extends INode> {
+public interface NodeMap<DBObject,T,E extends INode> {
public Collection<T> getRenderObjects(E node);
public void removeListener(NodeListener listener);
- public IMapping<Object, E> getMapping();
+ public IMapping<DBObject, E> getMapping();
}
import org.simantics.g3d.scenegraph.base.INode;
-public interface NodeMapProvider<T,E extends INode> {
+public interface NodeMapProvider<DBObject,T,E extends INode> {
- public NodeMap<T,E> getNodeMap();
+ public NodeMap<DBObject,T,E> getNodeMap();
}
*
* @param <E>
*/
-public abstract class ScriptNodeMap<E extends INode> implements NodeMap<Object,E>, IMappingListener, NodeListener {
+public abstract class ScriptNodeMap<DBObject,E extends INode> implements NodeMap<DBObject,Object,E>, IMappingListener, NodeListener {
private static final boolean DEBUG = false;
protected Session session;
- protected IMapping<Object,E> mapping;
+ protected IMapping<DBObject,E> mapping;
protected ParentNode<E> rootNode;
private boolean dirty = false;
- public ScriptNodeMap(Session session, IMapping<Object,E> mapping, ParentNode<E> rootNode) {
+ public ScriptNodeMap(Session session, IMapping<DBObject,E> mapping, ParentNode<E> rootNode) {
this.session = session;
this.mapping = mapping;
this.rootNode = rootNode;
synchronized (syncMutex) {
graphUpdates = true;
mapping.getRangeModified().clear();
- for (Object o : mapping.getDomain())
+ for (DBObject o : mapping.getDomain())
mapping.domainModified(o);
mapping.updateRange(graph);
graphModified.clear();
if (DEBUG) System.out.println("Graph update start");
synchronized (syncMutex) {
graphUpdates = true;
- for (Object domainObject : mapping.getDomainModified()) {
+ for (DBObject domainObject : mapping.getDomainModified()) {
E rangeObject = mapping.get(domainObject);
if (rangeObject != null)
graphModified.add(rangeObject);
}
- public IMapping<Object,E> getMapping() {
+ public IMapping<DBObject,E> getMapping() {
return mapping;
}
public final Resource Builtin_VerticalTank;
public final Resource Builtin_VerticalTankGeometryProvider;
public final Resource CodeComponent;
+ public final Resource ComponentLibrary;
+ public final Resource ComponentLibrary_contains;
public final Resource Connects;
public final Resource DualConnectedComponent;
public final Resource EndComponent;
public static final String Builtin_VerticalTank = "http://www.simantics.org/Plant3D-0.1/Builtin/VerticalTank";
public static final String Builtin_VerticalTankGeometryProvider = "http://www.simantics.org/Plant3D-0.1/Builtin/VerticalTankGeometryProvider";
public static final String CodeComponent = "http://www.simantics.org/Plant3D-0.1/CodeComponent";
+ public static final String ComponentLibrary = "http://www.simantics.org/Plant3D-0.1/ComponentLibrary";
+ public static final String ComponentLibrary_contains = "http://www.simantics.org/Plant3D-0.1/ComponentLibrary/contains";
public static final String Connects = "http://www.simantics.org/Plant3D-0.1/Connects";
public static final String DualConnectedComponent = "http://www.simantics.org/Plant3D-0.1/DualConnectedComponent";
public static final String EndComponent = "http://www.simantics.org/Plant3D-0.1/EndComponent";
Builtin_VerticalTank = getResourceOrNull(graph, URIs.Builtin_VerticalTank);
Builtin_VerticalTankGeometryProvider = getResourceOrNull(graph, URIs.Builtin_VerticalTankGeometryProvider);
CodeComponent = getResourceOrNull(graph, URIs.CodeComponent);
+ ComponentLibrary = getResourceOrNull(graph, URIs.ComponentLibrary);
+ ComponentLibrary_contains = getResourceOrNull(graph, URIs.ComponentLibrary_contains);
Connects = getResourceOrNull(graph, URIs.Connects);
DualConnectedComponent = getResourceOrNull(graph, URIs.DualConnectedComponent);
EndComponent = getResourceOrNull(graph, URIs.EndComponent);
import java.util.HashSet;
import java.util.Set;
-import javax.vecmath.Vector3d;
-
import org.eclipse.swt.widgets.Display;
+import org.simantics.db.Resource;
import org.simantics.g3d.scenegraph.NodeMap;
import org.simantics.g3d.scenegraph.base.INode;
import org.simantics.g3d.vtk.swt.InteractiveVtkComposite;
import org.simantics.plant3d.scenegraph.InlineComponent;
import org.simantics.plant3d.scenegraph.Nozzle;
import org.simantics.plant3d.scenegraph.P3DRootNode;
-import org.simantics.plant3d.scenegraph.PipeRun;
import org.simantics.plant3d.scenegraph.PipelineComponent;
-import org.simantics.plant3d.scenegraph.controlpoint.PipeControlPoint;
-import org.simantics.plant3d.scenegraph.controlpoint.PipeControlPoint.Direction;
import org.simantics.plant3d.scenegraph.controlpoint.PipeControlPoint.PositionType;
-import org.simantics.plant3d.scenegraph.controlpoint.PipingRules;
import org.simantics.plant3d.utils.ComponentUtils;
-import org.simantics.plant3d.utils.Item;
import org.simantics.plant3d.utils.ComponentUtils.InsertInstruction;
-import org.simantics.plant3d.utils.Item.Type;
+import org.simantics.plant3d.utils.Item;
import org.simantics.utils.threads.ThreadUtils;
import org.simantics.utils.ui.ExceptionUtils;
private P3DRootNode root;
private PipelineComponent component;
- private NodeMap<vtkProp,INode> nodeMap;
+ private NodeMap<Resource,vtkProp,INode> nodeMap;
private TerminalSelectionGizmo gizmo;
import javax.vecmath.Tuple3d;
import javax.vecmath.Vector3d;
+import org.simantics.db.Resource;
import org.simantics.g3d.math.MathTools;
import org.simantics.g3d.math.Ray;
import org.simantics.g3d.scenegraph.NodeMap;
private SplitPointSelectionGizmo splitPointSelectionGizmo;
private ConstraintPointGizmo constraintPointGizmo;
private TerminalSelectionGizmo terminalSelectionGizmo;
- private NodeMap<vtkProp,INode> nodeMap;
+ private NodeMap<Resource,vtkProp,INode> nodeMap;
private enum ToolState{NOT_ACTIVE, INITIALIZING, SELECTING_POSITION, SELECTING_SPLIT, ROUTING};
private ToolState state = ToolState.NOT_ACTIVE;
import vtk.vtkProp;
import vtk.vtkProp3D;
-public class P3DNodeMap extends AbstractVTKNodeMap<INode> {
+public class P3DNodeMap extends AbstractVTKNodeMap<Resource,INode> {
private static final boolean DEBUG = false;
return new HoverHighlighter(panel,nodeMap);
}
- protected SelectionHighlighter<INode> createSelectionHighlighter() {
- return new SelectionHighlighter<INode>(panel,nodeMap);
+ protected SelectionHighlighter<Resource,INode> createSelectionHighlighter() {
+ return new SelectionHighlighter<Resource,INode>(panel,nodeMap);
}
protected String getLibraryUri() {
import javax.vecmath.Quat4d;
import javax.vecmath.Vector3d;
+import org.simantics.db.Resource;
import org.simantics.g3d.math.MathTools;
import org.simantics.g3d.scenegraph.IG3DNode;
import org.simantics.g3d.scenegraph.NodeMap;
import vtk.vtkProp;
@GraphType(Plant3D.URIs.Plant)
-public class P3DRootNode extends ParentNode<INode> implements IG3DNode, NodeMapProvider<vtkProp , INode> {
+public class P3DRootNode extends ParentNode<INode> implements IG3DNode, NodeMapProvider<Resource, vtkProp , INode> {
@RelatedElementsAdd(Plant3D.URIs.children)
}
@Override
- public NodeMap<vtkProp, INode> getNodeMap() {
+ public NodeMap<Resource,vtkProp, INode> getNodeMap() {
return nodeMap;
}
import java.util.Set;
import org.simantics.db.ReadGraph;
+import org.simantics.db.Resource;
import org.simantics.db.Session;
import org.simantics.db.exception.DatabaseException;
import org.simantics.g3d.ontology.G3D;
import vtk.vtkProp3D;
-public class P3DScriptNodeMap extends ScriptNodeMap<INode>{
+public class P3DScriptNodeMap extends ScriptNodeMap<Resource,INode>{
private static final boolean DEBUG = false;