--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>\r
+<projectDescription>\r
+ <name>3d</name>\r
+ <comment></comment>\r
+ <projects>\r
+ </projects>\r
+ <buildSpec>\r
+ <buildCommand>\r
+ <name>org.eclipse.m2e.core.maven2Builder</name>\r
+ <arguments>\r
+ </arguments>\r
+ </buildCommand>\r
+ </buildSpec>\r
+ <natures>\r
+ <nature>org.eclipse.m2e.core.maven2Nature</nature>\r
+ </natures>\r
+</projectDescription>\r
<projects>\r
</projects>\r
<buildSpec>\r
- <buildCommand>\r
- <name>org.eclipse.jdt.core.javabuilder</name>\r
- <arguments>\r
- </arguments>\r
- </buildCommand>\r
<buildCommand>\r
<name>org.eclipse.pde.ManifestBuilder</name>\r
<arguments>\r
</buildSpec>\r
<natures>\r
<nature>org.eclipse.pde.PluginNature</nature>\r
- <nature>org.eclipse.jdt.core.javanature</nature>\r
</natures>\r
</projectDescription>\r
Fragment-Host: org.jcae.opencascade;bundle-version="7.3.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Eclipse-PlatformFilter: (& (osgi.os=win32) (osgi.arch=x86_64))
+Automatic-Module-Name: org.jcae.opencascade.win32.x86_64
-output.. = bin/
bin.includes = META-INF/,\
.,\
OccJava.dll,\
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Export-Package: org.jcae.opencascade,
org.jcae.opencascade.jni
+Automatic-Module-Name: org.jcae.opencascade
<?xml version="1.0" encoding="UTF-8"?>\r
<classpath>\r
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>\r
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
<classpathentry kind="src" path="src"/>\r
<classpathentry kind="output" path="bin"/>\r
-#Tue Dec 13 11:35:42 EET 2011\r
eclipse.preferences.version=1\r
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
-org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8\r
+org.eclipse.jdt.core.compiler.compliance=1.8\r
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
-org.eclipse.jdt.core.compiler.source=1.6\r
+org.eclipse.jdt.core.compiler.source=1.8\r
org.simantics.action.ontology;bundle-version="1.0.0",
org.simantics.selectionview.ontology;bundle-version="1.0.0",
org.simantics.simulation.ontology;bundle-version="1.0.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.simantics.g3d.csg.ontology
+Automatic-Module-Name: org.simantics.g3d.csg.ontology
<?xml version="1.0" encoding="UTF-8"?>\r
<classpath>\r
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>\r
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
<classpathentry kind="src" path="src"/>\r
<classpathentry kind="output" path="bin"/>\r
-#Mon Dec 12 16:51:11 EET 2011\r
eclipse.preferences.version=1\r
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
-org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8\r
+org.eclipse.jdt.core.compiler.compliance=1.8\r
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
-org.eclipse.jdt.core.compiler.source=1.6\r
+org.eclipse.jdt.core.compiler.source=1.8\r
org.simantics.browsing.ui.common;bundle-version="1.1.0",
org.simantics.objmap2;bundle-version="1.0.0",
org.simantics.opencascade.vtk;bundle-version="1.0.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: org.simantics.g3d.csg.handler,
org.simantics.g3d.csg.model
+Automatic-Module-Name: org.simantics.g3d.csg
\r
}\r
\r
- @SuppressWarnings("rawtypes")\r
@Override\r
- public Object getAdapter(Class adapter) {\r
- if (Resource.class.equals(adapter))\r
- return model;\r
+ public <C> C getAdapter(Class<C> adapter) {\r
+ if (adapter.isAssignableFrom(Resource.class))\r
+ return adapter.cast(model);\r
return null;\r
}\r
\r
import org.simantics.g3d.csg.scenegraph2.SphereNode;
import org.simantics.g3d.csg.scenegraph2.TorusNode;
import org.simantics.g3d.csg.scenegraph2.UnionNode;
-import org.simantics.g3d.scenegraph.IG3DNode;
import org.simantics.g3d.scenegraph.NodeMap;
import org.simantics.g3d.scenegraph.base.INode;
import org.simantics.g3d.vtk.action.RemoveAction;
private SWTAWTComponent component;
private CSGrootNode rootNode;
- private IMapping<Resource,Object> mapping;
+ private IMapping<Resource, INode> mapping;
- private NodeSelectionProvider2<Resource,Object> selectionProvider;
+ private NodeSelectionProvider2<Resource, INode> selectionProvider;
private vtkCameraAndSelectorAction cameraAction;
private TranslateAction translateAction;
throw new RuntimeException("Scenegraph loading failed.");
populate();
- selectionProvider = new NodeSelectionProvider2<Resource,Object>(this,mapping,nodeMap);
+ selectionProvider = new NodeSelectionProvider2<Resource,INode>(this,mapping,nodeMap);
cameraAction.addSelectionChangedListener(selectionProvider);
- cameraAction.addHoverChangedListener(new HoverHighlighter(panel,nodeMap));
- selectionProvider.addSelectionChangedListener(new SelectionHighlighter(panel,nodeMap));
+ cameraAction.addHoverChangedListener(new HoverHighlighter<Resource>(panel,nodeMap));
+ selectionProvider.addSelectionChangedListener(new SelectionHighlighter<Resource>(panel,nodeMap));
getSite().setSelectionProvider(selectionProvider);
getSite().getPage().addPostSelectionListener(selectionProvider);
translateAction = new TranslateAction(panel,nodeMap);
rotateAction = new RotateAction(panel,nodeMap);
removeAction = new RemoveAction(nodeMap) {
- public void setNode(IG3DNode node) {
+ @Override
+ public void setNode(INode node) {
super.setNode(node);
if (node.getParent() instanceof CSGparentNode)
setEnabled(false);
-
}
};
private IContentOutlinePage createOutline() {
if (rootNode == null || selectionProvider == null)
return null;
- IContentOutlinePage outlinePage = new VTKContentOutlinePage<Resource,Object>(rootNode, selectionProvider);
+ IContentOutlinePage outlinePage = new VTKContentOutlinePage<Resource,INode>(rootNode, selectionProvider);
outlinePage.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
return outlinePage;
}
- @SuppressWarnings("rawtypes")
@Override
- public Object getAdapter(Class adapter) {
- if (IPropertyPage.class.equals(adapter))
- return new StandardPropertyPage(getSite(),getPropertyContexts());
- if (IContentOutlinePage.class.equals(adapter)) {
- return createOutline();
+ public <T> T getAdapter(Class<T> adapter) {
+ if (adapter.isAssignableFrom(IPropertyPage.class))
+ return adapter.cast(new StandardPropertyPage(getSite(),getPropertyContexts()));
+ if (adapter.isAssignableFrom(IContentOutlinePage.class)) {
+ return adapter.cast(createOutline());
}
- if (NodeMap.class.equals(adapter)) {
- return nodeMap;
+ if (adapter.isAssignableFrom(NodeMap.class)) {
+ return adapter.cast(nodeMap);
}
- if (INode.class.equals(adapter)) {
- return rootNode;
+ if (adapter.isAssignableFrom(INode.class)) {
+ return adapter.cast(rootNode);
}
- if (IMapping.class.equals(adapter)) {
- return mapping;
+ if (adapter.isAssignableFrom(IMapping.class)) {
+ return adapter.cast(mapping);
}
- if (InteractiveVtkPanel.class.equals(adapter)) {
- return panel;
+ if (adapter.isAssignableFrom(InteractiveVtkPanel.class)) {
+ return adapter.cast(panel);
}
- if (VtkView.class.equals(adapter))
- return panel;
+ if (adapter.isAssignableFrom(VtkView.class))
+ return adapter.cast(panel);
return super.getAdapter(adapter);
}
import org.simantics.db.Session;
import org.simantics.g3d.csg.scenegraph2.CSGrootNode;
import org.simantics.g3d.csg.scenegraph2.ICSGnode;
+import org.simantics.g3d.scenegraph.base.INode;
import org.simantics.g3d.scenegraph.base.ParentNode;
import org.simantics.g3d.vtk.awt.InteractiveVtkPanel;
import org.simantics.g3d.vtk.common.AbstractVTKNodeMap;
public class CSGNodeMap extends AbstractVTKNodeMap<Resource,ICSGnode> {
-
-
- public CSGNodeMap(Session session, IMapping mapping, InteractiveVtkPanel panel, CSGrootNode rootNode) {
+ public CSGNodeMap(Session session, IMapping<Resource,INode> mapping, InteractiveVtkPanel panel, CSGrootNode rootNode) {
super(session, mapping, panel, rootNode);
rootNode.setNodeMap(this);
}
}
@Override
- public Object getAdapter(Class adapter) {
+ public <C> C getAdapter(Class<C> adapter) {
return null;
}
}
@Override
- public Object getAdapter(Class adapter) {
- if (NodeMap.class == adapter)
- return nodeMap;
+ public <C> C getAdapter(Class<C> adapter) {
+ if (adapter.isAssignableFrom(NodeMap.class))
+ return adapter.cast(nodeMap);
return null;
}
<?xml version="1.0" encoding="UTF-8"?>\r
<classpath>\r
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>\r
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
<classpathentry kind="src" path="src"/>\r
<classpathentry kind="output" path="bin"/>\r
-#Mon Dec 12 12:36:09 EET 2011\r
eclipse.preferences.version=1\r
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
-org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8\r
+org.eclipse.jdt.core.compiler.compliance=1.8\r
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
-org.eclipse.jdt.core.compiler.source=1.6\r
+org.eclipse.jdt.core.compiler.source=1.8\r
Bundle-Vendor: VTT
Require-Bundle: org.eclipse.core.runtime,
org.simantics.layer0;bundle-version="1.0.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.simantics.g3d.ontology
+Automatic-Module-Name: org.simantics.g3d.ontology
<?xml version="1.0" encoding="UTF-8"?>\r
<classpath>\r
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>\r
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
<classpathentry kind="src" path="src"/>\r
<classpathentry kind="output" path="bin"/>\r
org.simantics.g3d.vtk.shape,
org.simantics.g3d.vtk.swt,
org.simantics.g3d.vtk.utils
+Automatic-Module-Name: org.simantics.g3d.vtk
package org.simantics.g3d.vtk.action;
import org.eclipse.jface.action.Action;
-import org.simantics.g3d.scenegraph.IG3DNode;
import org.simantics.g3d.scenegraph.base.INode;
import org.simantics.g3d.scenegraph.structural.IStructuralNode;
import org.simantics.g3d.vtk.Activator;
public class RemoveAction extends Action {
- private VTKNodeMap nodeMap;
+ private VTKNodeMap<?, ? extends INode> nodeMap;
protected INode node;
- public RemoveAction(VTKNodeMap nodeMap) {
+ public RemoveAction(VTKNodeMap<?, ? extends INode> nodeMap) {
setText("Remove");
setImageDescriptor(Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/delete.png"));
this.nodeMap = nodeMap;
import org.simantics.g3d.math.Ray;
import org.simantics.g3d.preferences.PreferenceConstants;
import org.simantics.g3d.scenegraph.IG3DNode;
+import org.simantics.g3d.scenegraph.base.INode;
import org.simantics.g3d.scenegraph.structural.IStructuralNode;
import org.simantics.g3d.vtk.Activator;
import org.simantics.g3d.vtk.common.VTKNodeMap;
public static final int Z = 2;
public static final int P = 3;
- private VTKNodeMap nodeMap;
+ private VTKNodeMap<?,? extends INode> nodeMap;
//private TranslateGizmo gizmo = new TranslateGizmo();
private RotateAxisGizmo gizmo = new RotateAxisGizmo();
private IG3DNode node;
return node;
}
- public RotateAction(InteractiveVtkPanel panel, VTKNodeMap nodeMap) {
+ public RotateAction(InteractiveVtkPanel panel, VTKNodeMap<?,? extends INode> nodeMap) {
super(panel);
setImageDescriptor(Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/arrow_rotate_clockwise.png"));
setText("Rotate");
import org.simantics.g3d.math.MathTools;
import org.simantics.g3d.math.Ray;
import org.simantics.g3d.scenegraph.IG3DNode;
+import org.simantics.g3d.scenegraph.base.INode;
import org.simantics.g3d.scenegraph.structural.IStructuralNode;
import org.simantics.g3d.vtk.Activator;
import org.simantics.g3d.vtk.common.VTKNodeMap;
public static final int YZ = 5;
public static final int P = 6;
- private VTKNodeMap nodeMap;
+ private VTKNodeMap<?, ? extends INode> nodeMap;
//private TranslateGizmo gizmo = new TranslateGizmo();
private TranslateAxisGizmo gizmo = new TranslateAxisGizmo();
protected IG3DNode node;
return node;
}
- public TranslateAction(InteractiveVtkPanel panel, VTKNodeMap nodeMap) {
+ public TranslateAction(InteractiveVtkPanel panel, VTKNodeMap<?, ? extends INode> nodeMap) {
super(panel);
setImageDescriptor(Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/arrow_out.png"));
setText("Translate");
import java.util.Map;
import java.util.Set;
import java.util.Stack;
+import java.util.function.Consumer;
import org.simantics.db.ReadGraph;
import org.simantics.db.Session;
import org.simantics.objmap.exceptions.MappingException;
import org.simantics.objmap.graph.IMapping;
import org.simantics.objmap.graph.IMappingListener;
-import org.simantics.utils.datastructures.Callback;
import org.simantics.utils.datastructures.MapList;
import org.simantics.utils.datastructures.MapSet;
import org.simantics.utils.datastructures.Pair;
@SuppressWarnings("unchecked")
@Override
public Collection<vtkProp> getRenderObjects(INode node) {
- return nodeToActor.getValues((E)node);
+ return nodeToActor.getValues((E) node);
}
protected <T extends vtkProp> void map(E node, Collection<T> props) {
nodeToActor.remove(node);
}
- @SuppressWarnings("unchecked")
@Override
public ParentNode<E> getRootNode() {
return (ParentNode<E>)rootNode;
}
- @SuppressWarnings("unchecked")
@Override
public void updateRenderObjectsFor(E node) {
List<vtkProp> toDelete = new ArrayList<vtkProp>();
view.lock();
- for (vtkProp prop : nodeToActor.getValues((E)node)) {
+ for (vtkProp prop : nodeToActor.getValues(node)) {
if (prop.GetVTKId() != 0) {
view.getRenderer().RemoveActor(prop);
//prop.Delete();
actorToNode.remove(prop);
}
view.unlock();
- nodeToActor.remove((E)node);
- Collection<vtkProp> coll = getActors((E)node);
+ nodeToActor.remove(node);
+ Collection<vtkProp> coll = getActors(node);
if (coll != null) {
for (vtkProp prop : coll) {
- nodeToActor.add((E)node,prop);
- actorToNode.put(prop, (E)node);
+ nodeToActor.add(node,prop);
+ actorToNode.put(prop, node);
toDelete.remove(prop);
}
}
repaint();
}
- @SuppressWarnings("unchecked")
private void receiveUpdate(E node, String id, boolean db) {
if (DEBUG) System.out.println("receiveUpdate " + debugString(node) + " " + id + " " + db);
synchronized (syncMutex) {
commit(graph);
}
- }, new Callback<DatabaseException>() {
+ }, new Consumer<DatabaseException>() {
@Override
- public void run(DatabaseException parameter) {
+ public void accept(DatabaseException parameter) {
if (parameter != null)
ExceptionUtils.logAndShowError("Cannot commit editor changes", parameter);
}
if (DEBUG)System.out.println("domainModified");
session.asyncRequest(new ReadRequest() {
- @SuppressWarnings("unchecked")
@Override
public void run(ReadGraph graph) throws DatabaseException {
update(graph);
* This code here synchronizes removed and added objects to collect deletable objects. (a deletable object is one which is removed but not added).
*
*/
+ @SuppressWarnings("unused")
protected void syncDeletes() {
deleteUC.clear();
for (Pair<E, String> n : removed) {
/**
* Clears deletable objects from mapping cache.
*/
+ @SuppressWarnings("unused")
protected void clearDeletes() {
if (DEBUG && delete.size() > 0) System.out.println("Delete");
for (E n : delete) {
package org.simantics.g3d.vtk.common;
import org.eclipse.jface.viewers.ISelection;
-import org.simantics.g3d.scenegraph.IG3DNode;
import org.simantics.g3d.scenegraph.NodeHighlighter;
import org.simantics.g3d.scenegraph.NodeHighlighter.HighlightEventType;
+import org.simantics.g3d.scenegraph.base.INode;
-public class HoverHighlighter extends SelectionHighlighter {
+public class HoverHighlighter<DBObject> extends SelectionHighlighter<DBObject> {
-
- public HoverHighlighter(VtkView panel, VTKNodeMap nodeMap) {
+ public HoverHighlighter(VtkView panel, VTKNodeMap<DBObject,?> nodeMap) {
super(panel, nodeMap);
-
}
+ @Override
protected void highlight(ISelection s) {
highlight(s, HighlightEventType.Hover, HighlightEventType.ClearHover);
}
- protected void hilight(IG3DNode node, HighlightEventType type) {
+ @Override
+ protected void hilight(INode node, HighlightEventType type) {
if (node instanceof NodeHighlighter) {
((NodeHighlighter)node).highlight(type);
return;
}
}
- protected void setDefaultColor(IG3DNode node) {
+ @Override
+ protected void setDefaultColor(INode node) {
double color[] = new double[]{0,0,0};
setColor(node, true, color);
}
- protected void setSelectedColor(IG3DNode node) {
+ @Override
+ protected void setSelectedColor(INode node) {
double color[] = new double[]{1,0,1};
setColor(node, true, color);
}
protected IEditorPart part;
protected IMapping<DBObject,JavaObject> mapping;
- protected VTKNodeMap nodeMap;
+ protected VTKNodeMap<DBObject, ? extends INode> nodeMap;
- public NodeSelectionProvider2(IEditorPart part, IMapping<DBObject,JavaObject> mapping, VTKNodeMap nodeMap) {
+ public NodeSelectionProvider2(IEditorPart part, IMapping<DBObject,JavaObject> mapping, VTKNodeMap<DBObject, ? extends INode> nodeMap) {
this.part = part;
this.mapping = mapping;
this.nodeMap = nodeMap;
} else if (resources.size() > 0) {
nodes = new ArrayList<IG3DNode>();
for (Resource r : resources) {
+ @SuppressWarnings("unchecked")
JavaObject n = mapping.get((DBObject)r);
if (n instanceof IG3DNode) {
nodes.add((IG3DNode)n);
fireSelectionChanged(event.getSource());
}
- @SuppressWarnings("unchecked")
protected void processSelection(ISelection s) {
selectedNodes.clear();
selectedItems.clear();
Collection<vtkProp> selectedActors = AdaptationUtils.adaptToCollection(s, vtkProp.class);
if (selectedActors.size() > 0) {
for (vtkProp a : selectedActors) {
- IG3DNode node = (IG3DNode)nodeMap.getNode((vtkProp)a);
+ INode node = nodeMap.getNode(a);
if (node == null)
continue;
if (!selectedNodes.contains(node))
selectedNodes.add(node);
+ @SuppressWarnings("unchecked")
DBObject r = mapping.inverseGet((JavaObject)node);
selectedItems.add(new VTKSelectionItem<DBObject>(a, node,r));
}
for (INode node : selectedNds) {
if (!selectedNodes.contains(node))
selectedNodes.add((IG3DNode)node);
+ @SuppressWarnings("unchecked")
DBObject r = mapping.inverseGet((JavaObject)node);
selectedItems.add(new VTKSelectionItem<DBObject>(null, (IG3DNode)node,r));
}
import vtk.vtkProp;
import vtk.vtkProperty;
-public class SelectionHighlighter<DBObject, E extends INode> implements ISelectionChangedListener{
+public class SelectionHighlighter<DBObject> implements ISelectionChangedListener {
-
-
protected VtkView panel;
- protected VTKNodeMap<DBObject,E> nodeMap;
+ protected VTKNodeMap<DBObject,?> 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<DBObject,E> nodeMap) {
+ public SelectionHighlighter(VtkView panel, VTKNodeMap<DBObject,?> nodeMap) {
this.panel = panel;
this.nodeMap = nodeMap;
}
}
- protected void hilight(E node, HighlightEventType type) {
+ protected void hilight(INode node, HighlightEventType type) {
if (node instanceof NodeHighlighter) {
((NodeHighlighter)node).highlight(type);
return;
}
for (IG3DNode node : selectedNodes) {
if (!currentSelectedNodes.contains(node)) {
- hilight((E)node, clear);
+ hilight((INode)node, clear);
changed = true;
}
}
for (IG3DNode node : currentSelectedNodes) {
if (!selectedNodes.contains(node)) {
- hilight((E)node, apply);
+ hilight((INode)node, apply);
changed = true;
}
}
return currentSelectedNodes;
}
- protected void setDefaultColor(E node) {
+ protected void setDefaultColor(INode node) {
double color[] = new double[]{1,1,0};
setColor(node, false, color);
}
- protected void setSelectedColor(E node) {
+ protected void setSelectedColor(INode node) {
double color[] = new double[]{1,0,0};
setColor(node, false, color);
}
-
- public void setColor(E node, boolean edge, double color[]) {
+ public void setColor(INode node, boolean edge, double color[]) {
for (vtkProp prop : nodeMap.getRenderObjects(node)) {
if (prop instanceof vtkActor) {
vtkActor act = (vtkActor)prop;
import org.simantics.g3d.tools.AdaptationUtils;\r
import org.simantics.g3d.ui.ScenegraphOutlinePage;\r
\r
-public class VTKContentOutlinePage<DBObject,JavaObject> extends ScenegraphOutlinePage{\r
- private NodeSelectionProvider2<DBObject,JavaObject> provider;\r
+public class VTKContentOutlinePage<DBObject, JavaObject extends INode> extends ScenegraphOutlinePage{\r
+ private NodeSelectionProvider2<DBObject, JavaObject> provider;\r
\r
- public VTKContentOutlinePage(ParentNode<? extends INode> rootNode, NodeSelectionProvider2<DBObject,JavaObject> provider) {\r
+ public VTKContentOutlinePage(ParentNode<? extends JavaObject> rootNode, NodeSelectionProvider2<DBObject, JavaObject> selectionProvider) {\r
super(rootNode);\r
- this.provider = provider;\r
+ this.provider = selectionProvider;\r
}\r
\r
private boolean outsideSelection = false;\r
*******************************************************************************/
package org.simantics.g3d.vtk.common;
-import org.simantics.g3d.scenegraph.IG3DNode;
import org.simantics.g3d.scenegraph.NodeMap;
import org.simantics.g3d.scenegraph.base.INode;
import vtk.vtkProp;
-public interface VTKNodeMap<DBObject,E extends INode> extends NodeMap<DBObject,vtkProp, E>{
-
-
-
+public interface VTKNodeMap<DBObject,E extends INode> extends NodeMap<DBObject, vtkProp, E>{
}
this.resource = res;
}
- @SuppressWarnings("rawtypes")
@Override
- public Object getAdapter(Class adapter) {
- if (adapter == Resource.class)
+ public <T> T getAdapter(Class<T> adapter) {
+ if (adapter.isAssignableFrom(Resource.class))
if (resource instanceof Resource)
- return resource;
+ return adapter.cast(resource);
else
return null;
- if (adapter == StructuralResource.class)
+ if (adapter.isAssignableFrom(StructuralResource.class))
if (resource instanceof StructuralResource)
- return resource;
+ return adapter.cast(resource);
else
return null;
- if (adapter == vtkProp.class)
- return prop;
- if (adapter == IG3DNode.class && node instanceof IG3DNode)
- return node;
- if (adapter == INode.class)
- return node;
+ if (adapter.isAssignableFrom(vtkProp.class))
+ return adapter.cast(prop);
+ if (adapter.isAssignableFrom(IG3DNode.class) && node instanceof IG3DNode)
+ return adapter.cast(node);
+ if (adapter.isAssignableFrom(INode.class))
+ return adapter.cast(node);
return null;
}
*******************************************************************************/
package org.simantics.g3d.vtk.shape;
-import javax.vecmath.Point3d;
import javax.vecmath.Tuple3d;
import vtk.vtkActor;
package org.simantics.g3d.vtk.swt;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
-import javax.vecmath.Vector3d;
-
import org.eclipse.swt.widgets.Composite;
-import org.simantics.g3d.math.Ray;
import org.simantics.g3d.scenegraph.RenderListener;
import org.simantics.g3d.vtk.action.vtkAction;
import org.simantics.g3d.vtk.common.VtkView;
-import org.simantics.g3d.vtk.utils.vtkUtil;
import org.simantics.utils.threads.IThreadWorkQueue;
import org.simantics.utils.threads.SWTThread;
import org.simantics.utils.threads.ThreadUtils;
import vtk.vtkAssemblyNode;
import vtk.vtkAssemblyPath;
import vtk.vtkCellPicker;
-import vtk.vtkCoordinate;
import vtk.vtkObjectBase;
import vtk.vtkPointPicker;
import vtk.vtkProp;
public void lock() {
getVTKLock().lock();
if (getComponent().getContext() != null && !getComponent().getContext().isCurrent()) {
+ @SuppressWarnings("unused")
int ret = getComponent().getContext().makeCurrent();
// System.out.println("Make current2 " + ret);
}
import org.simantics.g3d.math.Ray;
import org.simantics.g3d.preferences.PreferenceConstants;
import org.simantics.g3d.scenegraph.IG3DNode;
+import org.simantics.g3d.scenegraph.base.INode;
import org.simantics.g3d.scenegraph.structural.IStructuralNode;
import org.simantics.g3d.vtk.Activator;
import org.simantics.g3d.vtk.common.VTKNodeMap;
import org.simantics.g3d.vtk.gizmo.RotateAxisGizmo;
import org.simantics.g3d.vtk.utils.vtkUtil;
-import org.simantics.utils.threads.AWTThread;
import org.simantics.utils.threads.ThreadUtils;
import vtk.vtkProp;
public static final int Z = 2;
public static final int P = 3;
- private VTKNodeMap nodeMap;
+ private VTKNodeMap<?, ? extends INode> nodeMap;
//private TranslateGizmo gizmo = new TranslateGizmo();
private RotateAxisGizmo gizmo = new RotateAxisGizmo();
private IG3DNode node;
return node;
}
- public RotateAction(InteractiveVtkComposite panel, VTKNodeMap nodeMap) {
+ public RotateAction(InteractiveVtkComposite panel, VTKNodeMap<?, ? extends INode> nodeMap) {
super(panel);
setImageDescriptor(Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/arrow_rotate_clockwise.png"));
setText("Rotate");
import org.simantics.g3d.math.MathTools;
import org.simantics.g3d.math.Ray;
import org.simantics.g3d.scenegraph.IG3DNode;
+import org.simantics.g3d.scenegraph.base.INode;
import org.simantics.g3d.scenegraph.structural.IStructuralNode;
import org.simantics.g3d.vtk.Activator;
import org.simantics.g3d.vtk.common.VTKNodeMap;
import org.simantics.g3d.vtk.gizmo.TranslateAxisGizmo;
import org.simantics.g3d.vtk.utils.vtkUtil;
-import org.simantics.utils.threads.AWTThread;
import org.simantics.utils.threads.ThreadUtils;
import vtk.vtkProp;
public static final int YZ = 5;
public static final int P = 6;
- private VTKNodeMap nodeMap;
+ private VTKNodeMap<?, ? extends INode> nodeMap;
//private TranslateGizmo gizmo = new TranslateGizmo();
private TranslateAxisGizmo gizmo = new TranslateAxisGizmo();
protected IG3DNode node;
return node;
}
- public TranslateAction(InteractiveVtkComposite panel, VTKNodeMap nodeMap) {
+ public TranslateAction(InteractiveVtkComposite panel, VTKNodeMap<?, ? extends INode> nodeMap) {
super(panel);
setImageDescriptor(Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/arrow_out.png"));
setText("Translate");
<?xml version="1.0" encoding="UTF-8"?>\r
<classpath>\r
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>\r
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
<classpathentry kind="src" path="src"/>\r
<classpathentry kind="output" path="bin"/>\r
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
-org.eclipse.jdt.core.compiler.compliance=1.8
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.8
+eclipse.preferences.version=1\r
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8\r
+org.eclipse.jdt.core.compiler.compliance=1.8\r
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
+org.eclipse.jdt.core.compiler.source=1.8\r
org.simantics.g3d.tools,
org.simantics.g3d.ui,
org.simantics.g3d.wizard
+Automatic-Module-Name: org.simantics.g3d
private static Map<PropertyItem, PropertyManipulator> createManipulators(CompoundPropertyItem item, Object obj) {
try {
+ @SuppressWarnings("unchecked")
Map<String,Object> map = (Map<String, Object>)item.getter.invoke(obj);
Map<PropertyItem, PropertyManipulator> result = new HashMap<AnnotatedPropertyTabContributorFactory.PropertyItem, PropertyManipulator>();
for (String key : map.keySet()) {
return result;
} catch (Exception e) {
e.printStackTrace();
- return Collections.EMPTY_MAP;
+ return Collections.emptyMap();
}
}
if (focusCellManager != null) {
try {
Method m = focusCellManager.getClass().getSuperclass()
- .getDeclaredMethod("init", null);
+ .getDeclaredMethod("init");
m.setAccessible(true);
- m.invoke(focusCellManager, null);
+ m.invoke(focusCellManager);
} catch (SecurityException e) {
e.printStackTrace();
} catch (IllegalArgumentException e) {
if (DEBUG)System.err.println("FOCUS CELL: " + focusCell);
Method m = AbstractTableViewer.class.getDeclaredMethod(
- "getSelectionFromWidget", null);
+ "getSelectionFromWidget");
m.setAccessible(true);
- List l = (List) m.invoke(getViewer(), null);
+ @SuppressWarnings("rawtypes")
+ List l = (List) m.invoke(getViewer());
if (focusCellManager != null) {
m = focusCellManager
.getClass()
ViewerColumn column = (ViewerColumn) m.invoke(viewer,
new Object[] { new Integer(columnIndex) });
m = ViewerColumn.class.getDeclaredMethod(
- "getEditingSupport", null);
+ "getEditingSupport");
m.setAccessible(true);
- EditingSupport es = (EditingSupport) m.invoke(column, null);
+ EditingSupport es = (EditingSupport) m.invoke(column);
if (column != null && es != null) {
m = EditingSupport.class.getDeclaredMethod("canEdit",
new Class[] { Object.class });
m.setAccessible(true);
ViewerColumn column = (ViewerColumn) m.invoke(viewer,
new Object[] { new Integer(cell.getColumnIndex()) });
- m = ViewerColumn.class.getDeclaredMethod("getEditingSupport",
- null);
+ m = ViewerColumn.class.getDeclaredMethod("getEditingSupport");
m.setAccessible(true);
- EditingSupport es = (EditingSupport) m.invoke(column, null);
+ EditingSupport es = (EditingSupport) m.invoke(column);
if (column != null && es != null) {
m = EditingSupport.class.getDeclaredMethod("canEdit",
new Class[] { Object.class });
\r
@Override\r
public Object getValue(Object obj) throws Exception{\r
+ @SuppressWarnings("unchecked")\r
Map<String,Object> map = (Map<String, Object>)getter.invoke(obj);\r
return map.get(key);\r
}\r
+ @SuppressWarnings("unchecked")\r
@Override\r
public void setValue(Object obj, Object value) throws Exception {\r
Map<String,Object> map = new HashMap<String, Object>();\r
import org.simantics.g3d.property.annotations.GetPropertyValue;\r
import org.simantics.g3d.property.annotations.PropertyContributor;\r
import org.simantics.g3d.property.annotations.SetPropertyValue;\r
-import org.simantics.g3d.scenegraph.base.INode;\r
import org.simantics.g3d.scenegraph.base.Node;\r
import org.simantics.g3d.tools.NodeTools;\r
import org.simantics.objmap.graph.annotations.RelatedGetValue;\r
}\r
\r
@Override\r
- public Object getAdapter(Class adapter) {\r
- if (INode.class == adapter)\r
- return this;\r
- if (IG3DNode.class == adapter)\r
- return this;\r
+ public <C> C getAdapter(Class<C> adapter) {\r
+ if (adapter.isInstance(this))\r
+ return adapter.cast(this);\r
return null;\r
}\r
\r
}\r
\r
@Override\r
- public Object getAdapter(Class adapter) {\r
+ public <C> C getAdapter(Class<C> adapter) {\r
return null;\r
}\r
}\r
*******************************************************************************/
package org.simantics.g3d.scenegraph.base;
-import java.util.ArrayList;
-import java.util.List;
-
import org.eclipse.core.runtime.ListenerList;
import org.simantics.objmap.structural.IStructuralObject;\r
import org.simantics.utils.datastructures.MapList;\r
\r
-public abstract class ComponentNode<T extends Connection, T2 extends IComponentNode> extends Node implements IComponentNode<T, T2>{\r
+public abstract class ComponentNode<T extends Connection<T,T2>, T2 extends IComponentNode<T,T2>> extends Node implements IComponentNode<T, T2>{\r
\r
\r
private String name;\r
public List<T2> getAllConnectedNodes() {\r
List<T2> list = new ArrayList<T2>();\r
for (T c : getAllConnections()) {\r
- T2 node = (T2)c.getOther(this);\r
+ T2 node = c.getOther(this);\r
if (node != null)\r
list.add(node);\r
}\r
private MapList<String, T> connections = new MapList<String, T>();\r
\r
\r
+ @SuppressWarnings("unchecked")\r
protected void _addConnection(String id, T c) {\r
connections.add(id, c);\r
- c.addConnect(this);\r
+ c.addConnect((T2) this);\r
firePropertyChanged(id);\r
}\r
\r
public List<T2> getConnectedNodes(String id) {\r
List<T2> list = new ArrayList<T2>();\r
for (T c : getConnections(id)) {\r
- T2 node = (T2)c.getOther(this);\r
+ T2 node = c.getOther(this);\r
if (node != null)\r
list.add(node);\r
}\r
import org.simantics.objmap.structural.IStructuralObject;\r
\r
@SuppressWarnings("rawtypes")\r
-public abstract class Connection <T extends IComponentNode> implements IStructuralObject{\r
+public abstract class Connection<T extends Connection<T, T2>, T2 extends IComponentNode<T, T2>> implements IStructuralObject{\r
\r
+ private List<T2> connects = new ArrayList<T2>();\r
\r
- private List<T> connects = new ArrayList<T>();\r
- \r
- \r
- public void addConnect(T node) {\r
+ public void addConnect(T2 node) {\r
if (!connects.contains(node))\r
connects.add(node);\r
fireChanged(node,true);\r
}\r
\r
- protected void fireChanged(T node, boolean add){\r
- for (IComponentNode n : connects) {\r
- n.connectionChanged(this,node,add);\r
+ @SuppressWarnings("unchecked")\r
+ protected void fireChanged(T2 node, boolean add){\r
+ for (T2 n : connects) {\r
+ n.connectionChanged((T) this,node,add);\r
}\r
}\r
\r
- public Collection<T> getConnected() {\r
+ public Collection<T2> getConnected() {\r
return connects;\r
}\r
\r
- public void removeConnect(T node) {\r
+ public void removeConnect(T2 node) {\r
connects.remove(node);\r
fireChanged(node,false);\r
}\r
\r
+ @SuppressWarnings("unchecked")\r
public void remove() {\r
- List<T> toRemove = new ArrayList<T>(connects.size());\r
+ List<T2> toRemove = new ArrayList<T2>(connects.size());\r
toRemove.addAll(connects);\r
for (IComponentNode node : toRemove) {\r
- node.removeConnection(this);\r
+ node.removeConnection((T) this);\r
}\r
}\r
\r
- public T getOther(T node) {\r
+ public T2 getOther(IComponentNode<T, T2> node) {\r
if (connects.size() != 2) \r
return null;\r
if (connects.get(0).equals(node))\r
import org.simantics.objmap.structural.IStructuralObject;\r
import org.simantics.utils.datastructures.MapList;\r
\r
-public abstract class G3DComponentNode<T extends Connection, T2 extends IComponentNode> extends G3DNode implements IComponentNode<T, T2>{\r
+public abstract class G3DComponentNode<T extends Connection<T,T2>, T2 extends IComponentNode<T,T2>> extends G3DNode implements IComponentNode<T, T2>{\r
\r
\r
private String name;\r
private MapList<String, T> connections = new MapList<String, T>();\r
\r
\r
+ @SuppressWarnings("unchecked")\r
protected void _addConnection(String id, T c) {\r
connections.add(id, c);\r
- c.addConnect(this);\r
+ c.addConnect((T2) this);\r
firePropertyChanged(id);\r
}\r
\r
import org.simantics.g3d.property.annotations.GetPropertyValue;\r
import org.simantics.g3d.property.annotations.SetPropertyValue;\r
import org.simantics.g3d.scenegraph.IG3DNode;\r
-import org.simantics.g3d.scenegraph.base.INode;\r
import org.simantics.g3d.scenegraph.base.NodeException;\r
import org.simantics.g3d.tools.NodeTools;\r
import org.simantics.objmap.graph.annotations.RelatedGetValue;\r
protected Collection<T> _getStrNodes(String id) {\r
return getNodes(id+"/str");\r
}\r
- \r
- public Object getAdapter(Class adapter) {\r
- if (INode.class == adapter)\r
- return this;\r
- if (IG3DNode.class == adapter)\r
- return this;\r
+\r
+ @Override\r
+ public <U> U getAdapter(Class<U> adapter) {\r
+ if (adapter.isInstance(this))\r
+ return adapter.cast(this);\r
return null;\r
}\r
\r
- \r
- \r
}\r
import java.util.List;\r
\r
\r
-@SuppressWarnings("rawtypes")\r
-public interface IComponentNode<T extends Connection, T2 extends IComponentNode> extends IStructuralNode{\r
+public interface IComponentNode<T extends Connection<T,T2>, T2 extends IComponentNode<T,T2>> extends IStructuralNode{\r
\r
public List<T> getAllConnections();\r
//public void addConnection(Connection c);\r
import org.simantics.scl.compiler.types.Type;
import org.simantics.scl.osgi.SCLOsgi;
+@SuppressWarnings("restriction")
public class SCLUtil {
static Map<TCon,Class<?>> typeMap = new HashMap<TCon, Class<?>>();
@Override
public ParentNode<E> getRootNode() {
- return (ParentNode<E>)rootNode;
+ return rootNode;
}
+
+
@Override
public boolean isChangeTracking() {
return changeTracking;
import org.simantics.db.common.NamedResource;\r
import org.simantics.db.common.request.ReadRequest;\r
import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.layer0.Layer0;\r
import org.simantics.ui.utils.ResourceAdaptionUtils;\r
\r
\r
new ReadRequest() {\r
@Override\r
public void run(ReadGraph graph) throws DatabaseException {\r
- Layer0 L0 = Layer0.getInstance(graph);\r
models = getSupportedModels(graph, Simantics.getProject().get());\r
}\r
});\r
<?xml version="1.0" encoding="UTF-8"?>\r
<classpath>\r
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>\r
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
<classpathentry kind="src" path="src"/>\r
<classpathentry kind="output" path="bin"/>\r
-#Wed Aug 08 16:10:05 EEST 2012\r
eclipse.preferences.version=1\r
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
-org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8\r
+org.eclipse.jdt.core.compiler.compliance=1.8\r
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
-org.eclipse.jdt.core.compiler.source=1.6\r
+org.eclipse.jdt.core.compiler.source=1.8\r
javax.vecmath;bundle-version="1.5.2",
org.simantics.utils.datastructures;bundle-version="1.1.0",
org.simantics.g3d.vtk;bundle-version="1.0.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: org.simantics.opencascade.vtk
+Automatic-Module-Name: org.simantics.opencascade.vtk
return assemblies;
}
+ @SuppressWarnings("unused")
private static void gridToAssembly(vtkAssembly assemblies, vtkPolyData partGrid, vtkAppendPolyData stlSurfaceData, vtkAppendPolyData stlEdgeData) {
double featureAngle = 30;
<?xml version="1.0" encoding="UTF-8"?>\r
<classpath>\r
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>\r
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
<classpathentry kind="src" path="src"/>\r
<classpathentry kind="output" path="bin"/>\r
-#Mon Dec 12 17:21:52 EET 2011\r
eclipse.preferences.version=1\r
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled\r
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6\r
-org.eclipse.jdt.core.compiler.compliance=1.6\r
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8\r
+org.eclipse.jdt.core.compiler.compliance=1.8\r
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error\r
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error\r
-org.eclipse.jdt.core.compiler.source=1.6\r
+org.eclipse.jdt.core.compiler.source=1.8\r
org.jcae.opencascade;bundle-version="1.0.0",
org.simantics.utils.datastructures;bundle-version="1.1.0",
org.simantics.g3d;bundle-version="1.0.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: org.simantics.opencascade
+Automatic-Module-Name: org.simantics.opencascade
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>\r
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
+ <classpathentry kind="src" path="src"/>\r
+ <classpathentry kind="output" path="bin"/>\r
+</classpath>\r
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
+org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.compiler.source=1.8
org.simantics.image2.ontology;bundle-version="1.2.0",
org.simantics.silk.ontology;bundle-version="1.1.0",
org.simantics.project.ontology;bundle-version="1.2.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Export-Package: org.simantics.plant3d.ontology
+Automatic-Module-Name: org.simantics.plant3d.ontology
<projects>
</projects>
<buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Bundle-Name: Product
Bundle-SymbolicName: org.simantics.plant3d.product;singleton:=true
Bundle-Version: 1.0.0.qualifier
-Bundle-Activator: org.simantics.plant3d.product.Activator
Require-Bundle: org.eclipse.core.runtime,
org.eclipse.ui;bundle-version="3.7.0",
org.simantics.plant3d;bundle-version="1.0.0",
org.simantics.project;bundle-version="1.0.1"
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Vendor: VTT
-source.. = src/
-output.. = bin/
bin.includes = META-INF/,\
.,\
plugin.xml,\
+++ /dev/null
-package org.simantics.plant3d.product;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-
-public class Activator implements BundleActivator {
-
- private static BundleContext context;
-
- static BundleContext getContext() {
- return context;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext bundleContext) throws Exception {
- Activator.context = bundleContext;
- }
-
- /*
- * (non-Javadoc)
- * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext bundleContext) throws Exception {
- Activator.context = null;
- }
-
-}
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>\r
+<classpath>\r
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>\r
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>\r
+ <classpathentry kind="src" path="src"/>\r
+ <classpathentry kind="output" path="bin"/>\r
+</classpath>\r
org.simantics.structural.ui;bundle-version="1.1.1",
org.simantics.g3d.csg;bundle-version="1.0.0",
org.simantics.utils.thread.swt;bundle-version="1.1.0"
-Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: org.simantics.plant3d.actions,
org.simantics.plant3d.browser,
org.simantics.plant3d.scenegraph.controlpoint,
org.simantics.plant3d.scl,
org.simantics.plant3d.utils
+Automatic-Module-Name: org.simantics.plant3d
private Item toAdd = null;
private PositionType insertPosition;
+ @SuppressWarnings("unused")
private boolean insertAdjustable;
+ @SuppressWarnings("unused")
private boolean lengthAdjustable;
private String libUri;
public class RemoveAndSplitAction extends RemoveAction {
- public RemoveAndSplitAction(VTKNodeMap nodeMap) {
+ public RemoveAndSplitAction(VTKNodeMap<?, ? extends INode> nodeMap) {
super(nodeMap);
setText("Remove/Split");
}
return true;
}
+ @SuppressWarnings("unused")
private Vector3d getLockDir() {
switch (lock) {
case CUSTOM:
return new Vector3d(0,1,0);
case Z:
return new Vector3d(0,0,1);
+ default:
+ return null;
}
- return null;
}
protected void updateRoute(Vector3d o, Vector3d d) {
import org.simantics.g3d.vtk.swt.InteractiveVtkComposite;
import org.simantics.g3d.vtk.utils.vtkUtil;
import org.simantics.plant3d.Activator;
-import org.simantics.plant3d.actions.RoutePipeAction.LockType;
-import org.simantics.plant3d.actions.RoutePipeAction.ToolState;
import org.simantics.plant3d.scenegraph.EndComponent;
import org.simantics.plant3d.scenegraph.InlineComponent;
import org.simantics.plant3d.scenegraph.Nozzle;
import org.simantics.plant3d.scenegraph.PipelineComponent;
import org.simantics.plant3d.scenegraph.TurnComponent;
import org.simantics.plant3d.scenegraph.controlpoint.PipeControlPoint;
-import org.simantics.plant3d.scenegraph.controlpoint.PipingRules;
import org.simantics.plant3d.scenegraph.controlpoint.PipeControlPoint.Direction;
-import org.simantics.plant3d.utils.ComponentUtils;
public class TranslateFreeVariableLengthAction extends RoutePipeAction{
import org.simantics.g3d.math.MathTools;
import org.simantics.g3d.math.Ray;
import org.simantics.g3d.scenegraph.IG3DNode;
+import org.simantics.g3d.scenegraph.base.INode;
import org.simantics.g3d.vtk.common.VTKNodeMap;
import org.simantics.g3d.vtk.swt.InteractiveVtkComposite;
import org.simantics.g3d.vtk.swt.TranslateAction;
private Vector3d e;
private Vector3d dir;
- public TranslateInlineAction(InteractiveVtkComposite panel, VTKNodeMap nodeMap) {
+ public TranslateInlineAction(InteractiveVtkComposite panel, VTKNodeMap<?, ? extends INode> nodeMap) {
super(panel, nodeMap);
setImageDescriptor(Activator.imageDescriptorFromPlugin("com.famfamfam.silk", "icons/arrow_refresh.png"));
}
public class P3DBrowser extends ModelBrowser2 {
+ @SuppressWarnings("deprecation")
@Override
protected Set<String> getBrowseContexts() {
return browseContexts;
@Override
public Object[] getElements(Object inputElement) {
+ @SuppressWarnings("unchecked")
List<Item> list = (List<Item>)inputElement;
return list.toArray();
}
node.update(view.getRenderer());
if (node instanceof ParentNode<?>) {
+ @SuppressWarnings("unchecked")
ParentNode<IP3DNode> p = (ParentNode<IP3DNode>)node;
for (IP3DNode n : p.getNodes())
updateTransform(n);
import vtk.vtkSSAAPass;
import vtk.vtkSequencePass;
import vtk.vtkSimpleMotionBlurPass;
-import vtk.vtkSobelGradientMagnitudePass;
public class Plant3DEditor extends ResourceEditorPart {
return new NodeSelectionProvider2<Resource,INode>(this,mapping,nodeMap);
}
- protected HoverHighlighter createHoverHighlhighter() {
- return new HoverHighlighter(panel,nodeMap);
+ protected HoverHighlighter<Resource> createHoverHighlhighter() {
+ return new HoverHighlighter<>(panel,nodeMap);
}
- protected SelectionHighlighter<Resource,INode> createSelectionHighlighter() {
- return new SelectionHighlighter<Resource,INode>(panel,nodeMap);
+ protected SelectionHighlighter<Resource> createSelectionHighlighter() {
+ return new SelectionHighlighter<Resource>(panel,nodeMap);
}
protected String getLibraryUri() {
return outlinePage;
}
- @SuppressWarnings("rawtypes")
@Override
- public Object getAdapter(Class adapter) {
- if (IPropertyPage.class.equals(adapter))
- return new StandardPropertyPage(getSite(),getPropertyContexts());
- if (IContentOutlinePage.class.equals(adapter)) {
- return createOutline();
+ public <T> T getAdapter(Class<T> adapter) {
+ if (adapter.isAssignableFrom(IPropertyPage.class))
+ return adapter.cast(new StandardPropertyPage(getSite(),getPropertyContexts()));
+ if (adapter.isAssignableFrom(ISelectionProvider.class))
+ return adapter.cast(selectionProvider);
+ if (adapter.isAssignableFrom(IContentOutlinePage.class)) {
+ return adapter.cast(createOutline());
}
- if (NodeMap.class.equals(adapter)) {
- return nodeMap;
+ if (adapter.isAssignableFrom(NodeMap.class)) {
+ return adapter.cast(nodeMap);
}
- if (INode.class.equals(adapter)) {
- return rootNode;
+ if (adapter.isAssignableFrom(INode.class)) {
+ return adapter.cast(rootNode);
}
- if (IMapping.class.equals(adapter)) {
- return mapping;
+ if (adapter.isAssignableFrom(IMapping.class)) {
+ return adapter.cast(mapping);
}
-// if (InteractiveVtkPanel.class.equals(adapter)) {
-// return panel;
+// if (adapter.isAssignableFrom(InteractiveVtkPanel.class)) {
+// return adapter.cast(panel);
// }
- if (VtkView.class.equals(adapter))
- return panel;
- if (ISelectionProvider.class.equals(adapter))
- return selectionProvider;
+ if (adapter.isAssignableFrom(VtkView.class))
+ return adapter.cast(panel);
return super.getAdapter(adapter);
}
}
@Override
- public Object getAdapter(Class adapter) {
- if (IG3DNode.class == adapter)
- return this;
+ public <C> C getAdapter(Class<C> adapter) {
+ if (adapter.isInstance(this))
+ return adapter.cast(this);
return null;
}
}
- @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;
}
package org.simantics.plant3d.scenegraph;
import java.util.Map;
-import java.util.Set;
import org.simantics.g3d.scenegraph.IG3DNode;
@Override
public Collection<vtkProp3D> getActors() {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
@Override
}
+ @SuppressWarnings("deprecation")
@RelatedGetValue(Plant3D.URIs.HasTurnRadius)
@GetPropertyValue(value=Plant3D.URIs.HasTurnRadius, name = "Elbow radius")
public double getTurnRadius() {
return turnRadius[0];
}
+ @SuppressWarnings("deprecation")
@RelatedSetValue(Plant3D.URIs.HasTurnRadius)
@SetPropertyValue(Plant3D.URIs.HasTurnRadius)
public void setTurnRadius(double turnRadius) {
}
public Map<String,Object> updateParameterMap() {
- return Collections.EMPTY_MAP;
+ return Collections.emptyMap();
}
public abstract String getType();
}
+ @SuppressWarnings("unused")
private static boolean calculateOffset(Vector3d startPoint, Vector3d endPoint, ArrayList<PipeControlPoint> list, Vector3d dir, Vector3d offset) {
boolean hasOffsets = false;
List<PipeControlPoint> offsets = new ArrayList<PipeControlPoint>(list.size());
// position of the
// component
dir.add(prevPos);
- PipeControlPoint scp = insertStraight(prev, icp, dir, length);
+ insertStraight(prev, icp, dir, length);
return true;
} else {
triedIR = true;
// end,Point3d endPoint, Vector3d dir, boolean hasOffsets,int iter, boolean
// reversed, ArrayList<ExpandIterInfo> toRemove) throws TransactionException
// {
+ @SuppressWarnings("unused")
private static void processPathLegNoOffset(UpdateStruct2 u) throws Exception {
if (DEBUG)
System.out.println("PipingRules.processPathLeg " + u.start + " " + u.end);
// this should not be possible
throw new RuntimeException("VariableLengthComponent " + splittingComponent + " is not connected to anything.");
}
- double reservedLength = splittingComponent.getControlPoint().getLength();
double newLength = newComponent.getControlPoint().getLength();
vn.interpolate(next, 0.5);
- PipeControlPoint newVariableLengthCP = null;//insertStraight(pcp1, pcp2, pos, length);
if (nextCP == null) {
newCP.insert(splittingCP, Direction.NEXT);
- newVariableLengthCP = insertStraight(newCP, Direction.NEXT, new Vector3d(vn), ln);
+ insertStraight(newCP, Direction.NEXT, new Vector3d(vn), ln);
splittingCP.setWorldPosition(new Vector3d(vp));
// ControlPointTools.setWorldPosition(splittingCP, vp);
// splittingCP.setRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength, lp);
} else if (prevCP == null) {
newCP.insert(splittingCP, Direction.PREVIOUS);
- newVariableLengthCP = insertStraight(newCP, Direction.PREVIOUS, new Vector3d(vp), lp);
+ insertStraight(newCP, Direction.PREVIOUS, new Vector3d(vp), lp);
splittingCP.setWorldPosition(new Vector3d(vn));
// splittingCP.setRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength, ln);
} else {
newCP.insert(splittingCP, nextCP);
- newVariableLengthCP = insertStraight(newCP, nextCP, new Vector3d(vn), ln);
+ insertStraight(newCP, nextCP, new Vector3d(vn), ln);
splittingCP.setWorldPosition(new Vector3d(vp));
// splittingCP.setRelatedScalarDouble(ProcessResource.plant3Dresource.HasLength, lp);
}
import java.util.List;
import java.util.Map;
-import javax.vecmath.Point3d;
import javax.vecmath.Vector3d;
import org.simantics.Simantics;
pipeRun = toPcp.getPipeRun();
}
break;
+ default:
+ break;
}
Vector3d start = new Vector3d();
Vector3d end = new Vector3d();
case SPLIT:
pos = new Vector3d(toPcp.getWorldPosition());
break;
+ default:
+ break;
}
} else if (toPcp.isDirected()) {
break;
case SPLIT:
break;
+ default:
+ break;
}
switch (position) {
break;
case SPLIT:
PipingRules.splitVariableLengthComponent(newComponent, (InlineComponent)component, true);
+ default:
+ break;
}
} else {
PipeRun other = new PipeRun();
break;
case SPLIT:
break;
+ default:
+ break;
}
newPcp.setWorldPosition(pos);
// Runs do not have compatible specs, and a reducer must be attached in between.
InlineComponent reducer = ComponentUtils.createReducer(root);
PipeControlPoint pcp = reducer.getControlPoint();
- PipeControlPoint ocp = pcp.getSubPoint().get(0);
Vector3d endPos = endCP.getWorldPosition();
Vector3d currentPos = currentCP.getWorldPosition();
@Override
public List<Item> perform(ReadGraph graph) throws DatabaseException {
- Resource project = Simantics.getProject().get();
+// Resource project = Simantics.getProject().get();
Resource builtins = graph.getResource(libUri);
List<Item> actions = new ArrayList<>();
// actions.addAll(getItems(graph, project,type));
<projects>
</projects>
<buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
-source.. = src/
-output.. = bin/
bin.includes = META-INF/,\
.
* Commissariat a l'Energie Atomique et aux Energies Alternatives,
* 15 avenue des Sablieres, CS 60001, 33116 Le Barp, France.
*/
+@SuppressWarnings("restriction")
public class vtkSwtInteractorForwarderDecorator extends vtkInteractorForwarder
implements MouseListener, MouseMoveListener, MouseTrackListener, MouseWheelListener, KeyListener {
* Commissariat a l'Energie Atomique et aux Energies Alternatives,
* 15 avenue des Sablieres, CS 60001, 33116 Le Barp, France.
*/
+@SuppressWarnings("restriction")
public abstract class vtkAbstractComponent<T> implements vtkComponent<T> {
protected vtkRenderWindow renderWindow;
protected vtkRenderer renderer;
<projects>
</projects>
<buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
<buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
-source.. = src/
-output.. = bin/
bin.includes = META-INF/,\
.,\
vtkChartsCore.dll,\