1 /*******************************************************************************
\r
2 * Copyright (c) 2012, 2013 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.g3d.vtk.common;
\r
14 import org.eclipse.core.runtime.IAdaptable;
\r
15 import org.simantics.db.Resource;
\r
16 import org.simantics.g3d.scenegraph.IG3DNode;
\r
17 import org.simantics.g3d.scenegraph.base.INode;
\r
18 import org.simantics.objmap.structural.StructuralResource;
\r
22 public class VTKSelectionItem<DBObject> implements IAdaptable{
\r
24 private vtkProp prop;
\r
25 private IG3DNode node;
\r
26 private DBObject resource;
\r
28 //private VTKpropSet actors;
\r
31 public VTKSelectionItem(vtkProp prop, IG3DNode node, DBObject res) {
\r
34 this.resource = res;
\r
37 // public VTKSelectionItem(Resource res, Collection<vtkProp> actors) {
\r
38 // this.resource = res;
\r
39 // this.actors = new VTKpropSet();
\r
40 // this.actors.addAll(actors);
\r
43 // public VTKSelectionItem(Resource res, vtkProp... actors) {
\r
44 // this.resource = res;
\r
45 // this.actors = new VTKpropSet();
\r
46 // for (vtkProp a : actors)
\r
47 // this.actors.add(a);
\r
50 @SuppressWarnings("rawtypes")
\r
52 public Object getAdapter(Class adapter) {
\r
53 if (adapter == Resource.class)
\r
54 if (resource instanceof Resource)
\r
58 if (adapter == StructuralResource.class)
\r
59 if (resource instanceof StructuralResource)
\r
63 if (adapter == vtkProp.class)
\r
65 if (adapter == IG3DNode.class)
\r
67 if (adapter == INode.class)
\r
72 // @SuppressWarnings("rawtypes")
\r
74 // public Object getAdapter(Class adapter) {
\r
75 // if (adapter == Resource.class)
\r
77 // if (adapter == VTKpropSet.class)
\r
82 // public Resource getResource() {
\r
86 // public VTKpropSet getActors() {
\r
90 @SuppressWarnings("rawtypes")
\r
92 public boolean equals(Object obj) {
\r
95 if (obj.getClass() != this.getClass())
\r
97 VTKSelectionItem other = (VTKSelectionItem)obj;
\r
99 return prop.equals(other.prop);
\r
101 return node.equals(other.node);
\r
102 return resource.equals(other.resource);
\r
103 //return resource.equals(other.resource);
\r