1 /*******************************************************************************
2 * Copyright (c) 2012, 2013 Association for Decentralized Information Management in
4 * All rights reserved. This program and the accompanying materials
5 * are made available under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution, and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * VTT Technical Research Centre of Finland - initial API and implementation
11 *******************************************************************************/
12 package org.simantics.g3d.vtk.common;
14 import org.eclipse.core.runtime.IAdaptable;
15 import org.simantics.db.Resource;
16 import org.simantics.g3d.scenegraph.IG3DNode;
17 import org.simantics.g3d.scenegraph.base.INode;
18 import org.simantics.objmap.structural.StructuralResource;
22 public class VTKSelectionItem<DBObject> implements IAdaptable{
25 private IG3DNode node;
26 private DBObject resource;
28 public VTKSelectionItem(vtkProp prop, IG3DNode node, DBObject res) {
34 @SuppressWarnings("rawtypes")
36 public Object getAdapter(Class adapter) {
37 if (adapter == Resource.class)
38 if (resource instanceof Resource)
42 if (adapter == StructuralResource.class)
43 if (resource instanceof StructuralResource)
47 if (adapter == vtkProp.class)
49 if (adapter == IG3DNode.class)
51 if (adapter == INode.class)
56 @SuppressWarnings("rawtypes")
58 public boolean equals(Object obj) {
61 if (obj.getClass() != this.getClass())
63 VTKSelectionItem other = (VTKSelectionItem)obj;
65 if (!prop.equals(other.prop))
68 if (!node.equals(other.node))
71 return resource.equals(other.resource);